From 4af8ea2c60ce68b4ffeb5eb03eb7502dc76aa754 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 29 Jan 2026 16:44:31 +0300 Subject: [PATCH] Gestion des avoirs --- .../Avoir/AvoirDetailPresentation.vue | 632 ++++++++++++++---- .../Organism/Avoir/AvoirListPresentation.vue | 8 +- .../Organism/Avoir/NewAvoirPresentation.vue | 32 +- .../Commande/CommandeDetailPresentation.vue | 532 ++++++++++++--- .../Commande/NewCommandePresentation.vue | 8 +- .../molecules/Avoir/NewAvoirForm.vue | 297 ++++++-- .../molecules/form/NewEmployeeForm.vue | 39 +- .../molecules/form/NewFournisseurForm.vue | 49 +- 8 files changed, 1274 insertions(+), 323 deletions(-) diff --git a/thanasoft-front/src/components/Organism/Avoir/AvoirDetailPresentation.vue b/thanasoft-front/src/components/Organism/Avoir/AvoirDetailPresentation.vue index 0c1c516..da29cd4 100644 --- a/thanasoft-front/src/components/Organism/Avoir/AvoirDetailPresentation.vue +++ b/thanasoft-front/src/components/Organism/Avoir/AvoirDetailPresentation.vue @@ -7,104 +7,189 @@
{{ error }}
- - - - - - - - - - - - + + +
+
+
+ +
{{ getReasonLabel(avoir.reason_type) }}
+
+
+ +
{{ getRefundMethodLabel(avoir.refund_method) }}
+
+
+
+ + + +
+
+
+ + Articles de l'avoir +
+
+ +
+
+
+
+ +
{{ line.description }}
+
+ +
+ +
{{ line.quantity }}
+
+ +
+ +
{{ formatCurrency(line.unit_price) }}
+
+ +
+ + + {{ formatCurrency(line.total_ht) }} + +
+
+
+
+
+ + +
+
+
+ Total HT + {{ formatCurrency(avoir.total_ht) }} +
+
+ TVA (20%) + {{ formatCurrency(avoir.total_tva) }} +
+
+ Total TTC + {{ formatCurrency(avoir.total_ttc) }} +
+
+
+ + +
+
+ + Informations supplémentaires +
+ +
+
+ +
{{ formatDate(avoir.created_at) }}
+
+
+ +
{{ avoir.client?.email || avoir.client?.phone || 'Non spécifié' }}
+
+
+ +
+ +
{{ avoir.reason_description }}
+
+
+ + +
+
+ + + Changer le statut + + + +
+ + + Télécharger PDF + +
+ + + diff --git a/thanasoft-front/src/components/Organism/Avoir/AvoirListPresentation.vue b/thanasoft-front/src/components/Organism/Avoir/AvoirListPresentation.vue index 2860ed0..9bec85f 100644 --- a/thanasoft-front/src/components/Organism/Avoir/AvoirListPresentation.vue +++ b/thanasoft-front/src/components/Organism/Avoir/AvoirListPresentation.vue @@ -25,9 +25,11 @@ import AvoirListControls from "@/components/molecules/Avoir/AvoirListControls.vu import AvoirTable from "@/components/molecules/Tables/Avoirs/AvoirTable.vue"; import { useAvoirStore } from "@/stores/avoirStore"; import { storeToRefs } from "pinia"; +import { useNotificationStore } from "@/stores/notification"; const router = useRouter(); const avoirStore = useAvoirStore(); +const notificationStore = useNotificationStore(); const { avoirs, loading, error } = storeToRefs(avoirStore); const activeFilter = ref(null); @@ -80,6 +82,8 @@ const handleExport = () => { document.body.appendChild(link); link.click(); document.body.removeChild(link); + + notificationStore.success("Export", "Fichier CSV exporté avec succès"); }; const getStatusLabel = (status) => { @@ -96,9 +100,9 @@ const handleDelete = async (id) => { if (confirm("Êtes-vous sûr de vouloir supprimer cet avoir ?")) { try { await avoirStore.deleteAvoir(id); - alert("Avoir supprimé avec succès"); + notificationStore.success("Succès", "Avoir supprimé avec succès"); } catch (err) { - alert("Erreur lors de la suppression de l'avoir"); + notificationStore.error("Erreur", "Erreur lors de la suppression de l'avoir"); } } }; diff --git a/thanasoft-front/src/components/Organism/Avoir/NewAvoirPresentation.vue b/thanasoft-front/src/components/Organism/Avoir/NewAvoirPresentation.vue index 3165118..4e210c5 100644 --- a/thanasoft-front/src/components/Organism/Avoir/NewAvoirPresentation.vue +++ b/thanasoft-front/src/components/Organism/Avoir/NewAvoirPresentation.vue @@ -24,15 +24,41 @@ import { useRouter } from "vue-router"; import NewAvoirForm from "@/components/molecules/Avoir/NewAvoirForm.vue"; import SoftButton from "@/components/SoftButton.vue"; +import { useAvoirStore } from "@/stores/avoirStore"; +import { useNotificationStore } from "@/stores/notification"; const router = useRouter(); +const avoirStore = useAvoirStore(); +const notificationStore = useNotificationStore(); const goBack = () => { router.back(); }; -const handleSubmit = (formData) => { - alert(`Avoir créé avec succès: ${formData.number}`); - router.push("/avoirs"); +const handleSubmit = async (formData) => { + try { + const payload = { + client_id: formData.clientId, + invoice_id: formData.invoiceId, + avoir_number: formData.number, + status: formData.status, + avoir_date: formData.date, + reason_type: formData.reason, + reason_description: formData.reasonDetail, + lines: formData.lines.map(line => ({ + description: line.designation, + quantity: line.quantity, + unit_price: line.priceHt, + tva_rate: 0, + })), + }; + + await avoirStore.createAvoir(payload); + notificationStore.success("Succès", `Avoir créé avec succès: ${formData.number}`); + router.push("/avoirs"); + } catch (err) { + console.error("Error creating avoir:", err); + notificationStore.error("Erreur", "Erreur lors de la création de l'avoir"); + } }; diff --git a/thanasoft-front/src/components/Organism/Commande/CommandeDetailPresentation.vue b/thanasoft-front/src/components/Organism/Commande/CommandeDetailPresentation.vue index 6d79e71..5efd717 100644 --- a/thanasoft-front/src/components/Organism/Commande/CommandeDetailPresentation.vue +++ b/thanasoft-front/src/components/Organism/Commande/CommandeDetailPresentation.vue @@ -7,103 +7,178 @@
{{ error }}
- - - - - - - - - - - - + + +
+ +
{{ commande.deliveryAddress || 'Non spécifiée' }}
+
+ + + +
+
+
+ + Articles commandés +
+
+ +
+
+
+
+ +
{{ line.designation }}
+
+ +
+ +
{{ line.quantity }}
+
+ +
+ +
{{ formatCurrency(line.price_ht) }}
+
+ +
+ + + {{ formatCurrency(line.total_ht) }} + +
+
+
+
+
+ + +
+
+
+ Total HT + {{ formatCurrency(commande.total_ht) }} +
+
+ TVA (20%) + {{ formatCurrency(commande.total_tva) }} +
+
+ Total TTC + {{ formatCurrency(commande.total_ttc) }} +
+
+
+ + +
+
+ + Informations supplémentaires +
+ +
+
+ +
{{ commande.supplierAddress }}
+
+
+ +
{{ formatDate(commande.date) }}
+
+
+ +
+ +
{{ commande.notes }}
+
+
+ + +
+
+ + + Changer le statut + + + +
+ + + Télécharger PDF + +
+ + + diff --git a/thanasoft-front/src/components/Organism/Commande/NewCommandePresentation.vue b/thanasoft-front/src/components/Organism/Commande/NewCommandePresentation.vue index d0c974f..9f832b7 100644 --- a/thanasoft-front/src/components/Organism/Commande/NewCommandePresentation.vue +++ b/thanasoft-front/src/components/Organism/Commande/NewCommandePresentation.vue @@ -6,7 +6,12 @@
Créer une nouvelle commande
- + Retour
@@ -32,7 +37,6 @@ const goBack = () => { }; const handleSubmit = (formData) => { - alert(`Commande créée avec succès: ${formData.number}`); router.push("/fournisseurs/commandes"); }; diff --git a/thanasoft-front/src/components/molecules/Avoir/NewAvoirForm.vue b/thanasoft-front/src/components/molecules/Avoir/NewAvoirForm.vue index a10fb83..ae366fb 100644 --- a/thanasoft-front/src/components/molecules/Avoir/NewAvoirForm.vue +++ b/thanasoft-front/src/components/molecules/Avoir/NewAvoirForm.vue @@ -29,16 +29,50 @@
- +
-
+
- +
+ + +
+ + +
+ + + +
@@ -81,7 +115,7 @@ @@ -105,7 +139,7 @@
-
+

@@ -175,7 +209,7 @@ @@ -202,59 +236,139 @@