- Visu Saldo su Home

- SendRisTo
- Movimenti conto Comunitario
- Profilo
This commit is contained in:
Surya Paolo
2023-03-17 19:07:43 +01:00
parent 37c2f08510
commit af04e022eb
35 changed files with 393 additions and 98 deletions

View File

@@ -364,6 +364,7 @@ export default defineComponent({
const myvertical = ref(props.vertical)
const ordinam = ref('')
const ordinam_desc = ref(false)
const valoriopt = computed(() => (item: any, addall: boolean, addnone: boolean) => {
@@ -429,8 +430,8 @@ export default defineComponent({
watch(() => ordinam.value, (to: any, from: any) => {
if (pagination.value.sortBy !== ordinam.value) {
tools.setCookie('s_ordinam_' + props.prop_mytable, ordinam.value)
pagination.value.sortBy = ordinam.value
refresh()
// pagination.value.sortBy = getObjSort(ordinam.value, ordinam_desc.value)
// refresh()
}
})
@@ -616,25 +617,33 @@ export default defineComponent({
return precorder ? precorder : 1;
}
// emulate ajax call
// SELECT * FROM ... WHERE...LIMIT...
async function fetchFromServer(startRow: any, endRow: any, param_myfilter: any, param_myfilterand: any, sortBy: any, descending: any) {
// console.log('fetchFromServer')
function getObjSort(sortBy: any, descending: any) {
let myobj: any = {}
if (sortBy) {
let arrsort = sortBy.split(',');
let arrdescending = (descending && descending.length > 0) ? descending.split(',') : [];
if (arrsort) {
sortBy = sortBy + ''
descending = descending + ''
let arrsort = (sortBy && sortBy.indexOf(',') > 0) ? sortBy.split(',') : [];
let arrdescending = (descending && descending.lenght > 1 && descending.indexOf(',') > 0) ? descending.split(',') : [];
if (arrsort.length > 0) {
for (let i = 0; i < arrsort.length; i++) {
let field = arrsort[i].trim()
myobj[field] = (tools.isArray(arrdescending) && (arrdescending.length > [i])) ? parseInt(arrdescending[i].trim()) : 1;
myobj[field] = getOrderByField(field, myobj[field])
let risdesc = (tools.isArray(arrdescending) && (arrdescending.length > i)) ? parseInt(arrdescending[i].trim()) : 1;
myobj[field] = getOrderByField(field, risdesc)
}
} else {
myobj[sortBy] = getOrderByField(sortBy, descending ? -1 : 1)
}
}
console.log('myobj', myobj)
return myobj
}
// emulate ajax call
// SELECT * FROM ... WHERE...LIMIT...
async function fetchFromServer(startRow: any, endRow: any, param_myfilter: any, param_myfilterand: any, sortBy: any, descending: any) {
// console.log('fetchFromServer')
let myobj = getObjSort(sortBy, descending)
// console.log('sortBy', sortBy)
const filtersearch: any[] = []
@@ -982,11 +991,12 @@ export default defineComponent({
// don't forfunction to update local pagination object
pagination.value.page = page
pagination.value.rowsPerPage = rowsPerPage
pagination.value.sortBy = sortBy
pagination.value.sortBy = getObjSort(sortBy, descending)
ordinam.value = sortBy
ordinam_desc.value = descending
pagination.value.descending = descending
console.log('pagination', pagination)
// console.log('pagination', pagination)
// ...and turn of loading indicator
loading.value = false
@@ -1001,8 +1011,10 @@ export default defineComponent({
const myfilternow = myfilter.value
const myfilterandnow = myfilterand.value
if (ordinam.value)
if (ordinam.value) {
sortBy = ordinam.value
descending = ordinam_desc.value
}
savefilter()
@@ -1054,8 +1066,9 @@ export default defineComponent({
// don't forfunction to update local pagination object
pagination.value.page = page
pagination.value.rowsPerPage = rowsPerPage
pagination.value.sortBy = sortBy
pagination.value.sortBy = getObjSort(sortBy, descending)
ordinam.value = sortBy
ordinam_desc.value = descending
pagination.value.descending = descending
// console.log('pagination', pagination)
@@ -1436,7 +1449,6 @@ export default defineComponent({
tablesel.value = tools.getCookie('tablesel', tablesel.value)
}
myfilterand.value = props.filterdef
// myfiltercustom.value = props.filtercustom
// console.log('tablesel', tablesel)
@@ -1448,7 +1460,16 @@ export default defineComponent({
tablesel.value = mytable.value
}
ordinam.value = tools.getCookie('s_ordinam_' + tablesel.value, null)
if (!shared_consts.TABLES_ORDER_DATE_UPDATED.includes(tablesel.value) &&
!shared_consts.TABLES_ORDER_DESCR.includes(tablesel.value)) {
console.log('get cookie)')
let v1 = tools.getCookie('s_ordinam_' + tablesel.value, null)
if (v1)
ordinam.value = v1
let v2 = tools.getCookie('s_ordinam_des_' + tablesel.value, null)
if (v2)
ordinam_desc.value = v2
}
// console.log('2) tablesel', tablesel.value)
@@ -2239,6 +2260,7 @@ export default defineComponent({
userStore,
doSort,
ordinam,
ordinam_desc,
}
}
})