408 lines
14 KiB
Vue
408 lines
14 KiB
Vue
<template>
|
|
<v-card class="pa-1" height="100%">
|
|
<v-layout align-center row>
|
|
<v-flex xs12>
|
|
<v-card tile flat color="teal lighten-4" class="pa-2">
|
|
<h5 class=" subtitle-1 font-weight-bold">PENGIRIM DAN BAHASA</h5>
|
|
</v-card>
|
|
</v-flex>
|
|
</v-layout>
|
|
<v-layout column>
|
|
<v-flex xs12 class="pa-2">
|
|
<v-layout>
|
|
<v-flex xs6 mr-1>
|
|
<v-autocomplete
|
|
label="Pengirim"
|
|
v-model="selected_doctor"
|
|
:items="doctors"
|
|
:search-input.sync="search_doctor"
|
|
auto-select-first
|
|
style="font-size:12px;padding:4px 0"
|
|
no-filter
|
|
return-object
|
|
clearable
|
|
:item-text="item => item.M_DoctorCode + ' - ' + item.M_DoctorName"
|
|
:loading="is_loading_doctor"
|
|
no-data-text="Pilih Pengirim"
|
|
persistent-hint
|
|
:hint="!selected_doctor || !selected_doctor.M_DoctorName ? 'ketikkan nama dokter' : `${selected_doctor.M_DoctorPrefix || ''} ${selected_doctor.M_DoctorPrefix2 || ''} ${selected_doctor.M_DoctorName || ''} ${selected_doctor.M_DoctorSuffix || ''} ${selected_doctor.M_DoctorSuffix2 || ''}`.trim()"
|
|
>
|
|
|
|
<template v-slot:item="{ item }">
|
|
<v-list-tile-content>
|
|
<v-list-tile-title>{{ item.M_DoctorCode + ' - ' + item.M_DoctorPrefix + ' ' + item.M_DoctorPrefix2 + ' ' + item.M_DoctorName + ' ' + item.M_DoctorSuffix + ' ' + item.M_DoctorSuffix2 }}</v-list-tile-title>
|
|
<v-list-tile-sub-title v-if="item.address" class="caption">{{ item.address }}</v-list-tile-sub-title>
|
|
</v-list-tile-content>
|
|
</template>
|
|
</v-autocomplete>
|
|
<span v-if="selected_doctor.M_DoctorNote" class="caption">{{selected_doctor.M_DoctorNote}}</span>
|
|
<span v-if="selected_doctor && selected_doctor.address" class="caption grey--text">{{ selected_doctor.address }}</span>
|
|
</v-flex>
|
|
<v-flex xs3 mr-1>
|
|
<v-select
|
|
readonly
|
|
v-model="selected_language"
|
|
:items="languages"
|
|
item-text="name"
|
|
item-value="key"
|
|
style="font-size:12px;padding:4px 0"
|
|
label="Bahasa"
|
|
return-object
|
|
></v-select>
|
|
|
|
</v-flex>
|
|
|
|
<v-flex xs3>
|
|
<v-select
|
|
v-model="selected_language_2"
|
|
:items="languages_2"
|
|
item-text="name"
|
|
item-value="key"
|
|
style="font-size:12px;padding:4px 0"
|
|
label="Bahasa 2"
|
|
return-object
|
|
clearable
|
|
></v-select>
|
|
|
|
</v-flex>
|
|
|
|
</v-layout>
|
|
|
|
</v-flex>
|
|
|
|
<v-flex xs12>
|
|
<patient-delivery></patient-delivery>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card>
|
|
</template>
|
|
<script>
|
|
module.exports = {
|
|
components: {
|
|
'patient-delivery' : httpVueLoader('./patientDelivery.vue')
|
|
},
|
|
|
|
data() {
|
|
return {
|
|
n_mounted : 1,
|
|
search_doctor: ''
|
|
}
|
|
},
|
|
computed: {
|
|
is_loading_doctor: {
|
|
get() {
|
|
return this.$store.state.doctor.is_loading_doctor
|
|
},
|
|
set(val) {
|
|
this.$store.commit("doctor/update_is_loading_doctor",val)
|
|
}
|
|
},
|
|
searchfpp: {
|
|
get() {
|
|
return this.$store.state.doctor.searchfpp;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("doctor/update_searchfpp", val);
|
|
},
|
|
},
|
|
fpptypes() {
|
|
return this.$store.state.doctor.fpptypes;
|
|
},
|
|
|
|
selected_fpptype: {
|
|
get() {
|
|
return this.$store.state.doctor.selected_fpptype;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("doctor/update_selected_fpptype", val);
|
|
},
|
|
},
|
|
doctor_alias_address:{
|
|
get(){
|
|
return this.$store.state.doctor.doctor_alias_address
|
|
},
|
|
set(val) {
|
|
this.$store.commit('doctor/update_doctor_alias_address',val)
|
|
}
|
|
},
|
|
doctor_alias:{
|
|
get(){
|
|
return this.$store.state.doctor.doctor_alias
|
|
},
|
|
set(val) {
|
|
//alert(val.M_DoctorName)
|
|
this.$store.commit('doctor/update_doctor_alias',val)
|
|
var xdoc = this.$store.state.doctor.selected_doctor
|
|
var company = this.$store.state.company.selected_company
|
|
|
|
|
|
var doctorname = xdoc.M_DoctorName.split(']')
|
|
//alert(xdoc.M_DoctorName.split(']'))
|
|
console.log(doctorname)
|
|
if(doctorname[1].trim() === '-' && company.M_CompanyName !== 'PASIEN MANDIRI'){
|
|
this.$store.commit("company/update_show_alias_doctor",true)
|
|
}
|
|
else{
|
|
this.$store.commit("company/update_show_alias_doctor",false)
|
|
this.$store.commit('doctor/update_doctor_alias','')
|
|
this.$store.commit('doctor/update_doctor_alias_address','')
|
|
}
|
|
|
|
if(company){
|
|
if(val === '' && doctorname[1].trim() === '-' && company.M_CompanyName !== 'PASIEN MANDIRI'){
|
|
this.$store.commit('doctor/update_show_doctor_alert',true)
|
|
}
|
|
else{
|
|
this.$store.commit('doctor/update_show_doctor_alert',false)
|
|
}
|
|
}
|
|
else{
|
|
this.$store.commit('doctor/update_show_doctor_alert',false)
|
|
}
|
|
|
|
}
|
|
},
|
|
search:{
|
|
get(){
|
|
return this.$store.state.doctor.search
|
|
},
|
|
set(val) {
|
|
this.$store.commit('doctor/update_search',val)
|
|
}
|
|
},
|
|
|
|
languages() {
|
|
return this.$store.state.language.languages
|
|
},
|
|
|
|
languages_2 () {
|
|
return this.$store.state.language.languages_2
|
|
},
|
|
|
|
selected_language: {
|
|
get() {
|
|
return this.$store.state.language.selected_language
|
|
},
|
|
set(val) {
|
|
this.$store.commit('language/update_selected_language', val)
|
|
// this.$store.commit('language/update_selected_language_2', null)
|
|
|
|
|
|
}
|
|
},
|
|
|
|
selected_language_2: {
|
|
get() {
|
|
return this.$store.state.language.selected_language_2
|
|
},
|
|
set(val) {
|
|
this.$store.commit('language/update_selected_language_2', val)
|
|
}
|
|
},
|
|
|
|
selected_doctor_pj: {
|
|
get() {
|
|
return this.$store.state.doctor.selected_doctor_pj
|
|
},
|
|
set(val) {
|
|
this.$store.commit('doctor/update_selected_doctor_pj',val)
|
|
}
|
|
},
|
|
doctors_pj() {
|
|
return this.$store.state.doctor.doctors_pj
|
|
},
|
|
|
|
selected_address: {
|
|
get() {
|
|
return this.$store.state.doctor.selected_address
|
|
},
|
|
set(val) {
|
|
this.$store.commit('doctor/update_selected_address', val)
|
|
}
|
|
},
|
|
|
|
doctor_address() {
|
|
if (! this.$store.state.doctor.selected_doctor ) return []
|
|
if (! this.$store.state.doctor.selected_doctor.address) return []
|
|
return this.$store.state.doctor.selected_doctor.address
|
|
},
|
|
doctors() {
|
|
return this.$store.state.doctor.doctors
|
|
},
|
|
selected_doctor: {
|
|
get() {
|
|
return this.$store.state.doctor.selected_doctor
|
|
},
|
|
set(val) {
|
|
this.$store.commit("doctor/update_selected_doctor", val)
|
|
this.$store.dispatch('delivery/search_deliveries',{type:'doctor',id:val.M_DoctorID ? val.M_DoctorID : 0});
|
|
}
|
|
},
|
|
selected_doctor_x() {
|
|
return this.$store.state.doctor.selected_doctor
|
|
},
|
|
is_loading: {
|
|
get() {
|
|
return this.$store.state.doctor.search_status == 1
|
|
},
|
|
set(val) {
|
|
this.$store.commit("doctoc/update_search_status",val ? 1 : 2)
|
|
}
|
|
},
|
|
showalias: {
|
|
get() {
|
|
return this.$store.state.company.show_alias_doctor
|
|
},
|
|
set(val) {
|
|
this.$store.commit("company/update_show_alias_doctor",val)
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
xxxshowalias(){
|
|
var value = this.$store.state.doctor.selected_doctor
|
|
var doctorname = doctor.M_DoctorName.split(']')
|
|
var company = this.$store.state.company.selected_company
|
|
console.log(value)
|
|
if(!_.isEmpty(value)){
|
|
if(this.doctor_alias === '' && doctorname[1].trim() === '-' && company.M_CompanyName !== 'PASIEN MANDIRI')
|
|
return true
|
|
else{
|
|
this.doctor_alias = ''
|
|
this.doctor_alias_address = ''
|
|
return false
|
|
}
|
|
}
|
|
else{
|
|
this.doctor_alias = ''
|
|
this.doctor_alias_address = ''
|
|
return false
|
|
}
|
|
|
|
},
|
|
getAddress(doc) {
|
|
|
|
var s_addr = ''
|
|
if (! doc.address ) return ''
|
|
doc.address.forEach(function(addr){
|
|
if (s_addr != '') s_addr += ', '
|
|
s_addr += addr.M_DoctorAddressDescription
|
|
});
|
|
return s_addr
|
|
},
|
|
thr_search: _.debounce( function () {
|
|
console.log("search in doctor")
|
|
if (!window.one_token()) {
|
|
this.$store.commit('update_message_error', 'Maaf, koneksi Anda sempat terputus silahkan Log Out dan Login kembali')
|
|
this.$store.commit('update_dialog_error', true)
|
|
return
|
|
}
|
|
|
|
// this.$store.commit("doctor/update_search_status", 1) // LOADING
|
|
this.$store.dispatch("doctor/search")
|
|
}, 1000),
|
|
|
|
doctorAdd() {
|
|
this.$store.commit('doctor_new/update_dialog_new', true)
|
|
},
|
|
|
|
thr_searchfpp: _.debounce(function () {
|
|
if (!window.one_token()) {
|
|
this.$store.commit(
|
|
"update_message_error",
|
|
"Maaf, koneksi Anda sempat terputus silahkan Log Out dan Login kembali"
|
|
);
|
|
this.$store.commit("update_dialog_error", true);
|
|
return;
|
|
}
|
|
console.log("fpp is loading")
|
|
// this.$store.commit("doctor/update_search_status", 1) // LOADING
|
|
this.$store.dispatch("doctor/search_fpptype");
|
|
}, 1000),
|
|
},
|
|
watch : {
|
|
search_doctor(val, old) {
|
|
this.$store.commit("doctor/update_search", val)
|
|
|
|
if (val == "" ) return
|
|
if (val == old ) return
|
|
if (! val) return
|
|
if (val.length < 2 ) return
|
|
if (this.$store.state.doctor.is_loading_doctor == true ) return
|
|
this.thr_search()
|
|
},
|
|
searchfpp(val, old) {
|
|
console.log("search fpp", val)
|
|
this.$store.commit("doctor/update_searchfpp", val);
|
|
console.log("search fpp status ", this.$store.state.doctor.search_fpp_status)
|
|
|
|
if (val == "") return;
|
|
if (val == old) return;
|
|
if (!val) return;
|
|
if (val.length < 2) return;
|
|
if (this.$store.state.doctor.search_fpp_status == 1) return;
|
|
this.thr_searchfpp();
|
|
},
|
|
|
|
selected_address(val, o) {
|
|
let dlv = this.$store.state.delivery.checked_id
|
|
|
|
if (!val) {
|
|
// REMOVE FROM DELIVERY
|
|
let idx = dlv.indexOf(o.delivery_code)
|
|
if ( idx > -1) {
|
|
dlv.splice(idx, 1)
|
|
this.$store.commit('delivery/update_checked_id', dlv)
|
|
}
|
|
}
|
|
|
|
if (val) {
|
|
// Auto CHECKED
|
|
let cadd = val
|
|
if (cadd.delivery_default == "Y") {
|
|
if (dlv.indexOf(cadd.delivery_code) < 0) {
|
|
dlv.push(cadd.delivery_code)
|
|
this.$store.commit('delivery/update_checked_id', dlv)
|
|
}
|
|
}
|
|
|
|
}
|
|
},
|
|
|
|
selected_doctor(val, o) {
|
|
let dlv = this.$store.state.delivery.checked_id
|
|
|
|
// REMOVE FROM DELIVERY
|
|
if (!val.email_default) {
|
|
|
|
let idx = dlv.indexOf(o.delivery_code)
|
|
if ( idx > -1) {
|
|
dlv.splice(idx, 1)
|
|
this.$store.commit('delivery/update_checked_id', dlv)
|
|
}
|
|
} else if (val.email_default != "Y") {
|
|
let idx = dlv.indexOf(o.delivery_code)
|
|
if ( idx > -1) {
|
|
dlv.splice(idx, 1)
|
|
this.$store.commit('delivery/update_checked_id', dlv)
|
|
}
|
|
}
|
|
}
|
|
},
|
|
mounted: function() {
|
|
this.$store.dispatch("language/search")
|
|
this.$store.dispatch("doctor/search_fpptype")
|
|
/*
|
|
if ( this.$store.state.doctor.mounted < 1 ) {
|
|
this.$store.dispatch("doctor/search")
|
|
this.$store.dispatch("doctor/search_pj")
|
|
this.$store.dispatch("language/search")
|
|
}
|
|
|
|
this.$store.commit("doctor/increment_mounted", 1);
|
|
console.log("doctor mounted : ", this.$store.state.doctor.mounted)
|
|
*/
|
|
}
|
|
}
|
|
</script>
|