Compare commits

...

1 Commits

Author SHA1 Message Date
Stephane 421b784b4a change notification design 2 weeks ago
  1. 23
      app/Controllers/OrderController.php
  2. 2
      app/Views/orders/edit.php
  3. 2
      app/Views/templates/footer.php
  4. 10
      app/Views/templates/header.php
  5. 8
      app/Views/templates/header_menu.php

23
app/Controllers/OrderController.php

@ -915,14 +915,28 @@ public function update(int $id)
if ($role === 'COMMERCIALE') { if ($role === 'COMMERCIALE') {
$paid_status = 2; $paid_status = 2;
} else { } elseif ($role === 'Caissière') {
$paid_status = $this->request->getPost('paid_status'); $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_by = $current_order['validated_by'] ?? null;
$validated_at = $current_order['validated_at'] ?? null; $validated_at = $current_order['validated_at'] ?? null;
if ($old_paid_status != 1 && $paid_status == 1 && $role === 'Caissière') { 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_by = $user['id'];
$validated_at = date('Y-m-d H:i:s'); $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'); $customer_name = $this->request->getPost('customer_name');
$bill_no = $current_order['bill_no']; $bill_no = $current_order['bill_no'];
// ✅ Notification SECURITE du store concerné // ✅ Notification SECURITE du store concerné (toujours)
$Notification->createNotification( $Notification->createNotification(
"Commande validée: {$bill_no} - Client: {$customer_name}", "Commande validée: {$bill_no} - Client: {$customer_name}",
"SECURITE", "SECURITE",
@ -1038,7 +1052,8 @@ public function update(int $id)
'orders' 'orders'
); );
// ✅ RÉCUPÉRER TOUS LES STORES // ✅ Notifier Direction, DAF, SuperAdmin UNIQUEMENT pour les commandes avec remise
if ((float)$discount > 0) {
$Stores = new Stores(); $Stores = new Stores();
$allStores = $Stores->getActiveStore(); $allStores = $Stores->getActiveStore();
@ -1047,7 +1062,6 @@ public function update(int $id)
"Client : {$customer_name}<br>" . "Client : {$customer_name}<br>" .
"Validée par : {$user['firstname']} {$user['lastname']}"; "Validée par : {$user['firstname']} {$user['lastname']}";
// ✅ NOTIFIER DIRECTION, DAF, SUPERADMIN DE TOUS LES STORES
if (is_array($allStores) && count($allStores) > 0) { if (is_array($allStores) && count($allStores) > 0) {
foreach ($allStores as $store) { foreach ($allStores as $store) {
$Notification->createNotification( $Notification->createNotification(
@ -1073,6 +1087,7 @@ public function update(int $id)
} }
} }
} }
}
if ((float)$discount > 0) { if ((float)$discount > 0) {
$productData = new Products(); $productData = new Products();

2
app/Views/orders/edit.php

@ -344,7 +344,7 @@
<?php <?php
$users = session()->get('user'); $users = session()->get('user');
if ($users && $users['group_name'] !== 'COMMERCIALE'): if ($users && $users['group_name'] === 'Caissière'):
?> ?>
<div class="form-group"> <div class="form-group">

2
app/Views/templates/footer.php

@ -3,7 +3,7 @@
<div> <div>
<strong>Copyright &copy;<?php echo date('Y') ?>.</strong> All rights reserved. <strong>Copyright &copy;<?php echo date('Y') ?>.</strong> All rights reserved.
</div> </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> </footer>
<!-- Add the sidebar's background. This div must be placed <!-- Add the sidebar's background. This div must be placed

10
app/Views/templates/header.php

@ -1578,16 +1578,6 @@ body {
* { * {
transition-duration: 0.2s !important; transition-duration: 0.2s !important;
} }
};
}
.info-box-number {
font-size: 28px;
}
.description-header {
font-size: 24px !important;
}
} }
/* Mobiles et petites tablettes (max-width: 768px) */ /* Mobiles et petites tablettes (max-width: 768px) */

8
app/Views/templates/header_menu.php

@ -78,7 +78,7 @@
width: 420px; width: 420px;
padding: 0; padding: 0;
max-height: 520px; max-height: 520px;
display: flex; display: none;
flex-direction: column; flex-direction: column;
border-radius: 12px; border-radius: 12px;
overflow: hidden; overflow: hidden;
@ -86,6 +86,12 @@
border: 1px solid rgba(0,0,0,0.08); 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 */ /* Header du panel */
.notif-panel-header { .notif-panel-header {
display: flex; display: flex;

Loading…
Cancel
Save