<template>
      <v-layout class="fill-height" column>
            <v-card class="mb-2 pa-2 searchbox">
                  <v-layout>
                  <v-menu class="xs3 pr-2" v-model="menustartdate" :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="startDateFormatted" label="Tgl. Awal" outline readonly v-on="on" @blur="date = deFormatedDate(startDateFormatted)"></v-text-field>
                    </template>
                    <v-date-picker v-model="init_sdate" no-title @input="menustartdate = false"></v-date-picker>
                </v-menu>
                <v-menu class="xs3 pl-2" v-model="menuenddate" :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="endDateFormatted" label="Tgl. Akhir" outline readonly v-on="on" @blur="date = deFormatedDate(endDateFormatted)"></v-text-field>
                    </template>
                    <v-date-picker v-model="init_edate" no-title @input="menuenddate = false"></v-date-picker>
                </v-menu>
                        <v-text-field class="xs3 ma-1" label="Supplier" placeholder="Cari..." outline v-model="searchsupplier" hide-details></v-text-field>

                        <v-text-field class="xs3 ma-1" label="No. Bayar / No. Tagihan" placeholder="Cari..." outline v-model="searchnamelab" hide-details></v-text-field>

                        <!-- <v-select class="xs3 mini-select ma-1" :items="statuses" item-text="name" return-object v-model="status" label="Status" outline
                              hide-details></v-select> -->
                        <span @click="searchPatient" class="icon-medium-fill-base xs1 white--text success iconsearch-search"></span>
                         <span @click="setNewOrder" class="icon-medium-fill-base xs1 white--text primary  ml-1 icon-add"></span>
                       <!-- <v-btn @click="changeBtnFlagCourier(xisauto)" v-if="xisauto === 'N'" small color="error">
                              Manual</v-btn>
                        <v-btn @click="changeBtnFlagCourier(xisauto)" v-if="xisauto === 'Y'" small color="success">
                              Otomatis</v-btn>
                        -->
                  </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="bills" :loading="isLoading" hide-actions class="elevation-1">
                                    <template slot="items" slot-scope="props">
                                          <td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.tanggalbayar}}</td>
                                          <td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.SupplierInvoiceNumber}}
                                          </td>
                                          <td class="pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.SupplierPaymentNumber}}</td>
                                          <td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.SupplierName}}</td>
                                          <td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ convertMoney(props.item.coaDescription)}}</td>
                                          <td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ convertMoney(props.item.note_amount)}}</td>
                                          <td class="text-md-center" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
                                <span @click="printNote(props.item)" class="icon-medium-fill-base xs1 white--text grey darken-1 icon-print"></span>
                                <span v-if="props.item.SupplierPaymentIsConfirm == 'N'" @click="confirmNote(props.item)" class="icon-medium-fill-base xs1 white--text green darken-1"><v-icon dark>done_all</v-icon></span>
                                

                            </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="openalertnopay" :msg="msgalertnopay" @forget-dialog-alert="forgetAlertNoPay()" @close-dialog-alert="closeAlertNoPay()"></one-dialog-alert>
      
      
    <template>
        <v-layout row justify-center>
            <v-dialog v-model="dialogformorder" persistent max-width="600px">
                <v-card>
                    <v-card-title>
                        <span class="headline">Form Gagal Bayar</span>
                    </v-card-title>
                    <v-card-text class="pt-0 pb-0">
                        <v-form ref="formsupplier">
                            <v-layout row wrap>
                                <v-flex xs12 pa-2>
                                    <v-layout row>
                                        <v-flex xs12 pa-1>
                                            <p v-for="(xerror,idx) in xerrors" class="error pl-2 pr-2" style="color:#fff">{{xerror.msg}}</p>
                                        </v-flex>
                                    </v-layout>
                                    <v-layout row>
                                        <v-flex xs12 pa-1>
                                            <v-autocomplete label="Supplier*" v-model="xsupplier" :items="xsuppliers"
                                                :search-input.sync="search_supplier" auto-select-first no-filter item-text="SupplierName"
                                                return-object :loading="isLoading" no-data-text="Pilih Supplier">
                                                <template slot="item" slot-scope="{ item }">
                                                    <v-list-tile-content>
                                                        <v-list-tile-title v-text="item.SupplierName"></v-list-tile-title>
                                                    </v-list-tile-content>
                                                </template>
                                            </v-autocomplete>
                                            <p v-if="checkError('requirexsupplier')" class="error pl-2 pr-2" style="color:#fff">Pilih Supplier dulu dong</p>
                                        </v-flex>
                                    </v-layout>
                                    <v-layout row>
                                        <v-flex xs12 pa-1>
                                            <v-autocomplete label="No.Pembayaran*" v-model="xinvpayment" :items="xinvpayments"
                                                :search-input.sync="thr_search_invpayment" auto-select-first no-filter item-text="PaymentName"
                                                return-object :loading="isLoading" no-data-text="Pilih No. Pembayaran">
                                                <template slot="item" slot-scope="{ item }">
                                                    <v-list-tile-content>
                                                        <v-list-tile-title v-text="item.PaymentName"></v-list-tile-title>
                                                    </v-list-tile-content>
                                                </template>
                                            </v-autocomplete>
                                            <p v-if="checkError('requirexmou')" class="error pl-2 pr-2" style="color:#fff">Pilih No. Pembayaran dulu dong</p>
                                        </v-flex>
                                    </v-layout>
                                    <v-layout row>
                                        <v-flex xs12 pa-1>
                                            <v-layout>
                                                <v-flex xs4>
                                                    <v-text-field readonly v-model="xcoa" label="Tipe Bayar"></v-text-field>
                                                </v-flex>
                                                <v-flex xs2>
                                                </v-flex>
                                                <v-flex xs6>
                                                    <v-text-field readonly v-model="xtotalpayment" label="Jumlah Bayar"></v-text-field>
                                                </v-flex>
                                            </v-layout>
                                        </v-flex>
                                    </v-layout>
                                    <v-layout row>
                                        <v-flex xs12 pa-1>
                                            <v-text-field v-model="xnote" label="Catatan*"></v-text-field>
                                        </v-flex>
                                    </v-layout>

                                </v-flex>
                            </v-layout>
                    </v-card-text>
                    <v-card-actions>
                        <v-spacer></v-spacer>
                        <v-btn color="blue darken-1" flat @click="updateDialogFormOrder()">Tutup</v-btn>
                        <v-btn v-if="xact === 'new'" :disabled="in_saving" color="blue darken-1" flat @click="saveForm()">Simpan</v-btn>
                        <v-btn v-if="xact === 'view'" color="blue darken-1" flat @click="updateFormPerusahaan()">Simpan Perubahan</v-btn>
                    </v-card-actions>
                    </v-form>
                </v-card>
            </v-dialog>
        </v-layout>
    </template>
      
      
        <template>

            <v-dialog v-model="xdialogconfirm" persistent max-width="30%">
                <v-card>
                    <v-card-title :class="{ 'green':!_.isEmpty(xnotaconfirm), 'success':_.isEmpty(xnotaconfirm) }" class="headline darken-1 pt-2 pb-2"
                        primary-title>
                        <h4 style="color:#FFEBEE">
                            <span v-if="!_.isEmpty(xnotaconfirm)">Konfirmasi !</span>
                            <span v-if="_.isEmpty(xnotaconfirm)">Berhasil !</span>
                        </h4>
                    </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 v-html="xmsgconfirm" xs12>

                                            </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="error" v-if="!_.isEmpty(xnotaconfirm)" flat @click="doConfirmNote()">
                            Yakin dong !
                        </v-btn>

                        <v-btn v-if="!_.isEmpty(xnotaconfirm)" color="primary" flat @click="xdialogconfirm = false">
                            Tutup
                        </v-btn>
                        <v-btn v-if="_.isEmpty(xnotaconfirm)" color="primary" flat @click="closeDialogConfirm()">
                            Tutup
                        </v-btn>
                    </v-card-actions>
                </v-card>
            </v-dialog>

        </template>
     <one-dialog-print :title="printtitle" :width="printwidth" :height="550" :status="openprintnote" :urlprint="urlprintnote"
            @close-dialog-print="openprintnote = false"></one-dialog-print>
      </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;
      }

      .v-messages {
            min-height: 0px !important;
      }
</style>

<script>
      module.exports = {
            components: {
                  'one-dialog-info': httpVueLoader('../../common/oneDialogInfo.vue'),
                  'one-dialog-alert': httpVueLoader('../../common/oneDialogAlert.vue'),
                  'one-dialog-print': httpVueLoader('../../common/oneDialogPrintX.vue')
            },
            mounted() {

                  this.$store.dispatch("bill/search", {
                        supplier: this.searchsupplier,
                        search: this.searchnamelab,
                        status: this.status.value,
                        startdate: this.init_sdate,
                              enddate: this.init_edate,
                        current_page: 1,
                        lastidx: 0
                  })

            },
            methods: {
                  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.SupplierPaymentID == this.$store.state.bill.selected_bill.SupplierPaymentID
                  },
                  convertMoney(money) {
                        return one_money(money)
                  },
                  searchPatient() {
                        this.$store.dispatch("bill/search", {
                              supplier: this.searchsupplier,
                              search: this.searchnamelab,
                              status: this.status.value,
                              startdate: this.init_sdate,
                              enddate: this.init_edate,
                              current_page: 1,
                              lastidx: 0
                        })
                  },
                  setNewOrder() {
        this.$store.commit("bill/update_dialog_form_order", true)
            },
            updateDialogFormOrder() {
        this.$store.commit("bill/update_dialog_form_order", false)
            },
                  printNote(val) {
                        console.log(val)
                this.printwidth = 600
                this.printtitle = ""
                let user = one_user()
                var rpt = 'rpt_payment_faktur'
                this.urlprintnote = "/birt/run?__report=report/one/accounting/" + rpt + ".rptdesign&__format=pdf&username=" +
                    user.M_UserUsername + "&PID=" + val.SupplierPaymentID
                this.$store.commit("paymentmanual/update_open_print_note", true)
            },
            doPrint() {
                this.printtitle = ""
                this.closeDialogPaySuccess()
                let user = one_user()
                var rpt = 'rpt_payment_faktur'
                this.urlprintnote = "/birt/run?__report=report/one/accounting/" + rpt + ".rptdesign&__format=pdf&username=" +
                    user.M_UserUsername + "&PID=" + this.$store.state.bills.SupplierPaymentID
                this.$store.commit("paymentmanual/update_open_print_note", true)
            },
                  confirmNote(note) {
                this.$store.commit("paymentmanual/update_note_confirm", "")
                this.$store.commit("paymentmanual/update_nota_confirm", note)
                let xmsg = "Yakin , mau konfirmasi nota nomor <span style='color:green'>" + note.SupplierPaymentNumber + "</span> ?"
                this.$store.commit("paymentmanual/update_msg_confirm", xmsg)
                this.$store.commit("paymentmanual/update_dialog_confirm", true)
            },
            
            doConfirmNote() {
                let prm = {
                    nota: this.$store.state.paymentmanual.nota_confirm
                }
                this.$store.dispatch("paymentmanual/confirm_note", prm)
            },
            closeDialogConfirm() {
                let arrbill = this.$store.state.bill.bills
                var idx = _.findIndex(arrbill, item => item.SupplierPaymentID === this.$store.state.bill.selected_bill
                    .SupplierPaymentID)
                this.$store.commit("paymentmanual/update_dialog_confirm", false)
                this.$store.commit("bill/update_selected_bill", {})
                this.$store.dispatch("bill/search", {
                    startdate: this.init_sdate,
                    enddate: this.init_edate,
                    search: this.$store.state.bill.search,
                    status: this.$store.state.bill.selected_status.value,
                    current_page: this.$store.state.bill.current_page,
                    lastidx: idx
                })
            },
            thr_search_supplier: _.debounce(function () {
                this.$store.dispatch("bill/searchsupplier", {search:this.search_supplier})
            }, 500),
            thr_search_invpayment: _.debounce(function () {
                this.$store.dispatch("bill/searchinvpayment", {companyid:this.xsupplier.SupplierI,search:this.search_invpaymentD})
            }, 1000),
            saveForm() {
                let prm = {
                    nota: this.$store.state.paymentmanual.nota_form,
                    note: this.xnote
                }
                this.$store.dispatch("paymentmanual/confirm_note", prm)
            },
            closeDialogConfirm() {
                let arrbill = this.$store.state.bill.bills
                var idx = _.findIndex(arrbill, item => item.SupplierPaymentID === this.$store.state.bill.selected_bill
                    .SupplierPaymentID)
                this.$store.commit("paymentmanual/update_dialog_confirm", false)
                this.$store.commit("bill/update_selected_bill", {})
                this.$store.dispatch("bill/search", {
                    startdate: this.init_sdate,
                    enddate: this.init_edate,
                    search: this.$store.state.bill.search,
                    status: this.$store.state.bill.selected_status.value,
                    current_page: this.$store.state.bill.current_page,
                    lastidx: idx
                })
            },
                  selectMe(pat) {
                        if (this.xtotal_page > 0) {
                              let totpay = this.$store.state.paymentnew.total_payment
                              if (totpay === 0) {
                                    let xobj = this.$store.state.paymentnew.types
                                    console.log(xobj)
                                    xobj.forEach(function (obj) {
                                          obj.chex = false
                                          obj.leftvalue = 0
                                          obj.rightvalue = 0
                                          obj.selected_card = {
                                                id: 0,
                                                name: ''
                                          }
                                          obj.selected_edc = {
                                                id: 0,
                                                name: ''
                                          }
                                    })
                                    this.$store.commit("paymentnew/update_types", {
                                          records: xobj,
                                          total: xobj.length
                                    })
                                    this.$store.commit("bill/update_selected_bill", pat)
                                    this.$store.commit("paymentnew/update_total_payment", 0)
                                    this.$store.commit("paymentnew/update_notes", pat.notes)
                                    this.$store.commit("paymentmanual/update_notes", pat.notes)
                                    if (pat.flaglunas === 'N') {
                                          this.$store.commit("paymentmanual/update_tagihans", pat.tagihans)
                                    } else {
                                          this.$store.commit("paymentmanual/update_tagihans", '')
                                    }

                              } else {
                                    this.$store.commit("bill/update_open_alert_no_pay", true)
                              }
                        } else {
                              let totpay = 0
                              if (totpay === 0) {
                                    let xobj = this.$store.state.paymentnew.types
                                    console.log(xobj)
                                    xobj.forEach(function (obj) {
                                          obj.chex = false
                                          obj.leftvalue = 0
                                          obj.rightvalue = 0
                                          obj.selected_card = {
                                                id: 0,
                                                name: ''
                                          }
                                          obj.selected_edc = {
                                                id: 0,
                                                name: ''
                                          }
                                    })
                                    this.$store.commit("paymentnew/update_types", {
                                          records: '',
                                          total: 0
                                    })
                                    this.$store.commit("bill/update_selected_bill", '')
                                    this.$store.commit("paymentnew/update_total_payment", 0)
                                    this.$store.commit("paymentmanual/update_notes", '')
                                    this.$store.commit("paymentnew/update_notes", '')
                                    if (pat.flaglunas === 'N') {
                                          this.$store.commit("paymentmanual/update_tagihans", pat.tagihans)
                                    } else {
                                          this.$store.commit("paymentmanual/update_tagihans", '')
                                    }
                              } else {
                                    this.$store.commit("bill/update_open_alert_no_pay", true)
                              }
                        }


                  },
                  checkError(value) {
                var errors = this.$store.state.bill.errors
                if (errors.includes(value)) {
                    return true
                } else {
                    return false
                }
            },
                  closeAlertNoPay() {
                        this.$store.commit("bill/update_open_alert_no_pay", false)
                  },
                  forgetAlertNoPay() {
                        var xval = this.$store.state.paymentnew.types
                        var valpay = 0
                        xval.forEach(function (obj) {
                              obj.chex = false
                              obj.leftvalue = 0
                              obj.rightvalue = 0
                              obj.selected_card = {
                                    id: 0,
                                    name: ''
                              }
                              obj.selected_edc = {
                                    id: 0,
                                    name: ''
                              }
                        })
                        this.$store.commit("paymentnew/update_total_payment", 0)
                        this.$store.commit("bill/update_open_alert_no_pay", false)
                  },
                  changeBtnFlagCourier(value) {
                        var newval = (value === 'Y') ? 'N' : 'Y'
                        this.xisauto = newval
                  },
                  changeBtnFlagDefaultCourier(value) {
                        var newval = (value === 'Y') ? 'N' : 'Y'
                        this.xdisauto = newval
                  },
            },
            computed: {
            in_saving: {
                get() {
                    return this.$store.state.bill.in_saving
                },
                set(val) {
                    this.$store.commit("bill/update_in_saving", val)
                }
            },
                  xstartdate: {
                        get() {
                              return this.$store.state.bill.start_date
                        },
                        set(val) {
                              this.$store.commit("bill/update_start_date", val)
                        }
                  },
                  dialogformorder() {
                return this.$store.state.bill.dialog_form_order
            },
                  xenddate: {
                        get() {
                              return this.$store.state.bill.end_date
                        },
                        set(val) {
                              this.$store.commit("bill/update_end_date", val)
                        }
                  },
                  openprintnote: {
                get() {
                    return this.$store.state.paymentmanual.open_print_note
                },
                set(val) {
                    this.$store.commit("paymentmanual/update_open_print_note", val)
                }
            },
            xsuppliers() {
                return this.$store.state.bill.suppliers
            },
            xsupplier: {
                get() {
                    return this.$store.state.bill.supplier
                },
                set(val) {
                    this.$store.commit("bill/update_supplier", val)
                    this.$store.dispatch("bill/searchinvpayment", {companyid:val.SupplierID,search:this.search_invpaymentD})
                }
            },
            xinvpayments() {
                return this.$store.state.bill.invpayments
            },
            xinvpayment: {
                get() {
                    return this.$store.state.bill.invpayment
                },
                set(val) {
                    this.$store.commit("bill/update_supplier", val)
                    this.$store.dispatch("bill/getmou", {supplierid :this.$store.state.bill.supplier, search : ''})
                    this.xcoa = val.coaDescription
                    this.xtotalpayment = val.SupplierPaymentAmount
                    this.$store.commit("paymentmanual/update_nota_form", val)
                }
            },
            xact() {
                return this.$store.state.bill.act_comp
            },
                  xdialogconfirm: {
                get() {
                    return this.$store.state.paymentmanual.dialog_confirm
                },
                set(val) {
                    this.$store.commit("paymentmanual/update_dialog_confirm", val)
                }
            },
            xmsgconfirm() {
                return this.$store.state.paymentmanual.msg_confirm
            },
            xnotaconfirm() {
                return this.$store.state.paymentmanual.nota_confirm
            },
            xnotaform() {
                return this.$store.state.paymentmanual.nota_form
            },
                  init_sdate: {
                get() {
                    return this.$store.state.bill.init_sdate
                },
                set(val) {
                    this.$store.commit("bill/update_init_sdate", val)
                }
            },
            init_edate: {
                get() {
                    return this.$store.state.bill.init_edate
                },
                set(val) {
                    this.$store.commit("bill/update_init_edate", val)
                }
            },
                  xisauto: {
                        get() {
                              return this.$store.state.bill.isauto
                        },
                        set(val) {
                              this.$store.commit("bill/update_isauto", val)
                              this.$store.commit("paymentmanual/update_isauto", val)
                              this.$store.commit("paymentnew/update_isauto", val)
                        }
                  },
                  searchsupplier: {
                        get() {
                              return this.$store.state.bill.ssupplier
                        },
                        set(val) {
                              this.$store.commit("bill/update_ssupplier", val)
                        }
                  },
                  searchnamelab: {
                        get() {
                              return this.$store.state.bill.search
                        },
                        set(val) {
                              this.$store.commit("bill/update_search", val)
                        }
                  },
                  statuses() {
                        return this.$store.state.bill.statuses
                  },
                  status: {
                        get() {
                              return this.$store.state.bill.selected_status
                        },
                        set(val) {
                              this.$store.commit("bill/update_selected_status", val)
                        }
                  },
                  startDateFormatted() {
                        return this.formatDate(this.init_sdate)
                  },
                  endDateFormatted() {
                        return this.formatDate(this.init_edate)
                  },
                  isLoading() {
                        return this.$store.state.bill.search_status == 1
                  },
                  bills() {
                        return this.$store.state.bill.bills
                  },
                  openalertnopay: {
                        get() {
                              return this.$store.state.bill.open_alert_no_pay
                        },
                        set(val) {
                              this.$store.commit("bill/update_open_alert_no_pay", false)
                        }
                  },
                  msgalertnopay() {
                        return this.$store.state.bill.msg_alert_no_pay
                  },
                  xerrors() {
                return this.$store.state.bill.errors
            },
                  curr_page: {
                        get() {
                              return this.$store.state.bill.current_page
                        },
                        set(val) {
                              this.$store.commit("bill/update_current_page", val)
                              this.$store.dispatch("bill/search", {
                                    supplier: this.searchsupplier,
                                    search: this.searchnamelab,
                                    status: this.status.value,
                                    startdate: this.init_sdate,
                              enddate: this.init_edate,
                                    current_page: val,
                                    lastidx: 0
                              })
                        }
                  },
                  xtotal_page: {
                        get() {
                              return this.$store.state.bill.total_page
                        },
                        set(val) {
                              this.$store.commit("bill/update_total_page", val)
                        }
                  },
            },
            data() {
                  return {
                        items: [],
                        menustartdate: false,
                        menuenddate: false,
                        urlprintnote: '',
                printtitle: '',
                printwidth: '60%',
                search_supplier: '',
                search_invpayment: '',
                xid: 0,
                xnumber : '',
                xcoa: '',
                xtotalpayment: 0,
                xnote: '',
                        headers: [{
                                    text: "TGL. BAYAR",
                                    align: "left",
                                    sortable: false,
                                    value: "mr",
                                    width: "15%",
                                    class: "pa-2 blue lighten-3 white--text"
                              },
                              {
                                    text: "NO. TAGIHAN",
                                    align: "left",
                                    sortable: false,
                                    value: "lab",
                                    width: "15%",
                                    class: "pa-2 blue lighten-3 white--text"
                              },
                              {
                                    text: "NO. PEMBAYARAN",
                                    align: "left",
                                    sortable: false,
                                    value: "name",
                                    width: "20%",
                                    class: "pa-2 blue lighten-3 white--text"
                              },

                              {
                                    text: "SUPPLIER",
                                    align: "left",
                                    sortable: false,
                                    value: "status",
                                    width: "20%",
                                    class: "pa-2 blue lighten-3 white--text"
                              },
                              {
                                    text: "TIPE PEMBAYARAN",
                                    align: "left",
                                    sortable: false,
                                    value: "status",
                                    width: "10%",
                                    class: "pa-2 blue lighten-3 white--text"
                              },
                              {
                                    text: "TOTAL BAYAR",
                                    align: "left",
                                    sortable: false,
                                    value: "status",
                                    width: "10%",
                                    class: "pa-2 blue lighten-3 white--text"
                              },
                              {
                                    text: "AKSI",
                                    align: "left",
                                    sortable: false,
                                    value: "status",
                                    width: "10%",
                                    class: "pa-2 blue lighten-3 white--text"
                              }
                        ],
                  }
            },
            watch: {
            search_supplier(val, old) {
                if (val == old) return
                if (!val) return
                if (val.length < 1) return
                if (this.$store.state.bill.update_search_bill == 1) return
                this.thr_search_supplier()
            },
            search_invpayment(val, old) {
                if (val == old) return
                if (!val) return
                if (val.length < 1) return
                if (this.$store.state.bill.update_search_bill == 1) return
                this.thr_search_invpayment()
            }
        }
      }
</script>