<script>
// Extensions
import View from '@/views/View'
// Mixins
import LoadSections from '@/mixins/load-sections'
export default {
name: 'Ingresar',
metaInfo: { title: 'Ingresar Paciente' },
extends: View,
mixins: [
LoadSections([
'admit',
]),
],
props: {
id: {
type: String,
default: 'admit',
},
},
}
</script>
<script>
// Extensions
import View from '@/views/View'
// Mixins
import LoadSections from '@/mixins/load-sections'
export default {
name: 'Asignar',
metaInfo: { title: 'Asignar Paciente' },
extends: View,
mixins: [
LoadSections([
'ingresar-pacientes',
]),
],
props: {
id: {
type: String,
default: 'admit',
},
},
}
</script>
<template>
<base-section
id="admit"
space="0"
>
<patient-file />
</base-section>
</template>
<script>
import PatientFile from '../../components/PatientFile.vue'
export default {
name: 'SectionAdmit',
components: { PatientFile },
provide: {
heading: { align: 'center' },
},
}
</script>
...@@ -15,6 +15,28 @@ ...@@ -15,6 +15,28 @@
loading-text="Cargando Centros..." loading-text="Cargando Centros..."
@pagination="paginateCenters" @pagination="paginateCenters"
> >
<template v-slot:item.provincia="{ item }">
<v-text :disabled="true">
{{ getProvincia(item.provincia) }}
</v-text>
</template>
<template v-slot:item.municipio="{ item }">
<v-text :disabled="true">
{{ getMunicipio(item.municipio) }}
</v-text>
</template>
<template v-slot:item.organismo="{ item }">
<v-text :disabled="true">
{{ getOrganismo(item.organismo) }}
</v-text>
</template>
<template v-slot:item.en_uso="{ item }">
<v-switch
inset
:disabled="true"
:input-value="getActivation(item.en_uso)"
/>
</template>
<template v-slot:top> <template v-slot:top>
<v-toolbar flat> <v-toolbar flat>
<v-toolbar-title>Centros de aislamiento</v-toolbar-title> <v-toolbar-title>Centros de aislamiento</v-toolbar-title>
...@@ -39,85 +61,109 @@ ...@@ -39,85 +61,109 @@
<v-icon>mdi-plus</v-icon>Añadir Centro <v-icon>mdi-plus</v-icon>Añadir Centro
</v-btn> </v-btn>
</template> </template>
<v-card> <v-form
<v-card-title class="fix-title"> ref="form"
<span class="text-h5">{{ formTitle }}</span> class="px3"
</v-card-title> >
<v-card>
<v-card-title class="fix-title">
<span class="text-h5">{{ formTitle }}</span>
</v-card-title>
<v-card-text> <v-card-text>
<v-container> <v-container>
<v-row> <v-row>
<v-col <v-col
cols="12" cols="12"
sm="6" sm="6"
md="4" md="4"
> >
<v-text-field <v-text-field
v-model="editedItem.nombre_centro" v-model="editedItem.nombre_centro"
label="Nombre" label="Nombre"
/> :rules="inserteditRules"
</v-col> />
<v-col </v-col>
cols="12" <v-col
sm="6" cols="12"
md="4" sm="6"
> md="4"
<v-autocomplete >
v-model="editedItem.provincia" <v-autocomplete
:items="provinces" v-model="editedItem.provincia"
color="white" :items="provinces"
item-text="nombre" color="white"
label="Provincia" item-text="nombre"
item-value="id" label="Provincia"
@change="loadMunicipalitiesData(editedItem.provincia)" item-value="id"
/> :rules="inserteditRules"
</v-col> @change="loadMunicipalitiesData(editedItem.provincia)"
<v-col />
cols="12" </v-col>
sm="6" <v-col
md="4" cols="12"
> sm="6"
<v-autocomplete md="4"
v-model="editedItem.municipio" >
:items="municipalities" <v-autocomplete
item-value="nombre" v-model="editedItem.municipio"
color="white" :items="municipalities"
item-text="nombre" item-value="id"
label="Municipio" color="white"
/> item-text="nombre"
</v-col> label="Municipio"
<v-col :rules="inserteditRules"
cols="12" />
sm="6" </v-col>
md="4" <v-col
> cols="12"
<v-text-field sm="6"
v-model="editedItem.organismo" md="4"
label="Organismo" >
/> <v-autocomplete
</v-col> v-model="editedItem.organismo"
</v-row> :items="association"
</v-container> item-value="id"
</v-card-text> color="white"
item-text="nombre"
label="Organismo"
:rules="inserteditRules"
/>
</v-col>
<v-col
cols="12"
sm="6"
md="4"
>
<v-switch
v-model="editedItem.en_uso"
inset
:label="`En uso`"
/>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions> <v-card-actions>
<v-spacer /> <v-spacer />
<v-btn <v-btn
color="blue darken-1" color="blue darken-1"
text text
@click="close" @click="close"
> >
Cancelar Cancelar
</v-btn> </v-btn>
<v-btn <v-btn
color="blue darken-1" color="blue darken-1"
text text
@click="save" @click="save"
> >
Guardar Guardar
</v-btn> </v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-form>
</v-dialog> </v-dialog>
<v-dialog <v-dialog
v-model="dialogDelete" v-model="dialogDelete"
...@@ -241,10 +287,10 @@ ...@@ -241,10 +287,10 @@
mdi-hospital-building mdi-hospital-building
</v-icon> </v-icon>
<v-card-title class="text-h5"> <v-card-title class="text-h5">
{{ editedItem.nombre_centro }} / {{ editedItem.organismo }} {{ editedItem.nombre_centro }} / {{ getMunicipio(editedItem.provincia) }}
</v-card-title> </v-card-title>
</v-card-title> </v-card-title>
<v-card-subtitle>{{ editedItem.municipio }}</v-card-subtitle> <v-card-subtitle>{{ getMunicipio(editedItem.municipio) }}</v-card-subtitle>
<v-card-text> <v-card-text>
<info-box <info-box
:stats="myStats" :stats="myStats"
...@@ -266,9 +312,21 @@ ...@@ -266,9 +312,21 @@
loading-text="Cargando Areas..." loading-text="Cargando Areas..."
@pagination="paginateAreas" @pagination="paginateAreas"
> >
<template v-slot:item.categoria="{ item }">
<v-text :disabled="true">
{{ getCategoria(item.categoria) }}
</v-text>
</template>
<template v-slot:item.en_uso="{ item }">
<v-switch
inset
:disabled="true"
:input-value="getActivationArea(item.en_uso)"
/>
</template>
<template v-slot:top> <template v-slot:top>
<v-toolbar flat> <v-toolbar flat>
<v-toolbar-title>Areas</v-toolbar-title> <v-toolbar-title>Áreas</v-toolbar-title>
<v-divider <v-divider
class="mx-4" class="mx-4"
inset inset
...@@ -287,62 +345,116 @@ ...@@ -287,62 +345,116 @@
v-bind="attrs" v-bind="attrs"
v-on="on" v-on="on"
> >
<v-icon>mdi-plus</v-icon>Añadir Area <v-icon>mdi-plus</v-icon>Añadir Área
</v-btn> </v-btn>
</template> </template>
<v-card> <v-form
<v-card-title class="fix-title"> ref="form"
<span class="text-h5">{{ areaFormTitle }}</span> class="px3"
</v-card-title> >
<v-card>
<v-card-text> <v-card-title class="fix-title">
<v-container> <span class="text-h5">{{ areaFormTitle }}</span>
<v-row> </v-card-title>
<v-col <v-card-text>
cols="12" <v-container>
sm="6" <v-row>
md="4" <v-col
> cols="12"
<v-text-field sm="6"
v-model="editedAreaItem.nombre" md="4"
label="Nombre" >
/> <v-text-field
</v-col> v-model="editedAreaItem.nombre"
<v-col label="Nombre"
cols="12" :rules="inserteditRules"
sm="6" />
md="4" </v-col>
> <v-col
<v-autocomplete cols="12"
v-model="editedAreaItem.categoria" sm="6"
:items="categories" md="4"
color="white" >
item-text="nombre" <v-autocomplete
label="Categoria" v-model="editedAreaItem.categoria"
/> :items="categories"
</v-col> color="white"
</v-row> item-text="nombre"
</v-container> label="Categoria"
</v-card-text> item-value="id"
:rules="inserteditRules"
/>
</v-col>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="editedAreaItem.capacidad"
label="Capacidad"
type="number"
:rules="inserteditRules"
/>
</v-col>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="editedAreaItem.capacidad_real"
label="Capacidad real"
type="number"
:rules="inserteditRules"
/>
</v-col>
<v-col
cols="12"
sm="6"
md="4"
>
<v-text-field
v-model="editedAreaItem.ocupado"
label="Ocupado"
type="number"
:rules="inserteditRules"
/>
</v-col>
<v-col
cols="12"
sm="6"
md="4"
>
<v-switch
v-model="editedAreaItem.en_uso"
inset
:label="`En uso`"
/>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions> <v-card-actions>
<v-spacer /> <v-spacer />
<v-btn <v-btn
color="blue darken-1" color="blue darken-1"
text text
@click="closeArea" @click="closeArea"
> >
Cancelar Cancelar
</v-btn> </v-btn>
<v-btn <v-btn
color="blue darken-1" color="blue darken-1"
text text
@click="saveArea" @click="saveArea"
> >
Guardar Guardar
</v-btn> </v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-form>
</v-dialog> </v-dialog>
<v-dialog <v-dialog
v-model="dialogAreaDelete" v-model="dialogAreaDelete"
...@@ -429,7 +541,7 @@ ...@@ -429,7 +541,7 @@
</template> </template>
<span>Eliminar</span> <span>Eliminar</span>
</v-tooltip> </v-tooltip>
<v-tooltip bottom> <!--<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<v-icon <v-icon
color="info" color="info"
...@@ -441,7 +553,7 @@ ...@@ -441,7 +553,7 @@
</v-icon> </v-icon>
</template> </template>
<span>Detalles</span> <span>Detalles</span>
</v-tooltip> </v-tooltip>-->
</template> </template>
<template v-slot:no-data> <template v-slot:no-data>
<v-btn <v-btn
...@@ -455,7 +567,7 @@ ...@@ -455,7 +567,7 @@
</v-card-text> </v-card-text>
</v-card> </v-card>
</div> </div>
<div v-else-if="room"> <!--<div v-else-if="room">
<v-card> <v-card>
<v-btn <v-btn
style="margin: 12px" style="margin: 12px"
...@@ -666,7 +778,7 @@ ...@@ -666,7 +778,7 @@
</v-card> </v-card>
</v-card-text> </v-card-text>
</v-card> </v-card>
</div> </div>-->
</div> </div>
</template> </template>
...@@ -688,12 +800,18 @@ ...@@ -688,12 +800,18 @@
getMunicipalities, getMunicipalities,
getProvinces, getProvinces,
getClasifications, getClasifications,
getAssociation,
} from '@/axios/nomenclators' } from '@/axios/nomenclators'
export default { export default {
components: { InfoBox }, components: { InfoBox },
data: () => ({ data: () => ({
centersFilters: { centersFilters: {
page: 1, page: 1,
nombre_centro: null,
provincia: null,
municipio: null,
organismo: null,
en_uso: null,
}, },
areasFilters: { areasFilters: {
page: 1, page: 1,
...@@ -720,6 +838,7 @@ ...@@ -720,6 +838,7 @@
dialogRoomDelete: false, dialogRoomDelete: false,
provinces: [], provinces: [],
municipalities: [], municipalities: [],
association: [],
categories: [], categories: [],
headers: [ headers: [
{ {
...@@ -728,8 +847,10 @@ ...@@ -728,8 +847,10 @@
sortable: true, sortable: true,
value: 'nombre_centro', value: 'nombre_centro',
}, },
{ text: 'Provincia', value: 'provincia' },
{ text: 'Municipio', value: 'municipio' }, { text: 'Municipio', value: 'municipio' },
{ text: 'Organismo', value: 'organismo' }, { text: 'Organismo', value: 'organismo' },
{ text: 'En uso', value: 'en_uso' },
{ text: 'Acciones', value: 'actions', sortable: false }, { text: 'Acciones', value: 'actions', sortable: false },
], ],
areaHeaders: [ areaHeaders: [
...@@ -739,7 +860,10 @@ ...@@ -739,7 +860,10 @@
sortable: true, sortable: true,
value: 'nombre', value: 'nombre',
}, },
{ text: 'Categoria', value: 'categoria' }, { text: 'Categoría', value: 'categoria' },
{ text: 'Capacidad', value: 'capacidad' },
{ text: 'Capacidad Real', value: 'capacidad_real' },
{ text: 'En uso', value: 'en_uso' },
{ text: 'Acciones', value: 'actions', sortable: false }, { text: 'Acciones', value: 'actions', sortable: false },
], ],
roomsHeaders: [ roomsHeaders: [
...@@ -763,30 +887,30 @@ ...@@ -763,30 +887,30 @@
provincia: '', provincia: '',
municipio: '', municipio: '',
organismo: '', organismo: '',
cap_total: 0, en_uso: false,
cap_disponible: 0,
id: -1,
}, },
defaultItem: { defaultItem: {
nombre_centro: '', nombre_centro: '',
provincia: '', provincia: '',
municipio: '', municipio: '',
organismo: '', organismo: '',
cap_total: 0, en_uso: false,
cap_disponible: 0,
id: -1,
}, },
editedAreaItem: { editedAreaItem: {
nombre: '', nombre: '',
categoria: '', categoria: '',
capacity: 0, capacidad: 0,
availability: 0, capacidad_real: 0,
ocupado: 0,
en_uso: false,
}, },
defaultAreaItem: { defaultAreaItem: {
nombre: '', nombre: '',
categoria: '', categoria: '',
capacity: 0, capacidad: 0,
availability: 0, capacidad_real: 0,
ocupado: 0,
en_uso: false,
}, },
editedRoomItem: { editedRoomItem: {
number: '', number: '',
...@@ -796,6 +920,7 @@ ...@@ -796,6 +920,7 @@
number: '', number: '',
capacity: 0, capacity: 0,
}, },
inserteditRules: [v => !!v || 'Este campo es requerido'],
}), }),
computed: { computed: {
formTitle () { formTitle () {
...@@ -832,15 +957,85 @@ ...@@ -832,15 +957,85 @@
}, },
created () { created () {
this.initialize() this.initialize()
this.getProvincesData() this.loadProvincesData()
this.loadMunicipalitiesData() this.loadMunicipalitiesData()
this.loadClasificationsData() this.loadClasificationsData()
this.loadAssociationData()
}, },
async mounted () { async mounted () {
this.initialize() this.initialize()
this.loadCentersData() this.loadCentersData()
}, },
methods: { methods: {
getActivation (en_uso_center) {
if (en_uso_center) return true
else return false
},
getActivationArea (en_uso_area) {
if (en_uso_area) return true
else return false
},
getOrganismo (id_organismo) {
const associationData = this.association
let data = null
associationData.forEach(element => {
if (element.id === id_organismo) {
data = element.nombre
}
})
return data
},
getMunicipio (id_municipio) {
const municipalitiesData = this.municipalities
let data = null
municipalitiesData.forEach(element => {
if (element.id === id_municipio) {
data = element.nombre
}
})
return data
},
getProvincia (id_provincia) {
const provincesData = this.provinces
let data = null
provincesData.forEach(element => {
if (element.id === id_provincia) {
data = element.nombre
}
})
return data
},
getCategoria (id_categoria) {
const categoriesData = this.categories
let data = null
categoriesData.forEach(element => {
if (element.id === id_categoria) {
data = element.nombre
}
})
return data
},
async loadAssociationData () {
try {
const associationRes = await getAssociation()
this.association = associationRes.data
} 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,
})
}
},
async loadMunicipalitiesData (id) { async loadMunicipalitiesData (id) {
try { try {
const municipalitiesRes = await getMunicipalities(id) const municipalitiesRes = await getMunicipalities(id)
...@@ -883,7 +1078,7 @@ ...@@ -883,7 +1078,7 @@
}) })
} }
}, },
async getProvincesData () { async loadProvincesData () {
try { try {
const provincesResponse = await getProvinces() const provincesResponse = await getProvinces()
this.provinces = provincesResponse.data this.provinces = provincesResponse.data
...@@ -951,16 +1146,7 @@ ...@@ -951,16 +1146,7 @@
initialize () { initialize () {
this.centers = [] this.centers = []
this.areas = [] this.areas = []
this.rooms = [ this.rooms = []
{
number: 101,
capacity: 20,
},
{
number: 102,
capacity: 25,
},
]
}, },
editItem (item) { editItem (item) {
this.editedIndex = this.centers.indexOf(item) this.editedIndex = this.centers.indexOf(item)
...@@ -1092,29 +1278,12 @@ ...@@ -1092,29 +1278,12 @@
}, },
async save () { async save () {
if (this.editedIndex > -1) { if (this.editedIndex > -1) {
await putCenter(this.editedItem) if (this.$refs.form.validate()) {
this.loadCentersData() await putCenter(this.editedItem)
Object.assign(this.centers[this.editedIndex], this.editedItem)
this.$toast.success('Centro editado correctamente', {
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 {
try {
await postCenter(this.editedItem)
this.loadCentersData() this.loadCentersData()
this.centers.push(this.editedItem) Object.assign(this.centers[this.editedIndex], this.editedItem)
this.$toast.success('Centro insertado correctamente', { this.close()
this.$toast.success('Centro editado correctamente', {
position: 'bottom-center', position: 'bottom-center',
timeout: 5000, timeout: 5000,
closeOnClick: true, closeOnClick: true,
...@@ -1128,8 +1297,42 @@ ...@@ -1128,8 +1297,42 @@
icon: true, icon: true,
rtl: false, rtl: false,
}) })
} catch (e) { }
this.$toast.error(e.toString(), { } else {
if (this.$refs.form.validate()) {
try {
await postCenter(this.editedItem)
this.loadCentersData()
this.centers.push(this.editedItem)
this.close()
this.$toast.success('Centro insertado correctamente', {
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,
})
} catch (e) {
console.log(e)
}
}
}
},
async saveArea () {
if (this.editedAreaIndex > -1) {
if (this.$refs.form.validate()) {
await putArea(this.editedAreaItem)
this.loadAreasData()
Object.assign(this.areas[this.editedAreaIndex], this.editedAreaItem)
this.closeArea()
this.$toast.success('Área editada correctamente', {
position: 'bottom-center', position: 'bottom-center',
timeout: 5000, timeout: 5000,
closeOnClick: true, closeOnClick: true,
...@@ -1144,50 +1347,39 @@ ...@@ -1144,50 +1347,39 @@
rtl: false, rtl: false,
}) })
} }
}
this.close()
},
async saveArea () {
if (this.editedAreaIndex > -1) {
await putArea(this.editedAreaItem)
this.loadAreasData()
Object.assign(this.areas[this.editedAreaIndex], this.editedAreaItem)
this.$toast.success('Área editada correctamente', {
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 {
await postArea(this.editedItem.id_centro, this.editedAreaItem) if (this.$refs.form.validate()) {
this.loadAreasData() var data = {
this.areas.push(this.editedAreaItem) id_centro: this.editedItem.id_centro,
this.$toast.success('Área insertada correctamente', { nombre: this.editedAreaItem.nombre,
position: 'bottom-center', categoria: this.editedAreaItem.categoria,
timeout: 5000, capacidad: this.editedAreaItem.capacidad,
closeOnClick: true, capacidad_real: this.editedAreaItem.capacidad_real,
pauseOnFocusLoss: false, ocupado: this.editedAreaItem.ocupado,
pauseOnHover: true, en_uso: this.editedAreaItem.en_uso,
draggable: true, }
draggablePercent: 0.6, await postArea(data)
showCloseButtonOnHover: false, this.loadAreasData()
hideProgressBar: true, this.closeArea()
closeButton: 'button', this.areas.push(this.editedAreaItem)
icon: true, this.$toast.success('Área insertada correctamente', {
rtl: false, 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.closeArea()
}, },
saveRoom () { /* saveRoom () {
console.log(this.editedRoomItem) console.log(this.editedRoomItem)
if (this.editedRoomIndex > -1) { if (this.editedRoomIndex > -1) {
Object.assign(this.rooms[this.editedRoomIndex], this.editedRoomItem) Object.assign(this.rooms[this.editedRoomIndex], this.editedRoomItem)
...@@ -1195,22 +1387,22 @@ ...@@ -1195,22 +1387,22 @@
this.rooms.push(this.editedRoomItem) this.rooms.push(this.editedRoomItem)
} }
this.closeRoom() this.closeRoom()
}, }, */
paginateCenters (pageInfo) { paginateCenters (pageInfo) {
if (this.centersFirstLoad) { if (this.centersFirstLoad) {
this.centersFirstLoad = false this.centersFirstLoad = false
return } else {
this.centersFilters.page = pageInfo.page
this.loadCentersData(pageInfo.page)
} }
this.centersFilters.page = pageInfo.page
this.loadCentersData(pageInfo.page)
}, },
paginateAreas (pageInfo) { paginateAreas (pageInfo) {
if (this.areasFirstLoad) { if (this.areasFirstLoad) {
this.areasFirstLoad = false this.areasFirstLoad = false
return } else {
this.areasFilters.page = pageInfo.page
this.loadAreasData(pageInfo.page)
} }
this.areasFilters.page = pageInfo.page
this.loadAreasData(pageInfo.page)
}, },
}, },
} }
......
<template> <template>
<div> <div>
<div class="row"> <div class="row">
<div class="col-md-7"> <div class="col-md-7">
...@@ -7,45 +6,56 @@ ...@@ -7,45 +6,56 @@
v-model="selected" v-model="selected"
:headers="headers" :headers="headers"
:items="patients" :items="patients"
@item-selected="update_selected_patients"
@toggle-select-all="update_selected_patients"
:single-select="singleSelect" :single-select="singleSelect"
item-key="id_paciente" item-key="id_paciente"
show-select show-select
class="elevation-1" class="elevation-1"
@item-selected="update_selected_patients"
@toggle-select-all="update_selected_patients"
> >
<template v-slot:top> <template v-slot:top>
<div class="row"> <div class="row">
<div class="col-md-5" id="selection"> <div
id="selection"
class="col-md-5"
>
<v-switch <v-switch
v-model="singleSelect" v-model="singleSelect"
label="Selección Única" label="Selección Única"
class="pa-3" class="pa-3"
></v-switch> />
</div> </div>
<div class="col-md-5" id="add-patients"> <div
id="add-patients"
class="col-md-5"
>
<v-btn <v-btn
depressed depressed
@click="addPatients"
color="primary" color="primary"
@click="procesar_ingreso"
> >
Agregar Paciente Ingresar Pacientes
</v-btn> </v-btn>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-5" id="patients-name"> <div
id="patients-name"
class="col-md-5"
>
<v-text-field <v-text-field
v-model="text_field" v-model="text_field"
label="Nombre Paciente" label="Nombre Paciente"
outlined outlined
clearable clearable
@input="getPatientsByName" @input="getPatientsByName"
></v-text-field> />
</div> </div>
<div class="col-md-5" id="filter-categorie-patients"> <div
id="filter-categorie-patients"
class="col-md-5"
>
<v-select <v-select
:label="`Categoria`" :label="`Categoria`"
:items="categorias_name" :items="categorias_name"
...@@ -53,28 +63,32 @@ ...@@ -53,28 +63,32 @@
small-chips small-chips
multiple multiple
@change="filterByCategoriesPatients" @change="filterByCategoriesPatients"
/>
></v-select>
</div> </div>
</div> </div>
</template> </template>
</v-data-table> </v-data-table>
</div> </div>
<div class="col-md-5" id="centers-table"> <div
id="centers-table"
class="col-md-5"
>
<v-data-table <v-data-table
v-model="selectedCenters" v-model="selectedCenters"
:headers="headers_cat" :headers="headers_cat"
@item-selected="update_selected_center"
:single-select="singleSelectCenters" :single-select="singleSelectCenters"
:items="centers" :items="centers"
item-key="nombre_centro" item-key="nombre_centro"
show-select show-select
class="elevation-1" class="elevation-1"
@item-selected="update_selected_center"
> >
<template v-slot:top> <template v-slot:top>
<div class="row"> <div class="row">
<div
<div class="col-md-5" id="filter-organism"> id="filter-organism"
class="col-md-5"
>
<v-autocomplete <v-autocomplete
:label="`Organismo`" :label="`Organismo`"
:items="centers_name" :items="centers_name"
...@@ -82,11 +96,13 @@ ...@@ -82,11 +96,13 @@
small-chips small-chips
multiple multiple
@change="filterByOrganismos" @change="filterByOrganismos"
/>
></v-autocomplete>
</div> </div>
<div class="col-md-5" id="filter-categorie"> <div
id="filter-categorie"
class="col-md-5"
>
<v-select <v-select
:label="`Categoria`" :label="`Categoria`"
:items="categorias_name" :items="categorias_name"
...@@ -94,10 +110,74 @@ ...@@ -94,10 +110,74 @@
small-chips small-chips
multiple multiple
@change="filterByCategories" @change="filterByCategories"
/>
></v-select>
</div> </div>
</div> </div>
<p
v-if="selected_area.length"
id="selected-area"
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
: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-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"
:key="item.id_area"
:label="item.nombre"
:value="item.id_area"
@change="update_selected_area(item)"
/>
</div>
</v-radio-group>
</v-card-text>
<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>
...@@ -105,370 +185,467 @@ ...@@ -105,370 +185,467 @@
</div> </div>
</template> </template>
<script> <script>
import {getPatients, getPatient, postPatient, deletePatient, putPatient} from '@/axios/patients' import { getPatients, ingresarPacientes } from '@/axios/patients'
import {getCategories, getClasifications} from '@/axios/nomenclators' import { getCategories, getClasifications } from '@/axios/nomenclators'
import {deleteCenter, getCenters} from '@/axios/centers' import { getCenters } from '@/axios/centers'
import {forInRight} from 'lodash'
export default { export default {
// eslint-disabled // eslint-disabled
data() { data () {
return { return {
singleSelect: false, singleSelect: false,
selected: [], selected: [],
headers: [ headers: [
{ {
text: 'Nombre', text: 'Nombre',
align: 'start', align: 'start',
sortable: true, sortable: true,
value: 'nombre', value: 'nombre',
}, },
{text: 'Apellidos', value: 'apellidos'}, { text: 'Apellidos', value: 'apellidos' },
{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,
selectedCenters: [], selectedCenters: [],
headers_cat: [ headers_cat: [
{ {
text: 'Nombre', text: 'Nombre',
align: 'start', align: 'start',
sortable: true, sortable: true,
value: 'nombre_centro', value: 'nombre_centro',
}, },
{text: 'Municipio', value: 'municipio'}, { text: 'Municipio', value: 'municipio' },
{text: 'Organismo', value: 'organismo'}, { text: 'Organismo', value: 'organismo' },
/* { 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: 'clasificacion' }, */
], ],
search: '', search: '',
centers: [], centers: [],
categorias: [], categorias: [],
categorias_name: [], categorias_name: [],
centers_name: [], centers_name: [],
selected_patients: [], selected_patients: [],
selected_centers: [], selected_centers: [],
text_field: "", text_field: '',
} dialog: false,
}, selected_area: '',
created() { selected_area_id: -1,
this.getPatientsData(), }
this.getCentersData(), },
created () {
this.getPatientsData()
this.getCentersData()
this.getCentersCategoriesData() this.getCentersCategoriesData()
}, },
methods: { methods: {
update_selected_patients(values) { async procesar_ingreso () {
console.log("SELECTED ITEMS: entre ", values); if (this.selected_patients.length > 0) {
if (values.value) { const patientsId = []
if (values.items !== undefined) { this.selected_patients.forEach(function (item) {
for (let val of values.items) { patientsId.push(item.id_paciente)
this.selected_patients.push(val); },
)
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 ingresarPacientes(patientsId, this.selected_area_id)
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 { } else {
this.selected_patients.push(values.item); 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,
})
} }
} else { },
if (values.items !== undefined) { update_selected_area (item) {
const neo_selected_list = []; this.selected_area = item.nombre
for (const p of this.selected_patients) { this.selected_area_id = item.id_area
if (p.id_paciente !== val.id_paciente) { console.log('Selected Area: ', this.selected_area)
neo_selected_list.push(values); console.log('Selected Area ID: ', this.selected_area_id)
},
update_selected_patients (values) {
console.log('SELECTED ITEMS: entre ', values)
if (values.value) {
if (values.items !== undefined) {
for (const val of values.items) {
this.selected_patients.push(val)
} }
} else {
this.selected_patients.push(values.item)
} }
this.selected_patients = neo_selected_list;
} else { } else {
const neo_selected_list = []; if (values.items !== undefined) {
for (const p of this.selected_patients) { const neo_selected_list = []
if (p.id_paciente !== values.item.id_paciente) { for (const p of this.selected_patients) {
neo_selected_list.push(values.item); if (p.id_paciente !== val.id_paciente) {
neo_selected_list.push(values)
}
} }
this.selected_patients = neo_selected_list
} else {
const neo_selected_list = []
for (const p of this.selected_patients) {
if (p.id_paciente !== values.item.id_paciente) {
neo_selected_list.push(values.item)
}
}
this.selected_patients = []
this.selected_patients = neo_selected_list
} }
this.selected_patients = [];
this.selected_patients = neo_selected_list;
}
}
console.log("SELECTED ITEMS: ", this.selected_patients);
},
update_selected_center(values) {
console.log("SELECTED ITEMS: entre ", values);
if (values.value) {
if (values.items !== undefined) {
for (let val of values.items) {
this.selected_centers.push(val);
}
} else {
this.selected_centers.push(values.item);
} }
} else { console.log('SELECTED ITEMS: ', this.selected_patients)
if (values.items !== undefined) { },
const neo_selected_list = []; update_selected_center (values) {
for (const p of this.selected_centers) { console.log('SELECTED ITEMS: entre ', values)
if (p.id_centro !== val.id_centro) { if (values.value) {
neo_selected_list.push(values); if (values.items !== undefined) {
for (const val of values.items) {
this.selected_centers.push(val)
} }
} else {
this.selected_centers.push(values.item)
} }
this.selected_centers = neo_selected_list;
} else { } else {
const neo_selected_list = []; if (values.items !== undefined) {
for (const p of this.selected_centers) { const neo_selected_list = []
if (p.id_centro !== values.item.id_centro) { for (const p of this.selected_centers) {
neo_selected_list.push(values.item); if (p.id_centro !== val.id_centro) {
neo_selected_list.push(values)
}
}
this.selected_centers = neo_selected_list
} else {
const neo_selected_list = []
for (const p of this.selected_centers) {
if (p.id_centro !== values.item.id_centro) {
neo_selected_list.push(values.item)
}
} }
this.selected_centers = []
this.selected_centers = neo_selected_list
} }
this.selected_centers = [];
this.selected_centers = neo_selected_list;
} }
} this.selected_area = ''
console.log("SELECTED ITEMS CENTERS: ", this.selected_centers); this.selected_area_id = -1
}, console.log('SELECTED ITEMS CENTERS: ', this.selected_centers)
async filterByOrganismos(val) { },
console.log("VALUE", val); async filterByOrganismos (val) {
await this.getCentersData(); console.log('VALUE', val)
if (val.length > 0) { await this.getCentersData()
const neo_centers = []; if (val.length > 0) {
for (const organismo of val) { const neo_centers = []
for (const cen of this.centers) { for (const organismo of val) {
console.log("CEN org ", this.centers); for (const cen of this.centers) {
if (cen.organismo === organismo) { console.log('CEN org ', this.centers)
neo_centers.push(cen); if (cen.organismo === organismo) {
neo_centers.push(cen)
}
} }
} }
this.centers = neo_centers
console.log('Neo centers', neo_centers)
} }
this.centers = neo_centers; },
console.log("Neo centers", neo_centers); async filterByCategories (val) {
} console.log('VALUE', val)
}, async filterByCategories(val) { await this.getCentersData()
console.log("VALUE", val); if (val.length > 0) {
await this.getCentersData(); const neo_centers = []
if (val.length > 0) { for (const categorie of val) {
const neo_centers = []; for (const cen of this.centers) {
for (const categorie of val) { console.log('CEN CAT ', this.centers)
for (const cen of this.centers) { if (cen.categoria === this.translateCategorie(categorie)) {
console.log("CEN CAT ", this.centers); neo_centers.push(cen)
if (cen.categoria === this.translateCategorie(categorie)) { }
neo_centers.push(cen);
} }
} }
this.centers = neo_centers
console.log('Neo centers', neo_centers)
} }
this.centers = neo_centers; },
console.log("Neo centers", neo_centers); async filterByCategoriesPatients (val) {
} console.log('VALUE', val)
}, await this.getPatientsData()
async filterByCategoriesPatients(val) { if (val.length > 0) {
console.log("VALUE", val); const neo_centers = []
await this.getPatientsData(); for (const categorie of val) {
if (val.length > 0) { for (const cen of this.patients) {
const neo_centers = []; // console.log("CEN CAT ", cen.categoria);
for (const categorie of val) { // console.log("CATEGORIE ", this.translateCategorie(categorie));
for (const cen of this.patients) { if (cen.categoria === categorie) {
// console.log("CEN CAT ", cen.categoria); neo_centers.push(cen)
// console.log("CATEGORIE ", this.translateCategorie(categorie)); }
if (cen.categoria === categorie) {
neo_centers.push(cen);
} }
} }
this.patients = neo_centers
console.log('Neo patients', neo_centers)
} }
this.patients = neo_centers; },
console.log("Neo patients", neo_centers); async getPatientsByName () {
} console.log('VALUE', this.text_field)
}, async getPatientsByName() { // await this.getPatientsData();
console.log("VALUE", this.text_field); await this.getPatientsData()
// await this.getPatientsData(); const neo_centers = []
await this.getPatientsData(); console.log('Patients list size ', this.patients.length)
const neo_centers = []; for (let i = 0; i < this.patients.length; i++) {
console.log("Patients list size ", this.patients.length) const cen = this.patients[i]
for (let i = 0; i < this.patients.length; i++) { console.log('CEN CAT ', cen.id_paciente)
const cen = this.patients[i]; // console.log("CATEGORIE ", this.translateCategorie(categorie));
console.log("CEN CAT ", cen.id_paciente); if (cen.nombre.includes(this.text_field)) {
// console.log("CATEGORIE ", this.translateCategorie(categorie)); neo_centers.push(cen)
if (cen.nombre.includes(this.text_field)) { }
neo_centers.push(cen);
}
}
this.patients = neo_centers;
console.log("Neo patients", neo_centers);
},
translateCategorie(categorie) {
let id = -1;
for (const cat of this.categorias) {
if (cat.nombre === categorie) {
console.log("Cat nombre ", cat.nombre, " categoria ", categorie);
id = cat.id;
} }
} this.patients = neo_centers
return id; console.log('Neo patients', neo_centers)
}, },
async printValue(val) { translateCategorie (categorie) {
console.log("VALUE: ", val); let id = -1
},
async getCentersCategoriesData() {
try {
const catResponse = await getClasifications();
this.categorias = await catResponse.data;
for (const cat of this.categorias) { for (const cat of this.categorias) {
this.categorias_name.push(cat.nombre); if (cat.nombre === categorie) {
console.log('Cat nombre ', cat.nombre, ' categoria ', categorie)
id = cat.id
}
} }
console.log('cent categorias', this.categorias); return id
console.log('categorias name', this.categorias_name); },
} catch (e) { async printValue (val) {
this.$toast.error(e.toString(), { console.log('VALUE: ', val)
position: 'bottom-center', },
timeout: 5000, async getCentersCategoriesData () {
closeOnClick: true, try {
pauseOnFocusLoss: false, const catResponse = await getClasifications()
pauseOnHover: true, this.categorias = await catResponse.data
draggable: true, for (const cat of this.categorias) {
draggablePercent: 0.6, this.categorias_name.push(cat.nombre)
showCloseButtonOnHover: false, }
hideProgressBar: true, console.log('cent categorias', this.categorias)
closeButton: 'button', console.log('categorias name', this.categorias_name)
icon: true, } catch (e) {
rtl: false, this.$toast.error(e.toString(), {
}) position: 'bottom-center',
} timeout: 5000,
}, async getPatientsData() { closeOnClick: true,
try { pauseOnFocusLoss: false,
const patientsResponse = await getPatients() pauseOnHover: true,
this.patients = await patientsResponse.data.pacientes; draggable: true,
await this.getCategoriesData(); draggablePercent: 0.6,
/*let i = 0; showCloseButtonOnHover: false,
for (const p in pacientes) { hideProgressBar: true,
console.log("Entre aqui"); closeButton: 'button',
const p = pacientes[i]; icon: true,
let classification = 'niño' rtl: false,
if(p.embarazada!=0){ })
classification = 'embarazada'; }
} },
if(p.trabajador_salud!=0){ async getPatientsData () {
classification = 'trabajador de la salud'; try {
const patientsResponse = await getPatients()
this.patients = await patientsResponse.data.pacientes
const data = await getClasifications()
const clasications = await data.data
for (let i = 0; i < this.patients.length; i++) {
const patient = this.patients[i]
for (const c of clasications) {
if (c.id === patient.riesgo) {
patient.riesgo = c.nombre
}
} }
p.clasificacion = classification; this.patients[i] = patient
pacientes[i] = p; }
i+=1;
}*/ await this.getCategoriesData()
/* let i = 0;
for (const p in pacientes) {
console.log("Entre aqui");
const p = pacientes[i];
let classification = 'niño'
if(p.embarazada!=0){
classification = 'embarazada';
}
if(p.trabajador_salud!=0){
classification = 'trabajador de la salud';
}
p.clasificacion = classification;
pacientes[i] = p;
i+=1;
} */
// this.patients = pacientes; // this.patients = pacientes;
// console.log('Patientsss', pacientes); // console.log('Patientsss', pacientes);
} catch (e) { } catch (e) {
this.$toast.error(e.toString(), { this.$toast.error(e.toString(), {
position: 'bottom-center', position: 'bottom-center',
timeout: 5000, timeout: 5000,
closeOnClick: true, closeOnClick: true,
pauseOnFocusLoss: false, pauseOnFocusLoss: false,
pauseOnHover: true, pauseOnHover: true,
draggable: true, draggable: true,
draggablePercent: 0.6, draggablePercent: 0.6,
showCloseButtonOnHover: false, showCloseButtonOnHover: false,
hideProgressBar: true, hideProgressBar: true,
closeButton: 'button', closeButton: 'button',
icon: true, icon: true,
rtl: false, rtl: false,
}) })
}
},
async getCategoriesData() {
try {
const categoriesResponse = await getCategories()
const categories = await categoriesResponse.data;
this.categorias = categories;
this.categorias_name = [];
let i = 0;
// console.log("MOCK CAT ", categories);
let has_run = false;
for (const p of this.patients) {
categories.forEach(element => {
if (!has_run) {
this.categorias_name.push(element.nombre);
}
if (element.id == p.categoria) {
p.categoria = element.nombre;
}
});
has_run = true;
this.patients[i] = p;
i += 1;
} }
},
async getCategoriesData () {
try {
const categoriesResponse = await getCategories()
const categories = await categoriesResponse.data
this.categorias = categories
this.categorias_name = []
let i = 0
// console.log("MOCK CAT ", categories);
let has_run = false
for (const p of this.patients) {
categories.forEach(element => {
if (!has_run) {
this.categorias_name.push(element.nombre)
}
if (element.id == p.categoria) {
p.categoria = element.nombre
}
})
has_run = true
this.patients[i] = p
i += 1
}
// this.patients = pacientes; // this.patients = pacientes;
// console.log('Fix patients categorie', pacientes); // console.log('Fix patients categorie', pacientes);
// console.log('categorias_name', this.categorias_name); // console.log('categorias_name', this.categorias_name);
// console.log('categorias', this.categorias); // console.log('categorias', this.categorias);
} catch (e) {
} catch (e) { this.$toast.error(e.toString(), {
this.$toast.error(e.toString(), { position: 'bottom-center',
position: 'bottom-center', timeout: 5000,
timeout: 5000, closeOnClick: true,
closeOnClick: true, pauseOnFocusLoss: false,
pauseOnFocusLoss: false, pauseOnHover: true,
pauseOnHover: true, draggable: true,
draggable: true, draggablePercent: 0.6,
draggablePercent: 0.6, showCloseButtonOnHover: false,
showCloseButtonOnHover: false, hideProgressBar: true,
hideProgressBar: true, closeButton: 'button',
closeButton: 'button', icon: true,
icon: true, rtl: false,
rtl: false, })
})
}
},
async getCentersData(pacientes) {
try {
const centersResponse = await getCenters();
const centers = await centersResponse.data.centros;
let i = 0;
for (const c of centers) {
this.centers_name.push(c.organismo);
} }
this.centers = centers; },
console.log('Centers', centers); async getCentersData (pacientes) {
} catch (e) { try {
this.$toast.error(e.toString(), { const centersResponse = await getCenters()
position: 'bottom-center', const centers = await centersResponse.data.centros
timeout: 5000, const i = 0
closeOnClick: true, for (const c of centers) {
pauseOnFocusLoss: false, this.centers_name.push(c.organismo)
pauseOnHover: true, }
draggable: true, this.centers = centers
draggablePercent: 0.6, console.log('Centers', centers)
showCloseButtonOnHover: false, } catch (e) {
hideProgressBar: true, this.$toast.error(e.toString(), {
closeButton: 'button', position: 'bottom-center',
icon: true, timeout: 5000,
rtl: false, closeOnClick: true,
}) pauseOnFocusLoss: false,
} pauseOnHover: true,
draggable: true,
draggablePercent: 0.6,
showCloseButtonOnHover: false,
hideProgressBar: true,
closeButton: 'button',
icon: true,
rtl: false,
})
}
},
async addPatients () {
try {
console.log('Selected Patients', this.selected_patients)
console.log('Selected Centers', this.selected_centers)
} 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,
})
}
},
}, },
async addPatients() { }
try {
console.log("Selected Patients", this.selected_patients);
console.log("Selected Centers", this.selected_centers);
} 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>
<style> <style>
#centers-table { #centers-table {
...@@ -479,7 +656,7 @@ export default { ...@@ -479,7 +656,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>
<base-section
id="map"
space="0"
>
<iframe
allowfullscreen
aria-hidden="false"
frameborder="0"
height="500"
src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d214634.84395433197!2d-97.42974387625868!3d32.801023187219684!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x864e6e122dc807ad%3A0xa4af8bf8dd69acbd!2sFort%20Worth%2C%20TX!5e0!3m2!1sen!2sus!4v1584734211438!5m2!1sen!2sus"
style="border:0; display: block;"
tabindex="0"
width="100%"
/>
</base-section>
</template>
<script>
export default {
name: 'SectionMap',
provide: {
heading: { align: 'center' },
},
}
</script>
...@@ -8,14 +8,17 @@ ...@@ -8,14 +8,17 @@
style="margin-left: 8px" style="margin-left: 8px"
/> />
<v-spacer /> <v-spacer />
<v-btn <router-link :to="{name: 'Asignar'}">
text <v-btn
color="info" text
class="toolbar-btn" color="info"
dark class="toolbar-btn"
> dark
<v-icon>mdi-hospital-building</v-icon> Asignar Pacientes >
</v-btn> <v-icon>mdi-hospital-building</v-icon> Asignar Pacientes
</v-btn>
</router-link>
<v-dialog <v-dialog
v-model="dialog" v-model="dialog"
max-width="800px" max-width="800px"
...@@ -109,7 +112,7 @@ ...@@ -109,7 +112,7 @@
color="info" color="info"
v-bind="attrs" v-bind="attrs"
v-on="on" v-on="on"
@click="detailsItem(item)" @click="detailsItem(item.id_paciente)"
> >
mdi-dots-horizontal-circle mdi-dots-horizontal-circle
</v-icon> </v-icon>
...@@ -285,7 +288,7 @@ ...@@ -285,7 +288,7 @@
}), }),
computed: { computed: {
...mapGetters(['pIndex', 'patient', 'filters', 'editFromFile']), ...mapGetters(['pIndex', 'patient', 'filters', 'editFromFile', 'patientId']),
provinces () { provinces () {
return this.$store.getters.provinces return this.$store.getters.provinces
}, },
...@@ -311,8 +314,13 @@ ...@@ -311,8 +314,13 @@
...mapMutations(['setPIndex', 'setPatient', 'clearPatient', 'setFiltersPage', 'setFilterStatus']), ...mapMutations(['setPIndex', 'setPatient', 'clearPatient', 'setFiltersPage', 'setFilterStatus']),
showMe () { showMe () {
}, },
async admit (item) {
const response = await getPatient(item.id_paciente)
this.setPatient(response.data.paciente)
this.$router.push({ name: 'Confirmar' })
},
canConfirm (item) { canConfirm (item) {
if (item.area_nombre !== null && item.area_nombre !== '' && item.centro_nombre !== null && item.centro_nombre !== '' && localStorage.getItem('CA')) { if ((item.id_asignado && localStorage.getItem('role') === 'CA') || localStorage.getItem('role') === 'SADM') {
return true return true
} }
return false return false
...@@ -376,12 +384,12 @@ ...@@ -376,12 +384,12 @@
this.closeDetails() this.closeDetails()
this.editItem(this.patient) this.editItem(this.patient)
}, },
async detailsItem (item) { async detailsItem (id) {
this.loadingPatientData = true this.loadingPatientData = true
try { try {
const patientResponse = await getPatient(item.id_paciente) const patientResponse = await getPatient(id)
this.setPatient(patientResponse.data.paciente) this.setPatient(patientResponse.data.paciente)
this.setPIndex(this.patients.indexOf(item)) this.setPIndex(1)
this.infoPatient = true this.infoPatient = true
} catch (e) { } catch (e) {
errorHandler(e) errorHandler(e)
...@@ -506,13 +514,14 @@ ...@@ -506,13 +514,14 @@
}, },
closeSaved () { closeSaved () {
this.dialog = false this.dialog = false
this.$nextTick(() => { this.$nextTick(() => {
this.clearPatient() this.clearPatient()
this.setPIndex(-1) this.setPIndex(-1)
}) })
this.loadPatientsData() this.loadPatientsData()
if (this.patientId !== -1) {
this.detailsItem(this.patientId)
}
}, },
close () { close () {
this.dialog = false this.dialog = false
......