responsable funiones imprimir

This commit is contained in:
Lemuel Marquez
2021-08-04 17:03:13 -05:00
parent 90aad06995
commit 68c1c95ff4
8 changed files with 65 additions and 170 deletions
-1
View File
@@ -57,7 +57,6 @@ export default {
imprimirWarning: { type: Function, required: true },
imprimirError: { type: Function, required: true },
},
methods: {
validarFechas() {
const fechaInicio = moment(new Date(this.selectedInicio))
+24 -41
View File
@@ -11,7 +11,11 @@
expanded
>
<section
class="section is-flex is-align-items-center is-justify-content-center drag-drop"
class="
section
is-flex is-align-items-center is-justify-content-center
drag-drop
"
>
<div class="content has-text-centered">
<p>
@@ -29,34 +33,38 @@
</b-field>
<div>
<b-button :disabled="!csv.name" @click="dialog()" class="is-info"
>Enviar archivo</b-button
>
<b-button :disabled="!csv.name" @click="dialog()" class="is-info">
Enviar archivo
</b-button>
<b-button type="is-link" tag="a" target="_blank" :href="link"
>Descargar plantilla</b-button
>
<b-button type="is-link" tag="a" target="_blank" :href="link">
Descargar plantilla
</b-button>
</div>
<b-loading :is-full-page="true" :can-cancel="false" v-model="isLoading">
</b-loading>
<b-loading :is-full-page="true" :can-cancel="false" v-model="isLoading" />
</div>
</template>
<script>
import axios from 'axios'
export default {
data() {
return {
admin: {},
csv: {},
link: `${process.env.api}/plantilla.csv`,
token: {},
isLoading: false,
toastType: '',
toastMessage: '',
}
},
props: {
admin: { type: Object, required: true },
imprimirMensaje: { type: Function, required: true },
imprimirWarning: { type: Function, required: true },
imprimirError: { type: Function, required: true },
},
methods: {
validarExt() {
const extPermitidas = /(.csv)$/i
@@ -91,7 +99,11 @@ export default {
this.isLoading = true
formData.append('csv', this.csv)
axios
.post(`${process.env.api}/programa/carga_masiva`, formData, this.token)
.post(
`${process.env.api}/programa/carga_masiva`,
formData,
this.admin.token
)
.then((res) => {
this.isLoading = false
this.toastType = 'is-success'
@@ -104,35 +116,6 @@ export default {
this.imprimirError(err.response.data)
})
},
imprimirError(err) {
this.$buefy.dialog.alert({
title: 'Error',
message: err.message,
type: 'is-danger',
hasIcon: true,
icon: 'alert-circle',
ariaRole: 'alertdialog',
ariaModal: true,
})
if (err.err === 'token error') {
localStorage.clear()
this.$router.push('/')
}
},
getLocalhostInfo() {
this.admin.idUsuario = localStorage.getItem('idUsuario')
this.admin.idTipoUsuario = Number(localStorage.getItem('idTipoUsuario'))
this.admin.tipoUsuario = localStorage.getItem('tipoUsuario')
this.token = {
headers: {
'Content-Type': 'multipart/form-data',
token: localStorage.getItem('token'),
},
}
},
},
created() {
this.getLocalhostInfo()
},
}
</script>
@@ -53,14 +53,18 @@ import axios from 'axios'
export default {
data() {
return {
admin: {},
responsable: {},
idResponsable: null,
nuevo: {},
token: {},
isLoading: false,
}
},
props: {
admin: { type: Object, required: true },
imprimirMensaje: { type: Function, required: true },
imprimirWarning: { type: Function, required: true },
imprimirError: { type: Function, required: true },
},
methods: {
mostrarBoton() {
if (this.nuevo.correo) {
@@ -106,7 +110,7 @@ export default {
axios
.get(
`${process.env.api}/usuario/responsable?idUsuario=${this.idResponsable}`,
this.token
this.admin.token
)
.then((res) => {
this.responsable = res.data
@@ -125,7 +129,11 @@ export default {
if (this.nuevo.correo) data.correo = this.nuevo.correo
if (this.nuevo.nombre) data.nombre = this.nuevo.nombre
axios
.put(`${process.env.api}/usuario/responsable/update`, data, this.token)
.put(
`${process.env.api}/usuario/responsable/update`,
data,
this.admin.token
)
.then((res) => {
this.isLoading = false
this.toast()
@@ -144,7 +152,7 @@ export default {
.put(
`${process.env.api}/usuario/new_password_responsable`,
data,
this.token
this.admin.token
)
.then((res) => {
this.$buefy.toast.open({
@@ -159,35 +167,9 @@ export default {
this.imprimirError(err.response.data)
})
},
imprimirError(err) {
this.$buefy.dialog.alert({
title: 'Error',
message: err.message,
type: 'is-danger',
hasIcon: true,
icon: 'alert-circle',
ariaRole: 'alertdialog',
ariaModal: true,
})
if (err.err === 'token error') {
localStorage.clear()
this.$router.push('/')
}
},
getLocalhostInfo() {
this.admin.idUsuario = localStorage.getItem('idUsuario')
this.admin.idTipoUsuario = Number(localStorage.getItem('idTipoUsuario'))
this.admin.tipoUsuario = localStorage.getItem('tipoUsuario')
this.token = {
headers: {
token: localStorage.getItem('token'),
},
}
this.idResponsable = localStorage.getItem('idResponsable')
},
},
created() {
this.getLocalhostInfo()
this.idResponsable = localStorage.getItem('idResponsable')
if (this.admin.idTipoUsuario === 1) this.obtenerResponsable()
},
}
@@ -22,6 +22,7 @@
<b-field label="Institucion:">
<p class="input">{{ programa.institucion }}</p>
</b-field>
<b-field label="Dependencia:">
<p class="input">{{ programa.dependencia }}</p>
</b-field>
@@ -41,8 +42,7 @@
</b-button>
</div>
<b-loading :is-full-page="true" :can-cancel="false" v-model="isLoading">
</b-loading>
<b-loading :is-full-page="true" :can-cancel="false" v-model="isLoading" />
</div>
</template>
@@ -52,23 +52,27 @@ import axios from 'axios'
export default {
data() {
return {
admin: {},
idResponsable: null,
responsable: {},
programas: [],
programa: {},
programaSeleccionado: '',
token: {},
isLoading: false,
}
},
props: {
admin: { type: Object, required: true },
imprimirMensaje: { type: Function, required: true },
imprimirWarning: { type: Function, required: true },
imprimirError: { type: Function, required: true },
},
methods: {
obtenerResponsable() {
this.isLoading = true
axios
.get(
`${process.env.api}/usuario/responsable?idUsuario=${this.idResponsable}`,
this.token
this.admin.token
)
.then((res) => {
this.responsable = res.data
@@ -83,7 +87,7 @@ export default {
axios
.get(
`${process.env.api}/programa/programas_admin?idUsuario=${this.idResponsable}`,
this.token
this.admin.token
)
.then((res) => {
this.programas = res.data
@@ -92,32 +96,6 @@ export default {
this.error(err.response.data.message)
})
},
imprimirError(err) {
this.$buefy.dialog.alert({
title: 'Error',
message: err.message,
type: 'is-danger',
hasIcon: true,
icon: 'alert-circle',
ariaRole: 'alertdialog',
ariaModal: true,
})
if (err.err === 'token error') {
localStorage.clear()
this.$router.push('/')
}
},
getLocalhostInfo() {
this.admin.idUsuario = localStorage.getItem('idUsuario')
this.admin.idTipoUsuario = Number(localStorage.getItem('idTipoUsuario'))
this.admin.tipoUsuario = localStorage.getItem('tipoUsuario')
this.token = {
headers: {
token: localStorage.getItem('token'),
},
}
this.idResponsable = localStorage.getItem('idResponsable')
},
},
watch: {
programaSeleccionado() {
@@ -125,7 +103,7 @@ export default {
},
},
created() {
this.getLocalhostInfo()
this.idResponsable = localStorage.getItem('idResponsable')
if (this.admin.idTipoUsuario === 1) {
this.obtenerResponsable()
this.obtenerProgramas()
@@ -11,7 +11,7 @@
v-model="busqueda.correo"
@keyup.enter.native="obtenerResponsables()"
rounded
></b-input>
/>
</b-field>
<b-field class="column" label="Nombre">
@@ -22,7 +22,7 @@
v-model="busqueda.nombre"
@keyup.enter.native="obtenerResponsables()"
rounded
></b-input>
/>
</b-field>
<div class="column is-align-self-center">
@@ -65,8 +65,8 @@
</b-table-column>
<b-table-column field="estado" label="Estado" v-slot="props" centered>
<span :class="style(props.row.activo)"
>{{ props.row.activo ? 'Activo' : 'Desactivado' }}
<span :class="style(props.row.activo)">
{{ props.row.activo ? 'Activo' : 'Desactivado' }}
</span>
</b-table-column>
</b-table>
@@ -79,7 +79,6 @@ import axios from 'axios'
export default {
data() {
return {
admin: {},
data: [],
page: 1,
perPage: 25,
@@ -87,10 +86,15 @@ export default {
isLoading: false,
busqueda: {},
busquedaAnterior: {},
token: {},
responsableSeleccionado: {},
}
},
props: {
admin: { type: Object, required: true },
imprimirMensaje: { type: Function, required: true },
imprimirWarning: { type: Function, required: true },
imprimirError: { type: Function, required: true },
},
methods: {
style(activo) {
let style = 'tag'
@@ -120,7 +124,7 @@ export default {
axios
.get(
`${process.env.api}/usuario/responsables?&pagina=${this.page}${data}`,
this.token
this.admin.token
)
.then((res) => {
this.data = res.data.responsables
@@ -132,31 +136,6 @@ export default {
this.imprimirError(err.response.data)
})
},
imprimirError(err) {
this.$buefy.dialog.alert({
title: 'Error',
message: err.message,
type: 'is-danger',
hasIcon: true,
icon: 'alert-circle',
ariaRole: 'alertdialog',
ariaModal: true,
})
if (err.err === 'token error') {
localStorage.clear()
this.$router.push('/')
}
},
getLocalhostInfo() {
this.admin.idUsuario = localStorage.getItem('idUsuario')
this.admin.idTipoUsuario = Number(localStorage.getItem('idTipoUsuario'))
this.admin.tipoUsuario = localStorage.getItem('tipoUsuario')
this.token = {
headers: {
token: localStorage.getItem('token'),
},
}
},
},
watch: {
responsableSeleccionado() {
@@ -168,10 +147,7 @@ export default {
},
},
created() {
this.getLocalhostInfo()
if (this.admin.idTipoUsuario === 1) {
this.obtenerResponsables()
}
if (this.admin.idTipoUsuario === 1) this.obtenerResponsables()
},
}
</script>
-7
View File
@@ -29,13 +29,6 @@ export default {
CargaMasiva,
BotonRegresar,
},
beforeCreate() {
const idTipoUsuario = Number(localStorage.getItem('idTipoUsuario'))
if (idTipoUsuario === 2) this.$router.push('/responsable')
if (idTipoUsuario === 3) this.$router.push('/alumno')
if (idTipoUsuario === 4) this.$router.push('/casoEspecial')
},
data() {
return {
admin: {},
@@ -28,16 +28,6 @@ export default {
BotonRegresar,
Responsable,
},
beforeCreate() {
const idTipoUsuario = Number(localStorage.getItem('idTipoUsuario'))
if (idTipoUsuario === 2) this.$router.push('/responsable')
if (idTipoUsuario === 3) this.$router.push('/alumno')
if (idTipoUsuario === 4) this.$router.push('/casoEspecial')
if (!localStorage.getItem('idResponsable'))
this.$router.push('/admin/responsables')
},
data() {
return {
admin: {},
@@ -114,6 +104,8 @@ export default {
if (this.admin.idTipoUsuario === 2) this.$router.push('/responsable')
if (this.admin.idTipoUsuario === 3) this.$router.push('/alumno')
if (this.admin.idTipoUsuario === 4) this.$router.push('/casoEspecial')
if (!localStorage.getItem('idResponsable'))
this.$router.push('/admin/responsables')
},
}
</script>
@@ -20,16 +20,6 @@ export default {
BotonRegresar,
UpdateResponsable,
},
beforeCreate() {
const idTipoUsuario = Number(localStorage.getItem('idTipoUsuario'))
if (idTipoUsuario === 2) this.$router.push('/responsable')
if (idTipoUsuario === 3) this.$router.push('/alumno')
if (idTipoUsuario === 4) this.$router.push('/casoEspecial')
if (!localStorage.getItem('idResponsable'))
this.$router.push('/admin/responsables')
},
data() {
return {
admin: {},
@@ -106,6 +96,8 @@ export default {
if (this.admin.idTipoUsuario === 2) this.$router.push('/responsable')
if (this.admin.idTipoUsuario === 3) this.$router.push('/alumno')
if (this.admin.idTipoUsuario === 4) this.$router.push('/casoEspecial')
if (!localStorage.getItem('idResponsable'))
this.$router.push('/admin/responsables')
},
}
</script>