Export Movements to CSV File

fix Visibility for a Circuit
This commit is contained in:
Paolo Arena
2022-09-19 14:37:44 +02:00
parent ce79360d03
commit c75b78ea98
21 changed files with 122 additions and 37 deletions

View File

@@ -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"

View File

@@ -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

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -1,5 +1,5 @@
(function () {
console.log('LOADING IDB.JS .....')
// console.log('LOADING IDB.JS .....')
function toArray(arr) {
return Array.prototype.slice.call(arr);
}

View File

@@ -94,7 +94,7 @@ export const shared_consts = {
PUBTOSHARE: {
ALL: 0,
ONLY_GROUPS_FOLLOW: 1,
ONLY_TABLE_FOLLOW: 1,
},
REPORT_FILT_RESP: 1,

View File

@@ -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,

View File

@@ -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,
}
}
})

View File

@@ -413,9 +413,18 @@
</q-tr>
</template>
<template v-slot:top-right v-if="tablesList || arrfilters">
<template v-slot:top-right v-if="tablesList || arrfilters || enableExport">
<span style="display: none">{{ actual = null }}</span>
<q-btn
v-if="enableExport"
color="primary"
icon-right="archive"
:label="t('export.csv')"
no-caps
@click="exportTable"
/>
<q-select
v-if="tablesList"
v-model="tablesel"

View File

@@ -66,7 +66,6 @@ export default defineComponent({
const mybutt = []
mybutt.push({ label: t('mypages.follow_circuits') + ' (' + numMyCircuits.value + ')', value: costanti.MY_CIRCUITS })
mybutt.push({ label: t('mypages.find_circuit'), value: costanti.FIND_CIRCUIT })
// mybutt.push({ label: t('mypages.manage_my_circuits') + ' (' + numManageCircuits.value + ')', value: costanti.MANAGE_CIRCUITS })
if (numAskSentCircuits.value > 0 || props.modelValue === costanti.ASK_SENT_CIRCUIT)
@@ -104,8 +103,6 @@ export default defineComponent({
arr = circuitStore.listcircuits
} else if (props.modelValue === costanti.MY_CIRCUITS ) {
arr = circuitStore.listcircuits.filter((circ: any) => userStore.my.profile.mycircuits.findIndex((rec: any) => circ.name === rec.circuitname) >= 0)
} else if (props.modelValue === costanti.MANAGE_CIRCUITS) {
// arr = userStore.my.profile.manage_mycircuits
} else if (props.modelValue === costanti.ASK_SENT_CIRCUIT) {
arr = userStore.my.profile.asked_circuits
}

View File

@@ -10,6 +10,9 @@ const msg_it = {
guida: 'Guida',
guida_passopasso: 'Guida Passo Passo',
},
export: {
csv: 'Esporta in CSV',
},
grid: {
editvalues: 'Modifica Valori',
addrecord: 'Aggiungi Riga',
@@ -1137,6 +1140,10 @@ const msg_it = {
durata_deper: 'Durata Dep.',
img_logo: 'NomeFile Logo',
regulation: 'Regolamento',
disclaimer: 'Questo Strumento vuole essere un\'aiuto per contabilizzare gli scambi tra utenti. ' +
'Consigliamo vivamente di scaricarsi con frequenza le transazioni utenti, per ogni possibile evento imprevisto ' +
'(Server inaccessibile, ecc..) declinando così il creatore della APP da ogni responsabilità su come' +
'verrà utilizzata dal gruppo. ',
acceptregulation: 'Accetta il Regolamento',
domanda_ask: 'Chiedere l\'invito al Circuito {circuitname} accettando il suo Regolamento?',
domanda_revoke: 'Revocare la richiesta al Circuito {circuitname}?',

View File

@@ -206,8 +206,6 @@ export const costanti = {
ADMIN_GROUPS: 40,
FIND_CIRCUIT: 50,
MY_CIRCUITS: 51,
CREATE_CIRCUIT: 52,
MANAGE_CIRCUITS: 53,
ADMIN_CIRCUITS: 54,
ASK_SENT_CIRCUIT: 55,

View File

@@ -2197,7 +2197,7 @@ export const tools = {
isManager() {
const userStore = useUserStore()
return userStore.isManager
return userStore.isManager || userStore.isAdmin
},
isSocioResidente() {
@@ -2465,6 +2465,10 @@ export const tools = {
return date.formatDate(mytimestamp, 'YYYY-MM-DD HH:mm')
},
getstrYYMMDDHHMMDateTime(mytimestamp: Date | number | string | undefined) {
return date.formatDate(mytimestamp, 'YYYY-MM-DD_HH:mm')
},
getstrYYMMDDDateTimeAll(mytimestamp: Date | number | string | undefined) {
return date.formatDate(mytimestamp, 'YYYY-MM-DD HH:mm:ss')
},

View File

@@ -650,6 +650,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
// If is not already stored in DB, then show the message to the user.
if (!this.wasAlreadySubscribed || notreg) {
/*
options = {
title: tools.translate('notification.title_subscribed', [{
strin: 'sitename',
@@ -658,6 +659,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
content: translate('notification.subscribed'),
openUrl: '/',
}
*/
}
const myres = {
@@ -720,8 +723,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
}
})
}).catch((err) => {
console.error('err ready service worker', err)
})
console.error('err ready service worker', err)
})
}
}

View File

@@ -122,6 +122,7 @@
:vertical="0"
nodataLabel="Nessun Movimento effettuato"
:prop_search="true"
:enableExport="true"
hint="nota da trovare"
:finder="false"
:choose_visutype="false"
@@ -152,6 +153,7 @@
col_title="Lista Movimenti"
:vertical="costanti.VISUTABLE_LISTA"
nodataLabel="Nessun Movimento effettuato"
:enableExport="true"
:prop_search="true"
hint="nota da trovare"
:finder="false"
@@ -487,7 +489,18 @@
class="bg-green text-white"
style="text-align: center;"
>
<em style="font-weight: bold">Regolamento:</em><br>
<em style="font-weight: bold">Disclaimer:</em><br>
</q-banner>
<div v-html="t('circuit.disclaimer')">
</div>
</q-card-section>
<q-card-section class="inset-shadow">
<q-banner
rounded
class="bg-green text-white"
style="text-align: center;"
>
<em style="font-weight: bold">Regolamento interno:</em><br>
</q-banner>
<div v-html="circuit.regulation">
</div>

View File

@@ -49,6 +49,7 @@ export default defineComponent({
colmyUserCircuit,
toolsext,
isfinishLoading,
tools,
}
}
})

View File

@@ -8,14 +8,12 @@
<CFinder
:table="toolsext.TABCIRCUITS"
:noButtAdd="!tools.isManager()"
:showFilterPersonal="true"
/>
</CMyCircuits>
<div v-if="filter === costanti.CREATE_CIRCUIT">
Nuovo Circuito:
</div>
</div>
</template>