diff --git a/quasar.conf.js b/quasar.conf.js index 279e4d2..560c8cb 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -159,6 +159,7 @@ module.exports = function (ctx) { ], // Quasar plugins plugins: [ + 'Dialog', 'Notify', 'Meta', 'Cookies', diff --git a/src/classes/routinestd.ts b/src/classes/routinestd.ts new file mode 100644 index 0000000..bfa4b91 --- /dev/null +++ b/src/classes/routinestd.ts @@ -0,0 +1,18 @@ +export async function askConfirm($q: any, mytitle, mytext, ok, cancel) { + try { + return await $q.dialog({ + title: mytitle, + message: mytext, + ok: ok, + cancel: cancel + }).then((ris) => { + return true + // this.$q.notify('Agreed!') + }).catch(() => { + return false + // this.$q.notify('Disagreed...') + }) + } catch (e) { + return false + } +} diff --git a/src/components/todos/SingleTodo/SingleTodo.scss b/src/components/todos/SingleTodo/SingleTodo.scss index b61583a..b8247e6 100644 --- a/src/components/todos/SingleTodo/SingleTodo.scss +++ b/src/components/todos/SingleTodo/SingleTodo.scss @@ -145,7 +145,7 @@ $heightitem: 19px; } .menuProgress { - width:50px; + } .colProgress { diff --git a/src/components/todos/SingleTodo/SingleTodo.ts b/src/components/todos/SingleTodo/SingleTodo.ts index 3378892..f3e29b2 100644 --- a/src/components/todos/SingleTodo/SingleTodo.ts +++ b/src/components/todos/SingleTodo/SingleTodo.ts @@ -6,12 +6,17 @@ import { UserStore } from '@modules' import { ITodo } from '../../../model/index' +import { SubMenus } from '@components' + + import $ from 'jquery' -import { debounce } from '../../../classes/debounce' +// import { debounce } from '../../../classes/debounce' +import { askConfirm } from '../../../classes/routinestd' @Component({ - name: 'SingleTodo' + name: 'SingleTodo', + components: { SubMenus } }) export default class SingleTodo extends Vue { public selectPriority: [] = [] @@ -32,6 +37,7 @@ export default class SingleTodo extends Vue { public menuProgress: string = 'menuprogress' public percProgress: string = 'percProgress' public colProgress: string = 'blue' + public togglemenu: boolean = false $q: any @Prop({ required: true }) itemtodo: ITodo @@ -304,7 +310,7 @@ export default class SingleTodo extends Vue { clickMenu(action) { console.log('click menu: ', action) if (action === rescodes.MenuAction.DELETE) { - this.removeitem(this.itemtodo.id) + this.askConfirmDelete() } else if (action === rescodes.MenuAction.TOGGLE_EXPIRING) { this.enableExpiring() } else if (action === rescodes.MenuAction.COMPLETED) { @@ -332,4 +338,19 @@ export default class SingleTodo extends Vue { else return this.itemtodo.progress } + + askConfirmDelete() { + const deletestr = this.$t('dialog.delete') + const cancelstr = this.$t('dialog.cancel') + + askConfirm(this.$q, this.$t('dialog.msg.titledeleteTask'), this.$t('dialog.msg.deleteTask').toString(), deletestr, cancelstr) + .then(ris => { + console.log('ris', ris) + if (ris) + this.removeitem(this.itemtodo.id) + }).catch(err => { + + }) + } + } diff --git a/src/components/todos/SingleTodo/SingleTodo.vue b/src/components/todos/SingleTodo/SingleTodo.vue index af44643..16a3048 100644 --- a/src/components/todos/SingleTodo/SingleTodo.vue +++ b/src/components/todos/SingleTodo/SingleTodo.vue @@ -1,93 +1,69 @@ + + diff --git a/src/components/todos/SubMenus/index.ts b/src/components/todos/SubMenus/index.ts new file mode 100644 index 0000000..c15b8fd --- /dev/null +++ b/src/components/todos/SubMenus/index.ts @@ -0,0 +1 @@ +export {default as SubMenus} from './SubMenus.vue' diff --git a/src/components/todos/index.ts b/src/components/todos/index.ts index fb3b7c1..23bd0c5 100644 --- a/src/components/todos/index.ts +++ b/src/components/todos/index.ts @@ -1,2 +1,3 @@ export * from './SingleTodo' +export * from './SubMenus' export * from './todo' diff --git a/src/components/todos/todo/todo.scss b/src/components/todos/todo/todo.scss index 453338f..bb62af9 100644 --- a/src/components/todos/todo/todo.scss +++ b/src/components/todos/todo/todo.scss @@ -59,9 +59,17 @@ min-height: 10px; } +.divtitlecat { + margin: 5px; + padding: 5px; +} + .categorytitle{ + color:blue; + background-color: lightblue; font-size: 1.25rem; font-weight: bold; + text-align: center; } .titleSubMenu { diff --git a/src/components/todos/todo/todo.ts b/src/components/todos/todo/todo.ts index e05703d..af939b1 100644 --- a/src/components/todos/todo/todo.ts +++ b/src/components/todos/todo/todo.ts @@ -508,7 +508,7 @@ export default class Todo extends Vue { // } // - deselectAllRows(item, check, onlythis:boolean = false) { + deselectAllRows(item, check, onlythis: boolean = false) { console.log('deselectAllRows : ', item) for (let i = 0; i < this.$refs.single.length; i++) { diff --git a/src/components/todos/todo/todo.vue b/src/components/todos/todo/todo.vue index 090d1c2..a01f401 100644 --- a/src/components/todos/todo/todo.vue +++ b/src/components/todos/todo/todo.vue @@ -3,7 +3,9 @@

-
{{ getCategory() }}
+
+
{{ getCategory() }}
+
{{ prior = 0, priorcomplet = false }}
diff --git a/src/i18n.js b/src/i18n.js index 7c2ea4a..5687c04 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -1,5 +1,15 @@ const messages = { it: { + dialog: { + yes: 'Si', + no: 'No', + delete: 'Elimina', + cancel: 'Annulla', + msg: { + titledeleteTask: 'Cancella Task', + deleteTask: 'Vuoi cancellare questo Task?' + } + }, comp:{ Conta: "Conta", }, @@ -16,6 +26,9 @@ const messages = { Test: 'Test', Category: 'Categorie', Todo: 'Todo', + personal: 'Personale', + work: 'Lavoro', + shopping: 'Spesa', }, components: { authentication:{ @@ -92,6 +105,16 @@ const messages = { } }, enUk: { + dialog: { + yes: 'Yes', + no: 'No', + delete: 'Delete', + cancel: 'Cancel', + msg: { + titledeleteTask: 'Delete Task', + deleteTask: 'Delete this Task?' + } + }, comp:{ Conta: "Count", }, @@ -108,6 +131,9 @@ const messages = { Test: 'Test', Category: 'Category', Todo: 'Todo', + personal: 'Personal', + work: 'Work', + shopping: 'Shopping', }, components: { authentication:{ diff --git a/src/layouts/drawer/drawer.vue b/src/layouts/drawer/drawer.vue index d3b9f75..fc56086 100644 --- a/src/layouts/drawer/drawer.vue +++ b/src/layouts/drawer/drawer.vue @@ -38,6 +38,7 @@ import { Store } from 'vuex' import { UserStore } from '@modules' import { GlobalStore } from '@modules' + import { ITodoList } from "../../model"; @Component({ @@ -48,40 +49,48 @@ export default class Drawer extends Vue { public $q $t: any + public arrlista = GlobalStore.state.listatodo + photo = '' + user = null + links created() { console.log('Drawer created...') + + let listatodo = [] + + this.arrlista.forEach((elem: ITodoList) => { + let item = { route: '/todo/' + elem.namecat, faIcon: 'fa fa-list-alt', materialIcon: 'todo', name: 'pages.' + elem.description } + listatodo.push(item) + + }) + + this.links = { + Dashboard: { + routes: [ + { route: '/', faIcon: 'fa fa-home', materialIcon: 'home', name: 'pages.home' }, + { + route: '/todo', faIcon: 'fa fa-list-alt', materialIcon: 'todo', name: 'pages.Todo', + routes2: listatodo + }, + { route: '/category', faIcon: 'fa fa-list-alt', materialIcon: 'category', name: 'pages.Category' }, + { route: '/signup', faIcon: 'fa fa-registered', materialIcon: 'home', name: 'pages.SignUp' }, + { route: '/signin', faIcon: 'fa fa-anchor', materialIcon: 'home', name: 'pages.SignIn' }, + /* {route: '/vreg?idlink=aaa', faIcon: 'fa fa-login', materialIcon: 'login', name: 'pages.vreg'},*/ + ], + show: true, + }, + Forms: { + routes: [ + { route: '/prec', faIcon: 'fa fa-search', materialIcon: 'search', name: 'pages.Test' }, + ], + show: false + }, + } + } - Glo - photo = '' - user = null - links = { - Dashboard: { - routes: [ - { route: '/', faIcon: 'fa fa-home', materialIcon: 'home', name: 'pages.home' }, - { - route: '/todo', faIcon: 'fa fa-list-alt', materialIcon: 'todo', name: 'pages.Todo', - routes2: [ - { route: '/todo/personal', faIcon: 'fa fa-list-alt', materialIcon: 'todo', name: 'Personal' }, - { route: '/todo/work', faIcon: 'fa fa-list-alt', materialIcon: 'todo', name: 'Work' } - ] - }, - { route: '/category', faIcon: 'fa fa-list-alt', materialIcon: 'category', name: 'pages.Category' }, - { route: '/signup', faIcon: 'fa fa-registered', materialIcon: 'home', name: 'pages.SignUp' }, - { route: '/signin', faIcon: 'fa fa-anchor', materialIcon: 'home', name: 'pages.SignIn' }, - /* {route: '/vreg?idlink=aaa', faIcon: 'fa fa-login', materialIcon: 'login', name: 'pages.vreg'},*/ - ], - show: true, - }, - Forms: { - routes: [ - { route: '/prec', faIcon: 'fa fa-search', materialIcon: 'search', name: 'pages.Test' }, - ], - show: false - }, - } get MenuCollapse() { return GlobalStore.state.menuCollapse diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts index c1e0f0d..48a784f 100644 --- a/src/model/GlobalStore.ts +++ b/src/model/GlobalStore.ts @@ -10,5 +10,12 @@ export interface IGlobalState { menuCollapse: boolean leftDrawerOpen: boolean posts: IPost[] + listatodo: ITodoList[] +} + + +export interface ITodoList { + namecat: string + description: string } diff --git a/src/plugins/dialog.js b/src/plugins/dialog.js new file mode 100644 index 0000000..5b145d3 --- /dev/null +++ b/src/plugins/dialog.js @@ -0,0 +1,5 @@ +import Dialog from 'quasar' + +export default ({ Vue }) => { + Vue.use(Dialog) +} diff --git a/src/router/route-config.ts b/src/router/route-config.ts index 9b80a94..c2cccc0 100644 --- a/src/router/route-config.ts +++ b/src/router/route-config.ts @@ -27,7 +27,13 @@ export const RouteConfig: VueRouteConfig[] = [ { path: '/todo/:category', component: () => import('@/components/todos/todo/todo.vue'), - meta: { name: 'Todos' } + meta: { name: 'Todos' }, + children: [ + { + path: '', + component: () => import('@/components/todos/SingleTodo/SingleTodo.vue') + } + ] }, { path: '/category', diff --git a/src/store/Modules/GlobalStore.ts b/src/store/Modules/GlobalStore.ts index 0633489..8f5d78b 100644 --- a/src/store/Modules/GlobalStore.ts +++ b/src/store/Modules/GlobalStore.ts @@ -9,7 +9,12 @@ const state: IGlobalState = { mobileMode: false, menuCollapse: true, leftDrawerOpen: true, - posts: [] + posts: [], + listatodo: [ + {namecat: 'personal', description: 'personal'}, + {namecat: 'work', description: 'work'}, + {namecat: 'shopping', description: 'shopping'} + ] } const b = storeBuilder.module('GlobalModule', state) @@ -18,10 +23,15 @@ const b = storeBuilder.module('GlobalModule', state) namespace Getters { const conta = b.read(state => state.conta, 'conta') + const listatodo = b.read(state => state.listatodo, 'listatodo') export const getters = { get conta() { return conta() + }, + + get listaTodo() { + return listatodo() } } } diff --git a/src/store/Modules/rescodes.ts b/src/store/Modules/rescodes.ts index 6ceaf6d..85abf4c 100644 --- a/src/store/Modules/rescodes.ts +++ b/src/store/Modules/rescodes.ts @@ -28,7 +28,8 @@ export const rescodes = { DELETE: 100, TOGGLE_EXPIRING: 101, COMPLETED: 110, - PROGRESS_BAR: 120 + PROGRESS_BAR: 120, + PRIORITY: 130 }, @@ -79,28 +80,35 @@ export const rescodes = { menuPopupTodo: { 'it': [ { - id: 1, - label: 'Progressi', + id: 10, + label: '', value: 120, // PROGRESS_BAR - icon: 'check_circle', + icon: 'rowing', checked: true }, { - id: 2, + id: 20, + label: 'Imposta Priorità', + value: 130, // PRIORITY + icon: 'rowing', + checked: false + }, + { + id: 30, label: 'Completato', value: 110, // COMPLETED icon: 'check_circle', checked: true }, { - id: 3, + id: 40, label: 'Imposta Scadenza', value: 101, // TOGGLE_EXPIRING icon: 'date_range', checked: true }, { - id: 10, + id: 50, label: 'Cancella', value: 100, // DELETE icon: 'delete', @@ -109,28 +117,35 @@ export const rescodes = { ], 'enUk': [ { - id: 1, - label: 'Progress', + id: 10, + label: '', value: 120, // PROGRESS_BAR icon: 'check_circle', checked: true }, { - id: 2, + id: 20, + label: 'Set Priority', + value: 130, // PRIORITY + icon: 'high_priority', + checked: false + }, + { + id: 30, label: 'Completed', value: 110, // COMPLETED icon: 'check_circle', checked: true }, { - id: 3, + id: 40, label: 'Set Expiring', value: 101, // TOGGLE_EXPIRING icon: 'date_range', checked: true }, { - id: 10, + id: 50, label: 'Delete', value: 100, // DELETE icon: 'trash',