mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Improve the task management system by enabling secure auto-filling of invoice data
Update the client-side Avoirs page to automatically populate invoice amounts when a verified invoice is found, enhancing user experience and data accuracy. Implement conditional rendering for verification status icons and enable the 'Validate' button only when an invoice is successfully verified. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/H30E1Dv
This commit is contained in:
1 parent
3f671cd6b3
commit
ebbde4d150
3 files changed
+231
-14
No files matched your search
+203
@@ -0,0 +1,203 @@
|
||||
|
||||
|
||||
|
||||
|
||||
🔍 PREMIERS RESULTATS: [
|
||||
|
||||
'1. N°2501 - Blanc',
|
||||
|
||||
'2. N°2502 - Moins de 1€ 2€ 3€ 4€ 5€',
|
||||
|
||||
'3. N°2503 - Imbattables'
|
||||
|
||||
]
|
||||
|
||||
📢 [SERVER] User found: { username: 'admin', role: 'admin' }
|
||||
|
||||
🎯 [PRODUCTION] Using PostgreSQL DASHBOARD_MESSAGES table
|
||||
|
||||
GET /api/user 304 in 89ms
|
||||
|
||||
📋 PUBLICITIES RETURNED: { count: 29 }
|
||||
|
||||
GET /api/publicities 304 in 71ms
|
||||
|
||||
🔍 [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
|
||||
|
||||
🔍 [PRODUCTION] User search result: Found
|
||||
|
||||
❌ [PRODUCTION] User not found with username: admin_local
|
||||
|
||||
🔍 [PRODUCTION] User search result: Not found
|
||||
|
||||
🎯 [PRODUCTION] Found announcements: 2
|
||||
|
||||
GET /api/announcements 304 in 80ms
|
||||
|
||||
GET /api/user 304 in 7ms
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
📢 [SERVER] Fetching announcements for user: admin_local environment: production
|
||||
|
||||
🔗 PRODUCTION: getOrders() récupéré 64 commandes avec relations
|
||||
|
||||
Orders returned: 64 items
|
||||
|
||||
GET /api/orders 304 in 115ms
|
||||
|
||||
Customer Orders API called with: { groupIds: [ 1 ], userRole: 'admin' }
|
||||
|
||||
📢 [SERVER] User found: { username: 'admin', role: 'admin' }
|
||||
|
||||
🎯 [PRODUCTION] Using PostgreSQL DASHBOARD_MESSAGES table
|
||||
|
||||
🔍 [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
|
||||
|
||||
Customer Orders returned: 11 items
|
||||
|
||||
GET /api/customer-orders 304 in 147ms
|
||||
|
||||
GET /api/groups 304 in 125ms
|
||||
|
||||
🔍 [PRODUCTION] User search result: Found
|
||||
|
||||
GET /api/user 304 in 28ms
|
||||
|
||||
🔍 [PRODUCTION] User search result: Not found
|
||||
|
||||
❌ [PRODUCTION] User not found with username: admin_local
|
||||
|
||||
🎯 [PRODUCTION] Found announcements: 2
|
||||
|
||||
🔗 PRODUCTION: getDeliveries() récupéré 82 livraisons avec relations
|
||||
|
||||
Deliveries returned: 82 items
|
||||
|
||||
GET /api/announcements 304 in 199ms
|
||||
|
||||
GET /api/deliveries 304 in 202ms
|
||||
|
||||
GET /api/suppliers 304 in 5ms
|
||||
|
||||
🔍 Avoirs API called with: { groupIds: [ 1 ], userRole: 'admin' }
|
||||
|
||||
📋 Avoirs returned: 1 items
|
||||
|
||||
GET /api/avoirs 304 in 12ms
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 201 KiB |
+28
-14
@@ -441,13 +441,29 @@ export default function Avoirs() {
|
||||
[variables.avoirId]: result
|
||||
}));
|
||||
|
||||
// DÉSACTIVÉ TEMPORAIREMENT : Auto-remplissage pour debug
|
||||
// TODO: Réactiver une fois le problème identifié
|
||||
console.log('✅ Vérification terminée sans auto-remplissage:', {
|
||||
exists: result?.exists,
|
||||
invoiceAmount: result?.invoiceAmount,
|
||||
avoirId: variables.avoirId
|
||||
});
|
||||
// Auto-remplissage sécurisé si facture trouvée et montant disponible
|
||||
if (result?.exists === true && result?.invoiceAmount !== undefined && result?.invoiceAmount !== null) {
|
||||
const avoir = avoirs?.find(a => a?.id === variables.avoirId);
|
||||
if (avoir && avoir.supplierId && avoir.groupId) {
|
||||
try {
|
||||
console.log('🔄 Auto-remplissage montant:', { avoirId: variables.avoirId, amount: result.invoiceAmount });
|
||||
editAvoirMutation.mutate({
|
||||
id: variables.avoirId,
|
||||
data: {
|
||||
supplierId: avoir.supplierId,
|
||||
groupId: avoir.groupId,
|
||||
invoiceReference: avoir.invoiceReference || "",
|
||||
amount: result.invoiceAmount,
|
||||
comment: avoir.comment || "",
|
||||
commercialProcessed: avoir.commercialProcessed || false,
|
||||
status: avoir.status as "En attente de demande" | "Demandé" | "Reçu",
|
||||
}
|
||||
});
|
||||
} catch (autoFillError) {
|
||||
console.error('❌ Erreur auto-remplissage:', autoFillError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setVerifyingAvoirs(prev => {
|
||||
const newSet = new Set(prev);
|
||||
@@ -1136,12 +1152,10 @@ export default function Avoirs() {
|
||||
<div className="flex items-center justify-center">
|
||||
{verifyingAvoirs.has(avoir.id) ? (
|
||||
<Clock className="h-4 w-4 text-blue-500 animate-spin" />
|
||||
) : avoirVerificationResults[avoir.id] ? (
|
||||
avoirVerificationResults[avoir.id].exists ? (
|
||||
<CheckCircle className="h-4 w-4 text-green-500 cursor-help" />
|
||||
) : (
|
||||
<XCircle className="h-4 w-4 text-red-500 cursor-help" />
|
||||
)
|
||||
) : avoirVerificationResults[avoir.id]?.exists === true ? (
|
||||
<CheckCircle className="h-4 w-4 text-green-500 cursor-help" />
|
||||
) : avoirVerificationResults[avoir.id]?.exists === false ? (
|
||||
<XCircle className="h-4 w-4 text-red-500 cursor-help" />
|
||||
) : (
|
||||
<button
|
||||
onClick={() => handleVerifyAvoirInvoice(avoir)}
|
||||
@@ -1172,7 +1186,7 @@ export default function Avoirs() {
|
||||
)}
|
||||
|
||||
{/* Bouton Valider - apparaît si vérification réussie et pas encore validé */}
|
||||
{avoirVerificationResults[avoir.id]?.exists && !avoir.nocodbVerified && (
|
||||
{avoirVerificationResults[avoir.id]?.exists === true && !avoir.nocodbVerified && (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
|
||||
Reference in new issue
Block a user