Iscrizione Conacreis e Arcadei

This commit is contained in:
paoloar77
2022-10-29 12:37:30 +02:00
parent 2399124a33
commit 392c8bb6af
20 changed files with 668 additions and 380 deletions

View File

@@ -243,7 +243,7 @@ export default defineComponent({
const globalStore = useGlobalStore()
const isfinishLoading = computed(() => globalStore.finishLoading)
const pagination = ref(<IPagination>{ sortBy: 'desc', descending: false, page: 1, rowsNumber: 10, rowsPerPage: 10 })
const pagination = ref({ sortBy: 'desc', descending: false, page: 1, rowsNumber: 10, rowsPerPage: 10 } as IPagination)
const addRow = ref('Aggiungi')
@@ -277,29 +277,29 @@ export default defineComponent({
const numRecLoaded = ref(0)
const spinner_visible = ref(false)
const changetable = ref(false)
const searchList = ref(<ISearchList[]>[])
const searchList = ref([] as ISearchList[])
let actual = ''
const actual = ''
let idsel = ''
let colsel = ref(<IColGridTable | null>{ name: '', field: '', sortable: false })
const colsel = ref({ name: '', field: '', sortable: false } as IColGridTable | null)
let valPrec = ''
const separator = 'horizontal'
const myfilter = ref('')
const myfilterand: any = ref([])
let rowsel: any = {}
let dark = true
const dark = true
const canEdit = ref(false)
let returnedData: any = ref([])
const returnedData: any = ref([])
let returnedCount = 0
const colVisib: any = ref([])
const colNotVisib: any = ref([])
const colExtra: any = ref([])
const actualDate: any = ref(<any>null)
const actualDate: any = ref(null as any)
const rowclicksel = ref(<any>null)
const rowclicksel = ref(null as any)
const colclicksel = ref(null)
const selected: any = ref([])
@@ -341,7 +341,7 @@ export default defineComponent({
watch(() => props.prop_mycolumns, (to: any, from: any) => {
// console.log('watch searchlist', to)
if (myvertical.value != props.vertical) {
if (myvertical.value !== props.vertical) {
myvertical.value = props.vertical
refresh()
}
@@ -361,7 +361,7 @@ export default defineComponent({
watch(() => props.extraparams, (to: any, from: any) => {
// console.log('filtercustom', to)
if (to != from) {
if (to !== from) {
refresh()
}
})
@@ -483,7 +483,7 @@ export default defineComponent({
// emulate 'SELECT count(*) FROM ...WHERE...'
function getRowsNumberCount(myfilter?: any) {
function getRowsNumberCount() {
// if (!myfilter) {
// return original.length
@@ -515,12 +515,12 @@ export default defineComponent({
// console.log('sortBy', sortBy)
let filtersearch: any[] = []
let filtersearch2: any[] = []
let filtersearch3or: any[] = []
let filtersearch3and: any[] = []
let filtercustom: any[] = [...props.filtercustom]
let filter_gte: any[] = []
const filtersearch: any[] = []
const filtersearch2: any[] = []
const filtersearch3or: any[] = []
const filtersearch3and: any[] = []
const filtercustom: any[] = [...props.filtercustom]
const filter_gte: any[] = []
let recSector = null
let recSectorGood = null
@@ -560,23 +560,23 @@ export default defineComponent({
}
let arrfilter_cities: any = []
let arrfilter_provices: any = []
const arrfilter_cities: any = []
const arrfilter_provices: any = []
// console.table(searchList.value)
if (searchList.value) {
for (const item of searchList.value) {
//searchList.value.forEach((item: ISearchList) => {
// searchList.value.forEach((item: ISearchList) => {
if (!item.notinsearch) {
let objitem: any = {}
const objitem: any = {}
// console.log(' item ', item)
let obj: any = {}
const obj: any = {}
if (item.table === 'regions') {
let myfield = tools.getFieldSearchByTable(mytable.value, item.table, 'mycities.reg')
const myfield = tools.getFieldSearchByTable(mytable.value, item.table, 'mycities.reg')
obj[myfield] = item.value
if (myfield) {
obj['mycities.reg'] = item.value
@@ -591,7 +591,7 @@ export default defineComponent({
} else if (item.table === 'provinces') {
let myfield = tools.getFieldSearchByTable(mytable.value, item.table, 'mycities.prov')
const myfield = tools.getFieldSearchByTable(mytable.value, item.table, 'mycities.prov')
obj[myfield] = item.value
if (myfield) {
if (item.value !== '' && item.value !== costanti.FILTER_TUTTI) {
@@ -606,7 +606,7 @@ export default defineComponent({
} else if (item.table === 'cities') {
if (item.value && item.value.hasOwnProperty('_id')) {
let myfield = tools.getFieldSearchByTable(mytable.value, item.table, 'idCity')
const myfield = tools.getFieldSearchByTable(mytable.value, item.table, 'idCity')
if (myfield) {
obj[myfield] = item.value._id
if (item.value && item.value !== '' && item.value._id !== costanti.FILTER_TUTTI) {
@@ -649,16 +649,16 @@ export default defineComponent({
return true
})
let arr2: any = []
const arr2: any = []
if (item.table !== 'provinces') {
myarr.forEach((myval: any) => {
let objitem2: any = {}
const objitem2: any = {}
objitem2[item.key] = myval
arr2.push(objitem2)
})
let obj2: any = {
const obj2: any = {
$or: arr2
}
if (arr2.length > 0) {
@@ -668,28 +668,28 @@ export default defineComponent({
} else {
if ((item.table === toolsext.TABSKILLS) && item.value === costanti.FILTER_TUTTI) {
let obj2: any = {}
const obj2: any = {}
if (idSector > 0) {
// idSector
// obj2['sector._id'] = idSector
obj2['idSector'] = idSector
obj2.idSector = idSector
filtersearch2.push(obj2)
}
if (idSkill > 0) {
// idSector
obj2['idSkill'] = idSkill
obj2.idSkill = idSkill
filtersearch2.push(obj2)
}
} else if ((item.table === 'goods') && item.value === costanti.FILTER_TUTTI) {
let obj2: any = {}
const obj2: any = {}
if (idSectorGood > 0) {
// idSectorGood
obj2['sectorGood._id'] = idSectorGood
filtersearch2.push(obj2)
}
} else if ((item.table === 'subskills') && item.value === costanti.FILTER_TUTTI) {
let obj2: any = {}
const obj2: any = {}
// idSector
if (idSkill > 0) {
obj2['myskill._id'] = idSkill
@@ -703,7 +703,7 @@ export default defineComponent({
}
if (arrfilter_cities.length > 0 && recCities) {
let myobjfilt: any = {}
const myobjfilt: any = {}
for (const myrec of arrfilter_cities) {
myobjfilt[myrec.key] = myrec.value
}
@@ -711,7 +711,7 @@ export default defineComponent({
}
if (arrfilter_provices.length > 0 && recProvince) {
let myobjfilt: any = {}
const myobjfilt: any = {}
for (const myrec of arrfilter_provices) {
myobjfilt[myrec.key] = myrec.value
}
@@ -755,13 +755,13 @@ export default defineComponent({
filter: param_myfilter,
filterand: param_myfilterand,
// @ts-ignore
filtersearch: filtersearch,
filtersearch,
// @ts-ignore
filtersearch2: filtersearch2,
filtersearch3or: filtersearch3or,
filtersearch3and: filtersearch3and,
filtersearch2,
filtersearch3or,
filtersearch3and,
// @ts-ignore
filtercustom: filtercustom,
filtercustom,
// @ts-ignore
filter_gte,
sortBy: myobj,
@@ -834,7 +834,7 @@ export default defineComponent({
// fetch data from "server"
return fetchFromServer(startRow, endRow, myfilternow, myfilterandnow, sortBy, descending).then((ris: any) => {
pagination.value.rowsNumber = getRowsNumberCount(myfilter)
pagination.value.rowsNumber = getRowsNumberCount()
// clear out existing data and add new
if (!returnedData.value || returnedData.value.length === 0) {
@@ -899,16 +899,16 @@ export default defineComponent({
// fetch data from "server"
return fetchFromServer(startRow, endRow, myfilternow, myfilterandnow, sortBy, descending).then((ris: any) => {
pagination.value.rowsNumber = getRowsNumberCount(myfilter)
pagination.value.rowsNumber = getRowsNumberCount()
// console.log(' ...rowsNumber', pagination.value.rowsNumber)
if (returnedData.value === []) {
if (!returnedData.value || returnedData.value.length === 0) {
// no more data
} else {
try {
numRecLoaded.value = numRecLoaded.value + (returnedData.value ? returnedData.value.length : 0)
// console.log(' ...numRecLoaded.value', numRecLoaded.value)
let toadd = []
const toadd = []
for (const elem of returnedData.value) {
if (serverData.value.findIndex((rec: any) => rec._id === elem._id) < 0) {
toadd.push(elem)
@@ -1008,7 +1008,7 @@ export default defineComponent({
myinfscroll.value.stop()
}
refresh_infscroll(function () { return true })
refresh_infscroll(() => true)
} else {
refresh_table()
}
@@ -1063,22 +1063,19 @@ export default defineComponent({
function selItem(item: any, col: IColGridTable, inmodif?: boolean) {
// console.log('selItem', item, col)
if (inmodif) {
}
if (col.jointable === toolsext.TABSECTORS) {
// Sbianca la select della Categoria
if (item && item.hasOwnProperty('idSkill')) {
item['idSkill'] = costanti.FILTER_NESSUNO
newRecord.value['idSkill'] = item['idSkill']
item.idSkill = costanti.FILTER_NESSUNO
newRecord.value.idSkill = item.idSkill
}
} else if (col.jointable === toolsext.TABSECTORGOODS) {
// Sbianca la select della Categoria Beni
if (item && item.hasOwnProperty('idGood')) {
item['idGood'] = costanti.FILTER_NESSUNO
newRecord.value['idGood'] = item['idGood']
item.idGood = costanti.FILTER_NESSUNO
newRecord.value.idGood = item.idGood
console.log('newRecord', newRecord)
}
}
@@ -1164,11 +1161,11 @@ export default defineComponent({
}
}
const mydata = <any>{
const mydata = {
id: idsel,
table: mytable.value,
fieldsvalue: {}
}
} as any
if (colsel.value) {
@@ -1244,8 +1241,8 @@ export default defineComponent({
if (!newRecord.value) {
newRecord.value = {}
}
newRecord.value['userId'] = userStore.my._id
newRecord.value['idapp'] = process.env.APP_ID
newRecord.value.userId = userStore.my._id
newRecord.value.idapp = process.env.APP_ID
// globalStore.saveTable(mydata).then(ris => console.log('RISULT', ris))
newRecordBool.value = true
@@ -1398,7 +1395,7 @@ export default defineComponent({
if (action === lists.MenuAction.DELETE_RECTABLE) {
if ((serverData.value.length > 0) && item) {
console.log('item', item)
let indelim = serverData.value.findIndex((rec: any) => rec._id === item._id)
const indelim = serverData.value.findIndex((rec: any) => rec._id === item._id)
console.log('indexof', indelim)
if (indelim >= 0)
serverData.value.splice(indelim, 1)
@@ -1437,7 +1434,7 @@ export default defineComponent({
}
function checkIfColShow(field: string | undefined) {
let vis = true
const vis = true
/*if (shared_consts.TABLES_NOT_SHOW_IF_USERNAME.includes(props.prop_mytable) && !props.prop_search) {
if (field === 'username') {
vis = false
@@ -1449,11 +1446,11 @@ export default defineComponent({
function changeCol(newval: any) {
// console.log('changecol', mytable.value)
if (!!mytable.value) {
let arrcol = []
const arrcol = []
let col: IColGridTable = { name: '', sortable: false }
for (col of mycolumns.value) {
if (col.field !== costanti.NOFIELD) {
let obj = {
const obj = {
n: col.field + (col.subfield ? col.subfield : ''),
v: 0
}
@@ -1547,9 +1544,9 @@ export default defineComponent({
for (const col of arrselcol) {
const arrv = col.split(',')
if (arrv.length > 1) {
let field = arrv[0]
let visib = arrv[1]
const rec = mycolumns.value.find((rec: any) => (rec.field + rec.subfield) === field)
const field = arrv[0]
const visib = arrv[1]
const rec = mycolumns.value.find((myrec: any) => (myrec.field + myrec.subfield) === field)
if (rec) {
@@ -1560,7 +1557,7 @@ export default defineComponent({
} else if (visib === '0') {
// Se da togliere, lo togli
if (colVisib.value.includes(field))
colVisib.value = colVisib.value.filter((rec: any) => rec !== field)
colVisib.value = colVisib.value.filter((myrec: any) => myrec !== field)
}
}
}
@@ -1635,7 +1632,7 @@ export default defineComponent({
function enableSaveNewRec(newrec: boolean) {
let ok = true
const ok = true
const showmsg = true
@@ -1644,7 +1641,7 @@ export default defineComponent({
myrec = newRecord.value
}
//mycolumns.value.forEach((col: IColGridTable) => {
// mycolumns.value.forEach((col: IColGridTable) => {
let col: IColGridTable
let msg = ''
@@ -1723,7 +1720,7 @@ export default defineComponent({
const myobj = newRecord.value
//++ Eliminare eventuali campi ?
// ++ Eliminare eventuali campi ?
mycolumns.value.forEach((col: IColGridTable) => {
if (col.notsave) {
delete myobj[col.name]
@@ -1832,7 +1829,7 @@ export default defineComponent({
function showColCheck(col: IColGridTable, tipovis: number, visulabel: boolean, value: any = '', record: any = null) {
//if (col.isadvanced_field && !showfilteradv.value)
// if (col.isadvanced_field && !showfilteradv.value)
// return false
const check = tools.checkIfShowField(col, tipovis, visulabel, value)
@@ -1865,7 +1862,7 @@ export default defineComponent({
function getLabelFooterByRow(row: any) {
if (props.col_footer) {
let mycol = fieldsTable.getColByTable(tablesel.value, props.col_footer)
const mycol = fieldsTable.getColByTable(tablesel.value, props.col_footer)
if (mycol) {
return tools.getValueByRemoteField(mycol, row, row[props.col_footer], props.col_tabfooter)
}
@@ -1931,7 +1928,7 @@ export default defineComponent({
} else {
done(true)
}
} else{
} else {
done()
}
}
@@ -1955,7 +1952,7 @@ export default defineComponent({
if (col) {
if (col.label_trans === t('movement.accountFromId')) {
// ..
}
}