- Projects: Shared / Personal

This commit is contained in:
Paolo Arena
2019-04-25 00:30:13 +02:00
parent 08e2ece604
commit a7a4d224eb
17 changed files with 333 additions and 154 deletions

View File

@@ -172,6 +172,7 @@ module.exports = function (ctx) {
'QAvatar',
'QImg',
'QSplitter',
'QRating',
'QSeparator'
],
directives: [

View File

@@ -12,6 +12,7 @@ import { tools } from '../../store/Modules/tools'
import Quasar from 'quasar'
@Component({
name: 'Header',
components: {
drawer,
messagePopover

View File

@@ -3,6 +3,7 @@ import { Component } from 'vue-property-decorator'
import { tools } from '@src/store/Modules/tools'
@Component({
name: 'Logo'
})
export default class Logo extends Vue {
get logoimg() {

View File

@@ -50,50 +50,73 @@ export default class SingleProject extends Vue {
@Prop({ required: true }) public itemproject: IProject
@Watch('itemproject.enableExpiring') public valueChanged4() {
@Watch('itemproject.enableExpiring')
public valueChanged4() {
this.watchupdate('enableExpiring')
}
@Watch('itemproject.expiring_at') public valueChanged2() {
@Watch('itemproject.expiring_at')
public valueChanged2() {
this.watchupdate('expiring_at')
}
@Watch('itemproject.descr') public valueChanged5() {
@Watch('itemproject.descr')
public valueChanged5() {
this.precDescr = this.itemproject.descr
}
@Watch('itemproject.longdescr') public valueChangedlongdescr() {
@Watch('itemproject.longdescr')
public valueChangedlongdescr() {
this.watchupdate('longdescr')
}
@Watch('itemproject.hoursplanned') public valueChangedhoursplanned() {
@Watch('itemproject.hoursplanned')
public valueChangedhoursplanned() {
this.watchupdate('hoursplanned')
}
@Watch('itemproject.hoursworked') public valueChangedhoursworked() {
@Watch('itemproject.hoursworked')
public valueChangedhoursworked() {
this.watchupdate('hoursworked')
}
@Watch('itemproject.begin_development') public valueChangedbegin_development() {
@Watch('itemproject.begin_development')
public valueChangedbegin_development() {
this.watchupdate('begin_development')
}
@Watch('itemproject.hoursweeky_plannedtowork') public valueChangedhoursweeky_plannedtowork() {
@Watch('itemproject.hoursweeky_plannedtowork')
public valueChangedhoursweeky_plannedtowork() {
this.watchupdate('hoursweeky_plannedtowork')
}
@Watch('itemproject.begin_test') public valueChangedbegin_test() {
@Watch('itemproject.begin_test')
public valueChangedbegin_test() {
this.watchupdate('begin_test')
}
@Watch('itemproject.actualphase') public valueChangedactualphase() {
@Watch('itemproject.actualphase')
public valueChangedactualphase() {
this.watchupdate('actualphase')
}
@Watch('itemproject.privacyread') public valueChanged_privacyread() {
@Watch('itemproject.privacyread')
public valueChanged_privacyread() {
this.watchupdate('privacyread')
}
@Watch('itemproject.privacywrite') public valueChanged_privacywrite() {
@Watch('itemproject.privacywrite')
public valueChanged_privacywrite() {
this.watchupdate('privacywrite')
}
@Watch('itemproject.totalphases') public valueChangedtotalphases() {
@Watch('itemproject.totalphases')
public valueChangedtotalphases() {
this.watchupdate('totalphases')
}
@Watch('itemproject.progressCalc') public valueChanged6() {
@Watch('itemproject.progressCalc')
public valueChanged6() {
console.log('itemproject.progressCalc')
this.updateClasses()
@@ -112,12 +135,12 @@ export default class SingleProject extends Vue {
return this.$t('proj.newsubproj')
}
/*
public dateToYYYYMMDD(date) {
// may have timezone caveats https://stackoverflow.com/a/29774197/1850609
return date && date.toISOString().split('T')[0]
}
*/
/*
public dateToYYYYMMDD(date) {
// may have timezone caveats https://stackoverflow.com/a/29774197/1850609
return date && date.toISOString().split('T')[0]
}
*/
// Computed:
get isSel() {
@@ -134,7 +157,7 @@ export default class SingleProject extends Vue {
public watchupdate(field = '') {
console.log('watchupdate PROJ', field)
this.$emit('eventupdateproj', {myitem: this.itemproject, field } )
this.$emit('eventupdateproj', { myitem: this.itemproject, field })
this.updateicon()
}
@@ -147,24 +170,26 @@ export default class SingleProject extends Vue {
this.classDescrEdit += ' titleLista-item'
}
if (this.itemproject.progressCalc > 100)
this.itemproject.progressCalc = 100
this.percProgress = 'percProgress'
this.classExpiring = 'flex-item data-item shadow-1 hide-if-small'
this.classExpiringEx = ''
this.percentageProgress = this.itemproject.progressCalc
this.percProgress = 'percProgress'
this.colProgress = tools.getProgressColor(this.itemproject.progressCalc)
this.percProgress += ' ' + tools.getProgressClassColor(this.itemproject.progressCalc)
this.clButtPopover = this.sel ? 'pos-item-popover comp_selected' : 'pos-item-popover'
if (this.itemproject.statusproj !== tools.Status.COMPLETED) {
this.clButtPopover += ' pos-item-popover_cursor'
if (!!this.itemproject) {
if (this.itemproject.statusproj !== tools.Status.COMPLETED) {
this.clButtPopover += ' pos-item-popover_cursor'
}
if (this.itemproject.progressCalc > 100)
this.itemproject.progressCalc = 100
this.percentageProgress = this.itemproject.progressCalc
this.colProgress = tools.getProgressColor(this.itemproject.progressCalc)
this.percProgress += ' ' + tools.getProgressClassColor(this.itemproject.progressCalc)
}
if (this.isProject()) {
@@ -192,19 +217,20 @@ export default class SingleProject extends Vue {
}
public clickRiga(clickmenu: boolean = false) {
console.log('CLICK RIGA PROJ************')
console.log('CLICK RIGA PROJ ************')
if (!this.sel) {
if (!this.inEdit) {
// this.attivaEdit = true
this.$emit('deselectAllRowstodo', null, false)
this.$emit('deselectAllRowsproj', this.itemproject, true)
// if (!this.sel) {
if (!this.sel) {
this.selectRiga()
} else {
this.deselectRiga()
}
if (!this.inEdit) {
console.log('entrato...')
// this.attivaEdit = true
this.$emit('deselectAllRowstodo', null, false)
this.$emit('deselectAllRowsproj', this.itemproject, true)
if (!this.sel) {
this.selectRiga()
} else {
this.deselectRiga()
}
}
}
@@ -246,7 +272,7 @@ export default class SingleProject extends Vue {
this.clickRiga()
}
public activeEdit(){
public activeEdit() {
console.log('Attiva Edit')
this.attivaEdit = true
this.editProject()
@@ -277,7 +303,7 @@ export default class SingleProject extends Vue {
this.updateClasses()
}
this.faiFocus('inputprojdescr', false, true)
this.faiFocus('inputprojdescr', false, true)
}
// console.log('FINE - editProject')
}
@@ -336,19 +362,19 @@ export default class SingleProject extends Vue {
public keyDownArea(e) {
console.log('keyDownArea')
/*
if ((e.key === 'ArrowUp') && !e.shiftKey) {
e.key = 'Tab'
e.shiftKey = true
}
/*
if ((e.key === 'ArrowUp') && !e.shiftKey) {
e.key = 'Tab'
e.shiftKey = true
}
if ((e.key === 'ArrowDown') && !e.shiftKey) {
let nextInput = inputs.get(inputs.index(this) + 1)
if (nextInput) {
nextInput.focus()
}
}
*/
if ((e.key === 'ArrowDown') && !e.shiftKey) {
let nextInput = inputs.get(inputs.index(this) + 1)
if (nextInput) {
nextInput.focus()
}
}
*/
// Delete Key or Backspage
if (((e.keyCode === 46)) && (this.precDescr === '') && !e.shiftKey) {
e.preventDefault()
@@ -399,7 +425,7 @@ export default class SingleProject extends Vue {
this.updateClasses()
}
public aggiornaProgress(value, initialval){
public aggiornaProgress(value, initialval) {
if (value !== initialval) {
this.itemproject.progressCalc = value
this.updatedata('progressCalc')
@@ -424,7 +450,7 @@ export default class SingleProject extends Vue {
public updatedata(field: string) {
// const myitem = tools.jsonCopy(this.itemproject)
console.log('calling this.$emit(eventupdateproj)', this.itemproject)
this.$emit('eventupdateproj', { myitem: this.itemproject, field } )
this.$emit('eventupdateproj', { myitem: this.itemproject, field })
}
public updateicon() {
@@ -435,10 +461,10 @@ export default class SingleProject extends Vue {
} // expand_less
else if (this.itemproject.priority === tools.Priority.PRIORITY_NORMAL) {
this.iconPriority = 'remove'
}
}
else if (this.itemproject.priority === tools.Priority.PRIORITY_LOW) {
this.iconPriority = 'expand_more'
} // expand_more
} // expand_more
this.updateClasses()
}
@@ -482,7 +508,7 @@ export default class SingleProject extends Vue {
const deletestr = this.$t('dialog.delete')
const cancelstr = this.$t('dialog.cancel')
const msg = this.$t('dialog.msg.deleteTask', {mytodo : this.itemproject.descr })
const msg = this.$t('dialog.msg.deleteTask', { mytodo: this.itemproject.descr })
this.$q.dialog({
cancel: {

View File

@@ -15,6 +15,7 @@ import { SingleTodo } from '../SingleTodo'
const namespace: string = 'Todos'
@Component({
name: 'CTodo',
components: { SingleTodo },
filters: {
capitalize(value) {
@@ -22,6 +23,7 @@ const namespace: string = 'Todos'
}
}
})
export default class CTodo extends Vue {
public $q: any
public todotop: string = ''

View File

@@ -1,6 +1,7 @@
import Vue from 'vue'
import { Watch } from 'vue-property-decorator'
import { GlobalStore } from '../../store/Modules'
import Component from 'vue-class-component'
export default class MenuOne extends Vue {

View File

@@ -3,25 +3,37 @@
<q-list class="rounded-borders text-primary">
<template v-for="(parent, index) in getmenu">
<!--<div class="q-list-header">{{replaceUnderlineToSpace(index)}}</div>-->
<div v-for="item in parent.routes">
<div v-if="item.routes2">
<div v-for="myitemmenu in parent.routes">
<div v-if="!!myitemmenu.routes2">
<q-expansion-item
:header-inset-level="item.level_parent"
:content-inset-level="item.level_parent"
:label="getLabelByItem(item)"
:icon="item.materialIcon"
:header-inset-level="myitemmenu.level_parent"
:content-inset-level="myitemmenu.level_parent"
:label="getLabelByItem(myitemmenu)"
:icon="myitemmenu.materialIcon"
expand-icon-class="my-menu-separat"
header-class="my-menu"
active-class="my-menu-active"
>
active-class="my-menu-active">
<q-expansion-item v-for="(child2, index) in item.routes2" :to="child2.route" :key="index"
:header-inset-level="item.level_child"
<q-expansion-item v-for="(child2, index) in myitemmenu.routes2"
:key="index"
:to="child2.route"
:header-inset-level="myitemmenu.level_child"
:duration="300"
expand-icon="map"
active-class="my-menu-active"
class="item item-link drawer-closer cursor-pointer my-menu"
:label="getLabelByItem(child2)">
<q-expansion-item v-if="!!child2.routes2" v-for="(child3, index) in child2.routes2"
:key="index"
:to="child3.route"
:header-inset-level="myitemmenu.level_child"
:duration="300"
expand-icon="map"
active-class="my-menu-active"
class="item item-link drawer-closer cursor-pointer my-menu"
:label="getLabelByItem(child3)">
</q-expansion-item>
</q-expansion-item>
</q-expansion-item>
@@ -33,24 +45,20 @@
clickable
v-ripple
exact
:to="item.route"
active-class="my-menu-active"
>
:to="myitemmenu.route"
active-class="my-menu-active">
<q-item-section avatar class="my-menu-icon">
<q-icon :name="item.materialIcon"/>
<q-icon :name="myitemmenu.materialIcon"/>
</q-item-section>
<q-item-section class="my-menu">
{{$t(item.name)}}
{{$t(myitemmenu.name)}}
</q-item-section>
</q-item>
</div>
</q-slide-transition>
</div>
<!--<q-separator spaced />-->
</div>
</template>
</q-list>

View File

@@ -62,18 +62,23 @@ export interface IGlobalState {
export interface IMenuList {
nametranslate: string
description: string
description?: string
idelem?: string
icon?: string
name?: string
level_parent?: number
level_child?: number
urlroute?: string
routes2?: IMenuList[]
}
export interface IListRoutes {
route: string
faIcon: string
materialIcon: string
faIcon?: string
materialIcon?: string
name: string
text?: string
routes2: []
level_parent: number
level_child: number
routes2?: IListRoutes[]
level_parent?: number
level_child?: number
}

View File

@@ -20,6 +20,7 @@ export interface IProject {
enableExpiring?: boolean
id_prev?: string
modified?: boolean
favourite?: number
pos?: number
order?: number
live_url?: string

View File

@@ -97,7 +97,7 @@ export const routesList: IMyRouteConfig[] = [
// component: () => import('@/root/malaga/malaga.vue')
// },
{
path: '/projects/:idProj',
path: '/' + RouteNames.projects + '/:idProj',
name: RouteNames.projects,
component: () => import('@/views/projects/proj-list/proj-list.vue'),
meta: {
@@ -109,7 +109,7 @@ export const routesList: IMyRouteConfig[] = [
}
},
{
path: '/myprojects/:idProj',
path: '/' + RouteNames.myprojects + '/:idProj',
name: RouteNames.myprojects,
component: () => import('@/views/projects/proj-list/proj-list.vue'),
meta: {
@@ -119,9 +119,34 @@ export const routesList: IMyRouteConfig[] = [
}
// middleware: [auth]
}
},
{
path: '/' + RouteNames.listprojects,
name: RouteNames.listprojects,
component: () => import('@/views/projects/proj-list/proj-list.vue'),
meta: {
requiresAuth: true,
async asyncData() {
await Projects.actions.dbLoad({ checkPending: false, onlyiffirsttime: true })
}
// middleware: [auth]
}
},
{
path: '/' + RouteNames.favouriteprojects,
name: RouteNames.favouriteprojects,
component: () => import('@/views/projects/proj-list/proj-list.vue'),
meta: {
requiresAuth: true,
async asyncData() {
await Projects.actions.dbLoad({ checkPending: false, onlyiffirsttime: true })
}
// middleware: [auth]
}
}
/*
{

View File

@@ -2,5 +2,8 @@ export const RouteNames = {
home: 'home',
login: 'login',
projects: 'projects',
myprojects: 'myprojects'
projectsshared: 'projectsShared',
myprojects: 'myprojects',
favouriteprojects: 'favproj',
listprojects: 'listproj'
}

View File

@@ -127,8 +127,10 @@ const messages = {
Admin: 'Admin',
Test1: 'Test1',
Test2: 'Test2',
Projects: 'Progetti Condivisi',
MyProjects: 'Progetti Personali'
projects: 'Progetti',
favproj: 'Favoriti',
projectsShared: 'Condivisi',
myprojects: 'Personali'
},
components: {
authentication: {
@@ -388,8 +390,10 @@ const messages = {
Admin: 'Administración',
Test1: 'Test1',
Test2: 'Test2',
Projects: 'Proyectos Compartidos',
MyProjects: 'Proyectos Personales',
projects: 'Proyectos',
favproj: 'Favoritos',
projectsShared: 'Compartidos',
myprojects: 'Personales',
},
components: {
authentication: {
@@ -642,8 +646,10 @@ const messages = {
Admin: 'Admin',
Test1: 'Test1',
Test2: 'Test2',
Projects: 'Shared Projects',
MyProjects: 'Personal Projects',
projects: 'Projects',
favproj: 'Favorite',
projectsShared: 'Shared',
myprojects: 'Personals',
},
components: {
authentication: {

View File

@@ -15,6 +15,7 @@ import * as ApiTables from '@src/store/Modules/ApiTables'
import { GlobalStore, Projects, Todos, UserStore } from '@store'
import messages from '../../statics/i18n'
import globalroutines from './../../globalroutines/index'
import { RouteNames } from '@src/router/route-names'
let stateConnDefault = 'online'
@@ -72,7 +73,7 @@ async function getstateConnSaved() {
}
}
function addRoute(myarr, values) {
function addRoute(myarr, values: IListRoutes) {
myarr.push(values)
}
@@ -114,73 +115,131 @@ namespace Getters {
console.log('getmenu')
const arrlista = GlobalStore.state.listatodo
const lista = []
const lista: IListRoutes[] = []
arrlista.forEach((elem: IMenuList) => {
const item = {
const item: IListRoutes = {
faIcon: 'fa fa-list-alt',
materialIcon: 'todo',
name: 'pages.' + elem.description,
route: '/todo/' + elem.nametranslate
}
lista.push(item)
})
const arrlistaprojtutti = Projects.getters.listaprojects(false)
const arrlistaprojmiei = Projects.getters.listaprojects(true)
const listaprojectstutti = []
const listaprojectsmiei = []
const SHOW_PROJINTHEMENU = false
for (const elem of arrlistaprojtutti) {
const item = {
materialIcon: 'next_week',
name: elem.nametranslate,
text: elem.description,
route: tools.getUrlByTipoProj(false) + elem.idelem
}
listaprojectstutti.push(item)
let arrlistafavourite = []
let arrlistaprojtutti = []
let arrlistaprojmiei = []
if (SHOW_PROJINTHEMENU) {
arrlistaprojtutti = Projects.getters.listaprojects(false, false)
arrlistaprojmiei = Projects.getters.listaprojects(true, false)
arrlistafavourite = Projects.getters.listaprojects(false, true)
}
for (const elem of arrlistaprojmiei) {
const item = {
materialIcon: 'next_week',
name: elem.nametranslate,
text: elem.description,
route: tools.getUrlByTipoProj(true) + elem.idelem
}
listaprojectsmiei.push(item)
const arrMenu: IMenuList[] = []
// PROGETTI -> FAVORITI :
if (arrlistafavourite.length > 0) {
arrMenu.push({
icon: '',
nametranslate: 'pages.' + RouteNames.favouriteprojects,
urlroute: RouteNames.favouriteprojects,
level_parent: 0.0,
level_child: 0.5,
routes2: arrlistafavourite,
idelem: ''
})
}
// PROGETTI -> CONDIVISI :
arrMenu.push({
icon: '',
nametranslate: 'pages.' + RouteNames.projectsshared,
urlroute: 'projects',
level_parent: 0.0,
level_child: 0.5,
routes2: arrlistaprojtutti,
idelem: process.env.PROJECT_ID_MAIN
})
// PROGETTI -> PERSONALI :
arrMenu.push({
icon: '',
nametranslate: 'pages.' + RouteNames.myprojects,
urlroute: 'myprojects',
level_parent: 0.0,
level_child: 0.5,
routes2: arrlistaprojmiei,
idelem: process.env.PROJECT_ID_MAIN
})
const listaprojectMenu: IListRoutes[] = tools.convertMenuListInListRoutes(arrMenu)
const arrroutes: IListRoutes[] = []
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',
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: tools.getUrlByTipoProj(false) + process.env.PROJECT_ID_MAIN, faIcon: 'fa fa-list-alt', materialIcon: 'next_week', name: 'pages.Projects',
routes2: listaprojectstutti,
level_parent: 0,
level_child: 0.5
})
addRoute(arrroutes,{ route: tools.getUrlByTipoProj(true) + process.env.PROJECT_ID_MAIN, faIcon: 'fa fa-list-alt', materialIcon: 'next_week', name: 'pages.MyProjects',
routes2: listaprojectsmiei,
level_parent: 0,
level_child: 0.5
})
}
const myarrproj = []
for (const myitem of listaprojectMenu) {
addRoute(myarrproj, myitem)
}
addRoute(arrroutes, {
route: '', faIcon: 'fa fa-list-alt', materialIcon: 'next_week', name: 'pages.projects',
routes2: myarrproj,
level_parent: 0.0,
level_child: 0.5
})
console.log('arrroutes', arrroutes)
console.log('listaprojectMenu', listaprojectMenu)
// console.log('arrlistaprojmiei', arrlistaprojmiei)
if (UserStore.state.isAdmin) {
addRoute(arrroutes, { route: '/category', faIcon: 'fa fa-list-alt', materialIcon: 'category', name: 'pages.Category' })
addRoute(arrroutes, { route: '/admin/cfgserv', faIcon: 'fa fa-database', materialIcon: 'event_seat', name: 'pages.Admin' })
addRoute(arrroutes, { route: '/admin/testp1/par1', faIcon: 'fa fa-database', materialIcon: 'restore', name: 'pages.Test1' })
addRoute(arrroutes, { route: '/admin/testp1/par2', faIcon: 'fa fa-database', materialIcon: 'restore', name: 'pages.Test2' })
addRoute(arrroutes, {
route: '/category',
faIcon: 'fa fa-list-alt',
materialIcon: 'category',
name: 'pages.Category',
level_parent: 0.0,
level_child: 0.0
})
addRoute(arrroutes, {
route: '/admin/cfgserv',
faIcon: 'fa fa-database',
materialIcon: 'event_seat',
name: 'pages.Admin',
level_parent: 0.0,
level_child: 0.0
})
addRoute(arrroutes, {
route: '/admin/testp1/par1',
faIcon: 'fa fa-database',
materialIcon: 'restore',
name: 'pages.Test1',
level_parent: 0.0,
level_child: 0.0
})
addRoute(arrroutes, {
route: '/admin/testp1/par2',
faIcon: 'fa fa-database',
materialIcon: 'restore',
name: 'pages.Test2',
level_parent: 0.0,
level_child: 0.0
})
}
state.menulinks = {
@@ -192,7 +251,7 @@ namespace Getters {
return state.menulinks
console.log('state.menulinks', state.menulinks)
// console.log('state.menulinks', state.menulinks)
}, 'getmenu')
@@ -480,7 +539,7 @@ namespace Actions {
subscription.unsubscribe().then((successful) => {
// You've successfully unsubscribed
console.log('You\'ve successfully unsubscribed')
}).catch( (e) => {
}).catch((e) => {
// Unsubscription failed
})
}

View File

@@ -24,7 +24,7 @@ const stateglob: IProjectsState = {
const listFieldsToChange: string [] = ['descr', 'longdescr', 'hoursplanned', 'hoursworked', 'id_parent', 'statusproj',
'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progressCalc', 'live_url', 'test_url',
'begin_development', 'begin_test', 'actualphase', 'totalphases', 'hoursweeky_plannedtowork', 'endwork_estimate',
'privacyread', 'privacywrite', 'id_main_project', 'typeproj']
'privacyread', 'privacywrite', 'id_main_project', 'typeproj', 'favourite']
const listFieldsUpdateCalculation: string [] = ['hoursplanned', 'hoursworked', 'progressCalc', 'endwork_estimate']
@@ -51,11 +51,11 @@ function updateDataCalculated(projout, projin) {
})
}
function getproj(projects, idproj, miei: boolean) {
if (miei) {
return tools.mapSort(projects.filter((proj) => (proj.id_parent === idproj) && proj.userId === UserStore.state.userId))
function getproj(projects, idproj, miei: boolean, favourite: boolean) {
if (miei && !favourite) {
return tools.mapSort(projects.filter((proj) => (proj.id_parent === idproj) && (proj.userId === UserStore.state.userId)))
} else {
return tools.mapSort(projects.filter((proj) => (proj.id_parent === idproj) && proj.userId !== UserStore.state.userId ))
return tools.mapSort(projects.filter((proj) => (proj.id_parent === idproj) && (proj.userId !== UserStore.state.userId)))
}
}
@@ -104,21 +104,21 @@ namespace Getters {
// console.log('projs_dacompletare', miei)
if (state.projects) {
// console.log('state.projects', state.projects)
return getproj(state.projects, id_parent, miei)
return getproj(state.projects, id_parent, miei, false)
} else {
return []
}
}, 'projs_dacompletare')
const listaprojects = b.read((state: IProjectsState) => (miei: boolean): IMenuList[] => {
const listaprojects = b.read((state: IProjectsState) => (miei: boolean, favourite: boolean): IMenuList[] => {
if (state.projects) {
// console.log('state.projects', state.projects)
const listaproj = getproj(state.projects, process.env.PROJECT_ID_MAIN, miei)
const listaproj = getproj(state.projects, process.env.PROJECT_ID_MAIN, miei, favourite)
const myarr: IMenuList[] = []
for (const proj of listaproj) {
myarr.push({ nametranslate: '', description: proj.descr, idelem: proj._id })
}
console.log(' myarr', myarr, listaproj)
// console.log(' myarr', myarr, listaproj)
return myarr
} else {
@@ -146,7 +146,7 @@ namespace Getters {
}, 'getRecordById')
const getifCanISeeProj = b.read((state: IProjectsState) => (proj: IProject): boolean => {
if (proj === undefined)
if ((proj === undefined) || (proj === null))
return false
if (!!UserStore.state) {
@@ -164,7 +164,7 @@ namespace Getters {
}, 'getifCanISeeProj')
const CanIModifyPanelPrivacy = b.read((state: IProjectsState) => (proj: IProject): boolean => {
if (proj === undefined)
if ((proj === undefined) || (proj === null))
return false
if (!!UserStore) {

View File

@@ -3,7 +3,7 @@ import globalroutines from './../../globalroutines/index'
import { costanti } from './costanti'
import { translation } from './translation'
import Quasar, { date } from 'quasar'
import { IProject, ITodo, Privacy } from '@src/model'
import { IListRoutes, IMenuList, IProject, ITodo, Privacy } from '@src/model'
import * as ApiTables from '@src/store/Modules/ApiTables'
import translate from '@src/globalroutines/util'
@@ -27,6 +27,7 @@ export const tools = {
FIRST_PROJ: '5ca8f17fcd40dc5012f53346',
WHAT_NOTHING: 0,
WHAT_TODO: 1,
WHAT_PROJECT: 2,
@@ -1375,11 +1376,35 @@ export const tools = {
return idproj === process.env.PROJECT_ID_MAIN
},
getUrlByTipoProj(miei) {
getUrlByTipoProj(miei, name?: string) {
if (!!name)
return '/' + name + '/'
if (miei)
return '/myprojects/'
else
return '/projects/'
},
convertMenuListInListRoutes(arrlista: IMenuList[]) {
const lista = []
if (arrlista === undefined)
return lista
for (const elem of arrlista) {
const item: IListRoutes = {
faIcon: 'fa fa-list-alt',
materialIcon: elem.icon,
name: elem.nametranslate,
text: elem.description,
route: tools.getUrlByTipoProj(false, elem.urlroute) + elem.idelem,
routes2: tools.convertMenuListInListRoutes(elem.routes2),
level_parent: elem.level_parent,
level_child: elem.level_child
}
lista.push(item)
}
return lista
}
}

View File

@@ -72,6 +72,7 @@ export default class ProjList extends Vue {
@Watch('$route.name')
public changename() {
console.log('tools.getUrlByTipoProj(this.areMyProjects)', tools.getUrlByTipoProj(this.areMyProjects))
this.changeparent()
}
@Watch('$route.params.idProj')
@@ -403,6 +404,8 @@ export default class ProjList extends Vue {
this.idsel = id
this.whatisSel = tools.WHAT_PROJECT
this.itemselproj = Projects.getters.getRecordById(this.idsel)
if ((this.itemselproj === undefined || this.itemselproj === null))
this.whatisSel = tools.WHAT_NOTHING
}
public setitemsel(item: ITodo) {
this.whatisSel = tools.WHAT_TODO
@@ -422,7 +425,7 @@ export default class ProjList extends Vue {
}
public deselectAllRowstodo(item: ITodo, check, onlythis: boolean = false) {
// console.log('PROJ-LIST deselectAllRowstodo : ', item)
console.log('PROJ-LIST deselectAllRowstodo : ', item)
return false
@@ -452,7 +455,7 @@ export default class ProjList extends Vue {
}
public deselectAllRowsproj(item: IProject, check, onlythis: boolean = false) {
// console.log('deselectAllRowsproj: ', item)
console.log('deselectAllRowsproj: ', item)
for (const i in this.$refs.singleproject) {
@@ -478,7 +481,11 @@ export default class ProjList extends Vue {
}
public updateclasses() {
this.colProgress = tools.getProgressColor(this.itemselproj.progressCalc)
if (!!!this.itemselproj) {
this.colProgress = tools.getProgressColor(this.itemselproj.progressCalc)
} else {
this.whatisSel = tools.WHAT_NOTHING
}
}
public checkUpdate() {

View File

@@ -116,6 +116,14 @@
<!--ID = {{itemselproj._id}}-->
<div class="q-pa-xs clMain">
<div class="flex-container clMain">
<!--<q-rating-->
<!--v-model="itemselproj.favourite"-->
<!--class="flex-item flex-icon"-->
<!--size="2em"-->
<!--:max="1"-->
<!--color="primary">-->
<!--</q-rating>-->
<q-icon class="flex-item flex-icon" name="format_align_center"/>
<div class="flex-item projecttitle shadow-4">
{{itemselproj.descr}}