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

835 lines
31 KiB
Vue

<template>
<v-layout class="fill-height" column>
<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 xs4 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="Tanggal SPK"
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 xs4 mt-1 pr-2>
<v-select class="mini-select" :items="spks"
item-text="name"
return-object
v-model="selected_spk"
label="SPK - Kurir" outline hide-details></v-select>
</v-flex>
<v-flex xs2 mt-1 pr-2>
<v-text-field
label="Cari"
placeholder="No Reg / Nama"
v-model="search"
outline
hide-details
></v-text-field>
</v-flex>
<v-flex xs2 text-xs-right mt-1 pr-2>
<!--<span v-if="status_confirm !== 'Y'" title="laporkan" @click="saveReport" class="icon-medium-fill-base white--text info"><v-icon large dark>move_to_inbox</v-icon></span>-->
<span v-if="status_confirm !== 'Y'" title="konfirmasi" @click="confirmReport" class="icon-medium-fill-base white--text teal"><v-icon large dark>done_all</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 slot="items" slot-scope="props">
<td class="pa-2" @click="selectMe(props.item)"><span class="font-weigth-bold marron">{{props.item.no_reg}}</span></td>
<td class="pa-2" @click="selectMe(props.item)">
<p class="mb-0">{{props.item.patient_fullname}}</p>
<p class="red--text mono font-weight-bold mb-0 caption" v-if="props.item.rest == '0' && props.item.flag_bill === 'N'">Rp {{convertMoney(props.item.unpaid)}}</p>
</td>
<td class="text-xs-left pa-2" @click="selectMe(props.item)">
<v-menu
v-if="props.item.status !== 'Y'"
bottom
origin="center center"
transition="scale-transition"
>
<template v-slot:activator="{ on }">
<v-btn
color="#ff5252"
dark
depressed
style="margin-left:4px;height:32px;padding:2px 8px"
small
v-on="on"
>
{{selectedlangName(props.item.selected_receive)}}
</v-btn>
</template>
<v-list>
<v-list-tile
v-for="(lang, i) in receive_status"
:key="i"
>
<v-list-tile-title>{{ lang.name }}</v-list-tile-title>
</v-list-tile>
</v-list>
</v-menu>
<span class="teal--text" v-if="props.item.status === 'Y' && props.item.received_status === 'D'" >{{props.item.received_name}}</span>
<span class="red--text" v-if="props.item.status === 'Y' && props.item.received_status === 'R'" >{{props.item.received_name}}</span>
</td>
<td class="text-xs-left pa-2" @click="selectMe(props.item)">
<v-text-field class="mb-1"
v-if="props.item.status !== 'Y'"
placeholder="Penerima"
disabled
hide-details
v-model="props.item.receiver_name"
solo
></v-text-field>
<v-text-field
v-if="props.item.status !== 'Y'"
placeholder="Jam Penerimaan"
mask="##-##-#### ##:##"
hide-details
disabled
v-model="props.item.received_datetime"
solo
clearable
></v-text-field>
<p class="mb-1 font-weight-bold" v-if="props.item.status === 'Y'">{{props.item.receiver_name}}</p>
<p class="mb-1 teal--text font-weight-bold mono" v-if="props.item.status === 'Y'">{{props.item.received_datetime_ina}}</p>
</td>
<td class="text-xs-left pa-2" @click="selectMe(props.item)">
<v-text-field
v-if="props.item.status !== 'Y'"
placeholder="Pembayaran"
:disabled="props.item.status_payment === 'Y'"
reverse
suffix="Rp"
hide-details
@change="changePaymment(props.item,props.item.payment)"
v-model="props.item.payment"
solo
></v-text-field>
<span class="subtitle-2 mono font-weight-bold teal--text" v-if="props.item.status === 'Y'">Rp {{convertMoney(props.item.payment)}}</span>
</td>
</template>
</v-data-table>
</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("done/getspk",{
startdate:this.xdatestart,
spk:0,
lastid:-1
})
this.$store.dispatch("patient/getreceivestatus")
},
methods : {
convertMoney(money){
return one_money(money)
},
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) {
return p.spk_detail_id == this.$store.state.patient.selected_patient.spk_detail_id
},
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.done.transactions
console.log(patients)
console.log(pat)
var idx = _.findIndex(patients, function(o) { return o.spk_detail_id === pat.spk_detail_id })
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)
},
changeStatus(value,row){
console.log(value)
console.log(row)
var patients = this.patients
},
selectedlangName(value){
return value.name
},
selectLang(trx,lang){
console.log(trx)
var arr = this.$store.state.done.transactions
let idx = _.findIndex(arr, function(o) { return o.spk_detail_id == trx.spk_detail_id })
console.log(arr[idx])
console.log(lang)
arr[idx].selected_receive = lang
arr[idx].received_id = lang.id
arr[idx].received_code = lang.code
arr[idx].received_name = lang.name
arr[idx].received_status = lang.status
if(lang.code === 'YBS')
arr[idx].receiver_name = arr[idx].patient_fullname
else if(lang.code === 'NOONE' || lang.code === 'CNFSD')
arr[idx].receiver_name = '-'
else
arr[idx].receiver_name = ''
if(trx.status_payment === 'N' && lang.status === 'D' && parseInt(trx.payment) === 0)
arr[idx].payment = trx.unpaid
if(trx.status_payment === 'N' && lang.status !== 'D')
arr[idx].payment = 0
this.$store.commit("done/update_transactions",arr)
this.status_complete()
},
changePaymment(row,value){
var arr = this.$store.state.done.transactions
let idx = _.findIndex(arr, function(o) { return o.spk_detail_id == row.spk_detail_id })
arr[idx].payment = value
this.$store.commit("done/update_transactions",arr)
var summaries = _.filter(arr, function(o) { return o.status_payment == 'N' })
this.$store.commit("done/update_summaries",summaries)
this.status_complete()
},
saveReport(){
var arr = this.$store.state.done.transactions
var status_x = []
var empty_receiver = []
var wrong_date = []
arr.forEach(function(entry,idx) {
if(entry.received_code == 'XXX'){
status_x.push(entry.patient_fullname)
}
if(entry.receiver_name == ''){
empty_receiver.push(entry.patient_fullname)
}
var xdatetime = entry.received_datetime
console.log(xdatetime)
if(!moment(xdatetime, 'DDMMYYYYHHmm', true).isValid()){
wrong_date.push(entry.patient_fullname)
}
else{
arr[idx].received_datetime = xdatetime
}
})
if(status_x.length === 0 && empty_receiver.length === 0 && wrong_date.length === 0){
this.$store.dispatch("done/saveReport",arr)
}
else{
var msginfo = "<h4 class='font-weight-black body-1'>BELI SAMPO DI TOKO KELONTONG, INFO DI BAWAH INI DISIMAK DONG :</h4>"
msginfo += '</br>'
status_x.forEach(function(entry) {
//console.log(entry)
msginfo = msginfo+ "<p class='mb-0'><span class='font-weight-bold red--text'>"+entry+"</span> belum dipilih status pengiriman</p>"
})
msginfo += '</br>'
empty_receiver.forEach(function(entry) {
msginfo = msginfo+"<p class='mb-0'><span class='font-weight-bold red--text'>"+entry+"</span> belum mengisi penerima</p>"
})
msginfo += '</br>'
wrong_date.forEach(function(entry) {
msginfo = msginfo+"<p class='mb-0'><span class='font-weight-bold red--text'>"+entry+"</span> tanggal penerimaan harus sesuai format (dd-mm-yyy hh:mm)</p>"
})
this.$store.commit("patient/update_msg_info",msginfo)
this.opendialoginfo = true
}
},
confirmReport(){
var arr = this.$store.state.done.transactions
var status_x = []
var empty_receiver = []
arr.forEach(function(entry) {
if(entry.received_code == 'XXX'){
status_x.push(entry.patient_fullname)
}
if(entry.receiver_name == ''){
empty_receiver.push(entry.patient_fullname)
}
})
if(status_x.length === 0 && empty_receiver.length === 0){
this.$store.dispatch("done/confirmReport",arr)
}
else{
var msginfo = "<h4 class='font-weight-black body-1'>BELI SAMPO DI TOKO KELONTONG, INFO DI BAWAH INI DISIMAK DONG :</h4>"
msginfo += '</br>'
status_x.forEach(function(entry) {
//console.log(entry)
msginfo = msginfo+ "<p class='mb-0'><span class='font-weight-bold red--text'>"+entry+"</span> belum dipilih status pengiriman</p>"
})
msginfo += '</br>'
empty_receiver.forEach(function(entry) {
msginfo = msginfo+"<p class='mb-0'><span class='font-weight-bold red--text'>"+entry+"</span> belum mengisi penerima</p>"
})
msginfo += '</br>'
this.$store.commit("patient/update_msg_info",msginfo)
this.opendialoginfo = true
}
},
status_complete(){
var arr = this.$store.state.done.transactions
console.log(arr[0].header_id)
if(arr.length > 0 && arr[0].header_id !== '0'){
var status_x = []
var empty_receiver = []
arr.forEach(function(entry) {
if(entry.received_code == 'XXX'){
status_x.push(entry.patient_fullname)
}
if(entry.receiver_name == ''){
empty_receiver.push(entry.patient_fullname)
}
})
if(status_x.length === 0 && empty_receiver.length === 0)
this.$store.commit("done/update_ready_confirm",true)
else
this.$store.commit("done/update_ready_confirm",false)
}
else{
this.$store.commit("done/update_ready_confirm",false)
}
},
},
computed: {
ready_confirm(){
return this.$store.state.done.ready_confirm
},
status_confirm(){
return this.$store.state.done.status_confirm
},
receive_status: {
get() {
return this.$store.state.patient.receive_status
},
set(val) {
this.$store.commit("patient/update_receive_status",val)
//this.searchPatient()
}
},
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()
}
},
spks(){
return this.$store.state.done.spks
},
selected_spk: {
get() {
return this.$store.state.done.selected_spk
},
set(val) {
this.$store.commit("done/update_selected_spk",val)
this.$store.dispatch("done/search",{
startdate:this.xdatestart,
spk:val.id,
lastid:-1
})
}
},
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
},
selected_patient: {
get() {
return this.$store.state.patient.selected_patient
},
set(val) {
this.$store.commit("patient/update_selected_patient",val)
}
},
patients() {
return this.$store.state.done.transactions
},
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.$store.dispatch("done/getspk",{
startdate:this.xdatestart,
spk:0,
lastid:-1
})
}
},
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,
search:'',
// summaries:[],
headers: [
{
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: "STATUS PENGIRIMAN",
align: "left",
sortable: false,
value: "name",
width: "18%",
class: "pa-2 blue lighten-3 text-xs-left white--text"
},
{
text: "PENERIMA",
align: "left",
sortable: false,
value: "name",
width: "30%",
class: "pa-2 blue lighten-3 text-xs-left white--text"
},
{
text: "PEMBAYARAN",
align: "left",
sortable: false,
value: "name",
width: "20%",
class: "pa-2 blue lighten-3 text-xs-left white--text"
}
],
};
}
}
</script>