feat: implement supplier management module with CRUD operations and optimistic updates

This commit is contained in:
Michael committed 2026-04-02 09:38:30 +02:00
1 parent 1488accbdb
commit 44950d2239
5 files changed
+29 -9

No files matched your search

+6 -5
View File
@@ -137,12 +137,13 @@ export default function DlcPage() {
// Toujours mettre à jour le nom du produit
form.setValue("productName", article.libelle1, { shouldValidate: true });
// Matcher le fournisseur par nom
if (article.nom_fou_principal) {
const apiName = article.nom_fou_principal.toLowerCase().trim();
// Matcher le fournisseur par codefou en priorité, sinon par nom
if (article.codefou_principal) {
const matched = (suppliers as any[]).find((s: any) =>
s.name.toLowerCase().trim().includes(apiName) ||
apiName.includes(s.name.toLowerCase().trim())
s.codefou && s.codefou.trim().toLowerCase() === article.codefou_principal.trim().toLowerCase()
) || (suppliers as any[]).find((s: any) =>
s.name.toLowerCase().trim().includes(article.nom_fou_principal?.toLowerCase().trim() || '') ||
(article.nom_fou_principal?.toLowerCase().trim() || '').includes(s.name.toLowerCase().trim())
);
if (matched) {
form.setValue("supplierId", matched.id, { shouldValidate: true });