Move Project
This commit is contained in:
@@ -108,14 +108,22 @@ async function Sync_Execute(cmd, tablesync, nametab, method, item: ITodo, id, ms
|
||||
cmdSw = DB.CMD_SYNC
|
||||
}
|
||||
|
||||
// console.log('cmdSw', cmdSw)
|
||||
|
||||
// if ('serviceWorker' in navigator) {
|
||||
// console.log('serviceWorker PRESENTE')
|
||||
// } else {
|
||||
// console.log('serviceWorker NON PRESENTE !')
|
||||
// }
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
return await navigator.serviceWorker.ready
|
||||
.then((sw) => {
|
||||
// console.log('---------------------- navigator.serviceWorker.ready')
|
||||
|
||||
return globalroutines(null, 'write', tablesync, item, id)
|
||||
.then((id) => {
|
||||
// console.log('id', id)
|
||||
.then((ris) => {
|
||||
console.log('ris write:', ris)
|
||||
const sep = '|'
|
||||
|
||||
const multiparams = cmdSw + sep + tablesync + sep + nametab + sep + method + sep + UserStore.state.x_auth_token + sep + UserStore.state.lang
|
||||
@@ -145,6 +153,9 @@ async function Sync_Execute(cmd, tablesync, nametab, method, item: ITodo, id, ms
|
||||
console.error('Errore in globalroutines', tablesync, nametab, err)
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('Errore catch in globalroutines write', tablesync, nametab, err)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -408,6 +419,7 @@ export async function table_ModifyRecord(nametable, myitem, listFieldsToChange,
|
||||
tools.notifyarraychanged(miorec)
|
||||
|
||||
// 2) Modify on IndexedDb
|
||||
console.log('// 2) Modify on IndexedDb', miorec)
|
||||
return globalroutines(null, 'write', nametable, miorec)
|
||||
.then((ris) => {
|
||||
|
||||
|
||||
@@ -181,15 +181,12 @@ namespace Getters {
|
||||
|
||||
addRoute(arrroutes, { route: '/', faIcon: 'fa fa-home', materialIcon: 'home', name: 'pages.home' }) // HOME
|
||||
|
||||
if (!process.env.PROD) {
|
||||
addRoute(arrroutes, {
|
||||
route: '/todo', faIcon: 'fa fa-list-alt', materialIcon: 'format_list_numbered', name: 'pages.Todo',
|
||||
routes2: lista,
|
||||
level_parent: 0.5,
|
||||
level_child: 0.5
|
||||
})
|
||||
|
||||
}
|
||||
addRoute(arrroutes, {
|
||||
route: '/todo', faIcon: 'fa fa-list-alt', materialIcon: 'format_list_numbered', name: 'pages.Todo',
|
||||
routes2: lista,
|
||||
level_parent: 0.5,
|
||||
level_child: 0.5
|
||||
})
|
||||
|
||||
const myarrproj = []
|
||||
for (const myitem of listaprojectMenu) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IProject, IProjectsState, IDrag, IMenuList } from 'model'
|
||||
import { IProject, IProjectsState, IDrag, IMenuList, IAction } from 'model'
|
||||
import { Privacy } from '@src/model'
|
||||
import { storeBuilder } from './Store/Store'
|
||||
|
||||
@@ -18,7 +18,11 @@ const stateglob: IProjectsState = {
|
||||
showtype: costanti.ShowTypeTask.SHOW_LAST_N_COMPLETED,
|
||||
projects: [],
|
||||
insidePending: false,
|
||||
visuLastCompleted: 10
|
||||
visuLastCompleted: 10,
|
||||
action: {
|
||||
type: 0,
|
||||
_id: ''
|
||||
}
|
||||
}
|
||||
|
||||
const listFieldsToChange: string [] = ['descr', 'longdescr', 'hoursplanned', 'hoursworked', 'id_parent', 'statusproj',
|
||||
@@ -94,7 +98,7 @@ namespace Getters {
|
||||
begin_development: tools.getDateNull(),
|
||||
begin_test: tools.getDateNull(),
|
||||
hoursweeky_plannedtowork: 0,
|
||||
endwork_estimate: tools.getDateNull()
|
||||
endwork_estimate: tools.getDateNull(),
|
||||
}
|
||||
|
||||
return obj
|
||||
@@ -240,10 +244,23 @@ namespace Mutations {
|
||||
ApiTables.removeitemfromarray(state.projects, ind)
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
await Actions.actions.modify({ myitem: myitemdest, field: 'id_parent' })
|
||||
}
|
||||
|
||||
export const mutations = {
|
||||
deletemyitem: b.commit(deletemyitem),
|
||||
createNewItem: b.commit(createNewItem),
|
||||
updateProject: b.commit(updateProject)
|
||||
updateProject: b.commit(updateProject),
|
||||
movemyitem: b.commit(movemyitem)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -380,12 +397,43 @@ 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) {
|
||||
|
||||
// Change id_parent
|
||||
const orig_obj = Getters.getters.getRecordById(stateglob.action._id)
|
||||
const dest = Getters.getters.getRecordById(action._id)
|
||||
|
||||
// console.log('dest', dest)
|
||||
|
||||
const dest_obj = tools.jsonCopy(orig_obj)
|
||||
|
||||
if (!!dest_obj) {
|
||||
dest_obj.id_parent = dest._id
|
||||
dest_obj.id_main_project = dest.id_main_project
|
||||
dest_obj.modified = true
|
||||
dest_obj.id_prev = null
|
||||
|
||||
await Mutations.mutations.movemyitem({ myitemorig: orig_obj, myitemdest: dest_obj })
|
||||
}
|
||||
|
||||
stateglob.action.type = 0
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
dbLoad: b.dispatch(dbLoad),
|
||||
swapElems: b.dispatch(swapElems),
|
||||
deleteItem: b.dispatch(deleteItem),
|
||||
dbInsert: b.dispatch(dbInsert),
|
||||
modify: b.dispatch(modify)
|
||||
modify: b.dispatch(modify),
|
||||
ActionCutPaste: b.dispatch(ActionCutPaste)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,6 +61,8 @@ export const tools = {
|
||||
},
|
||||
|
||||
MenuAction: {
|
||||
CUT: 71,
|
||||
PASTE: 72,
|
||||
DELETE: 100,
|
||||
TOGGLE_EXPIRING: 101,
|
||||
COMPLETED: 110,
|
||||
@@ -480,6 +482,12 @@ export const tools = {
|
||||
|
||||
menuPopupProj: {
|
||||
it: [
|
||||
{
|
||||
id: 5,
|
||||
label: 'Taglia',
|
||||
value: 71, // CUT
|
||||
icon: 'undo'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
label: 'Modifica',
|
||||
@@ -503,6 +511,12 @@ export const tools = {
|
||||
],
|
||||
es:
|
||||
[
|
||||
{
|
||||
id: 5,
|
||||
label: 'Cortar',
|
||||
value: 71, // CUT
|
||||
icon: 'undo'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
label: 'Editar',
|
||||
@@ -526,6 +540,12 @@ export const tools = {
|
||||
],
|
||||
enUs:
|
||||
[
|
||||
{
|
||||
id: 5,
|
||||
label: 'Cut',
|
||||
value: 71, // CUT
|
||||
icon: 'undo'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
label: 'Edit',
|
||||
@@ -582,14 +602,23 @@ export const tools = {
|
||||
|
||||
menuPopupConfigProject: {
|
||||
it: [
|
||||
{
|
||||
id: 3,
|
||||
disable: false,
|
||||
label: translation.it.action.paste,
|
||||
value: 72, // Action.PASTE
|
||||
icon: 'file_copy'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
disable: false,
|
||||
label: translation.it.proj.newsubproj,
|
||||
value: 200, // ADD_PROJECT
|
||||
icon: 'next_week'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
disable: false,
|
||||
label: translation.it.task.showtask,
|
||||
value: 150, // SHOW_TASK
|
||||
icon: 'rowing'
|
||||
@@ -597,14 +626,23 @@ export const tools = {
|
||||
],
|
||||
es:
|
||||
[
|
||||
{
|
||||
id: 3,
|
||||
disable: false,
|
||||
label: translation.es.action.paste,
|
||||
value: 72, // Action.PASTE
|
||||
icon: 'file_copy'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
disable: false,
|
||||
label: translation.es.proj.newsubproj,
|
||||
value: 200, // ADD_PROJECT
|
||||
icon: 'next_week'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
disable: false,
|
||||
label: translation.es.task.showtask,
|
||||
value: 150,
|
||||
icon: 'rowing'
|
||||
@@ -612,14 +650,23 @@ export const tools = {
|
||||
],
|
||||
enUs:
|
||||
[
|
||||
{
|
||||
id: 3,
|
||||
disable: false,
|
||||
label: translation.enUs.action.paste,
|
||||
value: 72, // Action.PASTE
|
||||
icon: 'file_copy'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
label: translation.it.proj.newsubproj,
|
||||
disable: false,
|
||||
label: translation.enUs.proj.newsubproj,
|
||||
value: 200, // ADD_PROJECT
|
||||
icon: 'next_week'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
disable: false,
|
||||
label: translation.enUs.task.showtask,
|
||||
value: 150,
|
||||
icon: 'rowing'
|
||||
@@ -629,8 +676,16 @@ export const tools = {
|
||||
|
||||
menuPopupConfigMAINProject: {
|
||||
it: [
|
||||
{
|
||||
id: 3,
|
||||
disable: false,
|
||||
label: translation.it.action.paste,
|
||||
value: 72, // Action.PASTE
|
||||
icon: 'file_copy'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
disable: false,
|
||||
label: translation.it.proj.newproj,
|
||||
value: 200, // ADD_PROJECT
|
||||
icon: 'next_week'
|
||||
@@ -638,8 +693,16 @@ export const tools = {
|
||||
],
|
||||
es:
|
||||
[
|
||||
{
|
||||
id: 3,
|
||||
disable: false,
|
||||
label: translation.es.action.paste,
|
||||
value: 72, // Action.PASTE
|
||||
icon: 'file_copy'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
disable: false,
|
||||
label: translation.es.proj.newproj,
|
||||
value: 200, // ADD_PROJECT
|
||||
icon: 'next_week'
|
||||
@@ -647,9 +710,17 @@ export const tools = {
|
||||
],
|
||||
enUs:
|
||||
[
|
||||
{
|
||||
id: 3,
|
||||
disable: false,
|
||||
label: translation.enUs.action.paste,
|
||||
value: 72, // Action.PASTE
|
||||
icon: 'file_copy'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
label: translation.it.proj.newproj,
|
||||
disable: false,
|
||||
label: translation.enUs.proj.newproj,
|
||||
value: 200, // ADD_PROJECT
|
||||
icon: 'next_week'
|
||||
}
|
||||
@@ -660,6 +731,7 @@ export const tools = {
|
||||
it: [
|
||||
{
|
||||
id: 10,
|
||||
disable: false,
|
||||
label: 'Mostra gli ultimi N completati',
|
||||
value: costanti.ShowTypeTask.SHOW_LAST_N_COMPLETED,
|
||||
icon: 'rowing',
|
||||
@@ -667,6 +739,7 @@ export const tools = {
|
||||
},
|
||||
{
|
||||
id: 20,
|
||||
disable: false,
|
||||
label: 'Compiti da Completare',
|
||||
value: costanti.ShowTypeTask.SHOW_ONLY_TOCOMPLETE,
|
||||
icon: 'rowing',
|
||||
@@ -674,6 +747,7 @@ export const tools = {
|
||||
},
|
||||
{
|
||||
id: 30,
|
||||
disable: false,
|
||||
label: 'Tutti i compiti',
|
||||
value: costanti.ShowTypeTask.SHOW_ALL,
|
||||
icon: 'check_circle',
|
||||
@@ -684,6 +758,7 @@ export const tools = {
|
||||
[
|
||||
{
|
||||
id: 10,
|
||||
disable: false,
|
||||
label: 'Mostrar los ultimos N completados',
|
||||
value: costanti.ShowTypeTask.SHOW_LAST_N_COMPLETED,
|
||||
icon: 'rowing',
|
||||
@@ -691,6 +766,7 @@ export const tools = {
|
||||
},
|
||||
{
|
||||
id: 20,
|
||||
disable: false,
|
||||
label: 'Tareas para completar',
|
||||
value: costanti.ShowTypeTask.SHOW_ONLY_TOCOMPLETE,
|
||||
icon: 'rowing',
|
||||
@@ -698,6 +774,7 @@ export const tools = {
|
||||
},
|
||||
{
|
||||
id: 30,
|
||||
disable: false,
|
||||
label: 'Todos las Tareas',
|
||||
value: costanti.ShowTypeTask.SHOW_ALL,
|
||||
icon: 'check_circle',
|
||||
@@ -708,6 +785,7 @@ export const tools = {
|
||||
[
|
||||
{
|
||||
id: 10,
|
||||
disable: false,
|
||||
label: 'Show last N Completed',
|
||||
value: costanti.ShowTypeTask.SHOW_LAST_N_COMPLETED,
|
||||
icon: 'rowing',
|
||||
@@ -715,6 +793,7 @@ export const tools = {
|
||||
},
|
||||
{
|
||||
id: 20,
|
||||
disable: false,
|
||||
label: 'Task to complete',
|
||||
value: costanti.ShowTypeTask.SHOW_ONLY_TOCOMPLETE,
|
||||
icon: 'rowing',
|
||||
@@ -722,6 +801,7 @@ export const tools = {
|
||||
},
|
||||
{
|
||||
id: 30,
|
||||
disable: false,
|
||||
label: 'All Tasks',
|
||||
value: costanti.ShowTypeTask.SHOW_ALL,
|
||||
icon: 'check_circle',
|
||||
@@ -1405,6 +1485,6 @@ export const tools = {
|
||||
lista.push(item)
|
||||
}
|
||||
return lista
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@ export const translation = {
|
||||
task: {
|
||||
showtask: 'Mostra Task',
|
||||
},
|
||||
action: {
|
||||
paste: 'Incolla'
|
||||
},
|
||||
end: ''
|
||||
},
|
||||
es: {
|
||||
@@ -31,6 +34,9 @@ export const translation = {
|
||||
task: {
|
||||
showtask: 'Mostrar Tarea',
|
||||
},
|
||||
action: {
|
||||
paste: 'Pegar'
|
||||
},
|
||||
end: ''
|
||||
},
|
||||
enUs: {
|
||||
@@ -48,6 +54,9 @@ export const translation = {
|
||||
task: {
|
||||
showtask: 'Show Task',
|
||||
},
|
||||
action: {
|
||||
paste: 'Paste'
|
||||
},
|
||||
end: ''
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user