Files
FE_CPONE/test/vuex/one-sample-lab-pre-analitic/components/oneResultEntrySoList.vue
2026-04-27 10:13:31 +07:00

506 lines
18 KiB
Vue

<template>
<v-layout class="fill-height" column>
<v-dialog v-model="dialogsuccess" persistent max-width="350">
<v-card>
<v-card-title color="success" class="headline">Berhasil !</v-card-title>
<v-card-text v-html="msgsuccess">
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="green darken-1" flat @click="closeDialogSuccess">OK</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="dialogrequirement" persistent max-width="45%">
<v-card>
<v-card-title color="success" class="headline">Pilih yang tidak terpenuhi</v-card-title>
<v-card-text>
<v-layout wrap>
<v-flex v-for="(req,idx) in requirements" xs6>
<one-x-check
:xdatalabel="req.name"
:xdatacbx="req.chex"
@update-data-cbx="(val) =>checkReq(val,idx)"
></one-x-check>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="grey darken-1" flat @click="dialogrequirement = false">Tutup</v-btn>
<v-btn color="green darken-1" flat @click="save()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-card class="mb-2 pa-2 searchbox">
<v-layout row >
<v-menu class="xs3 pr-2"
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
class="mt-1"
v-model="filterComputedDateFormattedStart"
label="Tanggal Hari ini"
outline
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-select class="xs3 mini-select ma-1" :items="xstations"
item-text="name"
return-object
v-model="xselectedstation"
label="Status" outline hide-details></v-select>
<!--<v-btn class="xs3 ma-1" color="success" @click="searchTransaction" >Cari</v-btn>-->
<!-- <span @click="searchTransaction" 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="xtransactions"
:loading="isLoading"
hide-actions
class="elevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-left pa-1" v-bind:class="{'teal white--text':props.item.status === 'Y'}">{{ props.item.testname }}</td>
<td class="text-xs-left pa-1" v-bind:class="{'teal white--text':props.item.status === 'Y'}">
<v-layout v-if="props.item.status == 'X'" row>
<span @click="notok(props.item)" class="icon-medium-fill-base-small white"><v-icon >close</v-icon></span>
<span @click="ok(props.item)" class="icon-medium-fill-base-small white"><v-icon >check</v-icon></span>
</v-layout>
<span v-if="props.item.status === 'N'" >
<v-chip style="margin:1px!important" v-for="xxval in props.item.htmlreqs"
class="ma-2"
color="pink"
label
text-color="white"
>
<v-icon left>close</v-icon>
{{xxval}}
</v-chip>
</span>
<span v-if="props.item.status === 'Y'"></span>
</td>
<td class="text-xs-center pa-1" v-bind:class="{'teal white--text':props.item.status === 'Y'}" >{{ props.item.verifiedtime}}</td>
<td class="text-xs-center pa-1" v-bind:class="{'teal white--text':props.item.status === 'Y'}" >{{ props.item.verifiedby}}</td>
</template>
</v-data-table>
<v-divider></v-divider>
<v-pagination
style="margin-top:10px;margin-bottom:5px"
v-model="curr_page"
:length="xtotal_page"
></v-pagination>
</v-flex>
</v-layout>
</v-card>
<one-dialog-alert :status="openalertconfirmation" :msg="msgalertconfirmation" @forget-dialog-alert="forgetAlertConfirmation()" @close-dialog-alert="closeAlertConfirmation()"></one-dialog-alert>
<one-dialog-info :status="opendialoginfo" :msg="msginfo" @close-dialog-info="closeDialogInfo()"></one-dialog-info>
</v-layout>
</template>
<style scoped>
.searchbox .v-input.v-text-field .v-input__slot{
min-height:60px;
}
.searchbox .v-btn {
min-height:60px;
}
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'),
'one-x-check':httpVueLoader('../../common/onexcheck.vue')
},
mounted() {
var prm = {
startdate:this.xdatestart,
stationid:this.xselectedstation.id,
current_page:1,
lastid:-1
}
this.$store.dispatch("sample/search",prm)
this.$store.dispatch("sample/getrequirements")
},
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.status
},
searchTransaction() {
this.$store.dispatch("sample/search",{
startdate:this.xdatestart,
stationid:this.xselectedstation.id,
current_page:1,
lastid:-1
})
},
selectMe(trx) {
if(this.$store.state.sample.no_save == 0 ){
//console.log(trx)
this.$store.commit("sample/update_selected_transaction",trx)
this.$store.commit("sample/update_act",'edit')
if(trx.details.length > 0 ){
this.$store.commit("sample/update_details", trx.details)
}
else{
this.$store.commit("sample/update_details", [])
}
}else{
this.$store.commit("sample/update_open_alert_confirmation",true)
}
},
closeAlertConfirmation(){
this.$store.commit("sample/update_open_alert_confirmation",false)
},
forgetAlertConfirmation(){
this.$store.commit("sample/update_no_save",0)
this.$store.commit("sample/update_open_alert_confirmation",false)
},
updateAlert_success(val){
this.$store.commit("sample/update_alert_success",val)
},
setNewTransaction(){
this.$store.commit("sample/update_selected_transaction",{})
this.$store.commit("sample/update_details",[])
this.$store.commit("sample/update_selected_detail",{})
this.$store.commit("sample/update_selected_doctor",{})
this.$store.commit("sample/update_selected_doctor_address",{})
this.$store.commit("sample/update_selected_courier",{})
this.$store.commit("sample/update_trx_date",moment(new Date()).format('YYYY-MM-DD'))
this.$store.commit("sample/update_trx_note",'')
this.$store.commit("sample/update_act",'new')
},
closeDialogSuccess(){
let arrtrx = this.$store.state.sample.transactions
var idx = _.findIndex(arrtrx, item => item.trx_id === this.$store.state.sample.last_id)
console.log(idx)
this.$store.dispatch("sample/search",{
startdate:this.xdatestart,
enddate: this.xdateend,
search:this.xnamelab,
stationid:this.xselectedstation.id,
groupid:this.$store.state.sample.select_item_group.id,
subgroupid:this.$store.state.sample.select_item_subgroup.id,
lastid:idx
})
this.$store.commit("sample/update_dialog_success",false)
},
closeDialogInfo(){
this.$store.commit("sample/update_open_dialog_info",false)
},
selectgroup(value){
this.selected_itemgroup = value
},
selectsubgroup(value){
this.selected_itemsubgroup = value
},
checkReq(val,idx){
var xrequirements = this.requirements
xrequirements[idx].chex = val
this.$store.commit("sample/update_requirements",xrequirements)
},
notok(value){
this.selected_test = value
this.$store.commit("sample/update_act",'N')
var requirements = this.requirements
_.forEach(requirements, function(value,key) {
requirements[key]['chex'] = 'N'
});
this.requirements = requirements
this.dialogrequirement = true
},
ok(value){
this.selected_test = value
this.$store.commit("sample/update_act",'Y')
this.save()
},
save(){
var act = this.$store.state.sample.act
var goaction = true
if(act === 'N'){
var requirements = this.requirements
var filtered = _.filter(requirements, function(o) { return o.chex === 'Y' })
if(filtered.length === 0)
goaction = false
}
if(goaction){
var prm = this.selected_test
prm.requirements = this.requirements
prm.status = act
prm.search = {
startdate:this.xdatestart,
stationid:this.xselectedstation.id,
current_page:this.$store.state.sample.current_page,
lastid:-1
}
this.$store.dispatch("sample/save",prm)
}
},
},
computed: {
dialogsuccess: {
get() {
return this.$store.state.sample.dialog_success
},
set(val) {
this.$store.commit("sample/update_dialog_success",val)
}
},
msgsuccess(){
return this.$store.state.sample.msg_success
},
snackbar: {
get() {
return this.$store.state.sample.alert_success
},
set(val) {
this.$store.commit("sample/update_alert_success",val)
}
},
isLoading() {
return this.$store.state.sample.search_status == 1
},
itemgroups() {
return this.$store.state.sample.item_groups
},
selected_itemgroupname() {
return this.$store.state.sample.selected_itemgroupname
},
selected_itemgroup: {
get() {
//console.log(this.$store.state.sample.select_item_group)
return this.$store.state.sample.select_item_group
},
set(val) {
this.$store.commit("sample/update_select_item_group",val)
this.$store.commit("sample/update_selected_itemgroupname",val.fulltitle)
this.$store.commit("sample/update_item_subgroups",val.childrens)
this.$store.commit("sample/update_select_item_subgroup",val.childrens[0])
this.$store.commit("sample/update_selected_itemsubgroupname",val.childrens[0].fulltitle)
}
},
itemsubgroups() {
return this.$store.state.sample.item_subgroups
},
selected_itemsubgroupname() {
return this.$store.state.sample.selected_itemsubgroupname
},
selected_itemsubgroup: {
get() {
return this.$store.state.sample.select_item_subgroup
},
set(val) {
this.$store.commit("sample/update_select_item_subgroup",val)
this.$store.commit("sample/update_selected_itemsubgroupname",val.fulltitle)
}
},
xdatestart : {
get() {
return this.$store.state.sample.start_date
},
set(val) {
this.$store.commit("sample/update_start_date",val)
this.searchTransaction()
}
},
xdateend : {
get() {
return this.$store.state.sample.end_date
},
set(val) {
this.$store.commit("sample/update_end_date",val)
}
},
xnamelab : {
get() {
return this.$store.state.sample.name_lab
},
set(val) {
this.$store.commit("sample/update_name_lab",val)
}
},
filterComputedDateFormattedStart () {
return this.formatDate(this.xdatestart)
},
filterComputedDateFormattedEnd () {
return this.formatDate(this.xdateend)
},
xstations() {
return this.$store.state.sample.stations
},
xselectedstation: {
get() {
return this.$store.state.sample.selected_station
},
set(val) {
this.$store.commit("sample/update_selected_station",val)
this.searchTransaction()
}
},
xtransactions() {
//console.log(this.$store.state.sample.transactions)
return this.$store.state.sample.transactions
},
openalertconfirmation: {
get() {
return this.$store.state.sample.open_alert_confirmation
},
set(val) {
this.$store.commit("sample/update_open_alert_confirmation",val)
}
},
opendialoginfo: {
get() {
return this.$store.state.sample.open_dialog_info
},
set(val) {
this.$store.commit("sample/update_open_dialog_info",false)
}
},
msginfo(){
return this.$store.state.sample.msg_info
},
curr_page: {
get() {
return this.$store.state.sample.current_page
},
set(val) {
this.$store.commit("sample/update_current_page",val)
this.$store.dispatch("sample/search",{
startdate:this.xdatestart,
stationid:this.xselectedstation.id,
current_page:val,
lastid:-1
})
}
},
xtotal_page: {
get() {
return this.$store.state.sample.total_page
},
set(val) {
this.$store.commit("sample/update_total_page",val)
}
},
dialogrequirement: {
get() {
return this.$store.state.sample.dialog_requirement
},
set(val) {
this.$store.commit("sample/update_dialog_requirement",val)
}
},
requirements: {
get() {
return this.$store.state.sample.requirements
},
set(val) {
this.$store.commit("sample/update_requirements",val)
}
},
selected_test: {
get() {
return this.$store.state.sample.selected_test
},
set(val) {
this.$store.commit("sample/update_selected_test",val)
}
},
},
data() {
return {
msgalertconfirmation:"Perubahan yang telah dilakukan belum disimpan dong !",
menufilterdatestart:false,
menufilterdateend:false,
date: new Date().toISOString().substr(0, 10),
items: [],
name: '',
page:1,
headers: [
{
text: "NAMA TEST",
align: "left",
sortable: false,
width: "20%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "STATUS VERIFIKASI",
align: "center",
sortable: false,
width: "60%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "WAKTU VERIFIKASI",
align: "center",
sortable: false,
width: "10%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "DIVERIFIKASI OLEH",
align: "center",
sortable: false,
width: "10%",
class: "pa-2 blue lighten-3 white--text"
}
],
pagination:{
descending: false,
page: 1,
rowsPerPage: 5,
sortBy: 'trx_id ASC',
totalItems: this.$store.state.sample.total_transactions
}
};
}
}
</script>