- Added Delete Record to the CGridTableRec
This commit is contained in:
@@ -2,7 +2,8 @@ export const shared_consts = {
|
|||||||
|
|
||||||
Permissions: {
|
Permissions: {
|
||||||
Normal: 0,
|
Normal: 0,
|
||||||
Admin: 1
|
Admin: 1,
|
||||||
|
Manager: 2,
|
||||||
},
|
},
|
||||||
|
|
||||||
fieldsUserToChange() {
|
fieldsUserToChange() {
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
.colmodif {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ import { GlobalStore, UserStore } from '../../store/Modules/index'
|
|||||||
import { tools } from '../../store/Modules/tools'
|
import { tools } from '../../store/Modules/tools'
|
||||||
|
|
||||||
import { shared_consts } from '../../common/shared_vuejs'
|
import { shared_consts } from '../../common/shared_vuejs'
|
||||||
import { ICategory } from '../../model'
|
import { ICategory, IColGridTable } from '../../model'
|
||||||
import { CTodo } from '../todos/CTodo'
|
import { CTodo } from '../todos/CTodo'
|
||||||
import { SingleProject } from '../projects/SingleProject'
|
import { SingleProject } from '../projects/SingleProject'
|
||||||
|
import { lists } from '../../store/Modules/lists'
|
||||||
|
|
||||||
@Component({})
|
@Component({})
|
||||||
export default class CGridTableRec extends Vue {
|
export default class CGridTableRec extends Vue {
|
||||||
@Prop({ required: true }) public mytable: string
|
@Prop({ required: true }) public mytable: string
|
||||||
@Prop({ required: true }) public mytitle: string
|
@Prop({ required: true }) public mytitle: string
|
||||||
@Prop({ required: true }) public mylist: any[]
|
|
||||||
@Prop({ required: true }) public mycolumns: any[]
|
@Prop({ required: true }) public mycolumns: any[]
|
||||||
@Prop({ required: true }) public colkey: string
|
@Prop({ required: true }) public colkey: string
|
||||||
public $q
|
public $q
|
||||||
@@ -67,20 +67,28 @@ export default class CGridTableRec extends Vue {
|
|||||||
public SaveValue(newVal, valinitial) {
|
public SaveValue(newVal, valinitial) {
|
||||||
console.log('SaveValue', newVal, 'selected', this.selected)
|
console.log('SaveValue', newVal, 'selected', this.selected)
|
||||||
|
|
||||||
const mydata = {}
|
const mydata = {
|
||||||
|
// colkey: this.colkey,
|
||||||
|
id: this.idsel,
|
||||||
|
table: this.mytable,
|
||||||
|
fieldsvalue: {
|
||||||
|
|
||||||
mydata[this.colsel] = newVal
|
}
|
||||||
mydata[this.colkey] = this.idsel
|
}
|
||||||
this.valPrec = valinitial
|
|
||||||
|
mydata.fieldsvalue[this.colsel] = newVal
|
||||||
|
|
||||||
console.log('this.idsel', this.idsel, 'this.colsel', this.colsel)
|
|
||||||
console.table(mydata)
|
console.table(mydata)
|
||||||
|
|
||||||
this.$emit('save', mydata)
|
this.valPrec = valinitial
|
||||||
|
|
||||||
|
// console.log('this.idsel', this.idsel, 'this.colsel', this.colsel)
|
||||||
|
// console.table(mydata)
|
||||||
|
|
||||||
|
this.saveFieldValue(mydata)
|
||||||
}
|
}
|
||||||
|
|
||||||
public created() {
|
public created() {
|
||||||
|
|
||||||
// this.serverData = this.mylist.slice() // [{ chiave: 'chiave1', valore: 'valore 1' }]
|
// this.serverData = this.mylist.slice() // [{ chiave: 'chiave1', valore: 'valore 1' }]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,11 +218,45 @@ export default class CGridTableRec extends Vue {
|
|||||||
return this.returnedCount
|
return this.returnedCount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getclassCol(col) {
|
||||||
|
return col.disable ? '' : 'colmodif'
|
||||||
|
}
|
||||||
|
|
||||||
|
public saveFieldValue(mydata) {
|
||||||
|
console.log('saveFieldValue', mydata)
|
||||||
|
|
||||||
|
// Save on Server
|
||||||
|
GlobalStore.actions.saveFieldValue(mydata).then((esito) => {
|
||||||
|
if (esito)
|
||||||
|
tools.showPositiveNotif(this.$q, this.$t('db.recupdated'))
|
||||||
|
else {
|
||||||
|
tools.showNegativeNotif(this.$q, this.$t('db.recfailed'))
|
||||||
|
this.undoVal()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public mounted() {
|
public mounted() {
|
||||||
|
this.mycolumns.forEach((rec: IColGridTable) => {
|
||||||
|
rec.label = this.$t(rec.label_trans)
|
||||||
|
})
|
||||||
|
|
||||||
this.onRequest({
|
this.onRequest({
|
||||||
pagination: this.pagination,
|
pagination: this.pagination,
|
||||||
filter: undefined
|
filter: undefined
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public clickFunz(item, col: IColGridTable) {
|
||||||
|
if (col.action) {
|
||||||
|
tools.ActionRecTable(this, col.action, this.mytable, item._id, item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionAfterYes(action, item) {
|
||||||
|
if (action === lists.MenuAction.DELETE_RECTABLE) {
|
||||||
|
this.serverData.splice(this.serverData.indexOf(item), 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,9 @@
|
|||||||
<q-td v-for="col in mycolumns" :key="col.name" :props="props">
|
<q-td v-for="col in mycolumns" :key="col.name" :props="props">
|
||||||
<div v-if="col.action">
|
<div v-if="col.action">
|
||||||
<q-btn flat round color="red" icon="fas fa-trash-alt"
|
<q-btn flat round color="red" icon="fas fa-trash-alt"
|
||||||
@click="col.clickfunz"></q-btn>
|
@click="clickFunz(props.row, col)"></q-btn>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else :class="getclassCol(col)">
|
||||||
{{ props.row[col.name] }}
|
{{ props.row[col.name] }}
|
||||||
<q-popup-edit v-model="props.row[col.name]" :disable="col.disable" :title="col.title" buttons
|
<q-popup-edit v-model="props.row[col.name]" :disable="col.disable" :title="col.title" buttons
|
||||||
@save="SaveValue" @show="selItem(props.row, col.field)">
|
@save="SaveValue" @show="selItem(props.row, col.field)">
|
||||||
|
|||||||
@@ -60,6 +60,10 @@ export default class Header extends Vue {
|
|||||||
return UserStore.state.isAdmin
|
return UserStore.state.isAdmin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isManager() {
|
||||||
|
return UserStore.state.isManager
|
||||||
|
}
|
||||||
|
|
||||||
get conndata_changed() {
|
get conndata_changed() {
|
||||||
return GlobalStore.state.connData
|
return GlobalStore.state.connData
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,7 +141,7 @@
|
|||||||
<q-btn class="absolute-top-right" style="margin-right: 10px; color: white;"
|
<q-btn class="absolute-top-right" style="margin-right: 10px; color: white;"
|
||||||
dense flat round icon="close" @click="right = !right">
|
dense flat round icon="close" @click="right = !right">
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<div v-if="isLogged" class="text-weight-bold text-user">{{ Username }} - {{ myName }} <span v-if="isAdmin"> [Admin]</span></div>
|
<div v-if="isLogged" class="text-weight-bold text-user">{{ Username }} - {{ myName }} <span v-if="isAdmin"> [Admin]</span><span v-if="isManager"> [Manager]</span></div>
|
||||||
<div v-else class="text-user text-italic bg-red">
|
<div v-else class="text-user text-italic bg-red">
|
||||||
{{ $t('user.loggati') }}
|
{{ $t('user.loggati') }}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -57,6 +57,14 @@
|
|||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.isAdmin {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.isManager {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
|
||||||
.my-menu-icon{
|
.my-menu-icon{
|
||||||
min-width: 26px;
|
min-width: 26px;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ export default class MenuOne extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public visumenu(elem) { // : IListRoutes
|
public visumenu(elem) { // : IListRoutes
|
||||||
return (elem.onlyAdmin && UserStore.state.isAdmin) || (!elem.onlyAdmin)
|
return (elem.onlyAdmin && UserStore.state.isAdmin) || (elem.onlyManager && UserStore.state.isManager)
|
||||||
|
|| ((!elem.onlyAdmin) && (!elem.onlyManager))
|
||||||
}
|
}
|
||||||
|
|
||||||
public setParentVisibilityBasedOnRoute(parent) {
|
public setParentVisibilityBasedOnRoute(parent) {
|
||||||
@@ -64,4 +65,15 @@ export default class MenuOne extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getmymenuclass(elem: IListRoutes) {
|
||||||
|
let menu = 'my-menu'
|
||||||
|
|
||||||
|
if (elem.onlyAdmin)
|
||||||
|
menu += ' isAdmin'
|
||||||
|
if (elem.onlyManager)
|
||||||
|
menu += ' isManager'
|
||||||
|
|
||||||
|
return menu
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
:label="tools.getLabelByItem(myitemmenu, mythis)"
|
:label="tools.getLabelByItem(myitemmenu, mythis)"
|
||||||
:icon="myitemmenu.materialIcon"
|
:icon="myitemmenu.materialIcon"
|
||||||
expand-icon-class="my-menu-separat"
|
expand-icon-class="my-menu-separat"
|
||||||
header-class="my-menu"
|
:header-class="getmymenuclass(myitemmenu)"
|
||||||
active-class="my-menu-active">
|
active-class="my-menu-active">
|
||||||
|
|
||||||
<q-expansion-item v-for="(child2, index) in myitemmenu.routes2"
|
<q-expansion-item v-for="(child2, index) in myitemmenu.routes2"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { IAction } from '@src/model/Projects'
|
import { IAction } from '@src/model/Projects'
|
||||||
import { Component } from 'vue-router/types/router'
|
import { Component } from 'vue-router/types/router'
|
||||||
|
import { lists } from '@src/store/Modules/lists'
|
||||||
|
|
||||||
export interface IPost {
|
export interface IPost {
|
||||||
title: string
|
title: string
|
||||||
@@ -83,6 +84,7 @@ export interface IListRoutes {
|
|||||||
infooter?: boolean
|
infooter?: boolean
|
||||||
submenu?: boolean
|
submenu?: boolean
|
||||||
onlyAdmin?: boolean
|
onlyAdmin?: boolean
|
||||||
|
onlyManager?: boolean
|
||||||
meta?: any
|
meta?: any
|
||||||
idelem?: string
|
idelem?: string
|
||||||
urlroute?: string
|
urlroute?: string
|
||||||
@@ -209,3 +211,17 @@ export interface IParamsQuery {
|
|||||||
sortBy: any
|
sortBy: any
|
||||||
descending: number
|
descending: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IColGridTable {
|
||||||
|
name: string
|
||||||
|
required: boolean
|
||||||
|
label?: string
|
||||||
|
label_trans?: string
|
||||||
|
align?: string
|
||||||
|
field?: string
|
||||||
|
sortable?: boolean
|
||||||
|
disable?: boolean
|
||||||
|
titlepopupedit?: string
|
||||||
|
icon?: string
|
||||||
|
action?: any
|
||||||
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export interface IUserState {
|
|||||||
x_auth_token?: string
|
x_auth_token?: string
|
||||||
isLogged?: boolean
|
isLogged?: boolean
|
||||||
isAdmin?: boolean
|
isAdmin?: boolean
|
||||||
|
isManager?: boolean
|
||||||
usersList?: IUserList[]
|
usersList?: IUserList[]
|
||||||
countusers?: number
|
countusers?: number
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ const msgglobal = {
|
|||||||
usereventlist: 'Prenotazioni Utenti',
|
usereventlist: 'Prenotazioni Utenti',
|
||||||
userlist: 'Lista Utenti',
|
userlist: 'Lista Utenti',
|
||||||
},
|
},
|
||||||
|
manage: {
|
||||||
|
menu: 'Gestione'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
sendmsg: {
|
sendmsg: {
|
||||||
write: 'scrive'
|
write: 'scrive'
|
||||||
@@ -33,7 +36,11 @@ const msgglobal = {
|
|||||||
},
|
},
|
||||||
db: {
|
db: {
|
||||||
recupdated: 'Record Aggiornato',
|
recupdated: 'Record Aggiornato',
|
||||||
recfailed: 'Errore durante aggiornamento Record'
|
recfailed: 'Errore durante aggiornamento Record',
|
||||||
|
deleterecord: 'Elimina Record',
|
||||||
|
deletetherecord: 'Eliminare il Record?',
|
||||||
|
deletedrecord: 'Record Cancellato',
|
||||||
|
recdelfailed: 'Errore durante la cancellazione del Record',
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
authentication: {
|
authentication: {
|
||||||
@@ -149,7 +156,7 @@ const msgglobal = {
|
|||||||
titledenied: 'Permesso Notifiche Disabilitato!',
|
titledenied: 'Permesso Notifiche Disabilitato!',
|
||||||
title_subscribed: 'Sottoscrizione a FreePlanet.app!',
|
title_subscribed: 'Sottoscrizione a FreePlanet.app!',
|
||||||
subscribed: 'Ora potrai ricevere i messaggi e le notifiche.',
|
subscribed: 'Ora potrai ricevere i messaggi e le notifiche.',
|
||||||
newVersionAvailable: 'Aggiorna'
|
newVersionAvailable: 'Aggiorna',
|
||||||
},
|
},
|
||||||
connection: 'Connessione',
|
connection: 'Connessione',
|
||||||
proj: {
|
proj: {
|
||||||
@@ -229,6 +236,9 @@ const msgglobal = {
|
|||||||
usereventlist: 'Reserva Usuarios',
|
usereventlist: 'Reserva Usuarios',
|
||||||
userlist: 'Lista de usuarios',
|
userlist: 'Lista de usuarios',
|
||||||
},
|
},
|
||||||
|
manage: {
|
||||||
|
menu: 'Gestionar'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
sendmsg: {
|
sendmsg: {
|
||||||
write: 'escribe'
|
write: 'escribe'
|
||||||
@@ -253,7 +263,11 @@ const msgglobal = {
|
|||||||
},
|
},
|
||||||
db: {
|
db: {
|
||||||
recupdated: 'Registro Actualizado',
|
recupdated: 'Registro Actualizado',
|
||||||
recfailed: 'Error durante el registro de actualización'
|
recfailed: 'Error durante el registro de actualización',
|
||||||
|
deleterecord: 'Eliminar registro',
|
||||||
|
deletetherecord: '¿Eliminar el registro?',
|
||||||
|
deletedrecord: 'Registro cancelado',
|
||||||
|
recdelfailed: 'Error durante la eliminación del registro',
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
authentication: {
|
authentication: {
|
||||||
@@ -362,7 +376,7 @@ const msgglobal = {
|
|||||||
titledenied: 'Notificaciones permitidas deshabilitadas!',
|
titledenied: 'Notificaciones permitidas deshabilitadas!',
|
||||||
title_subscribed: 'Suscripción a FreePlanet.app!',
|
title_subscribed: 'Suscripción a FreePlanet.app!',
|
||||||
subscribed: 'Ahora puedes recibir mensajes y notificaciones.',
|
subscribed: 'Ahora puedes recibir mensajes y notificaciones.',
|
||||||
newVersionAvailable: 'Actualiza'
|
newVersionAvailable: 'Actualiza',
|
||||||
},
|
},
|
||||||
connection: 'Connection',
|
connection: 'Connection',
|
||||||
proj: {
|
proj: {
|
||||||
@@ -443,6 +457,9 @@ const msgglobal = {
|
|||||||
usereventlist: 'Réservation Utilisateur',
|
usereventlist: 'Réservation Utilisateur',
|
||||||
userlist: 'Liste d\'utilisateurs',
|
userlist: 'Liste d\'utilisateurs',
|
||||||
},
|
},
|
||||||
|
manage: {
|
||||||
|
menu: 'Gérer'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
sendmsg: {
|
sendmsg: {
|
||||||
write: 'écrit'
|
write: 'écrit'
|
||||||
@@ -467,7 +484,11 @@ const msgglobal = {
|
|||||||
},
|
},
|
||||||
db: {
|
db: {
|
||||||
recupdated: 'Enregistrement mis à jour',
|
recupdated: 'Enregistrement mis à jour',
|
||||||
recfailed: 'Erreur lors de la mise à jour'
|
recfailed: 'Erreur lors de la mise à jour',
|
||||||
|
deleterecord: 'Supprimer l\'enregistrement',
|
||||||
|
deletetherecord: 'Supprimer l\'enregistrement?',
|
||||||
|
deletedrecord: 'Enregistrement annulé',
|
||||||
|
recdelfailed: 'Erreur lors de la suppression de l\'enregistrement',
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
authentication: {
|
authentication: {
|
||||||
@@ -575,7 +596,7 @@ const msgglobal = {
|
|||||||
titledenied: 'Notifications autorisées désactivées!',
|
titledenied: 'Notifications autorisées désactivées!',
|
||||||
title_subscribed: 'Abonnement au Site Web!',
|
title_subscribed: 'Abonnement au Site Web!',
|
||||||
subscribed: 'Maintenant, vous pouvez recevoir des messages et des notifications.',
|
subscribed: 'Maintenant, vous pouvez recevoir des messages et des notifications.',
|
||||||
newVersionAvailable: 'Mise à jour'
|
newVersionAvailable: 'Mise à jour',
|
||||||
},
|
},
|
||||||
connection: 'Connexion',
|
connection: 'Connexion',
|
||||||
proj: {
|
proj: {
|
||||||
@@ -656,6 +677,9 @@ const msgglobal = {
|
|||||||
usereventlist: 'Users Booking',
|
usereventlist: 'Users Booking',
|
||||||
userlist: 'Users List',
|
userlist: 'Users List',
|
||||||
},
|
},
|
||||||
|
manage: {
|
||||||
|
menu: 'Manage'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
sendmsg: {
|
sendmsg: {
|
||||||
write: 'write'
|
write: 'write'
|
||||||
@@ -680,7 +704,11 @@ const msgglobal = {
|
|||||||
},
|
},
|
||||||
db: {
|
db: {
|
||||||
recupdated: 'Record Updated',
|
recupdated: 'Record Updated',
|
||||||
recfailed: 'Error during update Record'
|
recfailed: 'Error during update Record',
|
||||||
|
deleterecord: 'Delete Record',
|
||||||
|
deletetherecord: 'Delete the Record?',
|
||||||
|
deletedrecord: 'Record Deleted',
|
||||||
|
recdelfailed: 'Error during deletion of the Record',
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
authentication: {
|
authentication: {
|
||||||
@@ -787,7 +815,7 @@ const msgglobal = {
|
|||||||
titledenied: 'Notification Permission Denied!',
|
titledenied: 'Notification Permission Denied!',
|
||||||
title_subscribed: 'Subscribed to FreePlanet.app!',
|
title_subscribed: 'Subscribed to FreePlanet.app!',
|
||||||
subscribed: 'You can now receive Notification and Messages.',
|
subscribed: 'You can now receive Notification and Messages.',
|
||||||
newVersionAvailable: 'Upgrade'
|
newVersionAvailable: 'Upgrade',
|
||||||
},
|
},
|
||||||
connection: 'Conexión',
|
connection: 'Conexión',
|
||||||
proj: {
|
proj: {
|
||||||
@@ -868,6 +896,9 @@ const msgglobal = {
|
|||||||
usereventlist: 'Users Booking',
|
usereventlist: 'Users Booking',
|
||||||
userlist: 'Users List',
|
userlist: 'Users List',
|
||||||
},
|
},
|
||||||
|
manage: {
|
||||||
|
menu: 'Manage'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
sendmsg: {
|
sendmsg: {
|
||||||
write: 'write'
|
write: 'write'
|
||||||
@@ -892,7 +923,11 @@ const msgglobal = {
|
|||||||
},
|
},
|
||||||
db: {
|
db: {
|
||||||
recupdated: 'Record Updated',
|
recupdated: 'Record Updated',
|
||||||
recfailed: 'Error during update Record'
|
recfailed: 'Error during update Record',
|
||||||
|
deleterecord: 'Delete Record',
|
||||||
|
deletetherecord: 'Delete the Record?',
|
||||||
|
deletedrecord: 'Record Deleted',
|
||||||
|
recdelfailed: 'Error during deletion of the Record',
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
authentication: {
|
authentication: {
|
||||||
@@ -1001,7 +1036,7 @@ const msgglobal = {
|
|||||||
titledenied: 'Notification Permission Denied!',
|
titledenied: 'Notification Permission Denied!',
|
||||||
title_subscribed: 'Subscribed to FreePlanet.app!',
|
title_subscribed: 'Subscribed to FreePlanet.app!',
|
||||||
subscribed: 'You can now receive Notification and Messages.',
|
subscribed: 'You can now receive Notification and Messages.',
|
||||||
newVersionAvailable: 'Upgrade'
|
newVersionAvailable: 'Upgrade',
|
||||||
},
|
},
|
||||||
connection: 'Conexión',
|
connection: 'Conexión',
|
||||||
proj: {
|
proj: {
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import globalroutines from './../../globalroutines/index'
|
|||||||
import { cfgrouter } from '../../router/route-config'
|
import { cfgrouter } from '../../router/route-config'
|
||||||
import { static_data } from '@src/db/static_data'
|
import { static_data } from '@src/db/static_data'
|
||||||
import { IParamsQuery } from '@src/model/GlobalStore'
|
import { IParamsQuery } from '@src/model/GlobalStore'
|
||||||
|
import { serv_constants } from '@src/store/Modules/serv_constants'
|
||||||
|
import { IUserState } from '@src/model'
|
||||||
// import { static_data } from '@src/db/static_data'
|
// import { static_data } from '@src/db/static_data'
|
||||||
|
|
||||||
let stateConnDefault = 'online'
|
let stateConnDefault = 'online'
|
||||||
@@ -520,6 +522,40 @@ namespace Actions {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function saveFieldValue(context, mydata: object) {
|
||||||
|
console.log('saveFieldValue', mydata)
|
||||||
|
|
||||||
|
return await Api.SendReq(`/chval`, 'PATCH', { data: mydata })
|
||||||
|
.then((res) => {
|
||||||
|
if (res)
|
||||||
|
return (res.data.code === serv_constants.RIS_CODE_OK)
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function DeleteRec(context, { table, id }) {
|
||||||
|
console.log('DeleteRec', id)
|
||||||
|
|
||||||
|
return await Api.SendReq('/delrec/' + table + '/' + id, 'DELETE', null)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
if (res.data.code === serv_constants.RIS_CODE_OK) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error)
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export const actions = {
|
export const actions = {
|
||||||
setConta: b.dispatch(setConta),
|
setConta: b.dispatch(setConta),
|
||||||
createPushSubscription: b.dispatch(createPushSubscription),
|
createPushSubscription: b.dispatch(createPushSubscription),
|
||||||
@@ -529,7 +565,9 @@ namespace Actions {
|
|||||||
prova: b.dispatch(prova),
|
prova: b.dispatch(prova),
|
||||||
saveCfgServerKey: b.dispatch(saveCfgServerKey),
|
saveCfgServerKey: b.dispatch(saveCfgServerKey),
|
||||||
checkUpdates: b.dispatch(checkUpdates),
|
checkUpdates: b.dispatch(checkUpdates),
|
||||||
loadTable: b.dispatch(loadTable)
|
saveFieldValue: b.dispatch(saveFieldValue),
|
||||||
|
loadTable: b.dispatch(loadTable),
|
||||||
|
DeleteRec: b.dispatch(DeleteRec)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ const state: IUserState = {
|
|||||||
x_auth_token: '',
|
x_auth_token: '',
|
||||||
isLogged: false,
|
isLogged: false,
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
|
isManager: false,
|
||||||
usersList: [],
|
usersList: [],
|
||||||
countusers: 0
|
countusers: 0
|
||||||
}
|
}
|
||||||
@@ -158,8 +159,9 @@ namespace Mutations {
|
|||||||
mystate.surname = data.surname
|
mystate.surname = data.surname
|
||||||
mystate.perm = data.perm
|
mystate.perm = data.perm
|
||||||
mystate.isAdmin = tools.isBitActive(mystate.perm, shared_consts.Permissions.Admin)
|
mystate.isAdmin = tools.isBitActive(mystate.perm, shared_consts.Permissions.Admin)
|
||||||
|
mystate.isManager = tools.isBitActive(mystate.perm, shared_consts.Permissions.Manager)
|
||||||
|
|
||||||
console.log('authUser', 'state.isAdmin', mystate.isAdmin)
|
// console.log('authUser', 'state.isAdmin', mystate.isAdmin)
|
||||||
console.table(mystate)
|
console.table(mystate)
|
||||||
console.table(data)
|
console.table(data)
|
||||||
if (data.verified_email) {
|
if (data.verified_email) {
|
||||||
@@ -324,21 +326,6 @@ namespace Actions {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveUserChange(context, user: IUserState) {
|
|
||||||
console.log('saveUserChange', user)
|
|
||||||
|
|
||||||
return await Api.SendReq(`/users/${user.userId}`, 'PATCH', { user })
|
|
||||||
.then((res) => {
|
|
||||||
if (res)
|
|
||||||
return (res.data.code === serv_constants.RIS_CODE_OK)
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
return false
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
async function requestpwd(context, paramquery: IUserState) {
|
async function requestpwd(context, paramquery: IUserState) {
|
||||||
|
|
||||||
@@ -717,7 +704,6 @@ namespace Actions {
|
|||||||
logout: b.dispatch(logout),
|
logout: b.dispatch(logout),
|
||||||
requestpwd: b.dispatch(requestpwd),
|
requestpwd: b.dispatch(requestpwd),
|
||||||
resetpwd: b.dispatch(resetpwd),
|
resetpwd: b.dispatch(resetpwd),
|
||||||
saveUserChange: b.dispatch(saveUserChange),
|
|
||||||
signin: b.dispatch(signin),
|
signin: b.dispatch(signin),
|
||||||
signup: b.dispatch(signup),
|
signup: b.dispatch(signup),
|
||||||
vreg: b.dispatch(vreg)
|
vreg: b.dispatch(vreg)
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ export const lists = {
|
|||||||
EDIT: 160,
|
EDIT: 160,
|
||||||
ADD_PROJECT: 200,
|
ADD_PROJECT: 200,
|
||||||
THEME: 210,
|
THEME: 210,
|
||||||
THEMEBG: 211
|
THEMEBG: 211,
|
||||||
|
|
||||||
|
DELETE_RECTABLE: 300,
|
||||||
},
|
},
|
||||||
|
|
||||||
selectTheme: [
|
selectTheme: [
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Todos, Projects, UserStore, CalendarStore } from '@store'
|
import { Todos, Projects, UserStore, CalendarStore, GlobalStore } from '@store'
|
||||||
import globalroutines from './../../globalroutines/index'
|
import globalroutines from './../../globalroutines/index'
|
||||||
import { costanti } from './costanti'
|
import { costanti } from './costanti'
|
||||||
import { toolsext } from './toolsext'
|
import { toolsext } from './toolsext'
|
||||||
@@ -1314,7 +1314,7 @@ export const tools = {
|
|||||||
return result
|
return result
|
||||||
},
|
},
|
||||||
|
|
||||||
executefunc(myself: any, func: number, par: IParamDialog) {
|
executefunc(myself: any, table, func: number, par: IParamDialog) {
|
||||||
if (func === lists.MenuAction.DELETE) {
|
if (func === lists.MenuAction.DELETE) {
|
||||||
console.log('param1', par.param1)
|
console.log('param1', par.param1)
|
||||||
CalendarStore.actions.CancelBookingEvent({ideventbook: par.param1, notify: par.param2 === true ? '1' : '0'}).then((ris) => {
|
CalendarStore.actions.CancelBookingEvent({ideventbook: par.param1, notify: par.param2 === true ? '1' : '0'}).then((ris) => {
|
||||||
@@ -1325,10 +1325,19 @@ export const tools = {
|
|||||||
} else
|
} else
|
||||||
tools.showNegativeNotif(myself.$q, myself.$t('cal.cancelederrorbooking'))
|
tools.showNegativeNotif(myself.$q, myself.$t('cal.cancelederrorbooking'))
|
||||||
})
|
})
|
||||||
|
} else if (func === lists.MenuAction.DELETE_RECTABLE) {
|
||||||
|
console.log('param1', par.param1)
|
||||||
|
GlobalStore.actions.DeleteRec({table, id: par.param1}).then((ris) => {
|
||||||
|
if (ris) {
|
||||||
|
myself.ActionAfterYes(func, par.param2)
|
||||||
|
tools.showPositiveNotif(myself.$q, myself.$t('db.deletedrecord'))
|
||||||
|
} else
|
||||||
|
tools.showNegativeNotif(myself.$q, myself.$t('db.recdelfailed'))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async askConfirm($q: any, mytitle, mytext, ok, cancel, myself: any, funcok: number, funccancel: number, par: IParamDialog) {
|
async askConfirm($q: any, mytitle, mytext, ok, cancel, myself: any, table, funcok: number, funccancel: number, par: IParamDialog) {
|
||||||
return $q.dialog({
|
return $q.dialog({
|
||||||
message: mytext,
|
message: mytext,
|
||||||
ok: {
|
ok: {
|
||||||
@@ -1340,11 +1349,11 @@ export const tools = {
|
|||||||
persistent: false
|
persistent: false
|
||||||
}).onOk(() => {
|
}).onOk(() => {
|
||||||
console.log('OK')
|
console.log('OK')
|
||||||
tools.executefunc(myself, funcok, par)
|
tools.executefunc(myself, table, funcok, par)
|
||||||
return true
|
return true
|
||||||
}).onCancel(() => {
|
}).onCancel(() => {
|
||||||
console.log('CANCEL')
|
console.log('CANCEL')
|
||||||
tools.executefunc(myself, funccancel, par)
|
tools.executefunc(myself, table, funccancel, par)
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -2241,11 +2250,11 @@ export const tools = {
|
|||||||
},
|
},
|
||||||
CancelBookingEvent(mythis, eventparam: IEvents, bookeventid: string, notify: boolean) {
|
CancelBookingEvent(mythis, eventparam: IEvents, bookeventid: string, notify: boolean) {
|
||||||
console.log('CancelBookingEvent ', eventparam)
|
console.log('CancelBookingEvent ', eventparam)
|
||||||
tools.askConfirm(mythis.$q, translate('cal.titlebooking'), translate('cal.cancelbooking') + ' ' + tools.gettextevent(eventparam) + '?', translate('dialog.yes'), translate('dialog.no'), mythis, lists.MenuAction.DELETE, 0, { param1: bookeventid, param2: notify })
|
tools.askConfirm(mythis.$q, translate('cal.titlebooking'), translate('cal.cancelbooking') + ' ' + tools.gettextevent(eventparam) + '?', translate('dialog.yes'), translate('dialog.no'), mythis, '', lists.MenuAction.DELETE, 0, { param1: bookeventid, param2: notify })
|
||||||
},
|
},
|
||||||
CancelUserRec(mythis, id) {
|
ActionRecTable(mythis, action, table, id, item?) {
|
||||||
console.log('CancelUserRec', id)
|
console.log('CancelRecTable', id)
|
||||||
tools.askConfirm(mythis.$q, translate('cal.titlebooking'), translate('cal.canceluser') + '?', translate('dialog.yes'), translate('dialog.no'), mythis, lists.MenuAction.DELETE, 0, { param1: id })
|
return tools.askConfirm(mythis.$q, translate('db.deleterecord'), translate('db.deletetherecord'), translate('dialog.yes'), translate('dialog.no'), mythis, table, action, 0, { param1: id, param2: item })
|
||||||
},
|
},
|
||||||
isBitActive(bit, whattofind) {
|
isBitActive(bit, whattofind) {
|
||||||
return ((bit & whattofind) === whattofind)
|
return ((bit & whattofind) === whattofind)
|
||||||
|
|||||||
Reference in New Issue
Block a user