From c75b78ea98507f15739c174bb1533270bd264d47 Mon Sep 17 00:00:00 2001 From: Paolo Arena Date: Mon, 19 Sep 2022 14:37:44 +0200 Subject: [PATCH] Export Movements to CSV File fix Visibility for a Circuit --- .env.development | 2 +- .env.example.production | 2 +- _ALL_SITES/insiemesipuo.app/.env.development | 2 +- .../popolodelnuovomondo.app/.env.development | 2 +- _ALL_SITES/riso.app/.env.development | 2 +- _ALL_SITES/riso.app/.env.test | 2 +- .../terradellavisione.app/.env.development | 2 +- _ALL_SITES/terradellavisione.app/.env.test | 2 +- public/js/idb.js | 2 +- src/common/shared_vuejs.ts | 2 +- src/components/CFinder/CFinder.ts | 12 +--- src/components/CGridTableRec/CGridTableRec.ts | 71 ++++++++++++++++++- .../CGridTableRec/CGridTableRec.vue | 11 ++- src/components/CMyCircuits/CMyCircuits.ts | 3 - src/statics/lang/it.js | 7 ++ src/store/Modules/costanti.ts | 2 - src/store/Modules/tools.ts | 6 +- src/store/globalStore.ts | 7 +- src/views/user/mycircuit/mycircuit.vue | 15 +++- src/views/user/mycircuits/mycircuits.ts | 1 + src/views/user/mycircuits/mycircuits.vue | 4 +- 21 files changed, 122 insertions(+), 37 deletions(-) diff --git a/.env.development b/.env.development index 8bce66d4..7413cafb 100755 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.5.12" +APP_VERSION="0.5.13" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL="newfreeplanet" diff --git a/.env.example.production b/.env.example.production index aa8d2e81..97b9b3d0 100755 --- a/.env.example.production +++ b/.env.example.production @@ -1,4 +1,4 @@ -APP_VERSION="0.5.12" +APP_VERSION="0.5.13" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL=newfreeplanet diff --git a/_ALL_SITES/insiemesipuo.app/.env.development b/_ALL_SITES/insiemesipuo.app/.env.development index 8755c7d7..2fb1ed9e 100755 --- a/_ALL_SITES/insiemesipuo.app/.env.development +++ b/_ALL_SITES/insiemesipuo.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.5.12" +APP_VERSION="0.5.13" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/popolodelnuovomondo.app/.env.development b/_ALL_SITES/popolodelnuovomondo.app/.env.development index fcb98d5a..1bf69bc3 100755 --- a/_ALL_SITES/popolodelnuovomondo.app/.env.development +++ b/_ALL_SITES/popolodelnuovomondo.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.5.12" +APP_VERSION="0.5.13" SERVICE_WORKER_FILE="service-worker.js" APP_ID="12" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/riso.app/.env.development b/_ALL_SITES/riso.app/.env.development index 1e9d8aa4..aaf8256f 100755 --- a/_ALL_SITES/riso.app/.env.development +++ b/_ALL_SITES/riso.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.5.12" +APP_VERSION="0.5.13" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/riso.app/.env.test b/_ALL_SITES/riso.app/.env.test index e74d42f4..6a368852 100755 --- a/_ALL_SITES/riso.app/.env.test +++ b/_ALL_SITES/riso.app/.env.test @@ -1,4 +1,4 @@ -APP_VERSION="0.5.12" +APP_VERSION="0.5.13" SERVICE_WORKER_FILE="service-worker.js" APP_ID="13" DIRECTORY_LOCAL=newfreeplanet diff --git a/_ALL_SITES/terradellavisione.app/.env.development b/_ALL_SITES/terradellavisione.app/.env.development index c1a07d7e..7ec76fb5 100755 --- a/_ALL_SITES/terradellavisione.app/.env.development +++ b/_ALL_SITES/terradellavisione.app/.env.development @@ -1,4 +1,4 @@ -APP_VERSION="0.5.12" +APP_VERSION="0.5.13" SERVICE_WORKER_FILE="service-worker.js" APP_ID="14" DIRECTORY_LOCAL="newfreeplanet" diff --git a/_ALL_SITES/terradellavisione.app/.env.test b/_ALL_SITES/terradellavisione.app/.env.test index 40ee5748..5ba21319 100755 --- a/_ALL_SITES/terradellavisione.app/.env.test +++ b/_ALL_SITES/terradellavisione.app/.env.test @@ -1,4 +1,4 @@ -APP_VERSION="0.5.12" +APP_VERSION="0.5.13" SERVICE_WORKER_FILE="service-worker.js" APP_ID="14" DIRECTORY_LOCAL=newfreeplanet diff --git a/public/js/idb.js b/public/js/idb.js index 00f55a33..6dfbd1d7 100755 --- a/public/js/idb.js +++ b/public/js/idb.js @@ -1,5 +1,5 @@ (function () { - console.log('LOADING IDB.JS .....') + // console.log('LOADING IDB.JS .....') function toArray(arr) { return Array.prototype.slice.call(arr); } diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index 745e1980..b687142d 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -94,7 +94,7 @@ export const shared_consts = { PUBTOSHARE: { ALL: 0, - ONLY_GROUPS_FOLLOW: 1, + ONLY_TABLE_FOLLOW: 1, }, REPORT_FILT_RESP: 1, diff --git a/src/components/CFinder/CFinder.ts b/src/components/CFinder/CFinder.ts index e951b752..a42b9604 100755 --- a/src/components/CFinder/CFinder.ts +++ b/src/components/CFinder/CFinder.ts @@ -885,17 +885,6 @@ export default defineComponent({ // param1: shared_consts.PARAM_SHOW_PROVINCE, tablesel: 'cities', }, - { - label: 'Visibilità', - table: 'pub_to_share', - key: 'pub_to_share', - type: costanti.FieldType.select, - value: tools.getCookie(tools.COOK_SEARCH + 'pub_to_share', shared_consts.PUBTOSHARE.ALL, true), - addall: false, - arrvalue: [], - useinput: false, - filter: null, - }, ] searchList_MyGroups.value = [ @@ -1100,6 +1089,7 @@ export default defineComponent({ symbol: 1, idCity: 1, pub_to_share: 1, + visibility: 1, color: 1, abbrev: 1, data_costituz: 1, diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index 3929d3b9..00bb6c13 100755 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -31,7 +31,7 @@ import { CTitleBanner } from '../CTitleBanner' import { useUserStore } from '@store/UserStore' import { useGlobalStore } from '@store/globalStore' -import { useQuasar } from 'quasar' +import { useQuasar, exportFile } from 'quasar' import { costanti } from '@costanti' import translate from '@/globalroutines/util' import { toolsext } from '@store/Modules/toolsext' @@ -92,6 +92,11 @@ export default defineComponent({ required: false, default: 0, }, + enableExport: { + type: Boolean, + required: false, + default: false, + }, finder_noNull: { type: Boolean, required: false, @@ -960,7 +965,7 @@ export default defineComponent({ } function refresh_infscroll(done: any) { - console.log('refresh_infscroll') + // console.log('refresh_infscroll') rowclicksel.value = null onUpdateData(0, @@ -972,7 +977,7 @@ export default defineComponent({ function refresh() { - console.log('refresh', 'startsearch', startsearch.value) + // console.log('refresh', 'startsearch', startsearch.value) clickbuttsearch.value = true // console.log('refresh') @@ -1932,7 +1937,66 @@ export default defineComponent({ done() } } + + function wrapCsvValue (val: any, formatFn?: any, row?: any, col?: IColGridTable) { + let formatted = formatFn !== void 0 + ? formatFn(val, row) + : val + + formatted = formatted === void 0 || formatted === null + ? '' + : String(formatted) + + formatted = formatted.split('"').join('""') + /** + * Excel accepts \n and \r in strings, but some other CSV parsers do not + * Uncomment the next two lines to escape new lines + */ + // .split('\n').join('\\n') + // .split('\r').join('\\r') + + if (col) { + if (col.label_trans === t('movement.accountFromId')) { + + } + } + + if (col) + console.log(' valu', formatted, ' (col=', col.name) + + return `"${formatted}"` + } + // onMounted(mounted) + function exportTable () { + // console.log('row', serverData.value) + // console.log('mycolumns.value', mycolumns.value) + // naive encoding to csv format + const content = [mycolumns.value.map((col: any) => wrapCsvValue(col.label))].concat( + serverData.value.map((row: any) => mycolumns.value.map((col: any) => wrapCsvValue( + typeof col.field === 'function' + ? col.field(row) + : tools.getValue(row, col.field, col.subfield), + col.format, + row, + col + )).join(',')) + ).join('\r\n') + + const status = exportFile( + 'export-' + mytable.value + '_' + tools.getstrYYMMDDHHMMDateTime(tools.getDateNow()) + '.csv', + content, + 'text/csv' + ) + + if (status !== true) { + $q.notify({ + message: 'Il Browser ha negato il download del file.', + color: 'negative', + icon: 'warning' + }) + } + } created() mounted() @@ -2025,6 +2089,7 @@ export default defineComponent({ numRecLoaded, myinfscroll, t, + exportTable, } } }) diff --git a/src/components/CGridTableRec/CGridTableRec.vue b/src/components/CGridTableRec/CGridTableRec.vue index 433d2364..94344f57 100755 --- a/src/components/CGridTableRec/CGridTableRec.vue +++ b/src/components/CGridTableRec/CGridTableRec.vue @@ -413,9 +413,18 @@ -