1828 lines
88 KiB
Vue
1828 lines
88 KiB
Vue
<template>
|
|
<v-layout class="fill-height" column>
|
|
<!-- dialog copy -->
|
|
<v-dialog v-model="dialogcopy" persistent max-width="290">
|
|
<v-card>
|
|
<v-card-title color="success" class="headline">Copy Packet</v-card-title>
|
|
<v-card-text>
|
|
<v-layout row wrap>
|
|
<v-flex xs12 pa-2>
|
|
<v-text-field
|
|
color="black"
|
|
label="Nama Paket"
|
|
v-model="inp_T_PacketNameCopy"
|
|
single-line
|
|
hide-details
|
|
></v-text-field>
|
|
<p v-if="_.isEmpty(inp_T_PacketNameCopy)" class="error caption mt-1 mb-0 pl-2 pr-2 pb-2" style="color:#fff">Belum isi nama paket untuk copy</p>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card-text>
|
|
<v-card-actions>
|
|
<v-btn color="blue darken-1" flat @click="closeFormCopy()">Tutup</v-btn>
|
|
<v-spacer></v-spacer>
|
|
<v-btn color="green darken-1" flat @click="closeDialogSuccessCopy">Simpan</v-btn>
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
<!-- dialog copy -->
|
|
|
|
<!-- alert dialog start -->
|
|
<v-dialog v-model="dialogsuccess" persistent max-width="290">
|
|
<v-card>
|
|
<v-card-title color="success" class="headline">Berhasil !</v-card-title>
|
|
<v-card-text>
|
|
{{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>
|
|
<!-- alert dialog end -->
|
|
|
|
<!-- alert dialog error start -->
|
|
<v-dialog v-model="dialogerror" persistent max-width="290">
|
|
<v-card>
|
|
<v-card-title color="error" class="headline">Error !</v-card-title>
|
|
<v-card-text>
|
|
{{msgerror}}
|
|
</v-card-text>
|
|
<v-card-actions>
|
|
<v-spacer></v-spacer>
|
|
<v-btn color="green darken-1" flat @click="closeDialogError">OK</v-btn>
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
<!-- alert dialog error end -->
|
|
|
|
<!-- dialog confirmation start -->
|
|
<v-dialog v-model="dialogconfirmationdelete" 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>
|
|
{{msgconfirmationdelete}}
|
|
</v-card-text>
|
|
<v-card-actions>
|
|
<v-spacer></v-spacer>
|
|
<v-btn small color="error darken-1 text-sm-left" flat @click="doDeleteData()">Hapus</v-btn>
|
|
<v-btn small color="primary darken-1 text-sm-right" flat @click="dialogconfirmationdelete = false">Batal</v-btn>
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
<!-- dialog confirmation end -->
|
|
|
|
<!-- dialog add start -->
|
|
<v-dialog v-model="dialogadd" persistent max-width="900">
|
|
<v-card>
|
|
<v-card-title dark class="headline primary pt-2 pb-2" primary-title style="color:white; display: flex; justify-content: space-between;">
|
|
<h4 dark>Paket</h4>
|
|
<!-- <v-btn icon @click="dialogadd = false" class="pt-2 pb-2" style="color: white;">
|
|
<v-icon>close</v-icon>
|
|
</v-btn> -->
|
|
<v-btn icon @click="closeForm()" class="pt-2 pb-2" style="color: white;">
|
|
<v-icon>close</v-icon>
|
|
</v-btn>
|
|
</v-card-title>
|
|
<v-card-text class="pt-0 pb-0">
|
|
<v-layout row wrap>
|
|
<!-- left start -->
|
|
<v-flex xs6 pa-2>
|
|
<!-- nama paket -->
|
|
<v-text-field
|
|
color="black"
|
|
label="Nama Paket"
|
|
v-model="inp_T_PacketName"
|
|
:disabled="xact === 'edit'
|
|
&& selectedPacket.T_PacketIsGenerated === 'Y'
|
|
&& selectedPacket.T_PacketIsValidated === 'Y'"
|
|
single-line
|
|
hide-details
|
|
></v-text-field>
|
|
<p v-if="_.isEmpty(inp_T_PacketName)" class="error caption mt-1 mb-0 pl-2 pr-2 pb-2" style="color:#fff">Belum isi nama paket</p>
|
|
<!-- nama paket -->
|
|
|
|
<!-- tgl start date -->
|
|
<v-flex xs12 pt-2>
|
|
<v-menu
|
|
v-model="menufilterdatestart"
|
|
:close-on-content-click="false"
|
|
:nudge-right="40"
|
|
lazy
|
|
transition="scale-transition"
|
|
offset-y
|
|
hide-details
|
|
full-width
|
|
max-width="290px"
|
|
min-width="290px"
|
|
>
|
|
<template v-slot:activator="{ on }">
|
|
<v-text-field
|
|
|
|
v-model="filterComputedDateFormattedStart"
|
|
label="Tanggal Awal"
|
|
style="font-size:12px"
|
|
outline
|
|
hide-details
|
|
readonly
|
|
v-on="on"
|
|
@blur="date = deFormatedDate(filterComputedDateFormattedStart)"
|
|
></v-text-field>
|
|
</template>
|
|
<v-date-picker
|
|
:disabled="xact === 'edit'
|
|
&& selectedPacket.T_PacketIsGenerated === 'Y'
|
|
&& selectedPacket.T_PacketIsValidated === 'Y'"
|
|
v-model="xdatestart" no-title @input="menufilterdatestart = false"
|
|
></v-date-picker>
|
|
</v-menu>
|
|
</v-flex>
|
|
<!-- tgl start date -->
|
|
|
|
<!-- tgl end date -->
|
|
<v-flex xs12 pt-2>
|
|
<v-menu
|
|
v-model="menufilterdateend"
|
|
:close-on-content-click="false"
|
|
:nudge-right="40"
|
|
lazy
|
|
transition="scale-transition"
|
|
offset-y
|
|
full-width
|
|
hide-details
|
|
max-width="290px"
|
|
min-width="290px"
|
|
>
|
|
<template v-slot:activator="{ on }">
|
|
<v-text-field
|
|
|
|
v-model="filterComputedDateFormattedEnd"
|
|
label="Tanggal Akhir"
|
|
outline
|
|
style="font-size:12px"
|
|
readonly
|
|
hide-details
|
|
v-on="on"
|
|
@blur="date = deFormatedDate(filterComputedDateFormattedEnd)"
|
|
></v-text-field>
|
|
</template>
|
|
<v-date-picker
|
|
:disabled="xact === 'edit'
|
|
&& selectedPacket.T_PacketIsGenerated === 'Y'
|
|
&& selectedPacket.T_PacketIsValidated === 'Y'"
|
|
:min="xdatestart" v-model="xdateend" no-title @input="menufilterdateend = false"
|
|
></v-date-picker>
|
|
</v-menu>
|
|
</v-flex>
|
|
<!-- tgl end date -->
|
|
|
|
<!-- dropdown tpriceheader current -->
|
|
<v-flex xs12 pt-2>
|
|
<v-autocomplete
|
|
:items="xtpriceheaderformCb"
|
|
v-model="selected_tpriceheaderformCb"
|
|
item-text="T_PriceHeaderName"
|
|
hide-details
|
|
item-value="T_PriceHeaderID"
|
|
return-object
|
|
label="Price Header"
|
|
:disabled="xact === 'edit'
|
|
&& selectedPacket.T_PacketIsGenerated === 'Y'
|
|
&& selectedPacket.T_PacketIsValidated === 'Y'"
|
|
:search-input.sync="search_priceheader"
|
|
>
|
|
</v-autocomplete>
|
|
<p v-if="_.isEmpty(selected_tpriceheaderformCb)" class="error caption mt-1 mb-0 pl-2 pr-2 pb-2" style="color:#fff">Belum pilih price header</p>
|
|
</v-flex>
|
|
<!-- dropdown tpriceheader current -->
|
|
|
|
<!-- dropdown auto complete grup pemeriksaan -->
|
|
<v-flex xs12 pt-2>
|
|
<v-autocomplete
|
|
:items="xnatsubgroupCb"
|
|
v-model="selected_natsubgroupCb"
|
|
item-text="Nat_SubGroupName"
|
|
hide-details
|
|
item-value="Nat_SubGroupID"
|
|
return-object
|
|
label="Grup Pemeriksaan"
|
|
:disabled="xact === 'edit' && selectedPacket.T_PacketIsGenerated === 'Y'"
|
|
:search-input.sync="search_natsubgroup"
|
|
|
|
>
|
|
</v-autocomplete>
|
|
<p v-if="_.isEmpty(selected_tpriceheaderformCb)" class="error caption mt-1 mb-0 pl-2 pr-2 pb-2" style="color:#fff">Belum pilih price header</p>
|
|
</v-flex>
|
|
<!-- dropdown auto complete group pemeriksaan -->
|
|
|
|
<v-layout row>
|
|
<!-- cari kode -->
|
|
<v-flex xs6 pt-2>
|
|
<v-text-field
|
|
color="black"
|
|
label="Cari Kode"
|
|
placeholder="Cari Kode, Lalu Enter"
|
|
v-model="search_kode"
|
|
@keyup.enter="getpricelist()"
|
|
single-line
|
|
hide-details
|
|
></v-text-field>
|
|
</v-flex>
|
|
<!-- cari kode -->
|
|
<!-- cari nama -->
|
|
<v-flex xs6 pt-2 pl-3>
|
|
<v-text-field
|
|
color="black"
|
|
label="Cari Nama"
|
|
placeholder="Cari Nama, Lalu Enter"
|
|
v-model="search_nama"
|
|
@keyup.enter="getpricelist()"
|
|
single-line
|
|
hide-details
|
|
></v-text-field>
|
|
</v-flex>
|
|
<!-- cari nama -->
|
|
</v-layout>
|
|
|
|
<!-- list t_price start -->
|
|
<v-layout row>
|
|
<v-flex xs12 pt-4 pb-2>
|
|
<v-data-table
|
|
:headers="headersTPrice"
|
|
:items="tprices"
|
|
:loading="isLoading"
|
|
hide-actions
|
|
class="elevation-1">
|
|
<template slot="items" slot-scope="props">
|
|
<td v-bind:class="{'amber lighten-4':isSelectedTPrice(props.item)}" class="text-xs-left pa-1">
|
|
{{ props.item.T_TestCode}}
|
|
</td>
|
|
<td v-bind:class="{'amber lighten-4':isSelectedTPrice(props.item)}" class="text-xs-left pa-1">
|
|
{{ props.item.T_TestName}}
|
|
</td>
|
|
<td v-bind:class="{'amber lighten-4':isSelectedTPrice(props.item)}" class="text-xs-left pa-1" >
|
|
<v-btn
|
|
v-if="packetExist(props.item)"
|
|
:disabled="xact === 'edit'
|
|
&& selectedPacket.T_PacketIsGenerated === 'Y'
|
|
&& selectedPacket.T_PacketIsValidated === 'Y'"
|
|
style="min-width:25px;margin:0" @click="itemSelectedToPush(props.item)" small color="info">
|
|
Pilih
|
|
</v-btn>
|
|
<v-btn
|
|
v-if="!packetExist(props.item)"
|
|
style="min-width:25px;margin:0;background-color: red;color: white;" @click="itemSelectedToPush(props.item)" small disabled>
|
|
Sudah Dipilih
|
|
</v-btn>
|
|
</td>
|
|
</template>
|
|
</v-data-table>
|
|
<v-pagination style="margin-top:10px;margin-bottom:10px" :total-visible="15" v-model="curr_page_tprice" :length="xtotal_page_tprice"></v-pagination>
|
|
</v-flex>
|
|
</v-layout>
|
|
<!-- list t_price end -->
|
|
</v-flex>
|
|
<!-- left end -->
|
|
|
|
<!-- right start -->
|
|
<v-flex xs6 pa-2>
|
|
<!-- radio button jenis paket -->
|
|
<v-layout row>
|
|
<v-flex xs6 pt-3>
|
|
<!-- <p>Jenis Paket</p> -->
|
|
<p style="font-weight: bold;font-size: 14px;">Jenis Paket</p>
|
|
<!-- <v-radio-group
|
|
:readonly="tpacketdetails.length > 0"
|
|
v-model="xtpacketRb"
|
|
@change="showFields()"
|
|
row hide-details pt-0
|
|
>
|
|
<v-radio label="Panel" value="PN"></v-radio>
|
|
<v-radio label="Profile" value="PR"></v-radio>
|
|
</v-radio-group> -->
|
|
<v-radio-group
|
|
v-model="xtpacketRb"
|
|
row hide-details pt-0
|
|
:disabled="xact === 'edit'
|
|
&& selectedPacket.T_PacketIsGenerated === 'Y'
|
|
&& selectedPacket.T_PacketIsValidated === 'Y'"
|
|
>
|
|
<v-radio label="Panel" value="PN"></v-radio>
|
|
<v-radio label="Profile" value="PR"></v-radio>
|
|
</v-radio-group>
|
|
<p v-if="_.isEmpty(xtpacketRb)" class="error caption mt-1 mb-0 pl-2 pr-2 pb-2" style="color:#fff">Belum pilih jenis paket</p>
|
|
</v-flex>
|
|
<v-flex xs6 pt-3>
|
|
<p style="font-weight: bold;font-size: 14px;">Paket Opsional</p>
|
|
<v-radio-group
|
|
v-model="xtpacketOpsional"
|
|
row pt-0 hide-details
|
|
:disabled="xact === 'edit'
|
|
&& selectedPacket.T_PacketIsGenerated === 'Y'
|
|
&& selectedPacket.T_PacketIsValidated === 'Y'"
|
|
>
|
|
<v-radio label="Tidak" value="N"></v-radio>
|
|
<v-radio label="Ya" value="Y"></v-radio>
|
|
</v-radio-group>
|
|
</v-flex>
|
|
</v-layout>
|
|
<!-- radio button jenis paket -->
|
|
|
|
<!-- list detail paket array -->
|
|
<v-layout row wrap>
|
|
<v-flex xs12 pt-4 pb-2>
|
|
<p style="font-weight: bold;font-size: 18px; margin-bottom: 4px;">Detail Paket</p>
|
|
<v-text-field
|
|
color="black" label="Cari Nama"
|
|
placeholder="Cari Nama, Lalu Enter"
|
|
v-model="selected_detail_search"
|
|
@keyup.enter="searchDetailItem()"
|
|
single-line hide-details
|
|
></v-text-field>
|
|
</v-flex>
|
|
<v-flex xs12 pt-2 pb-2>
|
|
<v-data-table
|
|
:headers="headersTPacketDetailArray"
|
|
:items="display_tpacketdetails"
|
|
:loading="isLoading"
|
|
hide-actions
|
|
class="elevation-1">
|
|
<template slot="items" slot-scope="props">
|
|
<!-- <td v-bind:class="{'amber lighten-4':isSelectedTPrice(props.item)}" class="text-xs-left pa-1">
|
|
{{ props.item.T_TestName}}
|
|
</td> -->
|
|
<td class="text-xs-left pa-1">
|
|
{{ props.item.T_TestName}}
|
|
</td>
|
|
<!-- <td v-bind:class="{'amber lighten-4':isSelectedTPrice(props.item)}" class="text-xs-right pa-1">
|
|
{{convertMoney(props.item.T_PriceTotal)}}
|
|
</td> -->
|
|
<td class="text-xs-right pa-1">
|
|
{{convertMoney(props.item.T_PriceTotal)}}
|
|
</td>
|
|
<!-- <td v-bind:class="{'amber lighten-4':isSelectedTPrice(props.item)}" class="text-xs-right pa-1">
|
|
<v-text-field
|
|
:readonly="xtpacketRb === 'PR'"
|
|
color="black"
|
|
v-model="props.item.T_PriceTotalPacket"
|
|
:value="xtpacketRb === 'PR' ? convertMoney(props.item.T_PriceTotal) : convertMoney(props.item.T_PriceTotalPacket)"
|
|
@input="updatePrice($event,props.item)"
|
|
single-line
|
|
hide-details
|
|
type="number"
|
|
:min="0"
|
|
class="right-input"
|
|
></v-text-field>
|
|
</td> -->
|
|
<td class="text-xs-right pa-1">
|
|
<!-- <v-text-field
|
|
:readonly="xtpacketRb === 'PR'"
|
|
color="black"
|
|
v-model="props.item.T_PriceTotalPacket"
|
|
:value="xtpacketRb === 'PR' ? convertMoney(props.item.T_PriceTotal) : convertMoney(props.item.T_PriceTotalPacket)"
|
|
@input="updatePrice($event,props.item)"
|
|
single-line
|
|
hide-details
|
|
type="number"
|
|
:min="0"
|
|
class="right-input"
|
|
></v-text-field> -->
|
|
<v-text-field
|
|
color="black"
|
|
v-model="props.item.T_PriceTotalPacket"
|
|
:value="convertMoney(props.item.T_PriceTotalPacket)"
|
|
@input="updatePrice($event,props.item)"
|
|
single-line
|
|
hide-details
|
|
type="number"
|
|
:disabled="xact === 'edit' && selectedPacket.T_PacketIsGenerated === 'Y'"
|
|
:min="0"
|
|
class="right-input"
|
|
></v-text-field>
|
|
</td>
|
|
<!-- <td v-bind:class="{'amber lighten-4':isSelectedTPrice(props.item)}" class="text-xs-right pa-1 pr-2" >
|
|
<v-btn style="min-width:25px;margin:0"
|
|
@click="removeFromDetailPackets(props.item)" small color="red">
|
|
<v-icon
|
|
style="cursor:pointer;font-size:18px">
|
|
delete
|
|
</v-icon>
|
|
</v-btn>
|
|
</td> -->
|
|
<td class="text-xs-right pa-1 pr-2" >
|
|
<v-btn style="min-width:25px;margin:0"
|
|
:disabled="xact === 'edit'
|
|
&& selectedPacket.T_PacketIsGenerated === 'Y'
|
|
&& selectedPacket.T_PacketIsValidated === 'Y'"
|
|
@click="removeFromDetailPackets(props.item)" small color="red">
|
|
<v-icon
|
|
style="cursor:pointer;font-size:18px">
|
|
delete
|
|
</v-icon>
|
|
</v-btn>
|
|
</td>
|
|
</template>
|
|
<template v-slot:footer v-if="!_.isEmpty(tpacketdetails)">
|
|
<td class="text-xs-left pa-1">
|
|
<strong>Total</strong>
|
|
</td>
|
|
<td class="text-xs-right pa-1">
|
|
<!-- {{ totalTPriceAwal }} -->
|
|
<strong>{{ convertMoney(totalTPriceAwal) }}</strong>
|
|
</td>
|
|
<td :colspan="1" class="text-xs-right pa-1">
|
|
<!-- {{ totalTPricePacket }} -->
|
|
<strong>{{ convertMoney(totalTPricePacket) }}</strong>
|
|
</td>
|
|
</template>
|
|
</v-data-table>
|
|
<p v-if="_.isEmpty(tpacketdetails)" class="error caption mt-1 mb-0 pl-2 pr-2 pb-2" style="color:#fff">Belum pilih price</p>
|
|
<!-- <v-pagination style="margin-top:10px;margin-bottom:10px" :total-visible="15" v-model="curr_page_tpacketdetails" :length="xtotal_page_tpacketdetails"></v-pagination> -->
|
|
<div class="text-xs-center mt-2">
|
|
<v-pagination v-model="selected_detail_page" :length="display_total_perpage" :total-visible="5"></v-pagination>
|
|
</div>
|
|
</v-flex>
|
|
</v-layout>
|
|
<!-- list detail paket array -->
|
|
</v-flex>
|
|
<!-- right end -->
|
|
</v-layout>
|
|
</v-card-text>
|
|
<v-card-actions>
|
|
<v-btn color="blue darken-1" flat @click="closeForm()">Tutup</v-btn>
|
|
<v-spacer></v-spacer>
|
|
<v-btn v-if="
|
|
!_.isEmpty(inp_T_PacketName)
|
|
&& tpacketdetails.length > 0
|
|
&& !_.isEmpty(selected_tpriceheaderformCb)
|
|
&& selectedPacket.T_PacketIsGenerated != 'Y'
|
|
&& selectedPacket.T_PacketIsValidated != 'Y'"
|
|
color="blue darken-1" flat @click="savePacket()">Simpan</v-btn>
|
|
<!-- <v-btn small color="primary darken-1 text-sm-right" flat @click="dialogconfirmationdetailpaket = false">Close</v-btn> -->
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
<!-- dialog add end -->
|
|
|
|
<!-- dialog validation -->
|
|
<one-dialog-validate></one-dialog-validate>
|
|
|
|
<!-- dialog log packet start -->
|
|
<v-dialog v-model="dialoglog" max-width="1200">
|
|
<v-card>
|
|
<v-card-title class="headline primary white--text" style="display:flex;justify-content:space-between;">
|
|
<div>
|
|
Log Paket - {{ selected_log_packet.T_PacketName || '' }}
|
|
</div>
|
|
<v-btn icon @click="closeDialogLog" style="color:white;">
|
|
<v-icon>close</v-icon>
|
|
</v-btn>
|
|
</v-card-title>
|
|
|
|
<v-card-text>
|
|
<v-layout row wrap>
|
|
<v-flex xs12 md4 pa-2>
|
|
<v-card outlined>
|
|
<v-card-title class="subtitle-1 font-weight-bold">
|
|
Riwayat Log
|
|
</v-card-title>
|
|
<v-divider></v-divider>
|
|
|
|
<div v-if="logLoading" class="pa-3">
|
|
Memuat log...
|
|
</div>
|
|
|
|
<div v-else-if="packet_logs.length === 0" class="pa-3">
|
|
Tidak ada log.
|
|
</div>
|
|
|
|
<v-list two-line v-else>
|
|
<v-list-tile
|
|
v-for="item in packet_logs"
|
|
:key="item.LogPacketID"
|
|
@click="selectLogDetail(item)"
|
|
style="cursor:pointer;"
|
|
:style="selected_log_detail.LogPacketID === item.LogPacketID
|
|
? 'background:#fff9c4;border-left:4px solid #fbc02d;'
|
|
: 'background:transparent;border-left:4px solid transparent;'"
|
|
>
|
|
<v-list-tile-content>
|
|
<v-list-tile-title>
|
|
{{ formatDateTime(item.LogPacketCreated) }}
|
|
</v-list-tile-title>
|
|
<v-list-tile-sub-title>
|
|
{{ item.LogPacketType }} - {{ item.LogPacketUserName || '-' }}
|
|
</v-list-tile-sub-title>
|
|
</v-list-tile-content>
|
|
</v-list-tile>
|
|
</v-list>
|
|
</v-card>
|
|
</v-flex>
|
|
|
|
<v-flex xs12 md8 pa-2 class="log-detail-wrapper">
|
|
<v-card outlined>
|
|
<v-card-title class="subtitle-1 font-weight-bold">
|
|
Detail Log
|
|
</v-card-title>
|
|
<v-divider></v-divider>
|
|
|
|
<div v-if="_.isEmpty(selected_log_detail)" class="pa-3">
|
|
Silakan klik tanggal log untuk melihat detail.
|
|
</div>
|
|
|
|
<v-layout v-else row wrap class="pa-2">
|
|
<v-flex xs12 class="log-meta">
|
|
<div class="log-meta-item">
|
|
<strong>Tanggal:</strong>
|
|
{{ formatDateTime(selected_log_detail.LogPacketCreated) }}
|
|
</div>
|
|
<div class="log-meta-item">
|
|
<strong>Type:</strong>
|
|
{{ selected_log_detail.LogPacketType || '-' }}
|
|
</div>
|
|
<div class="log-meta-item">
|
|
<strong>User:</strong>
|
|
{{ selected_log_detail.LogPacketUserName || '-' }}
|
|
</div>
|
|
</v-flex>
|
|
|
|
<v-flex xs12>
|
|
<v-switch
|
|
v-model="showAllLogFields"
|
|
label="Tampilkan semua field"
|
|
class="ma-2"
|
|
hide-details
|
|
></v-switch>
|
|
</v-flex>
|
|
|
|
<v-flex xs12 pa-2>
|
|
<v-card outlined>
|
|
<v-card-title class="subtitle-2 font-weight-bold">
|
|
Perubahan Data
|
|
</v-card-title>
|
|
<v-divider></v-divider>
|
|
|
|
<v-card-text class="pt-2 pr-2 pb-2 pl-2">
|
|
<div v-if="logDetailRows.length === 0" class="pa-3 grey--text text--darken-1">
|
|
Tidak ada perubahan data yang bisa ditampilkan.
|
|
</div>
|
|
|
|
<div v-else class="log-table-wrapper">
|
|
<table class="log-table">
|
|
<colgroup>
|
|
<col style="width: 30%;">
|
|
<col style="width: 35%;">
|
|
<col style="width: 35%;">
|
|
</colgroup>
|
|
<thead>
|
|
<tr>
|
|
<th>Field</th>
|
|
<th>Before</th>
|
|
<th>After</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr
|
|
v-for="(row, index) in logDetailRows"
|
|
:key="index"
|
|
:class="{ 'row-changed': row.isChanged }"
|
|
>
|
|
<td class="field-name">
|
|
<div class="log-cell-content">
|
|
{{ row.label }}
|
|
</div>
|
|
</td>
|
|
|
|
<td class="log-value-cell">
|
|
<div class="log-cell-content">
|
|
<template v-if="Array.isArray(row.before)">
|
|
<div
|
|
v-for="(itemBefore, idxBefore) in row.before"
|
|
:key="'before-' + index + '-' + idxBefore"
|
|
class="log-list-item"
|
|
>
|
|
{{ itemBefore }}
|
|
</div>
|
|
</template>
|
|
<template v-else>
|
|
<div class="log-list-item">{{ row.before }}</div>
|
|
</template>
|
|
</div>
|
|
</td>
|
|
|
|
<td class="log-value-cell">
|
|
<div class="log-cell-content">
|
|
<template v-if="Array.isArray(row.after)">
|
|
<div
|
|
v-for="(itemAfter, idxAfter) in row.after"
|
|
:key="'after-' + index + '-' + idxAfter"
|
|
class="log-list-item"
|
|
>
|
|
{{ itemAfter }}
|
|
</div>
|
|
</template>
|
|
<template v-else>
|
|
<div class="log-list-item">{{ row.after }}</div>
|
|
</template>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</v-card-text>
|
|
</v-card>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card-text>
|
|
</v-card>
|
|
</v-dialog>
|
|
<!-- dialog log packet end -->
|
|
|
|
<!-- listing start -->
|
|
<v-card class="mb-2 pa-2 searchbox">
|
|
<v-layout row>
|
|
<!-- filter start -->
|
|
<v-flex pt-1 pl-2 pr-2 pb-1 xs7>
|
|
<v-text-field
|
|
color="black"
|
|
label="Cari"
|
|
placeholder="Ketikkan Nama, Lalu tekan Enter"
|
|
v-model="search_tpacket"
|
|
@keyup.enter="searchTPacket()"
|
|
single-line
|
|
hide-details
|
|
></v-text-field>
|
|
</v-flex>
|
|
<!-- dropdown t_headerprice start -->
|
|
<v-flex pt-1 pl-2 pb-1 xs5>
|
|
<v-select
|
|
:items="xtpriceheaderCb"
|
|
v-model="selected_tpriceheaderCb"
|
|
item-text="T_PriceHeaderName"
|
|
hide-details
|
|
item-value="T_PriceHeaderID"
|
|
return-object
|
|
label="Price Header"
|
|
@change="onPriceHeaderChange"
|
|
>
|
|
</v-select>
|
|
</v-flex>
|
|
<!-- dropdown t_headerprice end -->
|
|
<!-- add button start -->
|
|
<v-flex class="text-xs-right">
|
|
<span
|
|
:disabled="T_PacketIsGenerated === 'Y'"
|
|
@click="setNewPacketX" class="icon-medium-fill-base xs1 white--text primary mr-0 icon-add"></span>
|
|
</v-flex>
|
|
<!-- add button end -->
|
|
<!-- filter end -->
|
|
</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="tpackets"
|
|
:loading="isLoading"
|
|
hide-actions
|
|
class="elevation-1">
|
|
<template slot="items" slot-scope="props">
|
|
<td v-bind:class="{'amber lighten-4':isSelected(props.item)}" class="text-xs-left pa-1">
|
|
<p style="font-weight: bold;" class="mb-0">{{ props.item.T_PacketType}} : {{ props.item.T_PacketSasCode}}</p>
|
|
<p class="mb-0"><code>{{ props.item.T_PriceHeaderName}}</code></p>
|
|
</td>
|
|
<td v-bind:class="{'amber lighten-4':isSelected(props.item)}" class="text-xs-left pa-1">
|
|
{{ props.item.T_PacketName}} <br/>
|
|
<span style="font-weight: bold;">{{ props.item.T_PacketStartDateTxt }} / {{ props.item.T_PacketEndDateTxt }}</span>
|
|
</td>
|
|
<td v-bind:class="{'amber lighten-4':isSelected(props.item)}" class="text-xs-left pa-1">
|
|
<v-btn
|
|
v-if="parseInt(props.item.LogTotal || 0) > 0"
|
|
style="min-width:25px; margin:0"
|
|
color="secondary"
|
|
@click="openLogDialog(props.item)"
|
|
small
|
|
>
|
|
<v-icon small>remove_red_eye</v-icon>
|
|
</v-btn>
|
|
|
|
<v-btn
|
|
style="min-width:25px; margin:0"
|
|
color="amber"
|
|
@click="openCopyPacket(props.item)"
|
|
small
|
|
>
|
|
<v-icon small>file_copy</v-icon>
|
|
</v-btn>
|
|
|
|
<v-btn
|
|
style="min-width:25px; margin:0" color="info"
|
|
@click="editRow(props.item)" small
|
|
>
|
|
<v-icon small>edit</v-icon>
|
|
</v-btn>
|
|
|
|
<v-btn
|
|
style="min-width:25px; margin:0" small
|
|
@click="validateRow(props.item)" dark
|
|
:color="validateColor(props.item)"
|
|
>
|
|
<v-icon v-if="props.item.T_PacketIsValidated == 'N'" dark>done</v-icon>
|
|
<v-icon v-else dark>done_all</v-icon>
|
|
</v-btn>
|
|
|
|
<v-btn
|
|
:disabled="props.item.T_PacketIsGenerated === 'Y'"
|
|
style="min-width:25px; margin:0" color="error"
|
|
@click="deleteData(props.item)" small
|
|
>
|
|
<v-icon small>close</v-icon>
|
|
</v-btn>
|
|
</td>
|
|
</template>
|
|
</v-data-table>
|
|
<v-pagination style="margin-top:10px;margin-bottom:10px" :total-visible="15" v-model="curr_page" :length="xtotal_page"></v-pagination>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card>
|
|
<!-- listing end -->
|
|
|
|
<one-dialog-alert :status="openalertconfirmation" :msg="msgalertconfirmation" @forget-dialog-alert="forgetAlertConfirmation()" @close-dialog-alert="closeAlertConfirmation()"></one-dialog-alert>
|
|
</v-layout>
|
|
</template>
|
|
|
|
<style>
|
|
.right-input input {
|
|
text-align: right;
|
|
}
|
|
|
|
.log-detail-wrapper {
|
|
min-height: 400px;
|
|
}
|
|
|
|
.log-detail-wrapper > .v-card {
|
|
width: 100%;
|
|
}
|
|
|
|
.log-detail-wrapper .v-card__text {
|
|
width: 100%;
|
|
}
|
|
|
|
.log-table-wrapper {
|
|
display: block;
|
|
width: 100%;
|
|
min-width: 100%;
|
|
overflow-x: auto;
|
|
min-height: 200px;
|
|
}
|
|
|
|
.log-table {
|
|
width: 100% !important;
|
|
min-width: 100%;
|
|
border-collapse: collapse;
|
|
table-layout: fixed;
|
|
font-size: 13px;
|
|
}
|
|
|
|
.log-table th,
|
|
.log-table td {
|
|
border: 1px solid #e0e0e0;
|
|
text-align: left;
|
|
vertical-align: top;
|
|
box-sizing: border-box;
|
|
padding: 8px 12px;
|
|
word-break: break-word;
|
|
overflow-wrap: break-word;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.log-table thead th {
|
|
background: #1565c0;
|
|
color: #ffffff;
|
|
font-weight: 600;
|
|
text-align: center;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
.log-table .field-name {
|
|
font-weight: 600;
|
|
background: #fafafa;
|
|
}
|
|
|
|
.log-table .row-changed td {
|
|
background: #fffde7;
|
|
}
|
|
|
|
.log-value-cell {
|
|
white-space: pre-line;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.log-list-item {
|
|
display: block;
|
|
margin-bottom: 4px;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.log-list-item:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.log-meta {
|
|
padding: 8px 8px 4px 8px;
|
|
}
|
|
|
|
.log-meta-item {
|
|
margin-bottom: 6px;
|
|
font-size: 13px;
|
|
}
|
|
|
|
.log-cell-content {
|
|
display: block;
|
|
width: 100%;
|
|
min-height: 100%;
|
|
}
|
|
|
|
.log-table td {
|
|
vertical-align: top !important;
|
|
}
|
|
|
|
.log-table .field-name {
|
|
vertical-align: top !important;
|
|
}
|
|
|
|
.log-list-item {
|
|
display: block;
|
|
margin: 0 0 4px 0;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.log-list-item:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
module.exports = {
|
|
components: {
|
|
'one-dialog-info' : httpVueLoader('../../common/oneDialogInfo.vue'),
|
|
'one-dialog-alert': httpVueLoader('../../common/oneDialogAlert.vue'),
|
|
'one-dialog-validate': httpVueLoader('./dialogValidationPacket.vue')
|
|
},
|
|
mounted() {
|
|
this.$store.dispatch("packet/getTPriceHeader")
|
|
this.$store.dispatch("packet/getTPriceHeaderCurrent")
|
|
this.$store.dispatch("packet/getGroupPemeriksaan")
|
|
|
|
// listing table
|
|
var prm = {}
|
|
prm.search = this.search_tpacket
|
|
prm.current_page = 1
|
|
prm.tpriceheader = "All"
|
|
// prm.natsubgroup = "All"
|
|
this.$store.commit("packet/update_current_page", 1)
|
|
this.$store.dispatch("packet/searchv0", prm)
|
|
},
|
|
methods: {
|
|
closeFormCopy(){
|
|
this.inp_T_PacketNameCopy = ""
|
|
this.$store.commit("packet/update_dialog_copy", false)
|
|
},
|
|
openCopyPacket(row){
|
|
console.log('item edit ', row)
|
|
this.$store.commit("packet/update_selected_packet", row)
|
|
this.$store.commit("packet/update_dialog_copy", true)
|
|
},
|
|
closeDialogSuccessCopy() {
|
|
var prm = {}
|
|
prm.T_PacketID = this.$store.state.packet.selected_packet.T_PacketID;
|
|
prm.inp_T_PacketNameCopy = this.inp_T_PacketNameCopy;
|
|
|
|
console.log('data copy',prm)
|
|
this.$store.dispatch("packet/copypacket", prm)
|
|
},
|
|
disabledItem(item){
|
|
if(item.T_PriceHeaderIsGenerated === 'Y'){
|
|
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')}`
|
|
},
|
|
changeGroupPemeriksaanForm(selectedItem){
|
|
console.log('Selected item pemeriksaan:', selectedItem.Nat_SubGroupID);
|
|
this.$store.commit("packet/update_selected_natsubgroupCb", {
|
|
Nat_SubGroupID: selectedItem.Nat_SubGroupID,
|
|
Nat_SubGroupNat_GroupID:"",
|
|
Nat_SubGroupCode:"",
|
|
Nat_SubGroupName:selectedItem.Nat_SubGroupName,
|
|
Nat_SubGroupLangName:"",
|
|
Nat_SubGroupIsResult:"",
|
|
Nat_SubGroupReportTitle:"",
|
|
Nat_SubGroupCreated:"",
|
|
Nat_SubGroupLastUpdated:"",
|
|
Nat_SubGroupIsActive:""
|
|
})
|
|
this.search_nama = "";
|
|
this.search_kode = "";
|
|
this.searchKode()
|
|
},
|
|
changePriceHeaderForm(selectedItem){
|
|
console.log('Selected item:', selectedItem.Nat_SubGroupID);
|
|
this.$store.commit("packet/update_selected_natsubgroupCb",{
|
|
Nat_SubGroupID:"All",
|
|
Nat_SubGroupNat_GroupID:"",
|
|
Nat_SubGroupCode:"",
|
|
Nat_SubGroupName:"All",
|
|
Nat_SubGroupLangName:"",
|
|
Nat_SubGroupIsResult:"",
|
|
Nat_SubGroupReportTitle:"",
|
|
Nat_SubGroupCreated:"",
|
|
Nat_SubGroupLastUpdated:"",
|
|
Nat_SubGroupIsActive:""
|
|
})
|
|
this.search_nama = "";
|
|
this.search_kode = "";
|
|
this.searchKode()
|
|
},
|
|
showFields(){
|
|
if(this.xtpacketRb === 'PR'){
|
|
this.tpacketdetails.forEach(detail => {
|
|
detail.T_PriceTotalPacket = detail.T_PriceTotal;
|
|
});
|
|
this.updateTotals()
|
|
}
|
|
},
|
|
editRow(row) {
|
|
console.log('item edit ', row)
|
|
this.$store.commit("packet/update_selected_packet", row)
|
|
this.$store.commit("packet/update_act", 'edit')
|
|
this.$store.dispatch("packet/getPacketById", row)
|
|
},
|
|
deleteData(row){
|
|
console.log('item delete ', row)
|
|
this.$store.commit("packet/update_selected_packet", row)
|
|
console.log(this.$store.state.packet.selected_packet)
|
|
let msg = "Yakin, akan menghapus data paket " + this.$store.state.packet.selected_packet.T_PacketName + " ?"
|
|
this.$store.commit("packet/update_msg_confirmation_delete", msg)
|
|
this.$store.commit("packet/update_dialog_confirmation_delete", true)
|
|
},
|
|
doDeleteData() {
|
|
var prm = {}
|
|
prm.id = this.$store.state.packet.selected_packet.T_PacketID
|
|
prm.name = this.$store.state.packet.selected_packet.T_PacketName
|
|
console.log(prm)
|
|
this.$store.dispatch("packet/deletev0", prm)
|
|
},
|
|
closeForm(){
|
|
this.$store.commit("packet/update_inp_T_PacketName", "")
|
|
this.$store.commit("packet/update_selected_tpriceheaderformCb",{})
|
|
this.$store.commit("packet/update_selected_natsubgroupCb",{})
|
|
this.$store.commit("packet/update_tpackettypeRb",'PN')
|
|
this.$store.commit("packet/update_tpacketOpsional",'N')
|
|
this.$store.commit("packet/update_tpacketdetails", [])
|
|
this.$store.commit("packet/update_tpacketdetails_filtered", [])
|
|
this.$store.commit("packet/update_totalTPriceAwal", 0)
|
|
this.$store.commit("packet/update_totalTPricePacket", 0)
|
|
this.$store.commit("packet/update_search_nama", "")
|
|
this.$store.commit("packet/update_search_kode", "")
|
|
this.$store.commit("packet/update_tprices",[])
|
|
this.$store.commit("packet/update_total_prices",0)
|
|
this.$store.commit("packet/update_dialog_add", false)
|
|
},
|
|
closeDialogError(){
|
|
this.$store.commit("packet/update_dialog_error", false)
|
|
},
|
|
updatePrice(value,item) {
|
|
item.T_PriceTotalPacket = parseFloat(value.replace(/[^\d.-]/g, ''));
|
|
this.totalTPricePacket = this.tpacketdetails.reduce((sum, item) => {
|
|
const pricePacket = parseFloat(item.T_PriceTotalPacket) || 0;
|
|
return sum + pricePacket;
|
|
}, 0);
|
|
},
|
|
convertMoney(money) {
|
|
return one_money(money)
|
|
},
|
|
updateTotals() {
|
|
this.totalTPricePacket = this.tpacketdetails.reduce((sum, item) => {
|
|
const pricePacket = parseFloat(item.T_PriceTotalPacket) || 0;
|
|
return sum + pricePacket;
|
|
}, 0);
|
|
|
|
this.totalTPriceAwal = this.tpacketdetails.reduce((sum, item) => {
|
|
const priceTotal = parseFloat(item.T_PriceTotal) || 0;
|
|
return sum + priceTotal;
|
|
}, 0);
|
|
},
|
|
savePacket() {
|
|
var prm = {
|
|
xid:this.$store.state.packet.xid,
|
|
act:this.$store.state.packet.act,
|
|
namapacket:this.$store.state.packet.inp_T_PacketName,
|
|
priceheader:this.$store.state.packet.selected_tpriceheaderformCb,
|
|
jenispacket:this.$store.state.packet.tpackettypeRb,
|
|
detailpacket:this.$store.state.packet.tpacketdetails,
|
|
T_PacketOriginalPrice: this.totalTPriceAwal,
|
|
T_PacketPrice: this.totalTPricePacket,
|
|
T_PacketStartDate: this.$store.state.packet.start_date,
|
|
T_PacketEndDate: this.$store.state.packet.end_date,
|
|
isOpsional: this.$store.state.packet.tpacketOpsional,
|
|
lastid: -1
|
|
};
|
|
|
|
// console.log('inputan ',prm)
|
|
this.$store.dispatch("packet/savesetupv0", prm)
|
|
},
|
|
removeFromDetailPackets(item) {
|
|
var selected_tpacketdetails = this.$store.state.packet.tpacketdetails
|
|
var idx = _.findIndex(selected_tpacketdetails, function(o) { return parseInt(o.T_TestID) === parseInt(item.T_TestID)})
|
|
selected_tpacketdetails.splice(idx, 1)
|
|
this.updateTotals();
|
|
},
|
|
packetExist(item) {
|
|
var selected_tpacketdetails = this.$store.state.packet.tpacketdetails
|
|
var idx = _.findIndex(selected_tpacketdetails, function(o) { return parseInt(o.T_TestID) === parseInt(item.T_TestID)})
|
|
if(idx === -1){
|
|
return true
|
|
}
|
|
else{
|
|
return false
|
|
}
|
|
},
|
|
itemSelectedToPush(row){
|
|
var arrTx = [];
|
|
arrTx.push(row);
|
|
|
|
for (let x = 0; x < arrTx.length; x++) {
|
|
let alreadyExists = false;
|
|
for (let index = 0; index < this.tpacketdetails.length; index++) {
|
|
if (this.tpacketdetails[index].T_TestID === arrTx[x].T_TestID) {
|
|
alreadyExists = true;
|
|
break;
|
|
}
|
|
}
|
|
if (!alreadyExists) {
|
|
this.tpacketdetails.push({
|
|
T_PacketDetailT_TestID: arrTx[x].T_PriceT_TestID,
|
|
T_PriceTotal: arrTx[x].T_PriceTotal,
|
|
T_PriceTotalPacket: arrTx[x].T_PriceTotalPacket,
|
|
T_PacketDetailIsActive: arrTx[x].T_PriceIsActive,
|
|
T_PacketDetailCreated: arrTx[x].T_PriceCreated,
|
|
T_PacketDetailLastUpdated: arrTx[x].T_PriceLastUpdated,
|
|
T_PacketDetailPriceAmount: arrTx[x].T_PriceAmount,
|
|
T_PacketDetailPriceDisc: arrTx[x].T_PriceDisc,
|
|
T_PacketDetailPriceDiscRp: arrTx[x].T_PriceDiscRp,
|
|
T_PacketDetailPriceSubTotal: arrTx[x].T_PriceSubTotal,
|
|
T_TestID: arrTx[x].T_TestID,
|
|
T_TestName: arrTx[x].T_TestName
|
|
})
|
|
this.updateTotals();
|
|
}
|
|
}
|
|
|
|
console.log('item selected to push', this.$store.state.packet.tpacketdetails)
|
|
},
|
|
isSelectedTPrice(p) {
|
|
return p.T_PriceID == this.$store.state.packet.selected_tprice.T_PriceID
|
|
},
|
|
getpricelist(){
|
|
var prm = {}
|
|
prm.tpriceheader = this.selected_tpriceheaderformCb.T_PriceHeaderID
|
|
prm.natsubgroup = this.$store.state.packet.selected_natsubgroupCb.Nat_SubGroupID
|
|
prm.searchNama = this.search_nama
|
|
prm.searchKode = this.search_kode
|
|
prm.current_page = this.curr_page_tprice
|
|
this.$store.commit("packet/update_current_page_tprice", 1)
|
|
this.$store.dispatch("packet/searchTPricev0", prm)
|
|
},
|
|
searchKode(){
|
|
this.getpricelist()
|
|
},
|
|
searchNama(){
|
|
var prm = {}
|
|
prm.tpriceheader = this.selected_tpriceheaderformCb.T_PriceHeaderID
|
|
prm.natsubgroup = this.$store.state.packet.selected_natsubgroupCb.Nat_SubGroupID
|
|
prm.searchNama = this.search_nama
|
|
prm.searchKode = this.search_kode
|
|
prm.current_page = this.curr_page_tprice
|
|
this.$store.commit("packet/update_current_page_tprice", 1)
|
|
this.$store.dispatch("packet/searchTPricev0", prm)
|
|
},
|
|
onPriceHeaderChange(valuePriceHeader){
|
|
var prm = {}
|
|
prm.search = this.search_tpacket
|
|
prm.current_page = 1
|
|
prm.tpriceheader = valuePriceHeader.T_PriceHeaderID
|
|
this.$store.commit("packet/update_current_page", 1)
|
|
this.$store.dispatch("packet/searchv0", prm)
|
|
},
|
|
isSelected(p) {
|
|
return p.T_PacketID == this.$store.state.packet.selected_packet.T_PacketID
|
|
},
|
|
setNewPacketX(){
|
|
this.$store.commit("packet/update_act", 'new')
|
|
this.$store.commit("packet/update_xid", -1)
|
|
this.$store.commit("packet/update_dialog_add", true)
|
|
},
|
|
searchTPacket(){
|
|
var prm = {}
|
|
prm.search = this.search_tpacket
|
|
prm.current_page = this.curr_page
|
|
prm.tpriceheader = this.$store.state.packet.selected_tpriceheaderCb.T_PriceHeaderID
|
|
this.$store.commit("packet/update_current_page", 1)
|
|
this.$store.dispatch("packet/searchv0", prm)
|
|
},
|
|
closeAlertConfirmation() {
|
|
this.$store.commit("packet/update_open_alert_confirmation", false)
|
|
},
|
|
forgetAlertConfirmation() {
|
|
this.$store.commit("packet/update_no_save", 0)
|
|
this.$store.commit("packet/update_open_alert_confirmation", false)
|
|
},
|
|
closeDialogSuccess() {
|
|
let arrpacket = this.$store.state.packet.tpackets
|
|
var idx = _.findIndex(arrpacket, item => item.T_PacketID === this.$store.state.packet.last_id)
|
|
console.log(idx)
|
|
|
|
this.$store.dispatch("packet/searchv0", {
|
|
search: this.search_tpacket,
|
|
tpriceheader: this.$store.state.packet.selected_tpriceheaderCb.T_PriceHeaderID,
|
|
current_page: this.curr_page,
|
|
lastid: idx
|
|
})
|
|
this.$store.commit("packet/update_dialog_success", false)
|
|
},
|
|
searchDetailItem() {
|
|
const keyword = this.selected_detail_search;
|
|
const original = this.tpacketdetails;
|
|
if (original.length <= 0) {
|
|
this.tpacketdetails_filtered = original
|
|
return
|
|
}
|
|
|
|
const filtered = original.filter(item =>
|
|
item.T_TestName.toLowerCase().includes(keyword.toLowerCase())
|
|
);
|
|
this.tpacketdetails_filtered = filtered
|
|
},
|
|
validateRow(item) {
|
|
this.$store.commit("packet/update_dialog_validation", true)
|
|
this.$store.commit("packet/update_selected_packet", item)
|
|
},
|
|
validateColor(item) {
|
|
if (item.T_PacketIsValidated == 'N') {
|
|
return 'indigo'
|
|
} else {
|
|
return 'purple'
|
|
}
|
|
},
|
|
async openLogDialog(row){
|
|
this.$store.commit("packet/update_selected_log_packet", row)
|
|
this.$store.commit("packet/update_selected_log_detail", {})
|
|
this.$store.commit("packet/update_packet_logs", [])
|
|
this.$store.commit("packet/update_dialog_log", true)
|
|
|
|
await this.$store.dispatch("packet/getPacketLogs", {
|
|
T_PacketID: row.T_PacketID
|
|
})
|
|
|
|
},
|
|
selectLogDetail(item){
|
|
this.$store.commit("packet/update_selected_log_detail", item)
|
|
},
|
|
closeDialogLog(){
|
|
this.$store.commit("packet/update_dialog_log", false)
|
|
this.$store.commit("packet/update_selected_log_detail", {})
|
|
this.$store.commit("packet/update_packet_logs", [])
|
|
this.$store.commit("packet/update_selected_log_packet", {})
|
|
},
|
|
formatDateTime(val){
|
|
if (!val || val === '0000-00-00 00:00:00') return '-'
|
|
return moment(val).format('DD MMMM YYYY HH:mm:ss')
|
|
},
|
|
getLogFieldLabels() {
|
|
return {
|
|
T_PacketType: 'Jenis Paket',
|
|
T_PacketName: 'Nama Paket',
|
|
T_PacketPrice: 'Harga Paket',
|
|
T_PacketOriginalPrice: 'Harga Awal',
|
|
T_PacketSasCode: 'Kode Paket',
|
|
T_PacketStartDate: 'Tanggal Mulai',
|
|
T_PacketEndDate: 'Tanggal Akhir',
|
|
T_PacketIsGenerated: 'Generated',
|
|
T_PacketGeneratedDate: 'Tanggal Generated',
|
|
T_PacketIsOptional: 'Paket Opsional',
|
|
T_PacketIsValidated: 'Validated',
|
|
T_PacketValidatedCode: 'Kode Validasi',
|
|
T_PacketValidatedDate: 'Tanggal Validasi',
|
|
T_PacketValidatedUserID: 'User Validasi',
|
|
T_PacketIsActive: 'Status Aktif',
|
|
T_PacketCreated: 'Tanggal Dibuat',
|
|
T_PacketLastUpdated: 'Tanggal Update',
|
|
T_PacketOriginalBruto: 'Harga Bruto',
|
|
detail: 'Detail Paket'
|
|
}
|
|
},
|
|
normalizeLogValue(val, key = '') {
|
|
if (_.isNil(val) || val === '') return '-'
|
|
|
|
if (_.isArray(val)) {
|
|
if (key === 'detail') {
|
|
if (val.length === 0) return []
|
|
|
|
return val.map((item, index) => {
|
|
const testName =
|
|
item.T_TestName ||
|
|
item.T_TestLabel ||
|
|
item.TestName ||
|
|
item.NamaTest ||
|
|
'-'
|
|
|
|
const price =
|
|
!_.isNil(item.T_PacketDetailPrice)
|
|
? item.T_PacketDetailPrice
|
|
: (!_.isNil(item.T_PriceTotalPacket)
|
|
? item.T_PriceTotalPacket
|
|
: null)
|
|
|
|
return `${index + 1}. ${testName}${price !== null ? ' - ' + one_money(price) : ''}`
|
|
})
|
|
}
|
|
|
|
return `${val.length} item`
|
|
}
|
|
|
|
if (_.isObject(val)) {
|
|
if (!_.isNil(val.name)) return val.name
|
|
if (!_.isNil(val.display)) return val.display
|
|
return JSON.stringify(val, null, 2)
|
|
}
|
|
|
|
if (val === 'Y') return 'Ya'
|
|
if (val === 'N') return 'Tidak'
|
|
|
|
return String(val)
|
|
},
|
|
buildLogDetailRows(beforeData, afterData) {
|
|
const labels = this.getLogFieldLabels()
|
|
const excludedFields = [
|
|
'T_PacketID',
|
|
'T_PacketOldPriceID',
|
|
'T_PacketOldCompanyID',
|
|
'T_PacketT_PriceHeaderID'
|
|
]
|
|
|
|
const beforeObj = _.isPlainObject(beforeData) ? beforeData : {}
|
|
const afterObj = _.isPlainObject(afterData) ? afterData : {}
|
|
|
|
const keys = _.uniq([
|
|
...Object.keys(beforeObj),
|
|
...Object.keys(afterObj)
|
|
])
|
|
|
|
return keys
|
|
.filter(key => !excludedFields.includes(key))
|
|
.map(key => {
|
|
const beforeValRaw = beforeObj[key]
|
|
const afterValRaw = afterObj[key]
|
|
|
|
const beforeVal = this.normalizeLogValue(beforeValRaw, key)
|
|
const afterVal = this.normalizeLogValue(afterValRaw, key)
|
|
|
|
return {
|
|
key,
|
|
label: labels[key] || key,
|
|
before: beforeVal,
|
|
after: afterVal,
|
|
isChanged: JSON.stringify(beforeVal) !== JSON.stringify(afterVal)
|
|
}
|
|
})
|
|
.filter(row => this.showAllLogFields ? true : row.isChanged || (_.isEmpty(beforeObj) && !_.isEmpty(afterObj)))
|
|
},
|
|
},
|
|
computed: {
|
|
selectedPacket(){
|
|
return this.$store.state.packet.selected_packet
|
|
},
|
|
T_PacketIsGenerated:{
|
|
get() {
|
|
return this.$store.state.packet.T_PacketIsGenerated
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_T_PacketIsGenerated",val)
|
|
}
|
|
},
|
|
xdatestart : {
|
|
get() {
|
|
return this.$store.state.packet.start_date
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_start_date",val)
|
|
}
|
|
},
|
|
xdateend : {
|
|
get() {
|
|
return this.$store.state.packet.end_date
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_end_date",val)
|
|
//this.searchTransaction()
|
|
}
|
|
},
|
|
filterComputedDateFormattedStart () {
|
|
return this.formatDate(this.xdatestart)
|
|
},
|
|
filterComputedDateFormattedEnd () {
|
|
return this.formatDate(this.xdateend)
|
|
},
|
|
dialogconfirmationdelete: {
|
|
get() {
|
|
return this.$store.state.packet.dialog_confirmation_delete
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_dialog_confirmation_delete", val)
|
|
}
|
|
},
|
|
msgconfirmationdelete() {
|
|
return this.$store.state.packet.msg_confirmation_delete
|
|
},
|
|
xnatsubgroupCb() {
|
|
return this.$store.state.packet.natsubgroupCb
|
|
},
|
|
selected_natsubgroupCb: {
|
|
get() {
|
|
return this.$store.state.packet.selected_natsubgroupCb
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_selected_natsubgroupCb", val)
|
|
if(!_.isEmpty(val)){
|
|
this.getpricelist()
|
|
}
|
|
}
|
|
},
|
|
dialogerror: {
|
|
get() {
|
|
return this.$store.state.packet.dialog_error
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_dialog_error", val)
|
|
}
|
|
},
|
|
msgerror() {
|
|
return this.$store.state.packet.msg_error
|
|
},
|
|
totalTPricePacket:{
|
|
get(){
|
|
return this.$store.state.packet.totalTPricePacket
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_totalTPricePacket", val)
|
|
},
|
|
},
|
|
totalTPriceAwal:{
|
|
get(){
|
|
return this.$store.state.packet.totalTPriceAwal
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_totalTPriceAwal", val)
|
|
},
|
|
},
|
|
tpacketdetails: {
|
|
// return this.$store.state.packet.tpacketdetails
|
|
get() {
|
|
return this.$store.state.packet.tpacketdetails
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_tpacketdetails", val)
|
|
}
|
|
},
|
|
curr_page_tpacketdetails: {
|
|
get() {
|
|
return this.$store.state.packet.current_page_tpacketdetails
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_current_page_tpacketdetails", val)
|
|
// var prm = {}
|
|
// prm.searchNama = this.search_nama
|
|
// prm.searchKode = this.search_kode
|
|
// prm.current_page = val
|
|
// // prm.tpriceheader = this.$store.state.packet.selected_tpriceheaderCb.T_PriceHeaderID
|
|
// // this.$store.commit("packet/update_current_page", 1)
|
|
// this.$store.dispatch("packet/searchTPricev0", prm)
|
|
}
|
|
},
|
|
xtotal_page_tpacketdetails: {
|
|
get() {
|
|
return this.$store.state.packet.total_tpacketdetails
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_total_tpacketdetails", val)
|
|
}
|
|
},
|
|
tpacketdetails_filtered: {
|
|
get() {
|
|
return this.$store.state.packet.tpacketdetails_filtered
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_tpacketdetails_filtered", val)
|
|
}
|
|
},
|
|
display_tpacketdetails() {
|
|
const start = (this.selected_detail_page - 1) * this.selected_detail_perpage;
|
|
const end = start + this.selected_detail_perpage;
|
|
return this.tpacketdetails_filtered.slice(start, end);
|
|
},
|
|
display_total_perpage() {
|
|
if (this.tpacketdetails_filtered.length <= 0) {
|
|
return 1;
|
|
}
|
|
return Math.ceil(this.tpacketdetails_filtered.length / this.selected_detail_perpage);
|
|
},
|
|
pricepackets: {
|
|
get() {
|
|
return this.$store.state.packet.pricepackets
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_pricepackets", val)
|
|
}
|
|
},
|
|
xtpacketRb:{
|
|
get() {
|
|
return this.$store.state.packet.tpackettypeRb
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_tpackettypeRb", val)
|
|
}
|
|
},
|
|
xtpacketOpsional: {
|
|
get() {
|
|
return this.$store.state.packet.tpacketOpsional
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_tpacketOpsional", val)
|
|
}
|
|
},
|
|
tprices() {
|
|
return this.$store.state.packet.tprices
|
|
},
|
|
curr_page_tprice: {
|
|
get() {
|
|
return this.$store.state.packet.current_page_tprice
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_current_page_tprice", val)
|
|
var prm = {}
|
|
prm.natsubgroup = this.selected_natsubgroupCb.Nat_SubGroupID
|
|
prm.searchNama = this.search_nama
|
|
prm.searchKode = this.search_kode
|
|
prm.current_page = val
|
|
prm.tpriceheader = this.selected_tpriceheaderformCb.T_PriceHeaderID
|
|
// this.$store.commit("packet/update_current_page", 1)
|
|
this.$store.dispatch("packet/searchTPricev0", prm)
|
|
}
|
|
},
|
|
xtotal_page_tprice: {
|
|
get() {
|
|
return this.$store.state.packet.total_prices
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_total_prices", val)
|
|
}
|
|
},
|
|
xtpriceheaderformCb() {
|
|
return this.$store.state.packet.tpriceheaderformCb
|
|
},
|
|
selected_tpriceheaderformCb: {
|
|
get() {
|
|
return this.$store.state.packet.selected_tpriceheaderformCb
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_selected_tpriceheaderformCb", val)
|
|
if(!_.isEmpty(val)){
|
|
this.getpricelist()
|
|
}
|
|
}
|
|
},
|
|
search_kode: {
|
|
get() {
|
|
return this.$store.state.packet.search_kode
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_search_kode", val)
|
|
this.$store.commit("packet/update_no_save", 1)
|
|
}
|
|
},
|
|
search_nama: {
|
|
get() {
|
|
return this.$store.state.packet.search_nama
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_search_nama", val)
|
|
this.$store.commit("packet/update_no_save", 1)
|
|
}
|
|
},
|
|
inp_T_PacketName:{
|
|
get() {
|
|
return this.$store.state.packet.inp_T_PacketName
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_inp_T_PacketName", val)
|
|
}
|
|
},
|
|
inp_T_PacketNameCopy:{
|
|
get() {
|
|
return this.$store.state.packet.inp_T_PacketNameCopy
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_inp_T_PacketNameCopy", val)
|
|
}
|
|
},
|
|
xact() {
|
|
return this.$store.state.packet.act
|
|
},
|
|
dialogadd: {
|
|
get() {
|
|
return this.$store.state.packet.dialog_add
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_dialog_add", val)
|
|
}
|
|
},
|
|
dialogedit: {
|
|
get() {
|
|
return this.$store.state.packet.dialog_edit
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_dialog_edit", val)
|
|
}
|
|
},
|
|
curr_page: {
|
|
get() {
|
|
return this.$store.state.packet.current_page
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_current_page", val)
|
|
// this.$store.dispatch("packet/searchv0", {
|
|
// status: this.status,
|
|
// current_page: val,
|
|
// lastid: -1
|
|
// })
|
|
var prm = {}
|
|
prm.search = this.search_tpacket
|
|
// prm.natsubgroup = this.selected_natsubgroupCb
|
|
prm.current_page = val
|
|
prm.tpriceheader = this.$store.state.packet.selected_tpriceheaderCb.T_PriceHeaderID
|
|
// this.$store.commit("packet/update_current_page", 1)
|
|
this.$store.dispatch("packet/searchv0", prm)
|
|
}
|
|
},
|
|
xtotal_page: {
|
|
get() {
|
|
return this.$store.state.packet.total_packets
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_total_packets", val)
|
|
}
|
|
},
|
|
tpackets() {
|
|
return this.$store.state.packet.tpackets
|
|
},
|
|
isLoading() {
|
|
return this.$store.state.packet.search_status == 1
|
|
},
|
|
xtpriceheaderCb() {
|
|
return this.$store.state.packet.tpriceheaderCb
|
|
},
|
|
selected_tpriceheaderCb: {
|
|
get() {
|
|
return this.$store.state.packet.selected_tpriceheaderCb
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_selected_tpriceheaderCb", val)
|
|
}
|
|
},
|
|
search_tpacket: {
|
|
get() {
|
|
return this.$store.state.packet.search_tpacket
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_search_tpacket", val)
|
|
this.$store.commit("packet/update_no_save", 1)
|
|
}
|
|
},
|
|
dialogsuccess: {
|
|
get() {
|
|
return this.$store.state.packet.dialog_success
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_dialog_success", val)
|
|
}
|
|
},
|
|
dialogcopy: {
|
|
get() {
|
|
return this.$store.state.packet.dialog_copy
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_dialog_copy", val)
|
|
}
|
|
},
|
|
msgsuccess() {
|
|
return this.$store.state.packet.msg_success
|
|
},
|
|
openalertconfirmation: {
|
|
get() {
|
|
return this.$store.state.packet.open_alert_confirmation
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_open_alert_confirmation", val)
|
|
}
|
|
},
|
|
dialoglog: {
|
|
get() {
|
|
return this.$store.state.packet.dialog_log
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_dialog_log", val)
|
|
}
|
|
},
|
|
packet_logs() {
|
|
return this.$store.state.packet.packet_logs
|
|
},
|
|
selected_log_detail() {
|
|
return this.$store.state.packet.selected_log_detail
|
|
},
|
|
selected_log_packet() {
|
|
return this.$store.state.packet.selected_log_packet
|
|
},
|
|
logLoading() {
|
|
return this.$store.state.packet.log_status == 1
|
|
},
|
|
logDetailRows() {
|
|
if (_.isEmpty(this.selected_log_detail)) return []
|
|
|
|
return this.buildLogDetailRows(
|
|
this.selected_log_detail.LogPacketJsonBeforeParsed,
|
|
this.selected_log_detail.LogPacketJsonAfterParsed
|
|
)
|
|
},
|
|
},
|
|
watch: {
|
|
search_priceheader(val){
|
|
if(val.length > 2){
|
|
this.$store.dispatch("packet/searchTPriceHeader", {search: val})
|
|
}
|
|
},
|
|
tpacketdetails(val) {
|
|
this.searchDetailItem()
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
search_natsubgroup: "",
|
|
search_priceheader: "",
|
|
menufilterdatestart:false,
|
|
menufilterdateend:false,
|
|
date: new Date().toISOString().substr(0, 10),
|
|
msgalertconfirmation: "Perubahan yang telah dilakukan belum disimpan dong !",
|
|
page: 1,
|
|
headers: [
|
|
{
|
|
text: "JENIS PAKET",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "mr",
|
|
width: "20%",
|
|
class: "pa-2 primary white--text"
|
|
},
|
|
{
|
|
text: "NAMA PAKET",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "lab",
|
|
width: "55%",
|
|
class: "pa-2 primary white--text"
|
|
},
|
|
{
|
|
text: "AKSI",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "lab",
|
|
width: "15%",
|
|
class: "pa-2 primary white--text"
|
|
}
|
|
],
|
|
pagination: {
|
|
descending: false,
|
|
page: 1,
|
|
rowsPerPage: 5,
|
|
sortBy: 'T_PacketID',
|
|
totalItems: this.$store.state.packet.total_packets
|
|
},
|
|
|
|
// t_price
|
|
headersTPrice: [
|
|
{
|
|
text: "KODE",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "mr",
|
|
width: "20%",
|
|
class: "pa-2 primary white--text"
|
|
},
|
|
{
|
|
text: "NAMA",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "lab",
|
|
width: "55%",
|
|
class: "pa-2 primary white--text"
|
|
},
|
|
{
|
|
text: "AKSI",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "lab",
|
|
width: "15%",
|
|
class: "pa-2 primary white--text"
|
|
}
|
|
],
|
|
paginationTPrice: {
|
|
descending: false,
|
|
page: 1,
|
|
rowsPerPage: 5,
|
|
sortBy: 'T_PriceID',
|
|
totalItems: this.$store.state.packet.total_prices
|
|
},
|
|
|
|
// t_packetdetail array
|
|
headersTPacketDetailArray: [
|
|
{
|
|
text: "NAMA",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "mr",
|
|
width: "20%",
|
|
class: "pa-2 primary white--text"
|
|
},
|
|
{
|
|
text: "HARGA AWAL",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "lab",
|
|
width: "27.5%",
|
|
class: "pa-2 primary white--text"
|
|
},
|
|
{
|
|
text: "HARGA PAKET",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "lab",
|
|
width: "27.5%",
|
|
class: "pa-2 primary white--text"
|
|
},
|
|
{
|
|
text: "AKSI",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "lab",
|
|
width: "15%",
|
|
class: "pa-2 primary white--text"
|
|
}
|
|
],
|
|
paginationTPacketDetailArray: {
|
|
descending: false,
|
|
page: 1,
|
|
rowsPerPage: 5,
|
|
sortBy: 'T_PriceID',
|
|
totalItems: this.$store.state.packet.total_tpacketdetails
|
|
},
|
|
selected_detail_page: 1,
|
|
selected_detail_perpage: 10,
|
|
selected_detail_search: "",
|
|
showAllLogFields: false,
|
|
}
|
|
},
|
|
}
|
|
</script>
|