|
24 | 24 |
|
25 | 25 | <div class="relative"> |
26 | 26 | {#if !expanded} |
27 | | - <div |
28 | | - class="flex items-center gap-2 text-xs" |
29 | | - role="button" |
30 | | - tabindex="0" |
| 27 | + <button |
| 28 | + class="w-full text-left p-2 rounded-md border border-gray-200 dark:border-gray-600 hover:border-blue-400 dark:hover:border-blue-500 hover:bg-blue-50 dark:hover:bg-blue-950/30 transition-all group" |
31 | 29 | on:click={() => (expanded = true)} |
32 | | - on:keydown={(e) => e.key === 'Enter' && (expanded = true)} |
33 | 30 | > |
34 | | - <span class="dark:text-gray-300">{getFournisseurName(item.fournisseur)}</span> |
35 | | - {#if item.amount_per_bundle || item.ref_bundle} |
36 | | - <span class="text-gray-500 dark:text-gray-400"> |
37 | | - {item.amount_per_bundle ? `| B:${item.amount_per_bundle}` : ''} |
38 | | - {item.ref_bundle ? ` | R:${item.ref_bundle}` : ''} |
39 | | - </span> |
40 | | - {/if} |
41 | | - <button |
42 | | - class="p-1 hover:bg-gray-200 dark:hover:bg-gray-600 rounded transition-colors" |
43 | | - on:click|stopPropagation={() => (expanded = true)} |
44 | | - > |
45 | | - <iconify-icon icon="mdi:pencil" width="14" height="14"></iconify-icon> |
46 | | - </button> |
47 | | - </div> |
| 31 | + <div class="flex items-center justify-between gap-2"> |
| 32 | + <div class="flex flex-col gap-1 text-xs flex-1 min-w-0"> |
| 33 | + <div class="flex items-center gap-2"> |
| 34 | + <span class="text-gray-500 dark:text-gray-400 font-medium">Fourn:</span> |
| 35 | + <span class="font-semibold dark:text-gray-200 truncate">{getFournisseurName(item.fournisseur)}</span> |
| 36 | + </div> |
| 37 | + {#if item.amount_per_bundle || item.ref_bundle} |
| 38 | + <div class="flex items-center gap-2 text-gray-600 dark:text-gray-400"> |
| 39 | + {#if item.amount_per_bundle} |
| 40 | + <span>Bundle: {item.amount_per_bundle}</span> |
| 41 | + {/if} |
| 42 | + {#if item.ref_bundle} |
| 43 | + <span>Ref: {item.ref_bundle}</span> |
| 44 | + {/if} |
| 45 | + </div> |
| 46 | + {/if} |
| 47 | + </div> |
| 48 | + <iconify-icon icon="mdi:chevron-down" width="16" height="16" class="text-gray-400 group-hover:text-blue-500 transition-colors flex-shrink-0"></iconify-icon> |
| 49 | + </div> |
| 50 | + </button> |
48 | 51 | {:else} |
49 | | - <div class="min-w-[160px] space-y-2 mt-8"> |
50 | | - <button |
51 | | - class="absolute -top-8 right-2 px-2 py-1 bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded z-10 flex items-center gap-1 text-xs" |
52 | | - on:click={() => (expanded = false)} |
53 | | - > |
54 | | - <iconify-icon icon="mdi:close" width="14" height="14"></iconify-icon> |
55 | | - <span>Fermer</span> |
56 | | - </button> |
57 | | - <div> |
58 | | - <label class="text-xs block dark:text-gray-400 mb-1">Fournisseur</label> |
59 | | - <select |
60 | | - class="w-full text-xs px-2 py-1 border border-gray-200 dark:border-gray-600 rounded dark:bg-gray-700 dark:text-white focus:border-blue-500 focus:outline-none" |
61 | | - value={item.fournisseur ?? ''} |
62 | | - on:change={(e) => { |
63 | | - // @ts-ignore |
64 | | - editItem(item.id, { fournisseur: e.target?.value || undefined }, item.category_id); |
65 | | - }} |
| 52 | + <div class="border border-blue-500 dark:border-blue-400 rounded-md p-3 bg-blue-50/50 dark:bg-blue-950/20"> |
| 53 | + <div class="flex items-center justify-between mb-3"> |
| 54 | + <span class="text-xs font-semibold text-blue-700 dark:text-blue-300">Modifier Fournisseur</span> |
| 55 | + <button |
| 56 | + class="px-2 py-1 text-xs bg-white dark:bg-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 border border-gray-300 dark:border-gray-500 rounded flex items-center gap-1 transition-colors" |
| 57 | + on:click={() => (expanded = false)} |
66 | 58 | > |
67 | | - <option value="">-</option> |
68 | | - {#each fournisseurIterator as [val, name]} |
69 | | - <option value={val}>{name}</option> |
70 | | - {/each} |
71 | | - </select> |
72 | | - </div> |
73 | | - <div> |
74 | | - <label class="text-xs block dark:text-gray-400 mb-1">Bundle/Qté</label> |
75 | | - <input |
76 | | - type="number" |
77 | | - class="w-full text-xs px-2 py-1 border border-gray-200 dark:border-gray-600 rounded dark:bg-gray-700 dark:text-white focus:border-blue-500 focus:outline-none" |
78 | | - value={item.amount_per_bundle ?? ''} |
79 | | - placeholder="0" |
80 | | - on:input={(e) => { |
81 | | - // @ts-ignore |
82 | | - let val = e.target?.value; |
83 | | - editItem(item.id, { amount_per_bundle: val ? parseInt(val) : undefined }, item.category_id); |
84 | | - }} |
85 | | - /> |
| 59 | + <iconify-icon icon="mdi:check" width="14" height="14"></iconify-icon> |
| 60 | + <span>Fermer</span> |
| 61 | + </button> |
86 | 62 | </div> |
87 | | - <div> |
88 | | - <label class="text-xs block dark:text-gray-400 mb-1">Ref Code</label> |
89 | | - <input |
90 | | - type="text" |
91 | | - class="w-full text-xs px-2 py-1 border border-gray-200 dark:border-gray-600 rounded dark:bg-gray-700 dark:text-white focus:border-blue-500 focus:outline-none" |
92 | | - value={item.ref_bundle ?? ''} |
93 | | - placeholder="-" |
94 | | - on:input={(e) => { |
95 | | - // @ts-ignore |
96 | | - editItem(item.id, { ref_bundle: e.target?.value || undefined }, item.category_id); |
97 | | - }} |
98 | | - /> |
| 63 | + <div class="space-y-2"> |
| 64 | + <div> |
| 65 | + <label class="text-xs block font-medium dark:text-gray-300 mb-1">Fournisseur</label> |
| 66 | + <select |
| 67 | + class="w-full text-xs px-2 py-1.5 border border-gray-300 dark:border-gray-500 rounded bg-white dark:bg-gray-700 dark:text-white focus:border-blue-500 focus:ring-2 focus:ring-blue-200 dark:focus:ring-blue-800 outline-none transition-all" |
| 68 | + value={item.fournisseur ?? ''} |
| 69 | + on:change={(e) => { |
| 70 | + // @ts-ignore |
| 71 | + editItem(item.id, { fournisseur: e.target?.value || undefined }, item.category_id); |
| 72 | + }} |
| 73 | + > |
| 74 | + <option value="">-</option> |
| 75 | + {#each fournisseurIterator as [val, name]} |
| 76 | + <option value={val}>{name}</option> |
| 77 | + {/each} |
| 78 | + </select> |
| 79 | + </div> |
| 80 | + <div> |
| 81 | + <label class="text-xs block font-medium dark:text-gray-300 mb-1">Bundle/Quantité</label> |
| 82 | + <input |
| 83 | + type="number" |
| 84 | + class="w-full text-xs px-2 py-1.5 border border-gray-300 dark:border-gray-500 rounded bg-white dark:bg-gray-700 dark:text-white focus:border-blue-500 focus:ring-2 focus:ring-blue-200 dark:focus:ring-blue-800 outline-none transition-all" |
| 85 | + value={item.amount_per_bundle ?? ''} |
| 86 | + placeholder="0" |
| 87 | + on:input={(e) => { |
| 88 | + // @ts-ignore |
| 89 | + let val = e.target?.value; |
| 90 | + editItem(item.id, { amount_per_bundle: val ? parseInt(val) : undefined }, item.category_id); |
| 91 | + }} |
| 92 | + /> |
| 93 | + </div> |
| 94 | + <div> |
| 95 | + <label class="text-xs block font-medium dark:text-gray-300 mb-1">Code Référence</label> |
| 96 | + <input |
| 97 | + type="text" |
| 98 | + class="w-full text-xs px-2 py-1.5 border border-gray-300 dark:border-gray-500 rounded bg-white dark:bg-gray-700 dark:text-white focus:border-blue-500 focus:ring-2 focus:ring-blue-200 dark:focus:ring-blue-800 outline-none transition-all" |
| 99 | + value={item.ref_bundle ?? ''} |
| 100 | + placeholder="-" |
| 101 | + on:input={(e) => { |
| 102 | + // @ts-ignore |
| 103 | + editItem(item.id, { ref_bundle: e.target?.value || undefined }, item.category_id); |
| 104 | + }} |
| 105 | + /> |
| 106 | + </div> |
99 | 107 | </div> |
100 | 108 | </div> |
101 | 109 | {/if} |
|
0 commit comments