diff --git a/.env.development b/.env.development index 13c95d3..fea6886 100644 --- a/.env.development +++ b/.env.development @@ -6,7 +6,7 @@ LANG_DEFAULT='it' MONGODB_HOST='http://localhost:3000' PAO_APP_ID='KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF' MASTER_KEY='KKPPSS5KJK435J3KSS9F9D8S9F8SD3CR3T' -LOGO_REG='quasar-logo-full.svg' +LOGO_REG='freeplanet-logo-full.svg' TEST_EMAIL='paolo.arena77@gmail.com' TEST_USERNAME='paoloar77' TEST_PASSWORD='mypassword@1A' diff --git a/package-lock.json b/package-lock.json index 74763de..0c3bf32 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10611,6 +10611,11 @@ "integrity": "sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=", "dev": true }, + "gsap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/gsap/-/gsap-2.0.2.tgz", + "integrity": "sha512-WyT0uuDNb+5xMccx4SsVcI1CwvIL0BPgP8TyJJmMWT/btGXUNtKesnkXFMMshYs37renFhDo1P5NEoizeonviQ==" + }, "gzip-size": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-5.0.0.tgz", @@ -13267,6 +13272,11 @@ "topo": "3.0.3" } }, + "jquery": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", + "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg==" + }, "js-base64": { "version": "2.4.9", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.4.9.tgz", @@ -22397,6 +22407,11 @@ "is-plain-obj": "1.1.0" } }, + "sortablejs": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.7.0.tgz", + "integrity": "sha1-gKKyNwq9Vo4c7IwnETHvMKkE+ig=" + }, "source-list-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", @@ -24377,6 +24392,14 @@ "integrity": "sha512-x3LV3wdmmERhVCYy3quqA57NJW7F3i6faas++pJQWtknWT+n7k30F4TVdHvCLn48peTJFRvCpxs3UuFPqgeELg==", "dev": true }, + "vuedraggable": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/vuedraggable/-/vuedraggable-2.17.0.tgz", + "integrity": "sha512-TAC5tJTSbHSINQCSB59qHnuzT0Ad+E3IgvSWuA1e9UaebD8DxKaY1tCdvL3XvuLoaM3wc1dhpP/NbjpdxYsrng==", + "requires": { + "sortablejs": "1.7.0" + } + }, "vueify": { "version": "9.4.1", "resolved": "https://registry.npmjs.org/vueify/-/vueify-9.4.1.tgz", diff --git a/package.json b/package.json index d0192e6..f48f25a 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,8 @@ "google-translate-api": "^2.3.0", "graphql": "^0.13.2", "graphql-tag": "^2.8.0", + "gsap": "^2.0.2", + "jquery": "^3.3.1", "js-cookie": "^2.2.0", "localforage": "^1.7.3", "normalize.css": "^8.0.0", @@ -44,6 +46,7 @@ "vue-property-decorator": "^7.2.0", "vue-router": "^3.0.1", "vue-svgicon": "^3.1.0", + "vuedraggable": "^2.17.0", "vuelidate": "^0.7.4", "vuex": "^3.0.1", "vuex-class": "^0.3.1", diff --git a/quasar.conf.js b/quasar.conf.js index e148d2f..8183b7e 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -118,11 +118,13 @@ module.exports = function (ctx) { 'QToolbar', 'QToolbarTitle', 'QBtn', + 'QBtnDropdown', 'QIcon', 'QList', 'QListHeader', 'QItem', 'QItemMain', + 'QItemTile', 'QItemSide', 'QCard', 'QCardTitle', @@ -182,31 +184,16 @@ module.exports = function (ctx) { description: 'Social project in order to connecting people each others (working in progress...)', display: 'standalone', orientation: 'portrait', + theme_color: '#ffffff', background_color: '#ffffff', - theme_color: '#027be3', icons: [ { - 'src': 'statics/icons/icon-128x128.png', - 'sizes': '128x128', - 'type': 'image/png' - }, - { - 'src': 'statics/icons/icon-192x192.png', + 'src': 'statics/icons/android-chrome-192x192.png', 'sizes': '192x192', 'type': 'image/png' }, { - 'src': 'statics/icons/icon-256x256.png', - 'sizes': '256x256', - 'type': 'image/png' - }, - { - 'src': 'statics/icons/icon-384x384.png', - 'sizes': '384x384', - 'type': 'image/png' - }, - { - 'src': 'statics/icons/icon-512x512.png', + 'src': 'statics/icons/android-chrome-512x512', 'sizes': '512x512', 'type': 'image/png' } diff --git a/src/assets/quasar-logo-full.svg b/src/assets/quasar-logo-full.svg deleted file mode 100644 index 30d7561..0000000 --- a/src/assets/quasar-logo-full.svg +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/components/categories/SingleCat/SingleCat.ts b/src/components/categories/SingleCat/SingleCat.ts index 900000c..5d61c5a 100644 --- a/src/components/categories/SingleCat/SingleCat.ts +++ b/src/components/categories/SingleCat/SingleCat.ts @@ -1,8 +1,6 @@ import Vue from 'vue' import { Component, Prop } from 'vue-property-decorator' -require('./SingleCat.scss') - import { ICategory } from '../../../model/index' @Component({ diff --git a/src/components/categories/SingleCat/SingleCat.vue b/src/components/categories/SingleCat/SingleCat.vue index fbcc2ed..2ea4518 100644 --- a/src/components/categories/SingleCat/SingleCat.vue +++ b/src/components/categories/SingleCat/SingleCat.vue @@ -17,3 +17,7 @@ + + diff --git a/src/components/categories/category/category.ts b/src/components/categories/category/category.ts index f5806cf..fa2f45e 100644 --- a/src/components/categories/category/category.ts +++ b/src/components/categories/category/category.ts @@ -4,8 +4,6 @@ import { Component, Watch } from 'vue-property-decorator' import { SingleCat } from '@components' import { ICategory } from '@src/model' -require('./category.scss') - @Component({ components: { SingleCat } @@ -25,13 +23,15 @@ export default class Category extends Vue { id: 0, descr_it: 'Frozen Yogurt', descr_en: '', - descr_es: '' + descr_es: '', + campo2bool: true }, { id: 1, descr_it: 'Secondo', descr_en: '', - descr_es: '' + descr_es: '', + campo2bool: false }] columns: any [] = [ @@ -59,6 +59,14 @@ export default class Category extends Vue { field: 'descr_es', sortable: true, classes: 'my-class', + }, + { + name: 'campo2bool', + label: 'campo2bool', + align: 'left', + field: 'campo2bool', + sortable: true, + classes: 'my-class', } ] @@ -82,7 +90,8 @@ export default class Category extends Vue { const objcat: ICategory = { descr_it: '', descr_en: '', - descr_es: '' + descr_es: '', + campo2bool: true } return objcat diff --git a/src/components/categories/category/category.vue b/src/components/categories/category/category.vue index 9cce5a3..1d9eff6 100644 --- a/src/components/categories/category/category.vue +++ b/src/components/categories/category/category.vue @@ -53,7 +53,7 @@ - + @@ -61,3 +61,7 @@ + + diff --git a/src/components/categories/index.ts b/src/components/categories/index.ts index a391328..fb62135 100644 --- a/src/components/categories/index.ts +++ b/src/components/categories/index.ts @@ -1,2 +1,3 @@ export * from './SingleCat' export * from './category' +export * from './tabledata' diff --git a/src/components/categories/tabledata/index.ts b/src/components/categories/tabledata/index.ts new file mode 100644 index 0000000..5825f39 --- /dev/null +++ b/src/components/categories/tabledata/index.ts @@ -0,0 +1 @@ +export {default as TableData} from './tabledata.vue' diff --git a/src/components/categories/tabledata/tabledata.scss b/src/components/categories/tabledata/tabledata.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/components/categories/tabledata/tabledata.ts b/src/components/categories/tabledata/tabledata.ts new file mode 100644 index 0000000..7bb46c1 --- /dev/null +++ b/src/components/categories/tabledata/tabledata.ts @@ -0,0 +1,204 @@ +import Vue from 'vue' +import { Component, Watch } from 'vue-property-decorator' + +import { ICategory } from '@src/model' + +@Component({ +}) +export default class Tabledata extends Vue { + $q: any + + filter: boolean = false + title: string = '' + category: string = '' + categories_loc: any[] = [{}] + categories_arr: any[] = [{}] + selected: any [] = [] + selectedSecond: any [] = [] + + data: any [] = [{ + id: 0, + descr_it: 'Frozen Yogurt', + descr_en: '', + descr_es: '' + }, + { + id: 1, + descr_it: 'Secondo', + descr_en: '', + descr_es: '' + }] + + columns: any [] = [ + { + name: 'descr_it', + required: true, + label: 'IT', + align: 'left', + field: 'descr_it', + sortable: true, + classes: 'my-class', + }, + { + name: 'descr_en', + label: 'EN', + align: 'left', + field: 'descr_en', + sortable: true, + classes: 'my-class', + }, + { + name: 'descr_es', + label: 'ES', + align: 'left', + field: 'descr_es', + sortable: true, + classes: 'my-class', + }, + { + name: 'campo2bool', + label: 'campo2bool', + align: 'left', + field: 'campo2bool', + sortable: true, + classes: 'my-class', + } + ] + + @Watch('categories_loc') valueChanged() { + this.updatetable() + } + + + created() { + this.loadCat() + } + + async loadCat() { + await this.$db.categories.toArray().then(ris => this.categories_loc = ris) + + this.updatetable() + } + + initcat() { + + const objcat: ICategory = { + descr_it: '', + descr_en: '', + descr_es: '', + campo2bool: false + } + return objcat + + } + + async insertCategory() { + + const objcat = this.initcat() + + let myid = 0 + objcat.descr_it = this.category + + // Add to Indexdb + await this.$db.categories.add(objcat + ).then(ris => { + myid = ris + }) + + objcat.id = myid + + // Add into the memory + this.categories_loc.push(objcat) + + // empty the field + this.category = '' + } + + async deleteCategory(myarrobj) { + + await myarrobj.forEach(myobj => { + + if (myobj.id !== undefined) { + console.log('KEY = ', myobj.id) + + // Delete item + let deleteCount = this.$db.categories + .where('id').equals(myobj.id) + .delete() + + console.log('deleteCount = ', deleteCount) + if (deleteCount > 0) { + // Remove into the memory + this.categories_loc.splice(this.categories_loc.indexOf(myobj), 1) + + this.updatetable() + + return deleteCount + } + } + }) + + } + + updatetable() { + + this.filterCategories() + this.categories_arr = [...this.categories_loc] + + } + + async filterCategories() { + + if (this.filter) { + // #Todo If need to filter the output database ... + this.$db.categories + .where('descr_it').notEqual('nonlovedi') + .toArray() + .then((response) => { + Promise.all(response.map(key => key)) + .then((myarr) => { + this.categories_loc = [...myarr] + return this.categories_loc + }) + }) + } else { + return this.categories_loc + } + } + + deleteRow() { + console.log('SEL = ', this.selectedSecond) + + const seldel = [...this.selectedSecond] + if (this.deleteCategory(this.selectedSecond)) { + this.$q.notify({ + color: 'primary', + icon: 'delete', + message: `Deleted ` + (seldel.length.toString()) + ' item' + }) + + + } + + } + + /* + await db.transaction('rw', [db.friends], async () => { + const friend = await db.friends.get(1); + ++friend.age; + await db.friends.put(friend); + }); + */ + + async modify() { + // esempio da sistemare + await this.$db.transaction('rw', [this.$db.categories], async () => { + const friend = await this.$db.get(1) + ++friend.age + await this.$db.put(friend) + }) + + } + + +} diff --git a/src/components/categories/tabledata/tabledata.vue b/src/components/categories/tabledata/tabledata.vue new file mode 100644 index 0000000..3ed1aac --- /dev/null +++ b/src/components/categories/tabledata/tabledata.vue @@ -0,0 +1,65 @@ + + + + diff --git a/src/components/index.ts b/src/components/index.ts index f81a1f4..99a6bf5 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1,2 +1,4 @@ export * from './categories' +export * from './todos' +export * from './logo' diff --git a/src/components/logo/index.ts b/src/components/logo/index.ts new file mode 100644 index 0000000..3691656 --- /dev/null +++ b/src/components/logo/index.ts @@ -0,0 +1 @@ +export {default as Logo} from './logo.vue' diff --git a/src/components/logo/logo.scss b/src/components/logo/logo.scss new file mode 100644 index 0000000..5307147 --- /dev/null +++ b/src/components/logo/logo.scss @@ -0,0 +1,29 @@ +.svgclass{ + color: white; + transform: translateY(0px); + +} + +.svgclass_animate { + transform: translateY(-70px); + color: red; +} + +#sun { + animation: gravity 5s infinite; + +} + +@keyframes gravity{ + 0%{ + transform: rotateY(0deg); + } + 100%{ + transform: rotateY(360deg); + } +} + +#smile{ + opacity: 0.1 !important; + fill: red; +} diff --git a/src/components/logo/logo.ts b/src/components/logo/logo.ts new file mode 100644 index 0000000..17f7d8c --- /dev/null +++ b/src/components/logo/logo.ts @@ -0,0 +1,53 @@ +import Vue from 'vue' +import { Component } from 'vue-property-decorator' + +import { TimelineLite, Back } from 'gsap' + +import $ from 'jquery' +import Timeout = NodeJS.Timeout + +@Component({ + +}) +export default class Logo extends Vue { + logoimg: string = '' + + created() { + this.logoimg = 'statics/' + process.env.LOGO_REG + this.animate() + } + + animate () { + const timeline = new TimelineLite() + + /* + + let mysmile = $('#smile') + + mysmile.attr('class', 'smile_hide') + + setTimeout(() => { + mysmile.removeClass('smilevisible') + mysmile.addClass('smile_hide') + }, 1000) + + + setTimeout(() => { + mysmile.addClass('smilevisible') + mysmile.removeClass('smile_hide') + }, 10000) + + */ + + + /* + timeline.to('#smile', 5, { + cy: 20, + cx: 60, + ease: Back.easeInOut // Specify an ease + }) + */ + + } + +} diff --git a/src/components/logo/logo.vue b/src/components/logo/logo.vue new file mode 100644 index 0000000..65c27c7 --- /dev/null +++ b/src/components/logo/logo.vue @@ -0,0 +1,11 @@ + + + + diff --git a/src/components/todos/SingleTodo/SingleTodo.scss b/src/components/todos/SingleTodo/SingleTodo.scss new file mode 100644 index 0000000..01852da --- /dev/null +++ b/src/components/todos/SingleTodo/SingleTodo.scss @@ -0,0 +1,115 @@ +.flex-item{ + background-color: #d5e2eb; + padding: 1px; + margin: 1px; + color: #000; + font-size: 0.85rem; + flex: 1 1 auto; +} + +.flex-container2 { + flex-flow: row nowrap; + justify-content: space-between; +} + +.btn-item { + max-width: 24px; +} + + +.pos-item { + max-width: 24px; + min-width: 24px; + margin: 0 auto; + height: 36px; + line-height: 36px; + text-align: center; +} + +.priority-item-popover { + max-width: 24px; + min-width: 24px; + padding: 0px; +} + +.priority-item { + max-width: 24px; + min-width: 24px; +} + +.completed-item { + max-width: 24px; + min-width: 24px; +} + +.myexpired { + padding-top: 0px; + padding-bottom: 0px; + font-size: 12px; +} + +.data-item { + max-width: 100px; + min-width: 100px; + display: block; + visibility: initial; +} + +@media screen and (max-width: 600px) { + .data-item { + display: none; + visibility: hidden; + content: ""; + } +} + + +.div_descr { + // background-color: green; + flex: 2 1 auto; +} + + +.appsingletodo { + color: black; + font-size: 1.0rem; + // display: flex; + margin: 1px; + padding: 2px; + border: 1px; + background-color: #e1ebed; +} + +.mycols{ + margin: 1px; + padding: 2px; + //width: 40px; + // border-color: #8a8484; + // border-style: outset; + margin: auto; + // flex-grow: 1; +} + + + +.mycols:hover{ + +} + +.mybtn{ + width: 18px; + height: 18px; +} + +.icon_completed { + position: relative; + transform: translateY(0%); +} + +.mydescr{ +} + + +.icon_completed:hover { + color: darkgreen; +} diff --git a/src/components/todos/SingleTodo/SingleTodo.ts b/src/components/todos/SingleTodo/SingleTodo.ts new file mode 100644 index 0000000..3d118c3 --- /dev/null +++ b/src/components/todos/SingleTodo/SingleTodo.ts @@ -0,0 +1,79 @@ +import Vue from 'vue' +import { Component, Prop, Watch } from 'vue-property-decorator' + +import { rescodes } from '../../../store/Modules/rescodes' +import { UserStore } from '@modules' + +import { ITodo } from '../../../model/index' + +@Component({ + name: 'SingleTodo' +}) +export default class SingleTodo extends Vue { + public selectPriority: [] = [] + public iconCompleted: string = '' + public iconPriority: string = '' + public popover: boolean = false + $q: any + + @Prop({required: true}) itemtodo: ITodo + + @Watch('itemtodo.completed') valueChanged() { + this.$emit('eventupdate', this.itemtodo) + } + @Watch('itemtodo.expiring_at') valueChanged2() { + this.$emit('eventupdate', this.itemtodo) + } + @Watch('itemtodo.priority') valueChanged3() { + this.$emit('eventupdate', this.itemtodo) + } + + setCompleted () { + // console.log('setCompleted') + this.itemtodo.completed = !this.itemtodo.completed + + this.updateicon() + + this.updatedata() + } + + updatedata() { + this.$emit('eventupdate', this.itemtodo) + } + + updateicon () { + if (this.itemtodo.completed) + this.iconCompleted = 'check_circle' + else + this.iconCompleted = 'check_circle_outline' + + + if (this.itemtodo.priority === rescodes.Todos.PRIORITY_HIGH) + this.iconPriority = 'expand_less' // expand_less + else if (this.itemtodo.priority === rescodes.Todos.PRIORITY_NORMAL) + this.iconPriority = 'remove' + else if (this.itemtodo.priority === rescodes.Todos.PRIORITY_LOW) + this.iconPriority = 'expand_more' // expand_more + + } + + created() { + this.updateicon() + + this.selectPriority = rescodes.selectPriority[UserStore.state.lang] + + } + + remove(id) { + this.$emit('event', id) + } + + setPriority (newpriority) { + + this.itemtodo.priority = newpriority + + this.updatedata() + + // this.$q.notify('setPriority: ' + elem) + } +} diff --git a/src/components/todos/SingleTodo/SingleTodo.vue b/src/components/todos/SingleTodo/SingleTodo.vue new file mode 100644 index 0000000..fef32df --- /dev/null +++ b/src/components/todos/SingleTodo/SingleTodo.vue @@ -0,0 +1,55 @@ + + + + + diff --git a/src/components/todos/SingleTodo/index.ts b/src/components/todos/SingleTodo/index.ts new file mode 100644 index 0000000..f8fe0ed --- /dev/null +++ b/src/components/todos/SingleTodo/index.ts @@ -0,0 +1 @@ +export {default as SingleTodo} from './SingleTodo.vue' diff --git a/src/components/todos/index.ts b/src/components/todos/index.ts new file mode 100644 index 0000000..fb3b7c1 --- /dev/null +++ b/src/components/todos/index.ts @@ -0,0 +1,2 @@ +export * from './SingleTodo' +export * from './todo' diff --git a/src/components/todos/todo/index.ts b/src/components/todos/todo/index.ts new file mode 100644 index 0000000..2f2129f --- /dev/null +++ b/src/components/todos/todo/index.ts @@ -0,0 +1 @@ +export {default as Todo} from './todo.vue' diff --git a/src/components/todos/todo/todo.scss b/src/components/todos/todo/todo.scss new file mode 100644 index 0000000..a706668 --- /dev/null +++ b/src/components/todos/todo/todo.scss @@ -0,0 +1,13 @@ +.flex-container{ + background-color: #ccc; + padding: 5px; + display: flex; + flex-flow: row nowrap; + justify-content: space-between; +} + + + +.mycard { + visibility: hidden; +} diff --git a/src/components/todos/todo/todo.ts b/src/components/todos/todo/todo.ts new file mode 100644 index 0000000..08b55f2 --- /dev/null +++ b/src/components/todos/todo/todo.ts @@ -0,0 +1,221 @@ +import Vue from 'vue' +import { Component, Watch } from 'vue-property-decorator' + +import { SingleTodo } from '@components' +import { ITodo } from '@src/model' + +import { rescodes } from '../../../store/Modules/rescodes' + +import { UserStore } from '@modules' + +import _ from 'lodash' + +import draggable from 'vuedraggable' + +@Component({ + components: { SingleTodo, draggable } +}) +export default class Todo extends Vue { + $q: any + + filter: boolean = false + title: string = '' + todo: string = '' + todos_arr: any[] = [{}] + drag: boolean = true + startpos: number = 0 + endpos: number = 0 + + @Watch('drag') changedrag() { + console.log('drag = ' + this.drag) + } + + change(param) { + console.log('Change... ' + param) + } + + onStart() { + this.startpos = 0 + } + + getpos(indelem) { + return this.todos_arr[indelem].pos + } + + onEnd(myvar) { + let oldpos = this.getpos(myvar.oldIndex) + let newpos = this.getpos(myvar.newIndex) + + console.log('onEnd old = ' + oldpos + ' new = ' + newpos) + if (myvar.oldIndex < myvar.newIndex) { + // c'è spazio + newpos = oldpos - 1 + if (newpos <= 0) + newpos = 1 + } else { + newpos = newpos + 1 + } + + console.log('newpos = ' + newpos) + + if (newpos >= 0) { + let myobj = this.todos_arr[myvar.oldIndex] + console.log('posprec = ' + myobj.pos) + myobj.pos = newpos + this.modify(myobj) + + } + } + + + created() { + this.loadCat() + } + + showlistaTodos(nomelista = '') { + + // console.log('todos_arr: ') + this.todos_arr.forEach((todo, key) => { + console.log('Todo n"' + key + ': ' + todo) + }) + } + + loadCat() { + this.updatetable() + } + + initcat() { + + const mydateexp = new Date().setDate((new Date()).getDate() + 1) + + const objtodo: ITodo = { + userId: UserStore.state.userId, + descr: '', + pos: -1, + priority: rescodes.Todos.PRIORITY_NORMAL, + completed: false, + created_at: new Date(), + modify_at: new Date(), + expiring_at: mydateexp + } + return objtodo + + } + + getLastPos() { + let max = 0 + this.todos_arr.forEach(myobj => { + if (myobj.pos > max) + max = myobj.pos + }) + + return max + 1 + + } + + async insertTodo() { + + const objtodo = this.initcat() + + let myid = 0 + objtodo.descr = this.todo + objtodo.pos = this.getLastPos() + + // Add to Indexdb + await this.$db.todos.add(objtodo + ).then(() => { + this.updatetable() + }).catch(err => { + console.log('Errore: ' + err.message) + }) + + // empty the field + this.todo = '' + } + + getobjbyid(id) { + let myobjtrov = null + this.todos_arr.forEach(myobj => { + if (myobj.id === id) + myobjtrov = myobj + }) + + return myobjtrov + } + + deleteitem(id) { + // console.log('deleteitem: KEY = ', id) + + let myobjtrov = this.getobjbyid(id) + + if (myobjtrov !== null) { + // Delete item + this.$db.todos + .where('id').equals(id) + .delete() + .then(() => { + this.updatetable() + }) + } + } + + async updatetable() { + await this.filtertodos() + } + + async filtertodos() { + + if (this.filter) { + // #Todo If need to filter the output database ... + await this.$db.todos + .where('userId').equals(UserStore.state.userId) + .toArray() + .then((response) => { + Promise.all(response.map(key => key)) + .then((ristodos) => { + this.todos_arr = ristodos + }) + }) + } else { + + await this.$db.todos + .where('userId').equals(UserStore.state.userId) + + .toArray().then(ristodos => { + this.todos_arr = ristodos + }) + + this.todos_arr = _.orderBy(this.todos_arr, ['completed', 'priority', 'pos'], ['asc', 'desc', 'asc']) + } + + this.todos_arr.map((item, index) => { + item.pos = (index * 2) + 1 + }) + return [] + } + + updateitem(myobj) { + console.log('updateitem') + this.modify(myobj) + } + + + async modify(myobj) { + await this.$db.transaction('rw', [this.$db.todos], async () => { + const miorec = await this.$db.todos.get(myobj.id) + + miorec.modify_at = new Date() + miorec.completed = myobj.completed + miorec.expiring_at = myobj.expiring_at + miorec.priority = myobj.priority + miorec.pos = myobj.pos + + await this.$db.todos.put(miorec) + + this.updatetable() + }) + + } + + +} diff --git a/src/components/todos/todo/todo.vue b/src/components/todos/todo/todo.vue new file mode 100644 index 0000000..1ef1da6 --- /dev/null +++ b/src/components/todos/todo/todo.vue @@ -0,0 +1,32 @@ + + + diff --git a/src/i18n.js b/src/i18n.js index a26446d..866f1e1 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -15,6 +15,7 @@ const messages = { vreg: 'Verifica Reg', Test: 'Test', Category: 'Categorie', + Todo: 'Todo', }, components: { authentication:{ @@ -100,6 +101,7 @@ const messages = { vreg: 'Verify Reg', Test: 'Test', Category: 'Category', + Todo: 'Todo', }, components: { authentication:{ diff --git a/src/index.template.html b/src/index.template.html index a31bd4b..4e2e4de 100644 --- a/src/index.template.html +++ b/src/index.template.html @@ -10,7 +10,7 @@ - + diff --git a/src/layouts/drawer/drawer.vue b/src/layouts/drawer/drawer.vue index 4845368..3036516 100644 --- a/src/layouts/drawer/drawer.vue +++ b/src/layouts/drawer/drawer.vue @@ -59,6 +59,7 @@ Dashboard: { routes: [ { route: '/', faIcon: 'fa fa-home', materialIcon: 'home', name: 'pages.home' }, + { route: '/todo', faIcon: 'fa fa-list-alt', materialIcon: 'todo', name: 'pages.Todo' }, { 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' }, diff --git a/src/layouts/drawer/menuOne.vue b/src/layouts/drawer/menuOne.vue index 5c56e30..90a266d 100644 --- a/src/layouts/drawer/menuOne.vue +++ b/src/layouts/drawer/menuOne.vue @@ -3,13 +3,15 @@
@@ -61,6 +62,11 @@ diff --git a/src/router/route-config.ts b/src/router/route-config.ts index 2c91947..97f54c8 100644 --- a/src/router/route-config.ts +++ b/src/router/route-config.ts @@ -9,11 +9,6 @@ export const RouteConfig: VueRouteConfig[] = [ path: '/', meta: { name: 'Home' } }, - { - path: '/test', - component: () => import('@/views/login/test.vue'), - meta: { name: 'Test' } - }, { path: '/signup', component: () => import('@/views/login/signup/signup.vue'), @@ -29,6 +24,11 @@ export const RouteConfig: VueRouteConfig[] = [ component: () => import('@/views/login/vreg/vreg.vue'), meta: { name: 'Verify Reg' } }, + { + path: '/todo', + component: () => import('@/components/todos/todo/todo.vue'), + meta: { name: 'Todos' } + }, { path: '/category', component: () => import('@/components/categories/category/category.vue'), diff --git a/src/statics/freeplanet-logo-full.svg b/src/statics/freeplanet-logo-full.svg new file mode 100644 index 0000000..5ea13e2 --- /dev/null +++ b/src/statics/freeplanet-logo-full.svg @@ -0,0 +1,482 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Free Planet + Free Planet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/statics/icons/android-chrome-192x192.png b/src/statics/icons/android-chrome-192x192.png new file mode 100644 index 0000000..ef8f28f Binary files /dev/null and b/src/statics/icons/android-chrome-192x192.png differ diff --git a/src/statics/icons/android-chrome-512x512.png b/src/statics/icons/android-chrome-512x512.png new file mode 100644 index 0000000..46cdc86 Binary files /dev/null and b/src/statics/icons/android-chrome-512x512.png differ diff --git a/src/statics/icons/apple-icon-152x152.png b/src/statics/icons/apple-icon-152x152.png deleted file mode 100644 index c918acd..0000000 Binary files a/src/statics/icons/apple-icon-152x152.png and /dev/null differ diff --git a/src/statics/icons/apple-touch-icon.png b/src/statics/icons/apple-touch-icon.png new file mode 100644 index 0000000..5291627 Binary files /dev/null and b/src/statics/icons/apple-touch-icon.png differ diff --git a/src/statics/icons/favicon-16x16.png b/src/statics/icons/favicon-16x16.png index 177c86e..f052d7c 100644 Binary files a/src/statics/icons/favicon-16x16.png and b/src/statics/icons/favicon-16x16.png differ diff --git a/src/statics/icons/favicon-32x32.png b/src/statics/icons/favicon-32x32.png index b8e6cdf..9855a45 100644 Binary files a/src/statics/icons/favicon-32x32.png and b/src/statics/icons/favicon-32x32.png differ diff --git a/src/statics/icons/favicon.ico b/src/statics/icons/favicon.ico new file mode 100644 index 0000000..fd1950b Binary files /dev/null and b/src/statics/icons/favicon.ico differ diff --git a/src/statics/icons/icon-128x128.png b/src/statics/icons/icon-128x128.png deleted file mode 100644 index 590e8ce..0000000 Binary files a/src/statics/icons/icon-128x128.png and /dev/null differ diff --git a/src/statics/icons/icon-192x192.png b/src/statics/icons/icon-192x192.png deleted file mode 100644 index 2a9b50b..0000000 Binary files a/src/statics/icons/icon-192x192.png and /dev/null differ diff --git a/src/statics/icons/icon-256x256.png b/src/statics/icons/icon-256x256.png deleted file mode 100644 index 8450959..0000000 Binary files a/src/statics/icons/icon-256x256.png and /dev/null differ diff --git a/src/statics/icons/icon-384x384.png b/src/statics/icons/icon-384x384.png deleted file mode 100644 index 2d6dd7b..0000000 Binary files a/src/statics/icons/icon-384x384.png and /dev/null differ diff --git a/src/statics/icons/icon-512x512.png b/src/statics/icons/icon-512x512.png deleted file mode 100644 index a57354e..0000000 Binary files a/src/statics/icons/icon-512x512.png and /dev/null differ diff --git a/src/statics/icons/ms-icon-144x144.png b/src/statics/icons/ms-icon-144x144.png deleted file mode 100644 index b0880e8..0000000 Binary files a/src/statics/icons/ms-icon-144x144.png and /dev/null differ diff --git a/src/store/Modules/Todos.ts b/src/store/Modules/Todos.ts new file mode 100644 index 0000000..cc4b656 --- /dev/null +++ b/src/store/Modules/Todos.ts @@ -0,0 +1,61 @@ +import { ITodosState } from 'model' +import { storeBuilder } from './Store/Store' + + +const state: ITodosState = { + visuOnlyUncompleted: false +} + +const b = storeBuilder.module('TodosModule', state) + +// Getters +namespace Getters { + + const visuOnlyUncompleted = b.read(state => state.visuOnlyUncompleted, 'visuOnlyUncompleted') + + export const getters = { + get visuOnlyUncompleted() { + return visuOnlyUncompleted + } + } +} + +namespace Mutations { + + function deleteItem(state: ITodosState, num: number) { + // state.conta = num + // Cancella Item + } + + export const mutations = { + deleteItem: b.commit(deleteItem), + } + +} + +namespace Actions { + async function deleteItem(context, num: number) { + Mutations.mutations.deleteItem(num) + } + + export const actions = { + setConta: b.dispatch(deleteItem) + } + +} + +const stateGetter = b.state() + +// Module +const TodosModule = { + get state() { + return stateGetter() + }, + getters: Getters.getters, + mutations: Mutations.mutations, + actions: Actions.actions +} + + +export default ITodosState + diff --git a/src/store/Modules/UserStore.ts b/src/store/Modules/UserStore.ts index a57d7a1..1cf8186 100644 --- a/src/store/Modules/UserStore.ts +++ b/src/store/Modules/UserStore.ts @@ -13,7 +13,7 @@ const bcrypt = require('bcryptjs') // State const state: IUserState = { - _id: '', + userId: '', email: '', username: '', idapp: process.env.APP_ID, @@ -21,7 +21,6 @@ const state: IUserState = { lang: '', repeatPassword: '', idToken: '', - userId: 0, tokens: [], verifiedEmail: false } @@ -66,8 +65,8 @@ namespace Getters { namespace Mutations { function authUser(state, data: IUserState) { - state.username = data.username state.userId = data.userId + state.username = data.username state.idToken = data.idToken state.verifiedEmail = data.verifiedEmail // @ts-ignore @@ -102,10 +101,10 @@ namespace Mutations { } function clearAuthData(state: IUserState) { + state.userId = '' state.username = '' state.tokens = [] state.idToken = '' - state.userId = 0 state.verifiedEmail = false } @@ -308,16 +307,16 @@ namespace Actions { Mutations.mutations.setServerCode(myres.status) if (myres.status === 200) { - let iduser = body._id + let userId = body.userId let username = authData.username if (process.env.DEV) { console.log('USERNAME = ' + username) - console.log('IDUSER= ' + iduser) + console.log('IDUSER= ' + userId) } Mutations.mutations.authUser({ + userId: userId, username: username, - userId: iduser, idToken: x_auth_token, verifiedEmail: false }) @@ -325,9 +324,9 @@ namespace Actions { const now = new Date() // const expirationDate = new Date(now.getTime() + myres.data.expiresIn * 1000); const expirationDate = new Date(now.getTime() * 1000) + localStorage.setItem(rescodes.localStorage.userId, userId) localStorage.setItem(rescodes.localStorage.username, username) localStorage.setItem(rescodes.localStorage.token, x_auth_token) - localStorage.setItem(rescodes.localStorage.userId, iduser) localStorage.setItem(rescodes.localStorage.expirationDate, expirationDate.toString()) localStorage.setItem(rescodes.localStorage.verifiedEmail, '0') // dispatch('storeUser', authData); @@ -407,15 +406,15 @@ namespace Actions { Mutations.mutations.setServerCode(myres.status) if (myres.status === 200) { - let iduser = body._id + let userId = body.userId let username = authData.username let verifiedEmail = body.verified_email === 'true' || body.verified_email === true if (process.env.DEV) { console.log('USERNAME = ' + username) - console.log('IDUSER= ' + iduser) + console.log('IDUSER= ' + userId) Mutations.mutations.authUser({ + userId: userId, username: username, - userId: iduser, idToken: x_auth_token, verifiedEmail: verifiedEmail }) @@ -424,9 +423,9 @@ namespace Actions { const now = new Date() // const expirationDate = new Date(now.getTime() + myres.data.expiresIn * 1000); const expirationDate = new Date(now.getTime() * 1000) + localStorage.setItem(rescodes.localStorage.userId, userId) localStorage.setItem(rescodes.localStorage.username, username) localStorage.setItem(rescodes.localStorage.token, x_auth_token) - localStorage.setItem(rescodes.localStorage.userId, iduser) localStorage.setItem(rescodes.localStorage.expirationDate, expirationDate.toString()) localStorage.setItem(rescodes.localStorage.isLogged, String(true)) localStorage.setItem(rescodes.localStorage.verifiedEmail, Number(verifiedEmail).toString()) @@ -513,15 +512,15 @@ namespace Actions { if (now >= expirationDate) { return false } - const userId = Number(localStorage.getItem(rescodes.localStorage.userId)) + const userId = String(localStorage.getItem(rescodes.localStorage.userId)) const username = String(localStorage.getItem(rescodes.localStorage.username)) const verifiedEmail = localStorage.getItem(rescodes.localStorage.verifiedEmail) === '1' setGlobal() Mutations.mutations.authUser({ - username: username, userId: userId, + username: username, idToken: token, verifiedEmail: verifiedEmail }) diff --git a/src/store/Modules/rescodes.ts b/src/store/Modules/rescodes.ts index 8b0afe2..1c90661 100644 --- a/src/store/Modules/rescodes.ts +++ b/src/store/Modules/rescodes.ts @@ -13,5 +13,56 @@ export const rescodes = { userId: 'uid', token: 'tk', username: 'uname' + }, + + Todos: { + PRIORITY_NORMAL: 0, + PRIORITY_HIGH: 1, + PRIORITY_LOW: -1 + }, + + + selectPriority: { + 'it': [ + { + id: 1, + label: 'Alta', + value: 1, + icon: 'expand_less' + }, + { + id: 2, + label: 'Normale', + value: 0, + icon: 'remove' + }, + { + id: 3, + label: 'Bassa', + value: -1, + icon: 'expand_more' + }], + 'enUk': [ + { + id: 1, + label: 'High', + value: 1, + icon: 'expand_less' + }, + { + id: 2, + label: 'Normal', + value: 0, + icon: 'remove' + }, + { + id: 3, + label: 'Low', + value: -1, + icon: 'expand_more' + }] + } + + } diff --git a/src/typings/libs/ambient.d.ts b/src/typings/libs/ambient.d.ts new file mode 100644 index 0000000..1b94f64 --- /dev/null +++ b/src/typings/libs/ambient.d.ts @@ -0,0 +1 @@ +declare module 'vuedraggable' diff --git a/src/views/login/signin/signin.ts b/src/views/login/signin/signin.ts index 7519911..429bc02 100644 --- a/src/views/login/signin/signin.ts +++ b/src/views/login/signin/signin.ts @@ -10,7 +10,8 @@ import { validations, TSignin } from './signin-validate' import { validationMixin } from 'vuelidate' -import './signin.scss' +import { Logo } from '@components' + import router from '@router' // import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar' @@ -18,7 +19,8 @@ import router from '@router' @Component({ mixins: [validationMixin], - validations: validations + validations: validations, + components: { Logo } }) export default class Signin extends Vue { @@ -43,10 +45,6 @@ export default class Signin extends Vue { return process.env } - public logoimg() { - return process.env.LOGO_REG - } - showNotif(msg: any) { this.$q.notify(msg) } diff --git a/src/views/login/signin/signin.vue b/src/views/login/signin/signin.vue index 516c86f..8a12220 100644 --- a/src/views/login/signin/signin.vue +++ b/src/views/login/signin/signin.vue @@ -3,8 +3,7 @@

- - +

@@ -61,3 +60,7 @@ + + diff --git a/src/views/login/signup/signup.ts b/src/views/login/signup/signup.ts index 96d6843..407bb21 100644 --- a/src/views/login/signup/signup.ts +++ b/src/views/login/signup/signup.ts @@ -8,13 +8,14 @@ import { validations, TSignup } from './signup-validate' import { validationMixin } from 'vuelidate' -import './signup.scss' +import { Logo } from '@components' // import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar' @Component({ mixins: [validationMixin], - validations: validations + validations: validations, + components: { Logo } }) export default class Signup extends Vue { @@ -41,10 +42,6 @@ export default class Signup extends Vue { mounted() { } - public logoimg() { - return process.env.LOGO_REG - } - get allowSubmit() { let error = this.$v.$error || this.$v.$invalid diff --git a/src/views/login/signup/signup.vue b/src/views/login/signup/signup.vue index 9be1581..14bd03e 100644 --- a/src/views/login/signup/signup.vue +++ b/src/views/login/signup/signup.vue @@ -2,8 +2,7 @@