Merge pull request #401 from R0m1k3/1.1

1.1
This commit is contained in:
LogiFlow authored and GitHub committed 2025-09-08 21:29:52 +02:00
commit a12bc5c6e8
3 files changed
+240 -3

No files matched your search

@@ -0,0 +1,202 @@
createdBy: 'admin',
createdAt: 2025-08-18T10:45:08.585Z
},
{
id: 8,
title: 'Bon de Livraison',
content: 'Lorsque vous rentrez un numéro de bon de livraison, faite le a l identique, même les majuscules. Pour My candy Shop, prendre le numéro de commande.',
type: 'info',
storeId: null,
createdBy: 'admin_local',
createdAt: 2025-08-07T11:04:38.123Z
}
]
🔍 [PRODUCTION] Looking for user with username: admin
🔍 [PRODUCTION] Looking for user with username: admin_local
GET /api/dlc-products/stats 304 in 459ms
🔍 [PRODUCTION] User search result: Found
📢 [SERVER] Fetching announcements for user: admin_local environment: production
🔍 [PRODUCTION] User search result: Not found
❌ [PRODUCTION] User not found with username: admin_local
🎯 [PRODUCTION] Found announcements: 2
GET /api/announcements 304 in 348ms
Customer Orders API called with: { groupIds: [ 1 ], userRole: 'admin' }
📋 API PUBLICITIES REQUEST: {
year: '2025',
filterYear: 2025,
storeId: undefined,
userRole: 'admin'
}
📋 CALLING storage.getPublicities: { filterYear: 2025, groupIds: undefined }
GET /api/user 304 in 75ms
Deliveries API called with: {
startDate: undefined,
endDate: undefined,
storeId: '1',
withBL: undefined,
userRole: 'admin'
}
🔍 Admin deliveries filtering by store: { storeId: '1', groupIds: [ 1 ], role: 'admin' }
Fetching all deliveries
Orders API called with: {
startDate: undefined,
endDate: undefined,
storeId: '1',
userRole: 'admin'
}
🔍 Admin orders filtering by store: { storeId: '1', groupIds: [ 1 ], role: 'admin' }
Fetching all orders
📢 [SERVER] User found: { username: 'admin', role: 'admin' }
🎯 [PRODUCTION] Using PostgreSQL DASHBOARD_MESSAGES table
📋 PUBLICITES FETCHED: 29 résultats pour année 2025
🔍 PREMIERS RESULTATS: [
'1. N°2501 - Blanc',
'2. N°2502 - Moins de 1€ 2€ 3€ 4€ 5€',
'3. N°2503 - Imbattables'
]
Customer Orders returned: 11 items
GET /api/customer-orders 304 in 53ms
🔍 [PRODUCTION] Raw messages from DB: 2 items: [
{
id: 16,
title: 'Mise à jour Prix',
content: 'Merci de mettre vos prix a jour tous les matins, certain magasin ne le font pas.',
type: 'success',
storeId: null,
createdBy: 'admin',
createdAt: 2025-08-18T10:45:08.585Z
},
{
id: 8,
title: 'Bon de Livraison',
content: 'Lorsque vous rentrez un numéro de bon de livraison, faite le a l identique, même les majuscules. Pour My candy Shop, prendre le numéro de commande.',
type: 'info',
storeId: null,
createdBy: 'admin_local',
createdAt: 2025-08-07T11:04:38.123Z
}
]
🔍 [PRODUCTION] Looking for user with username: admin
🔍 [PRODUCTION] Looking for user with username: admin_local
📋 PUBLICITIES RETURNED: { count: 29 }
GET /api/publicities 304 in 223ms
🔍 [PRODUCTION] User search result: Not found
❌ [PRODUCTION] User not found with username: admin_local
🔍 [PRODUCTION] User search result: Found
🎯 [PRODUCTION] Found announcements: 2
🔗 PRODUCTION: getOrders() récupéré 64 commandes avec relations
Orders returned: 64 items
GET /api/announcements 304 in 189ms
GET /api/orders 304 in 204ms
🔗 PRODUCTION: getDeliveries() récupéré 82 livraisons avec relations
Deliveries returned: 82 items
GET /api/deliveries 304 in 225ms
GET /api/groups 304 in 91ms
GET /api/user 304 in 4ms
GET /api/suppliers 304 in 7ms
🔍 Avoirs API called with: { groupIds: [ 1 ], userRole: 'admin' }
📋 Avoirs returned: 1 items
GET /api/avoirs 304 in 10ms
GET /api/user 304 in 5ms
Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

+38 -3
View File
@@ -425,6 +425,20 @@ export default function Avoirs() {
}
};
// Debug: Log des avoirs reçus
useEffect(() => {
console.log('💰 Debug avoirs reçus:', {
count: avoirs?.length || 0,
first: avoirs?.[0] ? {
id: avoirs[0].id,
keys: Object.keys(avoirs[0]),
hasSupplier: !!avoirs[0].supplier,
hasGroup: !!avoirs[0].group,
hasCreator: !!avoirs[0].creator
} : null
});
}, [avoirs]);
// 🔍 FONCTION DE VÉRIFICATION DE FACTURE (comme rapprochement)
const verifyAvoirInvoiceMutation = useMutation({
mutationFn: async ({ avoirId, invoiceReference, forceRefresh }: { avoirId: number; invoiceReference?: string; forceRefresh?: boolean }) => {
@@ -1041,9 +1055,20 @@ export default function Avoirs() {
</thead>
<tbody className="bg-white divide-y divide-gray-200">
{filteredAvoirs?.filter(avoir => avoir && avoir.id).map((avoir) => {
const canEditDelete = ['admin', 'directeur'].includes((user as any)?.role);
return (
try {
// Debug: Log de l'avoir pour identifier le problème
console.log('🔍 Render avoir:', {
id: avoir?.id,
hasSupplier: !!avoir?.supplier,
hasGroup: !!avoir?.group,
hasCreator: !!avoir?.creator,
createdAt: avoir?.createdAt,
status: avoir?.status
});
const canEditDelete = ['admin', 'directeur'].includes((user as any)?.role);
return (
<tr key={avoir?.id || Math.random()} className={`hover:bg-gray-50 ${avoir?.nocodbVerified ? 'bg-gray-100 opacity-75' : ''}`}>
<td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
{avoir.supplier?.name || 'Fournisseur non défini'}
@@ -1199,6 +1224,16 @@ export default function Avoirs() {
</td>
</tr>
);
} catch (renderError) {
console.error('❌ Erreur rendu avoir:', renderError, avoir);
return (
<tr key={avoir?.id || Math.random()} className="bg-red-50">
<td colSpan={8} className="px-6 py-4 text-center text-red-600">
Erreur d'affichage de l'avoir #{avoir?.id || 'inconnu'}
</td>
</tr>
);
}
})}
</tbody>
</table>