fixed: completed_at field

This commit is contained in:
Paolo Arena
2019-04-05 23:59:52 +02:00
parent 7a55fa7f68
commit ac3f6f0ba9
12 changed files with 643 additions and 460 deletions

View File

@@ -12,6 +12,7 @@ export default class CDate extends Vue {
@Prop() public mydate!: Date @Prop() public mydate!: Date
@Prop({ required: false }) public label: string @Prop({ required: false }) public label: string
@Prop({ required: false, default: '' }) public data_class!: string @Prop({ required: false, default: '' }) public data_class!: string
@Prop({ required: false, default: false }) public readonly!: boolean
public mystyleicon: string = 'font-size: 1.5rem;' public mystyleicon: string = 'font-size: 1.5rem;'

View File

@@ -1,8 +1,8 @@
<template> <template>
<q-input :class="data_class" debounce="1000" dense :value="getdatestring" stack-label :label="label" @input="changedate"> <q-input :class="data_class" :readonly="readonly" :disable="readonly" debounce="1000" dense :value="getdatestring" stack-label :label="label" @input="changedate">
<template v-slot:append> <template v-slot:append>
<q-icon name="event" class="cursor-pointer" :style="mystyleicon"> <q-icon name="event" class="cursor-pointer" :style="mystyleicon">
<q-popup-proxy ref="datePicker"> <q-popup-proxy v-if="!readonly" ref="datePicker">
<q-date :value="getdateyymmddstring" today-btn @input="changedate"></q-date> <q-date :value="getdateyymmddstring" today-btn @input="changedate"></q-date>
</q-popup-proxy> </q-popup-proxy>
</q-icon> </q-icon>

View File

@@ -1,4 +1,4 @@
import { UserStore } from '../store/Modules' import { UserStore } from '@modules'
import messages from '../statics/i18n' import messages from '../statics/i18n'
function translate(params) { function translate(params) {

View File

@@ -224,6 +224,7 @@ const messages = {
status: 'Stato', status: 'Stato',
completed_at: 'Data Completamento', completed_at: 'Data Completamento',
expiring_at: 'Data Scadenza', expiring_at: 'Data Scadenza',
phase: 'Fase',
}, },
notification: { notification: {
status: 'Stato', status: 'Stato',
@@ -469,6 +470,7 @@ const messages = {
status: 'Estado', status: 'Estado',
completed_at: 'Fecha de finalización', completed_at: 'Fecha de finalización',
expiring_at: 'Fecha de Caducidad', expiring_at: 'Fecha de Caducidad',
phase: 'Fase',
}, },
notification: { notification: {
status: 'Estado', status: 'Estado',
@@ -714,6 +716,7 @@ const messages = {
status: 'Status', status: 'Status',
completed_at: 'Completition Date', completed_at: 'Completition Date',
expiring_at: 'Expiring Date', expiring_at: 'Expiring Date',
phase: 'Phase',
}, },
notification: { notification: {
status: 'Status', status: 'Status',

View File

@@ -98,7 +98,10 @@ async function dbDeleteItem(call, item) {
async function Sync_Execute(cmd, tablesync, nametab, method, item: ITodo, id, msg: String) { async function Sync_Execute(cmd, tablesync, nametab, method, item: ITodo, id, msg: String) {
// Send to Server to Sync // Send to Server to Sync
// console.log('Sync_Execute', cmd, tablesync, nametab, method, item.descr, id, msg) console.log('Sync_Execute', cmd, tablesync, nametab, method, id, msg)
if (nametab === 'todos') {
console.log(' TODO: ', item.descr)
}
let cmdSw = cmd let cmdSw = cmd
if ((cmd === DB.CMD_SYNC_NEW) || (cmd === DB.CMD_DELETE)) { if ((cmd === DB.CMD_SYNC_NEW) || (cmd === DB.CMD_DELETE)) {
@@ -370,7 +373,7 @@ function setmodifiedIfchanged(recOut, recIn, field) {
return false return false
} }
export async function table_ModifyRecord(nametable, myitem, fieldtochange) { export async function table_ModifyRecord(nametable, myitem, listFieldsToChange, field) {
if (myitem === null) { if (myitem === null) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve() resolve()
@@ -379,16 +382,13 @@ export async function table_ModifyRecord(nametable, myitem, fieldtochange) {
console.log('--> table_ModifyRecord', nametable, myitem.descr) console.log('--> table_ModifyRecord', nametable, myitem.descr)
const myobjsaved = tools.jsonCopy(myitem) if ((field === 'status') && (nametable === 'todos') && (myitem.status === tools.Status.COMPLETED)) {
console.log('AAAAAAAAAAAAAAAAAAAAAAAA ', myitem.completed_at)
/* myitem.completed_at = tools.getDateNow()
const mymodule = tools.getModulesByTable(nametable) console.log(' DOPO ', myitem.completed_at)
let param2 = ''
if (nametable === 'todos') {
param2 = myitem.category
} }
const miorec = mymodule.getters.getRecordById(myobjsaved._id, param2)
*/ const myobjsaved = tools.jsonCopy(myitem)
// get record from IndexedDb // get record from IndexedDb
const miorec = await globalroutines(null, 'read', nametable, null, myobjsaved._id) const miorec = await globalroutines(null, 'read', nametable, null, myobjsaved._id)
@@ -397,16 +397,17 @@ export async function table_ModifyRecord(nametable, myitem, fieldtochange) {
return return
} }
console.log('miorec', miorec.descr, miorec.id_prev) console.log(' 0-> ')
if (nametable === 'todos') { console.log('myobjsaved.completed_at', myobjsaved.completed_at)
if (setmodifiedIfchanged(miorec, myobjsaved, 'status') && (miorec.status === tools.Status.COMPLETED)) {
miorec.completed_at = tools.getDateNow()
console.log('miorec.completed_at', miorec.completed_at) console.log('miorec.completed_at', miorec.completed_at)
}
}
fieldtochange.forEach((myfield) => { console.log('miorec', miorec.descr, miorec.id_prev, nametable)
console.log('status', miorec.status, myobjsaved.status)
console.log(' 3-> ')
listFieldsToChange.forEach((myfield) => {
setmodifiedIfchanged(miorec, myobjsaved, myfield) setmodifiedIfchanged(miorec, myobjsaved, myfield)
}) })
@@ -415,15 +416,21 @@ export async function table_ModifyRecord(nametable, myitem, fieldtochange) {
miorec.modify_at = tools.getDateNow() miorec.modify_at = tools.getDateNow()
miorec.modified = false miorec.modified = false
console.log(' 0) ARR MIOREC PRIMA ', miorec.completed_at, miorec)
// 1) Permit to Update the Views // 1) Permit to Update the Views
tools.notifyarraychanged(miorec) tools.notifyarraychanged(miorec)
console.log(' 1) MIOREC CALL WRITE: ', miorec.completed_at, miorec)
// 2) Modify on IndexedDb // 2) Modify on IndexedDb
return globalroutines(null, 'write', nametable, miorec) return globalroutines(null, 'write', nametable, miorec)
.then((ris) => { .then((ris) => {
console.log(' 2) MIOREC !: ', miorec.completed_at)
// 3) Modify on the Server (call) // 3) Modify on the Server (call)
Sync_SaveItem(nametable, 'PATCH', miorec) return Sync_SaveItem(nametable, 'PATCH', miorec)
}) })
} else { } else {

View File

@@ -20,7 +20,7 @@ const state: IProjectsState = {
visuLastCompleted: 10 visuLastCompleted: 10
} }
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 listFieldsToChange: 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 b = storeBuilder.module<IProjectsState>('Projects', state)
const stateGetter = b.state() const stateGetter = b.state()
@@ -302,8 +302,8 @@ namespace Actions {
return id return id
} }
async function modify(context, { myitem, field }) { async function modify(context, { myitem, field } ) {
return await ApiTables.table_ModifyRecord(nametable, myitem, fieldtochange) return await ApiTables.table_ModifyRecord(nametable, myitem, listFieldsToChange, field)
} }
async function swapElems(context, itemdragend: IDrag) { async function swapElems(context, itemdragend: IDrag) {
@@ -311,7 +311,7 @@ namespace Actions {
const myarr = Getters.getters.items_dacompletare(itemdragend.id_proj) const myarr = Getters.getters.items_dacompletare(itemdragend.id_proj)
tools.swapGeneralElem(nametable, myarr, itemdragend, fieldtochange) tools.swapGeneralElem(nametable, myarr, itemdragend, listFieldsToChange)
} }

View File

@@ -27,7 +27,7 @@ const state: ITodosState = {
visuLastCompleted: 10 visuLastCompleted: 10
} }
const fieldtochange: string [] = ['descr', 'status', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date', 'completed_at'] const listFieldsToChange: string [] = ['descr', 'status', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date', 'completed_at']
const b = storeBuilder.module<ITodosState>('Todos', state) const b = storeBuilder.module<ITodosState>('Todos', state)
const stateGetter = b.state() const stateGetter = b.state()
@@ -356,7 +356,7 @@ namespace Actions {
} }
async function modify(context, { myitem, field }) { async function modify(context, { myitem, field }) {
return await ApiTables.table_ModifyRecord(nametable, myitem, fieldtochange) return await ApiTables.table_ModifyRecord(nametable, myitem, listFieldsToChange, field)
} }
async function swapElems(context, itemdragend: IDrag) { async function swapElems(context, itemdragend: IDrag) {
@@ -366,7 +366,7 @@ namespace Actions {
const indcat = state.categories.indexOf(cat) const indcat = state.categories.indexOf(cat)
const myarr = state.todos[indcat] const myarr = state.todos[indcat]
tools.swapGeneralElem(nametable, myarr, itemdragend, fieldtochange) tools.swapGeneralElem(nametable, myarr, itemdragend, listFieldsToChange)
} }

View File

@@ -1,9 +1,11 @@
import { Todos, Projects, UserStore } from '@store' import { Todos, Projects, UserStore } from '@store'
import globalroutines from './../../globalroutines/index' import globalroutines from './../../globalroutines/index'
import { costanti } from './costanti' import { costanti } from './costanti'
import { translation } from './translation'
import Quasar, { date } from 'quasar' import Quasar, { date } from 'quasar'
import { IProject, ITodo } from '@src/model' import { IProject, ITodo } from '@src/model'
import * as ApiTables from '@src/store/Modules/ApiTables' import * as ApiTables from '@src/store/Modules/ApiTables'
import translate from '@src/globalroutines/util'
export interface INotify { export interface INotify {
color?: string | 'primary' color?: string | 'primary'
@@ -54,7 +56,7 @@ export const tools = {
Status: { Status: {
NONE: 0, NONE: 0,
OPENED: 1, OPENED: 1,
COMPLETED: 10, COMPLETED: 10
}, },
MenuAction: { MenuAction: {
@@ -67,6 +69,75 @@ export const tools = {
EDIT: 160, EDIT: 160,
ADD_PROJECT: 200 ADD_PROJECT: 200
}, },
selectPhase: {
it: [
{
id: 1,
label: translation.it.fase + ' 0',
value: 0
},
{
id: 2,
label: translation.it.fase + ' 1',
value: 1
},
{
id: 3,
label: translation.it.fase + ' 2',
value: 2
},
{
id: 4,
label: translation.it.fase + ' 3',
value: 3
}
],
es: [
{
id: 1,
label: translation.es.fase + ' 0',
value: 0
},
{
id: 2,
label: translation.es.fase + ' 1',
value: 1
},
{
id: 3,
label: translation.es.fase + ' 2',
value: 2
},
{
id: 4,
label: translation.es.fase + ' 3',
value: 3
}
],
enUs: [
{
id: 1,
label: translation.enUs.fase + ' 0',
value: 0
},
{
id: 2,
label: translation.enUs.fase + ' 1',
value: 1
},
{
id: 3,
label: translation.enUs.fase + ' 2',
value: 2
},
{
id: 4,
label: translation.enUs.fase + ' 3',
value: 3
}
]
},
selectStatus: { selectStatus: {
it: [ it: [
{ {
@@ -88,7 +159,8 @@ export const tools = {
icon: 'expand_less' icon: 'expand_less'
} }
], ],
es: [ es:
[
{ {
id: 1, id: 1,
label: 'Ninguno', label: 'Ninguno',
@@ -108,7 +180,8 @@ export const tools = {
icon: 'expand_less' icon: 'expand_less'
} }
], ],
enUs: [ enUs:
[
{ {
id: 1, id: 1,
label: 'None', label: 'None',
@@ -129,7 +202,8 @@ export const tools = {
} }
] ]
}, }
,
selectPriority: { selectPriority: {
it: [ it: [
{ {
@@ -150,7 +224,8 @@ export const tools = {
value: 0, value: 0,
icon: 'expand_more' icon: 'expand_more'
}], }],
es: [ es:
[
{ {
id: 1, id: 1,
label: 'Alta', label: 'Alta',
@@ -169,7 +244,8 @@ export const tools = {
value: 0, value: 0,
icon: 'expand_more' icon: 'expand_more'
}], }],
enUs: [ enUs:
[
{ {
id: 1, id: 1,
label: 'High', label: 'High',
@@ -188,7 +264,8 @@ export const tools = {
value: 0, value: 0,
icon: 'expand_more' icon: 'expand_more'
}], }],
de: [ de:
[
{ {
id: 1, id: 1,
label: 'High', label: 'High',
@@ -208,11 +285,13 @@ export const tools = {
icon: 'expand_more' icon: 'expand_more'
}] }]
}, }
,
INDEX_MENU_DELETE: 4, INDEX_MENU_DELETE: 4,
menuPopupTodo: { menuPopupTodo:
{
it: [ it: [
{ {
id: 10, id: 10,
@@ -250,7 +329,8 @@ export const tools = {
checked: false checked: false
} }
], ],
es: [ es:
[
{ {
id: 10, id: 10,
label: '', label: '',
@@ -287,7 +367,8 @@ export const tools = {
checked: false checked: false
} }
], ],
enUs: [ enUs:
[
{ {
id: 10, id: 10,
label: '', label: '',
@@ -324,7 +405,8 @@ export const tools = {
checked: false checked: false
} }
] ]
}, }
,
menuPopupProj: { menuPopupProj: {
it: [ it: [
@@ -349,7 +431,8 @@ export const tools = {
checked: false checked: false
} }
], ],
es: [ es:
[
{ {
id: 10, id: 10,
label: 'Editar', label: 'Editar',
@@ -371,7 +454,8 @@ export const tools = {
checked: false checked: false
} }
], ],
enUs: [ enUs:
[
{ {
id: 10, id: 10,
label: 'Edit', label: 'Edit',
@@ -393,7 +477,8 @@ export const tools = {
checked: false checked: false
} }
] ]
}, }
,
menuPopupConfigTodo: { menuPopupConfigTodo: {
it: [ it: [
@@ -404,7 +489,8 @@ export const tools = {
icon: 'rowing' icon: 'rowing'
} }
], ],
es: [ es:
[
{ {
id: 10, id: 10,
label: 'Mostrar Tareas', label: 'Mostrar Tareas',
@@ -412,7 +498,8 @@ export const tools = {
icon: 'rowing' icon: 'rowing'
} }
], ],
enUs: [ enUs:
[
{ {
id: 10, id: 10,
label: 'Show Task', label: 'Show Task',
@@ -420,7 +507,8 @@ export const tools = {
icon: 'rowing' icon: 'rowing'
} }
] ]
}, }
,
menuPopupConfigProject: { menuPopupConfigProject: {
it: [ it: [
@@ -437,7 +525,8 @@ export const tools = {
icon: 'rowing' icon: 'rowing'
} }
], ],
es: [ es:
[
{ {
id: 5, id: 5,
label: 'Nuevo Projecto', label: 'Nuevo Projecto',
@@ -451,7 +540,8 @@ export const tools = {
icon: 'rowing' icon: 'rowing'
} }
], ],
enUs: [ enUs:
[
{ {
id: 5, id: 5,
label: 'New Project', label: 'New Project',
@@ -465,7 +555,8 @@ export const tools = {
icon: 'rowing' icon: 'rowing'
} }
] ]
}, }
,
listOptionShowTask: { listOptionShowTask: {
it: [ it: [
@@ -491,7 +582,8 @@ export const tools = {
checked: true checked: true
} }
], ],
es: [ es:
[
{ {
id: 10, id: 10,
label: 'Mostrar los ultimos N completados', label: 'Mostrar los ultimos N completados',
@@ -514,7 +606,8 @@ export const tools = {
checked: true checked: true
} }
], ],
enUs: [ enUs:
[
{ {
id: 10, id: 10,
label: 'Show last N Completed', label: 'Show last N Completed',
@@ -537,7 +630,8 @@ export const tools = {
checked: true checked: true
} }
] ]
}, }
,
getTitlePriority(priority) { getTitlePriority(priority) {
let cl = '' let cl = ''
@@ -553,7 +647,8 @@ export const tools = {
} }
return cl + ' titlePriority' return cl + ' titlePriority'
}, }
,
getStatusListByInd(index) { getStatusListByInd(index) {
try { try {
@@ -567,7 +662,8 @@ export const tools = {
console.log('Error: ', e) console.log('Error: ', e)
} }
return '' return ''
}, }
,
getPriorityByInd(index) { getPriorityByInd(index) {
// console.log('LANG in PRIOR', UserStore.state.lang) // console.log('LANG in PRIOR', UserStore.state.lang)
@@ -582,34 +678,46 @@ export const tools = {
console.log('Error: ', e) console.log('Error: ', e)
} }
return '' return ''
}, }
,
logelem(mystr, elem) { logelem(mystr, elem) {
console.log(mystr, 'elem [', elem._id, '] ', elem.descr, ' Pr(', tools.getPriorityByInd(elem.priority), ') [', elem.id_prev, '] modif=', elem.modified) console.log(mystr, 'elem [', elem._id, '] ', elem.descr, ' Pr(', tools.getPriorityByInd(elem.priority), ') [', elem.id_prev, '] modif=', elem.modified)
}, }
,
getelemprojstr(elem) { getelemprojstr(elem) {
return 'elem [id= ' + elem._id + '] ' + elem.descr + ' [id_prev= ' + elem.id_prev + '] ' return 'elem [id= ' + elem._id + '] ' + elem.descr + ' [id_prev= ' + elem.id_prev + '] '
}, }
,
logga_arrproj(myarr: IProject[]) { logga_arrproj(myarr
:
IProject[]
) {
let mystr = '\n' let mystr = '\n'
myarr.forEach((item) => { myarr.forEach((item) => {
mystr += tools.getelemprojstr(item) + ' ' mystr += tools.getelemprojstr(item) + ' '
}) })
return mystr return mystr
}, }
,
logelemprj(mystr, elem) { logelemprj(mystr, elem) {
console.log(mystr, tools.getelemprojstr(elem)) console.log(mystr, tools.getelemprojstr(elem))
}, }
,
getstrelem(elem) { getstrelem(elem) {
return 'elem [' + elem._id + '] ' + elem.descr + ' Pr(' + tools.getPriorityByInd(elem.priority) + ') [ID_PREV=' + elem.id_prev + '] modif=' + elem.modified + ' ' return 'elem [' + elem._id + '] ' + elem.descr + ' Pr(' + tools.getPriorityByInd(elem.priority) + ') [ID_PREV=' + elem.id_prev + '] modif=' + elem.modified + ' '
}, }
,
logga_arr(myarr: ITodo[]) { logga_arr(myarr
:
ITodo[]
) {
let mystr = '\n' let mystr = '\n'
myarr.forEach((item) => { myarr.forEach((item) => {
mystr += '[' + item.pos + '] ' + item.descr + ' Pr(' + tools.getPriorityByInd(item.priority) + ') [' + item.id_prev + '] modif=' + item.modified + '\n' mystr += '[' + item.pos + '] ' + item.descr + ' Pr(' + tools.getPriorityByInd(item.priority) + ') [' + item.id_prev + '] modif=' + item.modified + '\n'
@@ -617,7 +725,8 @@ export const tools = {
}) })
return mystr return mystr
}, }
,
touchmove(scrollable) { touchmove(scrollable) {
if (window) { if (window) {
@@ -628,11 +737,13 @@ export const tools = {
} }
}, { passive: false }) }, { passive: false })
} }
}, }
,
jsonCopy(src) { jsonCopy(src) {
return JSON.parse(JSON.stringify(src)) return JSON.parse(JSON.stringify(src))
}, }
,
getItemLS(item) { getItemLS(item) {
let ris = localStorage.getItem(item) let ris = localStorage.getItem(item)
@@ -641,17 +752,20 @@ export const tools = {
} }
return ris return ris
}, }
,
notifyarraychanged(array) { notifyarraychanged(array) {
if (array.length > 0) { if (array.length > 0) {
array.splice(array.length - 1, 1, array[array.length - 1]) array.splice(array.length - 1, 1, array[array.length - 1])
} }
}, }
,
isOkIndex(myarr, index) { isOkIndex(myarr, index) {
return (index >= 0 && index < myarr.length) return (index >= 0 && index < myarr.length)
}, }
,
update_idprev(myarr, indelemchange, indelemId) { update_idprev(myarr, indelemchange, indelemId) {
if (tools.isOkIndex(myarr, indelemchange)) { if (tools.isOkIndex(myarr, indelemchange)) {
@@ -667,9 +781,10 @@ export const tools = {
} }
} }
return null return null
}, }
,
async swapGeneralElem(nametable, myarr, itemdragend, fieldtochange) { async swapGeneralElem(nametable, myarr, itemdragend, listFieldsToChange) {
if (itemdragend.field === 'priority') { if (itemdragend.field === 'priority') {
// get last elem priority // get last elem priority
@@ -735,11 +850,14 @@ export const tools = {
const elem3 = tools.update_idprev(myarr, itemdragend.oldIndex, itemdragend.oldIndex - 1) // 1, 0 const elem3 = tools.update_idprev(myarr, itemdragend.oldIndex, itemdragend.oldIndex - 1) // 1, 0
const elem4 = tools.update_idprev(myarr, itemdragend.oldIndex + 1, itemdragend.oldIndex) // 2, 1 const elem4 = tools.update_idprev(myarr, itemdragend.oldIndex + 1, itemdragend.oldIndex) // 2, 1
await ApiTables.table_ModifyRecord(nametable, elem1, fieldtochange) await
await ApiTables.table_ModifyRecord(nametable, elem2, fieldtochange) ApiTables.table_ModifyRecord(nametable, elem1, listFieldsToChange, 'id_prev')
await ApiTables.table_ModifyRecord(nametable, elem3, fieldtochange) await
await ApiTables.table_ModifyRecord(nametable, elem4, fieldtochange) ApiTables.table_ModifyRecord(nametable, elem2, listFieldsToChange, 'id_prev')
await
ApiTables.table_ModifyRecord(nametable, elem3, listFieldsToChange, 'id_prev')
await
ApiTables.table_ModifyRecord(nametable, elem4, listFieldsToChange, 'id_prev')
tools.notifyarraychanged(myarr) tools.notifyarraychanged(myarr)
@@ -747,22 +865,33 @@ export const tools = {
// Update the records: // Update the records:
} }
}, }
,
getIndexById(myarr, id) { getIndexById(myarr, id) {
return myarr.indexOf(tools.getElemById(myarr, id)) return myarr.indexOf(tools.getElemById(myarr, id))
}, }
,
getElemById(myarr, id) { getElemById(myarr, id) {
console.log('getElemById', myarr, id) console.log('getElemById', myarr, id)
return myarr.find((elem) => elem._id === id) return myarr.find((elem) => elem._id === id)
}, }
,
getElemPrevById(myarr, id) { getElemPrevById(myarr, id) {
return myarr.find((elem) => elem.id_prev === id) return myarr.find((elem) => elem.id_prev === id)
}, }
,
getLastFirstElemPriority(myarr, priority: number, atfirst: boolean, escludiId: string) { getLastFirstElemPriority(myarr, priority
:
number, atfirst
:
boolean, escludiId
:
string
) {
if (myarr === null) { if (myarr === null) {
return -1 return -1
} }
@@ -796,11 +925,13 @@ export const tools = {
return 0 return 0
} }
} }
}, }
,
getFirstList(myarr) { getFirstList(myarr) {
return myarr.find((elem) => elem.id_prev === ApiTables.LIST_START) return myarr.find((elem) => elem.id_prev === ApiTables.LIST_START)
}, }
,
getModulesByTable(nametable) { getModulesByTable(nametable) {
if (nametable === 'todos') { if (nametable === 'todos') {
@@ -808,7 +939,8 @@ export const tools = {
} else if (nametable === 'projects') { } else if (nametable === 'projects') {
return Projects return Projects
} }
}, }
,
setArrayMainByTable(nametable, myarr) { setArrayMainByTable(nametable, myarr) {
if (nametable === 'todos') { if (nametable === 'todos') {
@@ -818,18 +950,21 @@ export const tools = {
Projects.state.projects = tools.jsonCopy(myarr) Projects.state.projects = tools.jsonCopy(myarr)
return Projects.state.projects return Projects.state.projects
} }
}, }
,
getmyid(id) { getmyid(id) {
return 'row' + id return 'row' + id
}, }
,
getLastListNotCompleted(nametable, cat) { getLastListNotCompleted(nametable, cat) {
const module = tools.getModulesByTable(nametable) const module = tools.getModulesByTable(nametable)
const arr = module.getters.items_dacompletare(cat) const arr = module.getters.items_dacompletare(cat)
return (arr.length > 0) ? arr[arr.length - 1] : null return (arr.length > 0) ? arr[arr.length - 1] : null
}, }
,
getElemByIndex(myarr, index) { getElemByIndex(myarr, index) {
if (index >= 0 && index < myarr.length) { if (index >= 0 && index < myarr.length) {
@@ -838,11 +973,13 @@ export const tools = {
else { else {
return null return null
} }
}, }
,
existArr(x) { existArr(x) {
return x = (typeof x !== 'undefined' && x instanceof Array) ? x : [] return x = (typeof x !== 'undefined' && x instanceof Array) ? x : []
}, }
,
json2array(json) { json2array(json) {
const result = [] const result = []
@@ -851,9 +988,13 @@ export const tools = {
result.push(json[key]) result.push(json[key])
}) })
return result return result
}, }
,
showNotif(q: any, msg, data ?: INotify | null) { showNotif(q
:
any, msg, data ?: INotify | null
) {
let myicon = data ? data.icon : 'ion-add' let myicon = data ? data.icon : 'ion-add'
if (!myicon) { if (!myicon) {
myicon = 'ion-add' myicon = 'ion-add'
@@ -869,11 +1010,13 @@ export const tools = {
color: mycolor, color: mycolor,
timeout: 3000 timeout: 3000
}) })
}, }
,
isRegistered() { isRegistered() {
return localStorage.getItem(tools.localStorage.userId) !== '' return localStorage.getItem(tools.localStorage.userId) !== ''
}, }
,
checkIfUserExist(mythis) { checkIfUserExist(mythis) {
@@ -889,7 +1032,8 @@ export const tools = {
} }
return true return true
}, }
,
checkLangPassed(mylang) { checkLangPassed(mylang) {
@@ -918,15 +1062,18 @@ export const tools = {
console.log('mylang calc : ', mylang) console.log('mylang calc : ', mylang)
return mylang return mylang
}, }
,
getimglogo() { getimglogo() {
return 'statics/images/' + process.env.LOGO_REG return 'statics/images/' + process.env.LOGO_REG
}, }
,
consolelogpao(strlog, strlog2 = '', strlog3 = '') { consolelogpao(strlog, strlog2 = '', strlog3 = '') {
globalroutines(null, 'log', strlog + ' ' + strlog2 + ' ' + strlog3, null) globalroutines(null, 'log', strlog + ' ' + strlog2 + ' ' + strlog3, null)
}, }
,
/* /*
get todos_vista() { get todos_vista() {
@@ -940,7 +1087,7 @@ export const tools = {
} }
*/ */
/* /*
public getArrTodos() { public getArrTodos() {
@@ -966,7 +1113,8 @@ export const tools = {
resolve('anything') resolve('anything')
}, numsec) }, numsec)
}) })
}, }
,
dragula_option($service, dragname) { dragula_option($service, dragname) {
$service.options(dragname, $service.options(dragname,
@@ -982,14 +1130,16 @@ export const tools = {
}, },
direction: 'vertical' direction: 'vertical'
}) })
}, }
,
// _.cloneDeep( Per clonare un oggetto // _.cloneDeep( Per clonare un oggetto
isLoggedToSystem() { isLoggedToSystem() {
const tok = tools.getItemLS(tools.localStorage.token) const tok = tools.getItemLS(tools.localStorage.token)
return !!tok return !!tok
}, }
,
mapSort(linkedList) { mapSort(linkedList) {
const sortedList = [] const sortedList = []
@@ -1038,7 +1188,8 @@ export const tools = {
// console.log('DOPO sortedList', sortedList); // console.log('DOPO sortedList', sortedList);
return sortedList return sortedList
}, }
,
getProgressClassColor(progress) { getProgressClassColor(progress) {
if (progress > 66) { if (progress > 66) {
@@ -1048,7 +1199,8 @@ export const tools = {
} else { } else {
return 'lowperc' return 'lowperc'
} }
}, }
,
getProgressColor(progress) { getProgressColor(progress) {
if (progress > 66) { if (progress > 66) {
@@ -1058,7 +1210,8 @@ export const tools = {
} else { } else {
return 'red' return 'red'
} }
}, }
,
getstrDate(mytimestamp) { getstrDate(mytimestamp) {
console.log('getstrDate', mytimestamp) console.log('getstrDate', mytimestamp)
@@ -1066,13 +1219,18 @@ export const tools = {
return date.formatDate(mytimestamp, 'DD/MM/YYYY') return date.formatDate(mytimestamp, 'DD/MM/YYYY')
else else
return '' return ''
}, }
,
getstrYYMMDDDate(mytimestamp) { getstrYYMMDDDate(mytimestamp) {
return date.formatDate(mytimestamp, 'YYYY-MM-DD') return date.formatDate(mytimestamp, 'YYYY-MM-DD')
}, }
,
// mystrdate "26.04.2013" // mystrdate "26.04.2013"
convertstrtoDate(mystrdate: string) { convertstrtoDate(mystrdate
:
string
) {
if (mystrdate.length < 10) { if (mystrdate.length < 10) {
return null return null
} }
@@ -1087,7 +1245,8 @@ export const tools = {
} }
console.log('mystrdate', mystrdate, strdate, mydate) console.log('mystrdate', mystrdate, strdate, mydate)
return mydate return mydate
}, }
,
capitalize(value) { capitalize(value) {
if (!value) { if (!value) {
@@ -1099,16 +1258,18 @@ export const tools = {
getDateNow() { getDateNow() {
const mydate = new Date() const mydate = new Date()
console.log('mydate', mydate, mydate.getDate(), mydate.getUTCDate()) console.log('mydate', mydate)
return mydate return mydate
}, }
,
getDateNull() { getDateNull() {
const mydate = new Date(0) return new Date(0)
return mydate }
}, ,
getTimeNow() { getTimeNow() {
return new Date().getTime() return new Date().getTime()
}, }
,
getTimestampsNow() { getTimestampsNow() {
return new Date().valueOf() return new Date().valueOf()
} }

View File

@@ -0,0 +1,14 @@
export const translation = {
it: {
fase: 'Fase',
end: ''
},
es: {
fase: 'Fase',
end: ''
},
enUs: {
fase: 'Phase',
end: ''
}
}

View File

@@ -74,7 +74,7 @@ $heightBtn: 100%;
.categorytitle{ .categorytitle{
color:blue; color:blue;
background-color: lightblue; background-color: lightblue;
font-size: 1.25rem; font-size: 1.25rem !important;
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
flex: 1; flex: 1;

View File

@@ -52,6 +52,7 @@ export default class ProjList extends Vue {
public percProgress: string = 'percProgress' public percProgress: string = 'percProgress'
public selectStatus: [] = tools.selectStatus[UserStore.state.lang] public selectStatus: [] = tools.selectStatus[UserStore.state.lang]
public selectPhase: [] = tools.selectPhase[UserStore.state.lang]
public $refs: { public $refs: {
singleproject: SingleProject[], singleproject: SingleProject[],
@@ -261,15 +262,6 @@ export default class ProjList extends Vue {
public async updateitemproj({ myitem, field }) { public async updateitemproj({ myitem, field }) {
console.log('calling MODIFY updateitemproj', myitem, field) console.log('calling MODIFY updateitemproj', myitem, field)
const itemdragend: IDrag = {
id_proj: this.idProjAtt,
field,
idelemtochange: myitem._id,
atfirst: false
}
// await Projects.actions.swapElems(itemdragend)
await Projects.actions.modify({ myitem, field }) await Projects.actions.modify({ myitem, field })
} }

View File

@@ -193,12 +193,12 @@
@input="watchupdatetodo('status')"> @input="watchupdatetodo('status')">
</q-select> </q-select>
</div> </div>
<q-icon class="flex-item flex-icon" name="event"/> <q-icon class="flex-item flex-icon" name="outlined_flag"/>
<div class="flex-item itemdata"> <div class="flex-item itemstatus">
<CDate v-if="itemtodosel.status === tools.Status.COMPLETED" <q-select rounded outlined v-model="itemtodosel.phase" :options="selectPhase"
:mydate="itemtodosel.completed_at" @input="itemtodosel.completed_at = new Date(arguments[0])" :label="$t('todo.phase')" emit-value map-options
:label="$t('todo.completed_at')"> @input="watchupdatetodo('phase')">
</CDate> </q-select>
</div> </div>
</div> </div>
<div class="flex-container clMain"> <div class="flex-container clMain">
@@ -239,7 +239,12 @@
</CDate> </CDate>
</div> </div>
<div style="margin: 10px;"></div> <div style="margin: 10px;"></div>
<q-icon class="flex-item flex-icon" name="event"/>
<div class="flex-item itemdata"> <div class="flex-item itemdata">
<CDate :readonly="itemtodosel.status !== tools.Status.COMPLETED"
:mydate="itemtodosel.completed_at" @input="itemtodosel.completed_at = new Date(arguments[0])"
:label="$t('todo.completed_at')">
</CDate>
</div> </div>
</div> </div>
</template> </template>