- add fields: typeproj and id_main_project

This commit is contained in:
Paolo Arena
2019-04-09 21:07:16 +02:00
parent 884d84e2df
commit fd20048934
10 changed files with 449 additions and 183 deletions

View File

@@ -20,7 +20,10 @@ const stateglob: IProjectsState = {
visuLastCompleted: 10
}
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 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',
'privacyread', 'privacywrite', 'id_main_project', 'typeproj']
const listFieldsUpdateCalculation: string [] = ['hoursplanned', 'hoursworked', 'progressCalc', 'endwork_estimate']
@@ -43,8 +46,8 @@ function initcat() {
function updateDataCalculated(projout, projin) {
listFieldsUpdateCalculation.forEach((field) => {
projout[field] = projin[field];
});
projout[field] = projin[field]
})
}
namespace Getters {
@@ -56,7 +59,9 @@ namespace Getters {
_id: objectId(),
descr: '',
longdescr: '',
typeproj: 0,
id_parent: '',
id_main_project: '',
priority: tools.Priority.PRIORITY_NORMAL,
statusproj: tools.Status.OPENED,
created_at: tools.getDateNow(),
@@ -75,6 +80,8 @@ namespace Getters {
hoursworked: 0,
hoursplanned: 0,
progressCalc: 0,
privacyread: '',
privacywrite: '',
begin_development: tools.getDateNull(),
begin_test: tools.getDateNull(),
hoursweeky_plannedtowork: 0,
@@ -95,12 +102,13 @@ namespace Getters {
const listaprojects = b.read((state: IProjectsState) => (): IMenuList[] => {
if (state.projects) {
// console.log('state.projects', state.projects)
console.log('state.projects', state.projects)
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 })
}
console.log(' myarr', myarr, listaproj)
return myarr
} else {
@@ -120,17 +128,6 @@ namespace Getters {
return ''
}, 'getDescrById')
const getParentById = b.read((state: IProjectsState) => (id: string): string => {
if (state.projects) {
const itemfound = state.projects.find((item) => item._id === id)
if (!!itemfound) {
return itemfound.id_parent
}
}
return ''
}, 'getParentById')
const getRecordById = b.read((state: IProjectsState) => (id: string): IProject => {
if (state.projects) {
return state.projects.find((item) => item._id === id)
@@ -151,13 +148,9 @@ namespace Getters {
get getDescrById() {
return getDescrById()
},
get getParentById() {
return getParentById()
},
get getRecordById() {
return getRecordById()
}
}
}
@@ -282,6 +275,8 @@ namespace Actions {
objproj.descr = myobj.descr
objproj.category = myobj.category
objproj.id_parent = myobj.id_parent
objproj.id_main_project = myobj.id_main_project
objproj.typeproj = myobj.typeproj
let elemtochange: IProject = null

View File

@@ -67,6 +67,18 @@ namespace Getters {
return state.servercode
}, 'getServerCode')
const IsMyFriend = b.read((state) => (userIdOwner) => {
// ++TODO Check if userIdOwner is my friend
// userIdOwner is my friend ?
return true
}, 'IsMyFriend')
const IsMyGroup = b.read((state) => (userIdOwner) => {
// ++TODO Check if userIdOwner is on my groups
// userIdOwner is on my groups ?
return true
}, 'IsMyGroup')
export const getters = {
get lang() {
return lang()
@@ -80,6 +92,12 @@ namespace Getters {
get getServerCode() {
return getServerCode()
},
get IsMyFriend() {
return IsMyFriend()
},
get IsMyGroup() {
return IsMyGroup()
}
// get fullName() { return fullName();},
}

View File

@@ -3,7 +3,7 @@ import globalroutines from './../../globalroutines/index'
import { costanti } from './costanti'
import { translation } from './translation'
import Quasar, { date } from 'quasar'
import { IProject, ITodo } from '@src/model'
import { IProject, ITodo, Privacy } from '@src/model'
import * as ApiTables from '@src/store/Modules/ApiTables'
import translate from '@src/globalroutines/util'
@@ -136,8 +136,77 @@ export const tools = {
value: 3
}
]
},
selectPrivacy: {
it: [
{
id: 1,
label: translation.it.privacy.all,
value: Privacy.all
},
{
id: 2,
label: translation.it.privacy.friends,
value: Privacy.friends
},
{
id: 3,
label: translation.it.privacy.mygroup,
value: Privacy.mygroup
},
{
id: 4,
label: translation.it.privacy.onlyme,
value: Privacy.onlyme
}
],
es: [
{
id: 1,
label: translation.es.privacy.all,
value: Privacy.all
},
{
id: 2,
label: translation.es.privacy.friends,
value: Privacy.friends
},
{
id: 3,
label: translation.es.privacy.mygroup,
value: Privacy.mygroup
},
{
id: 4,
label: translation.es.privacy.onlyme,
value: Privacy.onlyme
}
],
enUs: [
{
id: 1,
label: translation.enUs.privacy.all,
value: Privacy.all
},
{
id: 2,
label: translation.enUs.privacy.friends,
value: Privacy.friends
},
{
id: 3,
label: translation.enUs.privacy.mygroup,
value: Privacy.mygroup
},
{
id: 4,
label: translation.enUs.privacy.onlyme,
value: Privacy.onlyme
}
]
},
selectStatus: {
it: [
{
@@ -514,13 +583,13 @@ export const tools = {
it: [
{
id: 5,
label: 'Nuovo Progetto',
label: translation.it.proj.newsubproj,
value: 200, // ADD_PROJECT
icon: 'next_week'
},
{
id: 10,
label: 'Mostra Task',
label: translation.it.task.showtask,
value: 150, // SHOW_TASK
icon: 'rowing'
}
@@ -529,13 +598,13 @@ export const tools = {
[
{
id: 5,
label: 'Nuevo Projecto',
label: translation.es.proj.newsubproj,
value: 200, // ADD_PROJECT
icon: 'next_week'
},
{
id: 10,
label: 'Mostrar Tareas',
label: translation.es.task.showtask,
value: 150,
icon: 'rowing'
}
@@ -544,19 +613,47 @@ export const tools = {
[
{
id: 5,
label: 'New Project',
label: translation.it.proj.newsubproj,
value: 200, // ADD_PROJECT
icon: 'next_week'
},
{
id: 10,
label: 'Show Task',
label: translation.enUs.task.showtask,
value: 150,
icon: 'rowing'
}
]
}
,
},
menuPopupConfigMAINProject: {
it: [
{
id: 5,
label: translation.it.proj.newproj,
value: 200, // ADD_PROJECT
icon: 'next_week'
}
],
es:
[
{
id: 5,
label: translation.es.proj.newproj,
value: 200, // ADD_PROJECT
icon: 'next_week'
}
],
enUs:
[
{
id: 5,
label: translation.it.proj.newproj,
value: 200, // ADD_PROJECT
icon: 'next_week'
}
]
},
listOptionShowTask: {
it: [
@@ -1270,5 +1367,9 @@ export const tools = {
return new Date().valueOf()
},
isMainProject(idproj) {
return idproj === process.env.PROJECT_ID_MAIN
}
}

View File

@@ -1,14 +1,53 @@
export const translation = {
it: {
fase: 'Fase',
privacy: {
all: 'Tutti',
friends: 'Amici',
mygroup: 'Gruppo',
onlyme: 'Solo io'
},
proj: {
newproj: 'Nuovo Progetto',
newsubproj: 'Nuovo Sotto-Progetto',
},
task: {
showtask: 'Mostra Task',
},
end: ''
},
es: {
fase: 'Fase',
privacy: {
all: 'Todos',
friends: 'Amigos',
mygroup: 'Grupos',
onlyme: 'Solo yo'
},
proj: {
newproj: 'Nuevo Projecto',
newsubproj: 'Nuevo Sub-Projecto',
},
task: {
showtask: 'Mostrar Tarea',
},
end: ''
},
enUs: {
fase: 'Phase',
privacy: {
all: 'All',
friends: 'Friends',
mygroup: 'Group',
onlyme: 'Only me'
},
proj: {
newproj: 'New Project',
newsubproj: 'New Sub-Project',
},
task: {
showtask: 'Show Task',
},
end: ''
}
}