437 lines
16 KiB
Vue
437 lines
16 KiB
Vue
<template>
|
|
<v-layout class="fill-height" column>
|
|
<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>
|
|
<v-card class="mb-2 pa-2 searchbox">
|
|
<v-layout align-center row>
|
|
<v-flex class="pa-1" xs3>
|
|
<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="Tanggal Awal"
|
|
outline
|
|
hide-details
|
|
readonly
|
|
v-on="on"
|
|
@blur="date = deFormatedDate(filterComputedDateFormattedStart)"
|
|
></v-text-field>
|
|
</template>
|
|
<v-date-picker v-model="xdatestart" no-title @input="menufilterdatestart = false"></v-date-picker>
|
|
</v-menu>
|
|
</v-flex>
|
|
<v-flex class="pa-1" xs3>
|
|
<v-menu
|
|
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
|
|
|
|
v-model="filterComputedDateFormattedEnd"
|
|
label="Tanggal Akhir"
|
|
outline
|
|
readonly
|
|
hide-details
|
|
v-on="on"
|
|
@blur="date = deFormatedDate(filterComputedDateFormattedEnd)"
|
|
></v-text-field>
|
|
</template>
|
|
<v-date-picker v-model="xdateend" no-title @input="menufilterdateend = false"></v-date-picker>
|
|
</v-menu>
|
|
</v-flex>
|
|
<v-flex class="pa-1" xs5>
|
|
<v-text-field
|
|
|
|
v-model="spk_search"
|
|
label="Cari"
|
|
outline
|
|
@keyup.enter="searchTransaction"
|
|
placeholder="Ketikkan nomor atau mcu lalu enter"
|
|
hide-details
|
|
></v-text-field>
|
|
</v-flex>
|
|
<v-flex class="pt-1 text-xs-right pr-0" xs1>
|
|
<span title="buat officer baru" @click="setNewTransaction" class="pt-1 icon-medium-fill-base white--text primary mt-1 ml-1 icon-add"></span>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card>
|
|
<v-card >
|
|
<v-layout row>
|
|
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
|
<v-data-table
|
|
:headers="headers"
|
|
:items="xtransactions"
|
|
:loading="isLoading"
|
|
hide-actions
|
|
class="elevation-1">
|
|
<template slot="items" slot-scope="props">
|
|
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
|
|
{{ props.item.trx_number }}
|
|
</td>
|
|
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.trx_date }}</td>
|
|
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.trx_datemcu }}</td>
|
|
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.mgmmcu_name }}</td>
|
|
|
|
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
|
|
<v-btn title="hapus semua" style="min-width:20px" @click="deleteAll(props.item)" small color="error"><v-icon small>delete</v-icon></v-btn>
|
|
</td>
|
|
</template>
|
|
</v-data-table>
|
|
<v-divider></v-divider>
|
|
<v-pagination
|
|
style="margin-top:10px;margin-bottom:10px"
|
|
v-model="curr_page"
|
|
:length="xtotal_page"
|
|
|
|
></v-pagination>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card>
|
|
<one-dialog-alert :status="openalertconfirmation" :msg="msgalertconfirmation" @forget-dialog-alert="forgetAlertConfirmation()" @close-dialog-alert="closeAlertConfirmation()"></one-dialog-alert>
|
|
<one-dialog-info :status="opendialoginfo" :msg="msginfo" @close-dialog-info="closeDialogInfo()"></one-dialog-info>
|
|
</v-layout>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.searchbox .v-input.v-text-field .v-input__slot{
|
|
min-height:40px;
|
|
}
|
|
.searchbox .v-btn {
|
|
min-height:40px;
|
|
}
|
|
table.v-table tbody td,table.v-table tbody th {
|
|
height: 40px;
|
|
}
|
|
|
|
table.v-table thead tr {
|
|
height: 40px;
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
|
module.exports = {
|
|
components : {
|
|
'one-dialog-info':httpVueLoader('../../common/oneDialogInfo.vue'),
|
|
'one-dialog-alert':httpVueLoader('../../common/oneDialogAlert.vue')
|
|
},
|
|
mounted() {
|
|
this.$store.dispatch("form/getmgmmcu")
|
|
// this.$store.dispatch("form/getstaff",{
|
|
// id:''
|
|
// })
|
|
//this.$store.dispatch("form/getkecamatan",{xdate:moment(new Date()).format('YYYY-MM-DD')})
|
|
this.$store.dispatch("samplestorage/search",{
|
|
startdate:this.xdatestart,
|
|
enddate: this.xdateend,
|
|
status:this.xselected_status.id,
|
|
current_page:1,
|
|
lastid:-1
|
|
})
|
|
},
|
|
methods : {
|
|
deleteAll(value){
|
|
this.$store.dispatch("form/deleteAll",value)
|
|
},
|
|
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.id == this.$store.state.samplestorage.selected_transaction.id
|
|
},
|
|
searchTransaction() {
|
|
this.$store.dispatch("samplestorage/search",{
|
|
startdate:this.xdatestart,
|
|
enddate: this.xdateend,
|
|
search:this.spk_search,
|
|
current_page:1,
|
|
lastid:-1
|
|
})
|
|
},
|
|
selectMe(trx) {
|
|
if(this.$store.state.samplestorage.no_save == 0 ){
|
|
console.log('trx',trx)
|
|
this.$store.commit("form/update_trx_id",trx.id)
|
|
this.$store.commit("samplestorage/update_selected_transaction",trx)
|
|
this.$store.commit("samplestorage/update_act",'edit')
|
|
this.$store.commit("form/update_transaction_number",trx.trx_number)
|
|
this.$store.commit("form/update_transaction_date",trx.xdate)
|
|
this.$store.commit("form/update_transaction_date_mcu",trx.xdatemcu)
|
|
this.$store.commit("form/update_transaction_time",trx.xtime)
|
|
this.$store.commit("form/update_selected_mgmmcu",{id:trx.mgmmcu_id,name:trx.mgmmcu_name})
|
|
this.$store.commit("form/update_transaction_note",trx.trx_note)
|
|
this.$store.commit("form/update_selected_staff",{id:trx.staff_id,name:trx.staff_name})
|
|
this.$store.commit("form/update_selected_officer_type",{id:trx.type_id,name:trx.type_name})
|
|
//console.log(trx.details)
|
|
//this.$store.commit("form/update_details",trx.details)
|
|
this.$store.dispatch("form/getdetails",{id:trx.id})
|
|
this.$store.dispatch("form/getstaff",{id:trx.id, search: ''})
|
|
this.$store.commit("form/update_deleted_details",[])
|
|
this.$store.commit("form/update_show_delete",false)
|
|
}else{
|
|
this.$store.commit("samplestorage/update_open_alert_confirmation",true)
|
|
}
|
|
},
|
|
closeAlertConfirmation(){
|
|
this.$store.commit("samplestorage/update_open_alert_confirmation",false)
|
|
},
|
|
forgetAlertConfirmation(){
|
|
this.$store.commit("samplestorage/update_no_save",0)
|
|
this.$store.commit("samplestorage/update_open_alert_confirmation",false)
|
|
},
|
|
updateAlert_success(val){
|
|
this.$store.commit("samplestorage/update_alert_success",val)
|
|
},
|
|
setNewTransaction(){
|
|
this.$store.dispatch("form/getmgmmcu")
|
|
this.$store.dispatch("form/getstaff",{id:'', search: ''})
|
|
|
|
},
|
|
closeDialogSuccess(){
|
|
let arrtrx = this.$store.state.samplestorage.transactions
|
|
var idx = _.findIndex(arrtrx, item => item.id === this.$store.state.samplestorage.last_id)
|
|
console.log(idx)
|
|
var xcur_page = 1
|
|
if(idx !== -1)
|
|
xcur_page = this.$store.state.samplestorage.current_page
|
|
this.$store.dispatch("samplestorage/search",{
|
|
startdate:this.xdatestart,
|
|
enddate: this.xdateend,
|
|
status:this.xselected_status.id,
|
|
current_page:this.curr_page,
|
|
lastid:idx
|
|
})
|
|
this.$store.commit("samplestorage/update_dialog_success",false)
|
|
},
|
|
closeDialogInfo(){
|
|
this.$store.commit("samplestorage/update_open_dialog_info",false)
|
|
|
|
|
|
}
|
|
},
|
|
computed: {
|
|
dialogsuccess: {
|
|
get() {
|
|
return this.$store.state.samplestorage.dialog_success
|
|
},
|
|
set(val) {
|
|
this.$store.commit("samplestorage/update_dialog_success",val)
|
|
}
|
|
},
|
|
msgsuccess(){
|
|
return this.$store.state.samplestorage.msg_success
|
|
},
|
|
snackbar: {
|
|
get() {
|
|
return this.$store.state.samplestorage.alert_success
|
|
},
|
|
set(val) {
|
|
this.$store.commit("samplestorage/update_alert_success",val)
|
|
}
|
|
},
|
|
isLoading() {
|
|
return this.$store.state.samplestorage.search_status == 1
|
|
},
|
|
xfilterdate:{
|
|
get() {
|
|
return this.$store.state.form.xfilterdate
|
|
},
|
|
set(val) {
|
|
this.$store.commit("form/xfilterdate",val)
|
|
|
|
}
|
|
},
|
|
xdatestart : {
|
|
get() {
|
|
return this.$store.state.samplestorage.start_date
|
|
},
|
|
set(val) {
|
|
this.$store.commit("samplestorage/update_start_date",val)
|
|
this.searchTransaction()
|
|
}
|
|
},
|
|
xdateend : {
|
|
get() {
|
|
return this.$store.state.samplestorage.end_date
|
|
},
|
|
set(val) {
|
|
this.$store.commit("samplestorage/update_end_date",val)
|
|
this.searchTransaction()
|
|
}
|
|
},
|
|
spk_search : {
|
|
get() {
|
|
return this.$store.state.samplestorage.spk_search
|
|
},
|
|
set(val) {
|
|
this.$store.commit("samplestorage/update_spk_search",val)
|
|
//this.searchTransaction()
|
|
}
|
|
},
|
|
filterComputedDateFormattedStart () {
|
|
return this.formatDate(this.xdatestart)
|
|
},
|
|
filterComputedDateFormattedEnd () {
|
|
return this.formatDate(this.xdateend)
|
|
},
|
|
xtransactions() {
|
|
// console.log('data', this.$store.state.samplestorage.transactions)
|
|
return this.$store.state.samplestorage.transactions
|
|
},
|
|
openalertconfirmation: {
|
|
get() {
|
|
return this.$store.state.samplestorage.open_alert_confirmation
|
|
},
|
|
set(val) {
|
|
this.$store.commit("samplestorage/update_open_alert_confirmation",val)
|
|
}
|
|
},
|
|
opendialoginfo: {
|
|
get() {
|
|
return this.$store.state.samplestorage.open_dialog_info
|
|
},
|
|
set(val) {
|
|
this.$store.commit("samplestorage/update_open_dialog_info",false)
|
|
}
|
|
},
|
|
msginfo(){
|
|
return this.$store.state.samplestorage.msg_info
|
|
},
|
|
xstatuses(){
|
|
return this.$store.state.samplestorage.statuses
|
|
},
|
|
xselected_status:{
|
|
get(){
|
|
return this.$store.state.samplestorage.selected_status
|
|
},
|
|
set(val){
|
|
this.$store.commit("samplestorage/update_selected_status",val)
|
|
}
|
|
},
|
|
curr_page: {
|
|
get() {
|
|
return this.$store.state.samplestorage.current_page
|
|
},
|
|
set(val) {
|
|
this.$store.commit("samplestorage/update_current_page",val)
|
|
this.$store.dispatch("samplestorage/search",{
|
|
startdate:this.xdatestart,
|
|
enddate: this.xdateend,
|
|
status:this.xselected_status.id,
|
|
current_page:val,
|
|
lastid:-1
|
|
})
|
|
}
|
|
},
|
|
xtotal_page: {
|
|
get() {
|
|
return this.$store.state.samplestorage.total_page
|
|
},
|
|
set(val) {
|
|
this.$store.commit("samplestorage/update_total_page",val)
|
|
}
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
msgalertconfirmation:"Perubahan yang telah dilakukan belum disimpan dong !",
|
|
menufilterdatestart:false,
|
|
menufilterdateend:false,
|
|
date: new Date().toISOString().substr(0, 10),
|
|
items: [],
|
|
name: '',
|
|
page:1,
|
|
headers: [
|
|
{
|
|
text: "NUMBER",
|
|
align: "CENTER",
|
|
sortable: false,
|
|
width: "15%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
{
|
|
text: "TANGGAL",
|
|
align: "CENTER",
|
|
sortable: false,
|
|
width: "15%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
{
|
|
text: "TANGGAL MCU",
|
|
align: "CENTER",
|
|
sortable: false,
|
|
width: "10%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
{
|
|
text: "MCU",
|
|
align: "CENTER",
|
|
sortable: false,
|
|
width: "25%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
// {
|
|
// text: "CATATAN",
|
|
// align: "CENTER",
|
|
// sortable: false,
|
|
// width: "30%",
|
|
// class: "pa-2 blue lighten-3 white--text"
|
|
// },
|
|
{
|
|
text: "AKSI",
|
|
align: "LEFT",
|
|
sortable: false,
|
|
width: "8%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
}
|
|
],
|
|
pagination:{
|
|
descending: false,
|
|
page: 1,
|
|
rowsPerPage: 5,
|
|
sortBy: 'T_SampleStorageDate',
|
|
totalItems: this.$store.state.samplestorage.total_transactions
|
|
}
|
|
};
|
|
}
|
|
}
|
|
</script>
|