2025-03-31 23:55:53 +02:00
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<!-- Selezione Colonne -->
|
|
|
|
|
<div class="q-mb-md">
|
|
|
|
|
<q-select
|
|
|
|
|
v-model="selectedColumns"
|
|
|
|
|
:options="allColumns"
|
|
|
|
|
label="Colonne da visualizzare"
|
|
|
|
|
multiple
|
|
|
|
|
emit-value
|
|
|
|
|
map-options
|
2025-04-01 18:36:45 +02:00
|
|
|
option-value="name"
|
|
|
|
|
option-label="label"
|
2025-03-31 23:55:53 +02:00
|
|
|
filled
|
|
|
|
|
style="max-width: 400px"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Tabella Prodotti -->
|
|
|
|
|
<table>
|
|
|
|
|
<!-- Intestazioni (Thead) -->
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
2025-04-01 18:36:45 +02:00
|
|
|
<template v-for="col in allColumns">
|
|
|
|
|
<th
|
|
|
|
|
v-if="isColumnVisible(col.name)"
|
|
|
|
|
:key="col.name"
|
|
|
|
|
>
|
|
|
|
|
{{ col.label }}
|
|
|
|
|
</th>
|
|
|
|
|
</template>
|
2025-03-31 23:55:53 +02:00
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<!-- Corpo della Tabella (Tbody) -->
|
|
|
|
|
<draggable
|
|
|
|
|
v-model="internalProducts"
|
|
|
|
|
tag="tbody"
|
|
|
|
|
handle=".drag-handle"
|
|
|
|
|
item-key="_id"
|
|
|
|
|
@end="onDragEnd"
|
|
|
|
|
>
|
|
|
|
|
<template #item="{ element }">
|
|
|
|
|
<tr :key="element._id">
|
|
|
|
|
<!-- Icona Drag Handle -->
|
2025-04-01 18:36:45 +02:00
|
|
|
<td
|
|
|
|
|
v-if="isColumnVisible('drag')"
|
|
|
|
|
class="drag-handle"
|
|
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="drag_handle"
|
|
|
|
|
size="32px"
|
|
|
|
|
color="primary"
|
|
|
|
|
/>
|
2025-03-31 23:55:53 +02:00
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
<!-- Immagine Piccola -->
|
|
|
|
|
<td v-if="isColumnVisible('image')">
|
|
|
|
|
<q-img
|
|
|
|
|
:src="
|
|
|
|
|
element.productInfo?.imagefile
|
|
|
|
|
? tools.getFullFileNameByImageFile('productInfos', element.productInfo?.imagefile)
|
|
|
|
|
: element.productInfo?.image_link
|
|
|
|
|
"
|
|
|
|
|
style="width: 50px; height: 50px"
|
2025-04-01 18:36:45 +02:00
|
|
|
class="rounded-borders cursor-pointer"
|
|
|
|
|
@click="showProduct(element)"
|
2025-03-31 23:55:53 +02:00
|
|
|
/>
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
<!-- Titolo -->
|
|
|
|
|
<td v-if="isColumnVisible('name')">{{ element.productInfo?.name }}</td>
|
|
|
|
|
|
|
|
|
|
<!-- Autore -->
|
|
|
|
|
<td v-if="isColumnVisible('authors')">{{ formatAuthors(element.productInfo?.authors) }}</td>
|
|
|
|
|
|
|
|
|
|
<!-- Argomento -->
|
|
|
|
|
<td v-if="isColumnVisible('catprods')">{{ formatCatProds(element.productInfo?.catprods) }}</td>
|
|
|
|
|
|
2025-04-01 18:36:45 +02:00
|
|
|
<!-- Quantità -->
|
|
|
|
|
<td v-if="isColumnVisible('quantity')">{{ element.arrvariazioni[0].quantita }}</td>
|
|
|
|
|
|
2025-03-31 23:55:53 +02:00
|
|
|
<!-- ISBN -->
|
|
|
|
|
<td v-if="isColumnVisible('isbn')">{{ element.isbn }}</td>
|
|
|
|
|
|
|
|
|
|
<!-- Azioni -->
|
|
|
|
|
<td v-if="isColumnVisible('actions')">
|
2025-04-01 18:36:45 +02:00
|
|
|
<q-btn-dropdown
|
|
|
|
|
label="Azioni"
|
|
|
|
|
color="primary"
|
|
|
|
|
flat
|
|
|
|
|
>
|
2025-03-31 23:55:53 +02:00
|
|
|
<q-list>
|
2025-04-01 18:36:45 +02:00
|
|
|
<q-item
|
|
|
|
|
clickable
|
|
|
|
|
v-close-popup
|
|
|
|
|
@click="removeProduct(element)"
|
|
|
|
|
>
|
2025-03-31 23:55:53 +02:00
|
|
|
<q-item-section>
|
|
|
|
|
<q-item-label>Elimina</q-item-label>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-btn-dropdown>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</template>
|
|
|
|
|
</draggable>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
2025-04-01 18:36:45 +02:00
|
|
|
<CMyDialog
|
|
|
|
|
v-model="showProd"
|
|
|
|
|
title="Prodotto"
|
|
|
|
|
class="q-ma-md"
|
|
|
|
|
>
|
|
|
|
|
<CSearchProduct v-if="selProd" :idprodtoshow="selProd._id" nameLinkTemplate="SEARCH_Prima"> </CSearchProduct>
|
|
|
|
|
</CMyDialog>
|
2025-03-31 23:55:53 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" src="./CProductTable.ts"></script>
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
@import './CProductTable.scss';
|
|
|
|
|
</style>
|