- Creazione di un Nuovo Catalogo (e la sua relativa pagina), a partire da un modello ed un catalogo esistente.

- Aggiunta dei bottoni sul Ccatalogocard
This commit is contained in:
Surya Paolo
2025-06-12 23:49:13 +02:00
parent 2dac04fb16
commit 286cc4e3a7
23 changed files with 286736 additions and 1889 deletions

View File

@@ -27,7 +27,7 @@ import { CModifTrafiletto } from '@src/components/CModifTrafiletto';
import { costanti } from '@costanti';
import { IAuthor, ICatProd } from 'app/src/model';
import type { IMyScheda, IOptCatalogo, IProduct } from '@src/model';
import type { IMyScheda, IOptCatalogo, IOrderCart, IProduct } from '@src/model';
import { shared_consts } from 'app/src/common/shared_vuejs';
import { CViewTable } from '../CViewTable';
import { CLabel } from '../CLabel';
@@ -35,7 +35,7 @@ import { useI18n } from 'vue-i18n';
export default defineComponent({
name: 'CProductTable',
emits: ['update:lista_prodotti', 'update:optcatalogo', 'rigenera'],
emits: ['update:lista_prodotti', 'update:optcatalogo', 'rigenera', 'addtolist'],
components: {
draggable,
CSearchProduct,
@@ -70,6 +70,11 @@ export default defineComponent({
required: false,
default: () => ({}),
},
options: {
type: Object,
required: false,
default: () => ({}),
}
},
setup(props, { emit }) {
// Copia locale della lista_prodotti per manipolazione interna
@@ -106,7 +111,6 @@ export default defineComponent({
const addstr = ref('');
const optionscatalogo = ref(<any>{ maxlength: 0 });
function handleUpdate(newList) {
@@ -136,7 +140,6 @@ export default defineComponent({
internalProducts.value.forEach((p: IProduct) => {
p.myorder = ProductStore.createMyOrder();
});
}
),
{ deep: true };
@@ -264,6 +267,15 @@ export default defineComponent({
style: 'width: 50px',
notsortable: true,
},
{
name: 'addtolist',
label: 'Add',
field: 'addtolist',
align: 'center',
noexp: true,
notsortable: true,
visu: costanti.VISUCAMPI.PER_EDITORE,
},
{
name: 'edit',
label: 'Mod',
@@ -555,6 +567,7 @@ export default defineComponent({
case 'data_online_stampa':
return tools.getstrDate(catalog.data_online_stampa);
case 'addtocart':
case 'addtolist':
return true;
case 'image':
return catalog.foto_collana?.imagefile
@@ -809,6 +822,7 @@ export default defineComponent({
? cookieValue
: [
'pos',
'addtolist',
'drag',
'edit',
'validato',
@@ -852,8 +866,13 @@ export default defineComponent({
const selectedColumns = ref([]);
function isEditColumn(name: string): boolean {
const column = allColumns.value.find((col) => col.name === name);
return column ? column.edit : false;
};
// 3. Funzione per verificare se una colonna è visibile (isColumnVisible)
const isColumnVisible = (column, real?: boolean) => {
const isColumnVisible = (column: string, real?: boolean) => {
if (column === 'actions' && !real) {
return false;
}
@@ -862,10 +881,20 @@ export default defineComponent({
return false;
}
}
const ok =
let ok =
allColumns.value.some((col) => col.name === column) &&
(!props.optcatalogo.showListaArgomenti ||
(props.optcatalogo.showListaArgomenti && !column.edit));
(props.optcatalogo.showListaArgomenti && !isEditColumn(column)));
if (props.options?.showbuttAdd && column === 'addtolist') {
if (tools.isCollaboratore())
ok = true
}
if (!props.options?.showbuttAdd && column === 'addtolist') {
ok = false
}
return selectedColumns.value.includes(column) && ok;
};
@@ -873,9 +902,8 @@ export default defineComponent({
const column = allColumns.value.find((col) => col.name === name);
return column ? column.label : '';
};
// Funzione per eliminare un prodotto
const removeProduct = (product) => {
const removeProduct = (product: IProduct) => {
return $q
.dialog({
message: t('scheda.removeProduct'),
@@ -1082,6 +1110,10 @@ export default defineComponent({
emit('rigenera');
}
function addtolist(element) {
emit('addtolist', element)
}
function getFieldClick(element: any, field: any): (() => void) | null {
switch (field.field) {
case 'trafiletto':
@@ -1147,7 +1179,7 @@ export default defineComponent({
);
}
function getImageByElement(element) {
function getImageByElement(element: any) {
let image = '';
if (props.table === shared_consts.TABLES_CATALOG) {
image = element.foto_collana?.imagefile;
@@ -1252,6 +1284,7 @@ export default defineComponent({
allColumnsComputed,
addtoCart,
arrordersCart,
addtolist,
};
},
});