@metano/quasar_rest_auth 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +17 -0
- package/LICENSE +21 -0
- package/Makefile +18 -0
- package/README.md +6 -0
- package/boot/alerts.js +152 -0
- package/boot/api.js +155 -0
- package/boot/app.js +111 -0
- package/boot/base.js +242 -0
- package/boot/config.js +117 -0
- package/boot/cripto.js +35 -0
- package/boot/data.js +28 -0
- package/boot/storage.js +74 -0
- package/components/DefinicoesLayout.vue +34 -0
- package/components/FormLogin.vue +217 -0
- package/components/LeftMenu.vue +93 -0
- package/components/LeftMenuSegundo.vue +96 -0
- package/components/MyTest.vue +41 -0
- package/components/RightMenu.vue +36 -0
- package/components/SearchMenu.vue +88 -0
- package/components/SettingsLayout.vue +34 -0
- package/components/TopMenu.vue +68 -0
- package/components/TopMenuSegundo.vue +85 -0
- package/components/footer/Comments.vue +77 -0
- package/components/footer/MainFooter.vue +71 -0
- package/components/header/HeaderBrand.vue +64 -0
- package/components/header/HeaderDarkModeToggle.vue +40 -0
- package/components/header/HeaderFullScreen.vue +55 -0
- package/components/header/HeaderLanguage.vue +56 -0
- package/components/header/HeaderNotifications.vue +53 -0
- package/components/header/HeaderServices.vue +118 -0
- package/components/header/HeaderUser.vue +210 -0
- package/components/header/HeaderUserMenu.vue +0 -0
- package/components/header/RegistarEntidade.vue +309 -0
- package/gitignore +3 -0
- package/help +9 -0
- package/index.js +9 -0
- package/layouts/AuthLayout.vue +74 -0
- package/layouts/MainLayout.vue +190 -0
- package/package.json +31 -0
- package/pages/auth/LoginPage.vue +32 -0
- package/pages/routes.js +33 -0
- package/stores/AuthStore.js +587 -0
- package/stores/example-store.js +21 -0
- package/stores/index.js +20 -0
- package/stores/settings.js +12 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<div>
|
|
4
|
+
<q-dialog
|
|
5
|
+
v-model="showRegistarEntidade"
|
|
6
|
+
persistent
|
|
7
|
+
:maximized="maximizedToggle"
|
|
8
|
+
full-height
|
|
9
|
+
>
|
|
10
|
+
<RegistarEntidade />
|
|
11
|
+
</q-dialog>
|
|
12
|
+
<q-dialog v-model="pergunta" persistent class="row">
|
|
13
|
+
<q-card style="width: 400px;" flat>
|
|
14
|
+
|
|
15
|
+
<q-card-section class="row ">
|
|
16
|
+
<label class="text-h6 text-grey-9 text-center">
|
|
17
|
+
{{tdc('De qual deseja sair')}}
|
|
18
|
+
</label>
|
|
19
|
+
</q-card-section>
|
|
20
|
+
<q-separator />
|
|
21
|
+
|
|
22
|
+
<q-card-actions class="row" >
|
|
23
|
+
<q-btn flat class="col-12" color="primary" @click="pergunta = false, User.logout(User.Entidade?.id)" > {{tdc(User.Entidade?.nome)}}</q-btn>
|
|
24
|
+
</q-card-actions>
|
|
25
|
+
|
|
26
|
+
<q-card-actions class="row" >
|
|
27
|
+
<q-btn flat class="col-12" color="primary" @click="pergunta = false, User.logout('x')" > {{tdc(User?.TipoEntidade?.nome)}}</q-btn>
|
|
28
|
+
</q-card-actions>
|
|
29
|
+
<q-separator/>
|
|
30
|
+
<q-card-actions class="row" >
|
|
31
|
+
<q-btn class="col-12" flat v-close-popup>{{tdc('Cancelar')}}</q-btn>
|
|
32
|
+
</q-card-actions>
|
|
33
|
+
</q-card>
|
|
34
|
+
|
|
35
|
+
</q-dialog>
|
|
36
|
+
|
|
37
|
+
<q-btn round flat>
|
|
38
|
+
<q-avatar class="" size="45px" :class="$q.dark.isActive ? 'bg-white' : 'bg-white'" >
|
|
39
|
+
<img :src="User?.perfil" >
|
|
40
|
+
<q-card-actions align="center" v-if="User" flat>
|
|
41
|
+
<div class="text-h6 text-gry-8 row text-center">{{User?.username}}</div>
|
|
42
|
+
</q-card-actions>
|
|
43
|
+
<q-separator />
|
|
44
|
+
<q-menu flat square fit :offset="[130, 5]" >
|
|
45
|
+
<q-card class="my-card" style="width:270px;" flat bordered square >
|
|
46
|
+
<q-card-actions class="text-center row" v-if="User">
|
|
47
|
+
<div class=" col-12">
|
|
48
|
+
<q-avatar class="" size="120px" >
|
|
49
|
+
<img :src="User?.perfil" >
|
|
50
|
+
</q-avatar>
|
|
51
|
+
</div>
|
|
52
|
+
<div class=" text-center col-12 text-grey-9 text-h6">
|
|
53
|
+
{{User?.username}}
|
|
54
|
+
</div>
|
|
55
|
+
</q-card-actions>
|
|
56
|
+
<q-separator v-if="User" />
|
|
57
|
+
<q-expansion-item
|
|
58
|
+
v-if="User.data"
|
|
59
|
+
dense
|
|
60
|
+
group="group"
|
|
61
|
+
:label="User?.Entidade?.nome || tdc('Entidade') "
|
|
62
|
+
header-class=" text-grey-9"
|
|
63
|
+
v-model="entidadeClosed"
|
|
64
|
+
>
|
|
65
|
+
<q-separator />
|
|
66
|
+
<q-item dense clickable v-if="User.TipoEntidade?.crair_entidade" :to="{name:'add_entidade_self', params:{}}" >
|
|
67
|
+
<q-item-section>
|
|
68
|
+
<center><q-item-label overline class="text-blue"> {{ tdc('Registar Entidade')}}</q-item-label> </center>
|
|
69
|
+
</q-item-section>
|
|
70
|
+
</q-item>
|
|
71
|
+
<q-item dense clickable v-for="entidade in User?.Entidades" :key="entidade?.id" @click=" entidadeClosed = false, sucursalClosed = true, User.selectEntidade(entidade)">
|
|
72
|
+
<q-item-section>
|
|
73
|
+
<center><q-item-label overline> {{ tdc((entidade?.nome))}}</q-item-label> </center>
|
|
74
|
+
</q-item-section>
|
|
75
|
+
</q-item>
|
|
76
|
+
</q-expansion-item>
|
|
77
|
+
|
|
78
|
+
<q-expansion-item
|
|
79
|
+
v-if="User.data"
|
|
80
|
+
dense
|
|
81
|
+
group="group"
|
|
82
|
+
:label="User?.Sucursal?.nome || tdc('Sucursal') "
|
|
83
|
+
header-class=" text-grey-9"
|
|
84
|
+
v-model="sucursalClosed"
|
|
85
|
+
>
|
|
86
|
+
<q-separator />
|
|
87
|
+
<q-item dense clickable v-for="sucursal in User?.Sucursals" :key="sucursal?.id" @click=" sucursalClosed = false, User.selectSucursal(sucursal)">
|
|
88
|
+
<q-item-section>
|
|
89
|
+
<center><q-item-label overline> {{ tdc(sucursal?.nome)}}</q-item-label> </center>
|
|
90
|
+
</q-item-section>
|
|
91
|
+
</q-item>
|
|
92
|
+
</q-expansion-item>
|
|
93
|
+
|
|
94
|
+
<q-btn dense flat size="" @click="sucursalClosed = false" color="grey" :label="tdc(User.perfilSplint(User.Grupo?.name)) " style="width: 100%; border-color: transparent;">
|
|
95
|
+
<q-menu fit>
|
|
96
|
+
<q-list dense class="rounded-borders" style="min-width: 100px" >
|
|
97
|
+
<q-item clickable v-close-popup @click="User.selectGrupo({id:'1', name:'Hóspede'})" >
|
|
98
|
+
<q-item-section>
|
|
99
|
+
<q-item-label overline> {{tdc('Hóspede')}}</q-item-label>
|
|
100
|
+
</q-item-section>
|
|
101
|
+
</q-item>
|
|
102
|
+
|
|
103
|
+
<q-item clickable v-close-popup @click="User.selectGrupo(grupo)" v-ripple v-for=" grupo in User.Grupos" :key="grupo.id">
|
|
104
|
+
<q-item-section>
|
|
105
|
+
<q-item-label overline> {{ tdc(User.perfilSplint(grupo.name))}}</q-item-label>
|
|
106
|
+
|
|
107
|
+
</q-item-section>
|
|
108
|
+
|
|
109
|
+
</q-item>
|
|
110
|
+
|
|
111
|
+
</q-list>
|
|
112
|
+
</q-menu>
|
|
113
|
+
</q-btn>
|
|
114
|
+
<q-card-actions align="around" v-if="User.data">
|
|
115
|
+
<q-btn icon="settings" dense size="" :to="{name:'userDetails', params:{'user_id': User?.id}}" flat color="secondary" class="">{{tdc('Definições')}}</q-btn>
|
|
116
|
+
<q-btn icon="logout" dense size="" flat color="red" @click="pergunta = !pergunta">{{tdc('Sair')}}</q-btn>
|
|
117
|
+
</q-card-actions>
|
|
118
|
+
|
|
119
|
+
<q-card-actions align="around" v-else>
|
|
120
|
+
<q-btn icon="person_add" dense size="" :to="{name:'registarUser'}" flat color="primary" class="" :label="tdc('Registar')" />
|
|
121
|
+
<q-btn icon="login" dense size="" :to="{name:'login'}" flat color="secondary" class="" >{{tdc('login')}}</q-btn>
|
|
122
|
+
</q-card-actions>
|
|
123
|
+
<q-separator color="primary" dense size="xs" />
|
|
124
|
+
</q-card>
|
|
125
|
+
|
|
126
|
+
</q-menu>
|
|
127
|
+
</q-avatar>
|
|
128
|
+
<q-tooltip :class="$q.dark.isActive ? 'bg-transparent' : 'bg-primary'" v-if="User">{{User?.username }} </q-tooltip>
|
|
129
|
+
<q-tooltip :class="$q.dark.isActive ? 'bg-transparent' : 'bg-primary'" v-else>{{tdc('Hóspede')}}</q-tooltip>
|
|
130
|
+
</q-btn>
|
|
131
|
+
</div>
|
|
132
|
+
</template>
|
|
133
|
+
|
|
134
|
+
<script>
|
|
135
|
+
import { defineComponent } from 'vue'
|
|
136
|
+
import { tdc } from '../../boot/app'
|
|
137
|
+
import { getStorage } from '../../boot/base'
|
|
138
|
+
import { UserStore } from '../../stores/AuthStore'
|
|
139
|
+
import RegistarEntidade from './RegistarEntidade.vue'
|
|
140
|
+
|
|
141
|
+
export default defineComponent({
|
|
142
|
+
name: 'HeaderUser',
|
|
143
|
+
components: { RegistarEntidade },
|
|
144
|
+
|
|
145
|
+
setup () {
|
|
146
|
+
const User = UserStore()
|
|
147
|
+
return { User, tdc }
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
data () {
|
|
151
|
+
return {
|
|
152
|
+
sucursalClosed: false,
|
|
153
|
+
entidadeClosed: false,
|
|
154
|
+
pergunta: false,
|
|
155
|
+
showRegistarEntidade: false,
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
watch: {
|
|
160
|
+
'User.Grupo' (val) {
|
|
161
|
+
if (!val) return
|
|
162
|
+
if (this.$route.name !== 'wellcome') {
|
|
163
|
+
this.$router.push({ name: 'home' })
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
'User.isLogout' (val) {
|
|
168
|
+
if (!val) return
|
|
169
|
+
if (this.User.Entidade){
|
|
170
|
+
this.$router.push({ name: 'login' , query: { entidade: this.User.Entidade.id}})
|
|
171
|
+
}
|
|
172
|
+
this.$router.push({ name: 'login' })
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
methods: {
|
|
177
|
+
startSessionWatcher () {
|
|
178
|
+
this._sessionInterval = setInterval(this.User.checkSession, 1 * 60 * 1000)
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
beforeUnmount () {
|
|
182
|
+
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
async mounted () {
|
|
186
|
+
|
|
187
|
+
this.sucursalClosed = false
|
|
188
|
+
|
|
189
|
+
/* ---------- LEITURA SEGURA ---------- */
|
|
190
|
+
this.User.Entidade = this.User.safeParse(getStorage('c', 'userEntidade'))
|
|
191
|
+
this.User.Sucursals = this.User.safeParse(getStorage('c', 'userSucursals'))
|
|
192
|
+
this.User.Entidades = this.User.safeParse(getStorage('c', 'userEntidades'))
|
|
193
|
+
this.User.Sucursal = this.User.safeParse(getStorage('c', 'userSucursal'))
|
|
194
|
+
this.User.Grupo = this.User.safeParse(getStorage('c', 'userGrupo'))
|
|
195
|
+
this.User.Grupos = this.User.safeParse(getStorage('c', 'userGrupos'))
|
|
196
|
+
this.User.Permicoes = this.User.safeParse(getStorage('l', 'userPermicoes'))
|
|
197
|
+
|
|
198
|
+
this.User.data = this.User.safeParse(getStorage('c', 'user'))
|
|
199
|
+
this.User.access = getStorage('c', 'access')
|
|
200
|
+
this.User.refresh = getStorage('c', 'refresh')
|
|
201
|
+
|
|
202
|
+
this.User.RightTop = ('' + getStorage('c', 'right_top')).toLowerCase() === 'true'
|
|
203
|
+
this.User.LeftTop = ('' + getStorage('c', 'left_top')).toLowerCase() === 'true'
|
|
204
|
+
|
|
205
|
+
await this.User.getEntidades()
|
|
206
|
+
|
|
207
|
+
this.startSessionWatcher()
|
|
208
|
+
}
|
|
209
|
+
})
|
|
210
|
+
</script>
|
|
File without changes
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
|
|
2
|
+
<template>
|
|
3
|
+
<div>
|
|
4
|
+
<q-dialog v-model="pergunta" persistent class="row">
|
|
5
|
+
<q-card style="width: 400px;" flat>
|
|
6
|
+
|
|
7
|
+
<q-card-section class="row ">
|
|
8
|
+
<label class="text-h6 text-grey-9 text-center">
|
|
9
|
+
{{tdc('De qual deseja sair')}}
|
|
10
|
+
</label>
|
|
11
|
+
</q-card-section>
|
|
12
|
+
<q-separator />
|
|
13
|
+
|
|
14
|
+
<q-card-actions class="row" >
|
|
15
|
+
<q-btn flat class="col-12" color="primary" type="submit" @click="logout(User?.Entidade?.id)" > {{tdc(User?.Entidade?.nome)}}</q-btn>
|
|
16
|
+
</q-card-actions>
|
|
17
|
+
|
|
18
|
+
<q-card-actions class="row" >
|
|
19
|
+
<q-btn flat class="col-12" color="primary" type="submit" @click="logout('x')" > {{tdc(User?.TipoEntidade?.nome)}}</q-btn>
|
|
20
|
+
</q-card-actions>
|
|
21
|
+
<q-separator/>
|
|
22
|
+
<q-card-actions class="row" >
|
|
23
|
+
<q-btn class="col-12" flat v-close-popup>{{tdc('Cancelar')}}</q-btn>
|
|
24
|
+
</q-card-actions>
|
|
25
|
+
</q-card>
|
|
26
|
+
|
|
27
|
+
</q-dialog>
|
|
28
|
+
|
|
29
|
+
<q-btn round flat>
|
|
30
|
+
<q-avatar class="" size="45px" :class="$q.dark.isActive ? 'bg-white' : 'bg-white'" >
|
|
31
|
+
<img v-if="UserPessoa" :src="User?.perfil?.url" >
|
|
32
|
+
<img v-else src="https://awsacademy.instructure.com/images/messages/avatar-50.png" >
|
|
33
|
+
<q-card-actions align="center" v-if="User" flat>
|
|
34
|
+
<div class="text-h6 text-gry-8 row text-center">{{User?.username}}</div>
|
|
35
|
+
</q-card-actions>
|
|
36
|
+
<q-separator />
|
|
37
|
+
<q-menu flat square fit :offset="[130, 5]" >
|
|
38
|
+
<q-card class="my-card" style="width:270px;" flat bordered square >
|
|
39
|
+
<q-card-actions class="text-center row" v-if="User">
|
|
40
|
+
<div class=" col-12">
|
|
41
|
+
<q-avatar class="" size="120px" >
|
|
42
|
+
<img v-if="User" :src="User?.perfil?.url" >
|
|
43
|
+
<img v-else src="https://awsacademy.instructure.com/images/messages/avatar-50.png" >
|
|
44
|
+
</q-avatar>
|
|
45
|
+
</div>
|
|
46
|
+
<div class=" text-center col-12 text-grey-9 text-h6">
|
|
47
|
+
{{User?.username}}
|
|
48
|
+
</div>
|
|
49
|
+
</q-card-actions>
|
|
50
|
+
<q-separator v-if="User" />
|
|
51
|
+
<q-expansion-item
|
|
52
|
+
v-if="User"
|
|
53
|
+
dense
|
|
54
|
+
group="group"
|
|
55
|
+
:label="tdc('Entidade') "
|
|
56
|
+
header-class=" text-grey-9"
|
|
57
|
+
:caption="UserEntidade?.nome"
|
|
58
|
+
>
|
|
59
|
+
<q-separator />
|
|
60
|
+
<q-item dense clickable v-if="User?.TipoEntidade?.crair_entidade" :to="{name:'add_entidade_self', params:{}}" >
|
|
61
|
+
<q-item-section>
|
|
62
|
+
<center><q-item-label overline class="text-blue"> {{ tdc('Registar Entidade')}}</q-item-label> </center>
|
|
63
|
+
</q-item-section>
|
|
64
|
+
</q-item>
|
|
65
|
+
<q-item dense clickable v-for="entidade in User?.Entidades" :key="entidade?.id" @click="selectEntidade(entidade)">
|
|
66
|
+
<q-item-section>
|
|
67
|
+
<center><q-item-label overline> {{ tdc((entidade?.nome))}}</q-item-label> </center>
|
|
68
|
+
</q-item-section>
|
|
69
|
+
</q-item>
|
|
70
|
+
</q-expansion-item>
|
|
71
|
+
|
|
72
|
+
<q-expansion-item
|
|
73
|
+
v-if="User?.Entidade"
|
|
74
|
+
dense
|
|
75
|
+
group="group"
|
|
76
|
+
:label="tdc('Sucursal') "
|
|
77
|
+
header-class=" text-grey-9"
|
|
78
|
+
:caption="User?.Sucursal?.nome"
|
|
79
|
+
default-opened
|
|
80
|
+
v-model="sucursalClosed"
|
|
81
|
+
>
|
|
82
|
+
<q-separator />
|
|
83
|
+
<q-item dense clickable v-for="sucursal in User?.Sucursals" :key="sucursal?.id" @click="selectSucursal(sucursal)">
|
|
84
|
+
<q-item-section>
|
|
85
|
+
<center><q-item-label overline> {{ tdc(sucursal?.nome)}}</q-item-label> </center>
|
|
86
|
+
</q-item-section>
|
|
87
|
+
</q-item>
|
|
88
|
+
</q-expansion-item>
|
|
89
|
+
|
|
90
|
+
<q-btn dense flat size="" @click="sucursalClosed = false" color="grey" :label="tdc(perfilSplint(User?.Grupo?.name)) " style="width: 100%; border-color: transparent;">
|
|
91
|
+
<q-menu fit>
|
|
92
|
+
<q-list dense class="rounded-borders" style="min-width: 100px" >
|
|
93
|
+
<q-item clickable v-close-popup v-if="'domain'=='domain'" @click="selectGroup({id:'1', name:'Hóspede'})" >
|
|
94
|
+
<q-item-section>
|
|
95
|
+
<q-item-label overline> {{tdc('Hóspede')}}</q-item-label>
|
|
96
|
+
</q-item-section>
|
|
97
|
+
</q-item>
|
|
98
|
+
<q-item clickable v-close-popup v-else @click="selectGroup({id:'1', name:'Hóspede'})" >
|
|
99
|
+
<q-item-section>
|
|
100
|
+
<q-item-label overline> {{tdc('Hóspede')}}</q-item-label>
|
|
101
|
+
</q-item-section>
|
|
102
|
+
</q-item>
|
|
103
|
+
|
|
104
|
+
<q-item clickable v-close-popup @click="selectGroup(grupo)" v-ripple v-for=" grupo in User.Grupos" :key="grupo.id">
|
|
105
|
+
<q-item-section>
|
|
106
|
+
<q-item-label overline> {{ tdc(perfilSplint(grupo.name))}}</q-item-label>
|
|
107
|
+
</q-item-section>
|
|
108
|
+
</q-item>
|
|
109
|
+
</q-list>
|
|
110
|
+
</q-menu>
|
|
111
|
+
</q-btn>
|
|
112
|
+
|
|
113
|
+
<q-btn v-show="User" style="width: 100%; border-color: transparent;" icon="settings" dense size="" :to="{name:'userDetails', params:{'user_id': User?.id}}" flat color="secondary" class="">{{tdc('Definições')}}</q-btn>
|
|
114
|
+
<q-btn v-show="User" style="width: 100%; border-color: transparent;" icon="logout" dense size="" flat color="red" @click="modal_pergunta">{{tdc('Sair')}}</q-btn>
|
|
115
|
+
|
|
116
|
+
<q-btn v-show="!User" style="width: 100%; border-color: transparent;" dense size="" :to="{name:'registarUser'}" flat color="primary" class="" :label="tdc('Registar')" />
|
|
117
|
+
<q-btn v-show="!User" style="width: 100%; border-color: transparent;" dense size="" :to="{name:'login'}" flat color="secondary" class="" >{{tdc('login')}}</q-btn>
|
|
118
|
+
|
|
119
|
+
<q-separator color="primary" dense size="xs" />
|
|
120
|
+
</q-card>
|
|
121
|
+
|
|
122
|
+
</q-menu>
|
|
123
|
+
</q-avatar>
|
|
124
|
+
<q-tooltip :class="$q.dark.isActive ? 'bg-transparent' : 'bg-primary'" v-if="User">{{User?.username }} </q-tooltip>
|
|
125
|
+
<q-tooltip :class="$q.dark.isActive ? 'bg-transparent' : 'bg-primary'" v-else>{{tdc('Hóspede')}}</q-tooltip>
|
|
126
|
+
</q-btn>
|
|
127
|
+
</div>
|
|
128
|
+
</template>
|
|
129
|
+
|
|
130
|
+
<script>
|
|
131
|
+
|
|
132
|
+
import { defineComponent } from 'vue'
|
|
133
|
+
import { HTTPAuth, url } from '../../boot/api'
|
|
134
|
+
import { tdc } from '../../boot/app'
|
|
135
|
+
import { deleteStorage, getStorage, setStorage } from '../../boot/base'
|
|
136
|
+
import { UserStore } from '../../stores/AuthStore'
|
|
137
|
+
|
|
138
|
+
export default defineComponent({
|
|
139
|
+
name: 'RegistarEntidade',
|
|
140
|
+
components: {
|
|
141
|
+
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
setup () {
|
|
145
|
+
const User = UserStore()
|
|
146
|
+
return { User }
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
data () {
|
|
150
|
+
return {
|
|
151
|
+
tdc: tdc,
|
|
152
|
+
sucursalClosed: true,
|
|
153
|
+
pergunta: false,
|
|
154
|
+
selectSucursalModal: false,
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
methods: {
|
|
159
|
+
|
|
160
|
+
perfilSplint (datax) {
|
|
161
|
+
try {
|
|
162
|
+
const vare = datax.split('_')
|
|
163
|
+
if (vare[1] != null) {
|
|
164
|
+
return vare[1]
|
|
165
|
+
} else {
|
|
166
|
+
return vare[0]
|
|
167
|
+
}
|
|
168
|
+
} catch (err) {
|
|
169
|
+
return null
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
/* --------------------- SELECT ENTIDADE --------------------- */
|
|
174
|
+
selectEntidade (entidade) {
|
|
175
|
+
setStorage('c', 'userEntidade', JSON.stringify(entidade), 365)
|
|
176
|
+
|
|
177
|
+
if (this.User) this.User.Entidade = JSON.parse(getStorage('c', 'userEntidade'))
|
|
178
|
+
|
|
179
|
+
this.selectSucursalModal = false
|
|
180
|
+
this.getUserSucursals()
|
|
181
|
+
this.getEntidadeModulos()
|
|
182
|
+
this.sucursalClosed = true
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
/* --------------------- SELECT SUCURSAL --------------------- */
|
|
186
|
+
selectSucursal (sucursal) {
|
|
187
|
+
setStorage('c', 'userSucursal', JSON.stringify(sucursal), 365)
|
|
188
|
+
|
|
189
|
+
if (this.User) this.User.Sucursal = JSON.parse(getStorage('c', 'userSucursal'))
|
|
190
|
+
|
|
191
|
+
this.selectSucursalModal = false
|
|
192
|
+
this.getUserPerfils()
|
|
193
|
+
this.sucursalClosed = false
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
/* --------------------- GET USER SUCURSALS --------------------- */
|
|
197
|
+
async getUserSucursals () {
|
|
198
|
+
this.spiner = true
|
|
199
|
+
|
|
200
|
+
if (getStorage('c', 'userEntidade') !== null) {
|
|
201
|
+
try {
|
|
202
|
+
await HTTPAuth.get(url({ type: 'u', url: 'auth/usuarios/' + this.User?.id + '/userSucursals/', params: {} }))
|
|
203
|
+
.then(res => {
|
|
204
|
+
setStorage('c', 'userSucursals', JSON.stringify(res.data), 365)
|
|
205
|
+
|
|
206
|
+
if (this.User) this.User.Sucursals = res.data
|
|
207
|
+
})
|
|
208
|
+
.catch(err => console.log(err))
|
|
209
|
+
} catch (error) {
|
|
210
|
+
console.log(error.message)
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
/* --------------------- GET USER PERFILS --------------------- */
|
|
216
|
+
async getUserPerfils () {
|
|
217
|
+
try {
|
|
218
|
+
await HTTPAuth.get(url({ type: 'u', url: 'auth/usuarios/' + this.User?.id + '/userPerfils/', params: {} }))
|
|
219
|
+
.then(res => {
|
|
220
|
+
setStorage('c', 'userPerfils', JSON.stringify(res.data), 365)
|
|
221
|
+
|
|
222
|
+
if (this.User) this.User.Grupos = res.data
|
|
223
|
+
})
|
|
224
|
+
.catch(err => console.log(err))
|
|
225
|
+
} catch (error) {
|
|
226
|
+
console.log(error.message)
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
/* --------------------- SELECT GROUP --------------------- */
|
|
231
|
+
async selectGroup (group) {
|
|
232
|
+
setStorage('c', 'userGrupo', JSON.stringify(group), 365)
|
|
233
|
+
|
|
234
|
+
if (this.User) this.User.Grupo = group
|
|
235
|
+
|
|
236
|
+
await this.getUserPermicoes()
|
|
237
|
+
this.$router.push({ name: 'home', params: {} })
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
/* --------------------- GET USER PERMISSOES --------------------- */
|
|
241
|
+
async getUserPermicoes () {
|
|
242
|
+
if (getStorage('c', 'userSucursal') !== null) {
|
|
243
|
+
try {
|
|
244
|
+
await HTTPAuth.get(url({ type: 'u', url: 'auth/usuarios/' + this.User?.data?.id + '/userPermicoes/', params: {} }))
|
|
245
|
+
.then(res => {
|
|
246
|
+
setStorage('l', 'userPermicoes', JSON.stringify(res.data), 365)
|
|
247
|
+
|
|
248
|
+
if (this.User) this.User.Permicoes = res.data
|
|
249
|
+
})
|
|
250
|
+
.catch(err => console.log(err))
|
|
251
|
+
} catch (error) {
|
|
252
|
+
console.log(error.message)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
/* --------------------- GET ENTIDADE MODULOS --------------------- */
|
|
258
|
+
async getEntidadeModulos () {
|
|
259
|
+
if (getStorage('c', 'userEntidade') !== null) {
|
|
260
|
+
try {
|
|
261
|
+
await HTTPAuth.get(url({ type: 'u', url: 'auth/entidades/' + this.User?.Entidade.id + '/modulos/', params: {} }))
|
|
262
|
+
.then(res => {
|
|
263
|
+
setStorage('c', 'entidadeModulos', JSON.stringify(res.data), 365)
|
|
264
|
+
|
|
265
|
+
if (this.User) this.User.EntidadeModulos = res.data
|
|
266
|
+
})
|
|
267
|
+
.catch(err => console.log(err))
|
|
268
|
+
} catch (error) {
|
|
269
|
+
console.log(error.message)
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
mounted () {
|
|
276
|
+
const storedUser = getStorage('c', 'user')
|
|
277
|
+
|
|
278
|
+
if (storedUser) {
|
|
279
|
+
try {
|
|
280
|
+
if (this.User) this.User.data = JSON.parse(storedUser)
|
|
281
|
+
} catch (err) {
|
|
282
|
+
console.error('Erro ao fazer JSON.parse(user):', err)
|
|
283
|
+
if (this.User) this.User.data = { id: '1', username: 'Gest' }
|
|
284
|
+
}
|
|
285
|
+
} else {
|
|
286
|
+
if (this.User) this.User.data = { id: '1', username: 'Gest' }
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (this.User) {
|
|
290
|
+
const ent = getStorage('c', 'userEntidade')
|
|
291
|
+
const suc = getStorage('c', 'userSucursal')
|
|
292
|
+
const gru = getStorage('c', 'userGrupo')
|
|
293
|
+
|
|
294
|
+
try {
|
|
295
|
+
this.User.Entidade = ent ? JSON.parse(ent) : null
|
|
296
|
+
this.User.Sucursal = suc ? JSON.parse(suc) : null
|
|
297
|
+
this.User.Grupo = gru ? JSON.parse(gru) : null
|
|
298
|
+
} catch (err) {
|
|
299
|
+
console.error('Erro ao parsear entidades/grupo:', err)
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (!this.User?.Grupo?.id) {
|
|
303
|
+
// this.getEntidades()
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
})
|
|
308
|
+
</script>
|
|
309
|
+
|
package/gitignore
ADDED
package/help
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<q-layout view="hHh lpR fFf">
|
|
3
|
+
<q-header bordered :class="$q.dark.isActive ? 'bg-dark text-white' : 'bg-primary text-white'">
|
|
4
|
+
<q-toolbar class="no-wrap q-px-md">
|
|
5
|
+
<HeaderBrand />
|
|
6
|
+
<q-space />
|
|
7
|
+
<HeaderDarkModeToggle />
|
|
8
|
+
<HeaderFullScreen />
|
|
9
|
+
<HeaderLanguage />
|
|
10
|
+
<Servicos />
|
|
11
|
+
</q-toolbar>
|
|
12
|
+
</q-header>
|
|
13
|
+
|
|
14
|
+
<q-page-container class="">
|
|
15
|
+
<router-view :showing="Load.count === 0" />
|
|
16
|
+
<q-inner-loading :showing="Load.count !== 0">
|
|
17
|
+
<q-spinner-gears size="80px" color="primary" />
|
|
18
|
+
</q-inner-loading>
|
|
19
|
+
</q-page-container>
|
|
20
|
+
|
|
21
|
+
<Rodape />
|
|
22
|
+
|
|
23
|
+
<q-page-scroller position="bottom-right" :scroll-offset="50" :offset="[18, -10]">
|
|
24
|
+
<q-btn icon="keyboard_arrow_up" color="primary" round />
|
|
25
|
+
</q-page-scroller>
|
|
26
|
+
</q-layout>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
/* -------------------- IMPORT STORES -------------------- */
|
|
31
|
+
|
|
32
|
+
import { AuthStore, LoadStore, UserStore } from '../stores/AuthStore'
|
|
33
|
+
|
|
34
|
+
/* -------------------- IMPORT COMPONENTS -------------------- */
|
|
35
|
+
import HeaderBrand from '../components/header/HeaderBrand.vue'
|
|
36
|
+
import HeaderDarkModeToggle from '../components/header/HeaderDarkModeToggle.vue'
|
|
37
|
+
import HeaderLanguage from '../components/header/HeaderLanguage.vue'
|
|
38
|
+
import HeaderFullScreen from '../components/header/HeaderFullScreen.vue'
|
|
39
|
+
import Servicos from '../components/header/HeaderServices.vue'
|
|
40
|
+
import Rodape from '../components/footer/MainFooter.vue'
|
|
41
|
+
|
|
42
|
+
import { defineComponent } from 'vue'
|
|
43
|
+
|
|
44
|
+
export default defineComponent({
|
|
45
|
+
components: {
|
|
46
|
+
HeaderBrand,
|
|
47
|
+
HeaderDarkModeToggle,
|
|
48
|
+
HeaderLanguage,
|
|
49
|
+
HeaderFullScreen,
|
|
50
|
+
Servicos,
|
|
51
|
+
Rodape,
|
|
52
|
+
},
|
|
53
|
+
setup() {
|
|
54
|
+
const Auth = AuthStore()
|
|
55
|
+
const User = UserStore()
|
|
56
|
+
const Load = LoadStore()
|
|
57
|
+
return {
|
|
58
|
+
Auth,
|
|
59
|
+
User,
|
|
60
|
+
Load,
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
data() {
|
|
64
|
+
return {}
|
|
65
|
+
},
|
|
66
|
+
computed: {},
|
|
67
|
+
|
|
68
|
+
mounted() {},
|
|
69
|
+
|
|
70
|
+
methods: {},
|
|
71
|
+
})
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<style></style>
|