{"version":3,"sources":["webpack:///./src/views/sections/Info.vue?ecfa","webpack:///./src/views/sections/Info.vue?cdec","webpack:///src/views/sections/Info.vue","webpack:///./src/views/sections/Info.vue?1cb9","webpack:///./src/views/sections/Info.vue"],"names":["render","_vm","this","_h","$createElement","_c","_self","attrs","staticClass","staticRenderFns","component","VCol","VContainer","VResponsive","VRow","VThemeProvider"],"mappings":"gHAAA,W,gECAA,IAAIA,EAAS,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAOE,EAAG,mBAAmB,CAACE,MAAM,CAAC,KAAO,KAAK,CAACF,EAAG,eAAe,CAACG,YAAY,gBAAgBD,MAAM,CAAC,GAAK,aAAa,CAACF,EAAG,eAAe,CAACG,YAAY,UAAUD,MAAM,CAAC,YAAY,SAAS,CAACF,EAAG,cAAc,CAACE,MAAM,CAAC,MAAQ,KAAK,CAACF,EAAG,QAAQ,CAACA,EAAG,QAAQ,CAACE,MAAM,CAAC,KAAO,KAAK,GAAK,MAAM,CAACF,EAAG,cAAc,GAAGA,EAAG,QAAQ,CAACE,MAAM,CAAC,KAAO,KAAK,GAAK,MAAM,CAACF,EAAG,iBAAiB,CAACE,MAAM,CAAC,MAAQ,aAAaF,EAAG,wBAAwB,CAACE,MAAM,CAAC,MAAQ,OAAO,GAAGF,EAAG,QAAQ,CAACE,MAAM,CAAC,KAAO,KAAK,GAAK,MAAM,CAACF,EAAG,kBAAkB,GAAGA,EAAG,QAAQ,CAACE,MAAM,CAAC,KAAO,KAAK,GAAK,MAAM,CAACF,EAAG,cAAc,IAAI,IAAI,IAAI,IAAI,IAAI,IAC5qBI,EAAkB,GCgDtB,G,8BAAA,CACE,KAAF,sBAEE,WAAF,CACI,aAAJ,WAAM,OAAN,iDACI,UAAJ,WAAM,OAAN,oDCtD6V,I,yGCQzVC,EAAY,eACd,EACAV,EACAS,GACA,EACA,KACA,KACA,MAIa,aAAAC,EAAiB,QAShC,IAAkBA,EAAW,CAACC,OAAA,KAAKC,aAAA,KAAWC,cAAA,KAAYC,OAAA,KAAKC,iBAAA","file":"js/chunk-f782c928.8998d61d.js","sourcesContent":["export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--9-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--9-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--9-oneOf-1-2!../../../node_modules/sass-loader/dist/cjs.js??ref--9-oneOf-1-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Info.vue?vue&type=style&index=0&lang=sass&\"","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('v-theme-provider',{attrs:{\"dark\":\"\"}},[_c('base-section',{staticClass:\"grey darken-4\",attrs:{\"id\":\"info-alt\"}},[_c('v-responsive',{staticClass:\"mx-auto\",attrs:{\"max-width\":\"1400\"}},[_c('v-container',{attrs:{\"fluid\":\"\"}},[_c('v-row',[_c('v-col',{attrs:{\"cols\":\"12\",\"md\":\"3\"}},[_c('base-info')],1),_c('v-col',{attrs:{\"cols\":\"12\",\"md\":\"3\"}},[_c('base-info-card',{attrs:{\"title\":\"Contact\"}}),_c('base-business-contact',{attrs:{\"dense\":\"\"}})],1),_c('v-col',{attrs:{\"cols\":\"12\",\"md\":\"3\"}},[_c('info-features')],1),_c('v-col',{attrs:{\"cols\":\"12\",\"md\":\"3\"}},[_c('instagram')],1)],1)],1)],1)],1)],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n <v-theme-provider dark>\n <base-section\n id=\"info-alt\"\n class=\"grey darken-4\"\n >\n <v-responsive\n class=\"mx-auto\"\n max-width=\"1400\"\n >\n <v-container fluid>\n <v-row>\n <v-col\n cols=\"12\"\n md=\"3\"\n >\n <base-info />\n </v-col>\n\n <v-col\n cols=\"12\"\n md=\"3\"\n >\n <base-info-card title=\"Contact\" />\n\n <base-business-contact dense />\n </v-col>\n\n <v-col\n cols=\"12\"\n md=\"3\"\n >\n <info-features />\n </v-col>\n\n <v-col\n cols=\"12\"\n md=\"3\"\n >\n <instagram />\n </v-col>\n </v-row>\n </v-container>\n </v-responsive>\n </base-section>\n </v-theme-provider>\n</template>\n\n<script>\n export default {\n name: 'SectionBusinessInfo',\n\n components: {\n InfoFeatures: () => import('@/components/InfoFeatures'),\n Instagram: () => import('@/components/Instagram'),\n },\n }\n</script>\n\n<style lang=\"sass\">\n #info-alt a\n text-decoration: none\n</style>\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Info.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Info.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Info.vue?vue&type=template&id=951250be&\"\nimport script from \"./Info.vue?vue&type=script&lang=js&\"\nexport * from \"./Info.vue?vue&type=script&lang=js&\"\nimport style0 from \"./Info.vue?vue&type=style&index=0&lang=sass&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports\n\n/* vuetify-loader */\nimport installComponents from \"!../../../node_modules/vuetify-loader/lib/runtime/installComponents.js\"\nimport { VCol } from 'vuetify/lib/components/VGrid';\nimport { VContainer } from 'vuetify/lib/components/VGrid';\nimport { VResponsive } from 'vuetify/lib/components/VResponsive';\nimport { VRow } from 'vuetify/lib/components/VGrid';\nimport { VThemeProvider } from 'vuetify/lib/components/VThemeProvider';\ninstallComponents(component, {VCol,VContainer,VResponsive,VRow,VThemeProvider})\n"],"sourceRoot":""}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -5,26 +5,25 @@ import queryString from 'query-string' ...@@ -5,26 +5,25 @@ import queryString from 'query-string'
export async function getAreas (idCenter, page = 1) { export async function getAreas (idCenter, page = 1) {
const url = `${REQUEST_DIR}centros/${idCenter}/areas?page=${page}` const url = `${REQUEST_DIR}centros/${idCenter}/areas?page=${page}`
const response = await axios.get(url, requestData()) const response = await axios.get(url, requestDataFormUrlEncoded())
return response return response
} }
export async function getArea (id) { export async function getArea (id) {
const url = `${REQUEST_DIR}areas/${id}` const url = `${REQUEST_DIR}areas/${id}`
const response = await axios.get(url, requestData()) const response = await axios.get(url, requestDataFormUrlEncoded())
return response return response
} }
export async function postArea (data) { export async function postArea (data) {
const url = `${REQUEST_DIR}/areas` const url = `${REQUEST_DIR}areas`
data = queryString.stringify(data)
const response = await axios.post(url, data, requestDataFormUrlEncoded()) const response = await axios.post(url, data, requestDataFormUrlEncoded())
return response return response
} }
export async function deleteArea (idCenter, id) { export async function deleteArea (idCenter, id) {
const url = `${REQUEST_DIR}centros/${idCenter}/areas/${id}` const url = `${REQUEST_DIR}centros/${idCenter}/areas/${id}`
const response = await axios.delete(url, requestData()) const response = await axios.delete(url, requestDataFormUrlEncoded())
return response return response
} }
......
import { REQUEST_DIR } from '@/utils/constants' import { REQUEST_DIR } from '@/utils/constants'
import { requestData, requestDataFormUrlEncoded } from './requestHeadersHelper' import { requestData, requestDataFormUrlEncoded } from './requestHeadersHelper'
import axios from 'axios' import axios from 'axios'
import { store } from '@/store'
export async function login (user, pass) { export async function login (user, pass) {
user = { user = {
...@@ -8,6 +9,25 @@ export async function login (user, pass) { ...@@ -8,6 +9,25 @@ export async function login (user, pass) {
password: pass, password: pass,
} }
const url = `${REQUEST_DIR}auth/login` const url = `${REQUEST_DIR}auth/login`
const response = await axios.post(url, user, requestDataFormUrlEncoded()) const response = await axios
.post(url, user, requestData())
return response
}
export async function logout () {
const url = `${REQUEST_DIR}auth/logout`
const response = await axios.get(url, requestDataFormUrlEncoded())
return response
}
export async function getUser () {
const url = `${REQUEST_DIR}auth/user`
const response = await axios.get(url, requestDataFormUrlEncoded())
store.commit('setAntigens', response)
return response
}
export async function register (data) {
const url = `${REQUEST_DIR}auth/signup`
const response = await axios.post(url, data, requestData())
return response return response
} }
import axios from 'axios' import axios from 'axios'
import store from '@/store'
import { REQUEST_DIR } from '../utils/constants' import { REQUEST_DIR } from '../utils/constants'
import { import { requestData, requestDataFormUrlEncoded } from './requestHeadersHelper'
requestData,
requestDataFormUrlEncoded,
} from './requestHeadersHelper'
export async function getCenters (page = 1) { export async function getCenters (filters) {
const url = `${REQUEST_DIR}centros?page=${page}` const url = `${REQUEST_DIR}centros`
const response = await axios.get(url, requestData()) const response = await axios.get(url, requestData(filters))
const data = response.data.centros
store.commit('setCenters', data)
return response return response
} }
...@@ -25,7 +25,7 @@ export async function postCenter (data) { ...@@ -25,7 +25,7 @@ export async function postCenter (data) {
export async function deleteCenter (id) { export async function deleteCenter (id) {
const url = `${REQUEST_DIR}centros/${id}` const url = `${REQUEST_DIR}centros/${id}`
const response = await axios.delete(url, requestData()) const response = await axios.delete(url, requestDataFormUrlEncoded())
return response return response
} }
......
import axios from 'axios' import axios from 'axios'
import store from '@/store' import store from '@/store'
import { REQUEST_DIR } from '../utils/constants' import { REQUEST_DIR } from '../utils/constants'
import { requestData } from './requestHeadersHelper' import { requestDataFormUrlEncoded } from './requestHeadersHelper'
export async function getCategories () { export async function getCategories () {
const url = `${REQUEST_DIR}nomenclador/categoria` const url = `${REQUEST_DIR}nomenclador/categoria`
const response = await axios.get(url, requestData()) const response = await axios.get(url, requestDataFormUrlEncoded())
const categories = response.data const categories = response.data
store.commit('setCategories', categories) store.commit('setCategories', categories)
return response return response
} }
export async function getAntigenos () { export async function getAntigens () {
const url = `${REQUEST_DIR}nomenclador/antigeno` const url = `${REQUEST_DIR}nomenclador/antigeno`
const response = await axios.get(url, requestData()) const response = await axios.get(url, requestDataFormUrlEncoded())
const antigens = response.data const antigens = response.data
store.commit('setAntigens', antigens) store.commit('setAntigens', antigens)
return response return response
} }
export async function getSystemStatus () { export async function getSystemStatus () {
const url = `${REQUEST_DIR}nomenclador/sistema` const url = `${REQUEST_DIR}nomenclador/sistema`
const response = await axios.get(url, requestData()) const response = await axios.get(url, requestDataFormUrlEncoded())
store.commit('setSystemStatuses', response.data) store.commit('setSystemStatuses', response.data)
return response return response
} }
export async function getHealthStatus () { export async function getHealthStatuses () {
const url = `${REQUEST_DIR}nomenclador/estado` const url = `${REQUEST_DIR}nomenclador/salud`
const response = await axios.get(url, requestData()) const response = await axios.get(url, requestDataFormUrlEncoded())
const health = response.data const health = response.data
store.commit('setHealthStatuses', health) store.commit('setHealthStatuses', health)
return response return response
} }
export async function getProvinces () { export async function getProvinces () {
const url = `${REQUEST_DIR}nomenclador/provincia` const url = `${REQUEST_DIR}nomenclador/provincia`
const response = await axios.get(url, requestData()) const response = await axios.get(url, requestDataFormUrlEncoded())
const provinces = response.data const provinces = response.data
store.commit('setProvinces', provinces) store.commit('setProvinces', provinces)
return response return response
} }
export async function getMunicipalities (id = 6) { export async function getMunicipalities (id = 6) {
const url = `${REQUEST_DIR}nomenclador/municipio/${id}` const url = `${REQUEST_DIR}nomenclador/municipio/${id}`
const response = await axios.get(url, requestData()) const response = await axios.get(url, requestDataFormUrlEncoded())
const municipalities = response.data const municipalities = response.data
store.commit('setMunicipalities', municipalities) store.commit('setMunicipalities', municipalities)
return response return response
} }
export async function getClasifications () { export async function getClasifications () {
const url = `${REQUEST_DIR}nomenclador/clasificacion` const url = `${REQUEST_DIR}nomenclador/riesgo-categoria`
const response = await axios.get(url, requestData()) const response = await axios.get(url, requestDataFormUrlEncoded())
const clasifications = response.data const clasifications = response.data
store.commit('setClasifications', clasifications) store.commit('setClasifications', clasifications)
return response return response
} }
export async function getHealthAreas (id = 1) { export async function getHealthAreas (id = 1) {
const url = `${REQUEST_DIR}nomenclador/salud/${id}` const url = `${REQUEST_DIR}nomenclador/salud/${id}`
const response = await axios.get(url, requestData()) const response = await axios.get(url, requestDataFormUrlEncoded())
const hAreas = response.data const hAreas = response.data
store.commit('setHealthAreas', hAreas) store.commit('setHealthAreas', hAreas)
return response return response
......
import axios from 'axios' import axios from 'axios'
import { REQUEST_DIR } from '../utils/constants' import { REQUEST_DIR } from '../utils/constants'
import { requestData, requestDataFormUrlEncoded } from './requestHeadersHelper' import { requestData, requestDataFormUrlEncoded } from './requestHeadersHelper'
import queryString from 'query-string'
export async function getPatients (page = 1) { export async function getPatients (filters) {
const url = `${REQUEST_DIR}pacientes?page=${page}` const url = `${REQUEST_DIR}pacientes`
const response = await axios.get(url, requestData()) const response = await axios.get(url, requestDataFormUrlEncoded(filters))
return response return response
} }
export async function getPatient (id) { export async function getPatient (id) {
const url = `${REQUEST_DIR}pacientes/${id}` const url = `${REQUEST_DIR}pacientes/${id}`
const response = await axios.get(url, requestData()) const response = await axios.get(url, requestDataFormUrlEncoded())
return response return response
} }
...@@ -23,7 +22,7 @@ export async function postPatient (data) { ...@@ -23,7 +22,7 @@ export async function postPatient (data) {
export async function deletePatient (id) { export async function deletePatient (id) {
const url = `${REQUEST_DIR}pacientes/${id}` const url = `${REQUEST_DIR}pacientes/${id}`
const response = await axios.delete(url, requestData()) const response = await axios.delete(url, requestDataFormUrlEncoded())
return response return response
} }
...@@ -32,3 +31,39 @@ export async function putPatient (data) { ...@@ -32,3 +31,39 @@ export async function putPatient (data) {
const response = await axios.put(url, data, requestDataFormUrlEncoded()) const response = await axios.put(url, data, requestDataFormUrlEncoded())
return response return response
} }
export async function checkPatientData (data) {
data.estado_sistema = 3
const url = `${REQUEST_DIR}pacientes/${data.id_paciente}`
const response = await axios.put(url, data, requestDataFormUrlEncoded())
return response
}
export async function assignatePatient (idCenter, idPatient) {
const url = `${REQUEST_DIR}asignar-pacientes`
const data = {
id_centro: idCenter,
id_paciente: idPatient,
}
const response = await axios.post(url, data, requestDataFormUrlEncoded())
return response
}
export async function ingresarPacientes (patients_ids, id_area) {
const url = `${REQUEST_DIR}ingresar-pacientes`
const data = {
patients_ids: patients_ids,
id_paciente: id_area,
}
const response = await axios.post(url, data, requestDataFormUrlEncoded())
return response
}
export async function admitPatient (idPatient) {
const url = `${REQUEST_DIR}pacientes`
const response = await axios.post(
url,
idPatient,
requestDataFormUrlEncoded(),
)
return response
}
import { AGENT } from '@/utils/constants' import { AGENT } from '@/utils/constants'
import { decrypt } from '../utils/enc'
export function requestData () { export function requestData (filters) {
return { return {
params: filters,
headers: { headers: {
Authorization: 'Bearer ' + decrypt(localStorage.getItem('tkn')), // Authorization: 'Bearer ' + localStorage.getItem('tkn'),
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Accept: 'application/json', Accept: 'application/json',
}, },
...@@ -14,10 +14,11 @@ export function requestData () { ...@@ -14,10 +14,11 @@ export function requestData () {
} }
} }
export function requestDataFormUrlEncoded () { export function requestDataFormUrlEncoded (filters) {
return { return {
params: filters,
headers: { headers: {
Authorization: 'Bearer ' + decrypt(localStorage.getItem('tkn')), Authorization: 'Bearer ' + localStorage.getItem('tkn'),
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Accept: 'application/json', Accept: 'application/json',
}, },
......
<template> <template>
<v-expansion-panel> <v-expansion-panel>
<v-expansion-panel-header>Filtros</v-expansion-panel-header> <v-expansion-panel-header>
<template v-slot:default="{ open }">
<v-row no-gutters>
<v-col
cols="12"
md="2"
lg="1"
>
<span>Filtros</span>
</v-col>
<v-col
cols="8"
class="text--secondary"
>
<v-fade-transition
leave-absolute
>
<span
v-if="open"
key="0"
>
Escoja los parámetros para su búsqueda
</span>
<span
v-else-if="activeFilters.length !== 0 && filterStatus"
key="1"
>
<v-icon color="warning">mdi-alert</v-icon>
Filtros activos:
<span><b> {{ activeFilters.toString() }}</b></span>
</span>
</v-fade-transition>
</v-col>
</v-row>
</template>
</v-expansion-panel-header>
<v-expansion-panel-content> <v-expansion-panel-content>
<v-row> <v-row>
<v-col <v-col
...@@ -9,7 +44,7 @@ ...@@ -9,7 +44,7 @@
md="2" md="2"
> >
<v-text-field <v-text-field
v-model="filters.ci" v-model="cacheFilters.ci"
label="Carné de Identidad" label="Carné de Identidad"
:counter="11" :counter="11"
:rules="ciRules" :rules="ciRules"
...@@ -21,7 +56,7 @@ ...@@ -21,7 +56,7 @@
md="2" md="2"
> >
<v-text-field <v-text-field
v-model="filters.nombre" v-model="cacheFilters.nombre"
label="Nombre" label="Nombre"
clearable clearable
/> />
...@@ -32,7 +67,7 @@ ...@@ -32,7 +67,7 @@
md="2" md="2"
> >
<v-text-field <v-text-field
v-model="filters.apellidos" v-model="cacheFilters.apellidos"
label="Apellidos" label="Apellidos"
clearable clearable
/> />
...@@ -44,7 +79,7 @@ ...@@ -44,7 +79,7 @@
md="2" md="2"
> >
<v-autocomplete <v-autocomplete
v-model="filters.categoria" v-model="cacheFilters.categoria"
:items="categories" :items="categories"
item-value="id" item-value="id"
item-text="nombre" item-text="nombre"
...@@ -52,6 +87,21 @@ ...@@ -52,6 +87,21 @@
clearable clearable
/> />
</v-col> </v-col>
<v-col
v-if="categories !==null"
cols="12"
sm="4"
md="2"
>
<v-autocomplete
v-model="cacheFilters.salud"
:items="healthStatuses"
item-value="id"
item-text="nombre"
label="Estado de Salud"
clearable
/>
</v-col>
<v-col <v-col
v-if="systemStatuses !== null" v-if="systemStatuses !== null"
cols="12" cols="12"
...@@ -59,7 +109,7 @@ ...@@ -59,7 +109,7 @@
md="2" md="2"
> >
<v-autocomplete <v-autocomplete
v-model="filters.estado_sistema" v-model="cacheFilters.estado_sistema"
:items="systemStatuses" :items="systemStatuses"
item-value="id" item-value="id"
item-text="nombre" item-text="nombre"
...@@ -74,13 +124,14 @@ ...@@ -74,13 +124,14 @@
md="2" md="2"
> >
<v-autocomplete <v-autocomplete
v-model="filters.provincia" v-model="cacheFilters.provincia"
:items="provinces" :items="provinces"
item-value="id" item-value="id"
item-text="nombre" item-text="nombre"
label="Provincia" label="Provincia"
no-data-text="Ocurrió un problema con el servidor" no-data-text="Ocurrió un problema con el servidor"
clearable clearable
@change="loadMunicipalitiesData"
/> />
</v-col> </v-col>
<v-col <v-col
...@@ -90,14 +141,13 @@ ...@@ -90,14 +141,13 @@
md="2" md="2"
> >
<v-autocomplete <v-autocomplete
v-model="filters.municipio" v-model="cacheFilters.municipio"
:items="municipalities" :items="municipalities"
item-value="id" item-value="id"
item-text="nombre" item-text="nombre"
label="Municipio" label="Municipio"
clearable clearable
no-data-text="Debe seleccionar una provincia" no-data-text="Debe seleccionar una provincia"
@change="searchMunicipalities"
/> />
</v-col> </v-col>
<v-col <v-col
...@@ -106,7 +156,7 @@ ...@@ -106,7 +156,7 @@
md="2" md="2"
> >
<v-autocomplete <v-autocomplete
v-model="filters.centro" v-model="cacheFilters.centro"
:items="centers" :items="centers"
item-value="id_centro" item-value="id_centro"
item-text="nombre_centro" item-text="nombre_centro"
...@@ -121,7 +171,7 @@ ...@@ -121,7 +171,7 @@
md="2" md="2"
> >
<v-autocomplete <v-autocomplete
v-model="filters.clasificacion" v-model="cacheFilters.riesgo"
:items="clasifications" :items="clasifications"
item-value="id" item-value="id"
item-text="nombre" item-text="nombre"
...@@ -132,9 +182,33 @@ ...@@ -132,9 +182,33 @@
</v-col> </v-col>
</v-row> </v-row>
<v-row no-gutters> <v-row no-gutters>
<v-fade-transition>
<v-spacer v-if="activeFilters.length !== 0" />
</v-fade-transition>
<v-fade-transition>
<v-btn
v-if="activeFilters.length !== 0"
text
color="red"
:loading="loading"
@click="sendFilter('clear')"
>
<v-icon>mdi-filter-variant-remove</v-icon> Limpiar Filtros
</v-btn>
</v-fade-transition>
<v-spacer />
<v-btn
text
color="red"
:loading="loading"
@click="sendClose"
>
<v-icon>mdi-cancel</v-icon> Cancelar
</v-btn>
<v-spacer /> <v-spacer />
<v-btn <v-btn
color="info" dark
color="success"
:loading="loading" :loading="loading"
@click="sendFilter" @click="sendFilter"
> >
...@@ -147,9 +221,9 @@ ...@@ -147,9 +221,9 @@
</template> </template>
<script> <script>
import { getCategories, getSystemStatus, getProvinces, getMunicipalities, getClasifications } from '@/axios/nomenclators' import { getCategories, getSystemStatus, getProvinces, getClasifications, getMunicipalities, getHealthStatuses } from '@/axios/nomenclators'
import { isLastName, isId, isPositiveNumber, isCmf } from '@/utils/regex' import { isId } from '@/utils/regex'
import { getCenters } from '@/axios/centers' import { mapGetters, mapMutations } from 'vuex'
export default { export default {
name: 'FilterTool', name: 'FilterTool',
...@@ -164,18 +238,51 @@ ...@@ -164,18 +238,51 @@
}, },
}, },
data: () => ({ data: () => ({
cacheFilters: {},
ciRules: [ ciRules: [
v => isId(v) || 'Debe chequear el carné', v => isId(v) || '',
], ],
}), }),
computed: { computed: {
...mapGetters(['filterStatus']),
activeFilters () {
const cache = []
if (this.cacheFilters.ci !== null && this.cacheFilters.ci !== '' && this.cacheFilters.ci !== undefined) {
cache.push('CI')
}
if (this.cacheFilters.nombre !== null && this.cacheFilters.nombre !== '' && this.cacheFilters.nombre !== undefined) {
cache.push('Nombre')
}
if (this.cacheFilters.apellidos !== null && this.cacheFilters.apellidos !== '' && this.cacheFilters.apellidos !== undefined) {
cache.push('Apellidos')
}
if (this.cacheFilters.categoria !== null && this.cacheFilters.categoria !== undefined) {
cache.push('Categoría')
}
if (this.cacheFilters.estado_sistema !== null && this.cacheFilters.estado_sistema !== undefined) {
cache.push('Estado Sistema')
}
if (this.cacheFilters.provincia !== null && this.cacheFilters.provincia !== undefined) {
cache.push('Provincia')
}
if (this.cacheFilters.municipio !== null && this.cacheFilters.municipio !== undefined) {
cache.push('Municipio')
}
if (this.cacheFilters.riesgo !== null && this.cacheFilters.provincia !== undefined) {
cache.push('Clasificación')
}
return cache
},
categories () { categories () {
return this.$store.getters.categories return this.$store.getters.categories
}, },
systemStatuses () { systemStatuses () {
return this.$store.getters.systemStatuses return this.$store.getters.systemStatuses
}, },
healthStatuses () {
return this.$store.getters.healthStatuses
},
centers () { centers () {
return this.$store.getters.centers return this.$store.getters.centers
}, },
...@@ -190,27 +297,65 @@ ...@@ -190,27 +297,65 @@
}, },
}, },
mounted () { mounted () {
if (!this.$store.getters.categories.lenght === 0) { if (this.$store.getters.provinces.length === 0) {
getProvinces()
}
if (this.$store.getters.healthStatuses.length === 0) {
getHealthStatuses()
}
if (this.$store.getters.categories.length === 0) {
getCategories() getCategories()
} }
if (!this.$store.getters.systemStatuses === null) { if (this.$store.getters.systemStatuses.length === 0) {
getSystemStatus() getSystemStatus()
} }
if (!this.$store.getters.provinces.lenght === 0) { if (this.$store.getters.clasifications.length === 0) {
getProvinces() getClasifications()
} }
getClasifications()
}, },
methods: { methods: {
async searchMunicipalities () { ...mapMutations(['clearFilters', 'setFilters', 'setFilterStatus']),
console.log('HELLOOOOO') showData () {
},
sendFilter () {
this.$emit('filter-click')
}, },
sendClose () { sendClose () {
this.$emit('close-click') this.$emit('close-click')
}, },
sendFilter (type) {
if (type === 'clear') {
if (this.activeFilters.length === 0) {
this.sendClose()
return
}
this.setFilterStatus(false)
this.cacheFilters = Object.assign({}, [])
} else {
this.setFilterStatus(true)
}
this.setFilters(this.cacheFilters)
this.$emit('filter-click')
},
async loadMunicipalitiesData () {
if (this.cacheFilters.provincia !== null) {
try {
await getMunicipalities(this.cacheFilters.provincia)
} catch (e) {
this.$toast.error(e.toString(), {
position: 'bottom-center',
timeout: 5000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
}
}
},
}, },
} }
</script> </script>
<template>
<material-card
class="v-card--material-stats"
v-bind="$attrs"
v-on="$listeners"
>
<template #subtitle>
<div
class="text-right text-h3 v-card__subtitle--material-stats"
v-text="value"
/>
</template>
<template #actions>
<slot name="actions" />
</template>
<slot />
</material-card>
</template>
<script>
export default {
name: 'MaterialStatCard',
props: { value: String },
}
</script>
<style lang="sass">
.v-card--material-stats.v-card--material .v-card--material__title
color: #999999
font-size: .875rem !important
margin-left: auto
text-align: right
.v-card__subtitle--material-stats
color: #3C4858
</style>
...@@ -693,7 +693,7 @@ ...@@ -693,7 +693,7 @@
label="Test Antígeno" label="Test Antígeno"
/> />
</v-col> </v-col>
<v-col <!-- <v-col
cols="12" cols="12"
sm="6" sm="6"
md="4" md="4"
...@@ -706,7 +706,7 @@ ...@@ -706,7 +706,7 @@
item-value="id" item-value="id"
label="Estado en el sistema" label="Estado en el sistema"
/> />
</v-col> </v-col> -->
<v-col <v-col
cols="12" cols="12"
sm="6" sm="6"
...@@ -719,6 +719,7 @@ ...@@ -719,6 +719,7 @@
no-data-text="No se pudo conectar con el servidor" no-data-text="No se pudo conectar con el servidor"
item-value="id" item-value="id"
label="Estado de salud" label="Estado de salud"
:rules="healthAreaRules"
/> />
</v-col> </v-col>
<v-col <v-col
...@@ -727,12 +728,13 @@ ...@@ -727,12 +728,13 @@
md="4" md="4"
> >
<v-autocomplete <v-autocomplete
v-model="patient.clasificacion" v-model="patient.riesgo"
:items="clasifications" :items="clasifications"
item-text="nombre" item-text="nombre"
no-data-text="No se pudo conectar con el servidor" no-data-text="No se pudo conectar con el servidor"
item-value="id" item-value="id"
label="Clasificación" label="Clasificación"
:rules="healthAreaRules"
/> />
</v-col> </v-col>
<v-col <v-col
...@@ -788,16 +790,16 @@ ...@@ -788,16 +790,16 @@
<v-card-actions> <v-card-actions>
<v-spacer /> <v-spacer />
<v-btn <v-btn
color="blue darken-1" color="red darken-1"
text text
@click="sendClose" @click="close"
> >
Cancelar Cancelar
</v-btn> </v-btn>
<v-btn <v-btn
color="blue darken-1" color="green darken-1"
text dark
:loading="loadingPatientData" :loading="loading"
@click="save" @click="save"
> >
Guardar Guardar
...@@ -807,29 +809,23 @@ ...@@ -807,29 +809,23 @@
</template> </template>
<script> <script>
import { getCategories, getProvinces, getHealthAreas, getMunicipalities, getHealthStatus, getClasifications } from '@/axios/nomenclators' import { getCategories, getProvinces, getHealthAreas, getMunicipalities, getHealthStatus, getClasifications, getAntigens } from '@/axios/nomenclators'
import { COUNTRIES } from '@/utils/constants' import { COUNTRIES } from '@/utils/constants'
import { postPatient, putPatient, getPatients } from '@/axios/patients' import { postPatient, putPatient } from '@/axios/patients'
import { isLastName, isId, isPositiveNumber, isCmf } from '@/utils/regex' import { isLastName, isId, isPositiveNumber } from '@/utils/regex'
import { mapMutations, mapGetters } from 'vuex'
import errorHandler from '@/mixins/error-handler'
export default { export default {
name: 'PatientForm', name: 'PatientForm',
props: { props: {
index: {
type: Number,
default: -1,
},
title: { title: {
type: String, type: String,
default: 'Paciente', default: 'Paciente',
}, },
patient: {
type: Object,
default: null,
},
}, },
data: () => ({ data: () => ({
loadingPatientData: false, loading: false,
menu: false, menu: false,
remissionTypes: ['Policlínico', 'C.M.F.', 'Hospital'], remissionTypes: ['Policlínico', 'C.M.F.', 'Hospital'],
othersS: false, othersS: false,
...@@ -843,9 +839,6 @@ ...@@ -843,9 +839,6 @@
healthAreaRules: [ healthAreaRules: [
v => !!v || 'Este campo es requerido', v => !!v || 'Este campo es requerido',
], ],
cmfRules: [
v => isCmf(v) || 'Este campo es requerido',
],
numberRules: [ numberRules: [
v => !!v || 'Este campo es requerido', v => !!v || 'Este campo es requerido',
v => isPositiveNumber(v) || 'Debe chequear la edad', v => isPositiveNumber(v) || 'Debe chequear la edad',
...@@ -860,10 +853,11 @@ ...@@ -860,10 +853,11 @@
], ],
lastNameRules: [ lastNameRules: [
v => !!v || 'Este campo es requerido', v => !!v || 'Este campo es requerido',
v => isLastName(v) || 'Debe chequear el nombre', v => isLastName(v) || 'Debe chequear los apellidos',
], ],
}), }),
computed: { computed: {
...mapGetters(['pIndex', 'patient', 'editFromFile']),
countriesD () { countriesD () {
return COUNTRIES return COUNTRIES
}, },
...@@ -899,7 +893,6 @@ ...@@ -899,7 +893,6 @@
}, },
}, },
created () { created () {
console.log(this.index)
if (this.$store.getters.categories.length === 0) { if (this.$store.getters.categories.length === 0) {
getCategories() getCategories()
} }
...@@ -918,16 +911,25 @@ ...@@ -918,16 +911,25 @@
if (this.$store.getters.clasifications.length === 0) { if (this.$store.getters.clasifications.length === 0) {
getClasifications() getClasifications()
} }
if (this.$store.getters.antigens.length === 0) {
getAntigens()
}
}, },
methods: { methods: {
close () { ...mapMutations(['setPIndex']),
close (type) {
this.$refs.form.resetValidation() this.$refs.form.resetValidation()
if (!this.editFromFile) {
this.$nextTick(() => { this.$nextTick(() => {
this.patient = Object.assign({}, this.defaultItem) this.patient = Object.assign({}, this.defaultItem)
this.index = -1 this.setPIndex(-1)
}) })
this.sendClose() }
if (type === 'saved') {
this.sendRefresh()
} else {
this.sendClose()
}
}, },
clearData () { clearData () {
this.patient = Object.assign({}, this.defaultItem) this.patient = Object.assign({}, this.defaultItem)
...@@ -936,53 +938,50 @@ ...@@ -936,53 +938,50 @@
try { try {
await getHealthAreas(this.patient.municipio) await getHealthAreas(this.patient.municipio)
} catch (e) { } catch (e) {
this.$toast.error(e.toString(), { errorHandler(e)
position: 'bottom-center',
timeout: 5000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
} }
}, },
async loadMunicipalitiesData () { async loadMunicipalitiesData () {
try { try {
await getMunicipalities(this.patient.provincia) await getMunicipalities(this.patient.provincia)
} catch (e) { } catch (e) {
this.$toast.error(e.toString(), { errorHandler(e)
position: 'bottom-center',
timeout: 5000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
} }
}, },
sendClose () { sendClose () {
this.$emit('close-click') this.$emit('close-click')
}, },
sendRefresh () {
this.$emit('refresh')
},
async save () { async save () {
console.log(this.index) this.loading = true
if (this.$refs.form.validate()) { if (this.$refs.form.validate()) {
if (this.index > -1) { if (this.pIndex !== -1) {
this.patientsLoading = true
// Actualizar // Actualizar
try { try {
await putPatient(this.patient) const response = await putPatient(this.patient)
if (response.error !== undefined) {
const err = Object.getOwnPropertyNames(response.data.error)
if (err.filter(element => element === 'ci') !== null) {
this.$toast.error('El número de carné está en uso, el paciente ya debe tener expediente', {
position: 'bottom-center',
timeout: 5000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
this.loading = false
return
}
}
this.$toast.success('Datos actualizados correctamente', { this.$toast.success('Datos actualizados correctamente', {
position: 'bottom-center', position: 'bottom-center',
timeout: 5000, timeout: 5000,
...@@ -1000,28 +999,35 @@ ...@@ -1000,28 +999,35 @@
this.$refs.form.reset() this.$refs.form.reset()
this.$refs.form.resetValidation() this.$refs.form.resetValidation()
this.clearData() this.close('saved')
this.close()
} catch (e) { } catch (e) {
this.$toast.error(e.toString(), { errorHandler(e)
position: 'bottom-center',
timeout: 5000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
} }
} else { } else {
// Añadir // Añadir
try { try {
await postPatient(this.patient) const response = await postPatient(this.patient)
if (response.data.error !== undefined) {
const err = Object.getOwnPropertyNames(response.data.error)
if (err.filter(element => element === 'ci') !== null) {
this.$toast.error('El número de carné está en uso, el paciente ya debe tener expediente', {
position: 'bottom-center',
timeout: 5000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
this.loading = false
return
}
}
this.$toast.success('Registro exitoso', { this.$toast.success('Registro exitoso', {
position: 'bottom-center', position: 'bottom-center',
timeout: 5000, timeout: 5000,
...@@ -1039,25 +1045,11 @@ ...@@ -1039,25 +1045,11 @@
this.$refs.form.reset() this.$refs.form.reset()
this.$refs.form.resetValidation() this.$refs.form.resetValidation()
this.clearData() this.clearData()
this.close() this.close('saved')
} catch (e) { } catch (e) {
this.$toast.error(e.toString(), { errorHandler(e)
position: 'bottom-center',
timeout: 5000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
} }
} }
getPatients()
} else { } else {
this.$toast.error('Chequee los datos incorrectos', { this.$toast.error('Chequee los datos incorrectos', {
position: 'bottom-center', position: 'bottom-center',
...@@ -1074,6 +1066,7 @@ ...@@ -1074,6 +1066,7 @@
rtl: false, rtl: false,
}) })
} }
this.loading = false
}, },
}, },
} }
......
...@@ -23,10 +23,10 @@ Vue.use(MultiFiltersPlugin) ...@@ -23,10 +23,10 @@ Vue.use(MultiFiltersPlugin)
Vue.prototype.$axios = api Vue.prototype.$axios = api
localStorage.setItem('tkn', encrypt('pepe')) localStorage.setItem('tkn', encrypt('pepe'))
if (process.env.NODE_ENV === 'development') { // if (process.env.NODE_ENV === 'development') {
const { worker } = require('./mocks/browser') // const { worker } = require('./mocks/browser')
worker.start() // worker.start()
} // }
Vue.use(Toast, { Vue.use(Toast, {
transition: 'Vue-Toastification__bounce', transition: 'Vue-Toastification__bounce',
......
import Vue from 'vue'
export default function (error) {
let status = 0
if (error.toString() === 'Error: Network Error') {
this.$toast.error('Error de Red, revise su conexión', {
position: 'bottom-center',
timeout: 3000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
}
if (error.response !== undefined) {
switch (error.response.status) {
case 500: {
Vue.$toast.error('Error interno del servidor, inténtelo más tarde', {
position: 'bottom-center',
timeout: 3000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
break
}
case 401: {
Vue.$toast.error('No autorizado', {
position: 'bottom-center',
timeout: 3000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
status = -1
break
}
default: {
Vue.$toast.error('No autorizado', {
position: 'bottom-center',
timeout: 3000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
status = -1
break
}
}
}
if (status === -1) {
localStorage.setItem('tkn', null)
localStorage.setItem('userData', null)
localStorage.setItem('role', null)
Vue.$router.push({ name: 'Login' })
}
}
<script>
// Extensions
import View from '@/views/View'
// Mixins
import LoadSections from '@/mixins/load-sections'
export default {
name: 'Registro',
metaInfo: { title: 'Registro' },
extends: View,
mixins: [
LoadSections([
'register',
]),
],
props: {
id: {
type: String,
default: 'register',
},
},
}
</script>
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
<div class="col-md-5" id="add-patients"> <div class="col-md-5" id="add-patients">
<v-btn <v-btn
depressed depressed
@click="addPatients" @click="procesar_ingreso"
color="primary" color="primary"
> >
Agregar Paciente Ingresar Pacientes
</v-btn> </v-btn>
</div> </div>
...@@ -98,6 +98,68 @@ ...@@ -98,6 +98,68 @@
></v-select> ></v-select>
</div> </div>
</div> </div>
<p id="selected-area" v-if="selected_area.length" class="text-justify">
Area seleccionada: {{ selected_area }}
</p>
<!-- modal-->
<v-row justify="center">
<v-dialog
v-model="dialog"
scrollable
max-width="300px"
>
<template v-slot:activator="{ on, attrs }">
<v-btn
color="primary"
dark
v-bind:disabled="selected_centers.length===0"
v-bind="attrs"
v-on="on"
>
Seleccionar area
</v-btn>
</template>
<v-card>
<v-card-title>Seleccione un area</v-card-title>
<v-divider></v-divider>
<v-card-text style="height: 200px;">
<v-radio-group
v-model="dialogm1"
column
>
<div v-if="selected_centers.length">
<v-radio v-for="item in selected_centers[0].areas"
v-bind:label="item.nombre"
v-bind:value="item.id_area"
@change="update_selected_area(item)"
></v-radio>
</div>
</v-radio-group>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-btn
color="blue darken-1"
text
@click="dialog = false"
>
Cancelar
</v-btn>
<v-btn
color="blue darken-1"
text
@click="dialog = false"
>
Seleccionar
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-row>
</template> </template>
</v-data-table> </v-data-table>
</div> </div>
...@@ -107,7 +169,7 @@ ...@@ -107,7 +169,7 @@
<script> <script>
import {getPatients, getPatient, postPatient, deletePatient, putPatient} from '@/axios/patients' import {getPatients, getPatient, postPatient, deletePatient, putPatient, ingresarPacientes} from '@/axios/patients'
import {getCategories, getClasifications} from '@/axios/nomenclators' import {getCategories, getClasifications} from '@/axios/nomenclators'
import {deleteCenter, getCenters} from '@/axios/centers' import {deleteCenter, getCenters} from '@/axios/centers'
import {forInRight} from 'lodash' import {forInRight} from 'lodash'
...@@ -129,7 +191,7 @@ export default { ...@@ -129,7 +191,7 @@ export default {
{text: 'Edad', value: 'edad'}, {text: 'Edad', value: 'edad'},
{text: 'Sexo', value: 'sexo'}, {text: 'Sexo', value: 'sexo'},
{text: 'Categoría', value: 'categoria'}, {text: 'Categoría', value: 'categoria'},
{text: 'Clasificación', value: 'clasificacion'}, {text: 'Clasificación', value: 'riesgo'},
], ],
patients: [], patients: [],
singleSelectCenters: true, singleSelectCenters: true,
...@@ -155,6 +217,9 @@ export default { ...@@ -155,6 +217,9 @@ export default {
selected_patients: [], selected_patients: [],
selected_centers: [], selected_centers: [],
text_field: "", text_field: "",
dialog: false,
selected_area: "",
selected_area_id: -1,
} }
}, },
created() { created() {
...@@ -163,6 +228,82 @@ export default { ...@@ -163,6 +228,82 @@ export default {
this.getCentersCategoriesData() this.getCentersCategoriesData()
}, },
methods: { methods: {
async procesar_ingreso() {
if (this.selected_patients.length > 0) {
if (this.selected_centers.length > 0) {
if (this.selected_area_id !== -1) {
console.log("SELECTED PATIENTS: " + this.selected_patients + "SELECTED AREA: " + this.selected_area);
// const response = await this.ingresarPacientes(this.selected_patients, this.selected_area);
// console.log("REsponse", response);
this.$toast.success("Paciente ingresado con éxito", {
position: 'bottom-center',
timeout: 5000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
} else {
this.$toast.error("Debe seleccionar un area", {
position: 'bottom-center',
timeout: 5000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
}
} else {
this.$toast.error("Debe seleccionar un centro", {
position: 'bottom-center',
timeout: 5000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
}
} else {
this.$toast.error("Debe seleccionar al menos un paciente", {
position: 'bottom-center',
timeout: 5000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
}
},
update_selected_area(item) {
this.selected_area = item.nombre;
this.selected_area_id = item.id_area;
console.log("Selected Area: ", this.selected_area);
console.log("Selected Area ID: ", this.selected_area_id);
},
update_selected_patients(values) { update_selected_patients(values) {
console.log("SELECTED ITEMS: entre ", values); console.log("SELECTED ITEMS: entre ", values);
if (values.value) { if (values.value) {
...@@ -225,6 +366,8 @@ export default { ...@@ -225,6 +366,8 @@ export default {
this.selected_centers = neo_selected_list; this.selected_centers = neo_selected_list;
} }
} }
this.selected_area = "";
this.selected_area_id = -1;
console.log("SELECTED ITEMS CENTERS: ", this.selected_centers); console.log("SELECTED ITEMS CENTERS: ", this.selected_centers);
}, },
async filterByOrganismos(val) { async filterByOrganismos(val) {
...@@ -337,22 +480,37 @@ export default { ...@@ -337,22 +480,37 @@ export default {
try { try {
const patientsResponse = await getPatients() const patientsResponse = await getPatients()
this.patients = await patientsResponse.data.pacientes; this.patients = await patientsResponse.data.pacientes;
const data = await getClasifications();
let clasications = await data.data;
for (let i = 0; i < this.patients.length; i++) {
let patient = this.patients[i];
for (const c of clasications) {
if (c.id === patient.riesgo) {
patient.riesgo = c.nombre;
}
}
this.patients[i] = patient;
}
await this.getCategoriesData(); await this.getCategoriesData();
/*let i = 0; /*let i = 0;
for (const p in pacientes) { for (const p in pacientes) {
console.log("Entre aqui"); console.log("Entre aqui");
const p = pacientes[i]; const p = pacientes[i];
let classification = 'niño' let classification = 'niño'
if(p.embarazada!=0){ if(p.embarazada!=0){
classification = 'embarazada'; classification = 'embarazada';
} }
if(p.trabajador_salud!=0){ if(p.trabajador_salud!=0){
classification = 'trabajador de la salud'; classification = 'trabajador de la salud';
} }
p.clasificacion = classification; p.clasificacion = classification;
pacientes[i] = p; pacientes[i] = p;
i+=1; i+=1;
}*/ }*/
// this.patients = pacientes; // this.patients = pacientes;
// console.log('Patientsss', pacientes); // console.log('Patientsss', pacientes);
} catch (e) { } catch (e) {
...@@ -466,9 +624,8 @@ export default { ...@@ -466,9 +624,8 @@ export default {
} }
} }
}, },
} }
</script> </script>
<style> <style>
#centers-table { #centers-table {
...@@ -479,7 +636,7 @@ export default { ...@@ -479,7 +636,7 @@ export default {
margin-top: 20px; margin-top: 20px;
} }
#filter-organism, #filter-categorie, #filter-categorie-patients, #patients-name { #filter-organism, #filter-categorie, #filter-categorie-patients, #patients-name, #selected-area {
margin-left: 10px; margin-left: 10px;
} }
......
<template>
<v-card
class="elevation-12"
style="margin: 8px"
>
<v-toolbar
dark
color="success"
>
<v-toolbar-title>
Datos de Usuario
</v-toolbar-title>
</v-toolbar>
<v-card-text>
<v-form
ref="form"
v-model="valid"
lazy-validation
>
<!-- <v-text-field
v-model="data.name"
:rules="passwordRules"
prepend-icon="mdi-account"
label="Nombre"
/> -->
<v-text-field
v-model="data.email"
:rules="usernameRules"
prepend-icon="mdi-at"
name="login"
label="Coreo Electrónico"
required
type="email"
/>
<v-autocomplete
v-model="data.role"
:rules="passwordRules"
:items="roles"
prepend-icon="mdi-account"
label="Rol"
item-text="name"
item-value="value"
required
/>
<v-text-field
id="password"
v-model="data.password"
:rules="passwordRules"
prepend-icon="mdi-lock"
name="password"
required
label="Contraseña"
type="password"
/>
<v-text-field
id="password"
v-model="data.confirm_password"
:rules="passwordRules"
prepend-icon="mdi-lock"
name="password"
required
label="Confirmar Contraseña"
type="password"
/>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn
color="red"
text
:disabled="!valid"
submit
:loading="tryLogin"
@click="cancel"
>
Cancelar
</v-btn>
<v-spacer />
<v-btn
color="green"
dark
:disabled="!valid"
submit
:loading="tryLogin"
@click="submit"
>
Registrar
</v-btn>
<v-spacer />
</v-card-actions>
</v-card>
</template>
<script>
import { register } from '@/axios/auth'
import { mapMutations } from 'vuex'
import { isLastName, isEmail } from '@/utils/regex'
export default {
name: 'Register',
data: () => ({
custom: true,
data: {
name: null,
email: null,
password: null,
confirm_password: null,
role: null,
},
roles: [
{
value: 'MCP',
name: 'Mesa Coordinadora Provincial',
},
{
value: 'ERP',
name: 'Equipo de Respuesta Rápida',
},
{
value: 'MCM',
name: 'Mesa Coordinadora Municipal',
},
{
value: 'DCA',
name: 'Director Centro Hospitalario',
},
{
value: 'MCPREV',
name: 'Revisor de Mesa Coordinadora Provincial',
},
{
value: 'CA',
name: 'Centro Aislamiento',
},
],
tryLogin: false,
valid: true,
passwordRules: [
v => !!v || 'Este campo es requerido',
],
testRules: [
v => !!v || 'Este campo es requerido',
],
nameRules: [
v => !!v || 'Este campo es requerido',
v => isLastName(v) || 'Debe introducir un nombre válido',
],
usernameRules: [
v => !!v || 'Este campo es requerido',
v => isEmail(v) || 'Debe introducir una dirección de correo válida',
],
}),
computed: {
same () {
return this.data.password === this.data.confirm_password
},
progress () {
return Math.min(100, this.value.length * 10)
},
color () {
return ['error', 'warning', 'success'][Math.floor(this.progress / 40)]
},
},
methods: {
...mapMutations(['setUser']),
cancel () {
this.$router.push({ name: 'Control' })
},
async submit () {
this.$refs.form.validate()
if (this.$refs.form.validate(true)) {
this.tryLogin = true
try {
this.data.name = this.data.email
const loginResponse = await register(this.data)
const token = loginResponse.data.token
const user = loginResponse.data.user
this.setUser(user)
localStorage.setItem('tkn', token)
this.$router.push({ name: 'Control' })
} catch (e) {
if (e.toString() === 'Error: Network Error') {
this.$toast.error('Error de Red, revise su conexión', {
position: 'bottom-center',
timeout: 3000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
this.tryLogin = false
}
switch (e.response.status) {
case 500: {
this.$toast.error('Error interno del servidor, inténtelo más tarde', {
position: 'bottom-center',
timeout: 3000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
break
}
case 401: {
this.$toast.error('No autorizado', {
position: 'bottom-center',
timeout: 3000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
break
}
default: {
this.$toast.error('No autorizado', {
position: 'bottom-center',
timeout: 3000,
closeOnClick: true,
pauseOnFocusLoss: false,
pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
}
}
this.tryLogin = false
}
}
},
},
}
</script>