Add Edit Admin
This commit is contained in:
parent
a06d7db0b1
commit
d17c434c7b
@ -191,6 +191,8 @@ CREATE TABLE `tb_languages` (
|
||||
ALTER TABLE `tbl_voucher` ADD `generated_by` INT NOT NULL DEFAULT '0' COMMENT 'id admin' AFTER `status`;
|
||||
ALTER TABLE `tbl_users` ADD `root` INT NOT NULL DEFAULT '0' COMMENT 'for sub account' AFTER `id`;
|
||||
ALTER TABLE `tbl_users` CHANGE `user_type` `user_type` ENUM('SuperAdmin','Admin','Report','Agent','Sales') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;
|
||||
ALTER TABLE `tbl_users` CHANGE `password` `password` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;
|
||||
ALTER TABLE `tbl_users` ADD `phone` VARCHAR(32) NOT NULL DEFAULT '' AFTER `password`, ADD `email` VARCHAR(128) NOT NULL DEFAULT '' AFTER `phone`, ADD `city` VARCHAR(64) NOT NULL DEFAULT '' COMMENT 'kota' AFTER `email`, ADD `subdistrict` VARCHAR(64) NOT NULL DEFAULT '' COMMENT 'kecamatan' AFTER `city`, ADD `ward` VARCHAR(64) NOT NULL DEFAULT '' COMMENT 'kelurahan' AFTER `subdistrict`;
|
||||
|
||||
ALTER TABLE `tbl_appconfig`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
@ -309,7 +311,7 @@ VALUES (
|
||||
'admin',
|
||||
'Administrator',
|
||||
'd033e22ae348aeb5660fc2140aec35850c4da997',
|
||||
'Admin',
|
||||
'SuperAdmin',
|
||||
'Active',
|
||||
'2022-09-06 16:09:50',
|
||||
'2014-06-23 01:43:07'
|
||||
|
@ -192,7 +192,7 @@ class Lang
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (iPhone; CPU OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/28.1 Mobile/15E148 Safari/605.1.15");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||
curl_setopt ($ch, CURLOPT_HEADER, 0);
|
||||
$hasil = curl_exec ($ch);
|
||||
curl_close($ch);
|
||||
|
@ -9,9 +9,6 @@ _admin();
|
||||
$ui->assign('_title', Lang::T('Dashboard'));
|
||||
$admin = Admin::_info();
|
||||
$ui->assign('_admin', $admin);
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
r2(U . "home", 'e', Lang::T('You do not have permission to access this page'));
|
||||
}
|
||||
|
||||
$fdate = date('Y-m-01');
|
||||
$tdate = date('Y-m-t');
|
||||
|
@ -76,7 +76,7 @@ switch ($action) {
|
||||
$folders = [];
|
||||
$files = scandir('system/lan/');
|
||||
foreach ($files as $file) {
|
||||
if (is_file('system/lan/' . $file) && !in_array($file, ['index.html', 'country.json','.DS_Store'])) {
|
||||
if (is_file('system/lan/' . $file) && !in_array($file, ['index.html', 'country.json', '.DS_Store'])) {
|
||||
$file = str_replace(".json", "", $file);
|
||||
$folders[$file] = '';
|
||||
}
|
||||
@ -84,7 +84,7 @@ switch ($action) {
|
||||
$ui->assign('lani', $folders);
|
||||
$lans = Lang::getIsoLang();
|
||||
foreach ($lans as $lan => $val) {
|
||||
if(isset($folders[$lan])){
|
||||
if (isset($folders[$lan])) {
|
||||
unset($lans[$lan]);
|
||||
}
|
||||
}
|
||||
@ -97,19 +97,56 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'users':
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin', 'Agent'])) {
|
||||
r2(U . "dashboard", 'e', Lang::T('You do not have permission to access this page'));
|
||||
}
|
||||
|
||||
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/users.js"></script>');
|
||||
|
||||
$username = _post('username');
|
||||
if ($username != '') {
|
||||
$paginator = Paginator::build(ORM::for_table('tbl_users'), ['username' => '%' . $username . '%'], $username);
|
||||
$d = ORM::for_table('tbl_users')->where_like('username', '%' . $username . '%')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_asc('id')->find_many();
|
||||
if ($admin['user_type'] == 'SuperAdmin') {
|
||||
$paginator = Paginator::build(ORM::for_table('tbl_users'), ['username' => '%' . $username . '%'], $username);
|
||||
$d = ORM::for_table('tbl_users')
|
||||
->where_like('username', '%' . $username . '%')
|
||||
->offset($paginator['startpoint'])
|
||||
->limit($paginator['limit'])->order_by_asc('id')->find_many();
|
||||
} else if ($admin['user_type'] == 'Admin') {
|
||||
$paginator = Paginator::build(ORM::for_table('tbl_users'), [
|
||||
'username' => '%' . $username . '%',
|
||||
['user_type' => 'Report'],
|
||||
['user_type' => 'Agent'],
|
||||
['user_type' => 'Sales']
|
||||
], $username);
|
||||
$d = ORM::for_table('tbl_users')
|
||||
->where_like('username', '%' . $username . '%')
|
||||
->where_any_is([
|
||||
['user_type' => 'Report'],
|
||||
['user_type' => 'Agent'],
|
||||
['user_type' => 'Sales']
|
||||
])
|
||||
->offset($paginator['startpoint'])
|
||||
->limit($paginator['limit'])->order_by_asc('id')->find_many();
|
||||
} else {
|
||||
$paginator = Paginator::build(ORM::for_table('tbl_users'), ['username' => '%' . $username . '%'], $username);
|
||||
$d = ORM::for_table('tbl_users')
|
||||
->where_like('username', '%' . $username . '%')
|
||||
->where('root', $admin['id'])
|
||||
->offset($paginator['startpoint'])
|
||||
->limit($paginator['limit'])->order_by_asc('id')->find_many();
|
||||
}
|
||||
} else {
|
||||
$paginator = Paginator::build(ORM::for_table('tbl_users'));
|
||||
$d = ORM::for_table('tbl_users')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_asc('id')->find_many();
|
||||
if ($admin['user_type'] == 'SuperAdmin') {
|
||||
$paginator = Paginator::build(ORM::for_table('tbl_users'));
|
||||
$d = ORM::for_table('tbl_users')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_asc('id')->find_many();
|
||||
} else if ($admin['user_type'] == 'Admin') {
|
||||
$paginator = Paginator::build(ORM::for_table('tbl_users'));
|
||||
$d = ORM::for_table('tbl_users')->where_any_is([
|
||||
['user_type' => 'Report'],
|
||||
['user_type' => 'Agent'],
|
||||
['user_type' => 'Sales']
|
||||
])->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_asc('id')->find_many();
|
||||
} else {
|
||||
$paginator = Paginator::build(ORM::for_table('tbl_users'));
|
||||
$d = ORM::for_table('tbl_users')->where('root', $admin['id'])->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_asc('id')->find_many();
|
||||
}
|
||||
}
|
||||
|
||||
$ui->assign('d', $d);
|
||||
@ -119,21 +156,36 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case 'users-add':
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin', 'Agent'])) {
|
||||
r2(U . "dashboard", 'e', Lang::T('You do not have permission to access this page'));
|
||||
}
|
||||
run_hook('view_add_admin'); #HOOK
|
||||
$ui->assign('_title', Lang::T('Add User'));
|
||||
$ui->display('users-add.tpl');
|
||||
break;
|
||||
|
||||
case 'users-edit':
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
|
||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin', 'Agent'])) {
|
||||
r2(U . "dashboard", 'e', Lang::T('You do not have permission to access this page'));
|
||||
}
|
||||
|
||||
$ui->assign('_title', Lang::T('Edit User'));
|
||||
$id = $routes['2'];
|
||||
$d = ORM::for_table('tbl_users')->find_one($id);
|
||||
if ($admin['id'] == $id) {
|
||||
$d = ORM::for_table('tbl_users')->find_one($id);
|
||||
} else {
|
||||
if ($admin['user_type'] == 'SuperAdmin') {
|
||||
$d = ORM::for_table('tbl_users')->find_one($id);
|
||||
} else if ($admin['user_type'] == 'Admin') {
|
||||
$d = ORM::for_table('tbl_users')->where_any_is([
|
||||
['user_type' => 'Report'],
|
||||
['user_type' => 'Agent'],
|
||||
['user_type' => 'Sales']
|
||||
])->find_one($id);
|
||||
} else {
|
||||
$d = ORM::for_table('tbl_users')->where('root', $admin['id'])->find_one($id);
|
||||
}
|
||||
}
|
||||
if ($d) {
|
||||
$ui->assign('id', $id);
|
||||
$ui->assign('d', $d);
|
||||
run_hook('view_edit_admin'); #HOOK
|
||||
$ui->display('users-edit.tpl');
|
||||
@ -165,20 +217,22 @@ switch ($action) {
|
||||
$username = _post('username');
|
||||
$fullname = _post('fullname');
|
||||
$password = _post('password');
|
||||
$cpassword = _post('cpassword');
|
||||
$user_type = _post('user_type');
|
||||
$phone = _post('phone');
|
||||
$email = _post('email');
|
||||
$city = _post('city');
|
||||
$subdistrict = _post('subdistrict');
|
||||
$ward = _post('ward');
|
||||
$send_notif = _post('send_notif');
|
||||
$msg = '';
|
||||
if (Validator::Length($username, 16, 2) == false) {
|
||||
$msg .= 'Username should be between 3 to 15 characters' . '<br>';
|
||||
if (Validator::Length($username, 45, 2) == false) {
|
||||
$msg .= Lang::T('Username should be between 3 to 45 characters') . '<br>';
|
||||
}
|
||||
if (Validator::Length($fullname, 26, 2) == false) {
|
||||
$msg .= 'Full Name should be between 3 to 25 characters' . '<br>';
|
||||
if (Validator::Length($fullname, 45, 2) == false) {
|
||||
$msg .= Lang::T('Full Name should be between 3 to 45 characters') . '<br>';
|
||||
}
|
||||
if (!Validator::Length($password, 15, 5)) {
|
||||
$msg .= 'Password should be between 6 to 15 characters' . '<br>';
|
||||
}
|
||||
if ($password != $cpassword) {
|
||||
$msg .= 'Passwords does not match' . '<br>';
|
||||
if (!Validator::Length($password, 1000, 5)) {
|
||||
$msg .= Lang::T('Password should be minimum 6 characters') . '<br>';
|
||||
}
|
||||
|
||||
$d = ORM::for_table('tbl_users')->where('username', $username)->find_one();
|
||||
@ -194,12 +248,22 @@ switch ($action) {
|
||||
$d->fullname = $fullname;
|
||||
$d->password = $password;
|
||||
$d->user_type = $user_type;
|
||||
$d->phone = $phone;
|
||||
$d->email = $email;
|
||||
$d->city = $city;
|
||||
$d->subdistrict = $subdistrict;
|
||||
$d->ward = $ward;
|
||||
$d->status = 'Active';
|
||||
$d->creationdate = $date_now;
|
||||
|
||||
$d->save();
|
||||
|
||||
_log('[' . $admin['username'] . ']: ' . Lang::T('Account Created Successfully'), $admin['user_type'], $admin['id']);
|
||||
if ($send_notif == 'wa') {
|
||||
Message::sendWhatsapp(Lang::phoneFormat($phone), Lang::T('Hello, Your account has been created successfully.') . "\nUsername: $username\nPassword: $password\n\n" . $config['CompanyName']);
|
||||
} else if ($send_notif == 'sms') {
|
||||
Message::sendSMS($phone, Lang::T('Hello, Your account has been created successfully.') . "\nUsername: $username\nPassword: $password\n\n" . $config['CompanyName']);
|
||||
}
|
||||
|
||||
_log('[' . $admin['username'] . ']: ' . "Created $user_type <b>$username</b>", $admin['user_type'], $admin['id']);
|
||||
r2(U . 'settings/users', 's', Lang::T('Account Created Successfully'));
|
||||
} else {
|
||||
r2(U . 'settings/users-add', 'e', $msg);
|
||||
@ -211,34 +275,53 @@ switch ($action) {
|
||||
$fullname = _post('fullname');
|
||||
$password = _post('password');
|
||||
$cpassword = _post('cpassword');
|
||||
|
||||
$user_type = _post('user_type');
|
||||
$phone = _post('phone');
|
||||
$email = _post('email');
|
||||
$city = _post('city');
|
||||
$subdistrict = _post('subdistrict');
|
||||
$ward = _post('ward');
|
||||
$status = _post('status');
|
||||
$msg = '';
|
||||
if (Validator::Length($username, 16, 2) == false) {
|
||||
$msg .= 'Username should be between 3 to 15 characters' . '<br>';
|
||||
if (Validator::Length($username, 45, 2) == false) {
|
||||
$msg .= Lang::T('Username should be between 3 to 45 characters') . '<br>';
|
||||
}
|
||||
if (Validator::Length($fullname, 26, 2) == false) {
|
||||
$msg .= 'Full Name should be between 3 to 25 characters' . '<br>';
|
||||
if (Validator::Length($fullname, 45, 2) == false) {
|
||||
$msg .= Lang::T('Full Name should be between 3 to 45 characters') . '<br>';
|
||||
}
|
||||
if ($password != '') {
|
||||
if (!Validator::Length($password, 15, 5)) {
|
||||
$msg .= 'Password should be between 6 to 15 characters' . '<br>';
|
||||
if (!Validator::Length($password, 1000, 5)) {
|
||||
$msg .= Lang::T('Password should be minimum 6 characters') . '<br>';
|
||||
}
|
||||
if ($password != $cpassword) {
|
||||
$msg .= 'Passwords does not match' . '<br>';
|
||||
$msg .= Lang::T('Passwords does not match') . '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
$id = _post('id');
|
||||
$d = ORM::for_table('tbl_users')->find_one($id);
|
||||
if ($d) {
|
||||
if ($admin['id'] == $id) {
|
||||
$d = ORM::for_table('tbl_users')->find_one($id);
|
||||
} else {
|
||||
if ($admin['user_type'] == 'SuperAdmin') {
|
||||
$d = ORM::for_table('tbl_users')->find_one($id);
|
||||
} else if ($admin['user_type'] == 'Admin') {
|
||||
$d = ORM::for_table('tbl_users')->where_any_is([
|
||||
['user_type' => 'Report'],
|
||||
['user_type' => 'Agent'],
|
||||
['user_type' => 'Sales']
|
||||
])->find_one($id);
|
||||
} else {
|
||||
$d = ORM::for_table('tbl_users')->where('root', $admin['id'])->find_one($id);
|
||||
}
|
||||
}
|
||||
if (!$d) {
|
||||
$msg .= Lang::T('Data Not Found') . '<br>';
|
||||
}
|
||||
|
||||
if ($d['username'] != $username) {
|
||||
$c = ORM::for_table('tbl_users')->where('username', $username)->find_one();
|
||||
if ($c) {
|
||||
$msg .= Lang::T('Account already axist') . '<br>';
|
||||
$msg .= "<b>$username</b> ".Lang::T('Account already axist') . '<br>';
|
||||
}
|
||||
}
|
||||
run_hook('edit_admin'); #HOOK
|
||||
@ -254,10 +337,16 @@ switch ($action) {
|
||||
$user_type = _post('user_type');
|
||||
$d->user_type = $user_type;
|
||||
}
|
||||
$d->phone = $phone;
|
||||
$d->email = $email;
|
||||
$d->city = $city;
|
||||
$d->subdistrict = $subdistrict;
|
||||
$d->ward = $ward;
|
||||
$d->status = $status;
|
||||
|
||||
$d->save();
|
||||
|
||||
_log('[' . $admin['username'] . ']: ' . Lang::T('User Updated Successfully'), $admin['user_type'], $admin['id']);
|
||||
_log('[' . $admin['username'] . ']: $username ' . Lang::T('User Updated Successfully'), $admin['user_type'], $admin['id']);
|
||||
r2(U . 'settings/users', 's', 'User Updated Successfully');
|
||||
} else {
|
||||
r2(U . 'settings/users-edit/' . $id, 'e', $msg);
|
||||
@ -308,9 +397,9 @@ switch ($action) {
|
||||
}
|
||||
|
||||
//checkbox
|
||||
$checks = ['hide_mrc','hide_tms','hide_aui','hide_al','hide_uet','hide_vs','hide_pg'];
|
||||
$checks = ['hide_mrc', 'hide_tms', 'hide_aui', 'hide_al', 'hide_uet', 'hide_vs', 'hide_pg'];
|
||||
foreach ($checks as $check) {
|
||||
if(!isset($_POST[$check])){
|
||||
if (!isset($_POST[$check])) {
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', $check)->find_one();
|
||||
if ($d) {
|
||||
$d->value = 'no';
|
||||
@ -553,7 +642,7 @@ switch ($action) {
|
||||
run_hook('view_add_language'); #HOOK
|
||||
if (file_exists($lan_file)) {
|
||||
$ui->assign('langs', json_decode(file_get_contents($lan_file), true));
|
||||
}else{
|
||||
} else {
|
||||
$ui->assign('langs', []);
|
||||
}
|
||||
$ui->display('language-add.tpl');
|
||||
|
@ -393,5 +393,16 @@
|
||||
"Active Users": "Active Users",
|
||||
"All Users Insights": "All Users Insights",
|
||||
"Radius": "Radius",
|
||||
"Radius NAS": "Radius NAS"
|
||||
"Radius NAS": "Radius NAS",
|
||||
"Profile": "Profile",
|
||||
"Credentials": "Credentials",
|
||||
"Phone": "Phone",
|
||||
"City": "City",
|
||||
"Sub District": "Sub District",
|
||||
"Ward": "Ward",
|
||||
"Send Notification": "Send Notification",
|
||||
"Add User": "Add User",
|
||||
"Username should be between 3 to 45 characters": "Username should be between 3 to 45 characters",
|
||||
"Password should be minimum 6 characters": "Password should be minimum 6 characters",
|
||||
"Login": "Login"
|
||||
}
|
@ -48,5 +48,9 @@
|
||||
],
|
||||
"2024.2.12": [
|
||||
"ALTER TABLE `tbl_users` CHANGE `user_type` `user_type` ENUM('SuperAdmin','Admin','Report','Agent','Sales') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;"
|
||||
],
|
||||
"2024.2.15":[
|
||||
"ALTER TABLE `tbl_users` CHANGE `password` `password` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;",
|
||||
"ALTER TABLE `tbl_users` ADD `phone` VARCHAR(32) NOT NULL DEFAULT '' AFTER `password`, ADD `email` VARCHAR(128) NOT NULL DEFAULT '' AFTER `phone`, ADD `city` VARCHAR(64) NOT NULL DEFAULT '' COMMENT 'kota' AFTER `email`, ADD `subdistrict` VARCHAR(64) NOT NULL DEFAULT '' COMMENT 'kecamatan' AFTER `city`, ADD `ward` VARCHAR(64) NOT NULL DEFAULT '' COMMENT 'kelurahan' AFTER `subdistrict`;"
|
||||
]
|
||||
}
|
@ -84,7 +84,7 @@
|
||||
|
||||
<p>
|
||||
{$_admin['fullname']}
|
||||
<small>{if $_admin['user_type'] eq 'Admin'} {Lang::T('Administrator')}
|
||||
<small>{if $_admin['user_type'] eq 'SuperAdmin'} {Lang::T('Administrator')}
|
||||
{else}
|
||||
{Lang::T('Sales')} {/if}</small>
|
||||
</p>
|
||||
@ -124,7 +124,7 @@
|
||||
</a>
|
||||
</li>
|
||||
{$_MENU_AFTER_DASHBOARD}
|
||||
{if $_admin['user_type'] eq 'Admin' || $_admin['user_type'] eq 'Sales'}
|
||||
{if in_array($_admin['user_type'],['SuperAdmin','Admin'])}
|
||||
<li class="{if $_system_menu eq 'customers'}active{/if} treeview">
|
||||
<a href="#">
|
||||
<i class="ion ion-android-contacts"></i> <span>{Lang::T('Customer')}</span>
|
||||
@ -204,7 +204,7 @@
|
||||
</li>
|
||||
{$_MENU_AFTER_REPORTS}
|
||||
{/if}
|
||||
{if $_admin['user_type'] eq 'Admin'}
|
||||
{if in_array($_admin['user_type'],['SuperAdmin','Admin'])}
|
||||
<li class="{if $_system_menu eq 'network'}active{/if} treeview">
|
||||
<a href="#">
|
||||
<i class="ion ion-network"></i> <span>{Lang::T('Network')}</span>
|
||||
@ -215,10 +215,6 @@
|
||||
<ul class="treeview-menu">
|
||||
<li {if $_routes[0] eq 'routers' and $_routes[1] eq 'list'}class="active" {/if}><a
|
||||
href="{$_url}routers/list">{Lang::T('Routers')}</a></li>
|
||||
{if $_c['radius_enable']}
|
||||
<li {if $_routes[0] eq 'radius' and $_routes[1] eq 'nas-list'}class="active" {/if}><a
|
||||
href="{$_url}radius/nas-list">Radius NAS</a></li>
|
||||
{/if}
|
||||
<li {if $_routes[0] eq 'pool' and $_routes[1] eq 'list'}class="active" {/if}><a
|
||||
href="{$_url}pool/list">{Lang::T('IP Pool')}</a></li>
|
||||
{$_MENU_NETWORK}
|
||||
@ -226,21 +222,21 @@
|
||||
</li>
|
||||
{$_MENU_AFTER_NETWORKS}
|
||||
{if $_c['radius_enable']}
|
||||
<li class="{if $_system_menu eq 'radius'}active{/if} treeview">
|
||||
<a href="#">
|
||||
<i class="fa fa-database"></i> <span>{Lang::T('Radius')}</span>
|
||||
<span class="pull-right-container">
|
||||
<i class="fa fa-angle-left pull-right"></i>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu">
|
||||
<li {if $_routes[0] eq 'radius' and $_routes[1] eq 'nas-list'}class="active" {/if}><a
|
||||
href="{$_url}radius/nas-list">{Lang::T('Radius NAS')}</a></li>
|
||||
{$_MENU_RADIUS}
|
||||
</ul>
|
||||
</li>
|
||||
{$_MENU_AFTER_RADIUS}
|
||||
<li class="{if $_system_menu eq 'radius'}active{/if} treeview">
|
||||
<a href="#">
|
||||
<i class="fa fa-database"></i> <span>{Lang::T('Radius')}</span>
|
||||
<span class="pull-right-container">
|
||||
<i class="fa fa-angle-left pull-right"></i>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu">
|
||||
<li {if $_routes[0] eq 'radius' and $_routes[1] eq 'nas-list'}class="active" {/if}><a
|
||||
href="{$_url}radius/nas-list">{Lang::T('Radius NAS')}</a></li>
|
||||
{$_MENU_RADIUS}
|
||||
</ul>
|
||||
</li>
|
||||
{/if}
|
||||
{$_MENU_AFTER_RADIUS}
|
||||
<li class="{if $_system_menu eq 'pages'}active{/if} treeview">
|
||||
<a href="#">
|
||||
<i class="ion ion-document"></i> <span>{Lang::T("Static Pages")}</span>
|
||||
|
@ -1,63 +1,97 @@
|
||||
{include file="sections/header.tpl"}
|
||||
<!-- user-edit -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="panel panel-primary panel-hovered panel-stacked mb30">
|
||||
<div class="panel-heading">{Lang::T('Add New Administrator')}</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}settings/users-post">
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}settings/users-post">
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-md-6">
|
||||
<div class="panel panel-primary panel-hovered panel-stacked mb30">
|
||||
<div class="panel-heading">{Lang::T('Profile')}</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Username')}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="username" name="username">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Full Name')}</label>
|
||||
<div class="col-md-6">
|
||||
<label class="col-md-3 control-label">{Lang::T('Full Name')}</label>
|
||||
<div class="col-md-9">
|
||||
<input type="text" class="form-control" id="fullname" name="fullname">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('User Type')}</label>
|
||||
<div class="col-md-6">
|
||||
<label class="col-md-3 control-label">{Lang::T('Phone')}</label>
|
||||
<div class="col-md-9">
|
||||
<input type="number" class="form-control" id="phone" name="phone">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label">{Lang::T('Email')}</label>
|
||||
<div class="col-md-9">
|
||||
<input type="text" class="form-control" id="email" name="email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="city" name="city" placeholder="{Lang::T('City')}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="subdistrict" name="subdistrict" placeholder="{Lang::T('Sub District')}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="ward" name="ward" placeholder="{Lang::T('Ward')}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 col-md-6">
|
||||
<div class="panel panel-primary panel-hovered panel-stacked mb30">
|
||||
<div class="panel-heading">{Lang::T('Credentials')}</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label">{Lang::T('User Type')}</label>
|
||||
<div class="col-md-9">
|
||||
<select name="user_type" id="user_type" class="form-control">
|
||||
<option value="SuperAdmin">SuperAdministrator</option>
|
||||
<option value="Admin">Administrator</option>
|
||||
<option value="Report">Report Viewer</option>
|
||||
<option value="Agent">Agent</option>
|
||||
<option value="Sales">Sales</option>
|
||||
{if $_admin['user_type'] eq 'Agent'}
|
||||
<option value="Sales">Sales</option>
|
||||
{/if}
|
||||
{if $_admin['user_type'] eq 'Admin' || $_admin['user_type'] eq 'SuperAdmin'}
|
||||
<option value="Report">Report Viewer</option>
|
||||
<option value="Agent">Agent</option>
|
||||
<option value="Sales">Sales</option>
|
||||
{/if}
|
||||
{if $_admin['user_type'] eq 'SuperAdmin'}
|
||||
<option value="Admin">Administrator</option>
|
||||
<option value="SuperAdmin">Super Administrator</option>
|
||||
{/if}
|
||||
</select>
|
||||
<span class="help-block">{Lang::T('Choose User Type Sales to disable access to Settings')}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Password')}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="password" class="form-control" id="password" name="password">
|
||||
<label class="col-md-3 control-label">{Lang::T('Username')}</label>
|
||||
<div class="col-md-9">
|
||||
<input type="text" class="form-control" id="username" name="username">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Confirm Password')}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="password" class="form-control" id="cpassword" name="cpassword">
|
||||
<label class="col-md-3 control-label">{Lang::T('Password')}</label>
|
||||
<div class="col-md-9">
|
||||
<input type="password" class="form-control" id="password" value="{rand(000000,999999)}" name="password"
|
||||
onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-2 col-lg-10">
|
||||
<button class="btn btn-primary waves-effect waves-light"
|
||||
type="submit">{Lang::T('Save Changes')}</button>
|
||||
Or <a href="{$_url}settings/users">{Lang::T('Cancel')}</a>
|
||||
<label class="col-md-5 control-label">{Lang::T('Send Notification')}</label>
|
||||
<div class="col-md-7">
|
||||
<select name="send_notif" id="send_notif" class="form-control">
|
||||
<option value="-">Don't Send</option>
|
||||
<option value="sms">By SMS</option>
|
||||
<option value="wa">By WhatsApp</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-center">
|
||||
<button class="btn btn-primary waves-effect waves-light" type="submit">{Lang::T('Save Changes')}</button>
|
||||
Or <a href="{$_url}settings/users">{Lang::T('Cancel')}</a>
|
||||
</div>
|
||||
</form>
|
||||
{include file="sections/footer.tpl"}
|
@ -1,74 +1,123 @@
|
||||
{include file="sections/header.tpl"}
|
||||
<!-- user-edit -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12">
|
||||
<div class="panel panel-primary panel-hovered panel-stacked mb30">
|
||||
<div class="panel-heading">{Lang::T('Edit User')}</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}settings/users-edit-post">
|
||||
<form class="form-horizontal" method="post" role="form" action="{$_url}settings/users-edit-post">
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-md-6">
|
||||
<div
|
||||
class="panel panel-{if $d['status'] != 'Active'}danger{else}primary{/if} panel-hovered panel-stacked mb30">
|
||||
<div class="panel-heading">{Lang::T('Profile')}</div>
|
||||
<div class="panel-body">
|
||||
<input type="hidden" name="id" value="{$d['id']}">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Username')}</label>
|
||||
<div class="col-md-6">
|
||||
<label class="col-md-3 control-label">{Lang::T('Full Name')}</label>
|
||||
<div class="col-md-9">
|
||||
<input type="text" class="form-control" id="fullname" name="fullname"
|
||||
value="{$d['fullname']}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label">{Lang::T('Phone')}</label>
|
||||
<div class="col-md-9">
|
||||
<input type="number" class="form-control" id="phone" name="phone" value="{$d['phone']}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label">{Lang::T('Email')}</label>
|
||||
<div class="col-md-9">
|
||||
<input type="text" class="form-control" id="email" name="email" value="{$d['email']}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="city" name="city"
|
||||
placeholder="{Lang::T('City')}" value="{$d['city']}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="subdistrict" name="subdistrict"
|
||||
placeholder="{Lang::T('Sub District')}" value="{$d['subdistrict']}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input type="text" class="form-control" id="ward" name="ward"
|
||||
placeholder="{Lang::T('Ward')}" value="{$d['ward']}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 col-md-6">
|
||||
<div
|
||||
class="panel panel-{if $d['status'] != 'Active'}danger{else}primary{/if} panel-hovered panel-stacked mb30">
|
||||
<div class="panel-heading">{Lang::T('Credentials')}</div>
|
||||
<div class="panel-body">
|
||||
{if ($_admin['id']) neq ($d['id'])}
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label">{Lang::T('Status')}</label>
|
||||
<div class="col-md-9">
|
||||
<select name="status" id="status" class="form-control">
|
||||
<option value="Active" {if $d['status'] eq 'Active'}selected="selected" {/if}>
|
||||
Active</option>
|
||||
<option value="Inactive" {if $d['status'] eq 'Inactive'}selected="selected" {/if}>
|
||||
Inactive</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label">{Lang::T('User Type')}</label>
|
||||
<div class="col-md-9">
|
||||
<select name="user_type" id="user_type" class="form-control">
|
||||
{if $_admin['user_type'] eq 'Agent'}
|
||||
<option value="Sales" {if $d['user_type'] eq 'Sales'}selected="selected" {/if}>Sales
|
||||
</option>
|
||||
{/if}
|
||||
{if $_admin['user_type'] eq 'Admin' || $_admin['user_type'] eq 'SuperAdmin'}
|
||||
<option value="Report" {if $d['user_type'] eq 'Report'}selected="selected" {/if}>Report
|
||||
Viewer</option>
|
||||
<option value="Agent" {if $d['user_type'] eq 'Agent'}selected="selected" {/if}>Agent
|
||||
</option>
|
||||
<option value="Sales" {if $d['user_type'] eq 'Sales'}selected="selected" {/if}>Sales
|
||||
</option>
|
||||
{/if}
|
||||
{if $_admin['user_type'] eq 'SuperAdmin'}
|
||||
<option value="Admin" {if $d['user_type'] eq 'Admin'}selected="selected" {/if}>
|
||||
Administrator</option>
|
||||
<option value="SuperAdmin" {if $d['user_type'] eq 'SuperAdmin'}selected="selected"
|
||||
{/if}>Super Administrator</option>
|
||||
{/if}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label">{Lang::T('Username')}</label>
|
||||
<div class="col-md-9">
|
||||
<input type="text" class="form-control" id="username" name="username"
|
||||
value="{$d['username']}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Full Name')}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" id="fullname" name="fullname"
|
||||
value="{$d['fullname']}">
|
||||
</div>
|
||||
</div>
|
||||
{if ($_admin['id']) neq ($d['id'])}
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('User Type')}</label>
|
||||
<div class="col-md-6">
|
||||
<select name="user_type" id="user_type" class="form-control">
|
||||
<option value="SuperAdmin" {if $d['user_type'] eq 'SuperAdmin'}selected="selected"
|
||||
{/if}>SuperAdministrator</option>
|
||||
<option value="Admin" {if $d['user_type'] eq 'Admin'}selected="selected" {/if}>
|
||||
Administrator</option>
|
||||
<option value="Report" {if $d['user_type'] eq 'Report'}selected="selected" {/if}>Report
|
||||
Viewer</option>
|
||||
<option value="Agent" {if $d['user_type'] eq 'Agent'}selected="selected" {/if}>Agent
|
||||
</option>
|
||||
<option value="Sales" {if $d['user_type'] eq 'Sales'}selected="selected" {/if}>Sales
|
||||
</option>
|
||||
</select>
|
||||
<span class="help-block">{Lang::T('Choose User Type Sales to disable access to Settings')}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Password')}</label>
|
||||
<div class="col-md-6">
|
||||
<label class="col-md-3 control-label">{Lang::T('Password')}</label>
|
||||
<div class="col-md-9">
|
||||
<input type="password" class="form-control" id="password" name="password">
|
||||
<span class="help-block">{Lang::T('Keep Blank to do not change Password')}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label">{Lang::T('Confirm Password')}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="password" class="form-control" id="cpassword" name="cpassword">
|
||||
<label class="col-md-3 control-label">{Lang::T('Password')}</label>
|
||||
<div class="col-md-9">
|
||||
<input type="password" class="form-control" id="cpassword" name="cpassword"
|
||||
placeholder="{Lang::T('Confirm Password')}">
|
||||
<span class="help-block">{Lang::T('Keep Blank to do not change Password')}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-lg-offset-2 col-lg-10">
|
||||
<button class="btn btn-success waves-effect waves-light"
|
||||
type="submit">{Lang::T('Save Changes')}</button>
|
||||
Or <a href="{$_url}settings/users">{Lang::T('Cancel')}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<button class="btn btn-primary waves-effect waves-light" type="submit">{Lang::T('Save Changes')}</button>
|
||||
Or <a href="{$_url}settings/users">{Lang::T('Cancel')}</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{include file="sections/footer.tpl"}
|
@ -30,26 +30,34 @@
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>{Lang::T('Username')}</th>
|
||||
<th>{Lang::T('Full Name')}</th>
|
||||
<th>{Lang::T('Phone')}</th>
|
||||
<th>{Lang::T('Email')}</th>
|
||||
<th>{Lang::T('Type')}</th>
|
||||
<th>{Lang::T('Location')}</th>
|
||||
<th>{Lang::T('Last Login')}</th>
|
||||
<th>{Lang::T('Manage')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $d as $ds}
|
||||
<tr>
|
||||
<tr {if $ds['status'] != 'Active'}class="danger"{/if}>
|
||||
<td>{$ds['id']}</td>
|
||||
<td>{$ds['username']}</td>
|
||||
<td>{$ds['fullname']}</td>
|
||||
<td>{$ds['phone']}</td>
|
||||
<td>{$ds['email']}</td>
|
||||
<td>{$ds['user_type']}</td>
|
||||
<td>{$ds['last_login']}</td>
|
||||
<td>{$ds['city']}, {$ds['subdistrict']}, {$ds['ward']}</td>
|
||||
<td>{Lang::dateTimeFormat($ds['last_login'])}</td>
|
||||
<td>
|
||||
<a href="{$_url}settings/users-edit/{$ds['id']}"
|
||||
class="btn btn-warning btn-sm">{Lang::T('Edit')}</a>
|
||||
class="btn btn-warning btn-xs">{Lang::T('Edit')}</a>
|
||||
{if ($_admin['username']) neq ($ds['username'])}
|
||||
<a href="{$_url}settings/users-delete/{$ds['id']}" id="{$ds['id']}"
|
||||
class="btn btn-danger btn-sm" onclick="return confirm('{Lang::T('Delete')}?')">{Lang::T('Delete')}</a>
|
||||
class="btn btn-danger btn-xs" onclick="return confirm('{Lang::T('Delete')}?')">{Lang::T('Delete')}</a>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user