- other committ

This commit is contained in:
Paolo Arena
2019-10-10 16:53:33 +02:00
parent 3ed8c7116b
commit 9ab7ba5581
42 changed files with 1266 additions and 522 deletions

View File

@@ -1,10 +1,10 @@
import { Todos, Projects, UserStore } from '@store'
import { Todos, Projects, UserStore, CalendarStore } from '@store'
import globalroutines from './../../globalroutines/index'
import { costanti } from './costanti'
import { toolsext } from './toolsext'
import { translation } from './translation'
import Quasar, { date, Screen } from 'quasar'
import { ICollaborations, IListRoutes, IMenuList, IProject, ITodo, Privacy } from '@src/model'
import { ICollaborations, IListRoutes, IMenuList, IParamDialog, IProject, ITodo, Privacy } from '@src/model'
import * as ApiTables from '@src/store/Modules/ApiTables'
import translate from '@src/globalroutines/util'
import { RouteNames } from '@src/router/route-names'
@@ -12,6 +12,7 @@ import { RouteNames } from '@src/router/route-names'
import { lists } from './lists'
import { static_data } from '@src/db/static_data'
import { IColl, ITimeLineEntry, ITimeLineMain } from '@src/model/GlobalStore'
import { func_tools } from '@src/store/Modules/toolsext'
export interface INotify {
color?: string | 'primary'
@@ -55,6 +56,8 @@ export const tools = {
userId: 'uid',
token: 'tk',
username: 'uname',
name: 'nm',
surname: 'sn',
lang: 'lg'
},
@@ -70,6 +73,35 @@ export const tools = {
COMPLETED: 10
},
SelectListNumPeople: [
{
id: 1,
label: '1',
value: 1
},
{
id: 2,
label: '2',
value: 2
},
{
id: 3,
label: '3',
value: 3
},
{
id: 4,
label: '4',
value: 4
},
{
id: 5,
label: '5',
value: 5
}
]
,
selectPhase: {
it: [
{
@@ -1267,8 +1299,48 @@ export const tools = {
result.push(json[key])
})
return result
}
,
},
executefunc(myself: any, myfunc: number, par: IParamDialog) {
if (myfunc === costanti.FuncDialog.CANCEL_BOOKING) {
console.log(' ENTRATO ! CancelBookingEvent ')
CalendarStore.actions.CancelBookingEvent(par.param1).then((ris) => {
if (ris)
tools.showPositiveNotif(myself.$q, myself.$t('cal.canceledbooking') + ' "' + par.param1.title + '"')
else
tools.showNegativeNotif(myself.$q, myself.$t('cal.cancelederrorbooking'))
})
}
},
async askConfirm($q: any, mytitle, mytext, ok, cancel, myself: any, funcok: number, funccancel: number, par: IParamDialog) {
return $q.dialog({
message: mytext,
ok: {
label: ok,
push: true
},
title: mytitle,
cancel: true,
persistent: false
}).onOk(() => {
console.log('OK')
tools.executefunc(myself, funcok, par)
return true
}).onCancel(() => {
console.log('CANCEL')
tools.executefunc(myself, funccancel, par)
return false
})
},
showPositiveNotif(q: any, msg) {
tools.showNotif(q, msg, { color: 'positive', icon: 'notifications' })
},
showNegativeNotif(q: any, msg) {
tools.showNotif(q, msg, { color: 'negative', icon: 'notifications' })
},
showNotif(q: any, msg, data ?: INotify | null
) {
@@ -1297,7 +1369,7 @@ export const tools = {
checkIfUserExist(mythis) {
if (UserStore.state.userId === undefined) {
if (UserStore.getters.isUserInvalid) {
tools.showNotif(mythis.$q, mythis.$t('todo.usernotdefined'))
return false
}
@@ -1313,7 +1385,7 @@ export const tools = {
,
checkLangPassed(mylang) {
// console.log('checkLangPassed')
console.log('checkLangPassed')
const mybrowserLang = Quasar.lang.isoName
@@ -1335,7 +1407,7 @@ export const tools = {
console.log('non incluso ', mylang)
mylang = static_data.arrLangUsed[0]
// Metti Inglese come default
// Metti come default
UserStore.mutations.setlang(mylang)
}
}
@@ -1728,7 +1800,6 @@ export const tools = {
},
heightgallery() {
if (Screen.width < 400) {
return '200px'
@@ -1747,7 +1818,7 @@ export const tools = {
if (myheight > 1000) {
maxheight = 1000
} else {
maxheight = parseInt(myheight, 10)
maxheight = parseInt(myheight, 10)
}
}
} else {
@@ -1988,15 +2059,55 @@ export const tools = {
getimgFullpathbysize(fileimg: string) {
const ind = fileimg.lastIndexOf('/')
if (ind > 0) {
return { path: fileimg.substring(0, ind + 1) , file: fileimg.substring(ind + 1) }
return { path: fileimg.substring(0, ind + 1), file: fileimg.substring(ind + 1) }
} else {
return { path: '', file: fileimg }
}
},
convertHTMLtoText(myhtml) {
let msg = myhtml
msg = msg.replace('&quot;', '"')
msg = msg.replace('&gt;', '>')
msg = msg.replace('&lt;', '<')
msg = msg.replace('&amp;', '&')
msg = msg.replace('<br>', '\n')
return msg
},
gettextevent(myevent) {
return '"' + myevent.title + '" (' + this.getDateStr(myevent.date) + ') - ' + myevent.time
},
setLangAtt(mylang) {
console.log('setLangAtt =', mylang)
// console.log('PRIMA this.$q.lang.isoName', this.$q.lang.isoName)
// dynamic import, so loading on demand only
import(`quasar/lang/${mylang}`).then((lang) => {
console.log(' Import dinamically lang =', lang)
Quasar.lang.set(lang.default)
import(`../../statics/i18n`).then(() => {
console.log(' *** MY LANG DOPO=', Quasar.lang.isoName)
})
})
// this.$q.lang.set(mylang)
},
getappname(mythis) {
if (mythis === undefined)
return ''
if (mythis.$t === undefined)
return ''
if (Screen.width < 400) {
return mythis.$t('msg.myAppNameShort')
} else {
return mythis.$t('msg.myAppName')
}
}
// getLocale() {
// if (navigator.languages && navigator.languages.length > 0) {
// return navigator.languages[0]