Update product expiry date handling and display logic

Refactor client/src/pages/DlcPage.tsx to rename `dlcDate` to `expiryDate` in the `InsertDlcProduct` type and update its usage throughout the component for consistency and clarity.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: a3de0820-9397-41b2-b000-7931ee9c29de
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/a3de0820-9397-41b2-b000-7931ee9c29de/vqNg9rh
This commit is contained in:
michaelschal committed 2025-08-15 21:13:36 +00:00
1 parent ff414a16c7
commit 6b2c5af4f1
3 files changed
+207 -5

No files matched your search

@@ -0,0 +1,202 @@
📊 Calcul statistiques mensuelles: {
year: 2025,
month: 8,
startDate: '2025-08-01',
endDate: '2025-09-01',
groupIds: undefined
}
🗓️ [DATE-CALC] Aujourd'hui: 2025-08-15 (Vendredi)
🗓️ [DATE-CALC] Année précédente: 2024-08-16 (Vendredi)
🌤️ [RESPONSE] Weather data prepared: {
hasCurrentYear: true,
hasPreviousYear: true,
location: 'Frouard, France'
}
GET /api/weather/current 304 in 72ms
📊 Statistiques calculées: {
ordersCount: 20,
deliveriesCount: 42,
pendingOrdersCount: 8,
averageDeliveryTime: 0.3611111111111111,
totalPalettes: 120,
totalPackages: 36
}
GET /api/stats/monthly 304 in 72ms
Deliveries API called with: {
startDate: undefined,
endDate: undefined,
storeId: undefined,
withBL: undefined,
userRole: 'admin'
}
Admin filtering deliveries with groupIds: undefined
Fetching all deliveries
Orders API called with: {
startDate: undefined,
endDate: undefined,
storeId: undefined,
userRole: 'admin'
}
Admin filtering with groupIds: undefined
Fetching all orders
Customer Orders API called with: { groupIds: undefined, userRole: 'admin' }
🔗 PRODUCTION: getOrders() récupéré 51 commandes avec relations
Orders returned: 51 items
GET /api/orders 304 in 372ms
🔍 Tasks API called with: {
groupIds: undefined,
userRole: 'admin',
userId: 'admin_local',
requestedStoreId: undefined,
userGroups: 'all'
}
GET /api/user 304 in 361ms
GET /api/dlc-products/stats 304 in 367ms
🔗 PRODUCTION: getDeliveries() récupéré 86 livraisons avec relations
Deliveries returned: 86 items
GET /api/deliveries 304 in 384ms
Customer Orders returned: 37 items
GET /api/customer-orders 304 in 385ms
📋 Tasks returned: 55 items for user: admin_local
GET /api/tasks 304 in 377ms
GET /api/publicities 304 in 384ms
GET /api/user 304 in 5ms
Orders API called with: {
startDate: undefined,
endDate: undefined,
storeId: '1',
userRole: 'admin'
}
Admin filtering with groupIds: [ 1 ]
Fetching all orders
Deliveries API called with: {
startDate: undefined,
endDate: undefined,
storeId: '1',
withBL: undefined,
userRole: 'admin'
}
Admin filtering deliveries with groupIds: [ 1 ]
Fetching all deliveries
Customer Orders API called with: { groupIds: [ 1 ], userRole: 'admin' }
🔗 PRODUCTION: getOrders() récupéré 33 commandes avec relations
Orders returned: 33 items
GET /api/orders 304 in 120ms
🔗 PRODUCTION: getDeliveries() récupéré 48 livraisons avec relations
Deliveries returned: 48 items
GET /api/deliveries 304 in 137ms
Customer Orders returned: 9 items
GET /api/customer-orders 304 in 139ms
GET /api/groups 304 in 60ms
GET /api/publicities 304 in 90ms
GET /api/user 304 in 6ms
GET /api/suppliers 304 in 9ms
GET /api/dlc-products 304 in 24ms
GET /api/weather/current 401 in 1ms
📄 SPA: Serving index.html for /auth
GET /api/user 401 in 1ms
GET /api/user 401 in 1ms
GET /api/default-credentials-check 304 in 4ms
HEAD /api/health 200 in 1ms
Binary file not shown.

After

Width:  |  Height:  |  Size: 421 KiB

+5 -5
View File
@@ -229,7 +229,7 @@ export default function DlcPage() {
const dlcData: InsertDlcProduct = {
...data,
dlcDate,
expiryDate: dlcDate,
quantity: 1, // Valeur par défaut
unit: "unité", // Valeur par défaut
location: "Magasin", // Valeur par défaut
@@ -249,7 +249,7 @@ export default function DlcPage() {
form.reset({
productName: product.productName,
gencode: product.gencode || "",
dlcDate: product.dlcDate ? format(new Date(product.dlcDate), "yyyy-MM-dd") : "",
dlcDate: product.expiryDate ? format(new Date(product.expiryDate), "yyyy-MM-dd") : "",
dateType: product.dateType as "dlc" | "ddm" | "dluo",
supplierId: product.supplierId,
status: product.status as "en_cours" | "expires_soon" | "expires" | "valides",
@@ -278,7 +278,7 @@ export default function DlcPage() {
// Fonction pour déterminer si un produit doit afficher le bouton de validation
const shouldShowValidateButton = (product: DlcProductWithRelations) => {
const today = new Date();
const expiry = new Date(product.dlcDate || new Date());
const expiry = new Date(product.expiryDate || new Date());
const daysUntilExpiry = Math.ceil((expiry.getTime() - today.getTime()) / (1000 * 60 * 60 * 24));
// Afficher le bouton si le produit expire dans 15 jours ou moins, ou est déjà expiré
@@ -779,10 +779,10 @@ export default function DlcPage() {
</Badge>
</TableCell>
<TableCell>
{product.dlcDate ? format(new Date(product.dlcDate), "dd/MM/yyyy", { locale: fr }) : 'Date non définie'}
{product.expiryDate ? format(new Date(product.expiryDate), "dd/MM/yyyy", { locale: fr }) : 'Date non définie'}
</TableCell>
<TableCell>{product.supplier?.name || 'Non défini'}</TableCell>
<TableCell>{getStatusBadge(product.status, product.dlcDate)}</TableCell>
<TableCell>{getStatusBadge(product.status, product.expiryDate)}</TableCell>
<TableCell>
<div className="flex space-x-2">
<Button