Commit 3f9b6187 authored by krlsnvz93's avatar krlsnvz93
Browse files

Fixes in put in patients v2

parent 07486b3b
# [1.1.0](https://github.com/johnleider/zero-theme/compare/edde6e29248bb788873e2c958374675320325aac...1.1.0) (2020-05-11)
### Bug Fixes
* **HeroSection:** adjust maximum container width ([df19603](https://github.com/johnleider/zero-theme/commit/df19603c2bcdd4df0b71fd14d654de80a10d8531))
* **Projects:** pass through attributes ([75fd707](https://github.com/johnleider/zero-theme/commit/75fd707b6068b4173876240797d51242b7cf426d))
* **Settings:** adjust top position ([f089030](https://github.com/johnleider/zero-theme/commit/f089030090be52c065d16e9bbdd8f675aa624132))
* **SystemBar:** resolve mobile issues ([b8223d5](https://github.com/johnleider/zero-theme/commit/b8223d53ef1f024560d5092ca1d33fba902101d3))
### Features
* add images to theme ([41e32c9](https://github.com/johnleider/zero-theme/commit/41e32c97cb1ca8146bb500891170d5bf0d78debc))
* add more sections, update base components ([502b689](https://github.com/johnleider/zero-theme/commit/502b6898e350655138f76e04d36c677756eb05a2))
* add new hero-alt component and update views ([14d6cd7](https://github.com/johnleider/zero-theme/commit/14d6cd78d240c6381b8e319cd78de22090192496))
* add new section and abstract duplicate functionality ([d23e31c](https://github.com/johnleider/zero-theme/commit/d23e31c60bc4dd8ad64af6038af7fce5210fdc36))
* clean-up, renamed components, added new logo ([983275f](https://github.com/johnleider/zero-theme/commit/983275f282023139ebe87a7598b65c7e576c1823))
* **components:** add new components ([360d790](https://github.com/johnleider/zero-theme/commit/360d790e8bcbe553d2e4fe402d33b07f0a043344))
* **sections:** add default sections ([edde6e2](https://github.com/johnleider/zero-theme/commit/edde6e29248bb788873e2c958374675320325aac))
* **views:** add sections ([1f829de](https://github.com/johnleider/zero-theme/commit/1f829defee86ffa0f432f3e906bc518903c8caf7))
* **Views:** create new pages and supporting functionality ([429144d](https://github.com/johnleider/zero-theme/commit/429144de25ebba5531b233f7dd0bf2d9933f95b0))
* add new sections and components, clean-up ([a17e493](https://github.com/johnleider/zero-theme/commit/a17e493df767d8e0a305fc9a02a28cc46842b212))
import Vue from 'vue' import Vue from "vue";
import App from './App.vue' import App from "./App.vue";
import vuetify from './plugins/vuetify' import vuetify from "./plugins/vuetify";
import router from './router' import router from "./router";
import store from './src/store/index' import store from "./src/store/index";
import Vuebar from 'vuebar' import Vuebar from "vuebar";
import axios from 'axios' import axios from 'axios';
import './plugins/base' import "./plugins/base";
import api from './src/utils/api' import api from './src/utils/api';
import VueCookies from 'vue-cookies'
import VueCryptojs from 'vue-cryptojs'
Vue.use(VueCryptojs)
Vue.config.productionTip = false Vue.config.productionTip = false;
Vue.use(Vuebar) Vue.use(Vuebar);
Vue.use(VueCookies)
Vue.$cookies.config('8h')
Vue.prototype.$axios = api Vue.prototype.$axios = api
...@@ -25,4 +20,4 @@ new Vue({ ...@@ -25,4 +20,4 @@ new Vue({
axios, axios,
router, router,
render: (h) => h(App), render: (h) => h(App),
}).$mount('#app') }).$mount("#app");
...@@ -15695,19 +15695,6 @@ ...@@ -15695,19 +15695,6 @@
} }
} }
}, },
"vue-cookies": {
"version": "1.7.4",
"resolved": "https://registry.npmjs.org/vue-cookies/-/vue-cookies-1.7.4.tgz",
"integrity": "sha512-mOS5Btr8V9zvAtkmQ7/TfqJIropOx7etDAgBywPCmHjvfJl2gFbH2XgoMghleLoyyMTi5eaJss0mPN7arMoslA=="
},
"vue-cryptojs": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/vue-cryptojs/-/vue-cryptojs-2.1.5.tgz",
"integrity": "sha512-bllwNCd+jgQ6MOnhXuv+zMwisS7A+h7juFOJQjfrLlSo/Ld7/DTYlGS7OgYAW8bI3DZG3F6otE0iqKseVR2dlQ==",
"requires": {
"crypto-js": "^4.0.0"
}
},
"vue-eslint-parser": { "vue-eslint-parser": {
"version": "7.7.2", "version": "7.7.2",
"resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-7.7.2.tgz", "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-7.7.2.tgz",
......
{ {
"name": "SIGI", "name": "SIGI",
"version": "0.0.5", "version": "0.0.1",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
"vee-validate": "^3.4.10", "vee-validate": "^3.4.10",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-cli": "^2.9.6", "vue-cli": "^2.9.6",
"vue-cookies": "^1.7.4",
"vue-cryptojs": "^2.1.5",
"vue-meta": "^2.3.3", "vue-meta": "^2.3.3",
"vue-router": "^3.1.6", "vue-router": "^3.1.6",
"vue-toastification": "^1.7.11", "vue-toastification": "^1.7.11",
......
...@@ -48,6 +48,15 @@ export async function assignatePatient (idCenter, idPatient) { ...@@ -48,6 +48,15 @@ export async function assignatePatient (idCenter, idPatient) {
const response = await axios.post(url, data, requestDataFormUrlEncoded()) const response = await axios.post(url, data, requestDataFormUrlEncoded())
return response 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) { export async function admitPatient (idPatient) {
const url = `${REQUEST_DIR}pacientes` const url = `${REQUEST_DIR}pacientes`
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
sm="5" sm="5"
md="10" md="10"
> >
{{ patient.direccion }} => {{ municipality }} / {{ province }} {{ patient.direccion }} => {{ patient.provincia }} / {{ patient.municipio }}
</v-col> </v-col>
<v-col <v-col
cols="12" cols="12"
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
sm="5" sm="5"
md="10" md="10"
> >
{{ healthArea }} {{ patient.area_salud }}
</v-col> </v-col>
<v-col <v-col
cols="12" cols="12"
...@@ -383,80 +383,48 @@ ...@@ -383,80 +383,48 @@
<v-card-actions> <v-card-actions>
<v-spacer /> <v-spacer />
<v-btn <v-btn
v-if="editable" color="blue darken-1"
color="orange darken-1"
text text
@click="sendEdit" @click="sendClose"
> >
<v-icon>mdi-pencil</v-icon> OK
Editar
</v-btn> </v-btn>
<v-spacer v-if="!verified && role === 'MCPREV'" /> <v-spacer v-if="!verified" />
<v-btn <v-btn
v-if="!verified && role === 'MCPREV'" v-if="!verified"
color="blue darken-1" color="blue darken-1"
text text
@click="dataVerified" @click="dataVerified"
> >
<v-icon>mdi-account-check</v-icon>
Verificar Verificar
</v-btn> </v-btn>
<v-spacer /> <v-spacer />
<v-btn
color="green darken-1"
dark
@click="sendClose"
>
OK
</v-btn>
<v-spacer />
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</template> </template>
<script> <script>
import { getMunicipalities, getHealthAreas } from '@/axios/nomenclators'
import { mapGetters, mapMutations } from 'vuex'
import errorHandler from '@/mixins/error-handler'
import { checkPatientData } from '@/axios/patients'
export default { export default {
name: 'PatientFile', name: 'PatientFile',
props: { props: {
patient: {
type: Object,
default: null,
},
}, },
data: () => ({ data: () => ({
editable: true,
formTitle: 'Datos del Paciente', formTitle: 'Datos del Paciente',
healthAreas: [],
healthArea: null,
municipality: null,
}), }),
computed: { computed: {
...mapGetters(['patient']),
role () {
return localStorage.getItem('role')
},
verified () {
return this.patient.estado_sistema > 2
},
estadoSistema () { estadoSistema () {
const ststus = this.systemStatuses const pepe = this.systemStatuses
let ok = null let ok = null
ststus.forEach(element => { pepe.forEach(element => {
if (element.id === this.patient.estado_sistema) { if (element.id === this.patient.estado_sistema) {
ok = element.nombre ok = element.nombre
} }
}) })
return ok console.log(ok)
},
province () {
const prov = this.provinces
let ok = null
prov.forEach(element => {
if (element.id === this.patient.provincia) {
ok = element.nombre
}
})
return ok return ok
}, },
noApp () { noApp () {
...@@ -474,74 +442,28 @@ ...@@ -474,74 +442,28 @@
systemStatuses () { systemStatuses () {
return this.$store.getters.systemStatuses return this.$store.getters.systemStatuses
}, },
provinces () {
return this.$store.getters.provinces
},
municipalities () {
return this.$store.getters.municipalities
},
},
async created () {
const hResponse = await getHealthAreas(this.patient.municipio)
this.healthAreas = hResponse.data
await getMunicipalities(this.patient.provincia)
const munic = this.municipalities
let ok = null
munic.forEach(element => {
if (element.id === this.patient.municipio) {
ok = element.nombre
}
})
this.municipality = ok
let hItem = null
const hh = this.healthAreas
hh.forEach(element => {
if (element.id === this.patient.area_salud) {
hItem = element.nombre
}
})
this.healthArea = hItem
}, },
methods: { methods: {
...mapMutations(['setEditFromFile', 'setPIndex']),
async getHealthAreasData () {
try {
const hResponse = await getHealthAreas(this.patient.municipio)
this.healthAreas = hResponse.data
} catch (e) {
errorHandler(e)
}
},
sendClose () { sendClose () {
this.$emit('close-click') this.$emit('close-click')
}, },
sendEdit () { dataVerified () {
this.setEditFromFile(true) // TODO: Cambiar el estado de los datos del paciente
this.setPIndex(1) this.$toast.success('Usted ha verificado los datos satisfactoriamente', {
this.$emit('edit-click') position: 'bottom-center',
}, timeout: 5000,
async dataVerified () { closeOnClick: true,
try { pauseOnFocusLoss: false,
await checkPatientData(this.patient) pauseOnHover: true,
this.$toast.success('Se ha verificado los datos correctamente', { draggable: true,
position: 'top-center', draggablePercent: 0.6,
timeout: 5000, showCloseButtonOnHover: false,
closeOnClick: true, hideProgressBar: true,
pauseOnFocusLoss: false, closeButton: 'button',
pauseOnHover: false, icon: true,
draggable: true, rtl: false,
draggablePercent: 0.6, })
showCloseButtonOnHover: false, this.$emit('close-click')
hideProgressBar: false,
closeButton: 'button',
icon: true,
rtl: false,
})
this.patient.estado_sistema = 3
} catch (e) {
errorHandler(e)
}
this.$emit('ok-click')
}, },
}, },
} }
......
<script>
import { VCard } from 'vuetify/lib'
export default {
name: 'Card',
extends: VCard,
}
</script>
<template>
<v-theme-provider :dark="dark">
<v-container class="pa-0">
<v-row
:justify="justify"
no-gutters
>
<v-col
v-if="icon"
:class="`text-${align}`"
cols="12"
class="mb-4"
>
<base-icon :color="color">
{{ icon }}
</base-icon>
</v-col>
<v-col
v-if="title || subtitle"
:cols="callout ? 9 : 12"
>
<base-subtitle
v-if="subtitle"
:title="subtitle"
space="1"
/>
<base-title
:title="title"
class="text-uppercase"
space="1"
/>
<base-divider :color="color" />
<base-body
v-if="text || $slots.default"
:text="text"
space="6"
>
<slot />
</base-body>
</v-col>
<v-col
v-if="callout"
cols="2"
>
<div
class="text-h2 grey--text text--lighten-4 font-weight-bold pr-8"
v-text="callout"
/>
</v-col>
</v-row>
</v-container>
</v-theme-provider>
</template>
<script>
// Mixins
import Heading from '@/mixins/heading'
export default {
name: 'BaseInfoCard',
mixins: [Heading],
props: {
dark: Boolean,
callout: String,
color: {
type: String,
default: 'primary',
},
icon: String,
subtitle: String,
text: String,
title: String,
},
}
</script>
<template>
<v-card
v-bind="$attrs"
:class="classes"
class="v-card--material pa-3"
color="white"
>
<div class="d-flex grow flex-wrap">
<v-avatar
v-if="avatar"
size="128"
class="mx-auto v-card--material__avatar elevation-6"
color="grey"
>
<v-img :src="avatar" />
</v-avatar>
<v-sheet
v-else
:class="{
'pa-7': !$slots.image
}"
:color="color"
:max-height="icon ? 90 : undefined"
:width="icon ? 'auto' : '100%'"
elevation="6"
class="text-start v-card--material__heading"
dark
>
<slot
v-if="$slots.heading"
name="heading"
/>
<slot
v-else-if="$slots.image"
name="image"
/>
<div
v-else-if="title && !icon"
class="text-h4 font-weight-light"
v-text="title"
/>
<v-icon
v-else-if="icon"
size="32"
v-text="icon"
/>
<div
v-if="text"
class="text-h4 font-weight-thin"
v-text="text"
/>
</v-sheet>
<div
v-if="$slots['after-heading']"
class="ml-6"
>
<slot name="after-heading" />
</div>
<div
v-else-if="icon && title"
class="ml-4"
>
<div
class="card-title font-weight-light"
v-text="title"
/>
</div>
</div>
<slot />
<template v-if="$slots.actions">
<v-divider class="mt-2" />
<v-card-actions class="pb-0">
<slot name="actions" />
</v-card-actions>
</template>
</v-card>
</template>
<script>
export default {
name: 'MaterialCard',
props: {
avatar: {
type: String,
default: '',
},
color: {
type: String,
default: 'success',
},
icon: {
type: String,
default: undefined,
},
image: {
type: Boolean,
default: false,
},
text: {
type: String,
default: '',
},
title: {
type: String,
default: '',
},
},
computed: {
classes () {
return {
'v-card--material--has-heading': this.hasHeading,
}
},
hasHeading () {
return Boolean(this.$slots.heading || this.title || this.icon)
},
hasAltHeading () {
return Boolean(this.$slots.heading || (this.title && this.icon))
},
},
}
</script>
<style lang="sass">
.v-card--material
&__avatar
position: relative
top: -64px
margin-bottom: -32px
&__heading
position: relative
top: -40px
transition: .3s ease
z-index: 1
</style>
<template>
<base-material-card
:icon="icon"
class="v-card--material-stats"
v-bind="$attrs"
v-on="$listeners"
>
<template v-slot:after-heading>
<div class="ml-auto text-right">
<div
class="body-3 grey--text font-weight-light"
v-text="title"
/>
<h3 class="text-h4 font-weight-light text--primary">
{{ value }} <small>{{ smallValue }}</small>
</h3>
</div>
</template>
<v-col
cols="12"
class="px-0"
>
<v-divider />
</v-col>
<v-icon
:color="subIconColor"
size="16"
class="ml-2 mr-1"
>
{{ subIcon }}
</v-icon>
<span
:class="subTextColor"
class="text-caption grey--text font-weight-light"
v-text="subText"
/>
</base-material-card>
</template>
<script>
import Card from './Card'
export default {
name: 'MaterialStatsCard',
inheritAttrs: false,
props: {
...Card.props,
icon: {
type: String,
required: true,
},
subIcon: {
type: String,
default: undefined,
},
subIconColor: {
type: String,
default: 'grey',
},
subTextColor: {
type: String,
default: undefined,
},
subText: {
type: String,
default: undefined,
},
title: {
type: String,
default: undefined,
},
value: {
type: String,
default: undefined,
},
smallValue: {
type: String,
default: undefined,
},
},
}
</script>
<style lang="sass">
.v-card--material-stats
display: flex
flex-wrap: wrap
position: relative
> div:first-child
justify-content: space-between
.v-card
border-radius: 4px
flex: 0 1 auto
.v-card__text
display: inline-block
flex: 1 0 calc(100% - 120px)
position: absolute
top: 0
right: 0
width: 100%
.v-card__actions
flex: 1 0 100%
</style>
...@@ -8,115 +8,41 @@ ...@@ -8,115 +8,41 @@
height="80" height="80"
> >
<v-spacer /> <v-spacer />
<!-- <div>
<v-tabs
class="hidden-sm-and-down"
optional
>
<v-tab
v-for="(name, i) in items"
:key="i"
:to="{ name }"
:exact="name === 'Home'"
:ripple="false"
active-class="text--primary"
class="font-weight-bold"
min-width="96"
text
>
{{ name }}
</v-tab>
</v-tabs>
</div> -->
<v-app-bar-nav-icon <v-app-bar-nav-icon
@click="showHideDrawer" @click="showHideDrawer"
/> />
<v-menu
offset-y
max-width="200"
min-width="200"
>
<template v-slot:activator="{ on, attrs }">
<v-btn
v-bind="attrs"
icon
fab
class=""
v-on="on"
>
<v-tooltip
bottom
max-width="125"
min-width="125"
color="rgba(0,0,0, 0.8)"
>
<template v-slot:activator="{ on, attrs }">
<v-icon
v-bind="attrs"
color="#2D89C5"
v-on="on"
>
mdi-account
</v-icon>
<svg
viewBox="0 0 36 36"
height="12px"
width="12px"
role="img"
aria-hidden="true"
class="v-icon__svg langbtn"
>
<path
fill="#2D89C5"
d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"
/>
</svg>
</template>
<span class="tooltip">Usuario</span>
</v-tooltip>
</v-btn>
</template>
<v-lazy>
<v-card>
<v-list
dense
style="margin-left: 16px"
>
<v-list-item-title class="h3">
<b>
{{ userData }}
</b>
</v-list-item-title>
<v-list-item-subtitle>{{ role }}</v-list-item-subtitle>
</v-list>
<v-list
dense
>
<v-list-item
v-for="item in globalActions"
:key="item.title"
@click="navigateProcesses(item.link)"
>
<v-list-item-avatar>
<v-avatar
fab
>
<v-icon color="#2D89C5">
{{ item.icon }}
</v-icon>
</v-avatar>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title>{{ item.title }}</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item
@click="getMeOut"
>
<v-list-item-avatar>
<v-avatar
fab
>
<v-icon color="#2D89C5">
mdi-logout
</v-icon>
</v-avatar>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title>Cerrar Sesión</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
</v-card>
</v-lazy>
</v-menu>
</v-app-bar> </v-app-bar>
<!-- <home-drawer
v-model="drawer"
:items="items"
/> -->
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'
import { logout } from '@/axios/auth'
export default { export default {
name: 'HomeAppBar', name: 'HomeAppBar',
...@@ -125,58 +51,15 @@ ...@@ -125,58 +51,15 @@
}, */ }, */
data: () => ({ data: () => ({
drawer: null,
items: [
'Home',
'About',
'Contact',
'Pro',
],
}), }),
computed: {
globalActions () {
if (this.role === 'SADM') {
return [{ link: 'lol', title: 'Registrar', icon: 'mdi-account-plus' }]
} else {
return []
}
},
role () {
return localStorage.getItem('role')
},
userData () {
return localStorage.getItem('userData')
},
},
methods: { methods: {
navigateProcesses (link) {
this.$router.push({ name: 'Register' })
},
async getMeOut () {
// Todo: SEND LOGOUT REQUEST
try {
await logout()
localStorage.setItem('tkn', null)
localStorage.setItem('userData', null)
localStorage.setItem('role', null)
this.$toast.success('Sesión cerrada con éxito', {
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,
})
localStorage.setItem('tkn', null)
localStorage.setItem('userData', null)
localStorage.setItem('role', null)
this.$router.push({ name: 'Login' })
} catch (e) {
localStorage.setItem('tkn', null)
localStorage.setItem('userData', null)
localStorage.setItem('role', null)
this.$router.push({ name: 'Login' })
}
},
showHideDrawer () { showHideDrawer () {
this.$store.commit('setDrawer') this.$store.commit('setDrawer')
}, },
......
...@@ -24,16 +24,14 @@ ...@@ -24,16 +24,14 @@
shaped shaped
> >
<v-list-item <v-list-item
v-for="link in lol" v-for="name in items"
:key="link.name" :key="name"
:to="{ name: link.name }" :to="{ name }"
:exact="link.name === 'Home'" :exact="name === 'Home'"
color="primary" color="primary"
> >
<v-list-item-content> <v-list-item-content>
<v-list-item-title> <v-list-item-title v-text="name" />
<v-icon>{{ link.icon }}</v-icon> {{ link.name }}
</v-list-item-title>
</v-list-item-content> </v-list-item-content>
</v-list-item> </v-list-item>
</v-list> </v-list>
...@@ -41,7 +39,6 @@ ...@@ -41,7 +39,6 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'
export default { export default {
name: 'HomeDrawer', name: 'HomeDrawer',
...@@ -53,37 +50,13 @@ ...@@ -53,37 +50,13 @@
}, },
data: () => ({ data: () => ({
iconsrc: '@/assets/icon.png', iconsrc: '@/assets/icon.png',
lol: [],
}), }),
computed: { computed: {
...mapGetters(['user', 'drawer']), drawer () {
ok () { return this.$store.getters.drawer
return this.items
}, },
role () {
return localStorage.getItem('role')
},
},
created () {
this.filterLinks()
}, },
methods: { methods: {
filterLinks () {
const filtered = this.items.filter(ok => ok.type === 'default')
switch (this.role) {
case 'MCP': {
this.lol = this.items
break
}
case 'SADM': {
this.lol = this.items
break
}
default: {
this.lol = filtered
}
}
},
}, },
} }
</script> </script>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
cols="12" cols="12"
md="12" md="12"
> >
<b>2021</b> FMFC@UCLV <b>2020</b> FMFC@UCLV
</v-col> </v-col>
</v-row> </v-row>
</v-container> </v-container>
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'
export default { export default {
name: 'HomeLayout', name: 'HomeLayout',
...@@ -26,17 +25,11 @@ ...@@ -26,17 +25,11 @@
}, },
data: () => ({ data: () => ({
drawer: !null, drawer: !null,
links: [ items: [
{ name: 'Control', type: 'default', icon: 'mdi-view-dashboard' }, 'Control',
{ name: 'Centros', type: 'admin', icon: 'mdi-hospital-building' }, 'Centros',
{ name: 'Pacientes', type: 'default', icon: 'mdi-account-multiple' }, 'Pacientes',
], ],
}), }),
computed: {
...mapGetters(['user']),
items () {
return this.links
},
},
} }
</script> </script>
...@@ -11,7 +11,7 @@ import 'vue-toastification/dist/index.css' ...@@ -11,7 +11,7 @@ import 'vue-toastification/dist/index.css'
import axios from 'axios' import axios from 'axios'
import api from '@/utils/api' import api from '@/utils/api'
import { encrypt } from './utils/enc' import { encrypt } from './utils/enc'
import MultiFiltersPlugin from '@/plugins/MultiFilters' import MultiFiltersPlugin from "@/plugins/MultiFilters";
Vue.use(Vuex) Vue.use(Vuex)
...@@ -21,41 +21,18 @@ Vue.use(Vuebar) ...@@ -21,41 +21,18 @@ Vue.use(Vuebar)
Vue.use(MultiFiltersPlugin) Vue.use(MultiFiltersPlugin)
Vue.prototype.$axios = api Vue.prototype.$axios = api
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',
maxToasts: 20, maxToasts: 20,
newestOnTop: true, newestOnTop: true,
}) })
// CHECK SECURITY
router.beforeEach((to, from, next) => {
if (to.name !== 'Login' && localStorage.getItem('tkn') === 'null') {
Vue.$toast.error('Debe estar logueado para poder navegar en nuestro sitio', {
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,
})
router.push({ name: 'Login' })
} else if (to.name === 'Login' && localStorage.getItem('tkn') !== 'null') {
next({ name: 'Control' })
} else {
next()
}
})
new Vue({ new Vue({
axios, axios,
......
import { rest } from "msw"; import { rest } from 'msw'
import { REQUEST_DIR } from "../utils/constants"; import { REQUEST_DIR } from '../utils/constants'
export default [ export default [
rest.get(REQUEST_DIR + "centros?page=1", (req, res, ctx) => { rest.get(REQUEST_DIR + 'centros?page=1', (req, res, ctx) => {
return res( return res(
ctx.json({ ctx.json({
centros: [ centros: [
{ {
id_centro: 1, id_centro: 1,
nombre_centro: "Verda Robel", nombre_centro: 'Verda Robel',
municipio: "Santa Clara", municipio: 'Santa Clara',
organismo: "MINED", organismo: 'MINED',
created_at: "2021-07-06 21:45:51", created_at: '2021-07-06 21:45:51',
updated_at: "2021-07-06 21:45:51" updated_at: '2021-07-06 21:45:51',
categoria: 1,
}, },
{ {
id_centro: 2, id_centro: 2,
nombre_centro: "Mina Braun", nombre_centro: 'Mina Braun',
municipio: "Placetas", municipio: 'Placetas',
organismo: "MES", organismo: 'MES',
created_at: "2021-07-06 21:45:51", created_at: '2021-07-06 21:45:51',
updated_at: "2021-07-06 21:45:51" updated_at: '2021-07-06 21:45:51',
categoria: 1,
}, },
{ {
id_centro: 3, id_centro: 3,
nombre_centro: "Clarabelle Bednar", nombre_centro: 'Clarabelle Bednar',
municipio: "Placetas", municipio: 'Placetas',
organismo: "MES", organismo: 'MES',
created_at: "2021-07-06 21:45:51", created_at: '2021-07-06 21:45:51',
updated_at: "2021-07-06 21:45:51" updated_at: '2021-07-06 21:45:51',
categoria: 2,
},
{
id_centro: 4,
nombre_centro: 'Some Site',
municipio: 'Santo Domingo',
organismo: 'CARACOL',
created_at: '2021-07-06 21:45:51',
updated_at: '2021-07-06 21:45:51',
categoria: 0,
},
{
id_centro: 5,
nombre_centro: 'Another Place',
municipio: 'Caibarien',
organismo: 'MINED',
created_at: '2021-07-06 21:45:51',
updated_at: '2021-07-06 21:45:51',
categoria: 0,
} }
], ],
meta: { meta: {
...@@ -37,68 +58,68 @@ export default [ ...@@ -37,68 +58,68 @@ export default [
last_page: 2, last_page: 2,
per_page: 10, per_page: 10,
to: 10, to: 10,
total: 4 total: 4,
} },
}) }),
); )
}), }),
rest.post(REQUEST_DIR + "centros", (req, res, ctx) => { rest.post(REQUEST_DIR + 'centros', (req, res, ctx) => {
return res( return res(
ctx.json({ ctx.json({
centro: { centro: {
id_centro: 9, id_centro: 9,
nombre_centro: "Mrs. Katharina Feeney", nombre_centro: 'Mrs. Katharina Feeney',
municipio: "Sagua", municipio: 'Sagua',
organismo: "MES", organismo: 'MES',
created_at: "2021-07-06 21:45:51", created_at: '2021-07-06 21:45:51',
updated_at: "2021-07-06 21:45:51" updated_at: '2021-07-06 21:45:51',
}, },
message: "Success" message: 'Success',
}) }),
); )
}), }),
rest.put(REQUEST_DIR + "centros/1", (req, res, ctx) => { rest.put(REQUEST_DIR + 'centros/1', (req, res, ctx) => {
return res( return res(
ctx.json({ ctx.json({
centro: { centro: {
id_centro: 10, id_centro: 10,
nombre_centro: "Panchito3", nombre_centro: 'Panchito3',
municipio: "Sagua", municipio: 'Sagua',
organismo: "MES", organismo: 'MES',
created_at: "2021-07-06 21:45:51", created_at: '2021-07-06 21:45:51',
updated_at: "2021-07-07 01:45:37" updated_at: '2021-07-07 01:45:37',
}, },
message: "Centro Actualizado" message: 'Centro Actualizado',
}) }),
); )
}), }),
rest.delete(REQUEST_DIR + "centros/1", (req, res, ctx) => { rest.delete(REQUEST_DIR + 'centros/1', (req, res, ctx) => {
return res( return res(
ctx.json({ ctx.json({
centro: { centro: {
id_centro: 10, id_centro: 10,
nombre_centro: "Panchito3", nombre_centro: 'Panchito3',
municipio: "Sagua", municipio: 'Sagua',
organismo: "MES", organismo: 'MES',
created_at: "2021-07-06 21:45:51", created_at: '2021-07-06 21:45:51',
updated_at: "2021-07-07 01:45:37" updated_at: '2021-07-07 01:45:37',
}, },
message: "Centro Eliminado" message: 'Centro Eliminado',
}) }),
); )
}), }),
rest.get(REQUEST_DIR + "centros/1/areas?page=1", (req, res, ctx) => { rest.get(REQUEST_DIR + 'centros/1/areas?page=1', (req, res, ctx) => {
return res( return res(
ctx.json({ ctx.json({
areas: [ areas: [
{ {
id_area: 1, id_area: 1,
id_centro: 1, id_centro: 1,
nombre: "Chad Bins", nombre: 'Chad Bins',
categoria: "Alto Riesgo", categoria: 'Alto Riesgo',
created_at: "2021-07-07 03:20:18", created_at: '2021-07-07 03:20:18',
updated_at: "2021-07-07 03:20:18" updated_at: '2021-07-07 03:20:18',
} },
], ],
meta: { meta: {
current_page: 1, current_page: 1,
...@@ -106,78 +127,134 @@ export default [ ...@@ -106,78 +127,134 @@ export default [
last_page: 1, last_page: 1,
per_page: 10, per_page: 10,
to: 1, to: 1,
total: 1 total: 1,
} },
}) }),
); )
}),
rest.get(REQUEST_DIR + 'nomenclador/clasificacion', (req, res, ctx) => {
return res(
ctx.json([
{
id: 1,
nombre: 'ALTO RIESGO',
},
{
id: 2,
nombre: 'RIESGO MEDIO',
},
{
id: 3,
nombre: 'RIESGO BAJO',
},
{
id: 0,
nombre: 'SOSPECHOSO',
},
],
),
)
}),
rest.get(REQUEST_DIR + 'nomenclador/categoria', (req, res, ctx) => {
return res(
ctx.json([
{
id: 1,
nombre: 'ALTO RIESGO',
},
{
id: 2,
nombre: 'RIESGO MEDIO',
},
{
id: 3,
nombre: 'RIESGO BAJO',
},
{
id: 0,
nombre: 'SOSPECHOSO',
},
],
),
)
}), }),
rest.post(REQUEST_DIR + "centros/1/areas", (req, res, ctx) => { rest.post(REQUEST_DIR + 'centros/1/areas', (req, res, ctx) => {
return res( return res(
ctx.json({ ctx.json({
area: { area: {
id_centro: 9, id_centro: 9,
nombre_centro: "Mrs. Katharina Feeney", nombre_centro: 'Mrs. Katharina Feeney',
municipio: "Sagua", municipio: 'Sagua',
organismo: "MES", organismo: 'MES',
created_at: "2021-07-06 21:45:51", created_at: '2021-07-06 21:45:51',
updated_at: "2021-07-06 21:45:51" updated_at: '2021-07-06 21:45:51',
}, },
message: "Success" message: 'Success',
}) }),
); )
}), }),
rest.put(REQUEST_DIR + "areas/1", (req, res, ctx) => { rest.put(REQUEST_DIR + 'areas/1', (req, res, ctx) => {
return res( return res(
ctx.json({ ctx.json({
area: { area: {
id_centro: 9, id_centro: 9,
nombre_centro: "Mrs. Katharina Feeney", nombre_centro: 'Mrs. Katharina Feeney',
municipio: "Sagua", municipio: 'Sagua',
organismo: "MES", organismo: 'MES',
created_at: "2021-07-06 21:45:51", created_at: '2021-07-06 21:45:51',
updated_at: "2021-07-06 21:45:51" updated_at: '2021-07-06 21:45:51',
}, },
message: "Success" message: 'Success',
}) }),
); )
}), }),
rest.delete(REQUEST_DIR + "areas/1", (req, res, ctx) => { rest.delete(REQUEST_DIR + 'areas/1', (req, res, ctx) => {
return res( return res(
ctx.json({ ctx.json({
centro: { centro: {
id_centro: 10, id_centro: 10,
nombre_centro: "Panchito3", nombre_centro: 'Panchito3',
municipio: "Sagua", municipio: 'Sagua',
organismo: "MES", organismo: 'MES',
created_at: "2021-07-06 21:45:51", created_at: '2021-07-06 21:45:51',
updated_at: "2021-07-07 01:45:37" updated_at: '2021-07-07 01:45:37',
}, },
message: "Area Eliminado" message: 'Area Eliminado',
}) }),
); )
}), }),
rest.get(REQUEST_DIR + "pacientes?page=1", (req, res, ctx) => { rest.get(REQUEST_DIR + 'pacientes?page=1', (req, res, ctx) => {
return res( return res(
ctx.json({ ctx.json({
pacientes: [ pacientes: [
{ {
id_paciente: "1", id_paciente: '1',
ci: 92121234063, ci: 92121234063,
nombre: "Pepe", nombre: 'Pepe',
apellidos: "Glez Hdez" apellidos: 'Glez Hdez',
categoria: 3,
}, },
{ {
id_paciente: "1", id_paciente: '2',
ci: 92121234063, ci: 92121234063,
nombre: "Pepe", nombre: 'Pepe',
apellidos: "Glez Hdez" apellidos: 'Glez Hdez',
categoria: 2,
}, },
{ {
id_paciente: "1", id_paciente: '3',
ci: 92121234063, ci: 92121234063,
nombre: "Pepe", nombre: 'Pepe',
apellidos: "Glez Hdez" apellidos: 'Glez Hdez',
} categoria: 2,
},
{
id_paciente: '4',
ci: 92121234063,
nombre: 'Amancio',
apellidos: 'Perez Perez',
categoria: 0,
},
], ],
meta: { meta: {
current_page: 1, current_page: 1,
...@@ -185,33 +262,33 @@ export default [ ...@@ -185,33 +262,33 @@ export default [
last_page: 2, last_page: 2,
per_page: 10, per_page: 10,
to: 10, to: 10,
total: 20 total: 20,
} },
}) }),
); )
}), }),
rest.post(REQUEST_DIR + "pacientes", (req, res, ctx) => { rest.post(REQUEST_DIR + 'pacientes', (req, res, ctx) => {
return res( return res(
ctx.json({ ctx.json({
paciente: { paciente: {
id_paciente: 2, id_paciente: 2,
nombre: "Test store", nombre: 'Test store',
apellidos: "Test", apellidos: 'Test',
edad: "25", edad: '25',
ci: "12312312312", ci: '12312312312',
sexo: "M", sexo: 'M',
direccion: "Test", direccion: 'Test',
cmf: null, cmf: null,
remite_caso: null, remite_caso: null,
hospital: null, hospital: null,
estado_salud: null, estado_salud: null,
categoria: "1", categoria: '1',
estado_sistema: null, estado_sistema: null,
trabajador_salud: "0", trabajador_salud: '0',
embarazada: "0", embarazada: '0',
ninho: "0", ninho: '0',
test_antigeno: "1", test_antigeno: '1',
vacunado: "0", vacunado: '0',
apps: { apps: {
id_app: 2, id_app: 2,
id_paciente: 2, id_paciente: 2,
...@@ -221,9 +298,9 @@ export default [ ...@@ -221,9 +298,9 @@ export default [
obesidad: 0, obesidad: 0,
insuficiencia_renal: 0, insuficiencia_renal: 0,
oncologia: 0, oncologia: 0,
otros: "", otros: '',
created_at: "2021-07-15 03:36:39", created_at: '2021-07-15 03:36:39',
updated_at: "2021-07-15 03:36:39" updated_at: '2021-07-15 03:36:39',
}, },
sintomas: { sintomas: {
id_sintomas: 2, id_sintomas: 2,
...@@ -237,77 +314,76 @@ export default [ ...@@ -237,77 +314,76 @@ export default [
dificultad_respiratoria: 0, dificultad_respiratoria: 0,
cefalea: 0, cefalea: 0,
dolor_garganta: 0, dolor_garganta: 0,
otros: "", otros: '',
created_at: "2021-07-15 03:36:39", created_at: '2021-07-15 03:36:39',
updated_at: "2021-07-15 03:36:39" updated_at: '2021-07-15 03:36:39',
}, },
contacto: { contacto: {
id_contactos: 2, id_contactos: 2,
id_paciente: 2, id_paciente: 2,
fecha_contacto: null, fecha_contacto: null,
tipo_contacto: null, tipo_contacto: null,
lugar_contacto: "Test", lugar_contacto: 'Test',
created_at: "2021-07-15 03:36:39", created_at: '2021-07-15 03:36:39',
updated_at: "2021-07-15 03:36:39" updated_at: '2021-07-15 03:36:39',
} },
}, },
message: "Paciente registrado" message: 'Paciente registrado',
}) }),
); )
}), }),
rest.get(REQUEST_DIR + "pacientes/1", (req, res, ctx) => { rest.get(REQUEST_DIR + 'pacientes/1', (req, res, ctx) => {
return res( return res(
ctx.json({ ctx.json({
paciente: { paciente: {
id_paciente: 1, id_paciente: 1,
nombre: "Yoelvis", nombre: 'Yoelvis',
apellidos: "Gonzalez", apellidos: 'Gonzalez',
edad: 28, edad: 28,
ci: "92121234063", ci: '92121234063',
sexo: "M", sexo: 'M',
direccion: "Oquendo 109 e/ Ateneo y Cornelio. Rpro Virginia", direccion: 'Oquendo 109 e/ Ateneo y Cornelio. Rpro Virginia',
cmf: "20.31", cmf: '20.31',
remite_caso: "Policlinico", remite_caso: 'Policlinico',
hospital: null, hospital: null,
estado_salud: 1, estado_salud: 'De cuidado',
provincia: 1, provincia: 1,
municipio: 1, municipio: 1,
categoria: 1, categoria: 'Loco',
area_salud: 1, estado_sistema: 'Negativo_PCR',
estado_sistema: "1", trabajador_salud: 0,
trabajador_salud: false, embarazada: 0,
embarazada: false, ninho: 0,
ninho: false, test_antigeno: 'Negativo',
test_antigeno: "Negativo", vacunado: 1,
vacunado: true,
apps: { apps: {
id_app: 1, id_app: 1,
id_paciente: 1, id_paciente: 1,
hipertension: false, hipertension: 0,
diabetes: false, diabetes: 0,
asma: false, asma: 1,
obesidad: false, obesidad: 0,
insuficiencia_renal: false, insuficiencia_renal: 0,
oncologia: false, oncologia: 0,
otros: "", otros: '',
created_at: "2021-07-15 20:12:20", created_at: '2021-07-15 20:12:20',
updated_at: "2021-07-15 20:12:20" updated_at: '2021-07-15 20:12:20',
}, },
sintomas: { sintomas: {
id_sintomas: 1, id_sintomas: 1,
id_paciente: 1, id_paciente: 1,
fecha_sintomas: null, fecha_sintomas: null,
fiebre: false, fiebre: 0,
rinorrea: false, rinorrea: 1,
congestion_nasal: false, congestion_nasal: 0,
tos: false, tos: 0,
expectoracion: false, expectoracion: 0,
dificultad_respiratoria: false, dificultad_respiratoria: 0,
cefalea: false, cefalea: 0,
dolor_garganta: false, dolor_garganta: 0,
otros: "", otros: '',
created_at: "2021-07-15 20:12:20", created_at: '2021-07-15 20:12:20',
updated_at: "2021-07-15 20:12:20" updated_at: '2021-07-15 20:12:20',
}, },
contacto: { contacto: {
id_contactos: 1, id_contactos: 1,
...@@ -315,8 +391,8 @@ export default [ ...@@ -315,8 +391,8 @@ export default [
fecha_contacto: null, fecha_contacto: null,
tipo_contacto: null, tipo_contacto: null,
lugar_contacto: null, lugar_contacto: null,
created_at: "2021-07-15 20:12:20", created_at: '2021-07-15 20:12:20',
updated_at: "2021-07-15 20:12:20" updated_at: '2021-07-15 20:12:20',
}, },
arribo: { arribo: {
id_arribo: 1, id_arribo: 1,
...@@ -324,35 +400,35 @@ export default [ ...@@ -324,35 +400,35 @@ export default [
pais_procedencia: null, pais_procedencia: null,
lugar_estancia: null, lugar_estancia: null,
fecha_arribo: null, fecha_arribo: null,
created_at: "2021-07-15 20:12:20", created_at: '2021-07-15 20:12:20',
updated_at: "2021-07-15 20:12:20" updated_at: '2021-07-15 20:12:20',
} },
}, },
message: "Success" message: 'Success',
}) }),
); )
}), }),
rest.put(REQUEST_DIR + "pacientes/1", (req, res, ctx) => { rest.put(REQUEST_DIR + 'pacientes/1', (req, res, ctx) => {
return res( return res(
ctx.json({ ctx.json({
paciente: { paciente: {
id_paciente: 1, id_paciente: 1,
nombre: "Test store", nombre: 'Test store',
apellidos: "Test", apellidos: 'Test',
edad: 25, edad: 25,
ci: "12312312316", ci: '12312312316',
sexo: "M", sexo: 'M',
direccion: "Test", direccion: 'Test',
cmf: null, cmf: null,
remite_caso: null, remite_caso: null,
hospital: null, hospital: null,
estado_salud: "Test", estado_salud: 'Test',
categoria: "Test", categoria: 'Test',
estado_sistema: "Test", estado_sistema: 'Test',
trabajador_salud: 0, trabajador_salud: 0,
embarazada: 0, embarazada: 0,
ninho: 0, ninho: 0,
test_antigeno: "Test", test_antigeno: 'Test',
vacunado: 0, vacunado: 0,
apps: { apps: {
id_app: 1, id_app: 1,
...@@ -363,9 +439,9 @@ export default [ ...@@ -363,9 +439,9 @@ export default [
obesidad: 0, obesidad: 0,
insuficiencia_renal: 0, insuficiencia_renal: 0,
oncologia: 0, oncologia: 0,
otros: "", otros: '',
created_at: "2021-07-15 20:12:20", created_at: '2021-07-15 20:12:20',
updated_at: "2021-07-15 20:12:20" updated_at: '2021-07-15 20:12:20',
}, },
sintomas: { sintomas: {
id_sintomas: 1, id_sintomas: 1,
...@@ -379,182 +455,56 @@ export default [ ...@@ -379,182 +455,56 @@ export default [
dificultad_respiratoria: 0, dificultad_respiratoria: 0,
cefalea: 0, cefalea: 0,
dolor_garganta: 0, dolor_garganta: 0,
otros: "", otros: '',
created_at: "2021-07-15 20:12:20", created_at: '2021-07-15 20:12:20',
updated_at: "2021-07-15 20:12:20" updated_at: '2021-07-15 20:12:20',
}, },
contacto: { contacto: {
id_contactos: 1, id_contactos: 1,
id_paciente: 1, id_paciente: 1,
fecha_contacto: null, fecha_contacto: null,
tipo_contacto: null, tipo_contacto: null,
lugar_contacto: "Test", lugar_contacto: 'Test',
created_at: "2021-07-15 20:12:20", created_at: '2021-07-15 20:12:20',
updated_at: "2021-07-15 20:12:20" updated_at: '2021-07-15 20:12:20',
}, },
arribo: { arribo: {
id_arribo: 1, id_arribo: 1,
id_paciente: 1, id_paciente: 1,
pais_procedencia: "Italia", pais_procedencia: 'Italia',
lugar_estancia: null, lugar_estancia: null,
fecha_arribo: null, fecha_arribo: null,
created_at: "2021-07-15 20:12:20", created_at: '2021-07-15 20:12:20',
updated_at: "2021-07-15 20:12:20" updated_at: '2021-07-15 20:12:20',
} },
}, },
message: "Success" message: 'Success',
}) }),
); )
}), }),
rest.delete(REQUEST_DIR + "pacientes/1", (req, res, ctx) => { rest.delete(REQUEST_DIR + 'pacientes/1', (req, res, ctx) => {
return res( return res(
ctx.json({ ctx.json({
message: "Success" message: 'Success',
}) }),
);
}),
rest.get(REQUEST_DIR + "nomenclador/antigeno", (req, res, ctx) =>
res(
ctx.json([
{
id: 1,
nombre: "Positivo"
},
{
id: 2,
nombre: "Negativo"
},
{
id: 3,
nombre: "No realizado"
}
])
)
),
rest.get(REQUEST_DIR + "nomenclador/provincia", (req, res, ctx) =>
res(
ctx.json([
{
id: 1,
nombre: "HABANA"
},
{
id: 2,
nombre: "MATANZAS"
},
{
id: 3,
nombre: "VILLA CLARA"
}
])
)
),
rest.get(REQUEST_DIR + "nomenclador/clasificacion", (req, res, ctx) =>
res(
ctx.json([
{
id: 1,
nombre: "ALTO RIESGO"
},
{
id: 2,
nombre: "MEDIANO RIESGO"
},
{
id: 3,
nombre: "BAJO RIESGO"
}
])
)
),
rest.get(REQUEST_DIR + "nomenclador/sistema", (req, res, ctx) =>
res(
ctx.json([
{
id: 1,
nombre: "ENCUESTADO"
},
{
id: 2,
nombre: "PENDIENTE INGRESO"
},
{
id: 3,
nombre: "INGRESADO"
}
])
) )
), }),
rest.get(REQUEST_DIR + "nomenclador/estado", (req, res, ctx) => rest.get(REQUEST_DIR + 'nomenclador/antigeno', (req, res, ctx) =>
res( res(
ctx.json([ ctx.json([
{ {
id: 1, id: 1,
nombre: "DE CUIDADO" nombre: 'Positivo',
}, },
{ {
id: 2, id: 2,
nombre: "GRAVE" nombre: 'Negativo',
}, },
{ {
id: 3, id: 3,
nombre: "ETC" nombre: 'No realizado',
}
])
)
),
rest.get(REQUEST_DIR + "nomenclador/categoria", (req, res, ctx) =>
res(
ctx.json([
{
id: 1,
nombre: "SOSPECHOSO"
}, },
{ ]),
id: 2, ),
nombre: "POSITIVO"
},
{
id: 3,
nombre: "CONTACTO"
}
])
)
), ),
rest.get(REQUEST_DIR + "nomenclador/municipio/1", (req, res, ctx) => ]
res(
ctx.json([
{
id: 1,
nombre: "Santa Clara"
},
{
id: 2,
nombre: "Maniv=caragua"
},
{
id: 3,
nombre: "Santo Domingo"
}
])
)
),
rest.get(REQUEST_DIR + "nomenclador/salud/1", (req, res, ctx) =>
res(
ctx.json([
{
id: 1,
nombre: "Santa Clara"
},
{
id: 2,
nombre: "XX Aniversario"
},
{
id: 3,
nombre: "Maleza"
}
])
)
)
];
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* Enabled v-data-table to have moire than one filter. * Enabled v-data-table to have moire than one filter.
*/ */
class MultiFilters { class MultiFilters {
/** /**
* Constructor. * Constructor.
* *
...@@ -10,12 +11,12 @@ class MultiFilters { ...@@ -10,12 +11,12 @@ class MultiFilters {
* @param filter * @param filter
* @param headers * @param headers
*/ */
constructor (items, filters, filter, headers) { constructor(items, filters, filter, headers) {
this.items = items this.items = items;
this.filter = filter this.filter = filter;
this.headers = headers this.headers = headers;
this.filters = filters this.filters = filters;
this.filterCallbacks = {} this.filterCallbacks = {};
} }
/** /**
...@@ -24,8 +25,8 @@ class MultiFilters { ...@@ -24,8 +25,8 @@ class MultiFilters {
* @param val JSON chunk to be updated. * @param val JSON chunk to be updated.
* @returns {*} * @returns {*}
*/ */
static updateFilters (filters, val) { static updateFilters(filters, val) {
return Object.assign({}, filters, val) return Object.assign({}, filters, val);
} }
/** /**
...@@ -33,31 +34,31 @@ class MultiFilters { ...@@ -33,31 +34,31 @@ class MultiFilters {
* @param filterName The name of the filter from which the information will be extracted * @param filterName The name of the filter from which the information will be extracted
* @param filterCallback The callback that will apply the filter. * @param filterCallback The callback that will apply the filter.
*/ */
registerFilter (filterName, filterCallback) { registerFilter(filterName, filterCallback) {
this.filterCallbacks[filterName] = filterCallback this.filterCallbacks[filterName] = filterCallback;
} }
/** /**
* Run all filters. * Run all filters.
* @returns {*} * @returns {*}
*/ */
runFilters () { runFilters() {
const self = this const self = this;
let filteredItems = self.items let filteredItems = self.items;
Object.entries(this.filterCallbacks) Object.entries(this.filterCallbacks)
.forEach(([entity, cb]) => { .forEach(([entity, cb]) => {
filteredItems = cb.call(self, self.filters[entity], filteredItems) filteredItems = cb.call(self, self.filters[entity], filteredItems);
}) });
return filteredItems return filteredItems;
} }
} }
// Vue plugin. // Vue plugin.
const MultiFiltersPlugin = { const MultiFiltersPlugin = {
install (Vue, options) { install(Vue, options) {
Vue.prototype.$MultiFilters = MultiFilters Vue.prototype.$MultiFilters = MultiFilters;
}, }
} };
export default MultiFiltersPlugin export default MultiFiltersPlugin;
...@@ -59,11 +59,6 @@ const router = new Router({ ...@@ -59,11 +59,6 @@ const router = new Router({
component: () => import('@/views/pro/Index.vue'), component: () => import('@/views/pro/Index.vue'),
meta: { src: require('@/assets/pro.jpg') }, meta: { src: require('@/assets/pro.jpg') },
}, },
{
path: 'register',
name: 'Register',
component: () => import('@/views/admin/Index.vue'),
},
{ {
path: '*', path: '*',
name: 'FourOhFour', name: 'FourOhFour',
......
...@@ -3,16 +3,4 @@ export default { ...@@ -3,16 +3,4 @@ export default {
systemStatuses: state => state.systemStatuses, systemStatuses: state => state.systemStatuses,
provinces: state => state.provinces, provinces: state => state.provinces,
municipalities: state => state.municipalities, municipalities: state => state.municipalities,
categories: state => state.categories,
centers: state => state.centers,
clasifications: state => state.clasifications,
antigens: state => state.antigens,
healthAreas: state => state.healthAreas,
healthStatuses: state => state.healthStatuses,
pIndex: state => state.pIndex,
patient: state => state.patient,
user: state => state.user,
filters: state => state.filters,
filterStatus: state => state.filterStatus,
editFromFile: state => state.editFromFile,
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment