From 944d12194392ca171380f8830cf59a3352f85d0d Mon Sep 17 00:00:00 2001 From: Surya Paolo Date: Wed, 7 Dec 2022 18:16:23 +0100 Subject: [PATCH] - Installa APP: Messaggio in CIMA - in sistemazione: select compare la scelta di prima. --- src/App.ts | 12 +- src/common/shared_vuejs.ts | 5 + .../CCheckAppRunning/CCheckAppRunning.scss | 0 .../CCheckAppRunning/CCheckAppRunning.ts | 54 + .../CCheckAppRunning/CCheckAppRunning.vue | 31 + src/components/CCheckAppRunning/index.ts | 1 + src/components/CGridTableRec/CGridTableRec.ts | 13 + .../CGridTableRec/CGridTableRec.vue | 1487 +++++++++-------- src/components/CMyElem/CMyElem.ts | 3 +- src/components/CMyElem/CMyElem.vue | 4 + src/components/CMyPopupEdit/CMyPopupEdit.ts | 2 +- src/components/CMyPopupEdit/CMyPopupEdit.vue | 26 + src/components/CMyRecCard/CMyRecCard.ts | 5 + src/components/CMyRecCard/CMyRecCard.vue | 2 +- src/components/CMySelect/CMySelect.ts | 3 + src/components/CMySelect/CMySelect.vue | 1 + .../CPresentazione/CPresentazione.ts | 11 - .../CRegistration/CRegistration.scss | 0 src/components/CRegistration/CRegistration.ts | 29 + .../CRegistration/CRegistration.vue | 39 + src/components/CRegistration/index.ts | 1 + src/css/app.scss | 5 +- src/model/GlobalStore.ts | 4 + src/model/UserStore.ts | 2 +- src/statics/lang/it.js | 1 + src/store/Modules/costanti.ts | 1 + src/store/Modules/fieldsTable.ts | 102 +- src/store/Modules/tools.ts | 6 +- src/store/globalStore.ts | 21 + 29 files changed, 1119 insertions(+), 752 deletions(-) create mode 100755 src/components/CCheckAppRunning/CCheckAppRunning.scss create mode 100755 src/components/CCheckAppRunning/CCheckAppRunning.ts create mode 100755 src/components/CCheckAppRunning/CCheckAppRunning.vue create mode 100755 src/components/CCheckAppRunning/index.ts create mode 100755 src/components/CRegistration/CRegistration.scss create mode 100755 src/components/CRegistration/CRegistration.ts create mode 100755 src/components/CRegistration/CRegistration.vue create mode 100755 src/components/CRegistration/index.ts diff --git a/src/App.ts b/src/App.ts index 688ebf97..09a1359f 100755 --- a/src/App.ts +++ b/src/App.ts @@ -58,7 +58,7 @@ export default { } } - function isScrolledIntoView (el: any) { + function isScrolledIntoView(el: any) { let rect = el.getBoundingClientRect() let elemTop = rect.top let elemBottom = rect.bottom @@ -75,6 +75,16 @@ export default { console.log('scrolled') } } + + let displayMode = 'browser'; + const mqStandAlone = '(display-mode: standalone)'; + // @ts-ignore + if (((navigator && (navigator.standalone))) || + (window.matchMedia(mqStandAlone).matches)) { + displayMode = 'standalone' + } + + globalStore.isAppRunning = displayMode === 'standalone'; } function mounted() { diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index cd4a315f..f4ca32b2 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -37,6 +37,7 @@ export const shared_consts = { CAROUSEL_IMGS: 110, OPENSTREETMAP: 120, MAINVIEW: 130, + CHECKAPPRUNNING: 135, DASHBOARD: 140, STATUSREG: 160, CHECKIFISLOGGED: 170, @@ -1353,6 +1354,10 @@ export const shared_consts = { value: 210, label: 'Notifiche in Top', }, + { + value: 135, + label: 'Check App Running', + }, { value: 220, label: 'CHART', diff --git a/src/components/CCheckAppRunning/CCheckAppRunning.scss b/src/components/CCheckAppRunning/CCheckAppRunning.scss new file mode 100755 index 00000000..e69de29b diff --git a/src/components/CCheckAppRunning/CCheckAppRunning.ts b/src/components/CCheckAppRunning/CCheckAppRunning.ts new file mode 100755 index 00000000..40b011f8 --- /dev/null +++ b/src/components/CCheckAppRunning/CCheckAppRunning.ts @@ -0,0 +1,54 @@ +import { defineComponent, ref, computed, PropType, toRef } from 'vue' +import { useUserStore } from '@store/UserStore' +import { useRouter } from 'vue-router' +import { useGlobalStore } from '@store/globalStore' +import { useI18n } from '@/boot/i18n' +import { tools } from '@store/Modules/tools' +import { costanti, IMainCard } from '@store/Modules/costanti' +import { CBigBtn } from '@/components/CBigBtn' + + +export default defineComponent({ + name: 'CCheckAppRunning', + components: { CBigBtn }, + props: {}, + setup(props, { emit }) { + + const userStore = useUserStore() + const $router = useRouter() + const globalStore = useGlobalStore() + const { t } = useI18n() + + const deferredPrompt = ref(null) + + const isAppRunning = computed(() => globalStore.isAppRunning ) + + const finishLoading = computed(() => globalStore.finishLoading) + + function initprompt() { + window.addEventListener('beforeinstallprompt', (event) => { + event.preventDefault() + console.log('beforeinstallprompt !') + // Stash the event so it can be triggered later. + deferredPrompt.value = event + }) + } + + function installApp() { + if (deferredPrompt.value) + deferredPrompt.value.prompt() + } + + initprompt() + + return { + userStore, + tools, + costanti, + finishLoading, + deferredPrompt, + installApp, + isAppRunning, + } + } +}) diff --git a/src/components/CCheckAppRunning/CCheckAppRunning.vue b/src/components/CCheckAppRunning/CCheckAppRunning.vue new file mode 100755 index 00000000..02f94f31 --- /dev/null +++ b/src/components/CCheckAppRunning/CCheckAppRunning.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/src/components/CCheckAppRunning/index.ts b/src/components/CCheckAppRunning/index.ts new file mode 100755 index 00000000..d042cfd4 --- /dev/null +++ b/src/components/CCheckAppRunning/index.ts @@ -0,0 +1 @@ +export {default as CCheckAppRunning} from './CCheckAppRunning.vue' diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index 36b993c3..d479b16e 100755 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -264,6 +264,7 @@ export default defineComponent({ const addRow = ref('Aggiungi') const newRecordBool = ref(false) + const newRecordBoolOld = ref(false) const editRecordBool = ref(false) const newRecord: any = ref({}) const recSaved: any = ref({}) @@ -278,6 +279,7 @@ export default defineComponent({ const tablesel = ref('') const loading = ref(false) + const editOn = ref(false) const visupagedialog = ref(false) const myrecdialog = ref(null) @@ -1818,6 +1820,15 @@ export default defineComponent({ ris.username = userStore.my.username } + if (userStore.my.profile) { + if (fieldsTable.tableforEnableCircuits.includes(props.prop_mytable)) { + if (!userStore.my.profile.calc.numGoodsAndServices) + userStore.my.profile.calc.numGoodsAndServices = 1 + else + userStore.my.profile.calc.numGoodsAndServices += 1 + } + } + // console.table(serverData.value) if (indrec >= 0) serverData.value[indrec] = ris @@ -2153,6 +2164,8 @@ export default defineComponent({ t, exportTable, showNotification, + editOn, + newRecordBoolOld, } } }) diff --git a/src/components/CGridTableRec/CGridTableRec.vue b/src/components/CGridTableRec/CGridTableRec.vue index 2e99eb2b..99c0b74e 100755 --- a/src/components/CGridTableRec/CGridTableRec.vue +++ b/src/components/CGridTableRec/CGridTableRec.vue @@ -1,5 +1,12 @@