diff --git a/src/classes/routinestd.ts b/src/classes/routinestd.ts index bfa4b91..050c871 100644 --- a/src/classes/routinestd.ts +++ b/src/classes/routinestd.ts @@ -1,10 +1,15 @@ export async function askConfirm($q: any, mytitle, mytext, ok, cancel) { try { return await $q.dialog({ - title: mytitle, + cancel: { + label: cancel + }, message: mytext, - ok: ok, - cancel: cancel + ok: { + label: ok, + push: true + }, + title: mytitle }).then((ris) => { return true // this.$q.notify('Agreed!') diff --git a/src/components/todos/SingleTodo/SingleTodo.scss b/src/components/todos/SingleTodo/SingleTodo.scss index 26c9781..698af53 100644 --- a/src/components/todos/SingleTodo/SingleTodo.scss +++ b/src/components/todos/SingleTodo/SingleTodo.scss @@ -25,7 +25,7 @@ $heightdescr: 20px; .flex-container2 { flex-flow: row wrap; justify-content: space-between; - margin: 0px 5px 0px 5px; // top right bottom left + margin: 0px 1px 0px 1px; // top right bottom left } // Set visibility: visible to the icon menu of pos-item-popover @@ -71,7 +71,7 @@ $heightdescr: 20px; .pos-item { max-width: 24px; - min-width: 24px; + min-width: 26px; margin-left: 1px; margin-right: 1px; padding-left: 1px; @@ -218,16 +218,20 @@ $heightdescr: 20px; } .data-item { - max-width: 84px; + max-width: 78px; //min-width: 100px; //display: flex; //visibility: initial; margin-right: 3px; - color: #ccc; + color: #585858; order: 1; flex: 1; - height: $heightBtn; - line-height: $heightBtn; + height: $heightitem; + line-height: $heightitem; + padding-left: 2px; + padding-right: 0px; + //height: $heightBtn; + //line-height: $heightBtn; } @@ -263,7 +267,6 @@ $heightdescr: 20px; vertical-align: middle; line-height: 120%; - max-height: 40px; //background-color: #d50000; @@ -279,14 +282,17 @@ $heightdescr: 20px; } .div_descr { - display: table-cell; + display: -webkit-box; + max-height: 45px; } .div_descr_edit { + //display: block; max-height: 90px; //line-height: 120%; + //max-height: 90px; line-height: $heightitem; } diff --git a/src/components/todos/SingleTodo/SingleTodo.ts b/src/components/todos/SingleTodo/SingleTodo.ts index 0bbe535..e719dc9 100644 --- a/src/components/todos/SingleTodo/SingleTodo.ts +++ b/src/components/todos/SingleTodo/SingleTodo.ts @@ -22,7 +22,7 @@ export default class SingleTodo extends Vue { public classCompleted: string = '' public classDescr: string = '' public classDescrEdit: string = '' - public classExpiring: string = '' + public classExpiring: string = 'flex-item data-item shadow-1' public classExpiringEx: string = '' public iconPriority: string = '' public popover: boolean = false @@ -65,7 +65,10 @@ export default class SingleTodo extends Vue { } @Watch('itemtodo.progress') public valueChanged6() { + console.log('itemtodo.progress') this.updateClasses() + + console.log('this.percentageProgress', this.percentageProgress, 'this.itemtodo.progress', this.itemtodo.progress) } /* @@ -103,6 +106,9 @@ export default class SingleTodo extends Vue { this.classDescrEdit += ' titleLista-item' } + if (this.itemtodo.progress > 100) + this.itemtodo.progress = 100 + this.classExpiring = 'flex-item data-item shadow-1' this.classExpiringEx = '' if (this.itemtodo.completed) { @@ -362,6 +368,14 @@ export default class SingleTodo extends Vue { this.updateClasses() } + public aggiornaProgress(value, initialval){ + if (value !== initialval) { + this.itemtodo.progress = value + this.updatedata('progress') + this.deselectAndExitEdit() + } + } + public setCompleted() { // console.log('setCompleted') this.itemtodo.completed = !this.itemtodo.completed diff --git a/src/components/todos/SingleTodo/SingleTodo.vue b/src/components/todos/SingleTodo/SingleTodo.vue index ea00d59..aa7dc63 100644 --- a/src/components/todos/SingleTodo/SingleTodo.vue +++ b/src/components/todos/SingleTodo/SingleTodo.vue @@ -18,6 +18,8 @@
@@ -37,7 +39,7 @@ -
+
{{percentageProgress}}% - - + +
@@ -57,16 +62,24 @@
{{getstrDate(itemtodo.expiring_at)}} - - - - + + + + + + + + + + + + + + + + + +
div:nth-child(2) > div > input { +.menuInputProgress > div > div > div > input { min-width: 30px; + max-width: 30px; width: 30px; } diff --git a/src/components/todos/SubMenus/SubMenus.ts b/src/components/todos/SubMenus/SubMenus.ts index 0eab2c2..80eaf7e 100644 --- a/src/components/todos/SubMenus/SubMenus.ts +++ b/src/components/todos/SubMenus/SubMenus.ts @@ -1,9 +1,9 @@ import Vue from 'vue' import { Component, Prop } from 'vue-property-decorator' -import { ITodo } from '../../../model/index' import { tools } from '@src/store/Modules/tools' import { UserStore } from '@store' +import { ITodo } from '../../../model/index' // Doesn't exist in quasar this ? error TS2305 // import { format } from 'quasar' @@ -18,19 +18,19 @@ import { UserStore } from '@store' export default class SubMenus extends Vue { public selectPriority: [] = tools.selectPriority[UserStore.state.lang] - @Prop({ required: false }) menuPopupTodo: any[] - @Prop({ required: false }) itemtodo: ITodo - $q: any + @Prop({ required: false }) public menuPopupTodo: any[] + @Prop({ required: false }) public itemtodo: ITodo + public $q: any - clickMenu (field) { + public clickMenu(field) { this.$emit('clickMenu', field) } - setPriority (field) { + public setPriority(field) { this.$emit('setPriority', field) } - KeychangeProgress (e) { + public KeychangeProgress(e) { // between(50, 10, 20) if (this.itemtodo.progress > 100) { @@ -46,7 +46,7 @@ export default class SubMenus extends Vue { } } - create () { + public create() { this.selectPriority = tools.selectPriority[UserStore.state.lang] console.log('CREAZIONE') diff --git a/src/components/todos/SubMenus/SubMenus.vue b/src/components/todos/SubMenus/SubMenus.vue index fa53667..696d0b5 100644 --- a/src/components/todos/SubMenus/SubMenus.vue +++ b/src/components/todos/SubMenus/SubMenus.vue @@ -1,6 +1,6 @@ -
- - - - diff --git a/src/layouts/menuone/menuOne.scss b/src/layouts/menuone/menuOne.scss new file mode 100644 index 0000000..e5b9e67 --- /dev/null +++ b/src/layouts/menuone/menuOne.scss @@ -0,0 +1,52 @@ +.q-list-header { + min-height: 12px; + padding: 5px 8px; +} + +.menu-hr { + border-color: #dedede; + height: 0.5px; +} + +.router-link-active { + color: #027be3; + background-color: #dadada !important; + border-right: 2px solid #027be3; +} + +.list-label:first-child { + line-height: 20px; + padding: 5px; + margin: 1px; +} + +/* +.menu-enter-active, .scale-enter { + -webkit-animation: moveFromTopFade .5s ease both; + animation: moveFromTopFade .5s ease both; +} + +.menu-leave-to, .scale-leave-active { + -webkit-animation: moveToBottom .5s ease both; + animation: moveToBottom .5s ease both; +} +*/ + +.router-link-active { + color: #027be3; + background-color: #dadada !important; + border-right: 2px solid #027be3; +} + +.router-link-active .item-primary { + color: #027be3; +} + +.menu_freccina { + position: absolute; + right: 10px; + display: inline-block; + padding: 0 0px 0px 0px; + -webkit-transform: rotate(-180deg); + transform: rotate(-180deg); +} diff --git a/src/layouts/menuone/menuOne.ts b/src/layouts/menuone/menuOne.ts new file mode 100644 index 0000000..cc198fa --- /dev/null +++ b/src/layouts/menuone/menuOne.ts @@ -0,0 +1,38 @@ +import Vue from 'vue' +import { Watch } from 'vue-property-decorator' +import { GlobalStore } from '../../store/Modules' + +export default class MenuOne extends Vue { + + @Watch('$route.path') + private modifroute() { + Object.keys(this.getmenu).forEach((parentName) => { + this.setParentVisibilityBasedOnRoute(this.getmenu[parentName]) + }) + } + + // get currentRoutePath() { + // return this.$route.path + // } + + get getmenu() { + return GlobalStore.getters.getmenu + } + + public setParentVisibilityBasedOnRoute(parent) { + parent.routes.forEach((item) => { + if (this.$route.path === item.route) { + parent.show = true + return + } + }) + } + + public replaceUnderlineToSpace(text) { + while (text.indexOf('_') !== -1) { + text = text.replace('_', ' ') + } + return text + } + +} diff --git a/src/layouts/menuone/menuOne.vue b/src/layouts/menuone/menuOne.vue new file mode 100644 index 0000000..404be9d --- /dev/null +++ b/src/layouts/menuone/menuOne.vue @@ -0,0 +1,62 @@ + + + + + + diff --git a/src/layouts/toolbar/messagePopover/messagePopover.ts b/src/layouts/toolbar/messagePopover/messagePopover.ts index 0a7e65f..9d6d302 100644 --- a/src/layouts/toolbar/messagePopover/messagePopover.ts +++ b/src/layouts/toolbar/messagePopover/messagePopover.ts @@ -11,7 +11,7 @@ import './messagePopover.scss' export default class MessagePopover extends Vue { posts: IPost[] = [] - created() { + public created() { if (GlobalStore.state.posts.length < 1) { this.requestPosts() } diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts index e9dc4f9..b27dc1b 100644 --- a/src/model/GlobalStore.ts +++ b/src/model/GlobalStore.ts @@ -54,6 +54,7 @@ export interface IGlobalState { testp1: ITestp1 connData: IConnData posts: IPost[] + menulinks: {} listatodo: ITodoList[] arrConfig: IConfig[] } diff --git a/src/statics/i18n.js b/src/statics/i18n.js index 57155bb..f01eb99 100644 --- a/src/statics/i18n.js +++ b/src/statics/i18n.js @@ -95,21 +95,19 @@ const messages = { descr: '
    ' + '
  • Condividendo il progetto a Gruppi, Comunità, Associazioni No-profit, G.A.S.
  • ' + '
  • Rispondendo attivamente ai Sondaggi Popolari e lasciando Feedback
  • ' + - '
  • Effettuando piccole donazioni (anche 1€).
    ' + - 'Il ricavato, tolti i costi, verrá ripartito al 50% per il lavoro svolto, ' + - 'l\'altro per sostenere Progetti Sociali votati dalle persone stesse
  • ' + + '
  • Effettuando piccole donazioni (anche 1€) per le spese di gestione dei Server.
    ' + '
', }, multiplatform: { title: 'Multi-piattaforma', - descr: 'E\' Compatibile con Google Chrome, Firefox, Safari, iOS, Android. La stessa Applicazione ha le stesse funzionalitá sia sul cellulare che sul PC. ' + + descr: 'E\' Compatibile con Google Chrome, Firefox, Safari, iOS, Android e PC. L\'Applicazione s\'installa facilmente, senza passare dallo store. ' + 'basta condividere il nome del sito www.freeplanet.app', }, free: { title: 'Gratuita, Open Source e Niente Pubblicità', descr: 'Vedo un futuro dove non si utilizzerà più denaro. Dove le persone si aiuteranno a vicenda e non avranno bisogno di "possedere" cose, ma le condivideranno con gli altri.
' + - 'Questa App non è in vendita, non ha scopi commerciali, non ha prezzo ed appartiene solo al Popolo. A me il compito di gestirla e proteggerla. ' + - 'Sono certo che arriveranno solo i contributi necessari per sostenerla. Grazie a Tutti per il sostegno. ' + 'Questa App non è in vendita, non ha scopi commerciali, non ha prezzo ed appartiene al Popolo del Nuovo Mondo. A me il compito di gestirla e proteggerla. ' + + 'Verranno accettate solo donazioni Libere di privati ed Associazioni no-profit, in linea con i Principi, che serviranno per coprire le spese. Grazie a Tutti per il sostegno. ' }, }, pages: { @@ -205,7 +203,7 @@ const messages = { }, todo: { titleprioritymenu: 'Priorità:', - inserttop: 'Inserisci il Task in alto', + inserttop: 'Inserisci il Task in cima', insertbottom: 'Inserisci il Task in basso', edit: 'Descrizione Task:', completed: 'Ultimi Completati', diff --git a/src/store/Modules/GlobalStore.ts b/src/store/Modules/GlobalStore.ts index 57598ba..6d17355 100644 --- a/src/store/Modules/GlobalStore.ts +++ b/src/store/Modules/GlobalStore.ts @@ -1,4 +1,4 @@ -import { ICfgServer, IConfig, IGlobalState, StateConnection } from 'model' +import { ICfgServer, IConfig, IGlobalState, ITodoList, StateConnection } from 'model' import { storeBuilder } from './Store/Store' import Vue from 'vue' @@ -7,22 +7,21 @@ import translate from './../../globalroutines/util' import urlBase64ToUint8Array from '../../js/utility' -import messages from '../../statics/i18n' -import { GlobalStore, Todos, UserStore } from '@store' -import globalroutines from './../../globalroutines/index' import Api from '@api' -import { tools } from '@src/store/Modules/tools' -import { costanti } from '@src/store/Modules/costanti' import * as Types from '@src/store/Api/ApiTypes' +import { costanti } from '@src/store/Modules/costanti' +import { tools } from '@src/store/Modules/tools' +import { GlobalStore, Todos, UserStore } from '@store' +import messages from '../../statics/i18n' +import globalroutines from './../../globalroutines/index' const allTables = ['todos', 'categories', 'sync_todos', 'sync_todos_patch', 'delete_todos', 'config', 'swmsg'] const allTablesAfterLogin = ['todos', 'categories', 'sync_todos', 'sync_todos_patch', 'delete_todos', 'config', 'swmsg'] - let stateConnDefault = 'online' getstateConnSaved() - .then(conn => { + .then((conn) => { stateConnDefault = conn }) @@ -41,6 +40,7 @@ const state: IGlobalState = { testp1: { contatore: 0, mioarray: [] }, category: 'personal', posts: [], + menulinks: {}, listatodo: [ { namecat: 'personal', description: 'personal' }, { namecat: 'work', description: 'work' }, @@ -74,22 +74,21 @@ async function getstateConnSaved() { } } - const b = storeBuilder.module('GlobalModule', state) // Getters namespace Getters { - const conta = b.read(state => state.conta, 'conta') - const listatodo = b.read(state => state.listatodo, 'listatodo') - const category = b.read(state => state.category, 'category') + const conta = b.read((state) => state.conta, 'conta') + const listatodo = b.read((state) => state.listatodo, 'listatodo') + const category = b.read((state) => state.category, 'category') - const testpao1_getter_contatore = b.read(state => param1 => state.testp1.contatore + 100 + param1, 'testpao1_getter_contatore') - const testpao1_getter_array = b.read(state => param1 => state.testp1.mioarray.filter(item => item).map(item => item.valore), 'testpao1_getter_array') + const testpao1_getter_contatore = b.read((state) => (param1) => state.testp1.contatore + 100 + param1, 'testpao1_getter_contatore') + const testpao1_getter_array = b.read((state) => (param1) => state.testp1.mioarray.filter((item) => item).map((item) => item.valore), 'testpao1_getter_array') - const getConfigbyId = b.read(state => id => state.arrConfig.find(item => item._id === id), 'getConfigbyId') - const getConfigStringbyId = b.read(state => params => { - const config = state.arrConfig.find(item => item._id === params.id) + const getConfigbyId = b.read((state) => (id) => state.arrConfig.find((item) => item._id === id), 'getConfigbyId') + const getConfigStringbyId = b.read((state) => (params) => { + const config = state.arrConfig.find((item) => item._id === params.id) if (config) { return config.value } else { @@ -97,16 +96,87 @@ namespace Getters { } }, 'getConfigStringbyId') - const showtype = b.read(state => { + const showtype = b.read((state) => { // const config = state.arrConfig.find(item => item._id === cat + costanti.CONFIG_ID_SHOW_TYPE_TODOS) - const config = state.arrConfig.find(item => item._id === costanti.CONFIG_ID_SHOW_TYPE_TODOS) - if (config) + const config = state.arrConfig.find((item) => item._id === costanti.CONFIG_ID_SHOW_TYPE_TODOS) + if (config) { return config.value - else + } + else { return '' + } }, 'showtype') + const getmenu = b.read((state) => { + + const arrlista = GlobalStore.state.listatodo + let listatodo = [] + + arrlista.forEach((elem: ITodoList) => { + const item = { + faIcon: 'fa fa-list-alt', + materialIcon: 'todo', + name: 'pages.' + elem.description, + route: '/todo/' + elem.namecat + } + listatodo.push(item) + + }) + + + if (UserStore.state.isAdmin) { + state.menulinks = { + Dashboard: { + routes: [ + { route: '/', faIcon: 'fa fa-home', materialIcon: 'home', name: 'pages.home' }, + { route: '/todo', faIcon: 'fa fa-list-alt', materialIcon: 'format_list_numbered', name: 'pages.Todo', + routes2: listatodo + }, + { route: '/category', faIcon: 'fa fa-list-alt', materialIcon: 'category', name: 'pages.Category' }, + { route: '/admin/cfgserv', faIcon: 'fa fa-database', materialIcon: 'event_seat', name: 'pages.Admin' }, + { route: '/admin/testp1/par1', faIcon: 'fa fa-database', materialIcon: 'restore', name: 'pages.Test1' }, + { route: '/admin/testp1/par2', faIcon: 'fa fa-database', materialIcon: 'restore', name: 'pages.Test2' } + /* {route: '/vreg?idlink=aaa', faIcon: 'fa fa-login', materialIcon: 'login', name: 'pages.vreg'},*/ + ], + show: true + } + } + } else { + // PRODUCTION USER: + if (process.env.PROD) { + state.menulinks = { + Dashboard: { + routes: [ + { route: '/', faIcon: 'fa fa-home', materialIcon: 'home', name: 'pages.home' } + ], + show: true + } + } + } else { + // SERVER TEST + state.menulinks = { + Dashboard: { + routes: [ + { route: '/', faIcon: 'fa fa-home', materialIcon: 'home', name: 'pages.home' }, + { + route: '/todo', faIcon: 'fa fa-list-alt', materialIcon: 'todo', name: 'pages.Todo', + routes2: listatodo + }, + { route: '/category', faIcon: 'fa fa-list-alt', materialIcon: 'category', name: 'pages.Category' } + // { route: '/signup', faIcon: 'fa fa-registered', materialIcon: 'home', name: 'pages.SignUp' }, + // { route: '/signin', faIcon: 'fa fa-anchor', materialIcon: 'home', name: 'pages.SignIn' }, + /* {route: '/vreg?idlink=aaa', faIcon: 'fa fa-login', materialIcon: 'login', name: 'pages.vreg'},*/ + ], + show: true + } + } + } + } + + return state.menulinks + + }, 'getmenu') export const getters = { get testpao1_getter_contatore() { @@ -139,6 +209,10 @@ namespace Getters { return showtype() }, + get getmenu() { + return getmenu() + }, + get isOnline() { console.log('*********************** isOnline') return state.stateConnection === 'online' @@ -146,13 +220,14 @@ namespace Getters { get isNewVersionAvailable() { console.log('state.cfgServer', state.cfgServer) - const serversrec = state.cfgServer.find(x => x.chiave === tools.SERVKEY_VERS) + const serversrec = state.cfgServer.find((x) => x.chiave === tools.SERVKEY_VERS) console.log('Record ', serversrec) if (serversrec) { console.log('Vers Server ', serversrec.valore, 'Vers locale:', process.env.APP_VERSION) return serversrec.valore !== process.env.APP_VERSION - } else + } else { return false + } } } } @@ -259,11 +334,11 @@ namespace Actions { const mykey = process.env.PUBLICKEY_PUSH const mystate = state return navigator.serviceWorker.ready - .then(function (swreg) { + .then(function(swreg) { reg = swreg return swreg.pushManager.getSubscription() }) - .then(function (subscription) { + .then(function(subscription) { mystate.wasAlreadySubscribed = !(subscription === null) if (mystate.wasAlreadySubscribed) { @@ -273,17 +348,17 @@ namespace Actions { } else { // Create a new subscription console.log('Create a new subscription') - let convertedVapidPublicKey = urlBase64ToUint8Array(mykey) + const convertedVapidPublicKey = urlBase64ToUint8Array(mykey) return reg.pushManager.subscribe({ userVisibleOnly: true, applicationServerKey: convertedVapidPublicKey }) } }) - .then(function (newSub) { + .then(function(newSub) { saveNewSubscriptionToServer(context, newSub) }) - .catch(function (err) { + .catch(function(err) { console.log('ERR createPushSubscription:', err) }) } @@ -291,8 +366,9 @@ namespace Actions { // Calling the Server to Save in the MongoDB the Subscriber function saveNewSubscriptionToServer(context, newSub) { // If already subscribed, exit - if (!newSub) + if (!newSub) { return + } // console.log('saveSubscriptionToServer: ', newSub) // console.log('context', context) @@ -308,7 +384,7 @@ namespace Actions { } } - let myres = { + const myres = { options, subs: newSub, others: { @@ -318,13 +394,13 @@ namespace Actions { } return Api.SendReq('/subscribe', 'POST', myres) - .then(res => { + .then((res) => { state.wasAlreadySubscribed = true state.wasAlreadySubOnDb = true localStorage.setItem(tools.localStorage.wasAlreadySubOnDb, String(state.wasAlreadySubOnDb)) }) - .catch(e => { + .catch((e) => { console.log('Error during Subscription!', e) }) } @@ -344,13 +420,13 @@ namespace Actions { } function t(params) { - let msg = params.split('.') - let lang = UserStore.state.lang + const msg = params.split('.') + const lang = UserStore.state.lang - let stringa = messages[lang] + const stringa = messages[lang] let ris = stringa - msg.forEach(param => { + msg.forEach((param) => { ris = ris[param] }) @@ -378,14 +454,14 @@ namespace Actions { if ('serviceWorker' in navigator) { // REMOVE ALL SUBSCRIPTION console.log('REMOVE ALL SUBSCRIPTION...') - await navigator.serviceWorker.ready.then(function (reg) { + await navigator.serviceWorker.ready.then(function(reg) { console.log('... Ready') - reg.pushManager.getSubscription().then(function (subscription) { + reg.pushManager.getSubscription().then(function(subscription) { console.log(' Found Subscription...') - subscription.unsubscribe().then(function (successful) { + subscription.unsubscribe().then(function(successful) { // You've successfully unsubscribed console.log('You\'ve successfully unsubscribed') - }).catch(function (e) { + }).catch(function(e) { // Unsubscription failed }) }) @@ -408,7 +484,6 @@ namespace Actions { } - async function loadAfterLogin(context) { console.log('loadAfterLogin') actions.clearDataAfterLoginOnlyIfActiveConnection() @@ -419,8 +494,8 @@ namespace Actions { async function saveCfgServerKey(context, dataval: ICfgServer) { console.log('saveCfgServerKey dataval', dataval) - let ris = await Api.SendReq('/admin/updateval', 'POST', { pairval: dataval }) - .then(res => { + const ris = await Api.SendReq('/admin/updateval', 'POST', { pairval: dataval }) + .then((res) => { }) @@ -434,8 +509,8 @@ namespace Actions { state.networkDataReceived = false - let ris = await Api.SendReq('/checkupdates', 'GET', null) - .then(res => { + const ris = await Api.SendReq('/checkupdates', 'GET', null) + .then((res) => { state.networkDataReceived = true console.log('******* checkUpdates RES :', res.data.cfgServer) @@ -449,7 +524,7 @@ namespace Actions { return res }) - .catch(error => { + .catch((error) => { console.log('error checkUpdates', error) UserStore.mutations.setErrorCatch(error) return error @@ -477,10 +552,9 @@ const GlobalModule = { get state() { return stateGetter() }, + actions: Actions.actions, getters: Getters.getters, - mutations: Mutations.mutations, - actions: Actions.actions + mutations: Mutations.mutations } - export default GlobalModule diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index 5c80be8..9987571 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -1,8 +1,8 @@ -import { ITodo } from '@src/model' -import { costanti } from './costanti' -import globalroutines from './../../globalroutines/index' -import { Todos, UserStore } from '@store' import Api from '@api' +import { ITodo } from '@src/model' +import { Todos, UserStore } from '@store' +import globalroutines from './../../globalroutines/index' +import { costanti } from './costanti' export const tools = { EMPTY: 0, @@ -53,12 +53,11 @@ export const tools = { COMPLETED: 110, PROGRESS_BAR: 120, PRIORITY: 130, - SHOW_TASK: 150, + SHOW_TASK: 150 }, - selectPriority: { - 'it': [ + it: [ { id: 1, label: 'Alta', @@ -77,7 +76,7 @@ export const tools = { value: 0, icon: 'expand_more' }], - 'es': [ + es: [ { id: 1, label: 'Alta', @@ -96,7 +95,7 @@ export const tools = { value: 0, icon: 'expand_more' }], - 'enUs': [ + enUs: [ { id: 1, label: 'High', @@ -115,7 +114,7 @@ export const tools = { value: 0, icon: 'expand_more' }], - 'de': [ + de: [ { id: 1, label: 'High', @@ -135,13 +134,12 @@ export const tools = { icon: 'expand_more' }] - }, INDEX_MENU_DELETE: 4, menuPopupTodo: { - 'it': [ + it: [ { id: 10, label: '', @@ -178,7 +176,7 @@ export const tools = { checked: false } ], - 'es': [ + es: [ { id: 10, label: '', @@ -215,7 +213,7 @@ export const tools = { checked: false } ], - 'enUs': [ + enUs: [ { id: 10, label: '', @@ -255,34 +253,34 @@ export const tools = { }, menuPopupConfigTodo: { - 'it': [ + it: [ { id: 10, label: 'Mostra Task', value: 150, // SHOW_TASK - icon: 'rowing', - }, + icon: 'rowing' + } ], - 'es': [ + es: [ { id: 10, label: 'Mostrar Tareas', value: 150, - icon: 'rowing', - }, + icon: 'rowing' + } ], - 'enUs': [ + enUs: [ { id: 10, label: 'Show Task', value: 150, - icon: 'rowing', - }, + icon: 'rowing' + } ] }, listOptionShowTask: { - 'it': [ + it: [ { id: 10, label: 'Mostra gli ultimi N completati', @@ -305,7 +303,7 @@ export const tools = { checked: true } ], - 'es': [ + es: [ { id: 10, label: 'Mostrar los ultimos N completados', @@ -328,7 +326,7 @@ export const tools = { checked: true } ], - 'enUs': [ + enUs: [ { id: 10, label: 'Show last N Completed', @@ -359,15 +357,17 @@ export const tools = { getItemLS(item) { let ris = localStorage.getItem(item) - if ((ris == null) || (ris === '') || (ris === 'null')) + if ((ris == null) || (ris === '') || (ris === 'null')) { ris = '' + } return ris }, notifyarraychanged(array) { - if (array.length > 0) + if (array.length > 0) { array.splice(array.length - 1, 1, array[array.length - 1]) + } }, existArr(x) { @@ -375,9 +375,9 @@ export const tools = { }, json2array(json) { - let result = [] - let keys = Object.keys(json) - keys.forEach(function (key) { + const result = [] + const keys = Object.keys(json) + keys.forEach(function(key) { result.push(json[key]) }) return result @@ -395,21 +395,21 @@ export const tools = { if ('serviceWorker' in navigator) { return await navigator.serviceWorker.ready - .then(function (sw) { + .then(function(sw) { // console.log('---------------------- navigator.serviceWorker.ready') return globalroutines(null, 'write', table, item, id) - .then(function (id) { + .then(function(id) { // console.log('id', id) const sep = '|' - let multiparams = cmdSw + sep + table + sep + method + sep + UserStore.state.x_auth_token + sep + UserStore.state.lang - let mymsgkey = { + const multiparams = cmdSw + sep + table + sep + method + sep + UserStore.state.x_auth_token + sep + UserStore.state.lang + const mymsgkey = { _id: multiparams, value: multiparams } return globalroutines(null, 'write', 'swmsg', mymsgkey, multiparams) - .then(ris => { + .then((ris) => { // if ('SyncManager' in window) { // console.log(' SENDING... sw.sync.register', multiparams) // return sw.sync.register(multiparams) @@ -418,14 +418,14 @@ export const tools = { return Api.syncAlternative(multiparams) // } }) - .then(function () { + .then(function() { let data = null if (msg !== '') { data = { message: msg, position: 'bottom', timeout: 3000 } } return data }) - .catch(function (err) { + .catch(function(err) { console.error('Errore in globalroutines', table, err) }) }) @@ -434,6 +434,4 @@ export const tools = { } - - }