added themecolor and themebgcolor to todos and projects

This commit is contained in:
Paolo Arena
2019-04-29 23:47:42 +02:00
parent 166be747a5
commit 08c0ded31f
26 changed files with 547 additions and 221 deletions

View File

@@ -148,7 +148,7 @@ namespace Getters {
// PROGETTI -> FAVORITI :
if (arrlistafavourite.length > 0) {
arrMenu.push({
icon: '',
icon: 'favorite_border',
nametranslate: 'pages.' + RouteNames.favouriteprojects,
urlroute: RouteNames.favouriteprojects,
level_parent: 0.0,
@@ -160,7 +160,7 @@ namespace Getters {
// PROGETTI -> TUTTI :
arrMenu.push({
icon: '',
icon: 'accessibility_new',
nametranslate: 'pages.' + RouteNames.projectsall,
urlroute: RouteNames.projectsall,
level_parent: 0.0,
@@ -171,7 +171,7 @@ namespace Getters {
// PROGETTI -> CONDIVISI :
arrMenu.push({
icon: '',
icon: 'people_outline',
nametranslate: 'pages.' + RouteNames.projectsshared,
urlroute: RouteNames.projectsshared,
level_parent: 0.0,
@@ -182,7 +182,7 @@ namespace Getters {
// PROGETTI -> PERSONALI :
arrMenu.push({
icon: '',
icon: 'person',
nametranslate: 'pages.' + RouteNames.myprojects,
urlroute: RouteNames.myprojects,
level_parent: 0.0,

View File

@@ -4,6 +4,7 @@ import { storeBuilder } from './Store/Store'
import Api from '@api'
import { tools } from './tools'
import { lists } from './lists'
import * as ApiTables from './ApiTables'
import { GlobalStore, UserStore } from '@store'
import globalroutines from './../../globalroutines/index'
@@ -25,7 +26,7 @@ const stateglob: IProjectsState = {
const listFieldsToChange: string [] = ['descr', 'longdescr', 'hoursplanned', 'hoursleft', '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', 'favourite']
'privacyread', 'privacywrite', 'id_main_project', 'typeproj', 'favourite', 'themecolor', 'themebgcolor']
const listFieldsUpdateCalculation: string [] = ['hoursplanned', 'hoursleft', 'hoursworked', 'progressCalc', 'endwork_estimate']
@@ -98,7 +99,9 @@ namespace Getters {
begin_development: tools.getDateNull(),
begin_test: tools.getDateNull(),
hoursweeky_plannedtowork: 0,
endwork_estimate: tools.getDateNull()
endwork_estimate: tools.getDateNull(),
themecolor: '',
themebgcolor: ''
}
return obj
@@ -396,10 +399,10 @@ namespace Actions {
async function ActionCutPaste(context, action: IAction) {
if (action.type === tools.MenuAction.CUT) {
if (action.type === lists.MenuAction.CUT) {
GlobalStore.state.lastaction = action
} else if (action.type === tools.MenuAction.PASTE) {
if (GlobalStore.state.lastaction.type === tools.MenuAction.CUT) {
} else if (action.type === lists.MenuAction.PASTE) {
if (GlobalStore.state.lastaction.type === lists.MenuAction.CUT) {
// Change id_parent
const orig_obj = Getters.getters.getRecordById(GlobalStore.state.lastaction._id)

View File

@@ -3,6 +3,7 @@ import { storeBuilder } from './Store/Store'
import Api from '@api'
import { tools } from './tools'
import { lists } from './lists'
import * as ApiTables from './ApiTables'
import { GlobalStore, Todos, UserStore } from '@store'
import globalroutines from './../../globalroutines/index'
@@ -28,7 +29,7 @@ const state: ITodosState = {
visuLastCompleted: 10
}
const listFieldsToChange: string [] = ['descr', 'statustodo', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date', 'completed_at']
const listFieldsToChange: string [] = ['descr', 'statustodo', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date', 'completed_at', 'themecolor', 'themebgcolor']
const b = storeBuilder.module<ITodosState>('Todos', state)
const stateGetter = b.state()
@@ -82,7 +83,9 @@ namespace Getters {
assigned_to_userId: '',
hoursplanned: 0,
hoursworked: 0,
start_date: tools.getDateNull()
start_date: tools.getDateNull(),
themecolor: 'blue',
themebgcolor: 'white'
}
// return this.copy(objtodo)
return objtodo
@@ -388,7 +391,7 @@ namespace Actions {
}
async function swapElems(context, itemdragend: IDrag) {
console.log('TODOS swapElems', itemdragend, state.todos, state.categories)
// console.log('TODOS swapElems', itemdragend, state.todos, state.categories)
const cat = itemdragend.category
const indcat = state.categories.indexOf(cat)
@@ -401,10 +404,10 @@ namespace Actions {
async function ActionCutPaste(context, action: IAction) {
console.log('ActionCutPaste', action)
if (action.type === tools.MenuAction.CUT) {
if (action.type === lists.MenuAction.CUT) {
GlobalStore.state.lastaction = action
} else if (action.type === tools.MenuAction.PASTE) {
if (GlobalStore.state.lastaction.type === tools.MenuAction.CUT) {
} else if (action.type === lists.MenuAction.PASTE) {
if (GlobalStore.state.lastaction.type === lists.MenuAction.CUT) {
// Change id_parent
const orig_obj = Getters.getters.getRecordById(GlobalStore.state.lastaction._id, GlobalStore.state.lastaction.cat)

160
src/store/Modules/lists.ts Normal file
View File

@@ -0,0 +1,160 @@
import { Todos, Projects, UserStore } from '@store'
export const lists = {
MenuAction: {
CUT: 71,
PASTE: 72,
DELETE: 100,
TOGGLE_EXPIRING: 101,
COMPLETED: 110,
PROGRESS_BAR: 120,
PRIORITY: 130,
SHOW_TASK: 150,
EDIT: 160,
ADD_PROJECT: 200,
THEME: 210,
THEMEBG: 211
},
selectTheme: [
{
id: 1,
label: 'Theme 1',
value: 'red'
},
{
id: 2,
label: 'Theme 2',
value: 'pink'
},
{
id: 3,
label: 'Theme 3',
value: 'purple'
},
{
id: 4,
label: 'Theme 4',
value: 'deep-purple'
},
{
id: 5,
label: 'Theme 5',
value: 'indigo'
},
{
id: 6,
label: 'Theme 6',
value: 'blue'
},
{
id: 7,
label: 'Theme 7',
value: 'green'
},
{
id: 8,
label: 'Theme 8',
value: 'orange'
},
{
id: 9,
label: 'Theme 9',
value: 'brown'
},
{
id: 10,
label: 'Theme 10',
value: 'black'
},
{
id: 11,
label: 'Theme 11',
value: 'white'
}
],
selectPriority: {
it: [
{
id: 1,
label: 'Alta',
value: 2,
icon: 'expand_less'
},
{
id: 2,
label: 'Normale',
value: 1,
icon: 'remove'
},
{
id: 3,
label: 'Bassa',
value: 0,
icon: 'expand_more'
}],
es:
[
{
id: 1,
label: 'Alta',
value: 2,
icon: 'expand_less'
},
{
id: 2,
label: 'Normal',
value: 1,
icon: 'remove'
},
{
id: 3,
label: 'Baja',
value: 0,
icon: 'expand_more'
}],
enUs:
[
{
id: 1,
label: 'High',
value: 2,
icon: 'expand_less'
},
{
id: 2,
label: 'Normal',
value: 1,
icon: 'remove'
},
{
id: 3,
label: 'Low',
value: 0,
icon: 'expand_more'
}],
de:
[
{
id: 1,
label: 'High',
value: 2,
icon: 'expand_less'
},
{
id: 2,
label: 'Normal',
value: 1,
icon: 'remove'
},
{
id: 3,
label: 'Low',
value: 0,
icon: 'expand_more'
}]
}
}

View File

@@ -8,6 +8,8 @@ import * as ApiTables from '@src/store/Modules/ApiTables'
import translate from '@src/globalroutines/util'
import { RouteNames } from '@src/router/route-names'
import { lists } from './lists'
export interface INotify {
color?: string | 'primary'
textColor?: string
@@ -63,18 +65,6 @@ export const tools = {
COMPLETED: 10
},
MenuAction: {
CUT: 71,
PASTE: 72,
DELETE: 100,
TOGGLE_EXPIRING: 101,
COMPLETED: 110,
PROGRESS_BAR: 120,
PRIORITY: 130,
SHOW_TASK: 150,
EDIT: 160,
ADD_PROJECT: 200
},
selectPhase: {
it: [
{
@@ -277,89 +267,6 @@ export const tools = {
}
]
}
,
selectPriority: {
it: [
{
id: 1,
label: 'Alta',
value: 2,
icon: 'expand_less'
},
{
id: 2,
label: 'Normale',
value: 1,
icon: 'remove'
},
{
id: 3,
label: 'Bassa',
value: 0,
icon: 'expand_more'
}],
es:
[
{
id: 1,
label: 'Alta',
value: 2,
icon: 'expand_less'
},
{
id: 2,
label: 'Normal',
value: 1,
icon: 'remove'
},
{
id: 3,
label: 'Baja',
value: 0,
icon: 'expand_more'
}],
enUs:
[
{
id: 1,
label: 'High',
value: 2,
icon: 'expand_less'
},
{
id: 2,
label: 'Normal',
value: 1,
icon: 'remove'
},
{
id: 3,
label: 'Low',
value: 0,
icon: 'expand_more'
}],
de:
[
{
id: 1,
label: 'High',
value: 2,
icon: 'expand_less'
},
{
id: 2,
label: 'Normal',
value: 1,
icon: 'remove'
},
{
id: 3,
label: 'Low',
value: 0,
icon: 'expand_more'
}]
}
,
@@ -372,14 +279,14 @@ export const tools = {
id: 5,
disable: false,
label: 'Taglia',
value: 71, // CUT
value: lists.MenuAction.CUT,
icon: 'undo'
},
{
id: 10,
disable: false,
label: '',
value: 120, // PROGRESS_BAR
value: lists.MenuAction.PROGRESS_BAR,
icon: 'rowing',
checked: true
},
@@ -387,15 +294,34 @@ export const tools = {
id: 20,
disable: false,
label: 'Imposta Priorità',
value: 130, // PRIORITY
value: lists.MenuAction.PRIORITY,
icon: 'rowing',
checked: false
checked: false,
arrlista: lists.selectPriority.it
},
{
id: 21,
disable: false,
label: translation.it.proj.themecolor,
value: lists.MenuAction.THEME,
icon: 'format_color_text',
checked: false,
arrlista: lists.selectTheme
},
{
id: 22,
disable: false,
label: translation.it.proj.themebgcolor,
value: lists.MenuAction.THEMEBG,
icon: 'format_color_fill',
checked: false,
arrlista: lists.selectTheme
},
{
id: 30,
disable: false,
label: 'Completato',
value: 110, // COMPLETED
value: lists.MenuAction.COMPLETED,
icon: 'check_circle',
checked: true
},
@@ -403,7 +329,7 @@ export const tools = {
id: 40,
disable: false,
label: 'Imposta Scadenza',
value: 101, // TOGGLE_EXPIRING
value: lists.MenuAction.TOGGLE_EXPIRING,
icon: 'date_range',
checked: true
},
@@ -411,7 +337,7 @@ export const tools = {
id: 50,
disable: false,
label: 'Elimina',
value: 100, // DELETE
value: lists.MenuAction.DELETE,
icon: 'delete',
checked: false
}
@@ -422,14 +348,14 @@ export const tools = {
id: 5,
disable: false,
label: 'Cortar',
value: 71, // CUT
value: lists.MenuAction.CUT,
icon: 'undo'
},
{
id: 10,
disable: false,
label: '',
value: 120, // PROGRESS_BAR
value: lists.MenuAction.PROGRESS_BAR,
icon: 'rowing',
checked: true
},
@@ -437,15 +363,34 @@ export const tools = {
id: 20,
disable: false,
label: 'Establecer Prioridad',
value: 130, // PRIORITY
value: lists.MenuAction.PRIORITY,
icon: 'rowing',
checked: false
checked: false,
arrlista: lists.selectPriority.es
},
{
id: 21,
disable: false,
label: translation.es.proj.themecolor,
value: lists.MenuAction.THEME,
icon: 'format_color_text',
checked: false,
arrlista: lists.selectTheme
},
{
id: 22,
disable: false,
label: translation.es.proj.themebgcolor,
value: lists.MenuAction.THEMEBG,
icon: 'format_color_fill',
checked: false,
arrlista: lists.selectTheme
},
{
id: 30,
disable: false,
label: 'Completado',
value: 110, // COMPLETED
value: lists.MenuAction.COMPLETED,
icon: 'check_circle',
checked: true
},
@@ -453,7 +398,7 @@ export const tools = {
id: 40,
disable: false,
label: 'Establecer expiración',
value: 101, // TOGGLE_EXPIRING
value: lists.MenuAction.TOGGLE_EXPIRING,
icon: 'date_range',
checked: true
},
@@ -461,7 +406,7 @@ export const tools = {
id: 50,
disable: false,
label: 'Borrar',
value: 100, // DELETE
value: lists.MenuAction.DELETE,
icon: 'delete',
checked: false
}
@@ -472,14 +417,14 @@ export const tools = {
id: 5,
disable: false,
label: 'Cut',
value: 71, // CUT
value: lists.MenuAction.CUT,
icon: 'undo'
},
{
id: 10,
disable: false,
label: '',
value: 120, // PROGRESS_BAR
value: lists.MenuAction.PROGRESS_BAR,
icon: 'check_circle',
checked: true
},
@@ -487,15 +432,34 @@ export const tools = {
id: 20,
disable: false,
label: 'Set Priority',
value: 130, // PRIORITY
value: lists.MenuAction.PRIORITY,
icon: 'high_priority',
checked: false
checked: false,
arrlista: lists.selectPriority.enUs
},
{
id: 21,
disable: false,
label: translation.enUs.proj.themecolor,
value: lists.MenuAction.THEME,
icon: 'format_color_text',
checked: false,
arrlista: lists.selectTheme
},
{
id: 22,
disable: false,
label: translation.enUs.proj.themebgcolor,
value: lists.MenuAction.THEMEBG,
icon: 'format_color_fill',
checked: false,
arrlista: lists.selectTheme
},
{
id: 30,
disable: false,
label: 'Completed',
value: 110, // COMPLETED
value: lists.MenuAction.COMPLETED,
icon: 'check_circle',
checked: true
},
@@ -503,7 +467,7 @@ export const tools = {
id: 40,
disable: false,
label: 'Set Expiring',
value: 101, // TOGGLE_EXPIRING
value: lists.MenuAction.TOGGLE_EXPIRING,
icon: 'date_range',
checked: true
},
@@ -511,7 +475,7 @@ export const tools = {
id: 50,
disable: false,
label: 'Delete',
value: 100, // DELETE
value: lists.MenuAction.DELETE,
icon: 'trash',
checked: false
}
@@ -543,6 +507,24 @@ export const tools = {
icon: 'date_range',
checked: true
},
{
id: 45,
disable: false,
label: translation.it.proj.themecolor,
value: lists.MenuAction.THEME,
icon: 'format_color_text',
checked: false,
arrlista: lists.selectTheme
},
{
id: 46,
disable: false,
label: translation.it.proj.themebgcolor,
value: lists.MenuAction.THEMEBG,
icon: 'format_color_fill',
checked: false,
arrlista: lists.selectTheme
},
{
id: 50,
disable: false,
@@ -576,6 +558,24 @@ export const tools = {
icon: 'date_range',
checked: true
},
{
id: 45,
disable: false,
label: translation.es.proj.themecolor,
value: lists.MenuAction.THEME,
icon: 'format_color_text',
checked: false,
arrlista: lists.selectTheme
},
{
id: 46,
disable: false,
label: translation.es.proj.themebgcolor,
value: lists.MenuAction.THEMEBG,
icon: 'format_color_fill',
checked: false,
arrlista: lists.selectTheme
},
{
id: 50,
disable: false,
@@ -609,6 +609,24 @@ export const tools = {
icon: 'date_range',
checked: true
},
{
id: 45,
disable: false,
label: translation.enUs.proj.themecolor,
value: lists.MenuAction.THEME,
icon: 'format_color_text',
checked: false,
arrlista: lists.selectTheme
},
{
id: 46,
disable: false,
label: translation.enUs.proj.themebgcolor,
value: lists.MenuAction.THEMEBG,
icon: 'format_color_fill',
checked: false,
arrlista: lists.selectTheme
},
{
id: 50,
disable: false,
@@ -900,7 +918,7 @@ export const tools = {
getPriorityByInd(index) {
// console.log('LANG in PRIOR', UserStore.state.lang)
try {
const arr = tools.selectPriority[UserStore.state.lang]
const arr = lists.selectPriority[UserStore.state.lang]
for (const rec of arr) {
if (rec.value === index) {
return rec.label
@@ -1032,7 +1050,7 @@ export const tools = {
if (tools.isOkIndex(myarr, itemdragend.newIndex) && tools.isOkIndex(myarr, itemdragend.oldIndex)) {
console.log('SPLICE!')
console.log('*** SPLICE!')
// 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))

View File

@@ -10,6 +10,8 @@ export const translation = {
proj: {
newproj: 'Nuovo Progetto',
newsubproj: 'Nuovo Sotto-Progetto',
themecolor: 'Tema Colore',
themebgcolor: 'Tema Colore Sfondo'
},
task: {
showtask: 'Mostra Task',
@@ -30,6 +32,8 @@ export const translation = {
proj: {
newproj: 'Nuevo Projecto',
newsubproj: 'Nuevo Sub-Projecto',
themecolor: 'Tema Colores',
themebgcolor: 'Tema Colores Fondo'
},
task: {
showtask: 'Mostrar Tarea',
@@ -50,9 +54,11 @@ export const translation = {
proj: {
newproj: 'New Project',
newsubproj: 'New Sub-Project',
themecolor: 'Theme Color',
themebgcolor: 'Theme Background Color'
},
task: {
showtask: 'Show Task',
showtask: 'Show Task'
},
action: {
paste: 'Paste'