diff --git a/src/components/CProgress/CProgress.ts b/src/components/CProgress/CProgress.ts
index c087c6b..cc416fd 100644
--- a/src/components/CProgress/CProgress.ts
+++ b/src/components/CProgress/CProgress.ts
@@ -20,6 +20,7 @@ export default class CProgress extends Vue {
@Prop({ required: true }) public progressval: number
@Prop() public descr: string
@Prop({ default: false }) public slider: boolean
+ @Prop({ default: false }) public readonly: boolean
@Watch('progressval')
public valchanged(value) {
diff --git a/src/components/CProgress/CProgress.vue b/src/components/CProgress/CProgress.vue
index 1df9ef2..a353592 100644
--- a/src/components/CProgress/CProgress.vue
+++ b/src/components/CProgress/CProgress.vue
@@ -3,6 +3,7 @@
('Projects', stateglob)
const stateGetter = b.state()
@@ -92,13 +88,14 @@ namespace Getters {
actualphase: 1,
hoursworked: 0,
hoursplanned: 0,
+ hoursleft: 0,
progressCalc: 0,
privacyread: 'onlyme',
privacywrite: 'onlyme',
begin_development: tools.getDateNull(),
begin_test: tools.getDateNull(),
hoursweeky_plannedtowork: 0,
- endwork_estimate: tools.getDateNull(),
+ endwork_estimate: tools.getDateNull()
}
return obj
@@ -247,9 +244,6 @@ namespace Mutations {
async function movemyitem(state: IProjectsState, { myitemorig, myitemdest } ) {
const indorig = tools.getIndexById(state.projects, myitemorig._id)
- // console.log('myitemorig', myitemorig, 'indorig', indorig)
- // console.log('myitemdest', myitemdest)
-
state.projects.splice(indorig, 1)
state.projects.push(myitemdest)
@@ -399,13 +393,13 @@ namespace Actions {
async function ActionCutPaste(context, action: IAction) {
- if (action.type === tools.MenuAction.CUT)
- stateglob.action = action
- else if (action.type === tools.MenuAction.PASTE) {
- if (stateglob.action.type === tools.MenuAction.CUT) {
+ if (action.type === tools.MenuAction.CUT) {
+ GlobalStore.state.lastaction = action
+ } else if (action.type === tools.MenuAction.PASTE) {
+ if (GlobalStore.state.lastaction.type === tools.MenuAction.CUT) {
// Change id_parent
- const orig_obj = Getters.getters.getRecordById(stateglob.action._id)
+ const orig_obj = Getters.getters.getRecordById(GlobalStore.state.lastaction._id)
const dest = Getters.getters.getRecordById(action._id)
// console.log('dest', dest)
@@ -418,13 +412,12 @@ namespace Actions {
dest_obj.modified = true
dest_obj.id_prev = null
- await Mutations.mutations.movemyitem({ myitemorig: orig_obj, myitemdest: dest_obj })
- }
+ GlobalStore.state.lastaction.type = 0
- stateglob.action.type = 0
+ return await Mutations.mutations.movemyitem({ myitemorig: orig_obj, myitemdest: dest_obj })
+ }
}
}
- return true
}
export const actions = {
diff --git a/src/store/Modules/Todos.ts b/src/store/Modules/Todos.ts
index 5f8ff37..4fbffd2 100644
--- a/src/store/Modules/Todos.ts
+++ b/src/store/Modules/Todos.ts
@@ -11,6 +11,7 @@ import { serv_constants } from '@src/store/Modules/serv_constants'
import { GetterTree } from 'vuex'
import objectId from '@src/js/objectId'
import { costanti } from '@src/store/Modules/costanti'
+import { IAction } from '@src/model'
const nametable = 'todos'
@@ -46,7 +47,7 @@ function gettodosByCategory(category: string): [] {
function initcat() {
- let rec = Getters.getters.getRecordEmpty()
+ const rec = Getters.getters.getRecordEmpty()
rec.userId = UserStore.state.userId
return rec
@@ -54,7 +55,7 @@ function initcat() {
}
namespace Getters {
- const getRecordEmpty = b.read((state: ITodosState) => (): ITodo => {
+ const getRecordEmpty = b.read((stateparamf: ITodosState) => (): ITodo => {
const tomorrow = tools.getDateNow()
tomorrow.setDate(tomorrow.getDate() + 1)
@@ -81,32 +82,32 @@ namespace Getters {
assigned_to_userId: '',
hoursplanned: 0,
hoursworked: 0,
- start_date: tools.getDateNull(),
+ start_date: tools.getDateNull()
}
// return this.copy(objtodo)
return objtodo
}, 'getRecordEmpty')
- const items_dacompletare = b.read((state: ITodosState) => (cat: string): ITodo[] => {
+ const items_dacompletare = b.read((stateparam: ITodosState) => (cat: string): ITodo[] => {
const indcat = getindexbycategory(cat)
- // console.log('items_dacompletare', 'indcat', indcat, state.todos[indcat])
- if (state.todos[indcat]) {
- return state.todos[indcat].filter((todo) => todo.statustodo !== tools.Status.COMPLETED)
+ // console.log('items_dacompletare', 'indcat', indcat, stateparam.todos[indcat])
+ if (stateparam.todos[indcat]) {
+ return stateparam.todos[indcat].filter((todo) => todo.statustodo !== tools.Status.COMPLETED)
} else {
return []
}
}, 'items_dacompletare')
- const todos_completati = b.read((state: ITodosState) => (cat: string): ITodo[] => {
+ const todos_completati = b.read((stateparam: ITodosState) => (cat: string): ITodo[] => {
const indcat = getindexbycategory(cat)
- if (state.todos[indcat]) {
- if (state.showtype === costanti.ShowTypeTask.SHOW_LAST_N_COMPLETED) { // Show only the first N completed
- return state.todos[indcat].filter((todo) => todo.statustodo === tools.Status.COMPLETED).slice(0, state.visuLastCompleted)
+ if (stateparam.todos[indcat]) {
+ if (stateparam.showtype === costanti.ShowTypeTask.SHOW_LAST_N_COMPLETED) { // Show only the first N completed
+ return stateparam.todos[indcat].filter((todo) => todo.statustodo === tools.Status.COMPLETED).slice(0, stateparam.visuLastCompleted)
}
- else if (state.showtype === costanti.ShowTypeTask.SHOW_ONLY_TOCOMPLETE) {
+ else if (stateparam.showtype === costanti.ShowTypeTask.SHOW_ONLY_TOCOMPLETE) {
return []
}
- else if (state.showtype === costanti.ShowTypeTask.SHOW_ALL) {
- return state.todos[indcat].filter((todo) => todo.statustodo === tools.Status.COMPLETED)
+ else if (stateparam.showtype === costanti.ShowTypeTask.SHOW_ALL) {
+ return stateparam.todos[indcat].filter((todo) => todo.statustodo === tools.Status.COMPLETED)
}
else {
return []
@@ -116,22 +117,22 @@ namespace Getters {
}
}, 'todos_completati')
- const doneTodosCount = b.read((state: ITodosState) => (cat: string): number => {
+ const doneTodosCount = b.read((stateparam: ITodosState) => (cat: string): number => {
return getters.todos_completati(cat).length
}, 'doneTodosCount')
- const TodosCount = b.read((state: ITodosState) => (cat: string): number => {
+ const TodosCount = b.read((stateparam: ITodosState) => (cat: string): number => {
const indcat = getindexbycategory(cat)
- if (state.todos[indcat]) {
- return state.todos[indcat].length
+ if (stateparam.todos[indcat]) {
+ return stateparam.todos[indcat].length
} else {
return 0
}
}, 'TodosCount')
- const getRecordById = b.read((state: ITodosState) => (id: string, cat: string): ITodo => {
+ const getRecordById = b.read((stateparam: ITodosState) => (id: string, cat: string): ITodo => {
const indcat = getindexbycategory(cat)
- if (state.todos) {
- return state.todos[indcat].find((item) => item._id === id)
+ if (stateparam.todos) {
+ return stateparam.todos[indcat].find((item) => item._id === id)
}
return null
}, 'getRecordById')
@@ -160,49 +161,73 @@ namespace Getters {
namespace Mutations {
- function findIndTodoById(state: ITodosState, data: IParamTodo) {
- const indcat = state.categories.indexOf(data.categorySel)
+ function findIndTodoById(stateparam: ITodosState, data: IParamTodo) {
+ const indcat = stateparam.categories.indexOf(data.categorySel)
if (indcat >= 0) {
- return tools.getIndexById(state.todos[indcat], data.id)
+ return tools.getIndexById(stateparam.todos[indcat], data.id)
}
return -1
}
- function createNewItem(state: ITodosState, { objtodo, atfirst, categorySel }) {
- let indcat = state.categories.indexOf(categorySel)
- if (indcat == -1) {
- state.categories.push(categorySel)
- indcat = state.categories.indexOf(categorySel)
+ function createNewItem(stateparam: ITodosState, { objtodo, atfirst, categorySel }) {
+ let indcat = stateparam.categories.indexOf(categorySel)
+ if (indcat === -1) {
+ stateparam.categories.push(categorySel)
+ indcat = stateparam.categories.indexOf(categorySel)
}
- console.log('createNewItem', objtodo, 'cat=', categorySel, 'state.todos[indcat]', state.todos[indcat])
- if (state.todos[indcat] === undefined) {
- state.todos[indcat] = []
- state.todos[indcat].push(objtodo)
- console.log('push state.todos[indcat]', state.todos)
+ console.log('createNewItem', objtodo, 'cat=', categorySel, 'stateparam.todos[indcat]', stateparam.todos[indcat])
+ if (stateparam.todos[indcat] === undefined) {
+ stateparam.todos[indcat] = []
+ stateparam.todos[indcat].push(objtodo)
+ console.log('push stateparam.todos[indcat]', stateparam.todos)
return
}
if (atfirst) {
- state.todos[indcat].unshift(objtodo)
+ stateparam.todos[indcat].unshift(objtodo)
}
else {
- state.todos[indcat].push(objtodo)
+ stateparam.todos[indcat].push(objtodo)
}
- console.log('state.todos[indcat]', state.todos[indcat])
+ console.log('stateparam.todos[indcat]', stateparam.todos[indcat])
}
- function deletemyitem(state: ITodosState, myitem: ITodo) {
+ function deletemyitem(stateparam: ITodosState, myitem: ITodo) {
// Find record
- const indcat = state.categories.indexOf(myitem.category)
- const ind = findIndTodoById(state, { id: myitem._id, categorySel: myitem.category })
+ const indcat = stateparam.categories.indexOf(myitem.category)
+ const ind = findIndTodoById(stateparam, { id: myitem._id, categorySel: myitem.category })
- ApiTables.removeitemfromarray(state.todos[indcat], ind)
+ ApiTables.removeitemfromarray(stateparam.todos[indcat], ind)
+ }
+
+ async function movemyitem(stateparam: ITodosState, { myitemorig, myitemdest } ) {
+
+ const indcat = stateparam.categories.indexOf(myitemorig.category)
+ const indorig = tools.getIndexById(stateparam.todos[indcat], myitemorig._id)
+ let indcatdest = stateparam.categories.indexOf(myitemdest.category)
+
+ console.log('stateparam.categories', stateparam.categories)
+ console.log('myitemdest', myitemdest)
+ console.log('indcat', indcat, 'indcatdest', indcatdest, 'indorig', indorig)
+
+ if (indcatdest === -1) {
+ stateparam.categories.push(myitemdest.category)
+ const newindcat = stateparam.categories.indexOf(myitemdest.category)
+ stateparam.todos[newindcat] = []
+ indcatdest = newindcat
+ }
+
+ stateparam.todos[indcat].splice(indorig, 1)
+ stateparam.todos[indcatdest].push(myitemdest)
+
+ await Actions.actions.modify({ myitem: myitemdest, field: 'category' })
}
export const mutations = {
deletemyitem: b.commit(deletemyitem),
- createNewItem: b.commit(createNewItem)
+ createNewItem: b.commit(createNewItem),
+ movemyitem: b.commit(movemyitem)
}
}
@@ -373,12 +398,42 @@ namespace Actions {
}
+ async function ActionCutPaste(context, action: IAction) {
+ console.log('ActionCutPaste', action)
+
+ if (action.type === tools.MenuAction.CUT) {
+ GlobalStore.state.lastaction = action
+ } else if (action.type === tools.MenuAction.PASTE) {
+ if (GlobalStore.state.lastaction.type === tools.MenuAction.CUT) {
+
+ // Change id_parent
+ const orig_obj = Getters.getters.getRecordById(GlobalStore.state.lastaction._id, GlobalStore.state.lastaction.cat)
+ // const dest = Getters.getters.getRecordById(action._id, action.cat)
+
+ console.log('action', action, 'orig_obj', orig_obj)
+
+ const dest_obj = tools.jsonCopy(orig_obj)
+
+ if (!!dest_obj) {
+ dest_obj.category = action._id
+ dest_obj.modified = true
+ dest_obj.id_prev = null
+
+ GlobalStore.state.lastaction.type = 0
+
+ return await Mutations.mutations.movemyitem({ myitemorig: orig_obj, myitemdest: dest_obj })
+ }
+ }
+ }
+ }
+
export const actions = {
dbLoad: b.dispatch(dbLoad),
swapElems: b.dispatch(swapElems),
deleteItemtodo: b.dispatch(deleteItemtodo),
dbInsert: b.dispatch(dbInsert),
- modify: b.dispatch(modify)
+ modify: b.dispatch(modify),
+ ActionCutPaste: b.dispatch(ActionCutPaste)
}
}
diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts
index 66e8dd6..d2441f1 100644
--- a/src/store/Modules/tools.ts
+++ b/src/store/Modules/tools.ts
@@ -14,6 +14,8 @@ export interface INotify {
}
export const tools = {
+ projects: 'projects',
+ todos: 'todos',
EMPTY: 0,
CALLING: 10,
OK: 20,
@@ -365,8 +367,16 @@ export const tools = {
menuPopupTodo:
{
it: [
+ {
+ id: 5,
+ disable: false,
+ label: 'Taglia',
+ value: 71, // CUT
+ icon: 'undo'
+ },
{
id: 10,
+ disable: false,
label: '',
value: 120, // PROGRESS_BAR
icon: 'rowing',
@@ -374,6 +384,7 @@ export const tools = {
},
{
id: 20,
+ disable: false,
label: 'Imposta Priorità',
value: 130, // PRIORITY
icon: 'rowing',
@@ -381,6 +392,7 @@ export const tools = {
},
{
id: 30,
+ disable: false,
label: 'Completato',
value: 110, // COMPLETED
icon: 'check_circle',
@@ -388,6 +400,7 @@ export const tools = {
},
{
id: 40,
+ disable: false,
label: 'Imposta Scadenza',
value: 101, // TOGGLE_EXPIRING
icon: 'date_range',
@@ -395,6 +408,7 @@ export const tools = {
},
{
id: 50,
+ disable: false,
label: 'Elimina',
value: 100, // DELETE
icon: 'delete',
@@ -403,8 +417,16 @@ export const tools = {
],
es:
[
+ {
+ id: 5,
+ disable: false,
+ label: 'Cortar',
+ value: 71, // CUT
+ icon: 'undo'
+ },
{
id: 10,
+ disable: false,
label: '',
value: 120, // PROGRESS_BAR
icon: 'rowing',
@@ -412,6 +434,7 @@ export const tools = {
},
{
id: 20,
+ disable: false,
label: 'Establecer Prioridad',
value: 130, // PRIORITY
icon: 'rowing',
@@ -419,6 +442,7 @@ export const tools = {
},
{
id: 30,
+ disable: false,
label: 'Completado',
value: 110, // COMPLETED
icon: 'check_circle',
@@ -426,6 +450,7 @@ export const tools = {
},
{
id: 40,
+ disable: false,
label: 'Establecer expiración',
value: 101, // TOGGLE_EXPIRING
icon: 'date_range',
@@ -433,6 +458,7 @@ export const tools = {
},
{
id: 50,
+ disable: false,
label: 'Borrar',
value: 100, // DELETE
icon: 'delete',
@@ -441,8 +467,16 @@ export const tools = {
],
enUs:
[
+ {
+ id: 5,
+ disable: false,
+ label: 'Cut',
+ value: 71, // CUT
+ icon: 'undo'
+ },
{
id: 10,
+ disable: false,
label: '',
value: 120, // PROGRESS_BAR
icon: 'check_circle',
@@ -450,6 +484,7 @@ export const tools = {
},
{
id: 20,
+ disable: false,
label: 'Set Priority',
value: 130, // PRIORITY
icon: 'high_priority',
@@ -457,6 +492,7 @@ export const tools = {
},
{
id: 30,
+ disable: false,
label: 'Completed',
value: 110, // COMPLETED
icon: 'check_circle',
@@ -464,6 +500,7 @@ export const tools = {
},
{
id: 40,
+ disable: false,
label: 'Set Expiring',
value: 101, // TOGGLE_EXPIRING
icon: 'date_range',
@@ -471,6 +508,7 @@ export const tools = {
},
{
id: 50,
+ disable: false,
label: 'Delete',
value: 100, // DELETE
icon: 'trash',
@@ -484,18 +522,21 @@ export const tools = {
it: [
{
id: 5,
+ disable: false,
label: 'Taglia',
value: 71, // CUT
icon: 'undo'
},
{
id: 10,
+ disable: false,
label: 'Modifica',
value: 160, // EDIT
icon: 'create'
},
{
id: 40,
+ disable: false,
label: 'Imposta Scadenza',
value: 101, // TOGGLE_EXPIRING
icon: 'date_range',
@@ -503,6 +544,7 @@ export const tools = {
},
{
id: 50,
+ disable: false,
label: 'Elimina',
value: 100, // DELETE
icon: 'delete',
@@ -513,18 +555,21 @@ export const tools = {
[
{
id: 5,
+ disable: false,
label: 'Cortar',
value: 71, // CUT
icon: 'undo'
},
{
id: 10,
+ disable: false,
label: 'Editar',
value: 160, // EDIT
icon: 'create'
},
{
id: 40,
+ disable: false,
label: 'Establecer expiración',
value: 101, // TOGGLE_EXPIRING
icon: 'date_range',
@@ -532,6 +577,7 @@ export const tools = {
},
{
id: 50,
+ disable: false,
label: 'Borrar',
value: 100, // DELETE
icon: 'delete',
@@ -542,18 +588,21 @@ export const tools = {
[
{
id: 5,
+ disable: false,
label: 'Cut',
value: 71, // CUT
icon: 'undo'
},
{
id: 10,
+ disable: false,
label: 'Edit',
value: 160, // EDIT
icon: 'create'
},
{
id: 40,
+ disable: false,
label: 'Set Expiring',
value: 101, // TOGGLE_EXPIRING
icon: 'date_range',
@@ -561,6 +610,7 @@ export const tools = {
},
{
id: 50,
+ disable: false,
label: 'Delete',
value: 100, // DELETE
icon: 'trash',
@@ -574,6 +624,7 @@ export const tools = {
it: [
{
id: 10,
+ disable: false,
label: 'Mostra Task',
value: 150, // SHOW_TASK
icon: 'rowing'
@@ -583,6 +634,7 @@ export const tools = {
[
{
id: 10,
+ disable: false,
label: 'Mostrar Tareas',
value: 150,
icon: 'rowing'
@@ -592,6 +644,7 @@ export const tools = {
[
{
id: 10,
+ disable: false,
label: 'Show Task',
value: 150,
icon: 'rowing'
diff --git a/src/views/projects/proj-list/proj-list.ts b/src/views/projects/proj-list/proj-list.ts
index db14c65..5e4ea7a 100644
--- a/src/views/projects/proj-list/proj-list.ts
+++ b/src/views/projects/proj-list/proj-list.ts
@@ -171,7 +171,7 @@ export default class ProjList extends Vue {
mymenu = tools.menuPopupConfigProject[UserStore.state.lang]
if (mymenu.length > 0)
- mymenu[0].disable = !(Projects.state.action.type === tools.MenuAction.CUT)
+ mymenu[0].disable = !(GlobalStore.state.lastaction.type === tools.MenuAction.CUT)
return mymenu
}
@@ -191,6 +191,14 @@ export default class ProjList extends Vue {
}
return Math.round(this.itemselproj.hoursworked / this.itemselproj.hoursplanned * 100)
+ }
+ get getCalcHoursLeft() {
+
+ if (this.itemselproj.hoursleft <= 0) {
+ return 0
+ }
+ return Math.round(this.itemselproj.hoursworked / this.itemselproj.hoursleft * 100)
+
}
get calcprogressWeekly() {
@@ -207,7 +215,8 @@ export default class ProjList extends Vue {
try {
- let orerimaste = this.itemselproj.hoursplanned - this.itemselproj.hoursworked
+ // let orerimaste = this.itemselproj.hoursplanned - this.itemselproj.hoursworked
+ let orerimaste = this.itemselproj.hoursleft
if (orerimaste < 0) {
orerimaste = 0
}
@@ -227,7 +236,7 @@ export default class ProjList extends Vue {
console.log(' days', days, 'weeks', weeks, 'orerimaste', orerimaste, 'dateestimated', this.itemselproj.endwork_estimate)
return this.itemselproj.endwork_estimate
- }catch (e) {
+ } catch (e) {
this.itemselproj.endwork_estimate = tools.getDateNull()
}
@@ -379,11 +388,15 @@ export default class ProjList extends Vue {
} else if (action === tools.MenuAction.PASTE) {
const myaction: IAction = {
+ table: GlobalStore.state.lastaction.table,
type: tools.MenuAction.PASTE,
_id: this.itemselproj._id
}
- return await Projects.actions.ActionCutPaste(myaction)
+ if (myaction.table === tools.projects)
+ return await Projects.actions.ActionCutPaste(myaction)
+ else if (myaction.table === tools.todos)
+ return await Todos.actions.ActionCutPaste(myaction)
}
}
diff --git a/src/views/projects/proj-list/proj-list.vue b/src/views/projects/proj-list/proj-list.vue
index 82c2a06..f789315 100644
--- a/src/views/projects/proj-list/proj-list.vue
+++ b/src/views/projects/proj-list/proj-list.vue
@@ -272,6 +272,7 @@
v-model="itemtodosel.descr"
:label="$t('proj.longdescr')"
outlined
+ :readonly="readonly_PanelPrivacy"
debounce="1000"
autogrow>
@@ -283,6 +284,7 @@
@@ -290,6 +292,7 @@
@@ -299,6 +302,7 @@
@@ -329,6 +335,7 @@