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

429 lines
18 KiB
Vue

<template>
<v-layout v-if="xact !== 'new'" column>
<v-dialog v-model="dialogconfirmationdeletepat" persistent max-width="290">
<v-card>
<v-card-title dark class="headline error pt-2 pb-2" primary-title style="color:white">
<h4 dark>Konfirmasi</h4>
</v-card-title>
<v-card-text>
{{msgconfirmationdeletepat}}
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn small color="error darken-1 text-sm-left" flat @click="doDeletePat()">Hapus</v-btn>
<v-btn small color="primary darken-1 text-sm-right" flat @click="dialogconfirmationdeletepat = false">Batal</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="dialogconfirmationsend" persistent max-width="290">
<v-card>
<v-card-title dark class="headline success pt-2 pb-2" primary-title style="color:white">
<h4 dark>Konfirmasi</h4>
</v-card-title>
<v-card-text>
{{msgconfirmationsend}}
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn small color="success darken-1 text-sm-left" flat @click="doOrderMethode()">Kirim</v-btn>
<v-btn small color="primary darken-1 text-sm-right" flat @click="dialogconfirmationsend = false">Batal</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="dialogformpricemou" persistent max-width="650">
<v-card>
<v-card-title>
<span class="headline">Form Methode Pemeriksaan {{xtestprices.Nat_TestName}}</span>
</v-card-title>
<v-card-text class="pt-0 pb-0">
<v-layout wrap>
<v-flex xs12>
<v-select item-text="Nat_MethodeName" readonly return-object :items="xpricemoues" v-model="xpricemou" label="Metode"></v-select>
</v-flex>
<v-flex xs12>
<v-text-field label="Prioritas" v-model="xpriority"></v-text-field>
</v-flex>
<v-flex xs12>
<v-btn class="mt-1 mb-2" v-for="(vst,idx) in xorderdays" :key="vst.id" @click="changeDay(idx)" small :color="vst.isday === 'N' ? 'yellow' : 'green'">{{vst.M_DayOfWeekName}}
</v-btn>
</v-flex>
</v-layout>
<v-layout row>
</v-layout>
<v-divider></v-divider>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" flat @click="dialogformpricemou = false">Tutup</v-btn>
<v-btn v-if="xactpat === 'new'" color="blue darken-1" flat @click="saveNewMethode()">Simpan</v-btn>
<v-btn v-if="xactpat === 'edit'" color="blue darken-1" flat @click="saveEditMethode()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-card>
<v-layout row>
<v-flex xs12>
<v-subheader red--text text--lighten-1> DAFTAR HARGA PEMERIKSAAN {{xtestprices.T_TestName}}
<v-flex text-md-right>
</v-flex>
</v-subheader>
<v-divider></v-divider>
<v-layout row wrap>
<v-flex xs12 pa-2>
<v-data-table :headers="headers" :items="xpricemous" :loading="isLoading" hide-actions class="elevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-left pa-2">{{ props.item.M_CompanyName}}</td>
<td class="text-xs-left pa-2">{{ props.item.M_MouName}}
</td>
<td class="text-xs-left pa-2">{{ props.item.T_PriceIsCito}}
</td>
<td class="text-xs-left pa-2">{{ props.item.periode}}</td>
<td class="text-xs-left pa-2">{{ props.item.T_PricePriority}}
</td>
<td class="text-xs-left pa-2">{{ props.item.T_PriceTotal}}
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-layout row wrap>
<v-flex xs12 pa-2>
</v-flex>
</v-layout>
</v-flex>
</v-flex>
</v-card>
</v-layout>
</template>
<style scoped>
</style>
<script>
module.exports = {
data: () => ({
oldlabel: '',
search_day: '',
xpriority: '',
headers: [
{
text: "PERUSAHAAN",
align: "left",
sortable: false,
value: "mr",
width: "20%",
class: "pa-1 blue lighten-3 white--text"
},
{
text: "AGREEMENT",
align: "left",
sortable: false,
value: "lab",
width: "20%",
class: "pa-1 blue lighten-3 white--text"
},
{
text: "CITO",
align: "left",
sortable: false,
value: "lab",
width: "10%",
class: "pa-1 blue lighten-3 white--text"
},
{
text: "PERIODE",
align: "left",
sortable: false,
value: "lab",
width: "20%",
class: "pa-1 blue lighten-3 white--text"
},
{
text: "PRIORITAS",
align: "left",
sortable: false,
value: "mr",
width: "10%",
class: "pa-1 blue lighten-3 white--text"
},
{
text: "HARGA",
align: "left",
sortable: false,
value: "lab",
width: "10%",
class: "pa-1 blue lighten-3 white--text"
}
]
}),
computed: {
dialogconfirmationdeletepat: {
get() {
return this.$store.state.testprice.dialog_confirmation_delete_meth
},
set(val) {
this.$store.commit("testprice/update_dialog_confirmation_delete_meth", val)
}
},
xtestprices() {
return this.$store.state.testprice.selected_testprice
},
msgconfirmationdeletepat() {
return this.$store.state.testprice.msg_confirmation_delete_meth
},
dialogconfirmationsend: {
get() {
return this.$store.state.testprice.dialog_confirmation_send
},
set(val) {
this.$store.commit("testprice/update_dialog_confirmation_send", val)
}
},
msgconfirmationsend() {
return this.$store.state.testprice.msg_confirmation_send
},
xact() {
return this.$store.state.testprice.act
},
xactpat() {
return this.$store.state.testprice.act_meth
},
xactsend() {
return this.$store.state.testprice.act_send
},
dialogformpricemou: {
get() {
return this.$store.state.testprice.dialog_form_pricemou
},
set(val) {
this.$store.commit("testprice/update_dialog_form_pricemou", val)
}
},
isLoading() {
return this.$store.state.testprice.search_status == 1
},
xpricemous(p) {
return this.$store.state.testprice.pricemous
},
xnoref: {
get() {
return this.$store.state.testprice.noref
},
set(val) {
this.$store.commit("testprice/update_noref", val)
}
},
namapricemou: {
get() {
return this.$store.state.testprice.namapricemou
},
set(val) {
this.$store.commit("testprice/update_nama_pricemou", val)
}
},
xdob: {
get() {
return this.$store.state.testprice.dob
},
set(val) {
this.$store.commit("testprice/update_dob", val)
}
},
xpricemoues() {
return this.$store.state.testprice.pricemoues
},
xpricemou: {
get() {
return this.$store.state.testprice.selected_pricemou
},
set(val) {
this.$store.commit("testprice/update_selected_pricemou", val)
}
},
xorderautodays() {
return this.$store.state.testprice.orderautodays
},
xorderautoday: {
get() {
return this.$store.state.testprice.orderautoday
},
set(val) {
this.$store.commit("testprice/update_orderautoday", val)
}
},
xorderdays() {
return this.$store.state.testprice.orderdays
},
sub_total() {
let days = this.xorderdays
sub_total = 0
days.forEach(function (vpx, idx) {
let total = parseInt(vpx.total)
sub_total = sub_total + total
})
return sub_total
},
dp() {
let mindp = this.$store.state.testprice.selected_testprice.M_MouMinDP
let dp = mindp / 100 * this.sub_total
return dp
},
isbill() {
let isbill = this.$store.state.testprice.selected_testprice.M_MouIsBill
return isbill
},
isagingonhold() {
let isagingonhold = this.$store.state.testprice.selected_testprice.M_MouIsAgingOnHold
return isagingonhold
},
agingonhold() {
let agingonhold = this.$store.state.testprice.selected_testprice.M_MouIsAgingOnHoldNote
return agingonhold
}
},
methods: {
createNewMethode() {
this.$store.commit("testprice/update_act_meth", 'new')
this.xnoref = ''
this.namapricemou = ''
this.$store.commit("testprice/update_selected_pricemou", [])
this.xdob = ''
this.$store.commit("testprice/update_orderdays", [])
this.$store.commit("testprice/update_dialog_form_pricemou", true)
},
checkError(value) {
var errors = this.$store.state.testprice.errors
if (errors.includes(value)) {
return true
} else {
return false
}
},
changeDay(idx) {
var arrOrders = this.$store.state.testprice.orderdays
arrOrders[idx].isday = arrOrders[idx].isday === 'N' ? 'Y' : 'N'
this.$store.commit("testprice/update_orderdays", arrOrders)
},
saveNewMethode() {
var prm = {}
prm.M_MethodePriorityNat_TestID = this.$store.state.testprice.selected_testprice
.Nat_TestID
prm.Nat_MethodeName = this.$store.state.testprice.selected_testprice.Nat_MethodeName
prm.M_MethodePriorityNat_MethodeID = this.$store.state.testprice.selected_pricemou.Nat_MethodeID
prm.M_MethodePriorityNumber = this.xpriority
prm.orderdays = this.xorderdays
this.$store.dispatch("testprice/savenewpricemou", prm)
},
editMethode(value) {
this.$store.commit("testprice/update_act_meth", 'edit')
this.$store.commit("testprice/update_x_meth_id", value.M_MethodePriorityID)
this.xpriority = value.M_MethodePriorityNumber
this.$store.commit("testprice/update_selected_pricemou", {
Nat_MethodeID: value.Nat_MethodeID,
Nat_MethodeName: value.Nat_MethodeName
})
this.isday = value.isday === 'N' ? false : true
this.$store.commit("testprice/update_orderdays", value.days)
this.$store.commit("testprice/update_dialog_form_pricemou", true)
},
saveEditMethode() {
var prm = {}
prm.M_MethodePriorityID = this.$store.state.testprice.x_meth_id
prm.M_MethodePriorityNat_TestID = this.$store.state.testprice.selected_testprice
.Nat_TestID
prm.Nat_MethodeName = this.$store.state.testprice.selected_pricemou.Nat_MethodeName
prm.M_MethodePriorityNat_MethodeID = this.$store.state.testprice.selected_pricemou.Nat_MethodeID
prm.M_MethodePriorityNumber = this.xpriority
prm.orderdays = this.xorderdays
this.$store.dispatch("testprice/saveeditpricemou", prm)
},
thr_search_day: _.debounce(function () {
this.$store.dispatch("testprice/searchday", {
day: this.search_day,
mouid: this.$store.state.testprice.selected_testprice.Nat_TestM_MouID
})
}, 2000),
deleteMethode(value) {
this.$store.commit("testprice/update_act_meth", 'delete')
this.$store.commit("testprice/update_x_meth_id", value.M_MethodePriorityID)
this.$store.commit("testprice/update_errors", [])
var errors = this.$store.state.testprice.errors
var msg = ''
msg = "Yakin, akan menghapus data pricemou " + value.M_MethodePriorityName + " ?"
this.$store.commit("testprice/update_msg_confirmation_delete_meth", msg)
this.$store.commit("testprice/update_dialog_confirmation_delete_meth", true)
},
doDeletePat() {
var prm = {}
prm.M_MethodePriorityNat_TestID = this.$store.state.testprice.selected_testprice
.Nat_TestID
prm.M_MethodePriorityID = this.$store.state.testprice.x_meth_id
prm.M_MethodePriorityName = this.namapricemou
prm.M_CompanyName = this.$store.state.testprice.selected_testprice.M_CompanyName
this.$store.dispatch("testprice/deletepricemou", prm)
},
sendOrderMethode(value) {
let msg = "Yakin, akan mengirim permintaan nomor " + this.$store.state.testprice.selected_testprice
.Nat_TestNumber + " ?"
this.$store.commit("testprice/update_msg_confirmation_send", msg)
this.$store.commit("testprice/update_dialog_confirmation_send", true)
},
doOrderMethode() {
var prm = {}
prm.Nat_TestID = this.$store.state.testprice.selected_testprice
.Nat_TestID
prm.Nat_TestNumber = this.$store.state.testprice.selected_testprice
.Nat_TestNumber
this.$store.dispatch("testprice/sendorder", prm)
},
convertMoney(money) {
return one_money(money)
},
addTest() {
var oldArr = this.$store.state.testprice.orderdays
oldArr.push(this.$store.state.testprice.orderautoday)
this.searchday = ''
this.$store.commit("testprice/update_orderautodays", [])
this.$store.commit("testprice/update_orderautoday", {})
},
deleteDataPx(idx) {
var inx = parseInt(idx);
var xrow = this.$store.state.testprice.orderdays[inx]
if (parseInt(xrow.xid) !== 0) {
var xdelday = this.$store.state.testprice.deleted_orderdays
xdelday.push(xrow)
this.$store.commit("testprice/update_deleted_orderdays", xdelday)
}
var oldArr = this.$store.state.testprice.orderdays
oldArr.splice(inx, 1)
this.$store.commit("testprice/update_orderdays", oldArr)
},
},
watch: {
search_city(val, old) {
if (val == old) return
if (!val) return
if (val.length < 1) return
if (this.$store.state.testprice.update_autocomplete_status == 1) return
this.thr_search_city()
},
search_day(val, old) {
if (val == old) return
if (!val) return
if (val.length < 1) return
if (this.$store.state.testprice.update_autocomplete_status == 1) return
this.thr_search_day()
}
}
}
</script>