Files
FE_CPONE/fo/one-fo-supervisor-v1/components/oneFoSupervisorDialogTest.vue
2026-04-27 10:13:31 +07:00

674 lines
29 KiB
Vue

<template>
<v-layout row justify-center>
<v-dialog
v-model="promisedialog"
persistent
max-width="30%"
>
<v-card>
<v-card-title
class="headline darken-1 pt-2 pb-2"
primary-title
>
Konfirmasi
</v-card-title>
<v-card-text class="pt-2 pb-2">
<v-layout row>
<v-flex xs12 d-flex>
<v-layout row>
<v-flex pb-1 v-html="msgdialogpromise" xs12>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="black"
flat
@click="promisedialog = false"
>
Tutup
</v-btn>
<v-btn
color="purple"
flat
@click="closeDialogPromise()"
>
Lanjutkan
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="testdialog" persistent max-width="40%">
<v-card>
<v-card-title
dark
class="headline purple pt-2 pb-2"
primary-title
style="color:white"
>
<h4>Pemeriksaan</h4>
</v-card-title>
<v-card-text class="pt-2 pb-2">
<v-layout pa-2 row wrap>
<!--<v-flex xs7 pr-1>
<v-card elevation="1">
<v-layout pa-2>
<v-flex xs12 pa-2>
<v-layout row>
<v-flex xs12 mb-2>
<h4 class="mb-1">Pemeriksaan Register</h4>
<v-data-table
:headers="headers"
:items="testsregistration"
:loading="isLoading"
hide-actions class="elevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-center pa-2" >
<v-icon v-if="props.item.status === 'Y'" color="success" left>check</v-icon>
<v-icon v-if="props.item.status === 'N'" color="error" left>close</v-icon>
</td>
<td class="text-xs-center pa-2" >
<v-icon v-if="props.item.cito === 'Y'" color="success" left>check</v-icon>
<v-icon v-if="props.item.cito === 'N'" color="error" left>close</v-icon>
</td>
<td class="text-xs-left pa-2" >{{ props.item.testname }}</td>
<td class="text-xs-center pa-2">{{ convertMoney(props.item.bruto) }}</td>
<td class="text-xs-center pa-2">{{ convertMoney(props.item.discount) }}</td>
<td class="text-xs-center pa-2">{{ convertMoney(props.item.total) }}</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-layout v-if="savestatusverification !== 2" row>
<v-flex pt-2 xs4>
<h4 class="mb-1">Tambahan verifikasi</h4>
</v-flex>
<v-flex style="text-align:right" pt-1 xs8>
<v-btn style="margin-right:0" v-if="testsverification.length > 0" @click="checkPromiseOrderVerification()" small color="primary" dark>Simpan</v-btn>
</v-flex>
</v-layout>
<v-layout v-if="savestatusverification !== 2" row>
<v-flex xs12>
<v-data-table
:headers="headerverifications"
:items="testsverification"
:loading="isLoading"
hide-actions class="elevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-center pa-2" >
<v-icon v-if="props.item.status === 'Y'" color="success" left>check</v-icon>
<v-icon v-if="props.item.status === 'N'" color="error" left>close</v-icon>
</td>
<td class="text-xs-center pa-2" >
<v-icon v-if="props.item.cito === 'Y'" color="success" left>check</v-icon>
<v-icon v-if="props.item.cito === 'N'" color="error" left>close</v-icon>
</td>
<td class="text-xs-left pa-2" >{{ props.item.testname }}</td>
<td class="text-xs-center pa-2">{{ convertMoney(props.item.bruto) }}</td>
<td class="text-xs-center pa-2">{{ convertMoney(props.item.discount) }}</td>
<td class="text-xs-center pa-2">{{ convertMoney(props.item.total) }}</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-flex>
</v-card>
</v-flex>-->
<v-flex xs12 pl-1>
<v-card elevation="1">
<v-flex xs12 mb-2 pa-2>
<v-layout row>
<v-flex pt-2 xs4>
<h4 class="mb-1">Tambah Pemeriksaan</h4>
</v-flex>
<v-flex style="text-align:right" pt-1 xs8>
<v-progress-circular v-if="getdatastatus === 1"
indeterminate
color="primary"
></v-progress-circular>
<v-btn v-if="getdatastatus !== 1" style="margin-right:0" @click="checkPromiseOrderAdd()" small color="primary" dark>Simpan</v-btn>
<p><code v-if="vmsgsave">Sudah diperbarui</code></p>
</v-flex>
</v-layout>
<!--<v-layout row>
<v-flex xs12>
<v-checkbox
label="Cito ? "
v-model="vcito"
></v-checkbox>
</v-flex>
</v-layout>-->
<v-layout row>
<v-flex pr-1 xs8>
<v-autocomplete
label="Pemeriksaan"
v-model="vtest"
:items="vtests"
:search-input.sync="search_test"
auto-select-first
no-filter
item-text="pxname"
return-object
:loading="isLoading"
no-data-text="Cari Pemeriksaan ..."
>
<template
slot="item"
slot-scope="{ item }"
>
<v-list-tile-content>
<v-list-tile-title v-text="item.pxname"></v-list-tile-title>
</v-list-tile-content>
</template>
</v-autocomplete>
</v-flex>
<v-flex class="xs4 offset-2 text-sm-right">
<v-btn
color="primary"
@click="addTestToAll()"
>
Tambahkan
</v-btn>
</v-flex>
</v-layout>
</v-flex>
</v-card>
<v-card elevation="1">
<v-flex xs12 pa-2>
<v-layout row>
<v-flex xs12>
<h4 class="mb-1">Order Pemeriksaan</h4>
<v-data-table
:headers="headers"
:items="testsall"
:loading="isLoading"
hide-actions class="elevation-1">
<template slot="items" slot-scope="props">
<tr @click="changeTestAll(props.item)">
<td class="text-xs-center pa-2 pl-2" >
<v-checkbox primary hide-details @change="changeTestAll(props.item)" v-model="props.item.status"></v-checkbox>
</td>
<td class="text-xs-center pa-2" >
<v-icon v-if="props.item.cito === 'Y'" color="success" left>check</v-icon>
<v-icon v-if="props.item.cito === 'N'" color="error" left>close</v-icon>
</td>
<td class="text-xs-left pa-2" >{{ props.item.testname }}</td>
<td class="text-xs-center pa-2">{{ convertMoney(props.item.bruto) }}</td>
<td class="text-xs-center pa-2">{{ convertMoney(props.item.discount) }}</td>
<td class="text-xs-center pa-2">{{ convertMoney(props.item.total) }}</td>
</tr>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-flex>
</v-card>
</v-flex>
</v-layout>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
flat
@click="closeDialogOrder"
>
Tutup
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<one-dialog-error :status="opendialogerror" :msg="msgerror" @close-dialog-error="opendialogerror = false"></one-dialog-error>
</v-layout>
</template>
<style scoped>
table {
font-family: arial, sans-serif;
btest-collapse: collapse;
width: 100%;
background:white;
btest: 1px solid #ddd!important;
}
th, td {
padding: .75rem 1.25rem;
btest: 1px solid #ddd!important;
}
table>tr>td {
padding: .75rem 1.25rem;
btest: 1px solid #ddd!important;
}
table>tr>td:first {
padding-left:15px!important;
}
</style>
<script>
module.exports = {
components : {
'one-dialog-error':httpVueLoader('../../../common/oneDialogErrorFajri.vue')
},
data () {
return {
printwidth:600,
search_test:'',
is_loading:false,
isLoading:false,
error_promise:false,
error_promise_dialog:false,
selected_promise:{},
opendialogerror:false,
msgerror:"",
promiseright:'-',
headers: [
{
text: "STATUS",
align: "center",
sortable: false,
value: "status",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "CITO",
align: "center",
sortable: false,
value: "cito",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "PEMERIKSAAN",
align: "left",
sortable: false,
value: "testname",
width: "20%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "BRUTO",
align: "center",
sortable: false,
value: "bruto",
width: "20%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "DISKON",
align: "center",
sortable: false,
value: "discount",
width: "20%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "TOTAL",
align: "center",
sortable: false,
value: "total",
width: "20%",
class: "pa-2 blue lighten-3 white--text"
}
],
headerverifications :[
{
text: "STATUS",
align: "center",
sortable: false,
value: "status",
width: "7%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "CITO",
align: "center",
sortable: false,
value: "cito",
width: "7%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "PEMERIKSAAN",
align: "left",
sortable: false,
value: "testname",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "BRUTO",
align: "center",
sortable: false,
value: "bruto",
width: "10%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "DISKON",
align: "center",
sortable: false,
value: "discount",
width: "10%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "TOTAL",
align: "center",
sortable: false,
value: "total",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
}
]
}
},
computed: {
testdialog:{
get() {
return this.$store.state.test.test_dialog
},
set(val) {
this.$store.commit("test/update_test_dialog",val)
}
},
savestatusverification(){
return this.$store.state.test.save_status_verification
},
vmsgsave(){
return this.$store.state.test.save_message
},
vstatussave(){
return this.$store.state.test.save_status
},
testsregistration(){
return this.$store.state.test.test_registration
},
testsverification(){
return this.$store.state.test.test_verification
},
testsall(){
return this.$store.state.test.test_all
},
vtests(){
return this.$store.state.test.tests
},
vtest:{
get() {
return this.$store.state.test.test
},
set(val) {
this.$store.commit("test/update_test",val)
console.log(val.promise)
this.promiseright = val.promise
this.$store.commit("test/update_show_promise_right",true)
}
},
vcito:{
get() {
return this.$store.state.test.cito
},
set(val) {
this.$store.commit("test/update_cito",val)
}
},
xpromises(){
return this.$store.state.test.promises
},
xpromise:{
get() {
return this.$store.state.test.promise
},
set(val) {
this.$store.commit("test/update_promise",val)
}
},
promisedialog:{
get() {
return this.$store.state.test.promise_dialog
},
set(val) {
this.$store.commit("test/update_promise_dialog",val)
}
},
msgdialogpromise:{
get() {
return this.$store.state.test.msg_promise_dialog
},
set(val) {
this.$store.commit("test/update_msg_promise_dialog",val)
}
},
showpromiseleft:{
get() {
return this.$store.state.test.show_promise_left
},
set(val) {
this.$store.commit("test/update_show_promise_left",val)
}
},
showpromiseright:{
get() {
return this.$store.state.test.show_promise_right
},
set(val) {
this.$store.commit("test/update_show_promise_right",val)
}
},
promiseleft:{
get() {
return this.$store.state.test.promise_left
},
set(val) {
this.$store.commit("test/update_promise_left",val)
}
},
getdatastatus:{
get() {
return this.$store.state.test.save_status
},
set(val) {
this.$store.commit("test/update_save_status",val)
}
},
},
methods : {
convertMoney(money){
return one_money(money)
},
saveTestAdditionVerification(){
let arrtest = this.$store.state.test.test_verification
var prm = {
orderid:this.$store.state.patient.selected_patient.orderid,
tests:arrtest
}
this.$store.dispatch("test/savetestadditionalverification",prm)
},
changePromise(value){
let arrtest = this.$store.state.test.test_verification
var idx = _.findIndex(arrtest, item => item.idx === value.idx)
arrtest[idx]['promise'] = value.promise
this.$store.commit("test/update_test_verification",arrtest)
},
closeDialogOrder(){
if(this.savestatus !== 2){
this.$store.commit("test/update_test_dialog",false)
}
else{
let arrpatient = this.$store.state.patient.patients
var idx = _.findIndex(arrpatient, item => item.idx === this.$store.state.patient.selected_patient.idx)
console.log(idx)
this.$store.dispatch("patient/search",{
search: this.$store.state.patient.search,
status: this.$store.state.patient.selected_status.value,
lastidx:idx
})
this.$store.commit("test/update_test_dialog",false)
}
},
changeTestAll(value){
var oldArr = this.$store.state.test.test_all
var idx = _.findIndex(oldArr, value)
var olstatus = oldArr[idx].status
oldArr[idx].status = olstatus == false ? true : false
this.$store.commit("test/update_test_all",oldArr)
},
thr_search_test: _.debounce( function () {
var oldArr = this.$store.state.test.test_all
this.promiseright = '-'
var filtertest = _.filter(oldArr, function(o) { return o.status === true || o.status === 'Y' })
var prm = {
orderid:this.$store.state.patient.selected_patient.orderid,
search: this.search_test,
cito:this.$store.state.test.cito,
filtertest:filtertest
}
this.$store.dispatch("test/searchtest",prm)
},2000),
addTestToAll(){
var xtestall = this.$store.state.test.test_all
var xtestadditional = this.$store.state.test.test
var xnew = {
xid:0,
type:xtestadditional.type,
status:'Y',
cito:xtestadditional.flagcito,
testid:xtestadditional.pxid,
testcode:xtestadditional.pxcode,
testsascode:xtestadditional.pxsascode,
testname:xtestadditional.pxname,
isresult:xtestadditional.isresult,
bruto:xtestadditional.bruto,
discount:xtestadditional.discounttotal,
discountpersen:xtestadditional.discount,
discountrp:xtestadditional.discountrp,
total:xtestadditional.total
}
console.log(xtestadditional)
console.log(xnew.type)
if(xnew.type === 'PN' || xnew.type === 'SINGLE'){
xtestall.push(xnew)
this.$store.commit("test/update_test_all",xtestall)
this.$store.commit("test/update_test",{})
}
if(xnew.type === 'PR'){
xnew.orderid = this.$store.state.patient.selected_patient.orderid
var params = {all:xtestall,new:xnew}
this.$store.dispatch("test/getchildrenprofil",params)
}
if(xnew.type === 'SINGLE-PR'){
var child_test = JSON.parse(xtestadditional.child_test)
console.log(child_test)
child_test.forEach(item => {
var xxnew = {
xid:0,
type:'SINGLE',
status:'Y',
cito:'N',
testid:item.pxid,
testcode:item.pxcode,
testsascode:item.pxsascode,
testname:item.pxname,
isresult:item.isresult,
bruto:item.bruto,
discount:item.discounttotal,
discountpersen:item.discount,
discountrp:item.discountrp,
total:item.total
}
xtestall.push(xxnew)
})
this.$store.commit("test/update_test_all",xtestall)
this.$store.commit("test/update_test",{})
}
},
saveTestAdditional(){
var prm = {
orderid:this.$store.state.patient.selected_patient.orderid,
testall: this.$store.state.test.test_all
}
this.$store.dispatch("test/savetestadditional",prm)
},
checkPromiseOrderAdd(){
this.$store.commit("test/update_act",'additional')
var prm = {
orderid:this.$store.state.patient.selected_patient.orderid,
tests: this.$store.state.test.test_all
}
this.$store.dispatch("test/checkpromisetests",prm)
},
checkPromiseOrderVerification(){
this.$store.commit("test/update_act",'verification')
var prm = {
orderid:this.$store.state.patient.selected_patient.orderid,
tests: this.$store.state.test.test_verification
}
this.$store.dispatch("test/checkpromisetests",prm)
},
openDialogPromise(value){
this.error_promise_dialog = false
this.selected_promise = {}
this.$store.commit("test/update_selected_detail_verification",value)
this.promisedialog = true
},
addPromiseTodetail(){
if(this.selected_promise){
let arrtest = this.$store.state.test.test_verification
console.log(arrtest)
var idx = _.findIndex(arrtest, item => item.idx === this.$store.state.test.selected_detail_verification.idx)
arrtest[idx]['promise'] = this.selected_promise.id
arrtest[idx]['promisename'] = this.selected_promise.name
this.$store.commit("test/update_test_verification",arrtest)
this.promisedialog = false
}
else{
this.error_promise_dialog = true
}
},
closeDialogPromise(){
var act = this.$store.state.test.act
this.promisedialog = false
if(act === 'additional')
this.saveTestAdditional()
else
this.saveTestAdditionVerification()
}
},
watch: {
search_test(val,old) {
if (val == old ) return
if (! val) return
if (val.length < 1 ) return
if (this.$store.state.test.autocomplete_status == 1 ) return
this.thr_search_test()
}
}
}
</script>