Files
FE_CPONE/test/vuex/cpone-mcu-officer/components/oneMcuOfficerForm.vue
2026-04-27 10:13:31 +07:00

1245 lines
52 KiB
Vue

<template>
<div>
<!-- <v-dialog v-model="dialogsearchsample" persistent max-width="70%">
<v-card>
<v-card-title color="warning" class="headline">
LISTING ORDER
</v-card-title>
<v-divider></v-divider>
<v-card-text>
<v-layout align-center row>
<v-flex class="ma-1" xs2>
<v-menu
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
v-model="filterComputedDateFormattedStart"
label="Janji Hasil"
outline
hide-details
v-on="on"
@blur="date = deFormatedDate(filterComputedDateFormattedStart)"
></v-text-field>
</template>
<v-date-picker v-model="xfilterdate" no-title @input="menufilterdatestart = false"></v-date-picker>
</v-menu>
</v-flex>
<v-flex class="ma-1" xs2>
<v-select
class=" mini-select"
:search-input.sync="searchCompany"
autocomplete
v-model="selected_company"
:items="companies"
auto-select-first
item-text = "M_CompanyName"
return-object
outline
label="Kel. Pelanggan"
hide-details
>
<template
slot="item"
slot-scope="{ item }"
>
<v-list-tile-content>
<v-list-tile-title v-text="item.M_CompanyName"></v-list-tile-title>
</v-list-tile-content>
</template>
</v-select>
</v-flex>
<v-flex class="ma-1" xs3>
<v-select class="mini-select"
label="Filter Kecamatan"
outline
hide-details
item-text="name"
return-object
:items="xkecamatans"
v-model="xselected_kecamatan"
></v-select>
</v-flex>
<v-flex class="ma-1" xs3>
<v-select class="mini-select"
label="Filter Tipe"
outline
hide-details
item-text="name"
return-object
:items="xtypes"
v-model="xselected_type"
></v-select>
</v-flex>
<v-flex class="ma-1" xs2>
<v-text-field
v-model="filter_search"
label="Cari"
placeholder="Nama / No Lab"
outline
hide-details
@keyup.enter="dialogSearch(selected_company,xselected_kecamatan,xselected_type)"
></v-text-field>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs12 mt-2>
<v-data-table
:headers="allheaders"
:items="xsamples"
:loading="isLoading"
hide-actions
class="elevation-1">
<template v-slot:headers="props">
<tr>
<th style="width:20px" class= "blue-grey white--text">
<v-checkbox style="padding-top:0;margin-top:0"
hide-details
color="white"
:indeterminate="indeterminate"
@change="changeCbxAll(bar_chx_all)"
v-model="bar_chx_all"
></v-checkbox>
</th>
<th
v-for="header in props.headers"
:key="header.text"
:class="header.class"
:width="header.width"
>
{{ header.text }}
</th>
</tr>
</template>
<template v-slot:items="props">
<td style="width:20px" class="text-xs-left">
<v-checkbox style="padding-top:0;margin-top:0"
color="blue-grey"
hide-details
v-model="props.item.chex"
@change="checkTop()"
></v-checkbox>
</td>
<td class="text-xs-left pa-2" >
<p class="mb-0">{{props.item.labnumber}} / <span class="font-weight-bold">{{props.item.labnumber_ext}}</span></p>
<p class="font-weight-bold mb-0">{{props.item.patientname}}</p>
<p v-if="checkOrderDate(props.item) === 'old'" class="font-weight-bold red--text mb-0">{{props.item.date_order}}</p>
<p v-if="checkOrderDate(props.item) === 'now'" class="mb-0">{{props.item.date_order}}</p>
<p class="font-weight-bold mb-0 green--text">{{props.item.M_CompanyName}}</p>
</td>
<td class="text-xs-center pa-2" >
<p class="mb-0">{{ props.item.date_promise}}</p>
<p class="mb-0"> <span class="caption info--text">{{ props.item.xresult}}</span> </p>
</td>
<td class="text-xs-center pa-2" >
<p v-if="props.item.delivery_source === 'DOCTOR'" class="mb-0 font-weight-bold">{{ props.item.doctor_name}}</p>
<p v-if="props.item.delivery_source === 'COMPANY'" class="mb-0 font-weight-bold">{{ props.item.M_CompanyName}}</p>
<p class="mb-0 caption"><span class=" font-weight-bold info--text">{{ props.item.delivery_name.toUpperCase()}}</span></p>
<p class="mb-0">{{ props.item.xaddress}}</p>
<p class="mb-0">[ <span class="warning--text">{{props.item.kelurahan}}</span> ]</p>
<p v-if="props.item.catatan !== ''" class="mt-1 mb-0 error">
<span class=" mono white--text">catatan : {{props.item.catatan}}</span>
</p>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="green darken-1" flat @click="closeDialogSample()">OK</v-btn>
</v-card-actions>
</v-card>
</v-dialog> -->
<!-- Alert dialog Form Kosong Start -->
<v-dialog v-model="dialogalertshow" max-width="30%">
<v-card>
<v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
Peringatan!
</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 xs12>
<v-layout row>
<v-flex pt-2 pr-2 xs12>
<!-- <p id="error-break-line">{{ msgalertshow }}</p> -->
<p style="white-space:pre-wrap;">{{ msgalertshow }}</p>
</v-flex>
</v-layout>
</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="primary" flat @click="dialogalertshow = false">
Tutup
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- End alert dialog Form Kosong End -->
<v-layout class="mb-2" column >
<v-card>
<v-layout row>
<v-flex xs12>
<v-subheader red--text text--lighten-1> FORM MCU OFFICER
<span v-if="xact === 'edit'"> &nbsp;[ <span style="color:#2196F3;font-weight: 900;">{{ xnumbering }}</span>]</span>
<v-flex text-md-right>
<v-btn @click="save()" small color="info">Simpan</v-btn>
<v-btn @click="print()" small dark color="blue-grey">Print</v-btn>
</v-flex>
</v-subheader>
<v-divider></v-divider>
<v-layout row wrap>
<v-flex xs12 pa-2>
<v-layout mb-2 row>
<v-flex xs4 pa-1>
<v-menu class="xs4 pl-2"
v-model="menufilterdateend"
: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="filterComputedDateFormattedEnd"
label="Tanggal"
readonly
hide-details
v-on="on"
@blur="date = deFormatedDate(filterComputedDateFormattedEnd)"
></v-text-field>
</template>
<v-date-picker v-model="xdate" no-title @input="menufilterdateend = false"></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs4 pa-1>
<v-menu class="xs4 pl-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 MCU"
readonly
hide-details
v-on="on"
@blur="date = deFormatedDate(filterComputedDateFormattedStart)"
></v-text-field>
</template>
<v-date-picker v-model="xdatemcu" no-title @input="menufilterdatestart = false"></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs4 pa-1>
<v-select
hide-details
item-text="name"
return-object
:items="xmgmmcus"
v-model="xselected_mgmmcu"
label="MCU*"
></v-select>
<p v-if="checkError('requiremgmmcu')" class="error pl-2 pr-2" style="color:#fff">Mcu, dipilih dulu</p>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs12 pa-1>
<v-textarea
filled
outline
hide-details
label="Catatan"
v-model="xnote"
rows="3"
></v-textarea>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card>
</v-layout>
<v-layout class="mb-2" column>
<v-card>
<v-subheader red--text text--lighten-1>
LISTING OFFICER
</v-subheader>
<v-divider></v-divider>
<v-card-text>
<v-layout align-center row>
<v-flex xs3 pa-1>
<v-autocomplete
hide-details
auto-select-first no-filter
no-data-text="Cari Staff"
item-text="name"
return-object
:items="xstaffs"
v-model="xselected_staff"
:search-input.sync="search_staff"
label="Staff*"
>
<template slot="item" slot-scope="{ item }">
<v-list-tile-content>
<v-list-tile-title v-text="item.name"></v-list-tile-title>
</v-list-tile-content>
</template>
</v-autocomplete>
<p v-if="checkError('requirestaff')" class="error pl-2 pr-2" style="color:#fff">Staff, dipilih dulu</p>
</v-flex>
<v-flex xs3 pa-1>
<v-select
hide-details
item-text="name"
return-object
:items="xofficertypes"
v-model="xselected_officer_type"
label="Type*"
></v-select>
<p v-if="checkError('requiretype')" class="error pl-2 pr-2" style="color:#fff">Type, dipilih dulu</p>
</v-flex>
<v-flex pa-1>
<v-btn small @click="saveOfficer" color="orange">Tambahkan</v-btn>
<v-btn v-if="show_delete" @click="deleteDetail()" small color="error">Hapus</v-btn>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs12 mt-2>
<v-data-table
:headers="headers"
:items="xofficerHeaderDetails"
:loading="isLoading"
hide-actions
class="elevation-1">
<template v-slot:headers="props">
<tr>
<th style="width:20px" class= "blue-grey white--text">
<v-checkbox style="padding-top:0;margin-top:0"
hide-details
color="white"
:indeterminate="indeterminatex"
@change="changeCbxAllX(bar_chx_allx)"
v-model="bar_chx_allx"
></v-checkbox>
</th>
<th
v-for="header in props.headers"
:key="header.text"
:class="header.class"
:width="header.width"
>
{{ header.text }}
</th>
</tr>
</template>
<template v-slot:items="props">
<tr :key="props.index">
<td style="width:20px" class="text-xs-left">
<v-checkbox style="padding-top:0;margin-top:0"
color="blue-grey"
hide-details
v-model="props.item.chex"
@change="checkTopX()"
></v-checkbox>
</td>
<td class="text-xs-left pa-2" >
{{props.item.staffname}}
</td>
<td class="text-xs-center pa-2" >
{{props.item.typename}}
</td>
<td class="text-xs-center pa-2" >
{{props.item.number}}
</td>
<td class="text-xs-center pa-2" >
{{ props.item.date}}
</td>
<td class="text-xs-center pa-2" >
{{ props.item.mgmmcuname}}
</td>
<td class="text-xs-center pa-2" >
<v-btn title="hapus" style="min-width:20px" @click="deleterow(props.index)" small color="error"><v-icon small>delete</v-icon></v-btn>
</td>
</tr>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-card-text>
</v-card>
</v-layout>
<!-- <v-layout class="mb-2" column >
<v-card>
<v-layout row>
<v-flex xs12>
<v-subheader red--text text--lighten-1> DETAIL OFFICER
<v-flex text-md-right>
<v-btn v-if="show_delete" @click="deleteDetail()" small color="error">Hapus</v-btn>
<v-btn v-if="(_.isEmpty(selected_transaction, true)) || (selected_transaction && selected_transaction.status === 'S') || !selected_transaction" @click="openDialogSearch()" small color="warning">Cari order</v-btn>
</v-flex>
</v-subheader>
<v-divider></v-divider>
<v-layout row wrap>
<v-flex xs12 pa-2>
<v-layout row>
<v-flex xs12 pa-1>
<p v-if="checkError('requiredetails')" class="error pl-2 pr-2" style="color:#fff">Mana nih yang mau dikirim ?</p>
<v-data-table
:headers="allheaders"
:items="details"
:loading="isLoading"
hide-actions
class="elevation-1">
<template v-slot:headers="props">
<tr>
<th style="width:20px" class= "blue-grey white--text">
<v-checkbox style="padding-top:0;margin-top:0"
hide-details
color="white"
:indeterminate="indeterminatex"
@change="changeCbxAllX(bar_chx_allx)"
v-model="bar_chx_allx"
></v-checkbox>
</th>
<th
v-for="header in props.headers"
:key="header.text"
:class="header.class"
:width="header.width"
>
{{ header.text }}
</th>
</tr>
</template>
<template v-slot:items="props">
<td style="width:20px" class="text-xs-left">
<v-checkbox v-if="props.item.status === 'N'" style="padding-top:0;margin-top:0"
color="blue-grey"
hide-details
v-model="props.item.chex"
@change="checkTopX()"
></v-checkbox>
</td>
<td class="text-xs-left pa-2" >
<p class="mb-0">{{props.item.labnumber}} / <span class="font-weight-bold">{{props.item.labnumber_ext}}</span></p>
<p class="font-weight-bold mb-0">{{props.item.patientname}}</p>
<p v-if="checkOrderDate(props.item) === 'old'" class="font-weight-bold red--text mb-0">{{props.item.date_order}}</p>
<p v-if="checkOrderDate(props.item) === 'now'" class="mb-0">{{props.item.date_order}}</p>
<p class="font-weight-bold green--text mb-0">{{props.item.M_CompanyName}}</p>
</td>
<td class="text-xs-center pa-2" >
<p class="mb-0">{{ props.item.date_promise}}</p>
<p class="mb-0"> <span class="caption info--text">{{ props.item.xresult}}</span> </p>
</td>
<td class="text-xs-center pa-2" >
<p v-if="props.item.delivery_source === 'DOCTOR'" class="mb-0 font-weight-bold">{{ props.item.doctor_name}}</p>
<p v-if="props.item.delivery_source === 'COMPANY'" class="mb-0 font-weight-bold">{{ props.item.M_CompanyName}}</p>
<p class="mb-0 caption"><span class=" font-weight-bold info--text">{{ props.item.delivery_name.toUpperCase()}}</span></p>
<p class="mb-0">{{ props.item.xaddress}}</p>
<p class="mb-0">[ <span class="warning--text">{{props.item.kelurahan}}</span> ]</p>
<p v-if="props.item.catatan !== ''" class="mt-1 mb-0 error">
<span class=" mono white--text">catatan : {{props.item.catatan}}</span>
</p>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card>
</v-layout> -->
<one-dialog-print :title="printtitle" :width="printwidth" :height="500" :status="openprint" :urlprint="urlprint" @close-dialog-print="openprint=false"></one-dialog-print>
</div>
</template>
<style scoped>
table, td, th {
border: 1px solid #ddd;
text-align: left;
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
padding-top: 5px;
padding-bottom: 5px;
padding-left: 8px;
padding-right: 5px;
}
table.v-table tbody td,table.v-table tbody th {
height: 40px;
}
table.v-table thead tr {
height: 40px;
}
.mini-input .v-input{
margin-top: 0px;
}
.mini-input .v-input, .mini-input .v-input--selection-controls,.mini-input .v-input__slot{
margin-top: 0px;
margin-bottom:0px;
margin-left:3px;
}
.mini-input .v-messages{
min-height:0px;
}
input.fhm-input{
border: 1px solid black;
border-radius: 2px;
-webkit-box-shadow:
inset 0 0 2px rgba(0,0,0,0.1),
0 0 4px rgba(0,0,0,0.1);
-moz-box-shadow:
inset 0 0 2px rgba(0,0,0,0.1),
0 0 4px rgba(0,0,0,0.1);
box-shadow:
inset 0 0 2px rgba(0,0,0,0.1),
0 0 4px rgba(0,0,0,0.1);
padding: 2px 4px;
background: rgba(255,255,255,0.5);
margin: 0 0 1px 0;
width:30px;
text-align:center;
}
</style>
<script>
module.exports = {
components : {
'one-dialog-print':httpVueLoader('../../common/oneDialogPrintX.vue')
},
data: () => ({
dialogalertshow: false,
msgalertshow: '',
searchCompany:'',
xbarcode:'',
xform:'NEW',
search_dialog:'',
xalmariname:'',
xrackcode:'',
openprint:false,
urlprint:'',
printtitle:'',
printwidth:600,
xrow:0,
xcol:0,
indeterminate:false,
indeterminatex:false,
menufilterdatestart:false,
xdatestart:moment(new Date()).format('YYYY-MM-DD'),
date: new Date().toISOString().substr(0, 10),
menufilterdateend:false,
rackrows:[],
rackcols:[],
headers: [
{
text: "STAFF",
align: "center",
sortable: false,
width: "25%",
class: "pl-2 pt-1 pb-1 pr-2 blue-grey text-xs-center white--text"
},
{
text: "TYPE",
align: "center",
sortable: false,
width: "20%",
class: "pl-2 pt-1 pb-1 pr-2 blue-grey text-xs-center white--text"
},
{
text: "NUMBER",
align: "center",
sortable: false,
width: "10%",
class: "pl-2 pt-1 pb-1 pr-2 blue-grey text-xs-center white--text"
},
{
text: "TANGGAL",
align: "center",
sortable: false,
width: "15%",
class: "pl-2 pt-1 pb-1 pr-2 blue-grey text-xs-center white--text"
},
{
text: "MCU NAME",
align: "center",
sortable: false,
width: "20%",
class: "pl-2 pt-1 pb-1 pr-2 blue-grey text-xs-center white--text"
},
{
text: "AKSI",
align: "center",
sortable: false,
width: "10%",
class: "pl-2 pt-1 pb-1 pr-2 blue-grey text-xs-centert white--text"
}
],
allheaders: [
{
text: "PASIEN",
align: "left",
sortable: false,
width: "28%",
class: "pl-2 pt-1 pb-1 pr-2 blue-grey text-xs-left white--text"
},
{
text: "JANJI HASIL",
align: "center",
sortable: false,
width: "15%",
class: "pl-2 pt-1 pb-1 pr-2 blue-grey text-xs-center white--text"
},
{
text: "ALAMAT",
align: "center",
sortable: false,
width: "50%",
class: "pl-2 pt-1 pb-1 pr-2 blue-grey text-xs-center white--text"
}
],
}),
computed: {
bar_chx_all: {
get() {
return this.$store.state.form.bar_chx_all
},
set(val) {
this.$store.commit("form/update_bar_chx_all",val)
}
},
bar_chx_allx: {
get() {
return this.$store.state.form.bar_chx_allx
},
set(val) {
this.$store.commit("form/update_bar_chx_allx",val)
}
},
filterComputedDateFormattedStart () {
return this.formatDate(this.xdatemcu)
},
filterComputedDateFormattedEnd () {
return this.formatDate(this.xdate)
},
selected_transaction(){
return this.$store.state.samplestorage.selected_transaction
},
xact(){
return this.$store.state.samplestorage.act
},
xnumbering(){
return this.$store.state.form.transaction_number
},
xdatemcu:{
get() {
return this.$store.state.form.transaction_date_mcu
},
set(val) {
this.$store.commit("form/update_transaction_date_mcu",val)
// var company = this.$store.state.form.selected_company
// var kec = this.$store.state.form.selected_kecamatan
// var type = this.$store.state.form.selected_type
// this.dialogSearch(company,kec,type)
}
},
xdateend : {
get() {
return this.$store.state.form.end_date
},
set(val) {
this.$store.commit("form/update_end_date",val)
}
},
xdate:{
get() {
return this.$store.state.form.transaction_date
},
set(val) {
this.$store.commit("form/update_transaction_date",val)
}
},
xtime:{
get() {
return this.$store.state.form.transaction_time
},
set(val) {
this.$store.commit("form/update_transaction_time",val)
}
},
xnote:{
get() {
return this.$store.state.form.transaction_note
},
set(val) {
this.$store.commit("form/update_transaction_note",val)
this.$store.commit("samplestorage/update_no_save",1)
// this.$store.commit("form/update_officerHeaderDetails",[])
}
},
isLoading() {
return this.$store.state.samplestorage.search_status == 1
},
xmgmmcus(){
return this.$store.state.form.mgmmcus
},
xstaffs(){
return this.$store.state.form.staffs
},
xofficertypes(){
return this.$store.state.form.officer_types
},
xofficerHeaderDetails(){
return this.$store.state.form.officerHeaderDetails
},
xkecamatans(){
return this.$store.state.form.kecamatans
},
companies(){
return this.$store.state.form.companies
},
xtypes(){
return this.$store.state.form.types
},
xracks(){
return this.$store.state.form.racks
},
filter_search:{
get() {
return this.$store.state.form.filter_search
},
set(val) {
this.$store.commit("form/update_filter_search",val)
}
},
xselected_mgmmcu:{
get() {
return this.$store.state.form.selected_mgmmcu
},
set(val) {
this.$store.commit("form/update_selected_mgmmcu",val)
// this.$store.commit("form/update_officerHeaderDetails",[])
}
},
xselected_staff:{
get() {
return this.$store.state.form.selected_staff
},
set(val) {
this.$store.commit("form/update_selected_staff",val)
}
},
xselected_officer_type:{
get() {
return this.$store.state.form.selected_officer_type
},
set(val) {
this.$store.commit("form/update_selected_officer_type",val)
}
},
selected_company:{
get() {
return this.$store.state.form.selected_company
},
set(val) {
this.$store.commit("form/update_selected_company",val)
var kec = this.$store.state.form.selected_kecamatan
var type = this.$store.state.form.selected_type
this.dialogSearch(val,{'id':'0','name':'Semua'},{'id':'0','name':'Semua'})
}
},
xselected_kecamatan:{
get() {
return this.$store.state.form.selected_kecamatan
},
set(val) {
this.$store.commit("form/update_selected_kecamatan",val)
var company = this.$store.state.form.selected_company
var type = this.$store.state.form.selected_type
this.dialogSearch(company,val,{'id':'0','name':'Semua'})
}
},
xselected_type:{
get() {
return this.$store.state.form.selected_type
},
set(val) {
this.$store.commit("form/update_selected_type",val)
var company = this.$store.state.form.selected_company
var kec = this.$store.state.form.selected_kecamatan
this.dialogSearch(company,kec,val)
}
},
xselected_rack:{
get() {
return this.$store.state.form.selected_rack
},
set(val) {
this.$store.commit("form/update_selected_rack",val)
}
},
details(){
return this.$store.state.form.details
},
xsamples(){
return this.$store.state.form.samples
},
xopenalmari(){
return this.$store.state.form.open_almari
},
xopenrack(){
return this.$store.state.form.open_rack
},
xrackcontents(){
return this.$store.state.form.rack_contents
},
dialogsearchsample:{
get() {
return this.$store.state.form.dialog_search_sample
},
set(val) {
this.$store.commit("form/update_dialog_search_sample",val)
}
},
curr_page_search: {
get() {
return this.$store.state.form.current_page_search
},
set(val) {
this.$store.commit("form/update_current_page_search",val)
this.$store.dispatch("form/searchall",{
xdate:this.xdatestart,
kecamatan: this.xselected_kecamatan,
current_page:val,
lastid:-1
})
}
},
xtotal_page_search: {
get() {
return this.$store.state.form.total_page_search
},
set(val) {
this.$store.commit("form/update_total_page_search",val)
}
},
show_delete:{
get(){
return this.$store.state.form.show_delete
},
set(val) {
this.$store.commit("form/update_show_delete",val)
}
},
search_staff:{
get(){
return this.$store.state.form.search_staff
},
set(val) {
this.$store.commit("form/update_search_staff",val)
}
}
},
methods : {
checkOrderDate(item){
var rtn = 'now'
if(moment(item.date_order).format('YYYY-MM-DD') !== moment(this.$store.state.form.transaction_date).format('YYYY-MM-DD'))
rtn = 'old'
return rtn
},
print(){
var trx_selected = this.$store.state.samplestorage.selected_transaction
this.printwidth = 1028
this.printtitle = ""
let idx = trx_selected.id
let user = one_user()
var d = new Date();
var n = d.getTime()
var rptname = ''
var folder = 'rekap'
var rptname = 'rpt_list_mcu_005_header'
var xurl = ""
// https://devcpone.aplikasi.web.id/birt/run?__report=report/one/rekap/rpt_list_mcu_005_header.rptdesign&__format=pdf&PID=2&username=ADMIN&tm=1719455789649
xurl = "/birt/run?__report=report/one/"+folder+"/"+rptname+".rptdesign&__format=pdf&username="+user.M_UserUsername+"&PID="+idx+'&tm='+n
this.urlprint = xurl
this.openprint = true
},
changeCbxAll(value){
var arr = this.xsamples
this.indeterminate = false
this.btn_hide = true
arr.forEach((el)=>{el.chex = value})
var selected = _.filter(arr, function(o) { return o.chex })
this.$store.commit("form/update_selected_transaction",selected)
},
changeCbxAllX(value){
this.show_delete = false
var arr = this.xofficerHeaderDetails
this.indeterminatex = false
this.btn_hide = true
// var filtered_arr = _.filter(arr, function(o) { return o.status === 'N' })
arr.forEach((el)=>{el.chex = value})
var selected = _.filter(arr, function(o) { return o.chex })
if(selected.length > 0){
this.show_delete = true
}
},
checkError(value){
var errors = this.$store.state.form.errors
if(errors.includes(value)){
return true
}
else{
return false
}
},
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.xid == this.$store.state.samplestorage.selected_transaction.xid
},
selectMe(detail) {
this.$store.commit("form/update_selected_detail",detail)
this.$store.commit("form/update_open_almari",false)
this.$store.commit("form/update_open_rack",true)
this.$store.commit("form/update_selected_almari",detail.almari)
this.xalmariname = detail.almari.name
this.$store.commit("form/update_selected_rack",detail.rack)
this.xrackcode = detail.rack.code
this.$store.dispatch("form/getrackcontent",{
almariid:detail.almari.id,
rackid:detail.rack.id,
col:detail.col,
row:detail.row
})
},
addDetail(){
var barcode = this.xbarcode
this.xbarcode = ''
this.$store.dispatch("form/checkbarcode",{
barcode : barcode,
details : this.$store.state.form.details
})
},
deleteDetail(){
var arr = this.$store.state.form.officerHeaderDetails
var selected = _.filter(arr, function(o) { return o.chex })
var deleted = this.$store.state.form.deleted_details
selected.forEach(function(value,index){
// var idx = _.findIndex(arr, item => item.trx_id === value.trx_id)
// arr.splice(idx,1)
if(parseInt(value.trx_id) > 0){
var idx_del = _.findIndex(deleted, itemx => parseInt(itemx.trx_id) === parseInt(value.trx_id))
if(idx_del === -1)
deleted.push(value)
}
})
this.$store.commit("form/update_deleted_details",deleted)
this.show_delete = false
},
saveNewTransaction(){
var prm = {
date: this.$store.state.form.transaction_date,
time: this.$store.state.form.transaction_time,
note: this.$store.state.form.transaction_note,
details : this.$store.state.form.details
}
this.$store.dispatch("form/save",prm)
},
checkInLists(value){
let arrtests = this.$store.state.form.details
var idx = _.findIndex(arrtests, item => item.xid === value.xid && item.delid === value.delid)
if(idx !== -1){
return true
}
else{
return false
}
},
removeDetail(value){
let arrtests = this.$store.state.form.details
var idx = _.findIndex(arrtests, item => item.promiseid === value.promiseid && item.delid === value.delid)
arrtests.splice(idx,1)
this.$store.commit("form/update_details",arrtests)
},
closeDialogSample(){
var barcodes = this.xsamples
var selected = _.filter(barcodes, function(o) { return o.chex })
var details = this.$store.state.form.details
selected.forEach(function(value,index){
var idx = _.findIndex(details, item => item.promiseid === value.promiseid && item.delid === value.delid)
if(idx === -1){
value.chex = false
details.push(value)
}
})
this.$store.commit("form/update_details",details)
console.log(details)
this.$store.commit("form/update_dialog_search_sample",false)
},
openDialogSearch(){
this.bar_chx_all = false
this.indeterminatex = false
this.xfilterdate = moment(new Date()).format('YYYY-MM-DD')
this.$store.commit("form/update_selected_transaction",[])
var company = {'M_CompanyID':'0','M_CompanyName':'Semua'}
var kecamatan = {'id':'0','name':'Semua'}
var type = {'id':'0','name':'Semua'}
this.dialogSearch(company,kecamatan,type)
},
dialogSearch(company,kecamatan,type){
this.bar_chx_all = false
this.indeterminatex = false
this.$store.commit("form/update_selected_transaction",[])
this.$store.dispatch("form/searchall",{
xdate:this.xfilterdate,
kecamatan: kecamatan,
company:company,
current_page:this.curr_page_search,
type:type,
search:this.filter_search,
details:this.details,
lastid:-1
})
},
closeDialogSearch(){
this.$store.commit("form/update_dialog_search_sample",false)
},
searchSample(){
this.$store.dispatch("form/lookupsamples",{
search:this.search_dialog
})
},
checkStatus(value){
if(value.status === 'N' && value.selected === 'N'){
return 'info'
}else if(value.status === 'Y' && value.selected === 'T'){
return 'warning'
}
else{
return 'error'
}
},
changeStatusChecked(value){
let arrdet = this.$store.state.form.details
let arr = this.$store.state.form.samples
var idx = _.findIndex(arr, item => item.xid === value.xid && item.delid === value.delid)
arr[idx].flag_checked = value.flag_checked === 'N' ? 'Y':'N'
var selected_x = _.filter(arr, function(o) { return o.xid === value.xid && o.delid === value.delid})
var combine_x = _.concat(arrdet,selected_x)
this.$store.commit("form/update_details",combine_x)
},
resetOfficer() {
// this.$store.commit("form/update_transaction_note",'')
// this.$store.commit("form/update_selected_mgmmcu",{})
this.$store.commit("form/update_selected_staff",{})
this.$store.commit("form/update_selected_officer_type",{})
},
saveOfficer() {
this.$store.commit("form/update_errors",[])
var errors = this.$store.state.form.errors
if(_.isEmpty(this.xselected_mgmmcu)){
errors.push("requiremgmmcu")
}
if(_.isEmpty(this.xselected_staff)){
errors.push("requirestaff")
}
if(_.isEmpty(this.xselected_officer_type)){
errors.push("requiretype")
}
if (errors.length === 0) {
let officerHeaderDetails = this.xofficerHeaderDetails
this.$store.commit("form/update_trx_id",0)
officerHeaderDetails.push({
trx_id: this.$store.state.form.trx_id,
date:this.xdate,
datemcu:this.xdatemcu,
note:this.xnote,
mgmmcuid:this.xselected_mgmmcu.id,
mgmmcuname:this.xselected_mgmmcu.name,
staffid:this.xselected_staff.id,
staffname:this.xselected_staff.name,
typeid:this.xselected_officer_type.id,
typename:this.xselected_officer_type.name
})
// console.log("officerHeaderDetails", officerHeaderDetails)
if (this.xofficerHeaderDetails.length > 0) {
this.resetOfficer()
}
}
},
deleterow(idx) {
this.$store.dispatch('form/removeOfficer', idx);
},
save(){
this.$store.commit("form/update_errors",[])
var errors = this.$store.state.form.errors
if (this.xofficerHeaderDetails == 0 ) {
this.msgalertshow = "Officer Masih Kosong"
this.dialogalertshow = true
}
if(errors.length === 0){
this.$store.commit("form/update_errors",[])
var prm = {}
prm.mgmmcuid = 0;
prm.mgmmcunumber = '';
if (!_.isEmpty(this.xselected_mgmmcu)) {
prm.mgmmcuid = this.xselected_mgmmcu.id;
prm.mgmmcunumber = this.xselected_mgmmcu.Mgm_McuNumber
}
prm.trx_id = this.$store.state.samplestorage.selected_transaction.id
prm.date = this.xdate
prm.datemcu = this.xdatemcu
prm.note = this.xnote
prm.details = this.xofficerHeaderDetails
prm.deleted_details = this.$store.state.form.deleted_details
// console.log('save officer',prm)
this.$store.dispatch("form/save",prm)
}
},
checkTop(){
var barcodes = this.xsamples
var selected = _.filter(barcodes, function(o) { return o.chex; })
this.bar_chx_all = false
this.indeterminate = false
if(selected.length > 0 && barcodes.length === selected.length){
this.bar_chx_all = true
this.indeterminate = false
}
if(selected.length > 0 && barcodes.length > selected.length){
this.bar_chx_all = false
this.indeterminate = true
}
this.$store.commit("form/update_selected_transaction",selected)
},
checkTopX(){
this.show_delete = false
var barcodes = this.xofficerHeaderDetails
var selected = _.filter(barcodes, function(o) { return o.chex; })
this.bar_chx_allx = false
this.indeterminatex = false
if(selected.length > 0 && barcodes.length === selected.length){
this.bar_chx_allx = true
this.indeterminatex = false
this.show_delete = true
}
if(selected.length > 0 && barcodes.length > selected.length){
this.bar_chx_allx = false
this.indeterminatex = true
this.show_delete = true
}
//this.$store.commit("form/update_selected_transaction",selected)
},
thr_search_staff: _.debounce(function () {
this.$store.dispatch("form/getstaff", {
search: this.search_staff,
id: this.$store.state.samplestorage.selected_transaction.id
})
}, 200),
},
watch: {
search_staff(val, old) {
if (val == old) return
if (!val) return
if (val.length < 1) return
if (this.$store.state.form.update_get_data_status == 1) return
this.thr_search_staff()
},
}
}
</script>