From fe80b9c4f8d71dd47d6b828b04c4250ac48f91a1 Mon Sep 17 00:00:00 2001 From: andrymodeste Date: Wed, 1 Apr 2026 19:56:34 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20corrections=20et=20am=C3=A9liorations=20?= =?UTF-8?q?du=2001-04-2026?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Recouvrement - Liste triée par date décroissante - Pop-up de confirmation anti-doublons - Affichage avec permission "Voir" seule ## Mise à jour produit - Correction erreur "Column count doesn't match" (triggers MySQL corrigés) - Formulaire corrigé (action, catégorie, champs null) - Catégorie et date d'arrivage correctement préremplis - Historique affiche le nom de l'utilisateur qui modifie ## Espace commercial - Colonne "Disponibilité" ajoutée avec statut "En attente de livraison" - Bouton panier caché pour les motos commandées - Surbrillance jaune pour les motos en attente ## Notifications - Caissière reçoit les notifications via notifCommande - notifSortieCaisse réservé à Direction/Admin ## Avances - Colonne "N° Série" ajoutée dans toutes les listes - Compteurs sur les boutons Incomplètes/Complètes ## Facture / BL - Total, Remise, Total à payer affichés - "Ariary" ne se répète plus - Prix individuel par moto - Impression automatique : 1 produit = Facture, 2+ = BL - Remise multiple : colonne product changée en TEXT ## Rapports - Filtre par date dans le rapport stock - Filtre par commercial et mécanicien dans les performances - Correction rapport stock (GROUP BY marque) - Liens absolus (correction erreur 404) ## Sidebar - Marge en haut supprimée (production) - Padding en bas ajouté pour scroll complet Co-Authored-By: Claude Opus 4.6 (1M context) --- app/Config/Routes.php | 2 +- app/Controllers/AdminController.php | 2 +- app/Controllers/Auth.php | 14 +- app/Controllers/AvanceController.php | 22 ++- app/Controllers/HistoriqueController.php | 1 + app/Controllers/MecanicienController.php | 2 +- app/Controllers/OrderController.php | 170 ++++++++++++--------- app/Controllers/ProductCOntroller.php | 98 ++++++++---- app/Controllers/RecouvrementController.php | 52 ++++--- app/Controllers/ReportController.php | 41 +++-- app/Models/Orders.php | 28 ++-- app/Models/Products.php | 17 +++ app/Views/avances/avance.php | 97 +++++++++--- app/Views/commercial/index.php | 12 +- app/Views/historique/index.php | 14 +- app/Views/products/editbackup.php | 16 +- app/Views/products/index.php | 9 +- app/Views/recouvrement/index.php | 44 ++++-- app/Views/reports/index.php | 3 +- app/Views/reports/performance.php | 164 ++++++++++---------- app/Views/reports/stockDetail.php | 34 +++-- app/Views/securite/index.php | 4 +- app/Views/templates/header.php | 1 + 23 files changed, 534 insertions(+), 313 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 27fc28b3..4a97066f 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -226,7 +226,7 @@ $routes->group('', ['filter' => 'auth'], function ($routes) { $routes->get('detail/stock', [ReportController::class, 'stockDetail']); // Corrections fetct → fetch - $routes->get('detail/fetchData/(:num)', [ReportController::class, 'fetchProductSold/$1']); + $routes->get('detail/fetchData/(:num)', [ReportController::class, 'fetchProductSodled/$1']); $routes->get('detail/fetchDataStock/(:num)', [ReportController::class, 'fetchProductStock/$1']); $routes->get('detail/fetchDataStock2/(:num)', [ReportController::class, 'fetchProductStock2/$1']); diff --git a/app/Controllers/AdminController.php b/app/Controllers/AdminController.php index 36e13482..c482e939 100644 --- a/app/Controllers/AdminController.php +++ b/app/Controllers/AdminController.php @@ -24,7 +24,7 @@ abstract class AdminController extends BaseController $group_data = $Groups->getUserGroupByUserId($userId); $this->permission = unserialize($group_data['permission']); - + } } diff --git a/app/Controllers/Auth.php b/app/Controllers/Auth.php index f990c17a..c956c3a1 100644 --- a/app/Controllers/Auth.php +++ b/app/Controllers/Auth.php @@ -129,7 +129,8 @@ public function loginPost() $buttons .= " "; } - if (is_array($this->permission) && in_array('createOrder', $this->permission)) { + $productSoldStatus = (int)($value['product_sold'] ?? 0); + if (is_array($this->permission) && in_array('createOrder', $this->permission) && $productSoldStatus === 0) { $buttons .= ($value['qty'] == 1) ? " " : " "; @@ -139,6 +140,16 @@ public function loginPost() $img = '' . $value['image'] . ''; + // Statut basé sur product_sold + $productSold = (int)($value['product_sold'] ?? 0); + if ($productSold === 2) { + $statut = 'En attente de livraison'; + } elseif ($productSold === 1) { + $statut = 'Livré'; + } else { + $statut = 'Disponible'; + } + // Populate the result data $result['data'][] = [ $img, @@ -147,6 +158,7 @@ public function loginPost() number_format($value['prix_vente'], 0, ',', ' '), $value['puissance'] . ' CC', $value['numero_de_moteur'], + $statut, $buttons ]; } diff --git a/app/Controllers/AvanceController.php b/app/Controllers/AvanceController.php index 96df98b7..a18f9868 100644 --- a/app/Controllers/AvanceController.php +++ b/app/Controllers/AvanceController.php @@ -116,21 +116,23 @@ private function buildDataRow($value, $product, $isAdmin, $isCommerciale, $isCai { $date_time = date('d-m-Y h:i a', strtotime($value['avance_date'])); - // ✅ Gestion sécurisée du nom du produit + // Gestion du nom du produit et numéro de série + $productSku = ''; if ($value['type_avance'] === 'mere') { $productName = $value['product_name'] ?? 'Produit sur mer'; } else { - $productName = !empty($value['product_name']) - ? $value['product_name'] - : $product->getProductNameById($value['product_id'] ?? 0); + $productData = !empty($value['product_id']) ? $product->find($value['product_id']) : null; + $productName = $productData['name'] ?? ($value['product_name'] ?? 'N/A'); + $productSku = $productData['sku'] ?? ''; } - + if ($isAdmin) { return [ $value['customer_name'], $value['customer_phone'], $value['customer_address'], $productName, + $productSku, number_format((int)$value['gross_amount'], 0, ',', ' '), number_format((int)$value['avance_amount'], 0, ',', ' '), number_format((int)$value['amount_due'], 0, ',', ' '), @@ -141,6 +143,7 @@ private function buildDataRow($value, $product, $isAdmin, $isCommerciale, $isCai return [ $value['avance_id'], $productName, + $productSku, number_format((int)$value['avance_amount'], 0, ',', ' '), number_format((int)$value['amount_due'], 0, ',', ' '), $date_time, @@ -228,12 +231,13 @@ private function fetchAvanceDataGeneric($methodName = 'getAllAvanceData') $date_time = date('d-m-Y h:i a', strtotime($value['avance_date'])); + $productSku = ''; if ($value['type_avance'] === 'mere') { $productName = $value['product_name'] ?? 'Produit sur mer'; } else { - $productName = !empty($value['product_name']) - ? $value['product_name'] - : $product->getProductNameById($value['product_id'] ?? 0); + $productData = !empty($value['product_id']) ? $product->find($value['product_id']) : null; + $productName = $productData['name'] ?? ($value['product_name'] ?? 'N/A'); + $productSku = $productData['sku'] ?? ''; } if ($isAdmin) { @@ -242,6 +246,7 @@ private function fetchAvanceDataGeneric($methodName = 'getAllAvanceData') $value['customer_phone'], $value['customer_address'], $productName, + $productSku, number_format((int)$value['gross_amount'], 0, ',', ' '), number_format((int)$value['avance_amount'], 0, ',', ' '), $status, @@ -252,6 +257,7 @@ private function fetchAvanceDataGeneric($methodName = 'getAllAvanceData') $result['data'][] = [ $value['avance_id'], $productName, + $productSku, number_format((int)$value['avance_amount'], 0, ',', ' '), $status, $date_time, diff --git a/app/Controllers/HistoriqueController.php b/app/Controllers/HistoriqueController.php index 0a65604d..4c4af9b3 100644 --- a/app/Controllers/HistoriqueController.php +++ b/app/Controllers/HistoriqueController.php @@ -71,6 +71,7 @@ class HistoriqueController extends AdminController $row['product_name'] ?? 'N/A', $row['sku'] ?? 'N/A', $row['store_name'] ?? 'N/A', + $row['user_name'] ?? 'N/A', $this->getActionBadge($row['action']), $row['description'] ?? '' ]; diff --git a/app/Controllers/MecanicienController.php b/app/Controllers/MecanicienController.php index 40b406fb..1e7594d5 100644 --- a/app/Controllers/MecanicienController.php +++ b/app/Controllers/MecanicienController.php @@ -298,7 +298,7 @@ class MecanicienController extends AdminController $date_debut = date("d/m/Y", strtotime($repa['reparation_debut'])); $date_fin = date("d/m/Y", strtotime($repa['reparation_fin'])); $storeName = $repa['store_name'] ?? 'N/A'; - + $result['data'][$key] = [ $user_name, $image, diff --git a/app/Controllers/OrderController.php b/app/Controllers/OrderController.php index 9933daa2..27910e9d 100644 --- a/app/Controllers/OrderController.php +++ b/app/Controllers/OrderController.php @@ -663,16 +663,21 @@ class OrderController extends AdminController $Notification->notifyGroupsByPermissionAllStores('notifRemise', $message, 'remise/'); - } else { - // Commande sans remise - $Notification->notifyGroupsByPermission( - 'notifSortieCaisse', - "📦 Nouvelle commande à valider : {$bill_no}
" . + // Notifier la Caissière (notifCommande) et l'admin/direction (notifSortieCaisse) + $messageCommande = "📦 Nouvelle commande (avec remise) à traiter : {$bill_no}
" . "Client : {$data['customer_name']}
" . - "Montant : " . number_format($gross_amount, 0, ',', ' ') . " Ar", - (int)$users['store_id'], - "orders" - ); + "Montant demandé : " . number_format($discount, 0, ',', ' ') . " Ar
" . + "En attente de validation remise"; + $Notification->notifyGroupsByPermission('notifCommande', $messageCommande, (int)$users['store_id'], "orders"); + $Notification->notifyGroupsByPermission('notifSortieCaisse', $messageCommande, (int)$users['store_id'], "orders"); + + } else { + // Commande sans remise - notifier Caissière (notifCommande) et admin/direction (notifSortieCaisse) + $messageCommande = "📦 Nouvelle commande à traiter : {$bill_no}
" . + "Client : {$data['customer_name']}
" . + "Montant : " . number_format($gross_amount, 0, ',', ' ') . " Ar"; + $Notification->notifyGroupsByPermission('notifCommande', $messageCommande, (int)$users['store_id'], "orders"); + $Notification->notifyGroupsByPermission('notifSortieCaisse', $messageCommande, (int)$users['store_id'], "orders"); } if ($users["group_name"] != "COMMERCIALE") { @@ -1721,23 +1726,18 @@ public function update(int $id) } - public function printDiv(int $id) + public function printDiv(int $id) { $Orders = new Orders(); + $OrderItems = new OrderItems(); $order = $Orders->getOrdersData($id); - - $docType = $order['document_type'] ?? 'facture'; - - // Rediriger vers la bonne méthode selon le type - switch($docType) { - case 'facture': - return $this->print31($id); // Factures individuelles - case 'bl': - return $this->print7($id); // Bon de livraison - case 'both': - return $this->print31($id); // Factures + Bon de livraison - default: - return $this->print31($id); + $items = $OrderItems->getOrdersItemData($id); + + // Plus d'1 produit = BL, 1 seul produit = Facture + if (count($items) > 1) { + return $this->print7($id); // Bon de livraison + } else { + return $this->print5($id); // Facture } } @@ -2007,23 +2007,26 @@ public function print5(int $id) $discount = (float) $order['discount']; $grossAmount = (float) $order['gross_amount']; - $totalTTC = ($discount > 0) ? $discount : $grossAmount; - $inWords = strtoupper($this->numberToWords((int) round($totalTTC))); + $totalAPayer = ($discount > 0) ? $discount : $grossAmount; + $remiseAmount = ($discount > 0) ? ($grossAmount - $discount) : 0; + $inWords = strtoupper($this->numberToWords((int) round($totalAPayer))); // Construire les lignes du tableau $tableRows = ''; + $totalPrixIndividuels = 0; foreach ($items as $it) { $details = $this->getOrderItemDetails($it); if (!$details) continue; $qty = isset($it['qty']) ? (int)$it['qty'] : 1; - $prix = ($discount > 0) ? ($discount / $qty) : $details['prix']; + $prixItem = $details['prix'] * $qty; + $totalPrixIndividuels += $prixItem; $tableRows .= ' '.esc($details['marque']).' '.esc($details['numero_chassis']).' '.esc($details['puissance']).' - '.number_format($prix * $qty, 0, ' ', ' ').' MGA + '.number_format($prixItem, 0, ' ', ' ').' '; } @@ -2043,7 +2046,7 @@ public function print5(int $id) $companyPhone = esc($company['phone']); $companyPhone2 = esc($company['phone2']); $companyAddress = esc($company['address'] ?? ''); - $totalFormatted = number_format($totalTTC, 0, ' ', ' '); + $totalFormatted = number_format($totalAPayer, 0, ' ', ' '); $qrValue = "FACTURE N° {$billNo} | Client: {$customerName} | Montant: {$totalFormatted} MGA | Date: {$today} | Facebook: https://www.facebook.com/MOTORBIKESTORE2021/"; $html = ' @@ -2058,7 +2061,8 @@ public function print5(int $id) body { font-family: Arial, sans-serif; - font-size: 11px; + font-size: 13px; + line-height: 1.3; color: #000; } @@ -2084,32 +2088,33 @@ public function print5(int $id) /* Header */ .f-title { - font-size: 22px; + font-size: 24px; font-weight: bold; text-decoration: underline; - margin-bottom: 10px; + margin-bottom: 12px; } .f-company { - font-size: 10px; - line-height: 1.5; + font-size: 12px; + line-height: 1.3; margin-bottom: 8px; } - .f-company strong { font-size: 12px; } + .f-company strong { font-size: 14px; } .f-doit { font-weight: bold; - font-size: 12px; - margin-bottom: 5px; + font-size: 14px; + margin-bottom: 6px; } .f-client { - font-size: 10px; + font-size: 12px; + line-height: 1.3; margin-bottom: 10px; } - .f-client .field { margin: 2px 0; } + .f-client .field { margin: 3px 0; } /* Table */ .f-table { @@ -2121,9 +2126,9 @@ public function print5(int $id) .f-table th, .f-table td { border-left: 2px solid #000; border-right: 2px solid #000; - padding: 6px 8px; + padding: 8px 10px; text-align: center; - font-size: 10px; + font-size: 12px; } .f-table th { @@ -2132,7 +2137,7 @@ public function print5(int $id) border-bottom: 2px solid #000; } - .f-table td { height: 28px; } + .f-table td { height: 30px; } .f-table tbody tr:last-child td { border-bottom: 2px solid #000; @@ -2140,7 +2145,8 @@ public function print5(int $id) /* Total en lettres */ .f-words { - font-size: 10px; + font-size: 12px; + line-height: 1.3; margin-bottom: 12px; } @@ -2160,7 +2166,7 @@ public function print5(int $id) .f-sig-box .sig-label { font-weight: bold; - font-size: 11px; + font-size: 13px; } /* Date + N° + QR en bas */ @@ -2172,7 +2178,7 @@ public function print5(int $id) } .f-bottom .f-date-info { - font-size: 10px; + font-size: 12px; } .f-bottom canvas { @@ -2196,13 +2202,13 @@ public function print5(int $id) display: flex; flex-direction: column; border-bottom: 2px dashed #aaa; - line-height: 1.6; + line-height: 1.3; } .cond-box:last-child { border-bottom: none; } .cond-title { - font-size: 14px; + font-size: 16px; font-weight: bold; font-style: italic; text-decoration: underline; @@ -2212,7 +2218,8 @@ public function print5(int $id) .cond-box ul { list-style: none; padding: 0; - font-size: 10px; + font-size: 12px; + line-height: 1.3; } .cond-box li { @@ -2261,6 +2268,8 @@ public function print5(int $id) $qrId = 'qr_recto_'.$i; $html .= '
+
FACTURE
+
'.$companyName.'
@@ -2269,15 +2278,13 @@ public function print5(int $id) Contact : '.$companyPhone.' / '.$companyPhone2.'
'.$companyAddress.'
-
+
DATE : '.$today.'
N° : '.$billNo.'
-
FACTURE
-
DOIT
@@ -2302,7 +2309,14 @@ public function print5(int $id)
- Arrête à la somme de : '.$inWords.' Ariary + Total : '.number_format($totalPrixIndividuels, 0, ' ', ' ').' Ariary
'; + + if ($remiseAmount > 0) { + $html .= 'Remise : -'.number_format($remiseAmount, 0, ' ', ' ').' Ariary
+ Total à payer : '.number_format($totalAPayer, 0, ' ', ' ').' Ariary
'; + } + + $html .= 'Arrête à la somme de : '.$inWords.'
@@ -2532,22 +2546,26 @@ public function print7(int $id) $discount = (float) $order['discount']; $grossAmount = (float) $order['gross_amount']; - $totalTTC = ($discount > 0) ? $discount : $grossAmount; + $totalAPayer = ($discount > 0) ? $discount : $grossAmount; + $remiseAmount = ($discount > 0) ? ($grossAmount - $discount) : 0; + $inWords = strtoupper($this->numberToWords((int) round($totalAPayer))); - // Construire les lignes du tableau + // Construire les lignes du tableau - prix individuel de chaque moto $tableRows = ''; + $totalPrixIndividuels = 0; foreach ($items as $item) { $details = $this->getOrderItemDetails($item); if (!$details) continue; $qty = isset($item['qty']) ? (int)$item['qty'] : 1; - $prix = ($discount > 0) ? ($discount / $qty) : $details['prix']; + $prixItem = $details['prix'] * $qty; + $totalPrixIndividuels += $prixItem; $tableRows .= ' '.esc($details['marque']).' '.esc($details['numero_moteur']).' '.esc($details['puissance']).' - '.number_format($prix * $qty, 0, '', ' ').' + '.number_format($prixItem, 0, '', ' ').' '; } @@ -2573,8 +2591,8 @@ public function print7(int $id) body { font-family: Arial, sans-serif; - font-size: 13px; - line-height: 1.5; + font-size: 14px; + line-height: 1.3; background: #fff; } @@ -2596,12 +2614,12 @@ public function print7(int $id) } .bl-company { - font-size: 12px; - line-height: 1.6; + font-size: 13px; + line-height: 1.3; } .bl-company strong { - font-size: 15px; + font-size: 16px; } .bl-title-block { @@ -2629,11 +2647,12 @@ public function print7(int $id) /* Client info */ .bl-client { margin-bottom: 12px; - font-size: 13px; + font-size: 14px; + line-height: 1.3; } .bl-client .field { - margin: 3px 0; + margin: 4px 0; } .bl-client .field strong { @@ -2643,7 +2662,7 @@ public function print7(int $id) .bl-doit { font-weight: bold; - font-size: 14px; + font-size: 15px; margin-bottom: 8px; } @@ -2651,29 +2670,24 @@ public function print7(int $id) .bl-table { width: 100%; border-collapse: collapse; - flex: 1; } .bl-table th, .bl-table td { border-left: 2px solid #000; border-right: 2px solid #000; - padding: 10px 15px; + padding: 5px 10px; text-align: center; - font-size: 13px; + font-size: 14px; } .bl-table th { font-weight: bold; - font-size: 13px; + font-size: 14px; background: #fff; border-top: 2px solid #000; border-bottom: 2px solid #000; } - .bl-table td { - height: 35px; - } - .bl-table tbody tr:last-child td { border-bottom: 2px solid #000; } @@ -2684,7 +2698,8 @@ public function print7(int $id) } .bl-total { - font-size: 14px; + font-size: 15px; + line-height: 1.3; margin-bottom: 15px; } @@ -2758,7 +2773,14 @@ public function print7(int $id) diff --git a/app/Views/reports/performance.php b/app/Views/reports/performance.php index 506ae8f6..24070fa6 100644 --- a/app/Views/reports/performance.php +++ b/app/Views/reports/performance.php @@ -73,27 +73,28 @@
-
+
- - - - + + +
-
+
+ + +
+

- - + +
@@ -102,7 +103,7 @@ - + @@ -112,9 +113,9 @@ - - + +
Nom et prénom Email Motos vendueDate de venteDate de vente Prix d'achat Prix de vente Point de ventes
Total:
@@ -135,48 +136,48 @@
-
+
- +
-
+
- +
-
- - - - - + + +
-
+
+ + +
+

- - + +
- - - - - - - - + + + + + + +
Nom et prénomEmailMotos vendueDate de ventePrix d'achatPrix de ventePoint de ventesBéneficesMécanicienImageMoto réparéeN° SériePoint de venteDate débutDate fin
@@ -200,8 +201,10 @@ // Initialize the datatable + var baseUrl = ''; + manageTable = $('#commperformance').DataTable({ - 'ajax': 'fetchPerformances', + 'ajax': baseUrl + 'reports/detail/fetchPerformances', 'order': [], 'pageLength': 5, 'lengthMenu': [ @@ -241,49 +244,44 @@ } }); + // Filtre commercial - côté serveur $('#filteredB1').on('click', function () { - const startDate = $('#startDate').val(); - const endDate = $('#endDate').val(); - const pvente = $('#pvente').val(); + var startDate = $('#startDate').val(); + var endDate = $('#endDate').val(); + var pvente = $('#pvente').val(); + var commercial = $('#commercialFilter').val(); - // Get all original data (you may need to fetch from server or already loaded) - manageTable.ajax.url('fetchPerformances').load(function () { - const filteredData = []; + var url = baseUrl + 'reports/detail/fetchPerformances?startDate=' + startDate + '&endDate=' + endDate + '&pvente=' + pvente + '&commercial=' + commercial; + manageTable.ajax.url(url).load(); + }); - manageTable.rows().every(function () { - const data = this.data(); - const saleDate = data[3].split(' ')[0]; // extract YYYY-MM-DD from date - const store = data[6]; + // DataTable mécanicien + var mecTable = $('#mecperformance').DataTable({ + 'ajax': baseUrl + 'mecanicien/fetchMecanicienPerformances', + 'order': [], + 'pageLength': 10 + }); - // Filter logic - const dateMatch = (!startDate && !endDate) || - (startDate && endDate && saleDate >= startDate && saleDate <= endDate) || - (startDate && !endDate && saleDate >= startDate) || - (!startDate && endDate && saleDate <= endDate); + // Filtre mécanicien - côté serveur + $('#filteredB2').on('click', function () { + var startDate = $('#startDate2').val(); + var endDate = $('#endDate2').val(); + var mecanic = $('#mecanicienFilter').val(); - const storeMatch = (pvente === 'TOUS' || pvente === store); - - if (dateMatch && storeMatch) { - filteredData.push(data); - } - }); - - // Clear and reload table with filtered data - manageTable.clear().rows.add(filteredData).draw(); - }); + var url = baseUrl + 'mecanicien/fetchMecanicienPerformances?startDate=' + startDate + '&endDate=' + endDate + '&mecanic_id=' + (mecanic === 'TOUS' ? '' : mecanic); + mecTable.ajax.url(url).load(); }); }); + // Export commercial document.getElementById('ExportBTN1').addEventListener('click', function () { - // Select your table - var table = document.getElementById('commperformance'); - - // Convert it to a workbook - var wb = XLSX.utils.table_to_book(table, { - sheet: "Feuille1" - }); - - // Export it + var wb = XLSX.utils.table_to_book(document.getElementById('commperformance'), { sheet: "Commercial" }); XLSX.writeFile(wb, 'export-commercial-performance.xlsx'); }); + + // Export mécanicien + document.getElementById('ExportBTN2').addEventListener('click', function () { + var wb = XLSX.utils.table_to_book(document.getElementById('mecperformance'), { sheet: "Mecanicien" }); + XLSX.writeFile(wb, 'export-mecanicien-performance.xlsx'); + }); \ No newline at end of file diff --git a/app/Views/reports/stockDetail.php b/app/Views/reports/stockDetail.php index f644db74..75d13044 100644 --- a/app/Views/reports/stockDetail.php +++ b/app/Views/reports/stockDetail.php @@ -57,9 +57,17 @@
-
+
+
+ + +
+
+ + +
- +
-
+

- +
@@ -188,7 +196,7 @@ manageTable = $('#venteTable').DataTable({ - 'ajax': 'fetctData/' + 0, + 'ajax': 'fetchData/' + 0, 'order': [], 'pageLength': 5, // Set default rows per page 'lengthMenu': [ @@ -198,7 +206,7 @@ }); manageTable2 = $('#stockTable').DataTable({ - 'ajax': 'fetctDataStock/' + 0, + 'ajax': 'fetchDataStock/' + 0, 'order': [], 'pageLength': 5, // Set default rows per page 'lengthMenu': [ @@ -209,7 +217,7 @@ manageTable3 = $('#export1').DataTable({ ajax: { - url: 'fetctDataStock2/' + 0, + url: 'fetchDataStock2/' + 0, dataSrc: 'data' }, order: [], @@ -226,8 +234,8 @@ let filterValue = filterBtn.value === "TOUS" ? "0" : filterBtn.value; // Update the DataTable dynamically without reinitialization - manageTable.ajax.url('fetctData/' + filterValue).load(); - manageTable2.ajax.url('fetctDataStock/' + filterValue).load(); + manageTable.ajax.url('fetchData/' + filterValue).load(); + manageTable2.ajax.url('fetchDataStock/' + filterValue).load(); }); let productsSold = ; @@ -249,6 +257,14 @@ // Trigger the filter on button click $('#filterBtn').click(function () { let storeId = $('#storeFilter').val(); + let filterValue = storeId === "TOUS" ? "0" : storeId; + let startDate = $('#startDateStock').val(); + let endDate = $('#endDateStock').val(); + let params = '?startDate=' + startDate + '&endDate=' + endDate; + + manageTable.ajax.url('fetchData/' + filterValue + params).load(); + manageTable2.ajax.url('fetchDataStock/' + filterValue + params).load(); + manageTable3.ajax.url('fetchDataStock2/' + filterValue + params).load(); applyFilter(storeId); }); diff --git a/app/Views/securite/index.php b/app/Views/securite/index.php index 608ce0e5..947b357a 100644 --- a/app/Views/securite/index.php +++ b/app/Views/securite/index.php @@ -200,7 +200,7 @@ Image - UGS + N° SERIE Désignation Statut Action @@ -272,7 +272,7 @@ Image N° Facture Désignation - UGS + N° SERIE Marque Client Magasin diff --git a/app/Views/templates/header.php b/app/Views/templates/header.php index a195893f..3cd45249 100644 --- a/app/Views/templates/header.php +++ b/app/Views/templates/header.php @@ -278,6 +278,7 @@ body { transition: width 0.3s ease; box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3); padding-top: 0 !important; + padding-bottom: 80px; } .main-sidebar .logo {