- Generazione della Raccolta dei Cataloghi (web e Stampa), e creazione del PDF Online.

- Lista Raccolta Cataloghi, aggiungi/togli catalogo.
This commit is contained in:
Surya Paolo
2025-05-14 15:02:14 +02:00
parent 85faf11d27
commit fc8a954eb0
39 changed files with 6149 additions and 4069 deletions

View File

@@ -0,0 +1,231 @@
import {
computed,
provide, defineComponent, onBeforeMount, onBeforeUnmount, onMounted, ref, toRef, toRefs, watch,
} from 'vue'
import { tools } from '@tools'
import { CMyFieldDb } from '@src/components/CMyFieldDb'
import { costanti } from '@costanti'
import { useGlobalStore } from '@store/globalStore'
import { useUserStore } from '@store/UserStore'
import { CTitlePage } from '@src/components/CTitlePage'
import { CGridTableRec } from '@src/components/CGridTableRec'
import type { IColGridTable, ISearchList } from 'model';
import { IMyBacheca, IMySkill, ISkill } from 'model'
import { shared_consts } from '@src/common/shared_vuejs'
import { useI18n } from 'vue-i18n'
import { toolsext } from '@store/Modules/toolsext'
import { fieldsTable } from '@store/Modules/fieldsTable'
import { useQuasar } from 'quasar'
export default defineComponent({
name: 'CRaccoltaCataloghi',
emits: ['clickButtBar'],
props: {
ind: {
type: Number,
required: false,
default: -1,
},
prop_search: {
type: Boolean,
required: false,
default: true,
},
finder: {
type: Boolean,
required: false,
default: true,
},
heightcarousel: {
type: String,
required: false,
default: '',
},
heightcard: {
type: String,
required: false,
default: '400px',
},
widthcard: {
type: String,
required: false,
default: '300px',
},
heightimg: {
type: String,
required: false,
default: '150px',
},
widthimg: {
type: String,
required: false,
default: '300px',
},
},
components: {
CMyFieldDb, CGridTableRec, CTitlePage,
},
setup(props, { attrs, slots, emit }) {
const { t } = useI18n()
const $q = useQuasar()
const globalStore = useGlobalStore()
const userStore = useUserStore()
const table = ref('raccoltacataloghis')
const arrfilterand: any = ref([])
const filtercustom: any = ref([])
const search = ref('')
const myrecfiltertoggle = ref(tools.FILTER_ALL)
const prop_colkey = ref('')
const col_title = ref('')
const col_footer = ref('')
const col_tabfooter = ref('')
const strextra = ref('')
const myoptions = ref(<any>[])
const col = ref(<IColGridTable[]>[])
const myCatRef = ref(<any>null)
const getRaccoltaCataloghiByMyPage = computed((): IRaccoltaCatalogo | undefined => {
return catalogStore.raccoltacataloghis?.find((raccolta: IRaccoltaCatalogo) => raccolta.idPageAssigned === props.idPage);
});
function updatefilter(value: any) {
//
}
const pagina_collegata = computed(() => {
let linkpage = ''
const idpag = myrec.value.idPageAssigned
if (idpag) {
const mypage = globalStore.getPageById(idpag)
if (mypage)
linkpage = mypage.path!
}
return linkpage
})
watch(() => myrecfiltertoggle.value, (value: any, oldval: any) => {
updatefilter(value)
},
)
const mypagination = computed(() => {
return { sortBy: 'title', descending: false, page: 1, rowsNumber: 0, rowsPerPage: 10 }
})
function naviga(path: string) {
$router.push(path)
}
const showType = computed(() => {
return costanti.SHOW_MYCARD
})
const hint = computed(() => {
return 'digita la Raccolta da cercare'
})
const visuType = computed(() => {
return false // $q.screen.gt.xs
})
const noMsgRecord = computed(() => {
return 'Nessun dato trovato con i filtri selezionati'
})
function mounted() {
const obj = tools.getParamsByTable(table.value)
prop_colkey.value = obj.prop_colkey
col_title.value = obj.col_title
col_footer.value = obj.col_footer
col_tabfooter.value = obj.col_tabfooter
filtercustom.value = []
col.value = fieldsTable.getArrColsByTable(table.value)
}
function salvaListaRaccoltaCataloghi(ricarica: boolean) {
// Estrai solo gli ID dei prodotti filtrati
const myarr = [...getRaccoltaCataloghiByMyPage.value.lista_cataloghi];
const catalogIds = myarr.map((catalog) => catalog._id);
let mydata = {
lista_cataloghi: catalogIds,
};
// Salva gli ID dei prodotti nel catalogo
tools.saveFieldToServer($q, 'raccoltacataloghis', getRaccoltaCataloghiByMyPage.value._id, mydata, true, true);
}
function mySortFieldsAvailable() {
if (table.value === toolsext.TABUSER) {
return userStore.getSortFieldsAvailable()
}
return []
}
function doSearch() {
//
}
function clickButtBar(item: any) {
if (myCatRef.value) {
myCatRef.value.clickButtBar(item)
}
// emit('clickButtBar', item)
}
onMounted(mounted)
return {
t,
tools,
costanti,
arrfilterand,
filtercustom,
search,
doSearch,
myrecfiltertoggle,
prop_colkey,
col_title,
col_footer,
col_tabfooter,
col,
toolsext,
mypagination,
noMsgRecord,
showType,
visuType,
hint,
myoptions,
mySortFieldsAvailable,
clickButtBar,
myCatRef,
table,
pagina_collegata,
naviga,
}
},
})

View File

@@ -0,0 +1,47 @@
<template>
<div class="q-ma-xs">
<CGridTableRec
v-if="col && col.length > 0"
ref="myCatRef"
:prop_mytable="table"
:options="tools.optionsTable(table)"
:prop_mytitlenew="tools.getTitleAnnuncio(table)"
prop_mytitle="Raccolte"
:prop_mycolumns="col"
:prop_colkey="prop_colkey"
:col_title="col_title"
:col_footer="col_footer"
:col_tabfooter="col_tabfooter"
:vertical="costanti.VISUTABLE_LISTA"
:prop_pagination="mypagination"
:showType="showType"
:hint="hint"
:nodataLabel="noMsgRecord"
:prop_search="prop_search"
:finder="finder"
labelElemFind="trovati"
:choose_visutype="visuType"
:butt_modif_new="!tools.isUtente()"
:noresultLabel="t('grid.nosearchfound')"
:arrfilters="arrfilterand"
:filtercustom="filtercustom"
:prop_searchList="tools.getsearchList_RaccoltaCataloghi()"
:defaultnewrec="tools.getdefaultnewrec(table)"
labelBtnAddRow="NONE"
:prop_SortFieldsAvailable="mySortFieldsAvailable()"
labelBtnAddExtra="Aggiungi Raccolta"
:extraparams="tools.extraparams(table, { myrecfiltertoggle })"
:prop_showMap="false"
:heightcarousel="heightcarousel"
@clickButtBar="clickButtBar"
:enableExport="true"
:opt="{ rowclass: true, widthcard, heightcard, widthimg, heightimg }"
>
</CGridTableRec>
</div>
</template>
<script lang="ts" src="./CRaccoltaCataloghi.ts"></script>
<style lang="scss" scoped>
@import './CRaccoltaCataloghi.scss';
</style>

View File

@@ -0,0 +1 @@
export { default as CRaccoltaCataloghi } from './CRaccoltaCataloghi.vue'