Cut/Paste project and todos

This commit is contained in:
Paolo Arena
2019-04-29 01:01:31 +02:00
parent 2ba3cd6b3f
commit d6d527e1a8
14 changed files with 218 additions and 71 deletions

View File

@@ -20,6 +20,7 @@ export default class CProgress extends Vue {
@Prop({ required: true }) public progressval: number @Prop({ required: true }) public progressval: number
@Prop() public descr: string @Prop() public descr: string
@Prop({ default: false }) public slider: boolean @Prop({ default: false }) public slider: boolean
@Prop({ default: false }) public readonly: boolean
@Watch('progressval') @Watch('progressval')
public valchanged(value) { public valchanged(value) {

View File

@@ -3,6 +3,7 @@
<div class="flex-item progress-item shadow-1"> <div class="flex-item progress-item shadow-1">
<q-slider v-if="slider" label <q-slider v-if="slider" label
class="cpr-slider-item" class="cpr-slider-item"
:readonly="readonly"
:value="progressval" :value="progressval"
:min="0" :min="0"
:max="100" :max="100"
@@ -12,6 +13,7 @@
<q-linear-progress <q-linear-progress
v-else v-else
stripe stripe
:readonly="readonly"
rounded rounded
:value="progressval / 100" :value="progressval / 100"
class="cpr-progrbar-item" class="cpr-progrbar-item"

View File

@@ -10,6 +10,7 @@ import { SubMenusProj } from '../SubMenusProj'
import { CDate } from '../../CDate' import { CDate } from '../../CDate'
import { date } from 'quasar' import { date } from 'quasar'
import { GlobalStore } from '@store'
@Component({ @Component({
components: { SubMenusProj, CDate }, components: { SubMenusProj, CDate },
@@ -488,6 +489,7 @@ export default class SingleProject extends Vue {
this.activeEdit() this.activeEdit()
} else if (action === tools.MenuAction.CUT) { } else if (action === tools.MenuAction.CUT) {
const myaction = { const myaction = {
table: tools.projects,
type: tools.MenuAction.CUT, type: tools.MenuAction.CUT,
_id: this.itemproject._id _id: this.itemproject._id
} }

View File

@@ -1,7 +1,7 @@
import Vue from 'vue' import Vue from 'vue'
import { Component, Prop, Watch } from 'vue-property-decorator' import { Component, Prop, Watch } from 'vue-property-decorator'
import { UserStore } from '@modules' import { Projects, UserStore } from '@modules'
import { tools } from '../../../store/Modules/tools' import { tools } from '../../../store/Modules/tools'
import { ITodo } from '../../../model/index' import { ITodo } from '../../../model/index'
@@ -460,6 +460,14 @@ export default class SingleTodo extends Vue {
return await this.setCompleted() return await this.setCompleted()
} else if (action === tools.MenuAction.PROGRESS_BAR) { } else if (action === tools.MenuAction.PROGRESS_BAR) {
return await this.updatedata('progress') return await this.updatedata('progress')
} else if (action === tools.MenuAction.CUT) {
const myaction = {
table: tools.todos,
type: tools.MenuAction.CUT,
_id: this.itemtodo._id,
cat: this.itemtodo.category
}
return await Projects.actions.ActionCutPaste(myaction)
} else if (action === 0) { } else if (action === 0) {
this.deselectAndExitEdit() this.deselectAndExitEdit()
} }

View File

@@ -1,6 +1,7 @@
import { costanti } from "@src/store/Modules/costanti" import { costanti } from "@src/store/Modules/costanti"
import { UserStore } from "@store" import { UserStore } from "@store"
import { tools } from '@src/store/Modules/tools' import { tools } from '@src/store/Modules/tools'
import { IAction } from '@src/model/Projects'
export interface IPost { export interface IPost {
title: string title: string
@@ -58,6 +59,7 @@ export interface IGlobalState {
menulinks: {} menulinks: {}
listatodo: IMenuList[] listatodo: IMenuList[]
arrConfig: IConfig[] arrConfig: IConfig[]
lastaction: IAction
} }
export interface IMenuList { export interface IMenuList {

View File

@@ -3,8 +3,10 @@ import { UserStore } from '@store'
import { tools } from '@src/store/Modules/tools' import { tools } from '@src/store/Modules/tools'
export interface IAction { export interface IAction {
table: string
type: number type: number
_id: any _id: any
cat?: string
} }
export interface IProject { export interface IProject {
@@ -31,6 +33,7 @@ export interface IProject {
live_url?: string live_url?: string
test_url?: string test_url?: string
hoursplanned?: number hoursplanned?: number
hoursleft?: number
hoursworked?: number hoursworked?: number
progressCalc?: number progressCalc?: number
begin_development?: Date begin_development?: Date
@@ -48,7 +51,6 @@ export interface IProjectsState {
projects: IProject[] projects: IProject[]
insidePending: boolean insidePending: boolean
visuLastCompleted: number visuLastCompleted: number
action: IAction
} }
export const Privacy = { export const Privacy = {

View File

@@ -1,3 +1,5 @@
import { IAction } from '@src/model/Projects'
export interface ITodo { export interface ITodo {
_id?: any, _id?: any,
userId?: string userId?: string

View File

@@ -506,6 +506,7 @@ const messages = {
insertbottom: 'Añadir nuevo Proyecto', insertbottom: 'Añadir nuevo Proyecto',
longdescr: 'Descripción', longdescr: 'Descripción',
hoursplanned: 'Horas Estimadas', hoursplanned: 'Horas Estimadas',
hoursleft: 'Horas Restantes',
hoursadded: 'Horas Adicional', hoursadded: 'Horas Adicional',
hoursworked: 'Horas Trabajadas', hoursworked: 'Horas Trabajadas',
begin_development: 'Comienzo desarrollo', begin_development: 'Comienzo desarrollo',
@@ -763,6 +764,7 @@ const messages = {
insertbottom: 'Insert New Project', insertbottom: 'Insert New Project',
longdescr: 'Description', longdescr: 'Description',
hoursplanned: 'Estimated Hours', hoursplanned: 'Estimated Hours',
hoursleft: 'Left Hours',
hoursadded: 'Additional Hours', hoursadded: 'Additional Hours',
hoursworked: 'Worked Hours', hoursworked: 'Worked Hours',
begin_development: 'Start Dev', begin_development: 'Start Dev',

View File

@@ -51,7 +51,12 @@ const state: IGlobalState = {
downloading_server: 0, downloading_server: 0,
downloading_indexeddb: 0 downloading_indexeddb: 0
}, },
arrConfig: [] arrConfig: [],
lastaction: {
table: '',
type: 0,
_id: 0
}
} }
async function getConfig(id) { async function getConfig(id) {

View File

@@ -18,19 +18,15 @@ const stateglob: IProjectsState = {
showtype: costanti.ShowTypeTask.SHOW_LAST_N_COMPLETED, showtype: costanti.ShowTypeTask.SHOW_LAST_N_COMPLETED,
projects: [], projects: [],
insidePending: false, insidePending: false,
visuLastCompleted: 10, visuLastCompleted: 10
action: {
type: 0,
_id: ''
}
} }
const listFieldsToChange: string [] = ['descr', 'longdescr', 'hoursplanned', 'hoursworked', 'id_parent', 'statusproj', const listFieldsToChange: string [] = ['descr', 'longdescr', 'hoursplanned', 'hoursleft', 'hoursworked', 'id_parent', 'statusproj',
'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progressCalc', 'live_url', 'test_url', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progressCalc', 'live_url', 'test_url',
'begin_development', 'begin_test', 'actualphase', 'totalphases', 'hoursweeky_plannedtowork', 'endwork_estimate', 'begin_development', 'begin_test', 'actualphase', 'totalphases', 'hoursweeky_plannedtowork', 'endwork_estimate',
'privacyread', 'privacywrite', 'id_main_project', 'typeproj', 'favourite'] 'privacyread', 'privacywrite', 'id_main_project', 'typeproj', 'favourite']
const listFieldsUpdateCalculation: string [] = ['hoursplanned', 'hoursworked', 'progressCalc', 'endwork_estimate'] const listFieldsUpdateCalculation: string [] = ['hoursplanned', 'hoursleft', 'hoursworked', 'progressCalc', 'endwork_estimate']
const b = storeBuilder.module<IProjectsState>('Projects', stateglob) const b = storeBuilder.module<IProjectsState>('Projects', stateglob)
const stateGetter = b.state() const stateGetter = b.state()
@@ -92,13 +88,14 @@ namespace Getters {
actualphase: 1, actualphase: 1,
hoursworked: 0, hoursworked: 0,
hoursplanned: 0, hoursplanned: 0,
hoursleft: 0,
progressCalc: 0, progressCalc: 0,
privacyread: 'onlyme', privacyread: 'onlyme',
privacywrite: 'onlyme', privacywrite: 'onlyme',
begin_development: tools.getDateNull(), begin_development: tools.getDateNull(),
begin_test: tools.getDateNull(), begin_test: tools.getDateNull(),
hoursweeky_plannedtowork: 0, hoursweeky_plannedtowork: 0,
endwork_estimate: tools.getDateNull(), endwork_estimate: tools.getDateNull()
} }
return obj return obj
@@ -247,9 +244,6 @@ namespace Mutations {
async function movemyitem(state: IProjectsState, { myitemorig, myitemdest } ) { async function movemyitem(state: IProjectsState, { myitemorig, myitemdest } ) {
const indorig = tools.getIndexById(state.projects, myitemorig._id) 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.splice(indorig, 1)
state.projects.push(myitemdest) state.projects.push(myitemdest)
@@ -399,13 +393,13 @@ namespace Actions {
async function ActionCutPaste(context, action: IAction) { async function ActionCutPaste(context, action: IAction) {
if (action.type === tools.MenuAction.CUT) if (action.type === tools.MenuAction.CUT) {
stateglob.action = action GlobalStore.state.lastaction = action
else if (action.type === tools.MenuAction.PASTE) { } else if (action.type === tools.MenuAction.PASTE) {
if (stateglob.action.type === tools.MenuAction.CUT) { if (GlobalStore.state.lastaction.type === tools.MenuAction.CUT) {
// Change id_parent // 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) const dest = Getters.getters.getRecordById(action._id)
// console.log('dest', dest) // console.log('dest', dest)
@@ -418,13 +412,12 @@ namespace Actions {
dest_obj.modified = true dest_obj.modified = true
dest_obj.id_prev = null 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 = { export const actions = {

View File

@@ -11,6 +11,7 @@ import { serv_constants } from '@src/store/Modules/serv_constants'
import { GetterTree } from 'vuex' import { GetterTree } from 'vuex'
import objectId from '@src/js/objectId' import objectId from '@src/js/objectId'
import { costanti } from '@src/store/Modules/costanti' import { costanti } from '@src/store/Modules/costanti'
import { IAction } from '@src/model'
const nametable = 'todos' const nametable = 'todos'
@@ -46,7 +47,7 @@ function gettodosByCategory(category: string): [] {
function initcat() { function initcat() {
let rec = Getters.getters.getRecordEmpty() const rec = Getters.getters.getRecordEmpty()
rec.userId = UserStore.state.userId rec.userId = UserStore.state.userId
return rec return rec
@@ -54,7 +55,7 @@ function initcat() {
} }
namespace Getters { namespace Getters {
const getRecordEmpty = b.read((state: ITodosState) => (): ITodo => { const getRecordEmpty = b.read((stateparamf: ITodosState) => (): ITodo => {
const tomorrow = tools.getDateNow() const tomorrow = tools.getDateNow()
tomorrow.setDate(tomorrow.getDate() + 1) tomorrow.setDate(tomorrow.getDate() + 1)
@@ -81,32 +82,32 @@ namespace Getters {
assigned_to_userId: '', assigned_to_userId: '',
hoursplanned: 0, hoursplanned: 0,
hoursworked: 0, hoursworked: 0,
start_date: tools.getDateNull(), start_date: tools.getDateNull()
} }
// return this.copy(objtodo) // return this.copy(objtodo)
return objtodo return objtodo
}, 'getRecordEmpty') }, '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) const indcat = getindexbycategory(cat)
// console.log('items_dacompletare', 'indcat', indcat, state.todos[indcat]) // console.log('items_dacompletare', 'indcat', indcat, stateparam.todos[indcat])
if (state.todos[indcat]) { if (stateparam.todos[indcat]) {
return state.todos[indcat].filter((todo) => todo.statustodo !== tools.Status.COMPLETED) return stateparam.todos[indcat].filter((todo) => todo.statustodo !== tools.Status.COMPLETED)
} else { } else {
return [] return []
} }
}, 'items_dacompletare') }, '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) const indcat = getindexbycategory(cat)
if (state.todos[indcat]) { if (stateparam.todos[indcat]) {
if (state.showtype === costanti.ShowTypeTask.SHOW_LAST_N_COMPLETED) { // Show only the first N completed if (stateparam.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) 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 [] return []
} }
else if (state.showtype === costanti.ShowTypeTask.SHOW_ALL) { else if (stateparam.showtype === costanti.ShowTypeTask.SHOW_ALL) {
return state.todos[indcat].filter((todo) => todo.statustodo === tools.Status.COMPLETED) return stateparam.todos[indcat].filter((todo) => todo.statustodo === tools.Status.COMPLETED)
} }
else { else {
return [] return []
@@ -116,22 +117,22 @@ namespace Getters {
} }
}, 'todos_completati') }, '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 return getters.todos_completati(cat).length
}, 'doneTodosCount') }, 'doneTodosCount')
const TodosCount = b.read((state: ITodosState) => (cat: string): number => { const TodosCount = b.read((stateparam: ITodosState) => (cat: string): number => {
const indcat = getindexbycategory(cat) const indcat = getindexbycategory(cat)
if (state.todos[indcat]) { if (stateparam.todos[indcat]) {
return state.todos[indcat].length return stateparam.todos[indcat].length
} else { } else {
return 0 return 0
} }
}, 'TodosCount') }, '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) const indcat = getindexbycategory(cat)
if (state.todos) { if (stateparam.todos) {
return state.todos[indcat].find((item) => item._id === id) return stateparam.todos[indcat].find((item) => item._id === id)
} }
return null return null
}, 'getRecordById') }, 'getRecordById')
@@ -160,49 +161,73 @@ namespace Getters {
namespace Mutations { namespace Mutations {
function findIndTodoById(state: ITodosState, data: IParamTodo) { function findIndTodoById(stateparam: ITodosState, data: IParamTodo) {
const indcat = state.categories.indexOf(data.categorySel) const indcat = stateparam.categories.indexOf(data.categorySel)
if (indcat >= 0) { if (indcat >= 0) {
return tools.getIndexById(state.todos[indcat], data.id) return tools.getIndexById(stateparam.todos[indcat], data.id)
} }
return -1 return -1
} }
function createNewItem(state: ITodosState, { objtodo, atfirst, categorySel }) { function createNewItem(stateparam: ITodosState, { objtodo, atfirst, categorySel }) {
let indcat = state.categories.indexOf(categorySel) let indcat = stateparam.categories.indexOf(categorySel)
if (indcat == -1) { if (indcat === -1) {
state.categories.push(categorySel) stateparam.categories.push(categorySel)
indcat = state.categories.indexOf(categorySel) indcat = stateparam.categories.indexOf(categorySel)
} }
console.log('createNewItem', objtodo, 'cat=', categorySel, 'state.todos[indcat]', state.todos[indcat]) console.log('createNewItem', objtodo, 'cat=', categorySel, 'stateparam.todos[indcat]', stateparam.todos[indcat])
if (state.todos[indcat] === undefined) { if (stateparam.todos[indcat] === undefined) {
state.todos[indcat] = [] stateparam.todos[indcat] = []
state.todos[indcat].push(objtodo) stateparam.todos[indcat].push(objtodo)
console.log('push state.todos[indcat]', state.todos) console.log('push stateparam.todos[indcat]', stateparam.todos)
return return
} }
if (atfirst) { if (atfirst) {
state.todos[indcat].unshift(objtodo) stateparam.todos[indcat].unshift(objtodo)
} }
else { 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 // Find record
const indcat = state.categories.indexOf(myitem.category) const indcat = stateparam.categories.indexOf(myitem.category)
const ind = findIndTodoById(state, { id: myitem._id, categorySel: 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 = { export const mutations = {
deletemyitem: b.commit(deletemyitem), 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 = { export const actions = {
dbLoad: b.dispatch(dbLoad), dbLoad: b.dispatch(dbLoad),
swapElems: b.dispatch(swapElems), swapElems: b.dispatch(swapElems),
deleteItemtodo: b.dispatch(deleteItemtodo), deleteItemtodo: b.dispatch(deleteItemtodo),
dbInsert: b.dispatch(dbInsert), dbInsert: b.dispatch(dbInsert),
modify: b.dispatch(modify) modify: b.dispatch(modify),
ActionCutPaste: b.dispatch(ActionCutPaste)
} }
} }

View File

@@ -14,6 +14,8 @@ export interface INotify {
} }
export const tools = { export const tools = {
projects: 'projects',
todos: 'todos',
EMPTY: 0, EMPTY: 0,
CALLING: 10, CALLING: 10,
OK: 20, OK: 20,
@@ -365,8 +367,16 @@ export const tools = {
menuPopupTodo: menuPopupTodo:
{ {
it: [ it: [
{
id: 5,
disable: false,
label: 'Taglia',
value: 71, // CUT
icon: 'undo'
},
{ {
id: 10, id: 10,
disable: false,
label: '', label: '',
value: 120, // PROGRESS_BAR value: 120, // PROGRESS_BAR
icon: 'rowing', icon: 'rowing',
@@ -374,6 +384,7 @@ export const tools = {
}, },
{ {
id: 20, id: 20,
disable: false,
label: 'Imposta Priorità', label: 'Imposta Priorità',
value: 130, // PRIORITY value: 130, // PRIORITY
icon: 'rowing', icon: 'rowing',
@@ -381,6 +392,7 @@ export const tools = {
}, },
{ {
id: 30, id: 30,
disable: false,
label: 'Completato', label: 'Completato',
value: 110, // COMPLETED value: 110, // COMPLETED
icon: 'check_circle', icon: 'check_circle',
@@ -388,6 +400,7 @@ export const tools = {
}, },
{ {
id: 40, id: 40,
disable: false,
label: 'Imposta Scadenza', label: 'Imposta Scadenza',
value: 101, // TOGGLE_EXPIRING value: 101, // TOGGLE_EXPIRING
icon: 'date_range', icon: 'date_range',
@@ -395,6 +408,7 @@ export const tools = {
}, },
{ {
id: 50, id: 50,
disable: false,
label: 'Elimina', label: 'Elimina',
value: 100, // DELETE value: 100, // DELETE
icon: 'delete', icon: 'delete',
@@ -403,8 +417,16 @@ export const tools = {
], ],
es: es:
[ [
{
id: 5,
disable: false,
label: 'Cortar',
value: 71, // CUT
icon: 'undo'
},
{ {
id: 10, id: 10,
disable: false,
label: '', label: '',
value: 120, // PROGRESS_BAR value: 120, // PROGRESS_BAR
icon: 'rowing', icon: 'rowing',
@@ -412,6 +434,7 @@ export const tools = {
}, },
{ {
id: 20, id: 20,
disable: false,
label: 'Establecer Prioridad', label: 'Establecer Prioridad',
value: 130, // PRIORITY value: 130, // PRIORITY
icon: 'rowing', icon: 'rowing',
@@ -419,6 +442,7 @@ export const tools = {
}, },
{ {
id: 30, id: 30,
disable: false,
label: 'Completado', label: 'Completado',
value: 110, // COMPLETED value: 110, // COMPLETED
icon: 'check_circle', icon: 'check_circle',
@@ -426,6 +450,7 @@ export const tools = {
}, },
{ {
id: 40, id: 40,
disable: false,
label: 'Establecer expiración', label: 'Establecer expiración',
value: 101, // TOGGLE_EXPIRING value: 101, // TOGGLE_EXPIRING
icon: 'date_range', icon: 'date_range',
@@ -433,6 +458,7 @@ export const tools = {
}, },
{ {
id: 50, id: 50,
disable: false,
label: 'Borrar', label: 'Borrar',
value: 100, // DELETE value: 100, // DELETE
icon: 'delete', icon: 'delete',
@@ -441,8 +467,16 @@ export const tools = {
], ],
enUs: enUs:
[ [
{
id: 5,
disable: false,
label: 'Cut',
value: 71, // CUT
icon: 'undo'
},
{ {
id: 10, id: 10,
disable: false,
label: '', label: '',
value: 120, // PROGRESS_BAR value: 120, // PROGRESS_BAR
icon: 'check_circle', icon: 'check_circle',
@@ -450,6 +484,7 @@ export const tools = {
}, },
{ {
id: 20, id: 20,
disable: false,
label: 'Set Priority', label: 'Set Priority',
value: 130, // PRIORITY value: 130, // PRIORITY
icon: 'high_priority', icon: 'high_priority',
@@ -457,6 +492,7 @@ export const tools = {
}, },
{ {
id: 30, id: 30,
disable: false,
label: 'Completed', label: 'Completed',
value: 110, // COMPLETED value: 110, // COMPLETED
icon: 'check_circle', icon: 'check_circle',
@@ -464,6 +500,7 @@ export const tools = {
}, },
{ {
id: 40, id: 40,
disable: false,
label: 'Set Expiring', label: 'Set Expiring',
value: 101, // TOGGLE_EXPIRING value: 101, // TOGGLE_EXPIRING
icon: 'date_range', icon: 'date_range',
@@ -471,6 +508,7 @@ export const tools = {
}, },
{ {
id: 50, id: 50,
disable: false,
label: 'Delete', label: 'Delete',
value: 100, // DELETE value: 100, // DELETE
icon: 'trash', icon: 'trash',
@@ -484,18 +522,21 @@ export const tools = {
it: [ it: [
{ {
id: 5, id: 5,
disable: false,
label: 'Taglia', label: 'Taglia',
value: 71, // CUT value: 71, // CUT
icon: 'undo' icon: 'undo'
}, },
{ {
id: 10, id: 10,
disable: false,
label: 'Modifica', label: 'Modifica',
value: 160, // EDIT value: 160, // EDIT
icon: 'create' icon: 'create'
}, },
{ {
id: 40, id: 40,
disable: false,
label: 'Imposta Scadenza', label: 'Imposta Scadenza',
value: 101, // TOGGLE_EXPIRING value: 101, // TOGGLE_EXPIRING
icon: 'date_range', icon: 'date_range',
@@ -503,6 +544,7 @@ export const tools = {
}, },
{ {
id: 50, id: 50,
disable: false,
label: 'Elimina', label: 'Elimina',
value: 100, // DELETE value: 100, // DELETE
icon: 'delete', icon: 'delete',
@@ -513,18 +555,21 @@ export const tools = {
[ [
{ {
id: 5, id: 5,
disable: false,
label: 'Cortar', label: 'Cortar',
value: 71, // CUT value: 71, // CUT
icon: 'undo' icon: 'undo'
}, },
{ {
id: 10, id: 10,
disable: false,
label: 'Editar', label: 'Editar',
value: 160, // EDIT value: 160, // EDIT
icon: 'create' icon: 'create'
}, },
{ {
id: 40, id: 40,
disable: false,
label: 'Establecer expiración', label: 'Establecer expiración',
value: 101, // TOGGLE_EXPIRING value: 101, // TOGGLE_EXPIRING
icon: 'date_range', icon: 'date_range',
@@ -532,6 +577,7 @@ export const tools = {
}, },
{ {
id: 50, id: 50,
disable: false,
label: 'Borrar', label: 'Borrar',
value: 100, // DELETE value: 100, // DELETE
icon: 'delete', icon: 'delete',
@@ -542,18 +588,21 @@ export const tools = {
[ [
{ {
id: 5, id: 5,
disable: false,
label: 'Cut', label: 'Cut',
value: 71, // CUT value: 71, // CUT
icon: 'undo' icon: 'undo'
}, },
{ {
id: 10, id: 10,
disable: false,
label: 'Edit', label: 'Edit',
value: 160, // EDIT value: 160, // EDIT
icon: 'create' icon: 'create'
}, },
{ {
id: 40, id: 40,
disable: false,
label: 'Set Expiring', label: 'Set Expiring',
value: 101, // TOGGLE_EXPIRING value: 101, // TOGGLE_EXPIRING
icon: 'date_range', icon: 'date_range',
@@ -561,6 +610,7 @@ export const tools = {
}, },
{ {
id: 50, id: 50,
disable: false,
label: 'Delete', label: 'Delete',
value: 100, // DELETE value: 100, // DELETE
icon: 'trash', icon: 'trash',
@@ -574,6 +624,7 @@ export const tools = {
it: [ it: [
{ {
id: 10, id: 10,
disable: false,
label: 'Mostra Task', label: 'Mostra Task',
value: 150, // SHOW_TASK value: 150, // SHOW_TASK
icon: 'rowing' icon: 'rowing'
@@ -583,6 +634,7 @@ export const tools = {
[ [
{ {
id: 10, id: 10,
disable: false,
label: 'Mostrar Tareas', label: 'Mostrar Tareas',
value: 150, value: 150,
icon: 'rowing' icon: 'rowing'
@@ -592,6 +644,7 @@ export const tools = {
[ [
{ {
id: 10, id: 10,
disable: false,
label: 'Show Task', label: 'Show Task',
value: 150, value: 150,
icon: 'rowing' icon: 'rowing'

View File

@@ -171,7 +171,7 @@ export default class ProjList extends Vue {
mymenu = tools.menuPopupConfigProject[UserStore.state.lang] mymenu = tools.menuPopupConfigProject[UserStore.state.lang]
if (mymenu.length > 0) 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 return mymenu
} }
@@ -191,6 +191,14 @@ export default class ProjList extends Vue {
} }
return Math.round(this.itemselproj.hoursworked / this.itemselproj.hoursplanned * 100) 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() { get calcprogressWeekly() {
@@ -207,7 +215,8 @@ export default class ProjList extends Vue {
try { 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) { if (orerimaste < 0) {
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) console.log(' days', days, 'weeks', weeks, 'orerimaste', orerimaste, 'dateestimated', this.itemselproj.endwork_estimate)
return this.itemselproj.endwork_estimate return this.itemselproj.endwork_estimate
}catch (e) { } catch (e) {
this.itemselproj.endwork_estimate = tools.getDateNull() this.itemselproj.endwork_estimate = tools.getDateNull()
} }
@@ -379,11 +388,15 @@ export default class ProjList extends Vue {
} else if (action === tools.MenuAction.PASTE) { } else if (action === tools.MenuAction.PASTE) {
const myaction: IAction = { const myaction: IAction = {
table: GlobalStore.state.lastaction.table,
type: tools.MenuAction.PASTE, type: tools.MenuAction.PASTE,
_id: this.itemselproj._id _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)
} }
} }

View File

@@ -272,6 +272,7 @@
v-model="itemtodosel.descr" v-model="itemtodosel.descr"
:label="$t('proj.longdescr')" :label="$t('proj.longdescr')"
outlined outlined
:readonly="readonly_PanelPrivacy"
debounce="1000" debounce="1000"
autogrow> autogrow>
@@ -283,6 +284,7 @@
<q-icon class="flex-item flex-icon" name="done_outline"/> <q-icon class="flex-item flex-icon" name="done_outline"/>
<div class="flex-item itemstatus"> <div class="flex-item itemstatus">
<q-select rounded outlined v-model="itemtodosel.statustodo" :options="selectStatus" <q-select rounded outlined v-model="itemtodosel.statustodo" :options="selectStatus"
:readonly="readonly_PanelPrivacy"
:label="$t('todo.status')" emit-value map-options :label="$t('todo.status')" emit-value map-options
@input="modifyfieldtodo('statustodo')"> @input="modifyfieldtodo('statustodo')">
</q-select> </q-select>
@@ -290,6 +292,7 @@
<q-icon class="flex-item flex-icon" name="outlined_flag"/> <q-icon class="flex-item flex-icon" name="outlined_flag"/>
<div class="flex-item itemstatus"> <div class="flex-item itemstatus">
<q-select rounded outlined v-model="itemtodosel.phase" :options="selectPhase" <q-select rounded outlined v-model="itemtodosel.phase" :options="selectPhase"
:readonly="readonly_PanelPrivacy"
:label="$t('todo.phase')" emit-value map-options> :label="$t('todo.phase')" emit-value map-options>
</q-select> </q-select>
</div> </div>
@@ -299,6 +302,7 @@
<div class="flex-item itemdescr"> <div class="flex-item itemdescr">
<q-input <q-input
ref="input5" ref="input5"
:readonly="readonly_PanelPrivacy"
v-model="itemtodosel.hoursworked" v-model="itemtodosel.hoursworked"
type="number" type="number"
rounded outlined rounded outlined
@@ -312,6 +316,7 @@
<div class="flex-item itemdata content-center"> <div class="flex-item itemdata content-center">
<q-input <q-input
ref="input6" ref="input6"
:readonly="readonly_PanelPrivacy"
type="number" type="number"
v-model="itemtodosel.hoursplanned" v-model="itemtodosel.hoursplanned"
rounded outlined rounded outlined
@@ -321,6 +326,7 @@
</q-input> </q-input>
<CProgress :descr="$t('proj.progresstask')" <CProgress :descr="$t('proj.progresstask')"
:readonly="readonly_PanelPrivacy"
:progressval="itemtodosel.progress" :progressval="itemtodosel.progress"
:slider="true" @input="itemtodosel.progress = arguments[0]"></CProgress> :slider="true" @input="itemtodosel.progress = arguments[0]"></CProgress>
</div> </div>
@@ -329,6 +335,7 @@
<q-icon class="flex-item flex-icon" name="developer_mode"/> <q-icon class="flex-item flex-icon" name="developer_mode"/>
<div class="flex-item itemdata"> <div class="flex-item itemdata">
<CDate :mydate="itemtodosel.start_date" <CDate :mydate="itemtodosel.start_date"
:readonly="readonly_PanelPrivacy"
@input="itemtodosel.start_date = new Date(arguments[0])" @input="itemtodosel.start_date = new Date(arguments[0])"
:label="$t('todo.start_date')"> :label="$t('todo.start_date')">
@@ -337,7 +344,7 @@
<div style="margin: 10px;"></div> <div style="margin: 10px;"></div>
<q-icon class="flex-item flex-icon" name="event"/> <q-icon class="flex-item flex-icon" name="event"/>
<div class="flex-item itemdata"> <div class="flex-item itemdata">
<CDate :readonly="itemtodosel.statustodo !== tools.Status.COMPLETED" <CDate :readonly="((itemtodosel.statustodo !== tools.Status.COMPLETED) || readonly_PanelPrivacy)"
:mydate="itemtodosel.completed_at" :mydate="itemtodosel.completed_at"
@input="itemtodosel.completed_at = new Date(arguments[0])" @input="itemtodosel.completed_at = new Date(arguments[0])"
:label="$t('todo.completed_at')"> :label="$t('todo.completed_at')">