Fix Admin List for Admin

This commit is contained in:
Ibnu Maksum
2024-02-20 10:58:50 +07:00
parent 349a1d3250
commit 2063ae4159
11 changed files with 61 additions and 45 deletions

View File

@ -280,14 +280,16 @@ switch ($action) {
'username' => '%' . $search . '%',
['user_type' => 'Report'],
['user_type' => 'Agent'],
['user_type' => 'Sales']
['user_type' => 'Sales'],
['id' => $admin['id']]
], $search);
$d = ORM::for_table('tbl_users')
->where_like('username', '%' . $search . '%')
->where_any_is([
['user_type' => 'Report'],
['user_type' => 'Agent'],
['user_type' => 'Sales']
['user_type' => 'Sales'],
['id' => $admin['id']]
])
->offset($paginator['startpoint'])
->limit($paginator['limit'])->order_by_asc('id')->findArray();
@ -311,7 +313,8 @@ switch ($action) {
$d = ORM::for_table('tbl_users')->where_any_is([
['user_type' => 'Report'],
['user_type' => 'Agent'],
['user_type' => 'Sales']
['user_type' => 'Sales'],
['id' => $admin['id']]
])->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_asc('id')->findArray();
} else {
$paginator = Paginator::build(ORM::for_table('tbl_users'));
@ -591,7 +594,9 @@ switch ($action) {
$d->city = $city;
$d->subdistrict = $subdistrict;
$d->ward = $ward;
$d->status = $status;
if(isset($_POST['status'])){
$d->status = $status;
}
if ($admin['user_type'] == 'Agent') {
// Prevent hacking from form