Files
FE_CPONE/test/vuex/one-md-jpa-test/components/oneSampleCallSODetail.vue
2026-04-27 10:13:31 +07:00

218 lines
7.2 KiB
Vue

<template>
<v-layout class="fill-height" column>
<v-snackbar
v-model="snackbar"
>
{{ msg_snackbar }}
<v-btn
color="pink"
text
@click="snackbar = false"
>
tutup
</v-btn>
</v-snackbar>
<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.Nat_JPAGroupName}}
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-card>
</v-layout>
</template>
<style scoped>
.searchbox .v-input.v-text-field .v-input__slot{
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() {
this.$store.dispatch("samplesend/search",{lastid:-1})
},
methods : {
isSelected(p) {
return p.Nat_JPAGroupID == this.$store.state.samplesend.selected_patient.Nat_JPAGroupID
},
searchPatient() {
this.$store.dispatch("samplesend/search",{
lastid: -1
})
},
selectMe(pat) {
var patients = this.$store.state.samplesend.patients
this.$store.commit("samplesend/update_selected_patient",pat)
var idx = _.findIndex(patients, function(o) { return o.Nat_JpaID == pat.Nat_JpaID && o.Nat_JPAGroupID == pat.Nat_JPAGroupID })
this.$store.commit("samplesend/update_last_id",idx)
this.$store.dispatch("samplestorage/search",{
code:this.$store.state.samplestorage.code,
name: this.$store.state.samplestorage.name,
status:this.$store.state.samplestorage.selected_status.id,
jpagroup:pat.Nat_JPAGroupID,
current_page:1,
lastid:-1
})
},
xedit(value){
var patients = this.$store.state.samplesend.patients
var idx = _.findIndex(patients, function(o) { return o.Nat_JpaID == pat.Nat_JpaID && o.Nat_JPAGroupID == pat.Nat_JPAGroupID })
patients[idx].open_edit = 'Y'
this.$store.commit("samplesend/update_patients",patients)
},
saveEdit(value){
var prm = value
this.$store.dispatch("samplesend/save",prm)
},
xdelete(value){
var prm = {id:value.Nat_JPADetailID,status:'N'}
this.$store.dispatch("samplesend/save",prm)
},
insertNewJPA(){
var prm = {id:0,value:this.new_jpa}
this.$store.dispatch("samplesend/savejpagroup",prm)
},
saveJPAGroupNew(){
var prm = {id:0,value:this.value_new_jpa_group}
this.$store.dispatch("samplesend/savelistingjpagroup",prm)
},
openlisting(){
this.$store.commit("samplesend/update_dialog_jpa_group",true)
this.$store.dispatch("samplesend/search_listing",{})
},
saveEditJpaGroup(value,status){
var prm = {id:value.Nat_JPAGroupID,name:value.Nat_JPAGroupName,status:status}
this.$store.dispatch("samplesend/saveEditJpaGroup",prm)
},
changeDetail(value){
var details = this.$store.state.samplesend.patients
var idx = _.findIndex(details, function(o) { return o.Nat_JpaID == value.Nat_JpaID && o.Nat_JPAGroupID == value.Nat_JPAGroupID })
details[idx].Nat_JPADetailDiscount = value.Nat_JPADetailDiscount
this.$store.commit("samplesend/update_patients",details)
},
savedetail(){
var prm = {details:this.$store.state.samplesend.patients}
this.$store.dispatch("samplesend/savealljpadetail",prm)
},
changejpagroupinlist(value){
var details = this.$store.state.samplesend.jpa_groups
var idx = _.findIndex(details, function(o) { return o.Nat_JPAGroupID == value.Nat_JPAGroupID })
details[idx].Nat_JPAGroupName = value.Nat_JPAGroupName
this.$store.commit("samplesend/update_jpa_groups",details)
}
},
computed: {
snackbar: {
get() {
return this.$store.state.samplecall.alert_success
},
set(val) {
this.$store.commit("samplecall/update_alert_success",val)
}
},
jpagroups() {
return this.$store.state.samplesend.jpa_groups
},
value_new_jpa_group: {
get() {
return this.$store.state.samplesend.value_new_jpa_group
},
set(val) {
this.$store.commit("samplesend/update_value_new_jpa_group",val)
}
},
dialogjpagrup: {
get() {
return this.$store.state.samplesend.dialog_jpa_group
},
set(val) {
this.$store.commit("samplesend/update_dialog_jpa_group",val)
}
},
snackbar: {
get() {
return this.$store.state.samplesend.alert_success
},
set(val) {
this.$store.commit("samplesend/update_alert_success",val)
}
},
msg_snackbar: {
get() {
return this.$store.state.samplesend.msg_snackbar
},
set(val) {
this.$store.commit("samplesend/update_msg_snackbar",val)
}
},
isLoading() {
return this.$store.state.samplesend.search_status == 1
},
patients() {
return this.$store.state.samplesend.patients
},
xselectedpatient: {
get() {
return this.$store.state.samplesend.selected_patient
},
set(val) {
this.$store.commit("samplesend/update_selected_patient",val)
}
},
new_jpa: {
get() {
return this.$store.state.samplesend.new_jpa
},
set(val) {
this.$store.commit("samplesend/update_new_jpa",val)
}
},
},
data() {
return {
open_edit:false,
msgalertconfirmation:"Perubahan yang telah dilakukan belum disimpan dong !",
items: [],
page:1,
headers: [
{
text: "JPA GRUP",
align: "left",
sortable: false,
value: "mr",
width: "100%",
class: "pa-2 blue lighten-3 white--text"
}
]
}
}
}
</script>