Files
FE_CPONE/test/vuex/one-send-courier-result/components/oneFoVerificationList.vue
2026-04-27 10:13:31 +07:00

703 lines
26 KiB
Vue

<template>
<v-layout class="fill-height" column>
<v-dialog v-model="xdialogreceiver" persistent max-width="450">
<v-card>
<v-card-title color="indigo" class="headline">Serah Terima</v-card-title>
<v-card-text>
<v-layout ma-1 row>
<v-flex xs12>
<v-select class="mini-select" :items="receivertypes"
item-text="name"
return-object
hide-details
v-model="selected_receiver_type"
label="Receiver" outline hide-details></v-select>
</v-flex>
</v-layout>
<v-layout ma-1 v-if="selected_receiver_type.id !== 'YBS'" row>
<v-flex xs12>
<v-text-field
label="Nama Penerima"
v-model="receiver.name"
hide-details
outline
></v-text-field>
</v-flex>
</v-layout>
<v-layout ma-1 v-if="selected_receiver_type.id !== 'YBS'" row>
<v-flex xs12>
<v-text-field
label="Hp Penerima"
v-model="receiver.hp"
hide-details
outline
></v-text-field>
</v-flex>
</v-layout>
<v-layout ma-1 v-if="selected_receiver_type.id !== 'YBS'" row>
<v-flex xs12>
<v-text-field
label="Info Lainnya"
v-model="receiver.info"
hide-details
outline
></v-text-field>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="error darken-1" flat @click="xdialogreceiver = false">Tutup</v-btn>
<v-btn color="primary darken-1" flat @click="saveReceiver()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="xdialogaction" persistent max-width="350">
<v-card>
<v-card-title color="warning" class="headline">Konfirmasi</v-card-title>
<v-card-text v-html="xmsgaction">
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary darken-1" flat @click="closeDialogAction()">OK</v-btn>
<v-btn color="error darken-1" flat @click="xdialogaction = false">Tutup</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-snackbar
v-model="snackbar.value"
:timeout="snackbar.timeout"
>
{{ snackbar.text }}
<v-btn
color="blue"
text
@click="snackbar.value = false"
>
Tutup
</v-btn>
</v-snackbar>
<v-card class="mb-2 pa-2 searchbox">
<v-layout row>
<v-flex xs2 mt-1 pr-2>
<v-menu
v-model="menufilterdatestart"
:close-on-content-click="false"
:nudge-right="40"
lazy
transition="scale-transition"
offset-y
full-width
max-width="290px"
min-width="290px"
>
<template v-slot:activator="{ on }">
<v-text-field
v-model="filterComputedDateFormattedStart"
outline
label="Janji Hasil"
hide-details
readonly
v-on="on"
@blur="date = deFormatedDate(filterComputedDateFormattedStart)"
></v-text-field>
</template>
<v-date-picker v-model="xdatestart" no-title @input="menufilterdatestart = false"></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs2 mt-1 pr-2>
<v-text-field
label="Cari..."
outline
placeholder='No Reg / Nama'
v-model="nolab"
hide-details
v-on:keyup.enter="searchPatient"
></v-text-field>
</v-flex>
<!--<v-flex xs3 mt-1 pr-2>
<v-text-field
label="Nama"
outline
v-model="name"
v-on:keyup.enter="searchPatient"
hide-details
></v-text-field>
</v-flex>-->
<v-flex xs3 mt-1 pr-2>
<v-select class="mini-select" :items="statuses"
item-text="name"
return-object
v-model="selected_status"
label="Status" outline hide-details></v-select>
</v-flex>
<v-flex xs3 mt-1 pr-2>
<v-select v-if="selected_status.id === 'P'" class="mini-select" :items="couriers"
item-text="staff_name"
return-object
v-model="selected_courier"
label="Kurir" outline hide-details></v-select>
</v-flex>
<v-flex xs4 text-xs-right mt-1 pr-2>
<span title="konfirmasi" v-if="!btn_hide" @click="confirmSpv" class="icon-medium-fill-base white--text info"><v-icon dark>assignment_ind</v-icon></span>
<span title="serahkan kurir" v-if="!btn_hide" @click="receivedByCourier" class="icon-medium-fill-base white--text success"><v-icon dark>local_shipping</v-icon></span>
</v-flex>
<!--<v-btn class="xs3 ma-1" color="success" @click="searchPatient" >Search</v-btn>-->
<!--<span @click="searchPatient" class="icon-medium-fill-base white--text success iconsearch-search"></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"
hide-actions class="elevation-1">
<template v-slot:headers="props">
<tr>
<th style="width:20px" class= "text-xs-left blue lighten-3 white--text">
<v-checkbox v-if="selected_status.id == 'P'" style="padding-top:0;margin-top:0"
hide-details
color="white"
:indeterminate="indeterminatex"
@change="changeCbxAll(bar_chx_all)"
v-model="bar_chx_all"
></v-checkbox>
</th>
<th
v-for="header in props.headers"
:key="header.text"
:class="header.class"
:width="header.width"
>
{{ header.text }}
</th>
</tr>
</template>
<template slot="items" slot-scope="props">
<td style="width:20px" v-bind:class="{'amber lighten-4':isSelected(props.item),'amber':props.item.iscito === 'Y'}" class="text-xs-left">
<v-checkbox v-if="props.item.status === 'P'" style="padding-top:0;margin-top:0"
color="blue lighten-3"
hide-details
v-model="props.item.chex"
@change="checkTop()"
></v-checkbox>
</td>
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item),'amber':props.item.iscito === 'Y'}" @click="selectMe(props.item)">{{props.item.date_promise}}</td>
<td class="pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item),'amber':props.item.iscito === 'Y'}" @click="selectMe(props.item)">{{props.item.T_OrderHeaderLabNumber}}</td>
<td class="pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item),'amber':props.item.iscito === 'Y'}" @click="selectMe(props.item)">{{props.item.patient_fullname}}</td>
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item),'amber':props.item.iscito === 'Y'}" @click="selectMe(props.item)">{{props.item.M_CompanyName}}</td>
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item),'amber':props.item.iscito === 'Y'}" @click="selectMe(props.item)">
{{props.item.spv_name}}
</td>
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item),'amber':props.item.iscito === 'Y'}" @click="selectMe(props.item)">
{{props.item.staff_name}}
</td>
</template>
</v-data-table>
<v-divider></v-divider>
<v-pagination
style="margin-top:10px;margin-bottom:10px"
v-model="curr_page"
:length="xtotal_page"
></v-pagination>
</v-flex>
</v-layout>
</v-card>
<one-dialog-alert :status="openalertverification" :msg="msgalertverification" @forget-dialog-alert="forgetAlertVerification()" @close-dialog-alert="closeAlertVerification()"></one-dialog-alert>
<one-dialog-info :status="opendialoginfo" :msg="msginfo" @close-dialog-info="opendialoginfo = false"></one-dialog-info>
</v-layout>
</template>
<style scoped>
.searchbox .v-input.v-text-field .v-input__slot{
min-height:40px;
}
.searchbox .v-btn {
min-height:40px;
}
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/getcourier",{
startdate:this.xdatestart,
name:this.name,
nolab: this.nolab,
status: this.selected_status.id,
current_page:1,
lastid:-1
})
},
methods : {
changeCbxAll(value){
var arr = this.patients
this.indeterminatex = false
this.btn_hide = true
arr.forEach((el)=>{el.chex = value})
var selected = _.filter(arr, function(o) { return o.chex })
//this.$store.commit("patient/update_selected_transaction",selected)
if(selected.length > 0)
this.btn_hide = false
},
receivedByCourier(){
var arr = this.patients
var selected_not_confirm = _.filter(arr, function(o) { return o.chex && o.flag_confirm == 'N' })
console.log(selected_not_confirm)
if(selected_not_confirm.length === 0){
var selected_no_kurir = _.filter(arr, function(o) { return o.chex && o.staff_name == 'Belum ditentukan' })
if(selected_no_kurir.length === 0){
var selected = _.filter(arr, function(o) { return o.chex })
this.$store.commit("patient/update_last_courier",this.selected_courier)
var prm = {selected:selected}
this.$store.dispatch("patient/receivedbycourier",prm)
}
else{
this.msginfo = "Pergi pelesir disiantar, kalo belum ada kurir tidak ada yang mengantar"
this.opendialoginfo = true
}
}
else{
this.msginfo = "Makan es krim dicampur nasi, kalo mau dikirim harus dikonfirmasi"
this.opendialoginfo = true
}
},
confirmSpv(){
var arr = this.patients
var selected = _.filter(arr, function(o) { return o.chex })
this.$store.commit("patient/update_last_courier",this.selected_courier)
var prm = {selected:selected}
this.$store.dispatch("patient/confirmspv",prm)
},
checkTop(){
this.btn_hide = true
var barcodes = this.patients
var selected = _.filter(barcodes, function(o) { return o.chex })
this.bar_chx_all = false
this.indeterminatex = false
if(selected.length > 0 && barcodes.length === selected.length){
this.bar_chx_all = true
this.indeterminatex = false
this.btn_hide = false
}
if(selected.length > 0 && barcodes.length > selected.length){
this.bar_chx_all = false
this.indeterminatex = true
this.btn_hide = false
}
//this.$store.commit("done/update_selected_transaction",selected)
},
isSelected(p) {
if(p.iscito === 'Y')
return false
else
return p.T_OrderHeaderID == this.$store.state.patient.selected_patient.T_OrderHeaderID && p.T_OrderPromiseID == this.$store.state.patient.selected_patient.T_OrderPromiseID && p.T_OrderDeliveryID == this.$store.state.patient.selected_patient.T_OrderDeliveryID
},
searchPatient() {
if(this.selected_status.id != 'P'){
this.$store.dispatch("patient/search",{
startdate:this.xdatestart,
name:this.name,
nolab: this.nolab,
status: this.selected_status.id,
current_page:1,
lastid:-1
})
}
else{
this.$store.dispatch("patient/getcourier",{
startdate:this.xdatestart,
name:this.name,
nolab: this.nolab,
status: this.selected_status.id,
selected_courier:this.selected_courier.id,
current_page:1,
lastid:-1
})
}
},
selectMe(pat) {
this.$store.commit("patient/update_selected_patient",pat)
var patients = this.$store.state.patient.patients
var idx = _.findIndex(patients, function(o) { return o.T_OrderHeaderID === pat.T_OrderHeaderID })
this.$store.commit("patient/update_last_id",idx)
this.$store.dispatch("patient/getstatuspergroup",pat)
},
closeInfoVerification(){
this.$store.commit("patient/update_open_dialog_verification",false)
this.searchPatient()
},
closeAlertVerification(){
this.$store.commit("patient/update_open_alert_verification",false)
},
forgetAlertVerification(){
this.$store.commit("patient/update_no_save",0)
this.$store.commit("patient/update_open_alert_verification",false)
},
verify(value,act){
this.$store.commit("patient/update_selected_patient",value)
value.act = act
this.$store.commit("patient/update_now_prm",value)
if(act === 'Y'){
var prm = this.$store.state.patient.now_prm
prm.name = this.name
prm.nolab = this.nolab
this.$store.commit("done/update_current_page",1)
prm.done_search = {
startdate:this.$store.state.done.start_date,
enddate:this.$store.state.done.end_date,
search:this.$store.state.done.search,
current_page:1,
lastid:-1
}
this.$store.dispatch("patient/verify",prm)
}
else{
var xxver = value.verifications
xxver.forEach(function(entry,index) {
if(entry.xid === '0')
xxver[index].chex = true
})
this.$store.commit("patient/update_verifications",xxver)
this.$store.commit("patient/update_dialoglist",true)
this.$store.commit("patient/update_show_simpan_tolak",false)
}
},
closeDialogAction(){
var prm = this.$store.state.patient.now_prm
this.$store.dispatch("patient/verify",prm)
},
formatDate (date) {
if (!date) return null
const [year, month, day] = date.split('-')
return `${day}-${month}-${year}`
},
deFormatedDate (date) {
if (!date) return null
const [ day,month, year] = date.split('-')
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`
},
openReceive(value){
this.$store.commit("done/update_selected_patient_done",value)
this.selected_receiver_type = {id:'YBS',name:'YBS'}
this.receiver.name = this.$store.state.done.selected_patient_done.patient_fullname
this.receiver.hp = this.$store.state.done.selected_patient_done.patient_hp
this.receiver.info = ""
this.xdialogreceiver = true
},
sendEmail(trx){
var prm = trx
this.$store.dispatch("done/sendemail",prm)
}
},
computed: {
opendialoginfo: {
get() {
return this.$store.state.patient.dialog_info
},
set(val) {
this.$store.commit("patient/update_dialog_info",val)
//this.searchPatient()
}
},
msginfo: {
get() {
return this.$store.state.patient.msg_info
},
set(val) {
this.$store.commit("patient/update_msg_info",val)
//this.searchPatient()
}
},
bar_chx_all: {
get() {
return this.$store.state.done.bar_chx_all
},
set(val) {
this.$store.commit("done/update_bar_chx_all",val)
//this.searchPatient()
}
},
receivertypes(){
return [{id:'YBS',name:'YBS'},{id:'X',name:'Orang Lain'}]
},
xdialogreceiver: {
get() {
return this.$store.state.done.dialog_receiver
},
set(val) {
this.$store.commit("done/update_dialog_receiver",val)
//this.searchPatient()
}
},
selected_receiver_type: {
get() {
return this.$store.state.done.selected_receiver_type
},
set(val) {
this.$store.commit("done/update_selected_receiver_type",val)
if(val.id === 'YBS'){
this.receiver.name = this.$store.state.patient.selected_patient.patient_fullname
this.receiver.hp = this.$store.state.patient.selected_patient.patient_hp
this.receiver.info = ""
}
else{
this.receiver.name = ""
this.receiver.hp = ""
this.receiver.info = ""
}
}
},
receiver: {
get() {
return this.$store.state.done.receiver
},
set(val) {
this.$store.commit("done/update_receiver",val)
//this.searchPatient()
}
},
filterComputedDateFormattedStart () {
return this.formatDate(this.xdatestart)
},
statuses(){
return [{id:'P',name:'Siap dikirim'},{id:'X',name:'Belum siap dikirim'},{id:'S',name:'Sedang dikirim'},{id:'R',name:'Telah diterima'}]
},
selected_status: {
get() {
return this.$store.state.patient.selected_status
},
set(val) {
this.$store.commit("patient/update_selected_status",val)
this.searchPatient()
}
},
couriers(){
return this.$store.state.patient.couriers
},
selected_courier: {
get() {
return this.$store.state.patient.selected_courier
},
set(val) {
this.$store.commit("patient/update_selected_courier",val)
this.$store.dispatch("patient/search",{
startdate:this.xdatestart,
name:this.name,
nolab: this.nolab,
status: this.selected_status.id,
selected_courier:this.selected_courier.id,
current_page:1,
lastid:-1
})
}
},
snackbar: {
get() {
return this.$store.state.patient.snackbar
},
set(val) {
this.$store.commit("patient/update_snackbar",val)
}
},
name: {
get() {
return this.$store.state.patient.name
},
set(val) {
this.$store.commit("patient/update_name",val)
}
},
nolab: {
get() {
return this.$store.state.patient.nolab
},
set(val) {
this.$store.commit("patient/update_nolab",val)
}
},
isLoading() {
return this.$store.state.patient.search_status == 1
},
patients() {
return this.$store.state.patient.patients
},
opendialogverification: {
get() {
return this.$store.state.patient.open_dialog_verification
},
set(val) {
this.$store.commit("patient/update_open_dialog_verification",false)
}
},
msginfoverification(){
return this.$store.state.patient.msg_info_verification
},
openalertverification: {
get() {
return this.$store.state.patient.open_alert_verification
},
set(val) {
this.$store.commit("patient/open_alert_verification",false)
}
},
msgalertverification(){
return this.$store.state.patient.msg_alert_verification
},
xdialogaction:{
get() {
return this.$store.state.patient.dialog_action
},
set(val) {
this.$store.commit("patient/update_dialog_action",val)
}
},
xmsgaction:{
get() {
return this.$store.state.patient.msg_action
},
set(val) {
this.$store.commit("patient/update_msg_action",val)
}
},
btnsaveseen:{
get() {
return this.$store.state.patient.btn_save_seen
},
set(val) {
this.$store.commit("patient/update_btn_save_seen",val)
}
},
curr_page: {
get() {
return this.$store.state.patient.current_page
},
set(val) {
this.$store.commit("patient/update_current_page",val)
this.$store.dispatch("patient/search",{
startdate:this.xdatestart,
name:this.name,
nolab: this.nolab,
status: this.selected_status.id,
current_page:val,
lastid:-1
})
}
},
xtotal_page: {
get() {
return this.$store.state.patient.total_patient
},
set(val) {
this.$store.commit("patient/update_total_patient",val)
}
},
xdatestart : {
get() {
return this.$store.state.patient.start_date
},
set(val) {
this.$store.commit("patient/update_start_date",val)
this.searchPatient()
}
},
btn_hide: {
get() {
return this.$store.state.done.btn_hide
},
set(val) {
this.$store.commit("done/update_btn_hide",val)
}
}
},
data() {
return {
menufilterdatestart:false,
date: new Date().toISOString().substr(0, 10),
items: [],
indeterminatex:false,
headers: [
{
text: "JANJI HASIL",
align: "left",
sortable: false,
value: "mr",
width: "12%",
class: "pa-2 blue lighten-3 text-xs-left white--text"
},
{
text: "NO REG",
align: "left",
sortable: false,
value: "lab",
width: "10%",
class: "pa-2 blue lighten-3 text-xs-left white--text"
},
{
text: "PASIEN",
align: "left",
sortable: false,
value: "lab",
width: "20%",
class: "pa-2 blue lighten-3 text-xs-left white--text"
},
{
text: "KEL. PELANGGAN",
align: "left",
sortable: false,
value: "name",
width: "25%",
class: "pa-2 blue lighten-3 text-xs-left white--text"
},
{
text: "KONFRIMASI",
align: "left",
sortable: false,
value: "name",
width: "15%",
class: "pa-2 blue lighten-3 text-xs-left white--text"
},
{
text: "KURIR",
align: "left",
sortable: false,
value: "name",
width: "20%",
class: "pa-2 blue lighten-3 text-xs-left white--text"
}
],
};
}
}
</script>