From 9cfc308d09bf4bc2c8b708f1b5cba7104a22cdc3 Mon Sep 17 00:00:00 2001 From: Surya Paolo Date: Fri, 4 Apr 2025 18:15:14 +0200 Subject: [PATCH] - aggiornamento catalogo: lista titoli del catalogo - scheda prodotto libro - migliorata tabella prodotto --- src/common/shared_vuejs.ts | 10 + .../CCatalogoCard/CCatalogoCard.scss | 4 + src/components/CCatalogoCard/CCatalogoCard.ts | 21 +- .../CCatalogoCard/CCatalogoCard.vue | 334 +---------- .../CContainerCatalogoCard.ts | 7 +- .../CContainerCatalogoCard.vue | 1 + src/components/CDateTime/CDateTime.ts | 7 +- src/components/CDateTime/CDateTime.vue | 4 +- src/components/CInput/CInput.scss | 0 src/components/CInput/CInput.ts | 94 +++ src/components/CInput/CInput.vue | 39 ++ src/components/CInput/index.ts | 1 + src/components/CLabel/CLabel.ts | 9 +- src/components/CLabel/CLabel.vue | 7 +- src/components/CMyDialog/CMyDialog.vue | 10 + src/components/CMyEditElem/CMyEditElem.vue | 2 +- src/components/CMyPopupEdit/CMyPopupEdit.ts | 13 +- src/components/CMyPopupEdit/CMyPopupEdit.vue | 555 ++++++------------ src/components/CMyRecCatalog/CMyRecCatalog.ts | 5 + .../CMyRecCatalog/CMyRecCatalog.vue | 238 ++++---- src/components/CMySelect/CMySelect.ts | 41 +- src/components/CMySelect/CMySelect.vue | 82 +-- src/components/CMyValueDb/CMyValueDb.ts | 8 +- src/components/CMyValueDb/CMyValueDb.vue | 3 +- src/components/CProductCard/CProductCard.ts | 10 +- src/components/CProductCard/CProductCard.vue | 32 +- .../CProductTable/CProductTable.scss | 18 +- src/components/CProductTable/CProductTable.ts | 161 ++++- .../CProductTable/CProductTable.vue | 161 ++++- .../CSchedaProdotto/CSchedaProdotto.scss | 23 + .../CSchedaProdotto/CSchedaProdotto.ts | 353 +++++++++++ .../CSchedaProdotto/CSchedaProdotto.vue | 68 +++ src/components/CSchedaProdotto/index.ts | 1 + .../CSearchProduct/CSearchProduct.ts | 68 ++- .../CSearchProduct/CSearchProduct.vue | 29 +- .../CTableCupleLabelValue.scss | 51 ++ .../CTableCupleLabelValue.ts | 52 ++ .../CTableCupleLabelValue.vue | 36 ++ src/components/CTableCupleLabelValue/index.ts | 1 + src/model/GlobalStore.ts | 13 + src/model/Products.ts | 1 + src/statics/lang/it.js | 2 + src/store/Modules/tools.ts | 27 +- src/store/Products.ts | 19 +- src/views/ecommerce/catalogo/catalogo.scss | 5 +- src/views/ecommerce/catalogo/catalogo.ts | 38 +- src/views/ecommerce/catalogo/catalogo.vue | 26 +- src/views/user/myprofile/myprofile.ts | 3 +- src/views/user/myprofile/myprofile.vue | 1 + 49 files changed, 1760 insertions(+), 934 deletions(-) create mode 100755 src/components/CInput/CInput.scss create mode 100755 src/components/CInput/CInput.ts create mode 100755 src/components/CInput/CInput.vue create mode 100755 src/components/CInput/index.ts create mode 100755 src/components/CSchedaProdotto/CSchedaProdotto.scss create mode 100755 src/components/CSchedaProdotto/CSchedaProdotto.ts create mode 100755 src/components/CSchedaProdotto/CSchedaProdotto.vue create mode 100755 src/components/CSchedaProdotto/index.ts create mode 100755 src/components/CTableCupleLabelValue/CTableCupleLabelValue.scss create mode 100755 src/components/CTableCupleLabelValue/CTableCupleLabelValue.ts create mode 100755 src/components/CTableCupleLabelValue/CTableCupleLabelValue.vue create mode 100755 src/components/CTableCupleLabelValue/index.ts diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index d26a6d7c..39b90cbd 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -2475,4 +2475,14 @@ export const shared_consts = { SET: 1, }, + SCHEDA_PRODOTTO: { + CMD_NONE: 0, + CMD_MODIFICA: 1, + }, + + VISU_SEARCHPROD_MODE: { + VISU: 0, + INSERT: 1, + } + } diff --git a/src/components/CCatalogoCard/CCatalogoCard.scss b/src/components/CCatalogoCard/CCatalogoCard.scss index ed8c9b8e..c46db4b4 100755 --- a/src/components/CCatalogoCard/CCatalogoCard.scss +++ b/src/components/CCatalogoCard/CCatalogoCard.scss @@ -122,6 +122,10 @@ padding: 4px; } +.book-big { + font-size: 1.5rem !important; +} + .book-details { margin: 20px; diff --git a/src/components/CCatalogoCard/CCatalogoCard.ts b/src/components/CCatalogoCard/CCatalogoCard.ts index 2dcafdcd..c4496a0f 100755 --- a/src/components/CCatalogoCard/CCatalogoCard.ts +++ b/src/components/CCatalogoCard/CCatalogoCard.ts @@ -13,14 +13,17 @@ import { CMyValueDb } from '../CMyValueDb' import { CPrice } from '../CPrice' import { CText } from '../CText' import { CLabel } from '@src/components/CLabel' +import { CSchedaProdotto } from '@src/components/CSchedaProdotto' import { CBarCode } from '../CBarCode' +import { CTableCupleLabelValue } from '../CTableCupleLabelValue' import { func_tools, toolsext } from '@store/Modules/toolsext' import type { IOptCatalogo, IGasordine, IMyScheda, IOrder, IOrderCart, - IProduct, IVariazione + IProduct, IVariazione, + IRecFields } from '@src/model'; import { IBaseOrder @@ -86,7 +89,7 @@ export default defineComponent({ }, components: { CTitleBanner, CCardState, CCopyBtn, CMyValueDb, VuePdfApp, CPrice, CBarCode, CLabel, - CText, CViewTable + CText, CViewTable, CTableCupleLabelValue, CSchedaProdotto }, setup(props, { emit }) { const $q = useQuasar() @@ -103,6 +106,9 @@ export default defineComponent({ const site = ref(globalStore.site) + const arrlistScheda = ref([]) + + const $router = useRouter() const fullscreenImage = ref(null) @@ -132,6 +138,7 @@ export default defineComponent({ // updateCatalogoPadre() }, { deep: false }); + function updateCatalogoPadre() { emit('update:modelValue', optcatalogo.value); } @@ -323,10 +330,14 @@ export default defineComponent({ } - async function updateproductmodif() { - // console.log('updateproductmodif') + async function updateproductmodif(element: any) { + console.log('CCATALOGOCARD: updateproductmodif') try { - myproduct.value = await products.getProductById(props.id) + if (element?._id) { + myproduct.value = await products.getProductById(element?._id) + } else { + myproduct.value = await products.getProductById(props.id) + } updateLabel() } catch (e) { diff --git a/src/components/CCatalogoCard/CCatalogoCard.vue b/src/components/CCatalogoCard/CCatalogoCard.vue index 00817b97..c436fff6 100755 --- a/src/components/CCatalogoCard/CCatalogoCard.vue +++ b/src/components/CCatalogoCard/CCatalogoCard.vue @@ -18,12 +18,6 @@ size="3em" :thickness="2" /> -
-
+
Visualizza su GM (Tutti i campi) -
@@ -243,7 +239,8 @@
- - - Modifica a {{ myproduct.productInfo.name }} - - - -
-
Titolo:
- - -
SottoTitolo:
- - -
Descrizione Estesa:
- - -
-
-
Pagine:
- - -
-
-
Misure:
- - -
-
-
Pubblicazione:
- - -
-
-
Formato:
- - -
-
-
Quantità:
- - -
-
-
Argomenti:
- {{ products.getCatProdsStrByCatProds(myproduct.productInfo.idCatProds) }} -
-
-
-
-
Prezzo:
- - -
-
-
Prezzo Scontato:
- - -
-
-
-
-
Descrizione breve macro:
- - -
-
-
Link a gruppomacro.com:
- - -
-
-
-
Fatturati:
- - -
Fatturati Ultimi 3 Mese:
- - -
Venduti:
- - -
Venduti Ultimi 3 Mesi:
- - -
Venduti Ultimi 6 Mesi:
- - -
Venduti Ultimo Anno:
- - - - -
3 Mesi:
- - -
6 Mesi:
- - -
1 Anno:
- - -
-
-
-
+ + diff --git a/src/components/CDateTime/CDateTime.ts b/src/components/CDateTime/CDateTime.ts index 00bf0dc9..44aa849e 100755 --- a/src/components/CDateTime/CDateTime.ts +++ b/src/components/CDateTime/CDateTime.ts @@ -49,11 +49,6 @@ export default defineComponent({ required: false, default: false, }, - minuteinterval: { - type: String, - required: false, - default: '5', - }, view: { type: String, required: false, @@ -169,7 +164,7 @@ export default defineComponent({ return '' } - function getstrDate(mydate: Date) { + function getstrDate(mydate: Date | string) { if (props.view === 'date-time') { return tools.getstrDateTime(mydate) } else { diff --git a/src/components/CDateTime/CDateTime.vue b/src/components/CDateTime/CDateTime.vue index e3b033be..2372e2f8 100755 --- a/src/components/CDateTime/CDateTime.vue +++ b/src/components/CDateTime/CDateTime.vue @@ -20,7 +20,7 @@ - + diff --git a/src/components/CTableCupleLabelValue/CTableCupleLabelValue.scss b/src/components/CTableCupleLabelValue/CTableCupleLabelValue.scss new file mode 100755 index 00000000..b728111a --- /dev/null +++ b/src/components/CTableCupleLabelValue/CTableCupleLabelValue.scss @@ -0,0 +1,51 @@ +/* Stile generale del contenitore */ +.table-container { + display: flex; + flex-direction: column; + width: 100%; + max-width: 800px; /* Limita la larghezza per schermi grandi */ + margin: 0 auto; /* Centra il contenuto */ + border: 1px solid #ddd; + border-radius: 8px; + overflow: hidden; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); +} + +/* Stile delle righe della tabella */ +.table-row { + display: flex; + align-items: center; + padding: 2px; + border-bottom: 1px solid #eee; +} + +/* Ultima riga senza bordo inferiore */ +.table-row:last-child { + border-bottom: none; +} + +/* Stile delle celle */ +.table-cell { + flex: 1; + padding: 8px; +} + +/* Stile specifico per la colonna delle etichette */ +.label-cell { + font-weight: bold; + color: #333; + text-align: left; + min-width: 150px; /* Larghezza fissa per le etichette */ +} + +/* Stile specifico per la colonna dei valori */ +.value-cell { + flex: 2; + text-align: left; + color: #555; +} + +/* Hover su una riga */ +.table-row:hover { + background-color: #f9f9f9; +} \ No newline at end of file diff --git a/src/components/CTableCupleLabelValue/CTableCupleLabelValue.ts b/src/components/CTableCupleLabelValue/CTableCupleLabelValue.ts new file mode 100755 index 00000000..12c1c9a0 --- /dev/null +++ b/src/components/CTableCupleLabelValue/CTableCupleLabelValue.ts @@ -0,0 +1,52 @@ +import type { PropType } from 'vue'; +import { defineComponent, onMounted, ref, watch } from 'vue' +import { useQuasar } from 'quasar' +import { useI18n } from 'vue-i18n' +import { useGlobalStore } from '@store/globalStore' +import { fieldsTable } from '@store/Modules/fieldsTable' +import { tools } from '@tools' +import { costanti } from '@costanti' +import { CMyValueDb } from '@src/components/CMyValueDb' +import { IProduct, IRecFields } from 'app/src/model'; + + +export default defineComponent({ + name: 'CTableCupleLabelValue', + emits: ['updateproductmodif'], + props: { + title: { + type: String, + required: false, + default: '', + }, + list: { + type: Array as PropType, + required: true, + } + }, + components: { CMyValueDb }, + setup(props, { emit }) { + const $q = useQuasar() + const { t } = useI18n() + const globalStore = useGlobalStore() + + function mounted() { + + } + + function updateproductmodif(element: any) { + emit('updateproductmodif', element) + } + + onMounted(mounted) + + return { + tools, + costanti, + fieldsTable, + globalStore, + updateproductmodif, + } + }, +}) + diff --git a/src/components/CTableCupleLabelValue/CTableCupleLabelValue.vue b/src/components/CTableCupleLabelValue/CTableCupleLabelValue.vue new file mode 100755 index 00000000..0be086b0 --- /dev/null +++ b/src/components/CTableCupleLabelValue/CTableCupleLabelValue.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/src/components/CTableCupleLabelValue/index.ts b/src/components/CTableCupleLabelValue/index.ts new file mode 100755 index 00000000..ecd3fa74 --- /dev/null +++ b/src/components/CTableCupleLabelValue/index.ts @@ -0,0 +1 @@ +export {default as CTableCupleLabelValue} from './CTableCupleLabelValue.vue' diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts index 12a53d0c..d0c19560 100755 --- a/src/model/GlobalStore.ts +++ b/src/model/GlobalStore.ts @@ -818,6 +818,19 @@ export interface IMyScheda { } +export interface IRecFields { + editOn?: boolean + label?: string + table?: string + id?: string + rec?: any + mykey?: string + debounce?: string + type?: number + dense?: boolean + maxlength?: number +} + export interface ISchedaSingola { _id?: string scheda?: IMyScheda, diff --git a/src/model/Products.ts b/src/model/Products.ts index 4540bf9a..47651a75 100755 --- a/src/model/Products.ts +++ b/src/model/Products.ts @@ -64,6 +64,7 @@ export interface IProductInfo { descrizione_breve_macro?: string, descrizione_completa_macro?: string, + descr_trafiletto_catalogo?: string, sottotitolo?: string, link_macro?: string, } diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js index b21257ec..bf89fe83 100755 --- a/src/statics/lang/it.js +++ b/src/statics/lang/it.js @@ -2010,6 +2010,7 @@ const msg_it = { prezzo_scontato: '{prezzo_scontato}', descrizione_completa_macro: '{descrizione_completa_macro}', descrizione_breve_macro: '{descrizione_breve_macro}', + descr_trafiletto_catalogo: '{descr_trafiletto_catalogo}', link_macro: '{link_macro}', totVen: 'Totale Venduti', totFat: 'Totale Fatturati', @@ -2022,6 +2023,7 @@ const msg_it = { }, cataloglist: { + numprodotti: 'Libri presenti', foto_collana: 'Foto Catalogo', referenti: 'Editori', img_bordata: 'Immagine di sfondo', diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index 484e1b71..8709545a 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -2244,11 +2244,15 @@ export const tools = { }, strToObj(mystr: string): any { - if (mystr) { - mystr = decodeURIComponent(mystr) - return JSON.parse(mystr) - } else + try { + if (mystr) { + mystr = decodeURIComponent(mystr) + return JSON.parse(mystr) + } else + return null + } catch (e) { return null + } }, objToStr(myobj: any): string { @@ -9839,7 +9843,20 @@ export const tools = { const url = import.meta.env.VITE_APP_URL const protocol = url.startsWith('http://') ? 'http://' : url.startsWith('https://') ? 'https://' : '' return protocol - } + }, + + isRisoApp() { + return this.appid() === tools.IDAPP_RISO + }, + + isValueNotEmpty(value: any) { + // Verifica se `value` è un oggetto non vuoto o un valore valido + return ( + value !== null && + typeof value === "object" && + Object.keys(value).length > 0 + ); + }, // FINE ! diff --git a/src/store/Products.ts b/src/store/Products.ts index 555fa4a9..333eb6dc 100755 --- a/src/store/Products.ts +++ b/src/store/Products.ts @@ -549,11 +549,18 @@ export const useProducts = defineStore('Products', { async getProductById(id: string): Promise { let prod = null - if (!this.products) { - // Se non lo carico all'avvio, allora fai la chiamata al server - prod = await this.loadProductById(id) - } else { - prod = this.products.find((prod: IProduct) => prod._id === id) + try { + if (!id) { + return null + } + if (!this.products) { + // Se non lo carico all'avvio, allora fai la chiamata al server + prod = await this.loadProductById(id) + } else { + prod = this.products.find((prod: IProduct) => prod._id === id) + } + } catch (e) { + console.error('Err', e) } return prod ? prod : getRecordProductEmpty() @@ -1419,6 +1426,7 @@ export const useProducts = defineStore('Products', { descrizione_completa_macro += addstrcontinua } + const descr_trafiletto_catalogo = myproduct.productInfo.descr_trafiletto_catalogo || ''; const short_descr = myproduct.productInfo.descrizione_breve_macro || ''; const descrizione_breve_macro = short_descr.length > maxDescriptionLength ? short_descr.substring(0, short_descr.lastIndexOf(' ', maxDescriptionLength)) + '...' @@ -1468,6 +1476,7 @@ export const useProducts = defineStore('Products', { '{prezzo_scontato}': prezzo_scontato || '', '{descrizione_completa_macro}': descrizione_completa_macro || '', '{descrizione_breve_macro}': descrizione_breve_macro || '', + '{descr_trafiletto_catalogo}': descr_trafiletto_catalogo || '', '{link_macro}': link_macro || '', '{qta}': qta || '', '{image_link}': image_link || '', diff --git a/src/views/ecommerce/catalogo/catalogo.scss b/src/views/ecommerce/catalogo/catalogo.scss index bda5dc19..f0199b22 100755 --- a/src/views/ecommerce/catalogo/catalogo.scss +++ b/src/views/ecommerce/catalogo/catalogo.scss @@ -94,8 +94,11 @@ body { .book-details { font-family: 'DINPro-Condensed-Regular', sans-serif; margin-bottom: calc(5 * var(--scalecatalog) * 1px); - font-size: calc(14 * var(--scalecatalog) * 1px); + font-size: calc(16 * var(--scalecatalog) * 1px); text-align: left !important; + &.big { + font-size: calc(22 * var(--scalecatalog) * 1px); + } } diff --git a/src/views/ecommerce/catalogo/catalogo.ts b/src/views/ecommerce/catalogo/catalogo.ts index 2c65358d..b8f2e78d 100755 --- a/src/views/ecommerce/catalogo/catalogo.ts +++ b/src/views/ecommerce/catalogo/catalogo.ts @@ -13,8 +13,10 @@ import { costanti } from '@costanti' import { shared_consts } from '@src/common/shared_vuejs' import { CProductCard } from '@src/components/CProductCard' +import { CMyDialog } from '@src/components/CMyDialog' import { CMySelect } from '@src/components/CMySelect' import { CProductTable } from '@src/components/CProductTable' +import { CSearchProduct } from '@src/components/CSearchProduct' import { CContainerCatalogoCard } from '@src/components/CContainerCatalogoCard' import { CSelectUserActive } from '@src/components/CSelectUserActive' import type { @@ -34,7 +36,10 @@ import { Catalogo } from '.'; export default defineComponent({ name: 'Catalogo', - components: { CContainerCatalogoCard, CProductCard, CSelectUserActive, CMySelect, CProductTable }, + components: { + CContainerCatalogoCard, CProductCard, + CSelectUserActive, CMySelect, CProductTable, CSearchProduct, CMyDialog, + }, emits: ['update:modelValue', 'updateCatalogo'], props: { modelValue: { @@ -59,6 +64,7 @@ export default defineComponent({ const optauthors = ref([]) const pdfContent = ref(null); + const addnewProd = ref(false) const optcatalogo = ref({ ...props.modelValue }); @@ -601,8 +607,8 @@ export default defineComponent({ let risposta_si = false $q.dialog({ - title: 'Genera catalogo', - message: 'Sei sicuro di rigenerare il catalogo?', + title: 'Rigenera lista', + message: 'Sicuri di rigenerare questa lista di libri, perdendo l\'ordinamento attuale ?', cancel: true, persistent: true }).onOk(() => { @@ -1225,6 +1231,29 @@ export default defineComponent({ } } + function addProductToList(element: IProduct) { + // console.log('addProductToList', element) + + if (element) { + // add this record to lista_prodotti + if (getCatalogoByMyPage.value && !getCatalogoByMyPage.value.lista_prodotti.some((p) => p._id === element._id)) { + // inserire il record in cima + const arr = getCatalogoByMyPage.value.lista_prodotti + arr.unshift(element) + + updateProducts(arr) + + addnewProd.value = false + } + } + + } + + function clickaddNewBook() { + addnewProd.value = true + } + + onMounted(mounted) return { @@ -1284,6 +1313,9 @@ export default defineComponent({ generaListaLibri, lista_prodotti, updateProducts, + clickaddNewBook, + addProductToList, + addnewProd, } } }) diff --git a/src/views/ecommerce/catalogo/catalogo.vue b/src/views/ecommerce/catalogo/catalogo.vue index 96c197ab..3f5efd44 100755 --- a/src/views/ecommerce/catalogo/catalogo.vue +++ b/src/views/ecommerce/catalogo/catalogo.vue @@ -64,14 +64,23 @@ > + + @@ -638,6 +647,21 @@ + + + + + diff --git a/src/views/user/myprofile/myprofile.ts b/src/views/user/myprofile/myprofile.ts index 4af4230b..5de9e0ae 100755 --- a/src/views/user/myprofile/myprofile.ts +++ b/src/views/user/myprofile/myprofile.ts @@ -89,7 +89,7 @@ export default defineComponent({ const listgroupsfiltered = ref([]) const listcircuitsfiltered = ref([]) - const tab = ref('attivita') + const tab = ref('') function profile() { return userStore.my.profile @@ -150,6 +150,7 @@ export default defineComponent({ }) function mounted() { + tab.value = tools.isRisoApp() ? 'attivita' : 'info' loadProfile() } diff --git a/src/views/user/myprofile/myprofile.vue b/src/views/user/myprofile/myprofile.vue index e8cf923f..a9768e56 100755 --- a/src/views/user/myprofile/myprofile.vue +++ b/src/views/user/myprofile/myprofile.vue @@ -666,6 +666,7 @@ >