change notification design
This commit is contained in:
parent
3c7585b3a2
commit
421b784b4a
@ -915,14 +915,28 @@ public function update(int $id)
|
||||
|
||||
if ($role === 'COMMERCIALE') {
|
||||
$paid_status = 2;
|
||||
} else {
|
||||
} elseif ($role === 'Caissière') {
|
||||
$paid_status = $this->request->getPost('paid_status');
|
||||
} else {
|
||||
// SuperAdmin, Direction, DAF ne peuvent pas valider (paid_status=1) directement
|
||||
// Leur rôle est de valider les remises via la page remise/, pas les commandes
|
||||
$requested_status = (int)$this->request->getPost('paid_status');
|
||||
$paid_status = ($requested_status == 1) ? $old_paid_status : $requested_status;
|
||||
}
|
||||
|
||||
$validated_by = $current_order['validated_by'] ?? null;
|
||||
$validated_at = $current_order['validated_at'] ?? null;
|
||||
|
||||
|
||||
if ($old_paid_status != 1 && $paid_status == 1 && $role === 'Caissière') {
|
||||
// ✅ Bloquer si la commande a une remise non encore approuvée par SuperAdmin
|
||||
$currentDiscount = (float)($current_order['discount'] ?? 0);
|
||||
if ($currentDiscount > 0) {
|
||||
$RemiseCheck = new Remise();
|
||||
if (!$RemiseCheck->hasRemiseValidatedForOrder($id)) {
|
||||
session()->setFlashData('errors', 'Cette commande a une demande de remise en attente de validation par le SuperAdmin.');
|
||||
return redirect()->to('orders/');
|
||||
}
|
||||
}
|
||||
$validated_by = $user['id'];
|
||||
$validated_at = date('Y-m-d H:i:s');
|
||||
}
|
||||
@ -1030,7 +1044,7 @@ public function update(int $id)
|
||||
$customer_name = $this->request->getPost('customer_name');
|
||||
$bill_no = $current_order['bill_no'];
|
||||
|
||||
// ✅ Notification SECURITE du store concerné
|
||||
// ✅ Notification SECURITE du store concerné (toujours)
|
||||
$Notification->createNotification(
|
||||
"Commande validée: {$bill_no} - Client: {$customer_name}",
|
||||
"SECURITE",
|
||||
@ -1038,38 +1052,39 @@ public function update(int $id)
|
||||
'orders'
|
||||
);
|
||||
|
||||
// ✅ RÉCUPÉRER TOUS LES STORES
|
||||
$Stores = new Stores();
|
||||
$allStores = $Stores->getActiveStore();
|
||||
|
||||
$messageGlobal = "✅ Commande validée : {$bill_no}<br>" .
|
||||
"Store : " . $this->returnStore($user['store_id']) . "<br>" .
|
||||
"Client : {$customer_name}<br>" .
|
||||
"Validée par : {$user['firstname']} {$user['lastname']}";
|
||||
|
||||
// ✅ NOTIFIER DIRECTION, DAF, SUPERADMIN DE TOUS LES STORES
|
||||
if (is_array($allStores) && count($allStores) > 0) {
|
||||
foreach ($allStores as $store) {
|
||||
$Notification->createNotification(
|
||||
$messageGlobal,
|
||||
"Direction",
|
||||
(int)$store['id'],
|
||||
'orders'
|
||||
);
|
||||
|
||||
$Notification->createNotification(
|
||||
$messageGlobal,
|
||||
"DAF",
|
||||
(int)$store['id'],
|
||||
'orders'
|
||||
);
|
||||
|
||||
$Notification->createNotification(
|
||||
$messageGlobal,
|
||||
"SuperAdmin",
|
||||
(int)$store['id'],
|
||||
'orders'
|
||||
);
|
||||
// ✅ Notifier Direction, DAF, SuperAdmin UNIQUEMENT pour les commandes avec remise
|
||||
if ((float)$discount > 0) {
|
||||
$Stores = new Stores();
|
||||
$allStores = $Stores->getActiveStore();
|
||||
|
||||
$messageGlobal = "✅ Commande validée : {$bill_no}<br>" .
|
||||
"Store : " . $this->returnStore($user['store_id']) . "<br>" .
|
||||
"Client : {$customer_name}<br>" .
|
||||
"Validée par : {$user['firstname']} {$user['lastname']}";
|
||||
|
||||
if (is_array($allStores) && count($allStores) > 0) {
|
||||
foreach ($allStores as $store) {
|
||||
$Notification->createNotification(
|
||||
$messageGlobal,
|
||||
"Direction",
|
||||
(int)$store['id'],
|
||||
'orders'
|
||||
);
|
||||
|
||||
$Notification->createNotification(
|
||||
$messageGlobal,
|
||||
"DAF",
|
||||
(int)$store['id'],
|
||||
'orders'
|
||||
);
|
||||
|
||||
$Notification->createNotification(
|
||||
$messageGlobal,
|
||||
"SuperAdmin",
|
||||
(int)$store['id'],
|
||||
'orders'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -342,9 +342,9 @@
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
$users = session()->get('user');
|
||||
if ($users && $users['group_name'] !== 'COMMERCIALE'):
|
||||
<?php
|
||||
$users = session()->get('user');
|
||||
if ($users && $users['group_name'] === 'Caissière'):
|
||||
?>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<div>
|
||||
<strong>Copyright ©<?php echo date('Y') ?>.</strong> All rights reserved.
|
||||
</div>
|
||||
<div class="pull-right hidden-xs"><h5 style="font-family: tahoma;">Designed and Managed by <strong>MYDEVUP</strong>
|
||||
<div class="pull-right hidden-xs"><h5 style="font-family: tahoma;">Designed and Managed by <strong>COMPANY FOR MADAGASCAR</strong>
|
||||
</footer>
|
||||
|
||||
<!-- Add the sidebar's background. This div must be placed
|
||||
|
||||
@ -1578,16 +1578,6 @@ body {
|
||||
* {
|
||||
transition-duration: 0.2s !important;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
.info-box-number {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.description-header {
|
||||
font-size: 24px !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mobiles et petites tablettes (max-width: 768px) */
|
||||
|
||||
@ -78,7 +78,7 @@
|
||||
width: 420px;
|
||||
padding: 0;
|
||||
max-height: 520px;
|
||||
display: flex;
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
@ -86,6 +86,12 @@
|
||||
border: 1px solid rgba(0,0,0,0.08);
|
||||
}
|
||||
|
||||
/* Afficher quand ouvert (Bootstrap 3: .open, Bootstrap 4: .show) */
|
||||
.open > .notif-dropdown,
|
||||
.notif-dropdown.show {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/* Header du panel */
|
||||
.notif-panel-header {
|
||||
display: flex;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user