++ hoursweeky_plannedtowork, endwork_estimate, totalphases , actualphase

This commit is contained in:
Paolo Arena
2019-04-07 21:24:10 +02:00
parent f60edc1c5b
commit 884d84e2df
14 changed files with 239 additions and 108 deletions

View File

@@ -20,7 +20,9 @@ const stateglob: IProjectsState = {
visuLastCompleted: 10
}
const listFieldsToChange: string [] = ['descr', 'longdescr', 'hoursplanned', 'hoursworked', 'id_parent', 'statusproj', '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', 'statusproj', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progressCalc', 'live_url', 'test_url', 'begin_development', 'begin_test', 'actualphase', 'totalphases', 'hoursweeky_plannedtowork', 'endwork_estimate']
const listFieldsUpdateCalculation: string [] = ['hoursplanned', 'hoursworked', 'progressCalc', 'endwork_estimate']
const b = storeBuilder.module<IProjectsState>('Projects', stateglob)
const stateGetter = b.state()
@@ -39,6 +41,12 @@ function initcat() {
return rec
}
function updateDataCalculated(projout, projin) {
listFieldsUpdateCalculation.forEach((field) => {
projout[field] = projin[field];
});
}
namespace Getters {
const getRecordEmpty = b.read((state: IProjectsState) => (): IProject => {
// const tomorrow = tools.getDateNow()
@@ -60,13 +68,17 @@ namespace Getters {
id_prev: '',
pos: 0,
modified: false,
hoursworked: 0,
hoursplanned: 0,
live_url: '',
test_url: '',
totalphases: 1,
actualphase: 1,
hoursworked: 0,
hoursplanned: 0,
progressCalc: 0,
begin_development: tools.getDateNull(),
begin_test: tools.getDateNull()
begin_test: tools.getDateNull(),
hoursweeky_plannedtowork: 0,
endwork_estimate: tools.getDateNull()
}
return obj
@@ -87,7 +99,7 @@ namespace Getters {
const listaproj = tools.mapSort(state.projects.filter((proj) => proj.id_parent === process.env.PROJECT_ID_MAIN))
const myarr: IMenuList[] = []
for (const proj of listaproj) {
myarr.push({nametranslate: '', description: proj.descr, idelem: proj._id})
myarr.push({ nametranslate: '', description: proj.descr, idelem: proj._id })
}
return myarr
@@ -165,9 +177,20 @@ namespace Mutations {
else {
state.projects.push(objproj)
}
}
// console.log('state.projects', state.projects)
function updateProject(state: IProjectsState, { objproj }) {
if (!!objproj) {
console.log('updateProject', objproj)
const index = tools.getIndexById(state.projects, objproj._id)
console.log('index', index)
if (index >= 0) {
updateDataCalculated(state.projects[index], objproj)
// state.projects.splice(index, 1, objproj)
// tools.notifyarraychanged(state.projects)
}
}
}
function deletemyitem(state: IProjectsState, myitem: IProject) {
@@ -179,7 +202,8 @@ namespace Mutations {
export const mutations = {
deletemyitem: b.commit(deletemyitem),
createNewItem: b.commit(createNewItem)
createNewItem: b.commit(createNewItem),
updateProject: b.commit(updateProject)
}
}
@@ -298,7 +322,7 @@ namespace Actions {
return id
}
async function modify(context, { myitem, field } ) {
async function modify(context, { myitem, field }) {
return await ApiTables.table_ModifyRecord(nametable, myitem, listFieldsToChange, field)
}

View File

@@ -6,5 +6,7 @@ export const costanti = {
},
CONFIG_ID_CFG: '1',
CONFIG_ID_STATE_CONN: '2',
CONFIG_ID_SHOW_TYPE_TODOS: '3'
CONFIG_ID_SHOW_TYPE_TODOS: '3',
MAX_PHASES: 5
}

View File

@@ -153,7 +153,7 @@ export const tools = {
icon: 'expand_less'
},
{
id: 2,
id: 3,
label: 'Completato',
value: 10, // Status.COMPLETED
icon: 'expand_less'
@@ -174,7 +174,7 @@ export const tools = {
icon: 'expand_less'
},
{
id: 2,
id: 3,
label: 'Completado',
value: 10, // Status.COMPLETED
icon: 'expand_less'
@@ -195,7 +195,7 @@ export const tools = {
icon: 'expand_less'
},
{
id: 2,
id: 3,
label: 'Completed',
value: 10, // Status.COMPLETED
icon: 'expand_less'
@@ -691,10 +691,7 @@ export const tools = {
}
,
logga_arrproj(myarr
:
IProject[]
) {
logga_arrproj(myarr: IProject[]) {
let mystr = '\n'
myarr.forEach((item) => {
mystr += tools.getelemprojstr(item) + ' '
@@ -795,18 +792,18 @@ export const tools = {
console.log('swapElems PRIORITY', itemdragend)
}
console.log('swapGeneralElem', 'new =', itemdragend.newIndex, 'Old =', itemdragend.oldIndex, itemdragend)
if (itemdragend.newIndex === itemdragend.oldIndex) {
return
}
console.log('swapGeneralElem', 'new =', itemdragend.newIndex, 'Old =', itemdragend.oldIndex, itemdragend)
if (tools.isOkIndex(myarr, itemdragend.newIndex) && tools.isOkIndex(myarr, itemdragend.oldIndex)) {
console.log('SPLICE!')
console.log(' PRIMA!', tools.logga_arrproj(myarr))
// console.log(' PRIMA!', tools.logga_arrproj(myarr))
myarr.splice(itemdragend.newIndex, 0, myarr.splice(itemdragend.oldIndex, 1)[0])
console.log(' DOPO!', tools.logga_arrproj(myarr))
// console.log(' DOPO!', tools.logga_arrproj(myarr))
// Ora inverti gli indici
const indold = itemdragend.oldIndex
@@ -874,7 +871,7 @@ export const tools = {
,
getElemById(myarr, id) {
console.log('getElemById', myarr, id)
// console.log('getElemById', myarr, id)
return myarr.find((elem) => elem._id === id)
}
,
@@ -1271,6 +1268,7 @@ export const tools = {
,
getTimestampsNow() {
return new Date().valueOf()
}
},
}