nuevo formateo
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<p class="is-size-4 mb-4"><strong>Nombre: </strong> {{ nombre }}</p>
|
||||
<p class="is-size-4 mb-4"><strong>Correo: </strong> {{ correo }}</p>
|
||||
<div class="columns">
|
||||
<p class="is-size-4 column is-narrow" style="width: 250px;">
|
||||
<p class="is-size-4 column is-narrow" style="width: 250px">
|
||||
<strong>Clave de programa: </strong>
|
||||
</p>
|
||||
<b-select
|
||||
@@ -51,8 +51,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from "axios";
|
||||
import botonRegresar from "../../../../components/botonRegresar";
|
||||
import axios from 'axios'
|
||||
import botonRegresar from '../../../../components/botonRegresar'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -60,17 +60,17 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
idResponsable: localStorage.getItem("idResponsable"),
|
||||
correo: localStorage.getItem("correo"),
|
||||
nombre: localStorage.getItem("nombre"),
|
||||
idResponsable: localStorage.getItem('idResponsable'),
|
||||
correo: localStorage.getItem('correo'),
|
||||
nombre: localStorage.getItem('nombre'),
|
||||
programas: [],
|
||||
selected: {},
|
||||
token: {
|
||||
headers: {
|
||||
token: window.localStorage.getItem("token"),
|
||||
token: window.localStorage.getItem('token'),
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
obtenerProgramas() {
|
||||
@@ -80,58 +80,58 @@ export default {
|
||||
this.token
|
||||
)
|
||||
.then((res) => {
|
||||
this.programas = res.data;
|
||||
this.programas = res.data
|
||||
})
|
||||
.catch((err) => {
|
||||
this.error(err.response.data.message);
|
||||
});
|
||||
this.error(err.response.data.message)
|
||||
})
|
||||
},
|
||||
error(msj) {
|
||||
let salir = false;
|
||||
let salir = false
|
||||
switch (msj) {
|
||||
case "invalid signature":
|
||||
msj = "Tu token no es valido, inicia sesión de nuevo.";
|
||||
salir = true;
|
||||
break;
|
||||
case "jwt expired":
|
||||
msj = "Tu sesión ha expirado, inicia sesión de nuevo.";
|
||||
salir = true;
|
||||
break;
|
||||
case "jwt malformed":
|
||||
msj = "No se encontro tu token, inicia sesión de nuevo.";
|
||||
salir = true;
|
||||
break;
|
||||
case "No hay token":
|
||||
msj = "Ocurrio un error al enviar tu token, inicia sesión de nuevo.";
|
||||
salir = true;
|
||||
break;
|
||||
case 'invalid signature':
|
||||
msj = 'Tu token no es valido, inicia sesión de nuevo.'
|
||||
salir = true
|
||||
break
|
||||
case 'jwt expired':
|
||||
msj = 'Tu sesión ha expirado, inicia sesión de nuevo.'
|
||||
salir = true
|
||||
break
|
||||
case 'jwt malformed':
|
||||
msj = 'No se encontro tu token, inicia sesión de nuevo.'
|
||||
salir = true
|
||||
break
|
||||
case 'No hay token':
|
||||
msj = 'Ocurrio un error al enviar tu token, inicia sesión de nuevo.'
|
||||
salir = true
|
||||
break
|
||||
}
|
||||
|
||||
this.$buefy.dialog.alert({
|
||||
title: "Error",
|
||||
title: 'Error',
|
||||
message: msj,
|
||||
type: "is-danger",
|
||||
type: 'is-danger',
|
||||
hasIcon: true,
|
||||
icon: "alert-circle",
|
||||
iconPack: "mdi",
|
||||
ariaRole: "alertdialog",
|
||||
icon: 'alert-circle',
|
||||
iconPack: 'mdi',
|
||||
ariaRole: 'alertdialog',
|
||||
ariaModal: true,
|
||||
});
|
||||
})
|
||||
if (salir == true) {
|
||||
localStorage.clear();
|
||||
this.$router.push(`/`);
|
||||
localStorage.clear()
|
||||
this.$router.push(`/`)
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.obtenerProgramas();
|
||||
this.obtenerProgramas()
|
||||
},
|
||||
beforeCreate() {
|
||||
if (!localStorage.getItem("idResponsable")) {
|
||||
this.$router.push("/admin/programa");
|
||||
if (!localStorage.getItem('idResponsable')) {
|
||||
this.$router.push('/admin/programa')
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="container" style="margin-bottom:10%;margin-top:2%;">
|
||||
<div class="container" style="margin-bottom: 10%; margin-top: 2%">
|
||||
<BotonRegresar :path="'/admin/programa/infoResponsable'" />
|
||||
<p class="is-size-2">Editar información del responsable</p>
|
||||
<b-field label="Nombre">
|
||||
@@ -28,9 +28,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import validator from "validator";
|
||||
import botonRegresar from "../../../../../components/botonRegresar";
|
||||
import axios from "axios";
|
||||
import validator from 'validator'
|
||||
import botonRegresar from '../../../../../components/botonRegresar'
|
||||
import axios from 'axios'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -38,73 +38,73 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
idResponsable: localStorage.getItem("idResponsable"),
|
||||
idResponsable: localStorage.getItem('idResponsable'),
|
||||
viejo: {
|
||||
nombre: localStorage.getItem("nombre"),
|
||||
correo: localStorage.getItem("correo"),
|
||||
nombre: localStorage.getItem('nombre'),
|
||||
correo: localStorage.getItem('correo'),
|
||||
},
|
||||
nuevo: {
|
||||
nombre: "",
|
||||
correo: "",
|
||||
nombre: '',
|
||||
correo: '',
|
||||
},
|
||||
idServicio: localStorage.getItem("idServicio"),
|
||||
idServicio: localStorage.getItem('idServicio'),
|
||||
token: {
|
||||
headers: {
|
||||
token: window.localStorage.getItem("token"),
|
||||
token: window.localStorage.getItem('token'),
|
||||
},
|
||||
},
|
||||
isLoading: false,
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
mostrar() {
|
||||
if (validator.isEmail(this.nuevo.correo) || this.nuevo.nombre) {
|
||||
if (this.nuevo.correo) {
|
||||
if (validator.isEmail(this.nuevo.correo)) {
|
||||
return true;
|
||||
return true
|
||||
} else {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return true
|
||||
}
|
||||
},
|
||||
actualizar() {
|
||||
const data = { idUsuario: this.idResponsable };
|
||||
const data = { idUsuario: this.idResponsable }
|
||||
|
||||
this.isLoading = true;
|
||||
this.isLoading = true
|
||||
if (this.nuevo.correo) {
|
||||
data.correo = this.nuevo.correo;
|
||||
data.correo = this.nuevo.correo
|
||||
}
|
||||
if (this.nuevo.nombre) {
|
||||
data.nombre = this.nuevo.nombre;
|
||||
data.nombre = this.nuevo.nombre
|
||||
}
|
||||
axios
|
||||
.put(`${process.env.api}/usuario/responsable/update`, data, this.token)
|
||||
.then((res) => {
|
||||
this.isLoading = false;
|
||||
this.toast();
|
||||
this.$router.push("/admin/programa");
|
||||
this.isLoading = false
|
||||
this.toast()
|
||||
this.$router.push('/admin/programa')
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoading = false;
|
||||
this.error(err.response.data.message);
|
||||
});
|
||||
this.isLoading = false
|
||||
this.error(err.response.data.message)
|
||||
})
|
||||
},
|
||||
passwordDialog() {
|
||||
this.$buefy.dialog.confirm({
|
||||
title: "Actualizar datos",
|
||||
message: "¿Seguro(a) que quiere actualizar la contraseña?",
|
||||
confirmText: "Confirmar",
|
||||
cancelText: "Cancelar",
|
||||
type: "is-success",
|
||||
title: 'Actualizar datos',
|
||||
message: '¿Seguro(a) que quiere actualizar la contraseña?',
|
||||
confirmText: 'Confirmar',
|
||||
cancelText: 'Cancelar',
|
||||
type: 'is-success',
|
||||
hasIcon: true,
|
||||
onConfirm: () => this.password(),
|
||||
});
|
||||
})
|
||||
},
|
||||
password() {
|
||||
this.isLoading = true;
|
||||
const data = { idUsuario: this.idResponsable };
|
||||
this.isLoading = true
|
||||
const data = { idUsuario: this.idResponsable }
|
||||
axios
|
||||
.put(
|
||||
`${process.env.api}/usuario/new_password_responsable`,
|
||||
@@ -113,65 +113,65 @@ export default {
|
||||
)
|
||||
.then((res) => {
|
||||
this.$buefy.toast.open({
|
||||
message: "Se ha enviado el correo con la nueva contraseña",
|
||||
type: "is-success",
|
||||
});
|
||||
this.$router.push("/admin");
|
||||
message: 'Se ha enviado el correo con la nueva contraseña',
|
||||
type: 'is-success',
|
||||
})
|
||||
this.$router.push('/admin')
|
||||
})
|
||||
.catch((err) => {
|
||||
this.error(err.response.data.message);
|
||||
this.error(err.response.data.message)
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
});
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
toast() {
|
||||
this.$buefy.toast.open({
|
||||
message: "Se han actualizado los datos del responsable",
|
||||
type: "is-success",
|
||||
});
|
||||
message: 'Se han actualizado los datos del responsable',
|
||||
type: 'is-success',
|
||||
})
|
||||
},
|
||||
error(msj) {
|
||||
let salir = false;
|
||||
let salir = false
|
||||
switch (msj) {
|
||||
case "invalid signature":
|
||||
msj = "Tu token no es valido, inicia sesión de nuevo.";
|
||||
salir = true;
|
||||
break;
|
||||
case "jwt expired":
|
||||
msj = "Tu sesión ha expirado, inicia sesión de nuevo.";
|
||||
salir = true;
|
||||
break;
|
||||
case "jwt malformed":
|
||||
msj = "No se encontro tu token, inicia sesión de nuevo.";
|
||||
salir = true;
|
||||
break;
|
||||
case "No hay token":
|
||||
msj = "Ocurrio un error al enviar tu token, inicia sesión de nuevo.";
|
||||
salir = true;
|
||||
break;
|
||||
case 'invalid signature':
|
||||
msj = 'Tu token no es valido, inicia sesión de nuevo.'
|
||||
salir = true
|
||||
break
|
||||
case 'jwt expired':
|
||||
msj = 'Tu sesión ha expirado, inicia sesión de nuevo.'
|
||||
salir = true
|
||||
break
|
||||
case 'jwt malformed':
|
||||
msj = 'No se encontro tu token, inicia sesión de nuevo.'
|
||||
salir = true
|
||||
break
|
||||
case 'No hay token':
|
||||
msj = 'Ocurrio un error al enviar tu token, inicia sesión de nuevo.'
|
||||
salir = true
|
||||
break
|
||||
}
|
||||
|
||||
this.$buefy.dialog.alert({
|
||||
title: "Error",
|
||||
title: 'Error',
|
||||
message: msj,
|
||||
type: "is-danger",
|
||||
type: 'is-danger',
|
||||
hasIcon: true,
|
||||
icon: "alert-circle",
|
||||
iconPack: "mdi",
|
||||
ariaRole: "alertdialog",
|
||||
icon: 'alert-circle',
|
||||
iconPack: 'mdi',
|
||||
ariaRole: 'alertdialog',
|
||||
ariaModal: true,
|
||||
});
|
||||
})
|
||||
if (salir == true) {
|
||||
localStorage.clear();
|
||||
this.$router.push(`/`);
|
||||
localStorage.clear()
|
||||
this.$router.push(`/`)
|
||||
}
|
||||
},
|
||||
},
|
||||
beforeCreate() {
|
||||
if (!localStorage.getItem("idResponsable")) {
|
||||
this.$router.push("/admin/programa");
|
||||
if (!localStorage.getItem('idResponsable')) {
|
||||
this.$router.push('/admin/programa')
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user