Different Widget for Admin, Agent, Sales, Customer. Agent, Sales not yet have widget

This commit is contained in:
iBNu Maksum
2025-02-21 16:01:38 +07:00
parent 9332063c87
commit b379266973
5 changed files with 38 additions and 24 deletions

View File

@ -18,8 +18,12 @@ $tipeUser = _req("user");
if (empty($tipeUser)) {
$tipeUser = 'Admin';
}
if($tipeUser == 'Customer') {
$WIDGET_PATH .= DIRECTORY_SEPARATOR. 'customer';
}
$ui->assign('tipeUser', $tipeUser);
$max = ORM::for_table('tbl_widgets')->max('position');
$max = ORM::for_table('tbl_widgets')->where("user", $tipeUser)->max('position');
$max2 = substr_count($config['dashboard_' . $tipeUser], '.') + substr_count($config['dashboard_' . $tipeUser], ',') + 1;
if ($max2 > $max) {
$max = $max2;
@ -36,6 +40,7 @@ if ($action == 'add') {
$title = _post('title');
$widget = _post('widget');
$content = _post('content');
print_r($_POST);
$d = ORM::for_table('tbl_widgets')->create();
$d->orders = $orders;
$d->position = $position;
@ -58,6 +63,7 @@ if ($action == 'add') {
}
}
$widget['position'] = $pos;
$widget['user'] = $tipeUser;
$ui->assign('users', ORM::for_table('tbl_widgets')->getEnum("user"));
$ui->assign('do', 'add');
$ui->assign('widgets', $widgets);