Skip to content

Commit f798bbc

Browse files
committed
updated GUI
1 parent 23e85ff commit f798bbc

26 files changed

+843
-491
lines changed

resources/js/App.vue

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
<template>
2-
<v-nav class="px-0 py-0" :user="user">
3-
<v-item :path="{ name: 'clients' }">Clientes</v-item>
4-
<v-item :path="{ name: 'tokens' }">Clientes Tokens</v-item>
5-
<v-item :path="{ name: 'personalTokens' }">Personal Tokens</v-item>
6-
<v-item :path="{ name: 'users' }">Usuarios</v-item>
7-
<v-item :path="{ name: 'scopes' }">Scopes</v-item>
8-
<v-item :path="{ name: 'channels' }">Broadcasts</v-item>
9-
</v-nav>
10-
<section >
2+
<v-nav :user="user"></v-nav>
3+
<section class="container-fluid px-0 py-0">
114
<router-view />
125
</section>
13-
<footer>
14-
6+
<footer class="fixed-bottom">
157
</footer>
168
</template>
179
<script>
10+
import VNav from "./Pages/Dashboad/Navbar.vue";
11+
1812
export default {
13+
components: {
14+
VNav,
15+
},
16+
1917
data() {
2018
return {
2119
user: {},
@@ -24,6 +22,7 @@ export default {
2422
2523
created() {
2624
this.authenticated();
25+
this.authenticated()
2726
},
2827
2928
methods: {
@@ -38,6 +37,14 @@ export default {
3837
console.log(e);
3938
});
4039
},
40+
41+
listener() {
42+
this.$echo
43+
.private(this.$channels.ch_0())
44+
.listen("UpdateEmployeeEvent", (e) => {
45+
this.authenticated();
46+
});
47+
},
4148
},
4249
};
4350
</script>

resources/js/Pages/Account/2FA.vue

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<template>
2+
<div>
3+
<div class="row row-cols-1 col-12">
4+
<div class="col">
5+
<p class="font-monospace text-uppercase fw-bold">
6+
Two Factor Authentication
7+
</p>
8+
<span :class="[user.m2fa ? 'text-success' : 'text-danger']"
9+
>status : {{ user.m2fa ? "Activo" : "Inactivo" }}</span
10+
>
11+
</div>
12+
<div class="col py-3">
13+
<a
14+
:class="['btn', user.m2fa ? 'btn-danger' : 'btn-success']"
15+
@click="requestCode()"
16+
>
17+
Solicitar Token
18+
</a>
19+
</div>
20+
<div class="col py-3">
21+
<label for="token">TOKEN</label>
22+
<input
23+
type="text"
24+
class="form-control mb-3 form-control-sm w-25"
25+
v-model="token"
26+
/>
27+
<v-error :error="errors.token"></v-error>
28+
</div>
29+
<div class="col">
30+
<a
31+
:class="[
32+
'btn btn-block',
33+
user.m2fa ? 'btn-danger' : 'btn-success',
34+
]"
35+
@click="activar()"
36+
>
37+
{{ user.m2fa ? "Desactivar" : "Activar" }}
38+
</a>
39+
</div>
40+
41+
<div v-show="message" class="col mt-4 text-success">
42+
{{ message }}
43+
</div>
44+
45+
<div v-show="errors.message" class="col mt-4 text-danger">
46+
{{ errors.message }}
47+
</div>
48+
</div>
49+
</div>
50+
</template>
51+
<script>
52+
export default {
53+
data() {
54+
return {
55+
token: "",
56+
user: {},
57+
message: null,
58+
errors: {},
59+
};
60+
},
61+
62+
created() {
63+
this.authenticated();
64+
this.listener();
65+
},
66+
67+
methods: {
68+
requestCode() {
69+
window.axios
70+
.post("/m2fa/authorize")
71+
.then((res) => {
72+
this.message = res.data.message;
73+
this.errors.message = null;
74+
})
75+
.catch((err) => {
76+
if (err.response) {
77+
this.errors = err.response.data;
78+
this.message = null;
79+
}
80+
});
81+
},
82+
83+
authenticated() {
84+
window.axios
85+
.get("/api/gateway/user")
86+
.then((res) => {
87+
this.user = res.data;
88+
})
89+
.catch((e) => {});
90+
},
91+
92+
activar() {
93+
this.errors.message = null;
94+
95+
window.axios
96+
.post("/m2fa/activate", {
97+
token: this.token,
98+
})
99+
.then((res) => {
100+
this.token = "";
101+
this.message = res.data.message;
102+
})
103+
.catch((err) => {
104+
if (err.response) {
105+
this.errors = err.response.data.errors;
106+
}
107+
});
108+
},
109+
110+
listener() {
111+
this.$echo
112+
.private(this.$channels.ch_0())
113+
.listen("M2FAEvent", (e) => {
114+
this.authenticated();
115+
});
116+
},
117+
},
118+
};
119+
</script>
120+
<style lang=""></style>

resources/js/Pages/Account/About.vue

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
<template>
2+
<div class="container-fluid">
3+
<div class="row row-cols-3 col-sm-12">
4+
<div class="col">
5+
<v-update :user="user" @user-was-updated="authenticated"></v-update>
6+
</div>
7+
<div class="col mb-3">
8+
<span class="d-block fw-bold text-capitalize text-secondary"
9+
>nombre</span
10+
>
11+
<span>{{ user.nombre }}</span>
12+
</div>
13+
<div class="col mb-3">
14+
<span class="d-block fw-bold text-capitalize text-secondary"
15+
>apellido</span
16+
>
17+
<span class="font-monospace">
18+
{{ user.apellido }}
19+
</span>
20+
</div>
21+
<div class="col mb-3">
22+
<span class="d-block fw-bold text-capitalize text-secondary"
23+
>email</span
24+
>
25+
<span class="font-monospace">
26+
{{ user.correo }}
27+
</span>
28+
</div>
29+
30+
<div class="col mb-3">
31+
<span class="d-block fw-bold text-capitalize text-secondary"
32+
>pais</span
33+
>
34+
<span class="font-monospace">
35+
{{ user.pais }}
36+
</span>
37+
</div>
38+
<div class="col mb-3">
39+
<span class="d-block fw-bold text-capitalize text-secondary"
40+
>ciudad</span
41+
>
42+
<span class="font-monospace">
43+
{{ user.ciudad }}
44+
</span>
45+
</div>
46+
<div class="col mb-3">
47+
<span class="d-block fw-bold text-capitalize text-secondary"
48+
>direccion</span
49+
>
50+
<span class="font-monospace">
51+
{{ user.direccion }}
52+
</span>
53+
</div>
54+
<div class="col mb-3">
55+
<span class="d-block fw-bold text-capitalize text-secondary"
56+
>nacimiento</span
57+
>
58+
<span class="font-monospace">
59+
{{ user.nacimiento }}
60+
</span>
61+
</div>
62+
<div class="col mb-3">
63+
<span class="d-block fw-bold text-capitalize text-secondary"
64+
>telefono</span
65+
>
66+
<span class="font-monospace" v-for="(item, index) in user.telefono" :key="index">
67+
{{item}}
68+
</span>
69+
</div>
70+
<div class="col mb-3">
71+
<span class="d-block fw-bold text-capitalize text-secondary"
72+
>2FA - Two Factor Authentication</span
73+
>
74+
<span
75+
:class="[
76+
'font-monospace',
77+
user.m2fa ? 'text-success' : 'text-danger',
78+
]"
79+
>
80+
{{ user.m2fa ? "Activado" : "Inactivo" }}
81+
</span>
82+
</div>
83+
<div class="col mb-3">
84+
<span class="d-block fw-bold text-capitalize text-secondary"
85+
>registrado</span
86+
>
87+
<span class="font-monospace">
88+
{{ user.registrado }}
89+
</span>
90+
</div>
91+
<div class="col mb-3">
92+
<span class="d-block fw-bold text-capitalize text-secondary"
93+
>actualizado</span
94+
>
95+
<span class="font-monospace">
96+
{{ user.actualizado }}
97+
</span>
98+
</div>
99+
<div class="col">
100+
<span class="d-block fw-bold text-capitalize text-secondary"
101+
>Roles Asignados</span
102+
>
103+
<span> Tiene asignados {{ roles.length }} roles </span>
104+
</div>
105+
</div>
106+
</div>
107+
</template>
108+
<script>
109+
import VUpdate from "../Users/Update.vue";
110+
111+
export default {
112+
components: {
113+
VUpdate,
114+
},
115+
116+
data() {
117+
return {
118+
user: {},
119+
roles: {},
120+
};
121+
},
122+
123+
created() {
124+
this.authenticated();
125+
this.listener();
126+
},
127+
128+
methods: {
129+
authenticated() {
130+
window.axios
131+
.get("/api/gateway/user")
132+
.then((res) => {
133+
this.user = res.data;
134+
window.$auth = res.data;
135+
this.scopes(res.data.links.roles);
136+
})
137+
.catch((e) => {
138+
console.log(e);
139+
});
140+
},
141+
142+
scopes(link) {
143+
window.axios
144+
.get(link)
145+
.then((res) => {
146+
this.roles = res.data.data;
147+
})
148+
.catch((e) => {
149+
console.log(e);
150+
});
151+
},
152+
153+
listener() {
154+
this.$echo
155+
.private(this.$channels.ch_0())
156+
.listen("UpdateEmployeeEvent", (e) => {
157+
this.authenticated();
158+
});
159+
160+
this.$echo
161+
.private(this.$channels.ch_0())
162+
.listen("StoreEmployeeRoleEvent", (e) => {
163+
this.authenticated();
164+
});
165+
this.$echo
166+
.private(this.$channels.ch_0())
167+
.listen("DestroyEmployeeRoleEvent", (e) => {
168+
this.authenticated();
169+
});
170+
},
171+
},
172+
};
173+
</script>
174+
<style lang=""></style>

resources/js/Pages/Config/Index.vue renamed to resources/js/Pages/Account/Credential.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
2-
<div class="container-fuild text-center pt-5" style="">
2+
<div class="container-fluid text-center">
33
<button class="btn btn-danger py-3" @click="revocarCredentials">
44
Revocar todos las credenciales generadas
55
</button>
6-
6+
77
<span v-show="message" class="pt-5 d-block text-success">
88
{{ message }}
99
</span>
@@ -16,6 +16,7 @@ export default {
1616
message: null,
1717
};
1818
},
19+
1920
methods: {
2021
revocarCredentials() {
2122
window.axios

0 commit comments

Comments
 (0)