|
1 | 1 | <template> |
2 | | - <div v-if="showButtons" class="button-group d-flex justify-content-between align-items-center"> |
3 | | - <div class="button-left d-flex gap-2"> |
4 | | - <button |
5 | | - v-if="dataType === 'samples'" |
6 | | - data-testid="add-item-button" |
7 | | - class="btn btn-default" |
8 | | - @click="$emit('open-create-item-modal')" |
9 | | - > |
10 | | - Add an item |
11 | | - </button> |
12 | | - <button |
13 | | - v-if="dataType === 'samples'" |
14 | | - data-testid="batch-item-button" |
15 | | - class="btn btn-default" |
16 | | - @click="$emit('open-batch-create-item-modal')" |
17 | | - > |
18 | | - Add batch of items |
19 | | - </button> |
20 | | - <button |
21 | | - v-if="dataType === 'samples'" |
22 | | - data-testid="scan-qr-button" |
23 | | - class="btn btn-default" |
24 | | - @click="$emit('open-qr-scanner-modal')" |
25 | | - > |
26 | | - <font-awesome-icon icon="qrcode" /> Scan QR |
27 | | - </button> |
28 | | - <button |
29 | | - v-if="dataType === 'collections'" |
30 | | - data-testid="add-collection-button" |
31 | | - class="btn btn-default" |
32 | | - @click="$emit('open-create-collection-modal')" |
33 | | - > |
34 | | - Create new collection |
35 | | - </button> |
36 | | - <button |
37 | | - v-if="dataType === 'startingMaterials' && editableInventory" |
38 | | - data-testid="add-starting-material-button" |
39 | | - class="btn btn-default" |
40 | | - @click="$emit('open-create-item-modal')" |
41 | | - > |
42 | | - Add a starting material |
43 | | - </button> |
44 | | - <button |
45 | | - v-if="dataType === 'equipment'" |
46 | | - data-testid="add-equipment-button" |
47 | | - class="btn btn-default" |
48 | | - @click="$emit('open-create-equipment-modal')" |
49 | | - > |
50 | | - Add an item |
51 | | - </button> |
| 2 | + <div v-if="showButtons" class="d-flex justify-content-between align-items-center flex-wrap gap-2"> |
| 3 | + <!-- Section gauche : Boutons ou dropdown --> |
| 4 | + <div class="d-flex flex-grow-1 align-items-center gap-2"> |
| 5 | + <!-- Dropdown visible automatiquement en mobile --> |
| 6 | + <div class="d-lg-none dropdown"> |
| 7 | + <button |
| 8 | + class="btn btn-default dropdown-toggle" |
| 9 | + type="button" |
| 10 | + data-bs-toggle="dropdown" |
| 11 | + aria-expanded="false" |
| 12 | + > |
| 13 | + Add... |
| 14 | + </button> |
| 15 | + <ul class="dropdown-menu"> |
| 16 | + <li> |
| 17 | + <button |
| 18 | + v-if="dataType === 'samples'" |
| 19 | + data-testid="add-item-button" |
| 20 | + class="dropdown-item" |
| 21 | + @click="$emit('open-create-item-modal')" |
| 22 | + > |
| 23 | + Add an item |
| 24 | + </button> |
| 25 | + </li> |
| 26 | + <li> |
| 27 | + <button |
| 28 | + v-if="dataType === 'samples'" |
| 29 | + data-testid="batch-item-button" |
| 30 | + class="dropdown-item" |
| 31 | + @click="$emit('open-batch-create-item-modal')" |
| 32 | + > |
| 33 | + Add batch of items |
| 34 | + </button> |
| 35 | + </li> |
| 36 | + <li> |
| 37 | + <button |
| 38 | + v-if="dataType === 'samples'" |
| 39 | + data-testid="scan-qr-button" |
| 40 | + class="dropdown-item" |
| 41 | + @click="$emit('open-qr-scanner-modal')" |
| 42 | + > |
| 43 | + <font-awesome-icon icon="qrcode" /> Scan QR |
| 44 | + </button> |
| 45 | + </li> |
| 46 | + <li> |
| 47 | + <button |
| 48 | + v-if="dataType === 'collections'" |
| 49 | + data-testid="add-collection-button" |
| 50 | + class="dropdown-item" |
| 51 | + @click="$emit('open-create-collection-modal')" |
| 52 | + > |
| 53 | + Create new collection |
| 54 | + </button> |
| 55 | + </li> |
| 56 | + <li> |
| 57 | + <button |
| 58 | + v-if="dataType === 'startingMaterials' && editableInventory" |
| 59 | + data-testid="add-starting-material-button" |
| 60 | + class="dropdown-item" |
| 61 | + @click="$emit('open-create-item-modal')" |
| 62 | + > |
| 63 | + Add a starting material |
| 64 | + </button> |
| 65 | + </li> |
| 66 | + <li> |
| 67 | + <button |
| 68 | + v-if="dataType === 'equipment'" |
| 69 | + data-testid="add-equipment-button" |
| 70 | + class="dropdown-item" |
| 71 | + @click="$emit('open-create-equipment-modal')" |
| 72 | + > |
| 73 | + Add an item |
| 74 | + </button> |
| 75 | + </li> |
| 76 | + </ul> |
| 77 | + </div> |
| 78 | + |
| 79 | + <!-- Boutons visibles en grand écran --> |
| 80 | + <div class="d-none d-lg-flex gap-2"> |
| 81 | + <button |
| 82 | + v-if="dataType === 'samples'" |
| 83 | + data-testid="add-item-button" |
| 84 | + class="btn btn-default" |
| 85 | + @click="$emit('open-create-item-modal')" |
| 86 | + > |
| 87 | + Add an item |
| 88 | + </button> |
| 89 | + <button |
| 90 | + v-if="dataType === 'samples'" |
| 91 | + data-testid="batch-item-button" |
| 92 | + class="btn btn-default" |
| 93 | + @click="$emit('open-batch-create-item-modal')" |
| 94 | + > |
| 95 | + Add batch of items |
| 96 | + </button> |
| 97 | + <button |
| 98 | + v-if="dataType === 'samples'" |
| 99 | + data-testid="scan-qr-button" |
| 100 | + class="btn btn-default" |
| 101 | + @click="$emit('open-qr-scanner-modal')" |
| 102 | + > |
| 103 | + <font-awesome-icon icon="qrcode" /> Scan QR |
| 104 | + </button> |
| 105 | + <button |
| 106 | + v-if="dataType === 'collections'" |
| 107 | + data-testid="add-collection-button" |
| 108 | + class="btn btn-default" |
| 109 | + @click="$emit('open-create-collection-modal')" |
| 110 | + > |
| 111 | + Create new collection |
| 112 | + </button> |
| 113 | + <button |
| 114 | + v-if="dataType === 'startingMaterials' && editableInventory" |
| 115 | + data-testid="add-starting-material-button" |
| 116 | + class="btn btn-default" |
| 117 | + @click="$emit('open-create-item-modal')" |
| 118 | + > |
| 119 | + Add a starting material |
| 120 | + </button> |
| 121 | + <button |
| 122 | + v-if="dataType === 'equipment'" |
| 123 | + data-testid="add-equipment-button" |
| 124 | + class="btn btn-default" |
| 125 | + @click="$emit('open-create-equipment-modal')" |
| 126 | + > |
| 127 | + Add an item |
| 128 | + </button> |
| 129 | + </div> |
52 | 130 | </div> |
53 | | - <div class="button-right d-flex gap-2"> |
| 131 | + |
| 132 | + <!-- Section droite : Dropdown "Selected" et recherche --> |
| 133 | + <div class="d-flex align-items-center gap-2"> |
54 | 134 | <div class="dropdown"> |
55 | 135 | <button |
56 | 136 | data-testid="selected-dropdown" |
57 | 137 | class="btn btn-default dropdown-toggle" |
58 | 138 | type="button" |
59 | | - data-toggle="dropdown" |
60 | | - aria-haspopup="true" |
61 | | - aria-expanded="false" |
| 139 | + data-bs-toggle="dropdown" |
62 | 140 | :disabled="itemsSelected.length === 0" |
63 | | - @click="isSelectedDropdownVisible = !isSelectedDropdownVisible" |
64 | 141 | > |
65 | 142 | {{ itemsSelected.length > 0 ? `${itemsSelected.length} selected... ` : "Selected... " }} |
66 | 143 | </button> |
67 | | - <div |
68 | | - v-show="isSelectedDropdownVisible" |
69 | | - class="dropdown-menu" |
70 | | - style="display: block" |
71 | | - aria-labelledby="dropdownMenuButton" |
72 | | - > |
73 | | - <a |
74 | | - v-if="itemsSelected.length !== 0 && dataType !== 'collections'" |
75 | | - data-testid="add-to-collection-button" |
76 | | - class="dropdown-item" |
77 | | - @click="handleAddToCollection" |
78 | | - > |
79 | | - Add to collection |
80 | | - </a> |
81 | | - <a |
82 | | - v-if="itemsSelected.length !== 0" |
83 | | - data-testid="delete-selected-button" |
84 | | - class="dropdown-item" |
85 | | - @click="confirmDeletion" |
86 | | - > |
87 | | - Delete selected |
88 | | - </a> |
89 | | - </div> |
| 144 | + <ul class="dropdown-menu"> |
| 145 | + <li> |
| 146 | + <a |
| 147 | + v-if="itemsSelected.length !== 0 && dataType !== 'collections'" |
| 148 | + data-testid="add-to-collection-button" |
| 149 | + class="dropdown-item" |
| 150 | + @click="handleAddToCollection" |
| 151 | + > |
| 152 | + Add to collection |
| 153 | + </a> |
| 154 | + </li> |
| 155 | + <li> |
| 156 | + <a |
| 157 | + v-if="itemsSelected.length !== 0" |
| 158 | + data-testid="delete-selected-button" |
| 159 | + class="dropdown-item" |
| 160 | + @click="confirmDeletion" |
| 161 | + > |
| 162 | + Delete selected |
| 163 | + </a> |
| 164 | + </li> |
| 165 | + </ul> |
90 | 166 | </div> |
91 | 167 |
|
92 | 168 | <IconField> |
|
96 | 172 | <InputText |
97 | 173 | v-model="localFilters.global.value" |
98 | 174 | data-testid="search-input" |
99 | | - class="search-input" |
| 175 | + class="search-input w-100" |
100 | 176 | placeholder="Search" |
| 177 | + style="max-width: 150px" |
101 | 178 | /> |
102 | 179 | </IconField> |
103 | 180 | </div> |
|
0 commit comments