fixed: completed_at field
This commit is contained in:
@@ -12,6 +12,7 @@ export default class CDate extends Vue {
|
||||
@Prop() public mydate!: Date
|
||||
@Prop({ required: false }) public label: string
|
||||
@Prop({ required: false, default: '' }) public data_class!: string
|
||||
@Prop({ required: false, default: false }) public readonly!: boolean
|
||||
|
||||
public mystyleicon: string = 'font-size: 1.5rem;'
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<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>
|
||||
<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-popup-proxy>
|
||||
</q-icon>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UserStore } from '../store/Modules'
|
||||
import { UserStore } from '@modules'
|
||||
import messages from '../statics/i18n'
|
||||
|
||||
function translate(params) {
|
||||
|
||||
@@ -224,6 +224,7 @@ const messages = {
|
||||
status: 'Stato',
|
||||
completed_at: 'Data Completamento',
|
||||
expiring_at: 'Data Scadenza',
|
||||
phase: 'Fase',
|
||||
},
|
||||
notification: {
|
||||
status: 'Stato',
|
||||
@@ -469,6 +470,7 @@ const messages = {
|
||||
status: 'Estado',
|
||||
completed_at: 'Fecha de finalización',
|
||||
expiring_at: 'Fecha de Caducidad',
|
||||
phase: 'Fase',
|
||||
},
|
||||
notification: {
|
||||
status: 'Estado',
|
||||
@@ -714,6 +716,7 @@ const messages = {
|
||||
status: 'Status',
|
||||
completed_at: 'Completition Date',
|
||||
expiring_at: 'Expiring Date',
|
||||
phase: 'Phase',
|
||||
},
|
||||
notification: {
|
||||
status: 'Status',
|
||||
|
||||
@@ -98,7 +98,10 @@ async function dbDeleteItem(call, item) {
|
||||
async function Sync_Execute(cmd, tablesync, nametab, method, item: ITodo, id, msg: String) {
|
||||
// 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
|
||||
if ((cmd === DB.CMD_SYNC_NEW) || (cmd === DB.CMD_DELETE)) {
|
||||
@@ -370,7 +373,7 @@ function setmodifiedIfchanged(recOut, recIn, field) {
|
||||
return false
|
||||
}
|
||||
|
||||
export async function table_ModifyRecord(nametable, myitem, fieldtochange) {
|
||||
export async function table_ModifyRecord(nametable, myitem, listFieldsToChange, field) {
|
||||
if (myitem === null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve()
|
||||
@@ -379,16 +382,13 @@ export async function table_ModifyRecord(nametable, myitem, fieldtochange) {
|
||||
|
||||
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()
|
||||
console.log(' DOPO ', myitem.completed_at)
|
||||
}
|
||||
|
||||
/*
|
||||
const mymodule = tools.getModulesByTable(nametable)
|
||||
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
|
||||
const miorec = await globalroutines(null, 'read', nametable, null, myobjsaved._id)
|
||||
@@ -397,16 +397,17 @@ export async function table_ModifyRecord(nametable, myitem, fieldtochange) {
|
||||
return
|
||||
}
|
||||
|
||||
console.log('miorec', miorec.descr, miorec.id_prev)
|
||||
console.log(' 0-> ')
|
||||
|
||||
if (nametable === 'todos') {
|
||||
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('myobjsaved.completed_at', myobjsaved.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)
|
||||
})
|
||||
|
||||
@@ -415,15 +416,21 @@ export async function table_ModifyRecord(nametable, myitem, fieldtochange) {
|
||||
miorec.modify_at = tools.getDateNow()
|
||||
miorec.modified = false
|
||||
|
||||
console.log(' 0) ARR MIOREC PRIMA ', miorec.completed_at, miorec)
|
||||
|
||||
// 1) Permit to Update the Views
|
||||
tools.notifyarraychanged(miorec)
|
||||
|
||||
console.log(' 1) MIOREC CALL WRITE: ', miorec.completed_at, miorec)
|
||||
|
||||
// 2) Modify on IndexedDb
|
||||
return globalroutines(null, 'write', nametable, miorec)
|
||||
.then((ris) => {
|
||||
|
||||
console.log(' 2) MIOREC !: ', miorec.completed_at)
|
||||
|
||||
// 3) Modify on the Server (call)
|
||||
Sync_SaveItem(nametable, 'PATCH', miorec)
|
||||
return Sync_SaveItem(nametable, 'PATCH', miorec)
|
||||
|
||||
})
|
||||
} else {
|
||||
|
||||
@@ -20,7 +20,7 @@ const state: IProjectsState = {
|
||||
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 stateGetter = b.state()
|
||||
@@ -302,8 +302,8 @@ namespace Actions {
|
||||
return id
|
||||
}
|
||||
|
||||
async function modify(context, { myitem, field }) {
|
||||
return await ApiTables.table_ModifyRecord(nametable, myitem, fieldtochange)
|
||||
async function modify(context, { myitem, field } ) {
|
||||
return await ApiTables.table_ModifyRecord(nametable, myitem, listFieldsToChange, field)
|
||||
}
|
||||
|
||||
async function swapElems(context, itemdragend: IDrag) {
|
||||
@@ -311,7 +311,7 @@ namespace Actions {
|
||||
|
||||
const myarr = Getters.getters.items_dacompletare(itemdragend.id_proj)
|
||||
|
||||
tools.swapGeneralElem(nametable, myarr, itemdragend, fieldtochange)
|
||||
tools.swapGeneralElem(nametable, myarr, itemdragend, listFieldsToChange)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ const state: ITodosState = {
|
||||
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 stateGetter = b.state()
|
||||
@@ -356,7 +356,7 @@ namespace Actions {
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -366,7 +366,7 @@ namespace Actions {
|
||||
const indcat = state.categories.indexOf(cat)
|
||||
const myarr = state.todos[indcat]
|
||||
|
||||
tools.swapGeneralElem(nametable, myarr, itemdragend, fieldtochange)
|
||||
tools.swapGeneralElem(nametable, myarr, itemdragend, listFieldsToChange)
|
||||
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
14
src/store/Modules/translation.ts
Normal file
14
src/store/Modules/translation.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export const translation = {
|
||||
it: {
|
||||
fase: 'Fase',
|
||||
end: ''
|
||||
},
|
||||
es: {
|
||||
fase: 'Fase',
|
||||
end: ''
|
||||
},
|
||||
enUs: {
|
||||
fase: 'Phase',
|
||||
end: ''
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ $heightBtn: 100%;
|
||||
.categorytitle{
|
||||
color:blue;
|
||||
background-color: lightblue;
|
||||
font-size: 1.25rem;
|
||||
font-size: 1.25rem !important;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
flex: 1;
|
||||
|
||||
@@ -52,6 +52,7 @@ export default class ProjList extends Vue {
|
||||
public percProgress: string = 'percProgress'
|
||||
|
||||
public selectStatus: [] = tools.selectStatus[UserStore.state.lang]
|
||||
public selectPhase: [] = tools.selectPhase[UserStore.state.lang]
|
||||
|
||||
public $refs: {
|
||||
singleproject: SingleProject[],
|
||||
@@ -261,15 +262,6 @@ export default class ProjList extends Vue {
|
||||
public async 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 })
|
||||
|
||||
}
|
||||
|
||||
@@ -193,12 +193,12 @@
|
||||
@input="watchupdatetodo('status')">
|
||||
</q-select>
|
||||
</div>
|
||||
<q-icon class="flex-item flex-icon" name="event"/>
|
||||
<div class="flex-item itemdata">
|
||||
<CDate v-if="itemtodosel.status === tools.Status.COMPLETED"
|
||||
:mydate="itemtodosel.completed_at" @input="itemtodosel.completed_at = new Date(arguments[0])"
|
||||
:label="$t('todo.completed_at')">
|
||||
</CDate>
|
||||
<q-icon class="flex-item flex-icon" name="outlined_flag"/>
|
||||
<div class="flex-item itemstatus">
|
||||
<q-select rounded outlined v-model="itemtodosel.phase" :options="selectPhase"
|
||||
:label="$t('todo.phase')" emit-value map-options
|
||||
@input="watchupdatetodo('phase')">
|
||||
</q-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-container clMain">
|
||||
@@ -239,7 +239,12 @@
|
||||
</CDate>
|
||||
</div>
|
||||
<div style="margin: 10px;"></div>
|
||||
<q-icon class="flex-item flex-icon" name="event"/>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user