Components Gallery, Book, Card, CImgText .... continue...
This commit is contained in:
@@ -432,7 +432,7 @@ namespace Actions {
|
||||
}
|
||||
|
||||
async function loadAfterLogin(context) {
|
||||
console.log('loadAfterLogin')
|
||||
// console.log('loadAfterLogin')
|
||||
actions.clearDataAfterLoginOnlyIfActiveConnection()
|
||||
|
||||
state.arrConfig = await globalroutines(null, 'readall', 'config', null)
|
||||
|
||||
@@ -14,6 +14,7 @@ import { costanti } from '@src/store/Modules/costanti'
|
||||
import { RouteNames } from '@src/router/route-names'
|
||||
import * as Types from '@src/store/Api/ApiTypes'
|
||||
import { serv_constants } from '@src/store/Modules/serv_constants'
|
||||
import { static_data } from '@src/db/static_data'
|
||||
|
||||
const nametable = 'projects'
|
||||
|
||||
@@ -273,6 +274,9 @@ namespace Actions {
|
||||
|
||||
async function dbLoad(context, { checkPending, onlyiffirsttime }) {
|
||||
|
||||
if (!static_data.ENABLE_PROJECTS_LOADING)
|
||||
return null
|
||||
|
||||
if (onlyiffirsttime) {
|
||||
if (stateglob.projects.length > 0) {
|
||||
// if already set, then exit.
|
||||
|
||||
89
src/store/Modules/Store/calendar/CalendarStore.ts
Normal file
89
src/store/Modules/Store/calendar/CalendarStore.ts
Normal file
@@ -0,0 +1,89 @@
|
||||
import Api from '@api'
|
||||
import { ICalendarState } from 'model'
|
||||
import { ILinkReg, IResult, IIdToken, IToken } from 'model/other'
|
||||
import { storeBuilder } from '../Store'
|
||||
|
||||
import { serv_constants } from '../../serv_constants'
|
||||
import { tools } from '../../tools'
|
||||
|
||||
import translate from '../../../../globalroutines/util'
|
||||
import * as Types from '../../../Api/ApiTypes'
|
||||
|
||||
// State
|
||||
const state: ICalendarState = {
|
||||
titlebarHeight: 0,
|
||||
locale: 'it-IT',
|
||||
maxDays: 1,
|
||||
fiveDayWorkWeek: false,
|
||||
shortMonthLabel: false,
|
||||
showDayOfYearLabel: false,
|
||||
shortWeekdayLabel: false,
|
||||
shortIntervalLabel: false,
|
||||
hour24Format: true,
|
||||
hideHeader: false,
|
||||
noScroll: false,
|
||||
showMonthLabel: true,
|
||||
showWorkWeeks: false,
|
||||
intervalRange: {min: 9, max: 23},
|
||||
intervalRangeStep: 1,
|
||||
intervalHeight: 35,
|
||||
resourceHeight: 60,
|
||||
resourceWidth: 100,
|
||||
dayHeight: 100,
|
||||
enableThemes: false,
|
||||
theme: {}
|
||||
}
|
||||
|
||||
const b = storeBuilder.module<ICalendarState>('CalendarModule', state)
|
||||
const stateGetter = b.state()
|
||||
|
||||
namespace Getters {
|
||||
|
||||
// const lang = b.read((state) => {
|
||||
// if (state.lang !== '') {
|
||||
// return state.lang
|
||||
// } else {
|
||||
// return process.env.LANG_DEFAULT
|
||||
// }
|
||||
// }, 'lang')
|
||||
//
|
||||
// export const getters = {
|
||||
// get lang() {
|
||||
// return lang()
|
||||
// },
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
namespace Mutations {
|
||||
// function authUser(state: ICalendarState, data: ICalendarState) {
|
||||
// state.userId = data.userId
|
||||
// }
|
||||
//
|
||||
// export const mutations = {
|
||||
// authUser: b.commit(authUser),
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
namespace Actions {
|
||||
|
||||
// async function resetpwd(context, paramquery: ICalendarState) {
|
||||
// }
|
||||
//
|
||||
// export const actions = {
|
||||
// autologin_FromLocalStorage: b.dispatch(autologin_FromLocalStorage)
|
||||
// }
|
||||
}
|
||||
|
||||
// Module
|
||||
const CalendarModule = {
|
||||
get state() {
|
||||
return stateGetter()
|
||||
}
|
||||
// actions: Actions.actions,
|
||||
// getters: Getters.getters,
|
||||
// mutations: Mutations.mutations
|
||||
}
|
||||
|
||||
export default CalendarModule
|
||||
@@ -15,6 +15,7 @@ import objectId from '@src/js/objectId'
|
||||
import { costanti } from '@src/store/Modules/costanti'
|
||||
import { IAction } from '@src/model'
|
||||
import * as Types from '@src/store/Api/ApiTypes'
|
||||
import { static_data } from '@src/db/static_data'
|
||||
|
||||
const nametable = 'todos'
|
||||
|
||||
@@ -217,7 +218,7 @@ namespace Mutations {
|
||||
ApiTables.removeitemfromarray(stateparam.todos[indcat], ind)
|
||||
}
|
||||
|
||||
async function movemyitem(stateparam: ITodosState, { myitemorig, myitemdest } ) {
|
||||
async function movemyitem(stateparam: ITodosState, { myitemorig, myitemdest }) {
|
||||
|
||||
const indcat = stateparam.categories.indexOf(myitemorig.category)
|
||||
const indorig = tools.getIndexById(stateparam.todos[indcat], myitemorig._id)
|
||||
@@ -251,13 +252,19 @@ namespace Mutations {
|
||||
namespace Actions {
|
||||
|
||||
async function dbLoad(context, { checkPending }) {
|
||||
|
||||
if (!static_data.ENABLE_PROJECTS_LOADING)
|
||||
return null
|
||||
|
||||
console.log('dbLoad', nametable, checkPending, 'userid=', UserStore.state.userId)
|
||||
|
||||
// if (UserStore.state.userId === '') {
|
||||
// return new Types.AxiosError(0, null, 0, '')
|
||||
// }
|
||||
|
||||
const ris = await Api.SendReq('/todos/' + UserStore.state.userId, 'GET', null)
|
||||
let ris = null
|
||||
|
||||
ris = await Api.SendReq('/todos/' + UserStore.state.userId, 'GET', null)
|
||||
.then((res) => {
|
||||
if (res.data.todos) { // console.log('RISULTANTE CATEGORIES DAL SERVER = ', res.data.categories)
|
||||
state.todos = res.data.todos
|
||||
|
||||
@@ -512,9 +512,10 @@ namespace Actions {
|
||||
}
|
||||
|
||||
async function setGlobal(isLogged: boolean) {
|
||||
state.isLogged = true
|
||||
console.log('state.isLogged')
|
||||
// state.isLogged = true
|
||||
state.isLogged = isLogged
|
||||
if (isLogged) {
|
||||
console.log('state.isLogged')
|
||||
GlobalStore.mutations.setleftDrawerOpen(localStorage.getItem(tools.localStorage.leftDrawerOpen) === 'true')
|
||||
GlobalStore.mutations.setCategorySel(localStorage.getItem(tools.localStorage.categorySel))
|
||||
|
||||
@@ -531,7 +532,7 @@ namespace Actions {
|
||||
|
||||
async function autologin_FromLocalStorage(context) {
|
||||
try {
|
||||
console.log('*** autologin_FromLocalStorage ***')
|
||||
// console.log('*** autologin_FromLocalStorage ***')
|
||||
// INIT
|
||||
|
||||
let isLogged = false
|
||||
@@ -566,7 +567,7 @@ namespace Actions {
|
||||
|
||||
await setGlobal(isLogged)
|
||||
|
||||
console.log('autologin userId STATE ', state.userId)
|
||||
// console.log('autologin userId STATE ', state.userId)
|
||||
|
||||
return true
|
||||
} catch (e) {
|
||||
|
||||
@@ -1310,7 +1310,7 @@ export const tools = {
|
||||
,
|
||||
|
||||
checkLangPassed(mylang) {
|
||||
console.log('checkLangPassed')
|
||||
// console.log('checkLangPassed')
|
||||
|
||||
const mybrowserLang = Quasar.lang.isoName
|
||||
|
||||
@@ -1345,7 +1345,7 @@ export const tools = {
|
||||
UserStore.mutations.setlang(mylang)
|
||||
}
|
||||
|
||||
console.log('mylang calc : ', mylang)
|
||||
// console.log('mylang calc : ', mylang)
|
||||
|
||||
return mylang
|
||||
},
|
||||
@@ -1525,6 +1525,14 @@ export const tools = {
|
||||
return ''
|
||||
}
|
||||
,
|
||||
getstrMMMDate(mytimestamp) {
|
||||
// console.log('getstrDate', mytimestamp)
|
||||
if (!!mytimestamp)
|
||||
return date.formatDate(mytimestamp, 'DD MMM YYYY')
|
||||
else
|
||||
return ''
|
||||
}
|
||||
,
|
||||
getstrYYMMDDDate(mytimestamp) {
|
||||
return date.formatDate(mytimestamp, 'YYYY-MM-DD')
|
||||
}
|
||||
|
||||
41
src/store/Modules/toolsext.ts
Normal file
41
src/store/Modules/toolsext.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { UserStore } from '@store'
|
||||
|
||||
export const toolsext = {
|
||||
getLocale(vero?: boolean) {
|
||||
if (UserStore) {
|
||||
if (UserStore.state) {
|
||||
return UserStore.state.lang
|
||||
}
|
||||
}
|
||||
return process.env.LANG_DEFAULT
|
||||
}
|
||||
}
|
||||
|
||||
export const func_tools = {
|
||||
getLocale(vero?: boolean) {
|
||||
if (UserStore) {
|
||||
if (UserStore.state) {
|
||||
return UserStore.state.lang
|
||||
}
|
||||
}
|
||||
return ''
|
||||
},
|
||||
|
||||
getDateStr(mydate) {
|
||||
if (costanti_tools.DateFormatter) {
|
||||
const date = new Date(mydate)
|
||||
return costanti_tools.DateFormatter.format(date)
|
||||
}
|
||||
return mydate
|
||||
}
|
||||
}
|
||||
|
||||
export const costanti_tools = {
|
||||
DateFormatter: new Intl.DateTimeFormat(func_tools.getLocale() || void 0, {
|
||||
weekday: 'long',
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric'
|
||||
// timeZone: 'UTC'
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user