mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Merge pull request #397 from R0m1k3/1.1
Improve task data handling and prevent errors during edits
This commit is contained in:
3 files changed
+223
-14
No files matched your search
+205
@@ -0,0 +1,205 @@
|
||||
ions
|
||||
|
||||
|
||||
|
||||
|
||||
'1. N°2501 - Blanc',
|
||||
|
||||
'2. N°2502 - Moins de 1€ 2€ 3€ 4€ 5€',
|
||||
|
||||
'3. N°2503 - Imbattables'
|
||||
|
||||
]
|
||||
|
||||
GET /api/user 304 in 64ms
|
||||
|
||||
📋 PUBLICITIES RETURNED: { count: 29 }
|
||||
|
||||
GET /api/publicities 304 in 164ms
|
||||
|
||||
📢 [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
|
||||
|
||||
🔍 [PRODUCTION] User search result: Found
|
||||
|
||||
🔍 [PRODUCTION] User search result: Not found
|
||||
|
||||
❌ [PRODUCTION] User not found with username: admin_local
|
||||
|
||||
🎯 [PRODUCTION] Found announcements: 2
|
||||
|
||||
GET /api/announcements 304 in 67ms
|
||||
|
||||
GET /api/user 304 in 4ms
|
||||
|
||||
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] Fetching announcements for user: admin_local environment: production
|
||||
|
||||
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
|
||||
|
||||
Customer Orders API called with: { groupIds: [ 1 ], userRole: 'admin' }
|
||||
|
||||
📢 [SERVER] User found: { username: 'admin', role: 'admin' }
|
||||
|
||||
🎯 [PRODUCTION] Using PostgreSQL DASHBOARD_MESSAGES table
|
||||
|
||||
Customer Orders returned: 11 items
|
||||
|
||||
GET /api/customer-orders 304 in 93ms
|
||||
|
||||
🔍 [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: getDeliveries() récupéré 82 livraisons avec relations
|
||||
|
||||
Deliveries returned: 82 items
|
||||
|
||||
GET /api/deliveries 304 in 156ms
|
||||
|
||||
🔗 PRODUCTION: getOrders() récupéré 64 commandes avec relations
|
||||
|
||||
Orders returned: 64 items
|
||||
|
||||
🔍 [PRODUCTION] User search result: Found
|
||||
|
||||
🔍 [PRODUCTION] User search result: Not found
|
||||
|
||||
🎯 [PRODUCTION] Found announcements: 2
|
||||
|
||||
❌ [PRODUCTION] User not found with username: admin_local
|
||||
|
||||
GET /api/orders 304 in 194ms
|
||||
|
||||
GET /api/announcements 304 in 192ms
|
||||
|
||||
GET /api/groups 304 in 92ms
|
||||
|
||||
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 11ms
|
||||
|
||||
HEAD /api/health 200 in 1ms
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 207 KiB |
+18
-14
@@ -323,29 +323,33 @@ export default function Avoirs() {
|
||||
|
||||
// Handle edit action
|
||||
const handleEdit = (avoir: Avoir) => {
|
||||
if (!avoir || !avoir.id) return;
|
||||
|
||||
setSelectedAvoir(avoir);
|
||||
editForm.reset({
|
||||
supplierId: avoir.supplierId,
|
||||
groupId: avoir.groupId,
|
||||
supplierId: avoir.supplierId || 0,
|
||||
groupId: avoir.groupId || 0,
|
||||
invoiceReference: avoir.invoiceReference || "",
|
||||
amount: avoir.amount,
|
||||
comment: avoir.comment || "",
|
||||
commercialProcessed: avoir.commercialProcessed,
|
||||
status: avoir.status as "En attente de demande" | "Demandé" | "Reçu",
|
||||
commercialProcessed: avoir.commercialProcessed || false,
|
||||
status: avoir.status || "En attente de demande",
|
||||
});
|
||||
setIsEditDialogOpen(true);
|
||||
};
|
||||
|
||||
// Handle delete action
|
||||
const handleDelete = (avoir: Avoir) => {
|
||||
if (!avoir || !avoir.id) return;
|
||||
|
||||
setSelectedAvoir(avoir);
|
||||
setIsDeleteDialogOpen(true);
|
||||
};
|
||||
|
||||
// Handle status change
|
||||
const handleStatusChange = (avoirId: number, newStatus: string) => {
|
||||
const avoir = avoirs.find(a => a.id === avoirId);
|
||||
if (avoir) {
|
||||
const avoir = avoirs?.find(a => a?.id === avoirId);
|
||||
if (avoir && avoir.supplierId && avoir.groupId) {
|
||||
editAvoirMutation.mutate({
|
||||
id: avoirId,
|
||||
data: {
|
||||
@@ -1096,7 +1100,7 @@ export default function Avoirs() {
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap">
|
||||
<Select
|
||||
value={avoir.status}
|
||||
value={avoir?.status || ''}
|
||||
onValueChange={(newStatus) => handleStatusChange(avoir.id, newStatus)}
|
||||
>
|
||||
<SelectTrigger className="w-full">
|
||||
@@ -1173,7 +1177,7 @@ export default function Avoirs() {
|
||||
<td className="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||
<div className="flex items-center space-x-2">
|
||||
{/* 📋 Icône Upload pour avoirs "Reçu" */}
|
||||
{avoir.status === 'Reçu' && (
|
||||
{avoir?.status === 'Reçu' && (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
@@ -1233,7 +1237,7 @@ export default function Avoirs() {
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{!canEditDelete && avoir.status !== 'Reçu' && (
|
||||
{!canEditDelete && avoir?.status !== 'Reçu' && (
|
||||
<span className="text-gray-400 text-xs">Lecture seule</span>
|
||||
)}
|
||||
</div>
|
||||
@@ -1407,9 +1411,9 @@ export default function Avoirs() {
|
||||
{selectedAvoir && (
|
||||
<div className="mt-4 p-3 bg-gray-50 rounded-lg">
|
||||
<div className="text-sm">
|
||||
<div><strong>Fournisseur:</strong> {selectedAvoir.supplier?.name || 'Fournisseur non défini'}</div>
|
||||
<div><strong>Référence:</strong> {selectedAvoir.invoiceReference || 'Sans référence'}</div>
|
||||
<div><strong>Montant:</strong> {selectedAvoir.amount !== null && selectedAvoir.amount !== undefined ? `${selectedAvoir.amount.toFixed(2)} €` : 'Non spécifié'}</div>
|
||||
<div><strong>Fournisseur:</strong> {selectedAvoir?.supplier?.name || 'Fournisseur non défini'}</div>
|
||||
<div><strong>Référence:</strong> {selectedAvoir?.invoiceReference || 'Sans référence'}</div>
|
||||
<div><strong>Montant:</strong> {selectedAvoir?.amount !== null && selectedAvoir?.amount !== undefined ? `${selectedAvoir.amount.toFixed(2)} €` : 'Non spécifié'}</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -1443,10 +1447,10 @@ export default function Avoirs() {
|
||||
Référence: {selectedAvoirForUpload.invoiceReference || 'Non renseigné'}
|
||||
</div>
|
||||
<div className="text-gray-600">
|
||||
Magasin: {selectedAvoirForUpload.group?.name || 'Magasin non défini'}
|
||||
Magasin: {selectedAvoirForUpload?.group?.name || 'Magasin non défini'}
|
||||
</div>
|
||||
<div className="text-gray-600">
|
||||
Montant: {selectedAvoirForUpload.amount !== null && selectedAvoirForUpload.amount !== undefined ? `${selectedAvoirForUpload.amount.toFixed(2)} €` : 'Non spécifié'}
|
||||
Montant: {selectedAvoirForUpload?.amount !== null && selectedAvoirForUpload?.amount !== undefined ? `${selectedAvoirForUpload.amount.toFixed(2)} €` : 'Non spécifié'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user