<template>
    <v-layout class="fill-height" column>
        <template>

            <v-dialog v-model="dialogdeletealert" max-width="30%">
                <v-card>
                    <v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
                        Peringatan !
                    </v-card-title>
                    <v-card-text class="pt-2 pb-2">
                        <v-layout row>
                            <v-flex xs12 d-flex>
                                <v-layout row>
                                    <v-flex pb-1 xs12>
                                        <v-layout row>
                                            <v-flex pt-2 pr-2 xs12>
                                                {{msgalert}}
                                            </v-flex>
                                        </v-layout>
                                    </v-flex>
                                </v-layout>
                            </v-flex>
                        </v-layout>
                    </v-card-text>
                    <v-divider></v-divider>
                    <v-card-actions>
                        <v-spacer></v-spacer>
                        <v-btn color="primary" flat @click="dialogdeletealert = false">
                            Tutup
                        </v-btn>
                        <v-btn color="primary" flat @click="closeDeleteAlert()">
                            Yakin lah
                        </v-btn>
                    </v-card-actions>
                </v-card>
            </v-dialog>

        </template>
        <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>
                <!--<v-menu ref="menustartdate" v-model="menustartdate" :close-on-content-click="false" :nudge-right="0" lazy transition="scale-transition"
                    offset-y full-width max-width="290px" min-width="290px">
                    <template v-slot:activator="{ on }">
                        <v-text-field v-model="startDateFormatted" label="Tanggal Awal" readonly hide-details class="xs3 ma-1" outline v-on="on"
                            @blur="deFormatedDate(startDateFormatted)"></v-text-field>
                    </template>
                    <v-date-picker v-model="xstartdate" no-title @input="menustartdate = false"></v-date-picker>
                </v-menu>

                <v-menu ref="menuenddate" v-model="menuenddate" :close-on-content-click="false" :nudge-right="0" lazy transition="scale-transition"
                    offset-y full-width max-width="290px" min-width="290px">
                    <template v-slot:activator="{ on }">
                        <v-text-field v-model="endDateFormatted" label="Tanggal Akhir" hide-details outline class="xs3 ma-1" readonly v-on="on" @blur="deFormatedDate(endDateFormatted)"></v-text-field>
                    </template>
                    <v-date-picker v-model="xenddate" no-title @input="menuenddate = false"></v-date-picker>
                </v-menu>-->

                <v-text-field class="xs4 ma-1"  @keyup.enter="searchPatient()" label="Nama Pasien / No. Reg" placeholder="Cari..." outline v-model="snorm" 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>-->
              </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="printresults" 
                        :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.order_date}}</td>
                            <td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.T_OrderHeaderLabNumber}}</td>
                            <td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.patient_fullname}}</td>
                            <td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
                                <span title="cetak hasil"  @click="printNote(props.item)" class="icon-medium-fill-base-small xs1 white--text blue-grey"><v-icon dark >print</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="openalertconfirmation" :msg="msgalertconfirmation" @forget-dialog-alert="forgetAlertConfirmation()"
            @close-dialog-alert="closeAlertConfirmation()"></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 Bill Order [ {{this.xno}} ]</span>
                        </v-card-title>
                        <v-card-text class="pt-0 pb-0">
                            <v-form ref="formcompany">
                                <v-layout row wrap>
                                    <v-flex xs12 pa-2>
                                        <v-layout row>
                                            <v-flex xs12 pa-1>
                                                <v-autocomplete :readonly="this.xtotal > 0" label="Kelompok Pelanggan*" v-model="xcompany" :items="xcompanies" :search-input.sync="search_company"
                                                    auto-select-first no-filter item-text="M_CompanyName" return-object :loading="isLoading"
                                                    no-data-text="Pilih Kel. Pelanggan">
                                                    <template slot="item" slot-scope="{ item }">
                                                        <v-list-tile-content>
                                                            <v-list-tile-title v-text="item.M_CompanyName"></v-list-tile-title>
                                                        </v-list-tile-content>
                                                    </template>
                                                </v-autocomplete>
                                                <p v-if="checkError('requirexcompany')" class="error pl-2 pr-2" style="color:#fff">Pilih Kel. Pelanggan dulu dong</p>
                                            </v-flex>
                                        </v-layout>
                                        <v-layout row>
                                            <v-flex xs12 pa-1>
                                                <v-select :readonly="this.xtotal > 0" item-text="M_MouName" return-object :items="xmous" v-model="xmou" label="Agreement*"></v-select>
                                                <p v-if="checkError('requirexmou')" class="error pl-2 pr-2" style="color:#fff">Pilih Agreement dulu dong</p>
                                            </v-flex>
                                        </v-layout>
                                        <v-layout row>
                                            <v-flex xs12 pa-1>
                                                <v-layout>
                                                    <v-flex xs4>
                                                        <v-text-field v-model="xdueday" @change="changeDueDate()" label="Jatuh Tempo (Hari)"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs2>
                                                    </v-flex>
                                                    <v-flex xs6>
                                                        <v-menu ref="menusdate" v-model="menusdate" :close-on-content-click="false" :nudge-right="0" lazy transition="scale-transition"
                                                            offset-y full-width max-width="290px" min-width="290px">
                                                            <template v-slot:activator="{ on }">
                                                                <v-text-field v-model="startComputedDateFormatted" label="Tgl. Jatuh Tempo*" readonly v-on="on" @blur="date = deFormatedDate(startComputedDateFormatted)"></v-text-field>
                                                            </template>
                                                            <v-date-picker v-model="xsdate" no-title @change="changeDueDay()" @input="menusdate = false"></v-date-picker>
                                                            <p v-if="checkError('requirexsdate')" class="error pl-2 pr-2" style="color:#fff">Tanggal jatuh tempo</p>
                                                    </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'" color="blue darken-1" flat @click="saveFormPerusahaan()">Simpan</v-btn>
                            <v-btn v-if="xact === 'edit'" color="blue darken-1" flat @click="updateFormPerusahaan()">Simpan Perubahan</v-btn>
                        </v-card-actions>
                        </v-form>
                    </v-card>
                </v-dialog>
            </v-layout>
        </template>

        <one-dialog-print :title="printtitle" :width="printwidth" :height="550" :status="openprintnote" :urlprint="urlprintnote"
            @close-dialog-print="close_print()"></one-dialog-print>

    </v-layout>
</template>

<style scoped>
    .searchbox .v-input.v-text-field .v-input__slot {
        min-height: 60px;
    }

    .searchbox .v-btn {
        min-height: 60px;
    }

    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'),
            'one-dialog-print': httpVueLoader('../../common/oneDialogPrintX.vue')
        },
        mounted() {
            this.curr_page = 1
            this.$store.dispatch("printresult/search", {
                startdate: this.xstartdate,
                enddate: this.xenddate,
                search: this.snorm,
                status: this.status.value,
                current_page:this.curr_page,
                lastid: -1
            })
        },
        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')}`
            },
            checkError(value) {
                var errors = this.$store.state.printresult.errors
                if (errors.includes(value)) {
                    return true
                } else {
                    return false
                }
            },
            isSelected(p) {
                return p.T_OrderHeaderID == this.$store.state.printresult.selected_printresult
                    .T_OrderHeaderID
            },
            convertMoney(money) {
                return one_money(money)
            },
            printNote(val) {
                this.$store.commit("printresult/update_selected_printresult",val)
                this.printwidth = 800
                this.printtitle = ""
                let user = one_user()
                var rpt = 'rpt_test'
                this.urlprintnote = "/birt/frameset?__report=report/one/lab/" + rpt + ".rptdesign&__format=pdf&username=" +
                    user.M_UserUsername + "&PID=" + val.T_OrderHeaderID
                this.$store.commit("printresult/update_open_print_note", true)
            },
            searchPatient() {
                this.curr_page = 1
                this.$store.dispatch("printresult/search", {
                    startdate: this.xstartdate,
                    enddate: this.xenddate,
                    search: this.snorm,
                    status: this.status.value,
                    current_page:this.curr_page,
                    lastid: -1
                })
            },

            selectMe(pat) {
                if (this.$store.state.printresult.no_save == 0) {
                    this.$store.commit("printresult/update_selected_printresult", pat)
                    this.$store.commit("printresult/update_act_send", pat.T_ReceiveReferenceHeaderIsSent)
                    /*this.$store.dispatch("printresult/getpatient", {
                        id: pat.T_OrderHeaderID,
                        mouid: pat.F_BillM_MouID
                    })*/
                    this.$store.commit("printresult/update_statuss", pat.statuss)
                } else {
                    this.$store.commit("printresult/update_open_alert_confirmation", true)
                }

            },
            closeAlertConfirmation() {
                this.$store.commit("printresult/update_open_alert_confirmation", false)
            },
            forgetAlertConfirmation() {
                this.$store.commit("printresult/update_no_save", 0)
                this.$store.commit("printresult/update_open_alert_confirmation", false)
            },
            updateAlert_success(val) {
                this.$store.commit("printresult/update_alert_success", val)
            },
            updateDialogFormOrder() {
                this.$store.commit("printresult/update_dialog_form_order", false)
            },
            updateDialogStatusOrder() {
                this.$store.commit("printresult/update_dialog_status_order", false)
            },
            setNewOrder() {
                this.$store.commit("printresult/update_selected_printresult", {})
                this.$store.commit("printresult/update_act_comp", 'new')
                this.$store.commit("printresult/update_dialog_form_order", true)
                this.xid = 0
                this.xno = ''
                this.xtotal = 0
                this.xcompany = {}

                this.$store.commit("printresult/update_mous", [{}])
                this.xmou = {}
                var dueDate = moment(new Date(new Date().getTime() + (this.xdueday * 24 * 60 * 60 * 1000))).format(
                    'YYYY-MM-DD')
                this.xsdate = dueDate
                this.xnote = ''
                this.$store.dispatch("printresult/getpatient", {
                    id: 0,
                    mouid: 0
                })
            },
            changeDueDay() {
                var start = moment(new Date()).format('YYYY-MM-DD');
                var end = moment(this.xsdate);
                var xday = end.diff(start, "days")
                this.xdueday = xday
            },
            changeDueDate() {
                var dueDate = moment(new Date(new Date().getTime() + (this.xdueday * 24 * 60 * 60 * 1000))).format(
                    'YYYY-MM-DD')
                this.xsdate = dueDate
            },
            setStatusOrder() {
                this.$store.commit("printresult/update_selected_printresult", {})
                this.$store.commit("printresult/update_dialog_status_order", true)
                this.search_company = ''
            },
            saveFormPerusahaan() {
                this.$store.commit("printresult/update_errors", [])
                var errors = this.$store.state.printresult.errors
                if (_.isEmpty(this.xcompany)) {
                    errors.push("requirexcompany")
                }
                if (_.isEmpty(this.xmou)) {
                    errors.push("requirexmou")
                }
                if (_.isEmpty(this.xsdate)) {
                    errors.push("requirexsdate")
                }
                if (errors.length === 0) {
                    this.$store.dispatch("printresult/newprintresult", {
                        companyid: this.xcompany.M_CompanyID,
                        mouid: this.xmou.M_MouID,
                        sdate: this.xsdate,
                        note: this.xnote,
                        day: this.xdueday
                    })
                }
            },
            ediitBill(data) {
                this.xid = data.T_OrderHeaderID
                this.xno = data.F_BillNo
                this.xtotal = data.F_BillTotal
                this.$store.commit("printresult/update_companies", [{
                    M_CompanyID: data.M_CompanyID,
                    M_CompanyName: data.M_CompanyName
                }])
                this.xcompany = {
                    M_CompanyID: data.M_CompanyID,
                    M_CompanyName: data.M_CompanyName
                }

                this.$store.commit("printresult/update_mous", [{
                    M_MouID: data.M_MouID,
                    M_MouName: data.M_MouName
                }])
                this.xmou = {
                    M_MouID: data.M_MouID,
                    M_MouName: data.M_MouName
                }
                this.xdueday = data.F_BillDueDateDay
                this.xsdate = data.sdate
                this.xnote = data.F_BillNote
                this.$store.commit("printresult/update_act_comp", 'edit')
                this.$store.commit("printresult/update_dialog_form_order", true)
            },
            viewBill(data) {
                this.xid = data.T_OrderHeaderID
                this.xno = data.F_BillNo
                this.$store.commit("printresult/update_companies", [{
                    M_CompanyID: data.M_CompanyID,
                    M_CompanyName: data.M_CompanyName
                }])
                this.xcompany = {
                    M_CompanyID: data.M_CompanyID,
                    M_CompanyName: data.M_CompanyName
                }

                this.$store.commit("printresult/update_mous", [{
                    M_MouID: data.M_MouID,
                    M_MouName: data.M_MouName
                }])
                this.xmou = {
                    M_MouID: data.M_MouID,
                    M_MouName: data.M_MouName
                }
                this.xdueday = data.F_BillDueDateDay
                this.xsdate = data.sdate
                this.xnote = data.F_BillNote
                this.$store.commit("printresult/update_act_comp", 'view')
                this.$store.commit("printresult/update_dialog_form_order", true)
            },
            updateFormPerusahaan() {
                this.$store.commit("printresult/update_errors", [])
                var errors = this.$store.state.printresult.errors
                if (_.isEmpty(this.xcompany)) {
                    errors.push("requirexcompany")
                }
                if (_.isEmpty(this.xmou)) {
                    errors.push("requirexmou")
                }
                if (_.isEmpty(this.xsdate)) {
                    errors.push("requirexsdate")
                }
                if (errors.length === 0) {
                    this.$store.dispatch("printresult/editbill", {
                        id: this.xid,
                        sdate: this.xsdate,
                        note: this.xnote,
                        day: this.xdueday
                    })
                }
            },
            deleteBill(data) {
                this.xid = data.T_OrderHeaderID
                var xdata = {
                    id: data.T_OrderHeaderID,
                    name: data.F_BillNo
                }
                this.msgalert = "Yakin, Mau Hapus No. Tagihan " + data.F_BillNo + "  ?"
                this.dialogdeletealert = true
            },
            closeDeleteAlert() {
                this.$store.dispatch("printresult/deletebill", {
                    id: this.xid
                })
                this.dialogdeletealert = false
            },
            thr_search_company: _.debounce(function () {
                this.$store.dispatch("printresult/searchcompany", this.search_company)
            }, 2000),
            closeDialogSuccess() {
                let arrprintresult = this.$store.state.printresult.printresults
                var idx = _.findIndex(arrprintresult, item => item.T_OrderHeaderID === this.$store.state
                    .printresult.last_id)
                console.log(idx)
                this.$store.dispatch("printresult/search", {
                    startdate: this.xstartdate,
                    enddate: this.xenddate,
                    search: this.snorm,
                    status: this.status.value,
                    lastid: -1
                })
                this.$store.commit("printresult/update_dialog_success", 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')}`
            },
            close_print(){
                this.openprintnote = false
                var already_valideted = this.$store.state.printresult.selected_printresult.already_validated
                var ready_print = this.$store.state.printresult.selected_printresult.ready_print
                if( parseInt(already_valideted) > 0 && parseInt(ready_print) > 0)
                    this.$store.dispatch("printresult/firstprint", this.$store.state.printresult.selected_printresult)
            }
        },
        computed: {
            xstartdate: {
                get() {
                    return this.$store.state.printresult.start_date
                },
                set(val) {
                    this.$store.commit("printresult/update_start_date", val)
                }
            },
            xenddate: {
                get() {
                    return this.$store.state.printresult.end_date
                },
                set(val) {
                    this.$store.commit("printresult/update_end_date", val)
                }
            },
            startDateFormatted() {
                return this.formatDate(this.xstartdate)
            },
            endDateFormatted() {
                return this.formatDate(this.xenddate)
            },
            dialogsuccess: {
                get() {
                    return this.$store.state.printresult.dialog_success
                },
                set(val) {
                    this.$store.commit("printresult/update_dialog_success", val)
                }
            },
            msgsuccess() {
                return this.$store.state.printresult.msg_success
            },
            snackbar: {
                get() {
                    return this.$store.state.printresult.alert_success
                },
                set(val) {
                    this.$store.commit("printresult/update_alert_success", val)
                }
            },
            openprintnote: {
                get() {
                    return this.$store.state.printresult.open_print_note
                },
                set(val) {
                    this.$store.commit("printresult/update_open_print_note", false)
                }
            },
            isLoading() {
                return this.$store.state.printresult.search_status == 1
            },
            statuses() {
                return this.$store.state.printresult.statuses
            },
            status: {
                get() {
                    return this.$store.state.printresult.selected_status
                },
                set(val) {
                    this.$store.commit("printresult/update_selected_status", val)
                    this.searchPatient()
                }
            },
            xact() {
                return this.$store.state.printresult.act_comp
            },
            printresults() {
                return this.$store.state.printresult.printresults
            },
            openalertconfirmation: {
                get() {
                    return this.$store.state.printresult.open_alert_confirmation
                },
                set(val) {
                    this.$store.commit("printresult/update_open_alert_confirmation", val)
                }
            },
            dialogformorder() {
                return this.$store.state.printresult.dialog_form_order
            },
            dialogstatusorder() {
                return this.$store.state.printresult.dialog_status_order
            },
            xdate: {
                get() {
                    return this.$store.state.printresult.date
                },
                set(val) {
                    this.$store.commit("printresult/update_date", val)
                }
            },
            xnote: {
                get() {
                    return this.$store.state.printresult.note
                },
                set(val) {
                    this.$store.commit("printresult/update_note", val)
                }
            },
            xdueday: {
                get() {
                    return this.$store.state.printresult.dueday
                },
                set(val) {
                    this.$store.commit("printresult/update_dueday", val)
                }
            },
            xcompanies() {
                return this.$store.state.printresult.companies
            },
            xcompany: {
                get() {
                    return this.$store.state.printresult.company
                },
                set(val) {
                    this.$store.commit("printresult/update_company", val)
                    this.$store.dispatch("printresult/getmou", this.$store.state.printresult.company)
                }
            },
            xmous() {
                return this.$store.state.printresult.mous
            },
            xmou: {
                get() {
                    return this.$store.state.printresult.mou
                },
                set(val) {
                    this.$store.commit("printresult/update_mou", val)
                }
            },
            startComputedDateFormatted() {
                return this.formatDate(this.xsdate)
            },
            xsdate: {
                get() {
                    return this.$store.state.printresult.sdate
                },
                set(val) {
                    this.$store.commit("printresult/update_sdate", val)
                }
            },
            xstatuss() {
                return this.$store.state.printresult.statuss
            },
            curr_page: {
                get() {
                    return this.$store.state.printresult.current_page
                },
                set(val) { 
                    this.$store.commit("printresult/update_current_page",val)
                    this.$store.dispatch("printresult/search",{
                    startdate: this.xstartdate,
                    enddate: this.xenddate,
                    search: this.snorm,
                    status: this.status.value,
                    current_page:this.curr_page,
                    lastid: -1
                    })
                }
            },
            xtotal_page: {
                get() {
                    return this.$store.state.printresult.total_printresults
                },
                set(val) {
                    this.$store.commit("printresult/update_total_printresults",val)
                }
            },
            snorm: {
                get() {
                    return this.$store.state.printresult.snorm
                },
                set(val) {
                    this.$store.commit("printresult/update_snorm",val)
                }
            },
        },
        data() {
            return {
                msgalertconfirmation: "Perubahan yang telah dilakukan belum disimpan dong !",
                items: [],
                xid: 0,
                xno: '',
                xtotal: 0,
                name: '',
                //snorm: '',
                menustartdate: false,
                menuenddate: false,
                msgalert: "",
                dialogdeletealert: false,
                search_company: '',
                menusdate: false,
                urlprintnote: '',
                printtitle: '',
                printwidth: '80%',
                ndate: moment(new Date()).format('YYYY-MM-DD'),
                date: new Date().toISOString().substr(0, 10),
                disabledDates: {
                    to: new Date(Date.now() - 8640000)
                },
                page: 1,
                headers: [{
                        text: "TANGGAL",
                        align: "left",
                        sortable: false,
                        value: "mr",
                        width: "15%",
                        class: "pa-2 blue lighten-3 white--text"
                    },
                    {
                        text: "NO. REG",
                        align: "left",
                        sortable: false,
                        value: "mr",
                        width: "10%",
                        class: "pa-2 blue lighten-3 white--text"
                    },
                    {
                        text: "PASIEN",
                        align: "left",
                        sortable: false,
                        value: "mr",
                        width: "20%",
                        class: "pa-2 blue lighten-3 white--text"
                    },
                    {
                        text: "AKSI",
                        align: "center",
                        sortable: false,
                        value: "name",
                        width: "15%",
                        class: "pa-2 blue lighten-3 white--text"
                    }
                ],
                pagination: {
                    descending: true,
                    page: 1,
                    rowsPerPage: 5,
                    sortBy: 'F_BillNo',
                    totalItems: this.$store.state.printresult.total_printresults
                },
                statuss: [{
                        waktu: '16-07-2019 10:00',
                        status: 'Order Dibuat',
                        user: 'Nagita Slavina'
                    },
                    {
                        waktu: '16-07-2019 11:00',
                        status: 'Order Dikirim',
                        user: 'Nagita Slavina'
                    },
                    {
                        waktu: '16-07-2019 12:00',
                        status: 'Order dikonfirmasi',
                        user: 'Chacha Frederica'
                    },
                    {
                        waktu: '16-07-2019 13:00',
                        status: 'Telah dibuat Surat Jalan',
                        user: 'Chacha Frederica'
                    },
                    {
                        waktu: '16-07-2019 14:00',
                        status: 'Kurir akan mengambil sampel',
                        user: 'Satria Subiantoro'
                    }
                ]
            };
        },
        watch: {
            search_company(val, old) {
                if (val == old) return
                if (!val) return
                if (val.length < 1) return
                if (this.$store.state.printresult.update_autocomplete_status == 1) return
                this.thr_search_company()
            }
        }
    }
</script>
