Files
FE_CPONE/test/vuex/one-fo-cashier/components/oneFoCashierList.vue
2026-04-27 10:13:31 +07:00

330 lines
11 KiB
Vue

<template>
<v-layout class="fill-height" column>
<v-card class="mb-2 pa-2 searchbox">
<v-layout >
<v-menu
ref="menustartdate"
v-model="menustartdate"
:close-on-content-click="false"
:nudge-right="0"
lazy
transition="scale-transition"
offset-y
full-width
max-width="290px"
min-width="290px"
>
<template v-slot:activator="{ on }">
<v-text-field
v-model="startDateFormatted"
label="Tanggal Awal"
readonly
hide-details
class="xs3 ma-1"
outline
v-on="on"
@blur="deFormatedDate(startDateFormatted)"
></v-text-field>
</template>
<v-date-picker v-model="xstartdate" no-title @input="menustartdate = false"></v-date-picker>
</v-menu>
<v-menu
ref="menuenddate"
v-model="menuenddate"
:close-on-content-click="false"
:nudge-right="0"
lazy
transition="scale-transition"
offset-y
full-width
max-width="290px"
min-width="290px"
>
<template v-slot:activator="{ on }">
<v-text-field
v-model="endDateFormatted"
label="Tanggal Akhir"
hide-details
outline
class="xs3 ma-1"
readonly
v-on="on"
@blur="deFormatedDate(endDateFormatted)"
></v-text-field>
</template>
<v-date-picker v-model="xenddate" no-title @input="menuenddate = false"></v-date-picker>
</v-menu>
<v-text-field class="xs3 ma-1"
label=""
placeholder="Nama / No lab"
single-line
outline
v-model="searchnamelab"
hide-details
></v-text-field>
<v-select class="xs3 mini-select ma-1" :items="statuses"
item-text="name"
return-object
v-model="status"
label="Status" outline hide-details></v-select>
<span @click="searchPatient" class="icon-medium-fill-base xs1 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="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="pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.T_OrderHeaderLabNumber}}</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-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.M_CompanyName}} : {{ props.item.M_MouName}}</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="openalertnopay" :msg="msgalertnopay" @forget-dialog-alert="forgetAlertNoPay()" @close-dialog-alert="closeAlertNoPay()"></one-dialog-alert>
</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;
}
.v-messages{
min-height:0px!important;
}
</style>
<script>
module.exports = {
components : {
'one-dialog-info':httpVueLoader('../../common/oneDialogInfo.vue'),
'one-dialog-alert':httpVueLoader('../../common/oneDialogAlert.vue')
},
mounted() {
this.$store.dispatch("patient/search",{
startdate:this.xstartdate,
enddate:this.xenddate,
search: this.searchnamelab,
status: this.status.value,
current_page:1,
lastidx:0
})
},
methods : {
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')}`
},
isSelected(p) {
return p.T_OrderHeaderID == this.$store.state.patient.selected_patient.T_OrderHeaderID
},
searchPatient() {
this.$store.dispatch("patient/search",{
startdate:this.xstartdate,
enddate:this.xenddate,
search:this.searchnamelab,
status: this.status.value,
current_page:1,
lastidx:0
})
},
selectMe(pat) {
let totpay = this.$store.state.payment.total_payment
if(totpay === 0){
let xobj = this.$store.state.payment.types
xobj.forEach(function(obj){
obj.leftvalue = 0
obj.rightvalue = 0
})
this.$store.commit("payment/update_types",{records :xobj,total:xobj.length })
this.$store.commit("patient/update_selected_patient",pat)
this.$store.commit("payment/update_total_payment",0)
this.$store.commit("payment/update_notes",pat.notes)
}
else{
this.$store.commit("patient/update_open_alert_no_pay",true)
}
},
closeAlertNoPay(){
this.$store.commit("patient/update_open_alert_no_pay",false)
},
forgetAlertNoPay(){
var xval = this.$store.state.payment.types
var valpay = 0
xval.forEach(function(obj){
obj.leftvalue = 0
obj.rightvalue = 0
})
this.$store.commit("payment/update_total_payment",0)
this.$store.commit("patient/update_open_alert_no_pay",false)
}
},
computed: {
xstartdate:{
get() {
return this.$store.state.patient.start_date
},
set(val) {
this.$store.commit("patient/update_start_date",val)
}
},
xenddate:{
get() {
return this.$store.state.patient.end_date
},
set(val) {
this.$store.commit("patient/update_end_date",val)
}
},
searchnamelab:{
get() {
return this.$store.state.patient.search
},
set(val) {
this.$store.commit("patient/update_search",val)
}
},
statuses(){
return this.$store.state.patient.statuses
},
status:{
get() {
return this.$store.state.patient.selected_status
},
set(val) {
this.$store.commit("patient/update_selected_status",val)
}
},
startDateFormatted () {
return this.formatDate(this.xstartdate)
},
endDateFormatted () {
return this.formatDate(this.xenddate)
},
isLoading() {
return this.$store.state.patient.search_status == 1
},
patients() {
return this.$store.state.patient.patients
},
openalertnopay:{
get() {
return this.$store.state.patient.open_alert_no_pay
},
set(val) {
this.$store.commit("patient/update_open_alert_no_pay",false)
}
},
msgalertnopay(){
return this.$store.state.patient.msg_alert_no_pay
},
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.xstartdate,
enddate:this.xenddate,
search: this.searchnamelab,
status: this.status.value,
current_page:val,
lastidx:0
})
}
},
xtotal_page: {
get() {
return this.$store.state.patient.total_page
},
set(val) {
this.$store.commit("patient/update_total_page",val)
}
},
},
data() {
return {
items: [],
menustartdate:false,
menuenddate:false,
headers: [
{
text: "PID",
align: "left",
sortable: false,
value: "mr",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "NO LAB",
align: "left",
sortable: false,
value: "lab",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "NAMA",
align: "left",
sortable: false,
value: "name",
width: "20%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "KEL.PELANGGAN / AGREEMENT",
align: "left",
sortable: false,
value: "status",
width: "20%",
class: "pa-2 blue lighten-3 white--text"
}
],
}
}
}
</script>