mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-24 15:38:18 +02:00
feat: implement supplier management module with CRUD operations and optimistic updates
This commit is contained in:
1 parent
1488accbdb
commit
44950d2239
5 files changed
+29
-9
No files matched your search
@@ -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 });
|
||||
|
||||
Reference in new issue
Block a user