diff --git a/src/components/admin/TableOnlyView/tableOnlyView.scss b/src/components/admin/TableOnlyView/tableOnlyView.scss deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/todos/SingleTodo/SingleTodo.ts b/src/components/todos/SingleTodo/SingleTodo.ts index f990db1..b136526 100644 --- a/src/components/todos/SingleTodo/SingleTodo.ts +++ b/src/components/todos/SingleTodo/SingleTodo.ts @@ -403,13 +403,13 @@ export default class SingleTodo extends Vue { this.iconCompleted = 'check_circle_outline' } - if (this.itemtodo.priority === tools.Todos.PRIORITY_HIGH) { + if (this.itemtodo.priority === tools.Priority.PRIORITY_HIGH) { this.iconPriority = 'expand_less' } // expand_less - else if (this.itemtodo.priority === tools.Todos.PRIORITY_NORMAL) { + else if (this.itemtodo.priority === tools.Priority.PRIORITY_NORMAL) { this.iconPriority = 'remove' } - else if (this.itemtodo.priority === tools.Todos.PRIORITY_LOW) { + else if (this.itemtodo.priority === tools.Priority.PRIORITY_LOW) { this.iconPriority = 'expand_more' } // expand_more diff --git a/src/store/Modules/ApiTables.ts b/src/store/Modules/ApiTables.ts index c508410..986a172 100644 --- a/src/store/Modules/ApiTables.ts +++ b/src/store/Modules/ApiTables.ts @@ -9,12 +9,6 @@ export const allTables = ['todos', 'categories', 'sync_post_todos', 'sync_patch_ export const LIST_START = '0' -export const Priority = { - PRIORITY_HIGH: 2, - PRIORITY_NORMAL: 1, - PRIORITY_LOW: 0 -} - export const DB = { CMD_SYNC: 'sync-', CMD_SYNC_NEW: 'sync-new-', @@ -24,7 +18,7 @@ export const DB = { TABLE_DELETE: 'delete_' } -export async function dbInsertSave(call, item, method) { +async function dbInsertSave(call, item, method) { let ret = true if (!('serviceWorker' in navigator)) { @@ -57,7 +51,7 @@ export async function dbInsertSave(call, item, method) { return ret } -export async function dbDeleteItem(call, item) { +async function dbDeleteItem(call, item) { if (!('serviceWorker' in navigator)) { // console.log('dbdeleteItem', item) @@ -81,7 +75,7 @@ export async function dbDeleteItem(call, item) { } } -export async function Sync_Execute(cmd, table, method, item: ITodo, id, msg: String) { +async function Sync_Execute(cmd, table, method, item: ITodo, id, msg: String) { // Send to Server to Sync // console.log('Sync_Execute', cmd, table, method, item.descr, id, msg) @@ -131,7 +125,7 @@ export async function Sync_Execute(cmd, table, method, item: ITodo, id, msg: Str } } -export async function Sync_ExecuteCmd(cmd, nametab: string, table, method, item: ITodo, id, msg: String) { +async function Sync_ExecuteCmd(cmd, nametab: string, table, method, item: ITodo, id, msg: String) { // Send to Server to Sync console.log('Sync_Execute', cmd, table, method, item.descr, id, msg) @@ -187,7 +181,7 @@ export async function aftercalling(ris, checkPending: boolean, nametabindex: str } } -export async function checkPendingMsg() { +async function checkPendingMsg() { // console.log('checkPendingMsg') const config = await globalroutines(null, 'read', 'config', null, '1') @@ -226,7 +220,7 @@ export async function checkPendingMsg() { } // If something in the call of Service Worker went wrong (Network or Server Down), then retry ! -export async function sendSwMsgIfAvailable() { +async function sendSwMsgIfAvailable() { let something = false if ('serviceWorker' in navigator) { @@ -273,7 +267,7 @@ export async function sendSwMsgIfAvailable() { }) } -export async function waitAndRefreshData() { +async function waitAndRefreshData() { return await Todos.actions.dbLoadTodo({ checkPending: false }) } @@ -299,7 +293,7 @@ export async function waitAndcheckPendingMsg() { }) } -export async function updatefromIndexedDbToStateTodo(nametab) { +async function updatefromIndexedDbToStateTodo(nametab) { await globalroutines(null, 'updatefromIndexedDbToStateTodo', nametab, null) .then(() => { console.log('updatefromIndexedDbToStateTodo! ') @@ -340,7 +334,7 @@ sendMessageToSW(recdata, method) { } */ -export function setmodifiedIfchanged(recOut, recIn, field) { +function setmodifiedIfchanged(recOut, recIn, field) { if (String(recOut[field]) !== String(recIn[field])) { // console.log('*************** CAMPO ', field, 'MODIFICATO!', recOut[field], recIn[field]) recOut.modified = true @@ -407,8 +401,3 @@ export function table_DeleteRecord(nametable, myobjtrov, id) { Sync_DeleteItem(nametable, myobjtrov, id) } - -export function isLoggedToSystem() { - const tok = tools.getItemLS(tools.localStorage.token) - return !!tok -} diff --git a/src/store/Modules/GlobalStore.ts b/src/store/Modules/GlobalStore.ts index 0221502..996457e 100644 --- a/src/store/Modules/GlobalStore.ts +++ b/src/store/Modules/GlobalStore.ts @@ -122,7 +122,6 @@ namespace Getters { }) - if (UserStore.state.isAdmin) { state.menulinks = { Dashboard: { @@ -175,6 +174,8 @@ namespace Getters { } } + console.log('___ return getMenu ', state.menulinks) + return state.menulinks }, 'getmenu') @@ -284,7 +285,7 @@ namespace Mutations { console.log('config', config) if (config) { config.value = String(showtype) - Todos.state.showtype = parseInt(config.value) + Todos.state.showtype = parseInt(config.value, 10) } else { Todos.state.showtype = showtype } diff --git a/src/store/Modules/Todos.ts b/src/store/Modules/Todos.ts index f6fedeb..b8d4aec 100644 --- a/src/store/Modules/Todos.ts +++ b/src/store/Modules/Todos.ts @@ -103,10 +103,10 @@ function getLastFirstElemPriority(cat: string, priority: number, atfirst: boolea if (trovato) { return myarr.length - 1 } else { - if (priority === tools.Todos.PRIORITY_LOW) { + if (priority === tools.Priority.PRIORITY_LOW) { return myarr.length - 1 } - else if (priority === tools.Todos.PRIORITY_HIGH) { + else if (priority === tools.Priority.PRIORITY_HIGH) { return 0 } } @@ -150,7 +150,7 @@ function initcat() { _id: objectId(), userId: UserStore.state.userId, descr: '', - priority: tools.Todos.PRIORITY_NORMAL, + priority: tools.Priority.PRIORITY_NORMAL, completed: false, created_at: new Date(), modify_at: new Date(), diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index 92576d2..0c0d94d 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -36,7 +36,7 @@ export const tools = { lang: 'lg' }, - Todos: { + Priority: { PRIORITY_HIGH: 2, PRIORITY_NORMAL: 1, PRIORITY_LOW: 0 @@ -442,10 +442,27 @@ export const tools = { }) }, + dragula_option($service, dragname) { + $service.options(dragname, + { + moves(el, source, handle, sibling) { + return !el.classList.contains('donotdrag') // elements are always draggable by default + }, + accepts(el, target, source, sibling) { + return true // elements can be dropped in any of the `containers` by default + }, + invalid(el, handle) { + return el.classList.contains('donotdrag') // don't prevent any drags from initiating by default + }, + direction: 'vertical' + }) + }, + isLoggedToSystem() { const tok = tools.getItemLS(tools.localStorage.token) return !!tok } + // _.cloneDeep( Per clonare un oggetto } diff --git a/src/views/projects/proj-list/proj-list.ts b/src/views/projects/proj-list/proj-list.ts index c954d0f..109f91a 100644 --- a/src/views/projects/proj-list/proj-list.ts +++ b/src/views/projects/proj-list/proj-list.ts @@ -65,7 +65,6 @@ export default class ProjList extends Vue { public todotop: string = '' public todobottom: string = '' public drag: boolean = true - public startpos: number = 0 public listPriorityLabel: number[] = [] public arrPrior: number[] = [] public itemDragStart: any = null diff --git a/src/views/projects/proj-list/proj-list.vue b/src/views/projects/proj-list/proj-list.vue index ba0c414..068de0c 100644 --- a/src/views/projects/proj-list/proj-list.vue +++ b/src/views/projects/proj-list/proj-list.vue @@ -56,9 +56,9 @@
{{ prior = 0, priorcomplet = false }}
-
+
{ const itemdragend: IDrag = { @@ -264,8 +222,8 @@ export default class Todo extends Vue { // Set last category selected localStorage.setItem(tools.localStorage.categorySel, this.categoryAtt) - for (const todosKey in ApiTables.Priority) { - this.listPriorityLabel.push(ApiTables.Priority[todosKey]) + for (const todosKey in tools.Priority) { + this.listPriorityLabel.push(tools.Priority[todosKey]) } // console.log('Priority:' + this.listPriorityLabel) this.setarrPriority() @@ -348,7 +306,6 @@ export default class Todo extends Vue { return Todos.actions.insertTodo({ myobj, atfirst }) } - public async updateitem({ myitem, field }) { console.log('calling MODIFY updateitem', myitem, field) // Update the others components... @@ -426,17 +383,4 @@ export default class Todo extends Vue { return parseInt(el.attributes.index.value, 10) } - // setArrTodos() { - // - // let mystr = '' - // let mythis = this - // - // mythis.tmpstrTodos = '' - // return globalroutines(null, 'write', 'todos', this.todos_arr[0]) - // .then(function (alldata) { - // mythis.getArrTodos() - // }) - // } - // - } diff --git a/src/views/todo/todo.vue b/src/views/todo/todo.vue index c6f7790..d7c4136 100644 --- a/src/views/todo/todo.vue +++ b/src/views/todo/todo.vue @@ -63,7 +63,7 @@
{{ prior = 0, priorcomplet = false }}
-
+