Added begin_development and begin_test
Added status (changed completed field) fixed internet status connection.
This commit is contained in:
@@ -88,7 +88,7 @@ async function dbDeleteItem(call, item) {
|
||||
})
|
||||
.catch((error) => {
|
||||
UserStore.mutations.setErrorCatch(error)
|
||||
return UserStore.getters.getServerCode()
|
||||
return UserStore.getters.getServerCode
|
||||
})
|
||||
|
||||
return res
|
||||
@@ -188,11 +188,11 @@ export async function aftercalling(ris, checkPending: boolean, nametabindex: str
|
||||
if (ris.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
|
||||
tools.consolelogpao('UNAUTHORIZING... TOKEN EXPIRED... !! ')
|
||||
} else {
|
||||
tools.consolelogpao('NETWORK UNREACHABLE ! (Error in fetch)', UserStore.getters.getServerCode(), ris.status)
|
||||
tools.consolelogpao('NETWORK UNREACHABLE ! (Error in fetch)', UserStore.getters.getServerCode, ris.status)
|
||||
}
|
||||
if ('serviceWorker' in navigator) {
|
||||
// Read all data from IndexedDB Store into Memory
|
||||
await updatefromIndexedDbToStateTodo(nametabindex)
|
||||
await updatefromIndexedDbToState(nametabindex)
|
||||
}
|
||||
} else {
|
||||
if (ris.status === tools.OK && checkPending) {
|
||||
@@ -210,7 +210,7 @@ async function checkPendingMsg() {
|
||||
try {
|
||||
if (config) {
|
||||
if (!!config[1].stateconn) {
|
||||
// console.log('config.stateconn', config[1].stateconn)
|
||||
console.log('config.stateconn', config[1].stateconn)
|
||||
|
||||
if (config[1].stateconn !== GlobalStore.state.stateConnection) {
|
||||
GlobalStore.mutations.setStateConnection(config[1].stateconn)
|
||||
@@ -288,7 +288,7 @@ async function sendSwMsgIfAvailable() {
|
||||
}
|
||||
|
||||
async function waitAndRefreshData() {
|
||||
// #Todo++ Check if is OK
|
||||
// #Todo++ waitAndRefreshData: Check if is OK
|
||||
await Projects.actions.dbLoad({ checkPending: false, onlyiffirsttime: false })
|
||||
return await Todos.actions.dbLoad({ checkPending: false })
|
||||
}
|
||||
@@ -300,6 +300,10 @@ export async function waitAndcheckPendingMsg() {
|
||||
return await checkPendingMsg()
|
||||
.then((ris) => {
|
||||
if (ris) {
|
||||
if (!GlobalStore.getters.isOnline) { // If is Offline, then check
|
||||
|
||||
}
|
||||
|
||||
// console.log('risPending = ', ris)
|
||||
return sendSwMsgIfAvailable()
|
||||
.then((something) => {
|
||||
@@ -315,10 +319,10 @@ export async function waitAndcheckPendingMsg() {
|
||||
})
|
||||
}
|
||||
|
||||
async function updatefromIndexedDbToStateTodo(nametab) {
|
||||
await globalroutines(null, 'updatefromIndexedDbToStateTodo', nametab, null)
|
||||
async function updatefromIndexedDbToState(nametab) {
|
||||
await globalroutines(null, 'updatefromIndexedDbToState', nametab, null)
|
||||
.then(() => {
|
||||
console.log('updatefromIndexedDbToStateTodo! ')
|
||||
console.log('updatefromIndexedDbToState! ')
|
||||
return true
|
||||
})
|
||||
}
|
||||
@@ -377,14 +381,14 @@ export async function table_ModifyRecord(nametable, myitem, fieldtochange) {
|
||||
|
||||
const myobjsaved = tools.jsonCopy(myitem)
|
||||
|
||||
/*
|
||||
const mymodule = tools.getModulesByTable(nametable)
|
||||
let param2 = ''
|
||||
if (nametable === 'todos') {
|
||||
param2 = myitem.category
|
||||
}
|
||||
const miorec = mymodule.getters.getRecordById(myobjsaved._id, param2)
|
||||
*/
|
||||
/*
|
||||
const mymodule = tools.getModulesByTable(nametable)
|
||||
let param2 = ''
|
||||
if (nametable === 'todos') {
|
||||
param2 = myitem.category
|
||||
}
|
||||
const miorec = mymodule.getters.getRecordById(myobjsaved._id, param2)
|
||||
*/
|
||||
|
||||
// get record from IndexedDb
|
||||
const miorec = await globalroutines(null, 'read', nametable, null, myobjsaved._id)
|
||||
@@ -396,7 +400,7 @@ export async function table_ModifyRecord(nametable, myitem, fieldtochange) {
|
||||
console.log('miorec', miorec.descr, miorec.id_prev)
|
||||
|
||||
if (nametable === 'todos') {
|
||||
if (setmodifiedIfchanged(miorec, myobjsaved, 'completed')) {
|
||||
if (setmodifiedIfchanged(miorec, myobjsaved, 'status')) {
|
||||
miorec.completed_at = new Date().getDate()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ const state: IGlobalState = {
|
||||
posts: [],
|
||||
menulinks: {},
|
||||
listatodo: [
|
||||
{ name: 'personal', description: 'personal' },
|
||||
{ name: 'work', description: 'work' },
|
||||
{ name: 'shopping', description: 'shopping' }
|
||||
{ nametranslate: 'personal', description: 'personal' },
|
||||
{ nametranslate: 'work', description: 'work' },
|
||||
{ nametranslate: 'shopping', description: 'shopping' }
|
||||
],
|
||||
connData: {
|
||||
uploading_server: 0,
|
||||
@@ -120,7 +120,7 @@ namespace Getters {
|
||||
faIcon: 'fa fa-list-alt',
|
||||
materialIcon: 'todo',
|
||||
name: 'pages.' + elem.description,
|
||||
route: '/todo/' + elem.name
|
||||
route: '/todo/' + elem.nametranslate
|
||||
}
|
||||
listatodo.push(item)
|
||||
|
||||
@@ -132,7 +132,8 @@ namespace Getters {
|
||||
for (const elem of arrlistaproj) {
|
||||
const item = {
|
||||
materialIcon: 'next_week',
|
||||
name: elem.description,
|
||||
name: elem.nametranslate,
|
||||
text: elem.description,
|
||||
route: '/projects/' + elem.idelem
|
||||
}
|
||||
listaprojects.push(item)
|
||||
@@ -145,14 +146,14 @@ namespace Getters {
|
||||
if (!process.env.PROD) {
|
||||
addRoute(arrroutes, { route: '/todo', faIcon: 'fa fa-list-alt', materialIcon: 'format_list_numbered', name: 'pages.Todo',
|
||||
routes2: listatodo,
|
||||
level_parent: '0.5',
|
||||
level_child: '0.5'
|
||||
level_parent: 0.5,
|
||||
level_child: 0.5
|
||||
})
|
||||
|
||||
addRoute(arrroutes,{ route: '/projects/' + tools.FIRST_PROJ, faIcon: 'fa fa-list-alt', materialIcon: 'next_week', name: 'pages.Projects',
|
||||
routes2: listaprojects,
|
||||
level_parent: '0',
|
||||
level_child: '0.5'
|
||||
level_parent: 0,
|
||||
level_child: 0.5
|
||||
})
|
||||
}
|
||||
|
||||
@@ -210,7 +211,7 @@ namespace Getters {
|
||||
},
|
||||
|
||||
get isOnline() {
|
||||
console.log('*********************** isOnline')
|
||||
// console.log('*********************** isOnline')
|
||||
return state.stateConnection === 'online'
|
||||
},
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ const state: IProjectsState = {
|
||||
visuLastCompleted: 10
|
||||
}
|
||||
|
||||
const fieldtochange: string [] = ['descr', 'longdescr', 'hoursplanned', 'hoursworked', 'id_parent', 'completed', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress']
|
||||
const fieldtochange: string [] = ['descr', 'longdescr', 'hoursplanned', 'hoursworked', 'id_parent', 'status', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress', 'live_url', 'test_url', 'begin_development', 'begin_test']
|
||||
|
||||
const b = storeBuilder.module<IProjectsState>('Projects', state)
|
||||
const stateGetter = b.state()
|
||||
@@ -55,19 +55,27 @@ namespace Getters {
|
||||
const obj: IProject = {
|
||||
_id: objectId(),
|
||||
descr: '',
|
||||
longdescr: '',
|
||||
id_parent: '',
|
||||
priority: tools.Priority.PRIORITY_NORMAL,
|
||||
completed: false,
|
||||
status: tools.Status.OPENED,
|
||||
created_at: new Date(),
|
||||
modify_at: new Date(),
|
||||
completed_at: new Date(),
|
||||
begin_development: new Date(0),
|
||||
begin_test: new Date(0),
|
||||
category: '',
|
||||
// expiring_at: tomorrow,
|
||||
enableExpiring: false,
|
||||
id_prev: '',
|
||||
pos: 0,
|
||||
modified: false,
|
||||
hoursworked: 0,
|
||||
hoursplanned: 0,
|
||||
live_url: '',
|
||||
test_url: '',
|
||||
progressCalc: 0
|
||||
|
||||
}
|
||||
|
||||
return obj
|
||||
@@ -75,6 +83,7 @@ namespace Getters {
|
||||
|
||||
const items_dacompletare = b.read((state: IProjectsState) => (id_parent: string): IProject[] => {
|
||||
if (state.projects) {
|
||||
// console.log('state.projects', state.projects)
|
||||
return tools.mapSort(state.projects.filter((proj) => proj.id_parent === id_parent))
|
||||
} else {
|
||||
return []
|
||||
@@ -83,10 +92,11 @@ namespace Getters {
|
||||
|
||||
const listaprojects = b.read((state: IProjectsState) => (): IMenuList[] => {
|
||||
if (state.projects) {
|
||||
// console.log('state.projects', state.projects)
|
||||
const listaproj = tools.mapSort(state.projects.filter((proj) => proj.id_parent === tools.FIRST_PROJ))
|
||||
const myarr: IMenuList[] = []
|
||||
for (const proj of listaproj) {
|
||||
myarr.push({name: proj.descr, description: proj.descr, idelem: proj._id})
|
||||
myarr.push({nametranslate: '', description: proj.descr, idelem: proj._id})
|
||||
}
|
||||
return myarr
|
||||
|
||||
@@ -150,7 +160,7 @@ namespace Getters {
|
||||
namespace Mutations {
|
||||
|
||||
function createNewItem(state: IProjectsState, { objproj, atfirst, categorySel }) {
|
||||
console.log('createNewItem', objproj, 'cat=', categorySel, 'state.projects', state.projects)
|
||||
// console.log('createNewItem', objproj, 'cat=', categorySel, 'state.projects', state.projects)
|
||||
if (state.projects === undefined) {
|
||||
state.projects = []
|
||||
state.projects.push(objproj)
|
||||
@@ -164,7 +174,7 @@ namespace Mutations {
|
||||
state.projects.push(objproj)
|
||||
}
|
||||
|
||||
console.log('state.projects', state.projects)
|
||||
// console.log('state.projects', state.projects)
|
||||
|
||||
}
|
||||
|
||||
@@ -212,7 +222,6 @@ namespace Actions {
|
||||
default: costanti.ShowTypeTask.SHOW_LAST_N_COMPLETED
|
||||
}), 10)
|
||||
|
||||
// console.log('ARRAY TODOS = ', state.projects)
|
||||
if (process.env.DEBUG === '1') {
|
||||
console.log('dbLoad', 'state.projects', state.projects)
|
||||
}
|
||||
@@ -225,7 +234,7 @@ namespace Actions {
|
||||
return error
|
||||
})
|
||||
|
||||
ApiTables.aftercalling(ris, checkPending, 'categories')
|
||||
ApiTables.aftercalling(ris, checkPending, nametable)
|
||||
}
|
||||
|
||||
async function deleteItem(context, { idobj }) {
|
||||
@@ -292,7 +301,9 @@ namespace Actions {
|
||||
}
|
||||
|
||||
// 3) send to the Server
|
||||
return await ApiTables.Sync_SaveItem(nametable, 'POST', objproj)
|
||||
await ApiTables.Sync_SaveItem(nametable, 'POST', objproj)
|
||||
|
||||
return id
|
||||
}
|
||||
|
||||
async function modify(context, { myitem, field }) {
|
||||
|
||||
@@ -27,7 +27,7 @@ const state: ITodosState = {
|
||||
visuLastCompleted: 10
|
||||
}
|
||||
|
||||
const fieldtochange: string [] = ['descr', 'completed', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress']
|
||||
const fieldtochange: string [] = ['descr', 'status', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress']
|
||||
|
||||
const b = storeBuilder.module<ITodosState>('Todos', state)
|
||||
const stateGetter = b.state()
|
||||
@@ -55,7 +55,7 @@ function initcat() {
|
||||
userId: UserStore.state.userId,
|
||||
descr: '',
|
||||
priority: tools.Priority.PRIORITY_NORMAL,
|
||||
completed: false,
|
||||
status: tools.Status.OPENED,
|
||||
created_at: new Date(),
|
||||
modify_at: new Date(),
|
||||
completed_at: new Date(),
|
||||
@@ -76,7 +76,7 @@ namespace Getters {
|
||||
const items_dacompletare = b.read((state: ITodosState) => (cat: string): ITodo[] => {
|
||||
const indcat = getindexbycategory(cat)
|
||||
if (state.todos[indcat]) {
|
||||
return state.todos[indcat].filter((todo) => !todo.completed)
|
||||
return state.todos[indcat].filter((todo) => todo.status !== tools.Status.COMPLETED)
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
@@ -86,10 +86,10 @@ namespace Getters {
|
||||
const indcat = getindexbycategory(cat)
|
||||
if (state.todos[indcat]) {
|
||||
if (state.showtype === costanti.ShowTypeTask.SHOW_LAST_N_COMPLETED) {
|
||||
return state.todos[indcat].filter((todo) => todo.completed).slice(0, state.visuLastCompleted)
|
||||
return state.todos[indcat].filter((todo) => todo.status === tools.Status.COMPLETED).slice(0, state.visuLastCompleted)
|
||||
} // Show only the first N completed
|
||||
else if (state.showtype === costanti.ShowTypeTask.SHOW_ALL) {
|
||||
return state.todos[indcat].filter((todo) => todo.completed)
|
||||
return state.todos[indcat].filter((todo) => todo.completed === tools.Status.COMPLETED)
|
||||
}
|
||||
else {
|
||||
return []
|
||||
@@ -226,8 +226,8 @@ namespace Actions {
|
||||
ApiTables.aftercalling(ris, checkPending, 'categories')
|
||||
}
|
||||
|
||||
async function deleteItem(context, { cat, idobj }) {
|
||||
console.log('deleteItem: KEY = ', idobj)
|
||||
async function deleteItemtodo(context, { cat, idobj }) {
|
||||
console.log('deleteItemtodo: KEY = ', idobj)
|
||||
|
||||
const myarr = gettodosByCategory(cat)
|
||||
|
||||
@@ -354,7 +354,7 @@ namespace Actions {
|
||||
export const actions = {
|
||||
dbLoad: b.dispatch(dbLoad),
|
||||
swapElems: b.dispatch(swapElems),
|
||||
deleteItem: b.dispatch(deleteItem),
|
||||
deleteItemtodo: b.dispatch(deleteItemtodo),
|
||||
dbInsert: b.dispatch(dbInsert),
|
||||
modify: b.dispatch(modify)
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace Actions {
|
||||
})
|
||||
.catch((error: Types.AxiosError) => {
|
||||
UserStore.mutations.setErrorCatch(error)
|
||||
return { code: UserStore.getters.getServerCode(), msg: error.getMsgError() }
|
||||
return { code: UserStore.getters.getServerCode, msg: error.getMsgError() }
|
||||
})
|
||||
|
||||
}
|
||||
@@ -254,7 +254,7 @@ namespace Actions {
|
||||
return { code: res.data.code, msg: res.data.msg }
|
||||
}).catch((error) => {
|
||||
UserStore.mutations.setErrorCatch(error)
|
||||
return UserStore.getters.getServerCode()
|
||||
return UserStore.getters.getServerCode
|
||||
})
|
||||
|
||||
}
|
||||
@@ -280,7 +280,7 @@ namespace Actions {
|
||||
return { code: res.data.code, msg: res.data.msg }
|
||||
}).catch((error) => {
|
||||
UserStore.mutations.setErrorCatch(error)
|
||||
return UserStore.getters.getServerCode()
|
||||
return UserStore.getters.getServerCode
|
||||
})
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ namespace Actions {
|
||||
})
|
||||
.catch((error) => {
|
||||
UserStore.mutations.setErrorCatch(error)
|
||||
return UserStore.getters.getServerCode()
|
||||
return UserStore.getters.getServerCode
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -456,7 +456,7 @@ namespace Actions {
|
||||
})
|
||||
.catch((error) => {
|
||||
UserStore.mutations.setErrorCatch(error)
|
||||
return UserStore.getters.getServerCode()
|
||||
return UserStore.getters.getServerCode
|
||||
})
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@ namespace Actions {
|
||||
Mutations.mutations.clearAuthData()
|
||||
}).catch((error) => {
|
||||
UserStore.mutations.setErrorCatch(error)
|
||||
return UserStore.getters.getServerCode()
|
||||
return UserStore.getters.getServerCode
|
||||
})
|
||||
|
||||
return riscall
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Todos, Projects, UserStore } from '@store'
|
||||
import globalroutines from './../../globalroutines/index'
|
||||
import { costanti } from './costanti'
|
||||
import Quasar from 'quasar'
|
||||
import Quasar, { date } from 'quasar'
|
||||
import { IProject, ITodo } from '@src/model'
|
||||
import * as ApiTables from '@src/store/Modules/ApiTables'
|
||||
|
||||
@@ -21,6 +21,8 @@ export const tools = {
|
||||
DUPLICATE_EMAIL_ID: 11000,
|
||||
DUPLICATE_USERNAME_ID: 11100,
|
||||
|
||||
NUMSEC_CHECKUPDATE: 20000,
|
||||
|
||||
FIRST_PROJ: '__PROJECTS',
|
||||
|
||||
arrLangUsed: ['enUs', 'it', 'es'],
|
||||
@@ -46,6 +48,12 @@ export const tools = {
|
||||
PRIORITY_LOW: 0
|
||||
},
|
||||
|
||||
Status: {
|
||||
NONE: 0,
|
||||
OPENED: 1,
|
||||
COMPLETED: 10,
|
||||
},
|
||||
|
||||
MenuAction: {
|
||||
DELETE: 100,
|
||||
TOGGLE_EXPIRING: 101,
|
||||
@@ -53,7 +61,8 @@ export const tools = {
|
||||
PROGRESS_BAR: 120,
|
||||
PRIORITY: 130,
|
||||
SHOW_TASK: 150,
|
||||
EDIT: 160
|
||||
EDIT: 160,
|
||||
ADD_PROJECT: 200
|
||||
},
|
||||
|
||||
selectPriority: {
|
||||
@@ -350,6 +359,12 @@ export const tools = {
|
||||
|
||||
menuPopupConfigProject: {
|
||||
it: [
|
||||
{
|
||||
id: 5,
|
||||
label: 'Nuovo Progetto',
|
||||
value: 200, // ADD_PROJECT
|
||||
icon: 'next_week'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
label: 'Mostra Task',
|
||||
@@ -358,6 +373,12 @@ export const tools = {
|
||||
}
|
||||
],
|
||||
es: [
|
||||
{
|
||||
id: 5,
|
||||
label: 'Nuevo Projecto',
|
||||
value: 200, // ADD_PROJECT
|
||||
icon: 'next_week'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
label: 'Mostrar Tareas',
|
||||
@@ -366,6 +387,12 @@ export const tools = {
|
||||
}
|
||||
],
|
||||
enUs: [
|
||||
{
|
||||
id: 5,
|
||||
label: 'New Project',
|
||||
value: 200, // ADD_PROJECT
|
||||
icon: 'next_week'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
label: 'Show Task',
|
||||
@@ -555,7 +582,7 @@ export const tools = {
|
||||
// tools.notifyarraychanged(myarr)
|
||||
// myarr[indelemchange].modified = true
|
||||
// console.log('update_idprev Index=', indelemchange, 'indtoget', indelemId, tools.getstrelem(myarr[indelemchange]))
|
||||
console.log(' MODIFICATO! ', myarr[indelemchange].descr , ' PRIMA:', myarr[indelemchange].id_prev, 'DOPO: ', id_prev)
|
||||
console.log(' MODIFICATO! ', myarr[indelemchange].descr, ' PRIMA:', myarr[indelemchange].id_prev, 'DOPO: ', id_prev)
|
||||
myarr[indelemchange].id_prev = id_prev
|
||||
return myarr[indelemchange]
|
||||
}
|
||||
@@ -703,6 +730,20 @@ export const tools = {
|
||||
}
|
||||
},
|
||||
|
||||
setArrayMainByTable(nametable, myarr) {
|
||||
if (nametable === 'todos') {
|
||||
Todos.state.todos = tools.jsonCopy(myarr)
|
||||
return Todos.state.todos
|
||||
} else if (nametable === 'projects') {
|
||||
Projects.state.projects = tools.jsonCopy(myarr)
|
||||
return Projects.state.projects
|
||||
}
|
||||
},
|
||||
|
||||
getmyid(id) {
|
||||
return 'row' + id
|
||||
},
|
||||
|
||||
getLastListNotCompleted(nametable, cat) {
|
||||
const module = tools.getModulesByTable(nametable)
|
||||
const arr = module.getters.items_dacompletare(cat)
|
||||
@@ -937,6 +978,11 @@ export const tools = {
|
||||
} else {
|
||||
return 'red'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getstrDate(mytimestamp) {
|
||||
return date.formatDate(mytimestamp, 'DD-MM-YY')
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user