Initial import
This commit is contained in:
234
one-ui/test_x_old/vuex/one-md-patient/api/patient.js
Normal file
234
one-ui/test_x_old/vuex/one-md-patient/api/patient.js
Normal file
@@ -0,0 +1,234 @@
|
||||
const URL = "/one-api/mockup/masterdata/";
|
||||
|
||||
export async function search(token, name, snorm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'patient/search', {
|
||||
token:token,
|
||||
nama: name,
|
||||
snorm: snorm
|
||||
});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getsexreg(token) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'patient/getsexreg',{token:token});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function save(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'patient/save',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function newpatient(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'patient/newpatient',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function xdelete(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'patient/deletepatient',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getaddress(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'patient/getaddress',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function searchcity(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'patient/searchcity',{token:token,search:prm});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch(e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getdistrict(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'patient/getdistrict',{id:prm.M_CityID,token:token});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch(e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getkelurahan(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'patient/getkelurahan',{token:token,id:prm.M_DistrictID});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch(e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function savenewaddress(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'patient/savenewaddress',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveeditaddress(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'patient/saveeditaddress',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteaddress(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'patient/deleteaddress',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,397 @@
|
||||
<template>
|
||||
<v-layout v-if="xact !== 'new'" column >
|
||||
<v-dialog v-model="dialogconfirmationdeleteaddr" persistent max-width="290">
|
||||
<v-card>
|
||||
<v-card-title
|
||||
dark
|
||||
class="headline error pt-2 pb-2"
|
||||
primary-title
|
||||
style="color:white"
|
||||
>
|
||||
<h4 dark>Konfirmasi</h4>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
{{msgconfirmationdeleteaddr}}
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn small v-if="!checkError('deleteutama')" color="error darken-1 text-sm-left" flat @click="doDeleteAddr()">Hapus</v-btn>
|
||||
<v-btn small color="primary darken-1 text-sm-right" flat @click="dialogconfirmationdeleteaddr = false">Batal</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogformaddress" persistent max-width="650">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="headline">Form Alamat Pasien</span>
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-layout wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="labeladdress" label="Label"></v-text-field>
|
||||
<p v-if="checkError('requiredlabel')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
|
||||
<p v-if="checkError('readonlyutama')" class="error pl-2 pr-2" style="color:#fff">Biarkan jadi yang utama</p>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-layout row>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-autocomplete
|
||||
label="Kota"
|
||||
v-model="cityaddress"
|
||||
:items="xcities"
|
||||
:search-input.sync="search_city"
|
||||
auto-select-first
|
||||
no-filter
|
||||
item-text="M_CityName"
|
||||
return-object
|
||||
:loading="isLoading"
|
||||
no-data-text="Pilih Kota"
|
||||
>
|
||||
<template
|
||||
slot="item"
|
||||
slot-scope="{ item }"
|
||||
>
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title v-text="item.M_CityName"></v-list-tile-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
<p v-if="checkError('requiredcity')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
|
||||
</v-flex>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-select
|
||||
item-text="M_DistrictName"
|
||||
return-object
|
||||
:items="xdistricts"
|
||||
v-model="districtaddress"
|
||||
label="Kecamatan*"
|
||||
></v-select>
|
||||
<p v-if="checkError('requireddistrict')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
|
||||
</v-flex>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-select
|
||||
item-text="M_KelurahanName"
|
||||
return-object
|
||||
:items="xkelurahans"
|
||||
v-model="kelurahanaddress"
|
||||
label="Kelurahan / Desa*"
|
||||
></v-select>
|
||||
<p v-if="checkError('requiredkelurahan')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-textarea
|
||||
box
|
||||
label="Alamat Lengkap"
|
||||
v-model="descriptionaddress"
|
||||
></v-textarea>
|
||||
<p v-if="checkError('requireddescription')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
|
||||
</v-flex>
|
||||
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="blue darken-1" flat @click="dialogformaddress = false">Tutup</v-btn>
|
||||
<v-btn v-if="xactaddr === 'new'" color="blue darken-1" flat @click="saveNewAddress()">Simpan</v-btn>
|
||||
<v-btn v-if="xactaddr === 'edit'" color="blue darken-1" flat @click="saveEditAddress()">Simpan</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-card>
|
||||
<v-layout row>
|
||||
<v-flex xs12>
|
||||
<v-subheader red--text text--lighten-1> ALAMAT PASIEN
|
||||
<v-flex text-md-right>
|
||||
<v-btn @click="createNewAddress()" small color="info">Baru</v-btn>
|
||||
</v-flex>
|
||||
</v-subheader>
|
||||
<v-divider></v-divider>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12 pa-2>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="xaddresses"
|
||||
:loading="isLoading"
|
||||
hide-actions class="elevation-1">
|
||||
<template slot="items" slot-scope="props">
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-icon color="error" @click="deleteAddress(props.item)">delete</v-icon>
|
||||
<v-icon class="ml-3" color="primary" @click="editAddress(props.item)">edit</v-icon>
|
||||
</td>
|
||||
<td class="text-xs-left pa-2">{{ props.item.M_PatientAddressNote}}</td>
|
||||
<td class="text-xs-left pa-2">{{ props.item.M_PatientAddressDescription}}</td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-flex>
|
||||
</v-card>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data: () => ({
|
||||
search_city:'',
|
||||
oldlabel:'',
|
||||
headers: [
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "action",
|
||||
width: "10%",
|
||||
class: "pa-1 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "LABEL",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "20%",
|
||||
class: "pa-1 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "ALAMAT",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "40%",
|
||||
class: "pa-1 blue lighten-3 white--text"
|
||||
}
|
||||
]
|
||||
}),
|
||||
computed: {
|
||||
dialogconfirmationdeleteaddr:{
|
||||
get() {
|
||||
return this.$store.state.patient.dialog_confirmation_delete_addr
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_dialog_confirmation_delete_addr",val)
|
||||
}
|
||||
},
|
||||
msgconfirmationdeleteaddr(){
|
||||
return this.$store.state.patient.msg_confirmation_delete_addr
|
||||
},
|
||||
xact() {
|
||||
return this.$store.state.patient.act
|
||||
},
|
||||
xactaddr() {
|
||||
return this.$store.state.patient.act_addr
|
||||
},
|
||||
dialogformaddress:{
|
||||
get() {
|
||||
return this.$store.state.patient.dialog_form_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_dialog_form_address",val)
|
||||
}
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.patient.search_status == 1
|
||||
},
|
||||
xaddresses(p) {
|
||||
return this.$store.state.patient.addresses
|
||||
},
|
||||
xcities(){
|
||||
return this.$store.state.patient.cities
|
||||
},
|
||||
labeladdress:{
|
||||
get() {
|
||||
return this.$store.state.patient.label_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_label_address",val)
|
||||
}
|
||||
},
|
||||
cityaddress:{
|
||||
get() {
|
||||
return this.$store.state.patient.city_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_city_address",val)
|
||||
this.$store.dispatch("patient/getdistrict",this.$store.state.patient.city_address)
|
||||
}
|
||||
},
|
||||
xdistricts(){
|
||||
return this.$store.state.patient.districts
|
||||
},
|
||||
districtaddress:{
|
||||
get() {
|
||||
return this.$store.state.patient.district_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_district_address",val)
|
||||
this.$store.dispatch("patient/getkelurahan",this.$store.state.patient.district_address)
|
||||
}
|
||||
},
|
||||
xkelurahans(){
|
||||
return this.$store.state.patient.kelurahans
|
||||
},
|
||||
kelurahanaddress:{
|
||||
get() {
|
||||
return this.$store.state.patient.kelurahan_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_kelurahan_address",val)
|
||||
}
|
||||
},
|
||||
descriptionaddress:{
|
||||
get() {
|
||||
return this.$store.state.patient.description_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_description_address",val)
|
||||
}
|
||||
},
|
||||
},
|
||||
methods : {
|
||||
createNewAddress(){
|
||||
this.$store.commit("patient/update_act_addr",'new')
|
||||
this.search_city = ''
|
||||
this.labeladdress = ''
|
||||
this.$store.commit("patient/update_cities",[])
|
||||
this.cityaddress = {}
|
||||
this.$store.commit("patient/update_districts",[])
|
||||
this.districtaddress = {}
|
||||
this.$store.commit("patient/update_kelurahans",[])
|
||||
this.kelurahanaddress = {}
|
||||
this.descriptionaddress = ''
|
||||
this.$store.commit("patient/update_dialog_form_address",true)
|
||||
},
|
||||
thr_search_city: _.debounce( function () {
|
||||
this.$store.dispatch("patient/searchcity",this.search_city)
|
||||
},2000),
|
||||
checkError(value){
|
||||
var errors = this.$store.state.patient.errors
|
||||
if(errors.includes(value)){
|
||||
return true
|
||||
}
|
||||
else{
|
||||
return false
|
||||
}
|
||||
},
|
||||
saveNewAddress(){
|
||||
this.$store.commit("patient/update_errors",[])
|
||||
var errors = this.$store.state.patient.errors
|
||||
if(this.labeladdress === ''){
|
||||
errors.push("requiredlabel")
|
||||
}
|
||||
if(_.isEmpty(this.cityaddress)){
|
||||
errors.push("requiredcity")
|
||||
}
|
||||
if(_.isEmpty(this.districtaddress)){
|
||||
errors.push("requireddistrict")
|
||||
}
|
||||
if(_.isEmpty(this.kelurahanaddress)){
|
||||
errors.push("requiredkelurahan")
|
||||
}
|
||||
if(_.isEmpty(this.descriptionaddress)){
|
||||
errors.push("requireddescription")
|
||||
}
|
||||
|
||||
if(errors.length === 0){
|
||||
var prm = {}
|
||||
prm.M_PatientAddressM_PatientID = this.$store.state.patient.selected_patient.M_PatientID
|
||||
prm.M_PatientName = this.$store.state.patient.selected_patient.M_PatientName
|
||||
prm.M_PatientAddressNote = this.labeladdress
|
||||
prm.M_PatientAddressDescription = this.descriptionaddress
|
||||
prm.M_PatientAddressM_KelurahanID = this.kelurahanaddress.M_KelurahanID
|
||||
this.$store.dispatch("patient/savenewaddress",prm)
|
||||
}
|
||||
},
|
||||
editAddress(value){
|
||||
this.$store.commit("patient/update_act_addr",'edit')
|
||||
this.$store.commit("patient/update_x_addr_id",value.M_PatientAddressID)
|
||||
this.labeladdress = value.M_PatientAddressNote
|
||||
this.oldlabel = value.M_PatientAddressNote
|
||||
this.$store.commit("patient/update_cities",[{M_CityID:value.M_CityID,M_CityName:value.M_CityName}])
|
||||
this.cityaddress = {M_CityID:value.M_CityID,M_CityName:value.M_CityName}
|
||||
this.$store.commit("patient/update_districts",[{M_DistrictID:value.M_DistrictID,M_DistrictName:value.M_DistrictName}])
|
||||
this.districtaddress = {M_DistrictID:value.M_DistrictID,M_DistrictName:value.M_DistrictName}
|
||||
this.$store.commit("patient/update_kelurahans",[{M_KelurahanID:value.M_PatientAddressM_KelurahanID,M_KelurahanName:value.M_KelurahanName}])
|
||||
this.kelurahanaddress = {M_KelurahanID:value.M_PatientAddressM_KelurahanID,M_KelurahanName:value.M_KelurahanName}
|
||||
this.descriptionaddress = value.M_PatientAddressDescription
|
||||
this.$store.commit("patient/update_dialog_form_address",true)
|
||||
},
|
||||
saveEditAddress(){
|
||||
this.$store.commit("patient/update_errors",[])
|
||||
var errors = this.$store.state.patient.errors
|
||||
if(this.labeladdress === ''){
|
||||
errors.push("requiredlabel")
|
||||
}
|
||||
if(this.oldlabel.toLowerCase() === 'utama' && this.labeladdress.toLowerCase() !== 'utama'){
|
||||
errors.push("readonlyutama")
|
||||
}
|
||||
if(_.isEmpty(this.cityaddress)){
|
||||
errors.push("requiredcity")
|
||||
}
|
||||
if(_.isEmpty(this.districtaddress)){
|
||||
errors.push("requireddistrict")
|
||||
}
|
||||
if(_.isEmpty(this.kelurahanaddress)){
|
||||
errors.push("requiredkelurahan")
|
||||
}
|
||||
if(_.isEmpty(this.descriptionaddress)){
|
||||
errors.push("requireddescription")
|
||||
}
|
||||
|
||||
if(errors.length === 0){
|
||||
var prm = {}
|
||||
prm.M_PatientAddressID = this.$store.state.patient.x_addr_id
|
||||
prm.M_PatientAddressM_PatientID = this.$store.state.patient.selected_patient.M_PatientID
|
||||
prm.M_PatientName = this.$store.state.patient.selected_patient.M_PatientName
|
||||
prm.M_PatientAddressNote = this.labeladdress
|
||||
prm.M_PatientAddressDescription = this.descriptionaddress
|
||||
prm.M_PatientAddressM_KelurahanID = this.kelurahanaddress.M_KelurahanID
|
||||
this.$store.dispatch("patient/saveeditaddress",prm)
|
||||
}
|
||||
},
|
||||
deleteAddress(value){
|
||||
this.$store.commit("patient/update_act_addr",'delete')
|
||||
this.$store.commit("patient/update_x_addr_id",value.M_PatientAddressID)
|
||||
this.$store.commit("patient/update_errors",[])
|
||||
this.oldlabel = value.M_PatientAddressNote
|
||||
var errors = this.$store.state.patient.errors
|
||||
if(value.M_PatientAddressNote.toLowerCase() === 'utama'){
|
||||
errors.push("deleteutama")
|
||||
}
|
||||
var msg = ''
|
||||
if(errors.includes("deleteutama")){
|
||||
msg = "Biarkan yang utama tetap ada"
|
||||
}
|
||||
else{
|
||||
msg = "Yakin, akan menghapus data alamat pasien "+value.M_PatientAddressNote+" ?"
|
||||
}
|
||||
|
||||
this.$store.commit("patient/update_msg_confirmation_delete_addr",msg)
|
||||
this.$store.commit("patient/update_dialog_confirmation_delete_addr",true)
|
||||
},
|
||||
doDeleteAddr(){
|
||||
var prm = {}
|
||||
prm.M_PatientAddressID = this.$store.state.patient.x_addr_id
|
||||
prm.M_PatientAddressM_PatientID = this.$store.state.patient.selected_patient.M_PatientID
|
||||
prm.M_PatientName = this.$store.state.patient.selected_patient.M_PatientName
|
||||
prm.M_PatientAddressNote = this.oldlabel
|
||||
this.$store.dispatch("patient/deleteaddress",prm)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
search_city(val,old) {
|
||||
if (val == old ) return
|
||||
if (! val) return
|
||||
if (val.length < 1 ) return
|
||||
if (this.$store.state.patient.update_autocomplete_status == 1 ) return
|
||||
this.thr_search_city()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,410 @@
|
||||
<template>
|
||||
<v-layout class="mb-2" column>
|
||||
<v-dialog v-model="dialogconfirmationdelete" persistent max-width="290">
|
||||
<v-card>
|
||||
<v-card-title dark class="headline error pt-2 pb-2" primary-title style="color:white">
|
||||
<h4 dark>Konfirmasi</h4>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
{{msgconfirmationdelete}}
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn small color="error darken-1 text-sm-left" flat @click="doDeleteData()">Hapus</v-btn>
|
||||
<v-btn small color="primary darken-1 text-sm-right" flat @click="dialogconfirmationdelete = false">Batal</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-card>
|
||||
<v-layout row>
|
||||
<v-flex xs12>
|
||||
<v-subheader red--text text--lighten-1> DETAIL PASIEN
|
||||
<v-flex text-md-right>
|
||||
<v-btn v-if="xact === 'new'" @click="saveNewPatient()" small color="info">Simpan</v-btn>
|
||||
<v-btn v-if="xact === 'edit'" @click="deleteData()" small color="error">Hapus</v-btn>
|
||||
<v-btn v-if="xact === 'edit'" @click="saveData()" small color="primary">Simpan</v-btn>
|
||||
</v-flex>
|
||||
</v-subheader>
|
||||
<v-divider></v-divider>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12 pa-2>
|
||||
<v-layout row>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-select item-text="M_TitleName" return-object :items="xtitles" v-model="xtitle" label="Panggilan*" hide-details></v-select>
|
||||
<p v-if="checkError('requiretitle')" class="error pl-2 pr-2" style="color:#fff">Panggilan harus diisi dong</p>
|
||||
</v-flex>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-text-field v-model="xpatientname" label="Nama Pasien*" hide-details></v-text-field>
|
||||
<p v-if="checkError('requirename')" class="error pl-2 pr-2" style="color:#fff">Nama harus diisi dong</p>
|
||||
</v-flex>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-text-field readonly v-model="xnorm" label="PID" hide-details></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs3 pa-1>
|
||||
<v-text-field v-model="xpob" label="Tempat Lahir" hide-details></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs3 pa-1>
|
||||
<v-text-field v-model="xdob" label="Tanggal Lahir*" hint="format : DD-MM-YYYY , contoh : 22-06-1988"></v-text-field>
|
||||
<p v-if="checkError('requiredob')" class="error pl-2 pr-2" style="color:#fff">Tanggal lahir harus diisi dong</p>
|
||||
<p v-if="checkError('wrongformatdob')" class="error pt-1 pl-2 pr-2" style="color:#fff">format nya belum benar : dd-mm-yyy , OK ?</p>
|
||||
</v-flex>
|
||||
<v-flex xs3 pa-1>
|
||||
<v-select item-text="m_sexname" return-object :items="xsexes" v-model="xsex" label="Jenis Kelamin*" hide-details></v-select>
|
||||
<p v-if="checkError('requiresex')" class="error pl-2 pr-2" style="color:#fff">Jenis kelamin harus diisi dong</p>
|
||||
</v-flex>
|
||||
<v-flex xs3 pa-1>
|
||||
<v-select item-text="M_ReligionName" return-object :items="xreligions" v-model="xreligion" label="Agama" hide-details></v-select>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-text-field v-model="xphone" label="Telepon" hide-details></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-text-field v-model="xhp" label="HP" hide-details></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-text-field v-model="xemail" label="Email" hide-details></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-select item-text="M_IdTypeName" return-object :items="xkartuidentitass" v-model="xkartuidentitas" label="Kartu Identitas" hide-details></v-select>
|
||||
</v-flex>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-text-field v-model="xnoidentitas" label="No Identitas" hide-details></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-text-field v-model="xnote" label="Catatan" hide-details></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-flex>
|
||||
</v-card>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
table,
|
||||
td,
|
||||
th {
|
||||
border: 1px solid #ddd;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 8px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.mini-input .v-input {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
.mini-input .v-input,
|
||||
.mini-input .v-input--selection-controls,
|
||||
.mini-input .v-input__slot {
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.mini-input .v-messages {
|
||||
min-height: 0px;
|
||||
}
|
||||
|
||||
input.fhm-input {
|
||||
border: 1px solid black;
|
||||
border-radius: 2px;
|
||||
-webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1),
|
||||
0 0 4px rgba(0, 0, 0, 0.1);
|
||||
-moz-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1),
|
||||
0 0 4px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1),
|
||||
0 0 4px rgba(0, 0, 0, 0.1);
|
||||
padding: 2px 4px;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
margin: 0 0 1px 0;
|
||||
width: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data: () => ({
|
||||
|
||||
}),
|
||||
computed: {
|
||||
dialogconfirmationdelete: {
|
||||
get() {
|
||||
return this.$store.state.patient.dialog_confirmation_delete
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_dialog_confirmation_delete", val)
|
||||
}
|
||||
},
|
||||
msgconfirmationdelete() {
|
||||
return this.$store.state.patient.msg_confirmation_delete
|
||||
},
|
||||
xact() {
|
||||
return this.$store.state.patient.act
|
||||
},
|
||||
detail() {
|
||||
return this.$store.state.patient.selected_patient
|
||||
},
|
||||
xtitles () {
|
||||
return this.$store.state.patient.titles
|
||||
},
|
||||
xtitle: {
|
||||
get() {
|
||||
return this.$store.state.patient.selected_title
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_selected_title", val)
|
||||
this.$store.commit("patient/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xpatientname: {
|
||||
get() {
|
||||
return this.$store.state.patient.patient_name
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_patient_name", val)
|
||||
this.$store.commit("patient/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xnorm: {
|
||||
get() {
|
||||
return this.$store.state.patient.norm
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_norm", val)
|
||||
this.$store.commit("patient/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xdob: {
|
||||
get() {
|
||||
return this.$store.state.patient.dob
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_errors",[])
|
||||
var errors = this.$store.state.patient.errors
|
||||
var aDOB = moment(val, 'DD-MM-YYYY', true)
|
||||
var isValidDOB = aDOB.isValid()
|
||||
if(!isValidDOB){
|
||||
errors.push("wrongformatdob")
|
||||
}
|
||||
|
||||
this.$store.commit("patient/update_dob", val)
|
||||
this.$store.commit("patient/update_no_save", 1)
|
||||
|
||||
}
|
||||
},
|
||||
xsexes() {
|
||||
return this.$store.state.patient.sexes
|
||||
},
|
||||
xsex: {
|
||||
get() {
|
||||
return this.$store.state.patient.selected_sex
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_selected_sex", val)
|
||||
this.$store.commit("patient/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xreligions() {
|
||||
return this.$store.state.patient.religions
|
||||
},
|
||||
xreligion: {
|
||||
get() {
|
||||
return this.$store.state.patient.selected_religion
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_selected_religion", val)
|
||||
this.$store.commit("patient/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xphone: {
|
||||
get() {
|
||||
return this.$store.state.patient.phone
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_phone", val)
|
||||
this.$store.commit("patient/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xhp: {
|
||||
get() {
|
||||
return this.$store.state.patient.hp
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_hp", val)
|
||||
this.$store.commit("patient/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xemail: {
|
||||
get() {
|
||||
return this.$store.state.patient.email
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_email", val)
|
||||
this.$store.commit("patient/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xpob: {
|
||||
get() {
|
||||
return this.$store.state.patient.pob
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_pob", val)
|
||||
this.$store.commit("patient/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xkartuidentitass() {
|
||||
return this.$store.state.patient.kartuidentitass
|
||||
},
|
||||
xkartuidentitas: {
|
||||
get() {
|
||||
return this.$store.state.patient.selected_kartuidentitas
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_selected_kartuidentitas", val)
|
||||
this.$store.commit("patient/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xnoidentitas: {
|
||||
get() {
|
||||
return this.$store.state.patient.noidentitas
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_noidentitas", val)
|
||||
this.$store.commit("patient/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
xnote: {
|
||||
get() {
|
||||
return this.$store.state.patient.note
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_note", val)
|
||||
this.$store.commit("patient/update_no_save", 1)
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
checkError(value){
|
||||
var errors = this.$store.state.patient.errors
|
||||
if(errors.includes(value)){
|
||||
return true
|
||||
}
|
||||
else{
|
||||
return false
|
||||
}
|
||||
},
|
||||
saveData() {
|
||||
this.$store.commit("patient/update_errors",[])
|
||||
var errors = this.$store.state.patient.errors
|
||||
var aDOB = moment(this.xdob, 'DD-MM-YYYY', true)
|
||||
console.log(this.xdob)
|
||||
console.log(aDOB)
|
||||
var isValidDOB = aDOB.isValid()
|
||||
if(!isValidDOB){
|
||||
errors.push("wrongformatdob")
|
||||
}
|
||||
if(this.xpatientname === ''){
|
||||
errors.push("requirename")
|
||||
}
|
||||
if(this.xdob === ''){
|
||||
errors.push("requiredob")
|
||||
}
|
||||
if(_.isEmpty(this.xsex)){
|
||||
errors.push("requiresex")
|
||||
}
|
||||
if(_.isEmpty(this.xtitle)){
|
||||
errors.push("requiretitle")
|
||||
}
|
||||
if(errors.length === 0){
|
||||
var prm = {}
|
||||
prm.M_PatientID = this.$store.state.patient.selected_patient.M_PatientID
|
||||
prm.M_PatientM_TitleID = this.$store.state.patient.selected_title.M_TitleID
|
||||
prm.M_PatientName = this.xpatientname
|
||||
prm.M_PatientDOB = this.xdob
|
||||
prm.M_PatientM_SexID = this.$store.state.patient.selected_sex.M_SexID
|
||||
prm.M_PatientM_ReligionID = this.$store.state.patient.selected_religion.M_ReligionID
|
||||
prm.M_PatientEmail = this.xemail
|
||||
prm.M_PatientPOB = this.xpob
|
||||
prm.M_PatientHP = this.xhp
|
||||
prm.M_PatientPhone = this.xphone
|
||||
prm.M_PatientM_IdTypeID = this.$store.state.patient.selected_kartuidentitas.M_IdTypeID
|
||||
prm.M_PatientIDNumber = this.xnoidentitas
|
||||
prm.M_PatientNote = this.xnote
|
||||
this.$store.dispatch("patient/save", prm)
|
||||
}
|
||||
},
|
||||
saveNewPatient() {
|
||||
this.$store.commit("patient/update_errors",[])
|
||||
var errors = this.$store.state.patient.errors
|
||||
var aDOB = moment(this.xdob, 'DD-MM-YYYY', true)
|
||||
console.log(this.xdob)
|
||||
console.log(aDOB)
|
||||
var isValidDOB = aDOB.isValid()
|
||||
if(!isValidDOB){
|
||||
errors.push("wrongformatdob")
|
||||
}
|
||||
if(this.xpatientname === ''){
|
||||
errors.push("requirename")
|
||||
}
|
||||
if(this.xdob === ''){
|
||||
errors.push("requiredob")
|
||||
}
|
||||
if(_.isEmpty(this.xsex)){
|
||||
errors.push("requiresex")
|
||||
}
|
||||
if(_.isEmpty(this.xtitle)){
|
||||
errors.push("requiretitle")
|
||||
}
|
||||
if(errors.length === 0){
|
||||
var prm = {}
|
||||
prm.M_PatientID = 0
|
||||
prm.M_PatientM_TitleID = this.$store.state.patient.selected_title.M_TitleID
|
||||
prm.M_PatientName = this.xpatientname
|
||||
prm.M_PatientDOB = this.xdob
|
||||
prm.M_PatientM_SexID = this.$store.state.patient.selected_sex.M_SexID
|
||||
prm.M_PatientM_ReligionID = this.$store.state.patient.selected_religion.M_ReligionID
|
||||
prm.M_PatientEmail = this.xemail
|
||||
prm.M_PatientPOB = this.xpob
|
||||
prm.M_PatientHP = this.xhp
|
||||
prm.M_PatientPhone = this.xphone
|
||||
prm.M_PatientM_IdTypeID = this.$store.state.patient.selected_kartuidentitas.M_IdTypeID
|
||||
prm.M_PatientIDNumber = this.xnoidentitas
|
||||
prm.M_PatientNote = this.xnote
|
||||
this.$store.dispatch("patient/newpatient", prm)
|
||||
}
|
||||
},
|
||||
deleteData() {
|
||||
let msg = "Yakin, akan menghapus data pasien " + this.xpatientname + " ?"
|
||||
this.$store.commit("patient/update_msg_confirmation_delete", msg)
|
||||
this.$store.commit("patient/update_dialog_confirmation_delete", true)
|
||||
},
|
||||
doDeleteData() {
|
||||
var prm = {}
|
||||
prm.M_PatientID = this.$store.state.patient.selected_patient.M_PatientID
|
||||
prm.M_PatientName = this.xpatientname
|
||||
this.$store.dispatch("patient/delete", prm)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,256 @@
|
||||
<template>
|
||||
<v-layout class="fill-height" column>
|
||||
<v-dialog v-model="dialogsuccess" persistent max-width="290">
|
||||
<v-card>
|
||||
<v-card-title color="success" class="headline">Berhasil !</v-card-title>
|
||||
<v-card-text>
|
||||
{{msgsuccess}}
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="green darken-1" flat @click="closeDialogSuccess">OK</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-card class="mb-2 pa-2 searchbox">
|
||||
<v-layout>
|
||||
<v-text-field class="xs6 ma-1" label="PID" outline @keyup.enter="searchPatient" v-model="snorm" hide-details></v-text-field>
|
||||
<v-text-field class="xs6 ma-1" label="Nama" outline @keyup.enter="searchPatient" v-model="name" hide-details></v-text-field>
|
||||
|
||||
<!-- <span @click="searchPatient" class="icon-medium-fill-base xs1 white--text success iconsearch-search"></span>-->
|
||||
<span @click="setNewPatient" class="icon-medium-fill-base xs1 white--text primary ml-1 icon-add"></span>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<v-card>
|
||||
<v-layout row>
|
||||
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
||||
<v-data-table :headers="headers" :items="patients" :loading="isLoading" :pagination.sync="pagination" class="elevation-1">
|
||||
<template slot="items" slot-scope="props">
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.M_PatientNoReg}}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.M_PatientName}}</td>
|
||||
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.M_PatientHP}}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.M_SexName}}</td>
|
||||
</template>
|
||||
<template>
|
||||
<div class="text-xs-center">
|
||||
<v-pagination v-model="page" :length="15" :total-visible="7"></v-pagination>
|
||||
</div>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<one-dialog-alert :status="openalertconfirmation" :msg="msgalertconfirmation" @forget-dialog-alert="forgetAlertConfirmation()"
|
||||
@close-dialog-alert="closeAlertConfirmation()"></one-dialog-alert>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.searchbox .v-input.v-text-field .v-input__slot {
|
||||
min-height: 60px;
|
||||
}
|
||||
|
||||
.searchbox .v-btn {
|
||||
min-height: 60px;
|
||||
}
|
||||
|
||||
table.v-table tbody td,
|
||||
table.v-table tbody th {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
table.v-table thead tr {
|
||||
height: 40px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {
|
||||
'one-dialog-info': httpVueLoader('../../common/oneDialogInfo.vue'),
|
||||
'one-dialog-alert': httpVueLoader('../../common/oneDialogAlert.vue')
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("patient/getsexreg")
|
||||
this.$store.dispatch("patient/search", {
|
||||
name: this.name,
|
||||
snorm: this.snorm,
|
||||
lastid: -1
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
isSelected(p) {
|
||||
return p.M_PatientID == this.$store.state.patient.selected_patient.M_PatientID
|
||||
},
|
||||
searchPatient() {
|
||||
this.$store.dispatch("patient/search", {
|
||||
name: this.name,
|
||||
snorm: this.snorm,
|
||||
lastid: -1
|
||||
})
|
||||
},
|
||||
selectMe(pat) {
|
||||
if (this.$store.state.patient.no_save == 0) {
|
||||
this.$store.commit("patient/update_selected_patient", pat)
|
||||
this.$store.commit("patient/update_norm", pat.M_PatientNoReg)
|
||||
this.$store.commit("patient/update_patient_name", pat.M_PatientName)
|
||||
this.$store.commit("patient/update_selected_title", {
|
||||
M_TitleID: pat.M_PatientM_TitleID,
|
||||
M_TitleName: pat.M_TitleName
|
||||
})
|
||||
this.$store.commit("patient/update_selected_sex", {
|
||||
M_SexID: pat.M_PatientM_SexID,
|
||||
m_sexname: pat.M_SexName
|
||||
})
|
||||
this.$store.commit("patient/update_selected_religion", {
|
||||
M_ReligionID: pat.M_PatientM_ReligionID,
|
||||
M_ReligionName: pat.M_ReligionName
|
||||
})
|
||||
this.$store.commit("patient/update_dob", pat.M_PatientDOB)
|
||||
this.$store.commit("patient/update_hp", pat.M_PatientHP)
|
||||
this.$store.commit("patient/update_phone", pat.M_PatientPhone)
|
||||
this.$store.commit("patient/update_email", pat.M_PatientEmail)
|
||||
this.$store.commit("patient/update_pob", pat.M_PatientPOB)
|
||||
this.$store.commit("patient/update_selected_kartuidentitas", {
|
||||
M_IdTypeID: pat.M_PatientM_IdTypeID,
|
||||
M_IdTypeName: pat.M_IdTypeName
|
||||
})
|
||||
this.$store.commit("patient/update_noidentitas", pat.M_PatientIDNumber)
|
||||
this.$store.commit("patient/update_note", pat.M_PatientNote)
|
||||
this.$store.dispatch("patient/getaddress", {
|
||||
id: pat.M_PatientID
|
||||
})
|
||||
this.$store.commit("patient/update_act", 'edit')
|
||||
} else {
|
||||
this.$store.commit("patient/update_open_alert_confirmation", true)
|
||||
}
|
||||
|
||||
},
|
||||
closeAlertConfirmation() {
|
||||
this.$store.commit("patient/update_open_alert_confirmation", false)
|
||||
},
|
||||
forgetAlertConfirmation() {
|
||||
this.$store.commit("patient/update_no_save", 0)
|
||||
this.$store.commit("patient/update_open_alert_confirmation", false)
|
||||
},
|
||||
updateAlert_success(val) {
|
||||
this.$store.commit("patient/update_alert_success", val)
|
||||
},
|
||||
setNewPatient() {
|
||||
this.$store.commit("patient/update_selected_patient", {})
|
||||
this.$store.commit("patient/update_norm", '')
|
||||
this.$store.commit("patient/update_patient_name", '')
|
||||
this.$store.commit("patient/update_selected_title", {})
|
||||
this.$store.commit("patient/update_selected_sex", {})
|
||||
this.$store.commit("patient/update_selected_religion", {})
|
||||
this.$store.commit("patient/update_dob", '')
|
||||
this.$store.commit("patient/update_hp", '')
|
||||
this.$store.commit("patient/update_phone", '')
|
||||
this.$store.commit("patient/update_email", '')
|
||||
this.$store.commit("patient/update_pob", '')
|
||||
this.$store.commit("patient/update_selected_kartuidentitas", {})
|
||||
this.$store.commit("patient/update_noidentitas", '')
|
||||
this.$store.commit("patient/update_note", '')
|
||||
this.$store.commit("patient/update_addresses", [])
|
||||
|
||||
this.$store.commit("patient/update_act", 'new')
|
||||
},
|
||||
closeDialogSuccess() {
|
||||
let arrpatient = this.$store.state.patient.patients
|
||||
var idx = _.findIndex(arrpatient, item => item.M_PatientID === this.$store.state.patient.last_id)
|
||||
console.log(idx)
|
||||
this.$store.dispatch("patient/search", {
|
||||
name: this.name,
|
||||
snorm: this.snorm,
|
||||
lastid: idx
|
||||
})
|
||||
this.$store.commit("patient/update_dialog_success", false)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialogsuccess: {
|
||||
get() {
|
||||
return this.$store.state.patient.dialog_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_dialog_success", val)
|
||||
}
|
||||
},
|
||||
msgsuccess() {
|
||||
return this.$store.state.patient.msg_success
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.patient.alert_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_alert_success", val)
|
||||
}
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.patient.search_status == 1
|
||||
},
|
||||
patients() {
|
||||
return this.$store.state.patient.patients
|
||||
},
|
||||
openalertconfirmation: {
|
||||
get() {
|
||||
return this.$store.state.patient.open_alert_confirmation
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_open_alert_confirmation", val)
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
msgalertconfirmation: "Perubahan yang telah dilakukan belum disimpan dong !",
|
||||
items: [],
|
||||
name: '',
|
||||
snorm: '',
|
||||
page: 1,
|
||||
headers: [{
|
||||
text: "PID",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "10%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NAMA",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "25%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NO HP",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
|
||||
{
|
||||
text: "JENIS KELAMIN",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "status",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
}
|
||||
],
|
||||
pagination: {
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 5,
|
||||
sortBy: 'M_PatientName',
|
||||
totalItems: this.$store.state.patient.total_patients
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
95
one-ui/test_x_old/vuex/one-md-patient/index.php
Normal file
95
one-ui/test_x_old/vuex/one-md-patient/index.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>One</title>
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/icomoon-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/vuetify.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div v-cloak id="app">
|
||||
<v-app id="smartApp" >
|
||||
<one-navbar></one-navbar>
|
||||
<v-content style="background:#F5E8DF!important" >
|
||||
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
|
||||
<v-layout row wrap >
|
||||
<v-flex xs6 class="left" fill-height pa-1>
|
||||
<one-md-patient-list></one-md-patient-list>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="right" fill-height pa-1>
|
||||
<one-md-patient-detail></one-md-patient-detail>
|
||||
<one-md-patient-address></one-md-patient-address>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-container>
|
||||
</v-content>
|
||||
<one-footer> </one-footer>
|
||||
</v-app>
|
||||
</div>
|
||||
|
||||
<!-- Vendor -->
|
||||
<script src="../../../libs/vendor/moment.min.js"></script>
|
||||
<script src="../../../libs/vendor/numeral.min.js"></script>
|
||||
<script src="../../../libs/vendor/moment-locale-id.js"></script>
|
||||
<script src="../../../libs/vendor/lodash.js"></script>
|
||||
<script src="../../../libs/vendor/axios.min.js"></script>
|
||||
<script src="../../../libs/vendor/vue.js"></script>
|
||||
<script src="../../../libs/vendor/vuex.js"></script>
|
||||
<script src="../../../libs/vendor/vuetify.js"></script>
|
||||
<script src="../../../libs/vendor/httpVueLoader.js"></script>
|
||||
<script src="../../../libs/one_global.js"></script>
|
||||
<!-- App Script -->
|
||||
<?php
|
||||
$ts = "?ts=" . Date("ymdhis");
|
||||
?>
|
||||
<script type="module">
|
||||
window.calculate_age = function (inp_dob) {
|
||||
var now = moment(new Date())
|
||||
var dob = moment(new Date(inp_dob))
|
||||
var year = now.diff(dob,'years')
|
||||
dob.add(year,'years')
|
||||
var month = now.diff(dob,'months')
|
||||
dob.add(month,'months')
|
||||
var day = now.diff(dob,'days')
|
||||
if (isNaN(year)) return ''
|
||||
return `${year} tahun ${month} bulan ${day} hari`
|
||||
}
|
||||
|
||||
|
||||
import { store } from './store.js<?php echo $ts ?>';
|
||||
//for testing
|
||||
window.store = store;
|
||||
new Vue({
|
||||
store,
|
||||
el: '#app',
|
||||
methods: {
|
||||
tab_selected : function(tab) {
|
||||
return this.$store.state.tab_selected == tab
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-md-patient-list': httpVueLoader('./components/oneMdPatientList.vue'),
|
||||
'one-md-patient-detail': httpVueLoader('./components/oneMdPatientDetail.vue'),
|
||||
'one-md-patient-address': httpVueLoader('./components/oneMdPatientAddress.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
.left {
|
||||
}
|
||||
.right {
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
546
one-ui/test_x_old/vuex/one-md-patient/modules/patient.js
Normal file
546
one-ui/test_x_old/vuex/one-md-patient/modules/patient.js
Normal file
@@ -0,0 +1,546 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/patient.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
last_id: -1,
|
||||
last_saved_id: -1,
|
||||
x_addr_id: 0,
|
||||
act: 'edit',
|
||||
act_addr: 'new',
|
||||
get_data_status: 0,
|
||||
search_patient: 0,
|
||||
search_status: 0,
|
||||
search_error_message: '',
|
||||
norm: '',
|
||||
patient_name: '',
|
||||
titles: [],
|
||||
selected_title: {},
|
||||
dob: '',
|
||||
patients: [],
|
||||
total_patients: 0,
|
||||
patient_address: [],
|
||||
sexes: [],
|
||||
selected_sex: {},
|
||||
religions: [],
|
||||
selected_religion: {},
|
||||
phone: '',
|
||||
hp: '',
|
||||
email: '',
|
||||
pob: '',
|
||||
kartuidentitass: [],
|
||||
selected_kartuidentitas: {},
|
||||
noidentitas: '',
|
||||
note: '',
|
||||
total_patient: 0,
|
||||
selected_patient: {},
|
||||
save_status: 0,
|
||||
btn_save_seen: true,
|
||||
pgrs_save: false,
|
||||
save_error_message: '',
|
||||
no_save: 0,
|
||||
open_alert_confirmation: false,
|
||||
alert_success: false,
|
||||
msg_success: "",
|
||||
dialog_success: false,
|
||||
dialog_confirmation_delete: false,
|
||||
msg_confirmation_delete: "",
|
||||
dialog_confirmation_delete_addr: false,
|
||||
msg_confirmation_delete_addr: "",
|
||||
autocomplete_status: 0,
|
||||
dialog_form_address: false,
|
||||
label_address: '',
|
||||
addresses: [],
|
||||
cities: [],
|
||||
city_address: {},
|
||||
districts: [],
|
||||
district_address: {},
|
||||
kelurahans: [],
|
||||
kelurahan_address: {},
|
||||
description_address: '',
|
||||
errors: []
|
||||
},
|
||||
mutations: {
|
||||
update_x_addr_id(state, val) {
|
||||
state.x_addr_id = val
|
||||
},
|
||||
update_last_id(state, val) {
|
||||
state.last_id = val
|
||||
},
|
||||
update_last_saved_id(state, val) {
|
||||
state.last_saved_id = val
|
||||
},
|
||||
update_act(state, val) {
|
||||
state.act = val
|
||||
},
|
||||
update_act_addr(state, val) {
|
||||
state.act_addr = val
|
||||
},
|
||||
update_get_data_status(state, val) {
|
||||
state.get_data_status = val
|
||||
},
|
||||
update_search_error_message(state, patient) {
|
||||
state.search_error_message = patient
|
||||
},
|
||||
update_search_patient(state, patient) {
|
||||
state.search_patient = patient
|
||||
},
|
||||
update_dob(state, val) {
|
||||
state.dob = val
|
||||
},
|
||||
update_patient_name(state, val) {
|
||||
state.patient_name = val
|
||||
},
|
||||
update_norm(state, val) {
|
||||
state.norm = val
|
||||
},
|
||||
update_titles(state, val) {
|
||||
state.titles = val
|
||||
},
|
||||
update_selected_title(state, val) {
|
||||
state.selected_title = val
|
||||
},
|
||||
update_patients(state, data) {
|
||||
state.patients = data
|
||||
},
|
||||
update_selected_patient(state, val) {
|
||||
state.selected_patient = val
|
||||
},
|
||||
update_sexes(state, val) {
|
||||
state.sexes = val
|
||||
},
|
||||
update_selected_sex(state, val) {
|
||||
state.selected_sex = val
|
||||
},
|
||||
update_religions(state, val) {
|
||||
state.religions = val
|
||||
},
|
||||
update_selected_religion(state, val) {
|
||||
state.selected_religion = val
|
||||
},
|
||||
update_phone(state, val) {
|
||||
state.phone = val
|
||||
},
|
||||
update_email(state, val) {
|
||||
state.email = val
|
||||
},
|
||||
update_pob(state, val) {
|
||||
state.pob = val
|
||||
},
|
||||
update_hp(state, val) {
|
||||
state.hp = val
|
||||
},
|
||||
update_kartuidentitass(state, val) {
|
||||
state.kartuidentitass = val
|
||||
},
|
||||
update_selected_kartuidentitas(state, val) {
|
||||
state.selected_kartuidentitas = val
|
||||
},
|
||||
update_noidentitas(state, val) {
|
||||
state.noidentitas = val
|
||||
},
|
||||
update_note(state, val) {
|
||||
state.note = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_btn_save_seen(state, val) {
|
||||
state.btn_save_seen = val
|
||||
},
|
||||
update_pgrs_save(state, val) {
|
||||
state.pgrs_save = val
|
||||
},
|
||||
update_save_error_message(state, msg) {
|
||||
state.save_error_message = ''
|
||||
},
|
||||
update_no_save(state, val) {
|
||||
state.no_save = val
|
||||
},
|
||||
update_open_alert_confirmation(state, val) {
|
||||
state.open_alert_confirmation = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
},
|
||||
update_dialog_success(state, val) {
|
||||
state.dialog_success = val
|
||||
},
|
||||
update_dialog_confirmation_delete(state, val) {
|
||||
state.dialog_confirmation_delete = val
|
||||
},
|
||||
update_msg_confirmation_delete(state, val) {
|
||||
state.msg_confirmation_delete = val
|
||||
},
|
||||
update_dialog_confirmation_delete_addr(state, val) {
|
||||
state.dialog_confirmation_delete_addr = val
|
||||
},
|
||||
update_msg_confirmation_delete_addr(state, val) {
|
||||
state.msg_confirmation_delete_addr = val
|
||||
},
|
||||
update_addresses(state, val) {
|
||||
state.addresses = val
|
||||
},
|
||||
update_autocomplete_status(state, val) {
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_dialog_form_address(state, val) {
|
||||
state.dialog_form_address = val
|
||||
},
|
||||
update_label_address(state, val) {
|
||||
state.label_address = val
|
||||
},
|
||||
update_cities(state, val) {
|
||||
state.cities = val
|
||||
},
|
||||
update_city_address(state, val) {
|
||||
state.city_address = val
|
||||
},
|
||||
update_districts(state, val) {
|
||||
state.districts = val
|
||||
},
|
||||
update_district_address(state, val) {
|
||||
state.district_address = val
|
||||
},
|
||||
update_kelurahans(state, val) {
|
||||
state.kelurahans = val
|
||||
},
|
||||
update_kelurahan_address(state, val) {
|
||||
state.kelurahan_address = val
|
||||
},
|
||||
update_description_address(state, val) {
|
||||
state.description_address = val
|
||||
},
|
||||
update_search_status(state, val) {
|
||||
state.search_status = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_total_patients(state, val) {
|
||||
state.total_patients = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context, prm) {
|
||||
context.commit("update_search_patient", 1)
|
||||
try {
|
||||
let resp = await api.search(one_token(), prm.name, prm.snorm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_patient", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_patients", data.records)
|
||||
context.commit("update_total_patients", data.total)
|
||||
context.commit("update_no_save", 0)
|
||||
if (prm.lastid === -1) {
|
||||
context.commit("update_selected_patient", data.records[0])
|
||||
var pat = data.records[0]
|
||||
//console.log(pat.M_PatientNoReg)
|
||||
context.commit("update_norm", pat.M_PatientNoReg)
|
||||
context.commit("update_patient_name", pat.M_PatientName)
|
||||
context.commit("update_selected_title", {
|
||||
M_TitleID: pat.M_PatientM_TitleID,
|
||||
M_TitleName: pat.M_TitleName
|
||||
})
|
||||
context.commit("update_selected_sex", {
|
||||
M_SexID: pat.M_PatientM_SexID,
|
||||
m_sexname: pat.M_SexName
|
||||
})
|
||||
context.commit("update_selected_religion", {
|
||||
M_ReligionID: pat.M_PatientM_ReligionID,
|
||||
M_ReligionName: pat.M_ReligionName
|
||||
})
|
||||
context.commit("update_dob", pat.M_PatientDOB)
|
||||
context.commit("update_hp", pat.M_PatientHP)
|
||||
context.commit("update_phone", pat.M_PatientPhone)
|
||||
context.commit("update_email", pat.M_PatientEmail)
|
||||
context.commit("update_pob", pat.M_PatientPOB)
|
||||
context.commit("update_selected_kartuidentitas", {
|
||||
M_IdTypeID: pat.M_PatientM_IdTypeID,
|
||||
M_IdTypeName: pat.M_IdTypeName
|
||||
})
|
||||
context.commit("update_noidentitas", pat.M_PatientIDNumber)
|
||||
context.commit("update_note", pat.M_PatientNote)
|
||||
context.dispatch("getaddress", {
|
||||
id: pat.M_PatientID
|
||||
})
|
||||
} else {
|
||||
context.commit("update_selected_patient", data.records[prm.lastid])
|
||||
var pat = data.records[prm.lastid]
|
||||
context.commit("update_norm", pat.M_PatientNoReg)
|
||||
context.commit("update_patient_name", pat.M_PatientName)
|
||||
context.commit("update_selected_title", {
|
||||
M_TitleID: pat.M_PatientM_TitleID,
|
||||
M_TitleName: pat.M_TitleName
|
||||
})
|
||||
context.commit("update_selected_sex", {
|
||||
M_SexID: pat.M_PatientM_SexID,
|
||||
m_sexname: pat.M_SexName
|
||||
})
|
||||
context.commit("update_selected_religion", {
|
||||
M_ReligionID: pat.M_PatientM_ReligionID,
|
||||
M_ReligionName: pat.M_ReligionName
|
||||
})
|
||||
context.commit("update_dob", pat.M_PatientDOB)
|
||||
context.commit("update_hp", pat.M_PatientHP)
|
||||
context.commit("update_phone", pat.M_PatientPhone)
|
||||
context.commit("update_email", pat.M_PatientEmail)
|
||||
context.commit("update_pob", pat.M_PatientPOB)
|
||||
context.commit("update_selected_kartuidentitas", {
|
||||
M_IdTypeID: pat.M_PatientM_IdTypeID,
|
||||
M_IdTypeName: pat.M_IdTypeName
|
||||
})
|
||||
context.commit("update_noidentitas", pat.M_PatientIDNumber)
|
||||
context.commit("update_note", pat.M_PatientNote)
|
||||
context.dispatch("getaddress", {
|
||||
id: pat.M_PatientID
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getsexreg(context) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
let resp = await api.getsexreg(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status", 3)
|
||||
} else {
|
||||
context.commit("update_get_data_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_sexes", data.records.sexes)
|
||||
context.commit("update_religions", data.records.religions)
|
||||
context.commit("update_titles", data.records.titles)
|
||||
context.commit("update_kartuidentitass", data.records.kartuidentitass)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
}
|
||||
},
|
||||
async save(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.save(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_last_id", prm.M_PatientID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Data pasien " + prm.M_PatientName + " sudah terupdate dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async newpatient(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.newpatient(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
console.log(resp.data.id)
|
||||
context.commit("update_last_id", resp.data.id)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Data pasien " + prm.M_PatientName + " sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async delete(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.xdelete(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_last_id", 0)
|
||||
context.commit("update_dialog_confirmation_delete", false)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Data pasien " + prm.M_PatientName + " sudah dihapus dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_normupdate_norm", '')
|
||||
context.commit("update_patient_name", '')
|
||||
context.commit("update_selected_title", {})
|
||||
context.commit("update_selected_sex", {})
|
||||
context.commit("update_selected_religion", {})
|
||||
context.commit("update_dob", '')
|
||||
context.commit("update_hp", '')
|
||||
context.commit("update_phone", '')
|
||||
context.commit("update_email", '')
|
||||
context.commit("update_pob", '')
|
||||
context.commit("update_selected_kartuidentitas", {})
|
||||
context.commit("update_noidentitas", '')
|
||||
context.commit("update_note", '')
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async getaddress(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.getaddress(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_addresses", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async searchcity(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchcity(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
} else {
|
||||
context.commit("update_autocomplete_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_cities", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async getdistrict(context, prm) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
let resp = await api.getdistrict(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status", 3)
|
||||
} else {
|
||||
context.commit("update_get_data_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_districts", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
}
|
||||
},
|
||||
async getkelurahan(context, prm) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
let resp = await api.getkelurahan(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status", 3)
|
||||
} else {
|
||||
context.commit("update_get_data_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_kelurahans", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
}
|
||||
},
|
||||
async savenewaddress(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.savenewaddress(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_dialog_form_address", false)
|
||||
context.commit("update_last_id", prm.M_PatientAddressM_PatientID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Penambahan data alamat pasien " + prm.M_PatientName + " sudah berhasil dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async saveeditaddress(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.saveeditaddress(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_dialog_form_address", false)
|
||||
context.commit("update_last_id", prm.M_PatientAddressM_PatientID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Perubahan data alamat pasien " + prm.M_PatientName + " sudah berhasil dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async deleteaddress(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.deleteaddress(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_dialog_confirmation_delete_addr", false)
|
||||
context.commit("update_last_id", prm.M_PatientAddressM_PatientID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Penghapusan data alamat " + prm.M_PatientAddressNote + " dari pasien " + prm.M_PatientName + " sudah berhasil dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
one-ui/test_x_old/vuex/one-md-patient/store.js
Normal file
27
one-ui/test_x_old/vuex/one-md-patient/store.js
Normal file
@@ -0,0 +1,27 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import patient from "./modules/patient.js";
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
patient: patient,
|
||||
system: system
|
||||
},
|
||||
state: {
|
||||
tab_selected: 'pasien-dokter'
|
||||
},
|
||||
mutations: {
|
||||
change_tab(state, ntab) {
|
||||
state.tab_selected = ntab
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
change_tab(context, ntab) {
|
||||
context.commit('change_tab', ntab)
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user