<template>
    <v-layout>
        <v-flex xs12>
            <v-card class="mb-2" color="white">
                <v-toolbar color="blue lighten-3" dark height="50px">
                    <v-toolbar-title>Agreement Perusahaan : {{xcompany.name}}</v-toolbar-title>
                    <v-spacer></v-spacer>
                    <v-btn @click="openFormMou(0)" icon>
                        <v-icon>library_add</v-icon>
                    </v-btn>
                </v-toolbar>
                <v-layout row style="background:#bbdefb;padding-top:5px;" justify-left>
                    <v-list-tile>
                        <input type="text" v-model="xsearch" class="textinput" label="Nama Station" placeholder="Cari ..." />
                        </v-list-tile-content>
                    </v-list-tile>
                </v-layout>
                <v-divider></v-divider>
                <v-layout row class="scroll-container" style="max-height:645px;overflow: auto;">
                    <v-flex xs12 pl-2 pr-2 pt-2 pb-2>
                        <v-data-table :headers="headers" :items="mous" :loading="isLoading" :pagination.sync="pagination" class="elevation-1">
                            <template slot="items" slot-scope="props">
                                <td class="text-xs-left pa-2" v-html="props.item.numberx">
                                </td>
                                <td class="text-xs-left pa-2" v-html="props.item.namex">
                                </td>
                                <td class="text-xs-left pa-2" v-html="props.item.periode">
                                </td>
                                <td class="text-xs-left pa-2" v-html="props.item.M_MouTypeName">
                                </td>
                                <td class="text-xs-left pa-2">
                                    <v-btn class="xs3 ma-1" color="info" @click="setStatusOrder(props.item)">{{ props.item.aksi}}</v-btn>
                                </td>
                                <td class="text-xs-left pa-2">
                                  <v-icon small v-if="props.item.isverified == 'N' && props.item.isreleased == 'N'" class="ml-3" color="primary" @click="editFormMou(props.item)">edit</v-icon>
                                    <v-icon small v-if="props.item.isverified == 'N' && props.item.isreleased == 'N'" class="ml-3" color="error" @click="deleteMou(props.item)">delete</v-icon>
                                    <v-icon small v-if="props.item.isverified == 'N' && props.item.isreleased == 'N'" class="ml-3" color="success" @click="doPriceList(props.item)">add</v-icon>
                                    <v-icon small v-if="props.item.isreleased == 'Y'" class="ml-3" color="primary" @click="editFormMouRelease(props.item)">edit</v-icon>
                                    <v-icon small class="ml-3" color="success" @click="doPrintVerify(props.item)">print</v-icon>
                                    <v-icon small class="ml-3" color="success" @click="doPrintVerifyExcell(props.item)">library_books</v-icon>
</td>
                            </template>
                            <template>
                                <div class="text-xs-center">
                                    <v-pagination v-model="page" :length="15" :total-visible="7"></v-pagination>
                                </div>
                            </template>
                        </v-data-table>
                    </v-flex>
                </v-layout>
                <template>

                    <v-dialog v-model="dialogeditafterreleasealertmou" max-width="600px">
                        <v-card>
                            <v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
                                Edit (Setelah Rilis)

                            </v-card-title>
                            <v-card-text class="pt-0 pb-0">
                                <v-form ref="formcompanymou" v-model="validmou" lazy-validation>
                                    <v-layout wrap>
                                        <v-flex xs12>
                                            <v-icon color="orange darken-2" @click="doPrint()">folder_open</v-icon>PERUSAHAAN : {{xcompany.name}} <span> &nbsp;[ <span style="color:#2196F3;font-weight: 900;">{{number}} </span>&nbsp;]
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-text-field readonly label="Nama" v-model="name" class="font-italic"></v-text-field>
                                            <p v-if="checkError('requirename')" class="error pl-2 pr-2" style="color:#fff">Nama harus diisi dong</p>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-text-field readonly label="No Ref" class="font-italic" v-model="refnumber"></v-text-field>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-layout>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field readonly class="font-italic" label="Tgl. Mulai" placeholder="dd-mm-yyyy" mask="##-##-####" v-model="xstartdate"></v-text-field>
                                                </v-flex>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field readonly class="font-italic" label="Tgl. Selesai" placeholder="dd-mm-yyyy" mask="##-##-####" v-model="xenddate"></v-text-field>
                                                    <p v-if="checkError('requireenddate')" class="error pl-2 pr-2" style="color:#fff">Tgl. selesai tidak boleh kurang dari tgl. mulai</p>
                                                </v-flex>
                                            </v-layout>

                                            <v-flex xs12>

                                                <v-select readonly class="font-italic" item-text="basename" return-object :items="xbases" v-model="xbase" label="Dasar Agreement"></v-select>
                                                <p v-if="checkError('requirebase')" class="error pl-2 pr-2" style="color:#fff">Dasar Agreement harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly class="font-italic" item-text="M_OmzetTypeName" return-object :items="xomzettypes" v-model="xomzettype"
                                                    label="Klasifikasi Omset"></v-select>
                                                <p v-if="checkError('requireomzet')" class="error pl-2 pr-2" style="color:#fff">Klasifikasi Omset harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly class="font-italic" item-text="M_MouTypeName" return-object :items="xmoutypes" v-model="xmoutype" label="Tipe Agreement"></v-select>
                                                <p v-if="checkError('requiremoutypr')" class="error pl-2 pr-2" style="color:#fff">Tipe Agreement harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly class="font-italic" item-text="M_AgingTypeName" return-object :items="xagingtypes" v-model="xagingtype"
                                                    label="Tipe Aging"></v-select>
                                                <p v-if="checkError('requireagingtype')" class="error pl-2 pr-2" style="color:#fff">Tipe Aging harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-textarea v-model="xnote" label="Catatan"></v-textarea>
                                                <p v-if="checkError('requirenote')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-text-field label="Email Hasil" v-model="mouemail"></v-text-field>
                                                <p v-if="checkError('requireemailtext')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12 v-if="this.mouemail">
                                                <v-checkbox v-model="isemail" label="Otomatis Kirim Email Hasil?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                PIC Rekanan
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field label="Nama" v-model="xpicname"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field label="No. HP" v-model="xpichp"></v-text-field>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-text-field label="Email" v-model="mouemailpic"></v-text-field>
                                                <p v-if="checkError('requireemailtextpic')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                PIC Keuangan Rekanan
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field label="Nama" v-model="xfincname"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field label="No. HP" v-model="xfinchp"></v-text-field>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-text-field label="Email" v-model="mouemailfinc"></v-text-field>
                                                <p v-if="checkError('requireemailtextfinc')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-checkbox v-model="isbill" label="Bill ?"></v-checkbox>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field v-if="this.isbill === false" label="Min DP (Persen)" v-model="mindp"></v-text-field>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-select item-text="M_BillTypeName" return-object :items="xbilltypes" v-model="xbilltype" label="Tipe Tagihan"></v-select>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select v-if="this.xbilltype && this.xbilltype.M_BillTypeName === 'Terpusat'" item-text="M_BranchName" return-object :items="xbranchs"
                                                            v-model="xbranch" label="Cabang"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-checkbox v-model="isaging" label="Aging on Hold ?"></v-checkbox>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field type="number" v-if="this.isaging === true" label="Jatuh Tempo (Hari)" v-model="agingnote"></v-text-field>
                                                        <p v-if="checkError('requireaging')" class="error pl-2 pr-2" style="color:#fff">Jatuh Tempo (Hari) harus diisi dong</p>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox v-model="isdefault" label="Default ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox readonly class="font-italic" v-model="isfavorit" label="Favorite ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox v-model="ismcu" label="MCU ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox readonly class="font-italic" v-model="isjpanetto" label="JPA Netto ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 1" v-model="jpa1Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa1amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa1amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa1s"
                                                            v-model="xjpa1" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 2" v-model="jpa2Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa2amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa2amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa2s"
                                                            v-model="xjpa2" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 3" v-model="jpa3Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa3amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa3amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa3s"
                                                            v-model="xjpa3" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>

                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 4" v-model="jpa4Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa4amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa4amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa4s"
                                                            v-model="xjpa4" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex>
                                                <span>Huruf miring = data yang tidak dapat diubah karena sudah dirilis</span>
                                            </v-flex>
                                        </v-flex>
                                        <v-flex>
                                            <p v-for="(xerror,idx) in xerrors" class="error pl-2 pr-2" style="color:#fff">{{xerror.msg}}</p>
                                        </v-flex>
                                    </v-layout>
                            </v-card-text>
                            <v-divider></v-divider>
                            <v-card-actions>
                                <v-spacer></v-spacer>
                                <v-btn color="primary" flat @click="dialogeditafterreleasealertmou = false">
                                    Tutup
                                </v-btn>
                                <v-btn color="primary" flat @click="closeEditAfterReleadeAlertMou()">
                                    Simpan
                                </v-btn>
                            </v-card-actions>
                        </v-card>
                    </v-dialog>

                </template>
                <template>

                    <v-dialog v-model="dialogdeletealertmou" max-width="600px">
                        <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>
                                                        {{msgalertmou}}
                                                    </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="dialogdeletealertmou = false">
                                    Tutup
                                </v-btn>
                                <v-btn color="primary" flat @click="closeDeleteAlertMou()">
                                    Yakin lah
                                </v-btn>
                            </v-card-actions>
                        </v-card>
                    </v-dialog>

                </template>
                <template>

                    <v-dialog v-model="dialog_alert_verif" max-width="600px">
                        <v-card>
                            <v-card-title class="headline red 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>
                                                        {{msgalertverif}}
                                                    </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="close_alert_verif()">
                                    Tutup
                                </v-btn>
                            </v-card-actions>
                        </v-card>
                    </v-dialog>

                </template>
                <template>

                    <v-dialog v-model="dialogverifyalertmou" max-width="600px">
                        <v-card>
                            <v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
                                Verifikasi

                            </v-card-title>
                            <v-card-text class="pt-0 pb-0">
                                <v-form ref="formcompanymou" v-model="validmou" lazy-validation>
                                    <v-layout wrap>
                                        <v-flex xs12>
                                            <v-icon color="orange darken-2" @click="doPrint()">folder_open</v-icon>PERUSAHAAN : {{xcompany.name}} <span> &nbsp;[ <span style="color:#2196F3;font-weight: 900;">{{number}} </span>&nbsp;]
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-text-field readonly label="Nama" v-model="name"></v-text-field>
                                            <p v-if="checkError('requirename')" class="error pl-2 pr-2" style="color:#fff">Nama harus diisi dong</p>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-text-field readonly label="No Ref" v-model="refnumber"></v-text-field>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-layout>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field label="Tgl. Mulai" placeholder="dd-mm-yyyy" mask="##-##-####" v-model="xstartdate"></v-text-field>
                                                </v-flex>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field label="Tgl. Selesai" placeholder="dd-mm-yyyy" mask="##-##-####" v-model="xenddate"></v-text-field>
                                                    <p v-if="checkError('requireenddate')" class="error pl-2 pr-2" style="color:#fff">Tgl. selesai tidak boleh kurang dari tgl. mulai</p>
                                                </v-flex>
                                            </v-layout>

                                            <v-flex xs12>

                                                <v-select readonly item-text="basename" return-object :items="xbases" v-model="xbase" label="Dasar Agreement"></v-select>
                                                <p v-if="checkError('requirebase')" class="error pl-2 pr-2" style="color:#fff">Dasar Agreement harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly item-text="M_OmzetTypeName" return-object :items="xomzettypes" v-model="xomzettype" label="Klasifikasi Omset"></v-select>
                                                <p v-if="checkError('requireomzet')" class="error pl-2 pr-2" style="color:#fff">Klasifikasi Omset harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly item-text="M_MouTypeName" return-object :items="xmoutypes" v-model="xmoutype" label="Tipe Agreement"></v-select>
                                                <p v-if="checkError('requiremoutypr')" class="error pl-2 pr-2" style="color:#fff">Tipe Agreement harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly item-text="M_AgingTypeName" return-object :items="xagingtypes" v-model="xagingtype" label="Tipe Aging"></v-select>
                                                <p v-if="checkError('requireagingtype')" class="error pl-2 pr-2" style="color:#fff">Tipe Aging harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-textarea readonly v-model="xnote" label="Catatan"></v-textarea>
                                                <p v-if="checkError('requirenote')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-text-field readonly label="Email Hasil" v-model="mouemail"></v-text-field>
                                                <p v-if="checkError('requireemailtext')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12 v-if="this.mouemail">
                                                <v-checkbox readonly v-model="isemail" label="Otomatis Kirim Email Hasil?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                PIC Rekanan
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly label="Nama" v-model="xpicname"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly label="No. HP" v-model="xpichp"></v-text-field>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-text-field readonly label="Email" v-model="mouemailpic"></v-text-field>
                                                <p v-if="checkError('requireemailtextpic')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                PIC Keuangan Rekanan
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly label="Nama" v-model="xfincname"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly label="No. HP" v-model="xfinchp"></v-text-field>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-text-field readonly label="Email" v-model="mouemailfinc"></v-text-field>
                                                <p v-if="checkError('requireemailtextfinc')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-checkbox readonly v-model="isbill" label="Bill ?"></v-checkbox>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly v-if="this.isbill === false" label="Min DP (Persen)" v-model="mindp"></v-text-field>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly item-text="M_BillTypeName" return-object :items="xbilltypes" v-model="xbilltype" label="Tipe Tagihan"></v-select>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly v-if="this.xbilltype && this.xbilltype.M_BillTypeName === 'Terpusat'" item-text="M_BranchName" return-object
                                                            :items="xbranchs" v-model="xbranch" label="Cabang"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-checkbox readonly v-model="isaging" label="Aging on Hold ?"></v-checkbox>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly v-if="this.isaging === true" label="Jatuh Tempo (Hari)" v-model="agingnote"></v-text-field>
                                                        <p v-if="checkError('requireaging')" class="error pl-2 pr-2" style="color:#fff">Jatuh Tempo (Hari) harus diisi dong</p>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox readonly v-model="isdefault" label="Default ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox readonly v-model="isfavorit" label="Favorite ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox readonly v-model="ismcu" label="MCU ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox readonly v-model="isjpanetto" label="JPA Netto ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 1" v-model="jpa1Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa1amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa1amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa1s"
                                                            v-model="xjpa1" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 2" v-model="jpa2Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa2amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa2amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa2s"
                                                            v-model="xjpa2" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 3" v-model="jpa3Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa3amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa3amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa3s"
                                                            v-model="xjpa3" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>

                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 4" v-model="jpa4Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa4amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa4amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa4s"
                                                            v-model="xjpa4" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex>
                                                <p v-for="(xerror,idx) in xerrors" class="error pl-2 pr-2" style="color:#fff">{{xerror.msg}}</p>
                                            </v-flex>
                                    </v-layout>
                            </v-card-text>
                            <v-divider></v-divider>
                            <v-card-actions>
                                <v-spacer></v-spacer>
                                <v-btn color="primary" flat @click="dialogverifyalertmou = false">
                                    Tutup
                                </v-btn>
                                <v-btn color="primary" flat @click="closeVerifyAlertMou()">
                                    Verifikasi
                                </v-btn>
                            </v-card-actions>
                        </v-card>
                    </v-dialog>

                </template>

                <template>

                    <v-dialog v-model="dialogunverifyalertmou" max-width="600px">
                        <v-card>
                            <v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
                                Batal Verifikasi
                            </v-card-title>
                            <v-card-text class="pt-0 pb-0">
                                <v-form ref="formcompanymou" v-model="validmou" lazy-validation>
                                    <v-layout wrap>
                                        <v-flex xs12>
                                            PERUSAHAAN : {{xcompany.name}} <span> &nbsp;[ <span style="color:#2196F3;font-weight: 900;">{{number}} </span>                                            &nbsp;]
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-text-field readonly label="Nama" v-model="name"></v-text-field>
                                            <p v-if="checkError('requirename')" class="error pl-2 pr-2" style="color:#fff">Nama harus diisi dong</p>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-text-field readonly label="No Ref" v-model="refnumber"></v-text-field>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-layout>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field label="Tgl. Mulai" placeholder="dd-mm-yyyy" mask="##-##-####" v-model="xstartdate"></v-text-field>
                                                </v-flex>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field label="Tgl. Selesai" placeholder="dd-mm-yyyy" mask="##-##-####" v-model="xenddate"></v-text-field>
                                                    <p v-if="checkError('requireenddate')" class="error pl-2 pr-2" style="color:#fff">Tgl. selesai tidak boleh kurang dari tgl. mulai</p>
                                                </v-flex>
                                            </v-layout>

                                            <v-flex xs12>

                                                <v-select readonly item-text="basename" return-object :items="xbases" v-model="xbase" label="Dasar Agreement"></v-select>
                                                <p v-if="checkError('requirebase')" class="error pl-2 pr-2" style="color:#fff">Dasar Agreement harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly item-text="M_OmzetTypeName" return-object :items="xomzettypes" v-model="xomzettype" label="Klasifikasi Omset"></v-select>
                                                <p v-if="checkError('requireomzet')" class="error pl-2 pr-2" style="color:#fff">Klasifikasi Omset harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly item-text="M_MouTypeName" return-object :items="xmoutypes" v-model="xmoutype" label="Tipe Agreement"></v-select>
                                                <p v-if="checkError('requiremoutypr')" class="error pl-2 pr-2" style="color:#fff">Tipe Agreement harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly item-text="M_AgingTypeName" return-object :items="xagingtypes" v-model="xagingtype" label="Tipe Aging"></v-select>
                                                <p v-if="checkError('requireagingtype')" class="error pl-2 pr-2" style="color:#fff">Tipe Aging harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-textarea readonly v-model="xnote" label="Catatan"></v-textarea>
                                                <p v-if="checkError('requirenote')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-text-field readonly label="Email Hasil" v-model="mouemail"></v-text-field>
                                                <p v-if="checkError('requireemailtext')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12 v-if="this.mouemail">
                                                <v-checkbox readonly v-model="isemail" label="Otomatis Kirim Email Hasil?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                PIC Rekanan
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly label="Nama" v-model="xpicname"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly label="No. HP" v-model="xpichp"></v-text-field>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-text-field readonly label="Email" v-model="mouemailpic"></v-text-field>
                                                <p v-if="checkError('requireemailtextpic')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                PIC Keuangan Rekanan
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly label="Nama" v-model="xfincname"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly label="No. HP" v-model="xfinchp"></v-text-field>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-text-field readonly label="Email" v-model="mouemailfinc"></v-text-field>
                                                <p v-if="checkError('requireemailtextfinc')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-checkbox readonly v-model="isbill" label="Bill ?"></v-checkbox>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly v-if="this.isbill === false" label="Min DP (Persen)" v-model="mindp"></v-text-field>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly item-text="M_BillTypeName" return-object :items="xbilltypes" v-model="xbilltype" label="Tipe Tagihan"></v-select>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly v-if="this.xbilltype && this.xbilltype.M_BillTypeName === 'Terpusat'" item-text="M_BranchName" return-object
                                                            :items="xbranchs" v-model="xbranch" label="Cabang"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-checkbox readonly v-model="isaging" label="Aging on Hold ?"></v-checkbox>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly v-if="this.isaging === true" label="Jatuh Tempo (Hari)" v-model="agingnote"></v-text-field>
                                                        <p v-if="checkError('requireaging')" class="error pl-2 pr-2" style="color:#fff">Jatuh Tempo (Hari) harus diisi dong</p>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox readonly v-model="isdefault" label="Default ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox readonly v-model="isfavorit" label="Favorite ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox readonly v-model="ismcu" label="MCU ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox readonly v-model="isjpanetto" label="JPA Netto ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 1" v-model="jpa1Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa1amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa1amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa1s"
                                                            v-model="xjpa1" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 2" v-model="jpa2Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa2amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa2amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa2s"
                                                            v-model="xjpa2" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 3" v-model="jpa3Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa3amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa3amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa3s"
                                                            v-model="xjpa3" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>

                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 4" v-model="jpa4Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa4amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa4amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa4s"
                                                            v-model="xjpa4" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex>
                                                <p v-for="(xerror,idx) in xerrors" class="error pl-2 pr-2" style="color:#fff">{{xerror.msg}}</p>
                                            </v-flex>
                                    </v-layout>
                            </v-card-text>
                            <v-divider></v-divider>
                            <v-card-actions>
                                <v-spacer></v-spacer>
                                <v-btn color="primary" flat @click="dialogunverifyalertmou = false">
                                    Tutup
                                </v-btn>
                                <v-btn color="primary" flat @click="closeUnVerifyAlertMou()">
                                    Batal Verifikasi
                                </v-btn>
                            </v-card-actions>
                        </v-card>
                    </v-dialog>

                </template>


                <template>

                    <v-dialog v-model="dialogreleasealertmou" max-width="600px">
                        <v-card>
                            <v-card-title>
                                <span class="headline">Konfirmasi Rilis</span>
                            </v-card-title>
                            <v-card-text class="pt-0 pb-0">
                                <v-form ref="formcompanymou" v-model="validmou" lazy-validation>
                                    <v-layout wrap>
                                        <v-flex xs12>
                                            <v-icon color="orange darken-2" @click="doPrint()">folder_open</v-icon>PERUSAHAAN : {{xcompany.name}} <span> &nbsp;[ <span style="color:#2196F3;font-weight: 900;">{{number}} </span>                                            &nbsp;]
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-text-field readonly label="Nama" v-model="name"></v-text-field>
                                            <p v-if="checkError('requirename')" class="error pl-2 pr-2" style="color:#fff">Nama harus diisi dong</p>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-text-field readonly label="No Ref" v-model="refnumber"></v-text-field>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-layout>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field label="Tgl. Mulai" placeholder="dd-mm-yyyy" mask="##-##-####" v-model="xstartdate"></v-text-field>
                                                </v-flex>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field label="Tgl. Selesai" placeholder="dd-mm-yyyy" mask="##-##-####" v-model="xenddate"></v-text-field>
                                                    <p v-if="checkError('requireenddate')" class="error pl-2 pr-2" style="color:#fff">Tgl. selesai tidak boleh kurang dari tgl. mulai</p>
                                                </v-flex>
                                            </v-layout>

                                            <v-flex xs12>

                                                <v-select readonly item-text="basename" return-object :items="xbases" v-model="xbase" label="Dasar Agreement"></v-select>
                                                <p v-if="checkError('requirebase')" class="error pl-2 pr-2" style="color:#fff">Dasar Agreement harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly item-text="M_OmzetTypeName" return-object :items="xomzettypes" v-model="xomzettype" label="Klasifikasi Omset"></v-select>
                                                <p v-if="checkError('requireomzet')" class="error pl-2 pr-2" style="color:#fff">Klasifikasi Omset harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly item-text="M_MouTypeName" return-object :items="xmoutypes" v-model="xmoutype" label="Tipe Agreement"></v-select>
                                                <p v-if="checkError('requiremoutypr')" class="error pl-2 pr-2" style="color:#fff">Tipe Agreement harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly item-text="M_AgingTypeName" return-object :items="xagingtypes" v-model="xagingtype" label="Tipe Aging"></v-select>
                                                <p v-if="checkError('requireagingtype')" class="error pl-2 pr-2" style="color:#fff">Tipe Aging harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-textarea readonly v-model="xnote" label="Catatan"></v-textarea>
                                                <p v-if="checkError('requirenote')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-text-field readonly label="Email Hasil" v-model="mouemail"></v-text-field>
                                                <p v-if="checkError('requireemailtext')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12 v-if="this.mouemail">
                                                <v-checkbox readonly v-model="isemail" label="Otomatis Kirim Email Hasil?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                PIC Rekanan
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly label="Nama" v-model="xpicname"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly label="No. HP" v-model="xpichp"></v-text-field>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-text-field readonly label="Email" v-model="mouemailpic"></v-text-field>
                                                <p v-if="checkError('requireemailtextpic')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                PIC Keuangan Rekanan
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly label="Nama" v-model="xfincname"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly label="No. HP" v-model="xfinchp"></v-text-field>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-text-field readonly label="Email" v-model="mouemailfinc"></v-text-field>
                                                <p v-if="checkError('requireemailtextfinc')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-checkbox readonly v-model="isbill" label="Bill ?"></v-checkbox>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly v-if="this.isbill === false" label="Min DP (Persen)" v-model="mindp"></v-text-field>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly item-text="M_BillTypeName" return-object :items="xbilltypes" v-model="xbilltype" label="Tipe Tagihan"></v-select>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly v-if="this.xbilltype && this.xbilltype.M_BillTypeName === 'Terpusat'" item-text="M_BranchName" return-object
                                                            :items="xbranchs" v-model="xbranch" label="Cabang"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-checkbox readonly v-model="isaging" label="Aging on Hold ?"></v-checkbox>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field readonly v-if="this.isaging === true" label="Jatuh Tempo (Hari)" v-model="agingnote"></v-text-field>
                                                        <p v-if="checkError('requireaging')" class="error pl-2 pr-2" style="color:#fff">Jatuh Tempo (Hari) harus diisi dong</p>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox readonly v-model="isdefault" label="Default ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox readonly v-model="isfavorit" label="Favorite ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox readonly v-model="ismcu" label="MCU ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-checkbox readonly v-model="isjpanetto" label="JPA Netto ?"></v-checkbox>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 1" v-model="jpa1Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa1amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa1amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa1s"
                                                            v-model="xjpa1" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 2" v-model="jpa2Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa2amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa2amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa2s"
                                                            v-model="xjpa2" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 3" v-model="jpa3Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa3amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa3amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa3s"
                                                            v-model="xjpa3" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>

                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="JPA 4" v-model="jpa4Name"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs3 pa-1>
                                                        <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa4amount"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-select readonly class="font-italic" :disabled="xjpa4amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa4s"
                                                            v-model="xjpa4" label="Tipe JPA"></v-select>
                                                    </v-flex>
                                                </v-layout>
                                            </v-flex>
                                            <v-flex>
                                                <p v-for="(xerror,idx) in xerrors" class="error pl-2 pr-2" style="color:#fff">{{xerror.msg}}</p>
                                            </v-flex>
                                    </v-layout>
                            </v-card-text>
                            <v-divider></v-divider>
                            <v-card-actions>
                                <v-spacer></v-spacer>
                                <v-btn color="primary" flat @click="dialogreleasealertmou = false">
                                    Tutup
                                </v-btn>
                                <v-btn color="primary" flat @click="closeReleaseAlertMou()">
                                    Rilis
                                </v-btn>
                            </v-card-actions>
                        </v-card>
                    </v-dialog>

                </template>
                <template>

                    <v-dialog v-model="alertverify" 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>
                                                        {{msgalertmou}}
                                                    </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="alertverify = false">
                                    Tutup
                                </v-btn>
                                <v-btn color="primary" flat @click="doPrice()">
                                    Buat Harga
                                </v-btn>
                            </v-card-actions>
                        </v-card>
                    </v-dialog>

                </template>

                <template>

                    <v-dialog v-model="dialogunreleasealertmou" max-width="600px">
                        <v-card>
                            <v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
                                Batal Rilis
                            </v-card-title>
                            <v-card-text class="pt-0 pb-0">
                                <v-form ref="formcompanymou" v-model="validmou" lazy-validation>
                                    <v-layout wrap>
                                        <v-flex xs12>
                                            PERUSAHAAN : {{xcompany.name}} <span> &nbsp;[ <span style="color:#2196F3;font-weight: 900;">{{number}} </span>                                            &nbsp;]
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-text-field readonly label="Nama" v-model="name"></v-text-field>
                                            <p v-if="checkError('requirename')" class="error pl-2 pr-2" style="color:#fff">Nama harus diisi dong</p>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-text-field readonly label="No Ref" v-model="refnumber"></v-text-field>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-layout>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field label="Tgl. Mulai" placeholder="dd-mm-yyyy" mask="##-##-####" v-model="xstartdate"></v-text-field>
                                                </v-flex>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field label="Tgl. Selesai" placeholder="dd-mm-yyyy" mask="##-##-####" v-model="xenddate"></v-text-field>
                                                    <p v-if="checkError('requireenddate')" class="error pl-2 pr-2" style="color:#fff">Tgl. selesai tidak boleh kurang dari tgl. mulai</p>
                                                </v-flex>
                                            </v-layout>

                                            <v-flex xs12>

                                                <v-select readonly item-text="basename" return-object :items="xbases" v-model="xbase" label="Dasar Agreement"></v-select>
                                                <p v-if="checkError('requirebase')" class="error pl-2 pr-2" style="color:#fff">Dasar Agreement harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly item-text="M_OmzetTypeName" return-object :items="xomzettypes" v-model="xomzettype" label="Klasifikasi Omset"></v-select>
                                                <p v-if="checkError('requireomzet')" class="error pl-2 pr-2" style="color:#fff">Klasifikasi Omset harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly item-text="M_MouTypeName" return-object :items="xmoutypes" v-model="xmoutype" label="Tipe Agreement"></v-select>
                                                <p v-if="checkError('requiremoutypr')" class="error pl-2 pr-2" style="color:#fff">Tipe Agreement harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-select readonly item-text="M_AgingTypeName" return-object :items="xagingtypes" v-model="xagingtype" label="Tipe Aging"></v-select>
                                                <p v-if="checkError('requireagingtype')" class="error pl-2 pr-2" style="color:#fff">Tipe Aging harus diisi dong</p>
                                            </v-flex>
                                            <<v-flex xs12>
                                                <v-textarea readonly v-model="xnote" label="Catatan"></v-textarea>
                                                <p v-if="checkError('requirenote')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-text-field readonly label="Email Hasil" v-model="mouemail"></v-text-field>
                                            <p v-if="checkError('requireemailtext')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                        </v-flex>
                                        <v-flex xs12 v-if="this.mouemail">
                                            <v-checkbox readonly v-model="isemail" label="Otomatis Kirim Email Hasil?"></v-checkbox>
                                        </v-flex>
                                        <v-flex xs12>
                                            PIC Rekanan
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-layout>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field readonly label="Nama" v-model="xpicname"></v-text-field>
                                                </v-flex>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field readonly label="No. HP" v-model="xpichp"></v-text-field>
                                                </v-flex>
                                            </v-layout>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-text-field readonly label="Email" v-model="mouemailpic"></v-text-field>
                                            <p v-if="checkError('requireemailtextpic')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                        </v-flex>
                                        <v-flex xs12>
                                            PIC Keuangan Rekanan
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-layout>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field readonly label="Nama" v-model="xfincname"></v-text-field>
                                                </v-flex>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field readonly label="No. HP" v-model="xfinchp"></v-text-field>
                                                </v-flex>
                                            </v-layout>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-text-field readonly label="Email" v-model="mouemailfinc"></v-text-field>
                                            <p v-if="checkError('requireemailtextfinc')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-layout>
                                                <v-flex xs6 pa-1>
                                                    <v-checkbox readonly v-model="isbill" label="Bill ?"></v-checkbox>
                                                </v-flex>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field readonly v-if="this.isbill === false" label="Min DP (Persen)" v-model="mindp"></v-text-field>
                                                </v-flex>
                                            </v-layout>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-layout>
                                                <v-flex xs6 pa-1>
                                                    <v-select readonly item-text="M_BillTypeName" return-object :items="xbilltypes" v-model="xbilltype" label="Tipe Tagihan"></v-select>
                                                </v-flex>
                                                <v-flex xs6 pa-1>
                                                    <v-select readonly v-if="this.xbilltype && this.xbilltype.M_BillTypeName === 'Terpusat'" item-text="M_BranchName" return-object
                                                        :items="xbranchs" v-model="xbranch" label="Cabang"></v-select>
                                                </v-flex>
                                            </v-layout>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-layout>
                                                <v-flex xs6 pa-1>
                                                    <v-checkbox readonly v-model="isaging" label="Aging on Hold ?"></v-checkbox>
                                                </v-flex>
                                                <v-flex xs6 pa-1>
                                                    <v-text-field readonly v-if="this.isaging === true" label="Jatuh Tempo (Hari)" v-model="agingnote"></v-text-field>
                                                    <p v-if="checkError('requireaging')" class="error pl-2 pr-2" style="color:#fff">Jatuh Tempo (Hari) harus diisi dong</p>
                                                </v-flex>
                                            </v-layout>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-checkbox readonly v-model="isdefault" label="Default ?"></v-checkbox>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-checkbox readonly v-model="isfavorit" label="Favorite ?"></v-checkbox>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-checkbox readonly v-model="ismcu" label="MCU ?"></v-checkbox>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-checkbox readonly v-model="isjpanetto" label="JPA Netto ?"></v-checkbox>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-layout>
                                                <v-flex xs3 pa-1>
                                                    <v-text-field readonly class="font-italic" label="JPA 1" v-model="jpa1Name"></v-text-field>
                                                </v-flex>
                                                <v-flex xs3 pa-1>
                                                    <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa1amount"></v-text-field>
                                                </v-flex>
                                                <v-flex xs6 pa-1>
                                                    <v-select readonly class="font-italic" :disabled="xjpa1amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa1s"
                                                        v-model="xjpa1" label="Tipe JPA"></v-select>
                                                </v-flex>
                                            </v-layout>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-layout>
                                                <v-flex xs3 pa-1>
                                                    <v-text-field readonly class="font-italic" label="JPA 2" v-model="jpa2Name"></v-text-field>
                                                </v-flex>
                                                <v-flex xs3 pa-1>
                                                    <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa2amount"></v-text-field>
                                                </v-flex>
                                                <v-flex xs6 pa-1>
                                                    <v-select readonly class="font-italic" :disabled="xjpa2amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa2s"
                                                        v-model="xjpa2" label="Tipe JPA"></v-select>
                                                </v-flex>
                                            </v-layout>
                                        </v-flex>
                                        <v-flex xs12>
                                            <v-layout>
                                                <v-flex xs3 pa-1>
                                                    <v-text-field readonly class="font-italic" label="JPA 3" v-model="jpa3Name"></v-text-field>
                                                </v-flex>
                                                <v-flex xs3 pa-1>
                                                    <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa3amount"></v-text-field>
                                                </v-flex>
                                                <v-flex xs6 pa-1>
                                                    <v-select readonly class="font-italic" :disabled="xjpa3amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa3s"
                                                        v-model="xjpa3" label="Tipe JPA"></v-select>
                                                </v-flex>
                                            </v-layout>
                                        </v-flex>

                                        <v-flex xs12>
                                            <v-layout>
                                                <v-flex xs3 pa-1>
                                                    <v-text-field readonly class="font-italic" label="JPA 4" v-model="jpa4Name"></v-text-field>
                                                </v-flex>
                                                <v-flex xs3 pa-1>
                                                    <v-text-field readonly class="font-italic" label="Rupiah" type="number" v-model="xjpa4amount"></v-text-field>
                                                </v-flex>
                                                <v-flex xs6 pa-1>
                                                    <v-select readonly class="font-italic" :disabled="xjpa4amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa4s"
                                                        v-model="xjpa4" label="Tipe JPA"></v-select>
                                                </v-flex>
                                            </v-layout>
                                        </v-flex>
                                        <v-flex>
                                            <p v-for="(xerror,idx) in xerrors" class="error pl-2 pr-2" style="color:#fff">{{xerror.msg}}</p>
                                        </v-flex>
                                    </v-layout>
                            </v-card-text>
                            <v-divider></v-divider>
                            <v-card-actions>
                                <v-spacer></v-spacer>
                                <v-btn color="primary" flat @click="dialogunreleasealertmou = false">
                                    Tutup
                                </v-btn>
                                <v-btn color="primary" flat @click="closeUnReleaseAlertMou()">
                                    Batal Rilis
                                </v-btn>
                            </v-card-actions>
                        </v-card>
                    </v-dialog>

                </template>

                <template>
                    <v-layout row justify-center>
                        <v-dialog v-model="dialogstatusorder" persistent max-width="600px">
                            <v-card>
                                <v-card-title>
                                    <span class="headline">Status</span>
                                </v-card-title>
                                <v-card-text class="pt-0 pb-0">
                                    <v-timeline>
                                        <v-timeline-item v-for="(status, i) in xstatuss" :key="i" :waktu="status.waktu" :user="status.user" small>
                                            <template>
                                                <span :class="`headline font-weight-bold cyan--text`" v-text="status.status"></span>
                                            </template>
                                            <div class="py-3">
                                                <h2 :class="`headline font-weight-light mb-3 cyan--text`"></h2>
                                                <div>
                                                    {{status.waktu}}
                                                    <p> [ {{status.user}} ] </p>
                                                </div>
                                            </div>
                                        </v-timeline-item>
                                    </v-timeline>
                                    <v-card-actions>
                                        <v-spacer></v-spacer>
                                        <v-btn color="blue darken-1" flat @click="updateDialogStatusOrder()">Tutup</v-btn>
                                    </v-card-actions>
                            </v-card>
                        </v-dialog>
                    </v-layout>
                </template>

                <template>
                    <v-layout row justify-center>
                        <v-dialog v-model="dialogmou" persistent max-width="600px">
                            <v-card>
                                <v-card-title>
                                    <span class="headline">Form Agreement</span>
                                </v-card-title>
                                <v-card-text class="pt-0 pb-0">
                                    <v-form ref="formcompanymou" v-model="validmou" lazy-validation>
                                        <v-layout wrap>
                                            <v-flex xs12>
                                                PERUSAHAAN : {{xcompany.name}} <span> &nbsp;[ <span style="color:#2196F3;font-weight: 900;">{{number}} </span>                                                &nbsp;]
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-text-field label="Nama" v-model="name"></v-text-field>
                                                <p v-if="checkError('requirename')" class="error pl-2 pr-2" style="color:#fff">Nama harus diisi dong</p>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-text-field label="No Ref" v-model="refnumber"></v-text-field>
                                            </v-flex>
                                            <v-flex xs12>
                                                <v-layout>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field label="Tgl. Mulai" placeholder="dd-mm-yyyy" mask="##-##-####" v-model="xstartdate"></v-text-field>
                                                    </v-flex>
                                                    <v-flex xs6 pa-1>
                                                        <v-text-field label="Tgl. Selesai" placeholder="dd-mm-yyyy" mask="##-##-####" v-model="xenddate"></v-text-field>
                                                        <p v-if="checkError('requireenddate')" class="error pl-2 pr-2" style="color:#fff">Tgl. selesai tidak boleh kurang dari tgl. mulai</p>
                                                    </v-flex>
                                                </v-layout>
                                                <v-flex xs12>
                                                    <v-select item-text="basename" return-object :items="xbases" v-model="xbase" label="Dasar Agreement"></v-select>
                                                    <p v-if="checkError('requirebase')" class="error pl-2 pr-2" style="color:#fff">Dasar Agreement harus diisi dong</p>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-select item-text="M_OmzetTypeName" return-object :items="xomzettypes" v-model="xomzettype" label="Klasifikasi Omset"></v-select>
                                                    <p v-if="checkError('requireomzet')" class="error pl-2 pr-2" style="color:#fff">Klasifikasi Omset harus diisi dong</p>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-select item-text="M_MouTypeName" return-object :items="xmoutypes" v-model="xmoutype" label="Tipe Agreement"></v-select>
                                                    <p v-if="checkError('requiremoutypr')" class="error pl-2 pr-2" style="color:#fff">Tipe Agreement harus diisi dong</p>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-select item-text="M_AgingTypeName" return-object :items="xagingtypes" v-model="xagingtype" label="Tipe Aging"></v-select>
                                                    <p v-if="checkError('requireagingtype')" class="error pl-2 pr-2" style="color:#fff">Tipe Aging harus diisi dong</p>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-textarea v-model="xnote" label="Catatan"></v-textarea>
                                                    <p v-if="checkError('requirenote')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-text-field label="Email Hasil" v-model="mouemail"></v-text-field>
                                                    <p v-if="checkError('requireemailtext')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                                </v-flex>
                                                <v-flex xs12 v-if="this.mouemail">
                                                    <v-checkbox v-model="isemail" label="Otomatis Kirim Email Hasil?"></v-checkbox>
                                                </v-flex>
                                                <v-flex xs12>
                                                    PIC Rekanan
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-layout>
                                                        <v-flex xs6 pa-1>
                                                            <v-text-field label="Nama" v-model="xpicname"></v-text-field>
                                                        </v-flex>
                                                        <v-flex xs6 pa-1>
                                                            <v-text-field label="No. HP" v-model="xpichp"></v-text-field>
                                                        </v-flex>
                                                    </v-layout>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-text-field label="Email" v-model="mouemailpic"></v-text-field>
                                                    <p v-if="checkError('requireemailtextpic')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                                </v-flex>
                                                <v-flex xs12>
                                                    PIC Keuangan Rekanan
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-layout>
                                                        <v-flex xs6 pa-1>
                                                            <v-text-field label="Nama" v-model="xfincname"></v-text-field>
                                                        </v-flex>
                                                        <v-flex xs6 pa-1>
                                                            <v-text-field label="No. HP" v-model="xfinchp"></v-text-field>
                                                        </v-flex>
                                                    </v-layout>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-text-field label="Email" v-model="mouemailfinc"></v-text-field>
                                                    <p v-if="checkError('requireemailtextfinc')" class="error pl-2 pr-2" style="color:#fff">Uups tidak boleh pakai karakter " ; " ya..</p>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-layout>
                                                        <v-flex xs6 pa-1>
                                                            <v-checkbox v-model="isbill" label="Bill ?"></v-checkbox>
                                                        </v-flex>
                                                        <v-flex xs6 pa-1>
                                                            <v-text-field v-if="this.isbill === false" label="Min DP (Persen)" v-model="mindp"></v-text-field>
                                                        </v-flex>
                                                    </v-layout>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-layout>
                                                        <v-flex xs6 pa-1>
                                                            <v-select item-text="M_BillTypeName" return-object :items="xbilltypes" v-model="xbilltype" label="Tipe Tagihan"></v-select>
                                                        </v-flex>
                                                        <v-flex xs6 pa-1>
                                                            <v-select v-if="this.xbilltype && this.xbilltype.M_BillTypeName === 'Terpusat'" item-text="M_BranchName" return-object :items="xbranchs"
                                                                v-model="xbranch" label="Cabang"></v-select>
                                                        </v-flex>
                                                    </v-layout>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-layout>
                                                        <v-flex xs6 pa-1>
                                                            <v-checkbox v-model="isaging" label="Aging on Hold ?"></v-checkbox>
                                                        </v-flex>
                                                        <v-flex xs6 pa-1>
                                                            <v-text-field type="number" v-if="this.isaging === true" label="Jatuh Tempo (Hari)" v-model="agingnote"></v-text-field>
                                                            <p v-if="checkError('requireaging')" class="error pl-2 pr-2" style="color:#fff">Jatuh Tempo (Hari) harus diisi dong</p>
                                                        </v-flex>
                                                    </v-layout>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-checkbox v-model="isdefault" label="Default ?"></v-checkbox>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-checkbox v-model="isfavorit" label="Favorite ?"></v-checkbox>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-checkbox v-model="ismcu" label="MCU ?"></v-checkbox>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-checkbox v-model="isjpanetto" label="JPA Netto ?"></v-checkbox>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-layout>
                                                        <v-flex xs3 pa-1>
                                                            <v-text-field label="JPA 1" v-model="jpa1Name"></v-text-field>
                                                        </v-flex>
                                                        <v-flex xs3 pa-1>
                                                            <v-text-field label="Rupiah" type="number" v-model="xjpa1amount"></v-text-field>
                                                        </v-flex>
                                                        <v-flex xs6 pa-1>
                                                            <v-select :disabled="xjpa1amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa1s" v-model="xjpa1" label="Tipe JPA"></v-select>
                                                        </v-flex>
                                                    </v-layout>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-layout>
                                                        <v-flex xs3 pa-1>
                                                            <v-text-field label="JPA 2" v-model="jpa2Name"></v-text-field>
                                                        </v-flex>
                                                        <v-flex xs3 pa-1>
                                                            <v-text-field label="Rupiah" type="number" v-model="xjpa2amount"></v-text-field>
                                                        </v-flex>
                                                        <v-flex xs6 pa-1>
                                                            <v-select :disabled="xjpa2amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa2s" v-model="xjpa2" label="Tipe JPA"></v-select>
                                                        </v-flex>
                                                    </v-layout>
                                                </v-flex>
                                                <v-flex xs12>
                                                    <v-layout>
                                                        <v-flex xs3 pa-1>
                                                            <v-text-field label="JPA 3" v-model="jpa3Name"></v-text-field>
                                                        </v-flex>
                                                        <v-flex xs3 pa-1>
                                                            <v-text-field label="Rupiah" type="number" v-model="xjpa3amount"></v-text-field>
                                                        </v-flex>
                                                        <v-flex xs6 pa-1>
                                                            <v-select :disabled="xjpa3amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa3s" v-model="xjpa3" label="Tipe JPA"></v-select>
                                                        </v-flex>
                                                    </v-layout>
                                                </v-flex>

                                                <v-flex xs12>
                                                    <v-layout>
                                                        <v-flex xs3 pa-1>
                                                            <v-text-field label="JPA 4" v-model="jpa4Name"></v-text-field>
                                                        </v-flex>
                                                        <v-flex xs3 pa-1>
                                                            <v-text-field label="Rupiah" type="number" v-model="xjpa4amount"></v-text-field>
                                                        </v-flex>
                                                        <v-flex xs6 pa-1>
                                                            <v-select :disabled="xjpa4amount != '0'" item-text="Nat_JpaName" return-object :items="xjpa4s" v-model="xjpa4" label="Tipe JPA"></v-select>
                                                        </v-flex>
                                                    </v-layout>
                                                </v-flex>
                                                <v-flex>
                                                    <p v-for="(xerror,idx) in xerrors" class="error pl-2 pr-2" style="color:#fff">{{xerror.msg}}</p>
                                                </v-flex>
                                        </v-layout>
                                </v-card-text>
                                <v-card-actions>
                                    <v-spacer></v-spacer>
                                    <v-btn color="blue darken-1" flat @click="updateDialogFormMou()">Tutup</v-btn>
                                    <v-btn color="blue darken-1" flat @click="saveFormMou()">Simpan</v-btn>
                                </v-card-actions>
                                </v-form>
                            </v-card>
                        </v-dialog>
                    </v-layout>
                </template>

                <template>
                    <v-layout row justify-center>
                        <v-dialog v-model="dialogviewrelease" persistent max-width="1050px">
                            <v-card>
                                <v-card-title>
                                    <span class="headline">DETAIL RILIS</span><span> &nbsp;[ <span style="color:#2196F3;font-weight: 900;">{{name}} </span>&nbsp;]
                                </v-card-title>
                                <v-layout row wrap>
                                    <v-flex xs12 pl-2 pr-2 pt-2 pb-2>
                                        <v-data-table :headers="headerviewreleases" :items="moureleases" :loading="isLoading" hide-actions class="elevation-1">
                                            <template slot="items" slot-scope="props">
                                                <td class="text-xs-left pa-2" v-html="props.item.M_BranchName">
                                                </td>
                                                <td class="text-xs-left pa-2" v-html="props.item.status_release">
                                                </td>
                                                <td class="text-xs-left pa-2" v-html="props.item.date_release">
                                                </td>
                                                <td class="text-xs-left pa-2" v-html="props.item.staff_release">
                                                </td>
                                            </template>
                                        </v-data-table>
                                    </v-flex>
                                </v-layout>
                                <v-card-actions>
                                    <v-spacer></v-spacer>
                                    <v-btn color="primary" flat @click="closeViewRelease()">
                                        Tutup
                                    </v-btn>
                                </v-card-actions>
                            </v-card>
                        </v-dialog>
                    </v-layout>
                </template>

            </v-card>
            </v-flex>

            <one-dialog-print :title="printtitle" :width="printwidth" :height="500" :status="openprint" :urlprint="urlprint" @close-dialog-print="closePrint"></one-dialog-print>
            <one-dialog-print-verify :title="printtitleverify" :width="printwidthverify" :height="500" :status="openprintverify" :urlprint="urlprintverify"
                @close-dialog-print="closePrintVerify"></one-dialog-print-verify>


    </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;
    }

    .textinput {
        -webkit-transition: width 0.4s ease-in-out;
        transition: width 0.4s ease-in-out;
        background-color: white;
        background-position: 10px 10px;
        background-repeat: no-repeat;
        padding-left: 40px;
        width: 100%;
        padding: 8px 10px;
        margin-bottom: 5px;
        box-sizing: border-box;
        border: 1px solid #607d8b;

    }

    .textinput:focus {
        width: 100%;
    }

    .textinput:focus::-webkit-input-placeholder {
        color: transparent;
    }

    .textinput:focus::-moz-placeholder {
        color: transparent;
    }

    .textinput:-moz-placeholder {
        color: transparent;
    }

    .scroll-container {
        scroll-padding: 50px 0 0 50px;
    }

    ::-webkit-scrollbar {
        width: 7px;
    }

    /* this targets the default scrollbar (compulsory) */

    ::-webkit-scrollbar-track {
        background-color: #73baf3;
    }

    /* the new scrollbar will have a flat appearance with the set background color */

    ::-webkit-scrollbar-thumb {
        background-color: #2196f3;
    }

    /* this will style the thumb, ignoring the track */

    ::-webkit-scrollbar-button {
        background-color: #0079da;
    }

    /* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */

    ::-webkit-scrollbar-corner {
        background-color: black;
    }
</style>

<script>
    module.exports = {
        components: {
            'one-date-picker': httpVueLoader('../../../common/oneDatePicker.vue'),
            'one-dialog-print': httpVueLoader('../../../common/oneDialogPrintX.vue'),
            'one-dialog-print-verify': httpVueLoader('../../../common/oneDialogPrintX.vue')
        },
        data() {
            return {
                query: "",
                items: [],
                openprint: false,
                urlprint: '',
                printtitle: '',
                printwidth: 600,
                openprintverify: false,
                urlprintverify: '',
                printtitleverify: '',
                printwidthverify: 600,
                formatreport: 'pdf',
                emailRules: [
                    v => !!v || 'Alamat email harus diisi'
                ],
                page: 1,
                headers: [{
                        text: "NO.",
                        align: "Center",
                        sortable: false,
                        value: "lab",
                        width: "18%",
                        class: "blue lighten-4"
                    },
                    {
                        text: "NAMA",
                        align: "Center",
                        sortable: false,
                        value: "name",
                        width: "25%",
                        class: "blue lighten-4"
                    },
                    {
                        text: "PERIODE",
                        align: "Center",
                        sortable: false,
                        value: "name",
                        width: "20%",
                        class: "blue lighten-4"
                    },
                    {
                        text: "TIPE",
                        align: "Center",
                        sortable: false,
                        value: "name",
                        width: "8%",
                        class: "blue lighten-4"
                    },
                    {
                        text: "STATUS",
                        align: "Center",
                        sortable: false,
                        value: "name",
                        width: "5%",
                        class: "blue lighten-4"
                    },
                    {
                        text: "AKSI",
                        align: "Center",
                        sortable: false,
                        value: "status",
                        width: "18%",
                        class: "blue lighten-4"
                    }
                ],
                headerviewreleases: [{
                        text: "CABANG",
                        align: "LEFT",
                        sortable: false,
                        value: "name",
                        width: "10%",
                        class: "blue lighten-4"
                    },
                    {
                        text: "STATUS",
                        align: "LEFT",
                        sortable: false,
                        value: "name",
                        width: "15%",
                        class: "blue lighten-4"
                    },
                    {
                        text: "TANGGAL",
                        align: "LEFT",
                        sortable: false,
                        value: "name",
                        width: "10%",
                        class: "blue lighten-4"
                    },
                    {
                        text: "STAFF",
                        align: "LEFT",
                        sortable: false,
                        value: "name",
                        width: "20%",
                        class: "blue lighten-4"
                    }
                ],
                pagination: {
                    descending: false,
                    page: 1,
                    rowsPerPage: 5,
                    sortBy: 'trx_id ASC',
                    totalItems: this.$store.state.mou.total_transactions
                },
                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'
                    }
                ],
                color: "success",
                validmou: false,
                xid: 0,
                countprice: 0,
                name: "",
                number: "",
                refnumber: "",
                mindp: "",
                agingnote: 0,
                xnote: "",
                mouemail: "",
                mouemailpic: "",
                mouemailfinc: "",
                startdate: "",
                enddate: "",
                isbill: false,
                xpichp: "",
                xpicname: "",
                xfincname: "",
                xfinchp: "",
                isdefault: "",
                isfavorit: "",
                isjpanetto: "",
                ismcu: "",
                isonline: false,
                isaging: "",
                isemail: "",
                menustartdate: false,
                menuenddate: false,
                date: new Date().toISOString().substr(0, 10),
                jpa1Name: '',
                jpa2Name: '',
                jpa3Name: '',
                jpa4Name: '',
                jpa1Percent: 0,
                jpa2Percent: 0,
                jpa3Percent: 0,
                jpa4Percent: 0,
                dialogdeletealertmou: false,
                dialogverifyalertmou: false,
                dialogreleasealertmou: false,
                alertverify: false,
                dialogunreleasealertmou: false,
                dialogunverifyalertmou: false,
                dialogeditafterreleasealertmou: false,
                msgalertmou: ""
            };
        },
        mounted() {
            this.$store.dispatch("mou/selectbase")
            this.$store.dispatch("mou/selectomzettype")
            this.$store.dispatch("mou/selectmoutype")
            this.$store.dispatch("mou/selectagingtype")
            this.$store.dispatch("mou/selectbilltype")
            this.$store.dispatch("mou/selectbranch")
            this.$store.dispatch("mou/selectjpa")
        },
        computed: {
            mous() {
                return this.$store.state.mou.mous
            },
            moureleases() {
                return this.$store.state.mou.moureleases
            },
            xcompany() {
                return this.$store.state.company.selected_company
            },
            dialogmou() {
                return this.$store.state.mou.dialog_form_mou
            },
            dialog_alert_verif() {
                return this.$store.state.mou.dialog_alert_verif
            },
            msgalertverif() {
                return this.$store.state.mou.msgalertverif
            },
            xerrors() {
                return this.$store.state.mou.errors
            },
            isLoading() {
                return this.$store.state.mou.search_status == 1
            },
            xsearch: {
                get() {
                    return this.$store.state.mou.xsearch
                },
                set(val) {
                    this.$store.commit("mou/update_xsearch", val)
                }
            },
            jpa1_name: {
                get() {
                    return this.$store.state.mou.jpa1_name
                },
                set(v) {
                    return this.$store.state.mou.jpa1_name
                }
            },
            jpa2_name: {
                get() {
                    return this.$store.state.mou.jpa2_name
                },
                set(v) {
                    return this.$store.state.mou.jpa2_name
                }
            },
            jpa3_name: {
                get() {
                    return this.$store.state.mou.jpa3_name
                },
                set(v) {
                    return this.$store.state.mou.jpa3_name
                }
            },
            jpa4_name: {
                get() {
                    return this.$store.state.mou.jpa4_name
                },
                set(v) {
                    return this.$store.state.mou.jpa4_name
                }
            },
            jpa1_percent: {
                get() {
                    return this.$store.state.mou.jpa1_percent
                },
                set(v) {
                    return this.$store.state.mou.jpa1_percent
                }
            },
            jpa2_percent: {
                get() {
                    return this.$store.state.mou.jpa2_percent
                },
                set(v) {
                    return this.$store.state.mou.jpa2_percent
                }
            },
            jpa3_percent: {
                get() {
                    return this.$store.state.mou.jpa3_percent
                },
                set(v) {
                    return this.$store.state.mou.jpa3_percent
                }
            },
            jpa4_percent: {
                get() {
                    return this.$store.state.mou.jpa4_percent
                },
                set(v) {
                    return this.$store.state.mou.jpa4_percent
                }
            },
            startComputedDateFormatted() {
                return this.formatDate(this.xstartdate)
            },
            xstartdate: {
                get() {
                    return this.$store.state.mou.startdate
                },
                set(val) {
                    this.$store.commit("mou/update_startdate", val)
                }
            },
            endComputedDateFormatted() {
                return this.formatDate(this.xenddate)
            },
            xenddate: {
                get() {
                    return this.$store.state.mou.enddate
                },
                set(val) {
                    this.$store.commit("mou/update_enddate", val)
                }
            },
            xbases() {
                return this.$store.state.mou.bases
            },
            xbase: {
                get() {
                    return this.$store.state.mou.base
                },
                set(val) {
                    this.$store.commit("mou/update_base", val)
                }

            },
            xomzettypes() {
                return this.$store.state.mou.omzettypes
            },
            xomzettype: {
                get() {
                    return this.$store.state.mou.omzettype
                },
                set(val) {
                    this.$store.commit("mou/update_omzettype", val)
                    if (this.xid == 0) {
                        if (this.$store.state.mou.omzettype.M_OmzetTypeName === 'APS' ||
                            this.$store.state.mou.omzettype.M_OmzetTypeName === 'Dokter' ||
                            this.$store.state.mou.omzettype.M_OmzetTypeName === 'Rujukan' ||
                            this.$store.state.mou.omzettype.M_OmzetTypeName === 'Penelitian') {
                            this.ismcu = false
                        } else {
                            this.ismcu = true
                        }
                    }
                }

            },
            xbilltypes() {
                return this.$store.state.mou.billtypes
            },
            xbilltype: {
                get() {
                    return this.$store.state.mou.billtype
                },
                set(val) {
                    this.$store.commit("mou/update_billtype", val)
                }

            },
            xjpa1s() {
                return this.$store.state.mou.jpa1s
            },
            xjpa1: {
                get() {
                    return this.$store.state.mou.jpa1
                },
                set(val) {
                    this.$store.commit("mou/update_jpa1", val)
                }

            },
            xjpa2s() {
                return this.$store.state.mou.jpa2s
            },
            xjpa2: {
                get() {
                    return this.$store.state.mou.jpa2
                },
                set(val) {
                    this.$store.commit("mou/update_jpa2", val)
                }

            },
            xjpa3s() {
                return this.$store.state.mou.jpa3s
            },
            xjpa3: {
                get() {
                    return this.$store.state.mou.jpa3
                },
                set(val) {
                    this.$store.commit("mou/update_jpa3", val)
                }

            },
            xjpa4s() {
                return this.$store.state.mou.jpa4s
            },
            xjpa4: {
                get() {
                    return this.$store.state.mou.jpa4
                },
                set(val) {
                    this.$store.commit("mou/update_jpa4", val)
                }

            },
            xjpa1amount: {
                get() {
                    return this.$store.state.mou.jpa1amount
                },
                set(val) {
                    if (val == '') {
                        this.$store.commit("mou/update_jpa1amount", 0)
                    } else {
                        this.$store.commit("mou/update_jpa1amount", val)
                        if (val != 0) {
                            this.$store.commit("mou/update_jpa1", '')
                        }
                    }

                }

            },
            xjpa2amount: {
                get() {
                    return this.$store.state.mou.jpa2amount
                },
                set(val) {
                    if (val == '') {
                        this.$store.commit("mou/update_jpa2amount", 0)
                    } else {
                        this.$store.commit("mou/update_jpa2amount", val)
                        if (val != 0) {
                            this.$store.commit("mou/update_jpa2", '')
                        }
                    }
                }

            },
            xjpa3amount: {
                get() {
                    return this.$store.state.mou.jpa3amount
                },
                set(val) {
                    if (val == '') {
                        this.$store.commit("mou/update_jpa3amount", 0)
                    } else {
                        this.$store.commit("mou/update_jpa3amount", val)
                        if (val != 0) {
                            this.$store.commit("mou/update_jpa3", '')
                        }
                    }
                }

            },
            xjpa4amount: {
                get() {
                    return this.$store.state.mou.jpa4amount
                },
                set(val) {
                    if (val == '') {
                        this.$store.commit("mou/update_jpa4amount", 0)
                    } else {
                        this.$store.commit("mou/update_jpa4amount", val)
                        if (val != 0) {
                            this.$store.commit("mou/update_jpa4", '')
                        }
                    }
                }

            },
            xbranchs() {
                return this.$store.state.mou.branchs
            },
            xbranch: {
                get() {
                    return this.$store.state.mou.branch
                },
                set(val) {
                    this.$store.commit("mou/update_branch", val)
                }

            },
            xmoutypes() {
                return this.$store.state.mou.moutypes
            },
            xmoutype: {
                get() {
                    return this.$store.state.mou.moutype
                },
                set(val) {
                    this.$store.commit("mou/update_moutype", val)
                }

            },
            xagingtypes() {
                return this.$store.state.mou.agingtypes
            },
            xagingtype: {
                get() {
                    return this.$store.state.mou.agingtype
                },
                set(val) {
                    this.$store.commit("mou/update_agingtype", val)
                }

            },
            xstatuss() {
                return this.$store.state.mou.statuss
            },
            dialogstatusorder() {
                return this.$store.state.mou.dialog_status_order
            },
            dialogviewrelease() {
                return this.$store.state.mou.dialog_form_viewrelease
            }
        },
        methods: {
            updateDialogFormMou() {
                this.$store.commit("mou/update_dialog_form_mou", false)
            },
            updateDialogStatusOrder() {
                this.$store.commit("mou/update_dialog_status_order", false)
            },
            close_alert_verif() {
                this.$store.commit("mou/update_dialog_alert_verif", false)
            },
            setStatusOrder(val) {
                this.$store.commit("mou/update_mous", {})
                this.$store.commit("mou/update_dialog_status_order", true)
                this.$store.commit("mou/update_statuss", val.statuss)
            },
            doPriceList(val) {
                console.log(location)
                var id = val.id
                location.replace("/one-ui/agreement/one-md-price-copy-jpa-v5/" + "?id=" + id)
            },
            doPrice() {
                console.log(location)
                var id = this.xid
                location.replace("/one-ui/agreement/one-md-price-copy-jpa-v5/" + "?id=" + id)
            },
            doPrint() {
                console.log('doprint')
                this.printwidth = 1028
                this.printtitle = ""
                let user = one_user()
                var id = this.xid
                var d = new Date();
                var n = d.getTime()
                var rptname = 'price_mou'
                var formatrpt = this.formatreport

                this.urlprint = "/birt/run?__report=report/one/rekap/" + rptname + ".rptdesign&__format=" +
                    formatrpt + "&PID=" + id + "&username=" + user.M_UserUsername + "&tm=" + n

                this.openprint = true
            },
            closePrint() {
                this.openprint = false
            },
            doPrintVerify(val) {
                console.log('doprint')
                this.printwidthverify = 1028
                this.printtitleverify = ""
                let user = one_user()
                var id = val.id
                var d = new Date();
                var n = d.getTime()
                var rptname = 'price_mou'
                var formatrpt = this.formatreport

                this.urlprintverify = "/birt/run?__report=report/one/rekap/" + rptname + ".rptdesign&__format=" +
                    formatrpt + "&PID=" + id + "&username=" + user.M_UserUsername + "&tm=" + n

                this.openprintverify = true
            },
            doPrintVerifyExcell(val) {
                console.log('doprint')
                this.printwidthverify = 1028
                this.printtitleverify = ""
                let user = one_user()
                var id = val.id
                var d = new Date();
                var n = d.getTime()
                var rptname = 'price_mou'
                var formatrpt = 'xls'

                this.urlprintverify = "/birt/run?__report=report/one/rekap/" + rptname + ".rptdesign&__format=" +
                    formatrpt + "&PID=" + id + "&username=" + user.M_UserUsername + "&tm=" + n

                this.openprintverify = true
            },
            closePrintVerify() {
                this.openprintverify = false
            },
            openFormMou(val) {
                this.xid = val
                this.name = ''
                this.number = ''
                this.refnumber = ''
                this.xstartdate = moment(new Date()).format('DD-MM-YYYY')
                this.xenddate = moment(new Date()).format('DD-MM-YYYY')
                this.isbill = false
                this.xpicname = ''
                this.xpichp = ''
                this.xfincname = ''
                this.xfinchp = ''
                this.isdefault = ''
                this.isfavorite = ''
                this.isjpanetto = ''
                this.ismcu = ''
                this.isonline = ''
                this.isaging = ''
                this.isemail = ''
                this.mindp = ''
                this.agingnote = 0
                this.xnote = ''
                this.mouemail = ''
                this.mouemailpic = ''
                this.mouemailfinc = ''
                this.jpa1Name = ''
                this.jpa2Name = ''
                this.jpa3Name = ''
                this.jpa4Name = ''
                this.jpa1Percent = ''
                this.jpa2Percent = ''
                this.jpa3Percent = ''
                this.jpa4Percent = ''
                this.xjpa1amount = 0
                this.xjpa2amount = 0
                this.xjpa3amount = 0
                this.xjpa4amount = 0
                this.$store.commit("mou/update_moutype", {})
                this.$store.commit("mou/update_agingtype", {})
                this.$store.commit("mou/update_omzettype", {})
                this.$store.commit("mou/update_base", {})
                this.$store.commit("mou/update_billtype", {})
                this.$store.commit("mou/update_branch", {})
                this.$store.commit("mou/update_jpa1", {})
                this.$store.commit("mou/update_jpa2", {})
                this.$store.commit("mou/update_jpa3", {})
                this.$store.commit("mou/update_jpa4", {})
                this.$store.commit("mou/update_dialog_form_mou", true)
            },
            editFormMou(val) {
                //  this.$store.commit("mou/update_error_name", false)
                this.xid = val.id
                this.name = val.name
                this.number = val.number
                this.refnumber = val.refnumber
                this.xstartdate = val.startdate
                this.xenddate = val.enddate
                this.xpicname = val.picname
                this.xpichp = val.pichp
                this.xfincname = val.fincname
                this.xfinchp = val.finchp
                this.isbill = val.isbill === 'N' ? false : true
                this.isdefault = val.isdefault === 'N' ? false : true
                this.isfavorit = val.isfavorit === 'N' ? false : true
                this.isjpanetto = val.isjpanetto === 'N' ? false : true
                this.ismcu = val.ismcu === 'N' ? false : true
                this.isonline = val.isonline === 'N' ? false : true
                this.isaging = val.isaging === 'N' ? false : true
                this.isemail = val.isemail === 'N' ? false : true
                this.mindp = val.mindp
                this.agingnote = val.agingday
                this.xnote = val.xnote
                this.mouemail = val.mouemail
                this.mouemailpic = val.mouemailpic
                this.mouemailfinc = val.mouemailfinc
                this.jpa1Name = val.M_MouJpa1Name
                this.jpa2Name = val.M_MouJpa2Name
                this.jpa3Name = val.M_MouJpa3Name
                this.jpa4Name = val.M_MouJpa4Name
                this.jpa1Percent = val.M_MouJpa1Percent
                this.jpa2Percent = val.M_MouJpa2Percent
                this.jpa3Percent = val.M_MouJpa3Percent
                this.jpa4Percent = val.M_MouJpa4Percent
                var bases = this.$store.state.mou.bases
                var idx_base = _.findIndex(bases, function (o) {
                    return o.baseid == val.baseid
                })
                var base = bases[idx_base]
                this.$store.commit("mou/update_base", base)

                var omzettypes = this.$store.state.mou.omzettypes
                var idx_omzettype = _.findIndex(omzettypes, function (o) {
                    return o.M_OmzetTypeID == val.M_OmzetTypeID
                })
                var omzettype = omzettypes[idx_omzettype]
                this.$store.commit("mou/update_omzettype", omzettype)

                var billtypes = this.$store.state.mou.billtypes
                var idx_billtype = _.findIndex(billtypes, function (o) {
                    return o.M_BillTypeID == val.M_BillTypeID
                })
                var billtype = billtypes[idx_billtype]
                this.$store.commit("mou/update_billtype", billtype)

                var branchs = this.$store.state.mou.branchs
                var idx_branch = _.findIndex(branchs, function (o) {
                    return o.M_BranchID == val.M_BranchID
                })
                var branch = branchs[idx_branch]
                this.$store.commit("mou/update_branch", branch)

                var moutypes = this.$store.state.mou.moutypes
                var idx_moutype = _.findIndex(moutypes, function (o) {
                    return o.M_MouTypeID == val.M_MouTypeID
                })
                var moutype = moutypes[idx_moutype]
                this.$store.commit("mou/update_moutype", moutype)

                var agingtypes = this.$store.state.mou.agingtypes
                var idx_agingtype = _.findIndex(agingtypes, function (o) {
                    return o.M_AgingTypeID == val.M_AgingTypeID
                })
                var agingtype = agingtypes[idx_agingtype]
                this.$store.commit("mou/update_agingtype", agingtype)

                this.xjpa1amount = val.M_MouJpa1Amount
                this.xjpa2amount = val.M_MouJpa2Amount
                this.xjpa3amount = val.M_MouJpa3Amount
                this.xjpa4amount = val.M_MouJpa4Amount

                var jpa1s = this.$store.state.mou.jpa1s
                var idx_jpa1 = _.findIndex(jpa1s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa1Nat_JpaID
                })
                var jpa1 = jpa1s[idx_jpa1]
                this.$store.commit("mou/update_jpa1", jpa1)

                var jpa2s = this.$store.state.mou.jpa2s
                var idx_jpa2 = _.findIndex(jpa2s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa2Nat_JpaID
                })
                var jpa2 = jpa2s[idx_jpa2]
                this.$store.commit("mou/update_jpa2", jpa2)

                var jpa3s = this.$store.state.mou.jpa3s
                var idx_jpa3 = _.findIndex(jpa3s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa3Nat_JpaID
                })
                var jpa3 = jpa3s[idx_jpa3]
                this.$store.commit("mou/update_jpa3", jpa3)

                var jpa4s = this.$store.state.mou.jpa4s
                var idx_jpa4 = _.findIndex(jpa4s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa4Nat_JpaID
                })
                var jpa4 = jpa4s[idx_jpa4]
                this.$store.commit("mou/update_jpa4", jpa4)
                this.$store.commit("mou/update_dialog_form_mou", true)
            },
            editFormMouRelease(val) {
                this.dialogeditafterreleasealertmou = true
                this.xid = val.id
                this.name = val.name
                this.number = val.number
                this.refnumber = val.refnumber
                this.xstartdate = val.startdate
                this.xenddate = val.enddate
                this.xpicname = val.picname
                this.xpichp = val.pichp
                this.xfincname = val.fincname
                this.xfinchp = val.finchp
                this.isbill = val.isbill === 'N' ? false : true
                this.isdefault = val.isdefault === 'N' ? false : true
                this.isfavorit = val.isfavorit === 'N' ? false : true
                this.isjpanetto = val.isjpanetto === 'N' ? false : true
                this.ismcu = val.ismcu === 'N' ? false : true
                this.isonline = val.isonline === 'N' ? false : true
                this.isaging = val.isaging === 'N' ? false : true
                this.isemail = val.isemail === 'N' ? false : true
                this.mindp = val.mindp
                this.agingnote = val.agingday
                this.xnote = val.xnote
                this.mouemail = val.mouemail
                this.mouemailpic = val.mouemailpic
                this.mouemailfinc = val.mouemailfinc
                this.jpa1Name = val.M_MouJpa1Name
                this.jpa2Name = val.M_MouJpa2Name
                this.jpa3Name = val.M_MouJpa3Name
                this.jpa4Name = val.M_MouJpa4Name
                this.jpa1Percent = val.M_MouJpa1Percent
                this.jpa2Percent = val.M_MouJpa2Percent
                this.jpa3Percent = val.M_MouJpa3Percent
                this.jpa4Percent = val.M_MouJpa4Percent
                var bases = this.$store.state.mou.bases
                var idx_base = _.findIndex(bases, function (o) {
                    return o.baseid == val.baseid
                })
                var base = bases[idx_base]
                this.$store.commit("mou/update_base", base)

                var omzettypes = this.$store.state.mou.omzettypes
                var idx_omzettype = _.findIndex(omzettypes, function (o) {
                    return o.M_OmzetTypeID == val.M_OmzetTypeID
                })
                var omzettype = omzettypes[idx_omzettype]
                this.$store.commit("mou/update_omzettype", omzettype)

                var billtypes = this.$store.state.mou.billtypes
                var idx_billtype = _.findIndex(billtypes, function (o) {
                    return o.M_BillTypeID == val.M_BillTypeID
                })
                var billtype = billtypes[idx_billtype]
                this.$store.commit("mou/update_billtype", billtype)

                var branchs = this.$store.state.mou.branchs
                var idx_branch = _.findIndex(branchs, function (o) {
                    return o.M_BranchID == val.M_BranchID
                })
                var branch = branchs[idx_branch]
                this.$store.commit("mou/update_branch", branch)

                var moutypes = this.$store.state.mou.moutypes
                var idx_moutype = _.findIndex(moutypes, function (o) {
                    return o.M_MouTypeID == val.M_MouTypeID
                })
                var moutype = moutypes[idx_moutype]
                this.$store.commit("mou/update_moutype", moutype)

                var agingtypes = this.$store.state.mou.agingtypes
                var idx_agingtype = _.findIndex(agingtypes, function (o) {
                    return o.M_AgingTypeID == val.M_AgingTypeID
                })
                var agingtype = agingtypes[idx_agingtype]
                this.$store.commit("mou/update_agingtype", agingtype)
                this.xjpa1amount = val.M_MouJpa1Amount
                this.xjpa2amount = val.M_MouJpa2Amount
                this.xjpa3amount = val.M_MouJpa3Amount
                this.xjpa4amount = val.M_MouJpa4Amount

                var jpa1s = this.$store.state.mou.jpa1s
                var idx_jpa1 = _.findIndex(jpa1s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa1Nat_JpaID
                })
                var jpa1 = jpa1s[idx_jpa1]
                this.$store.commit("mou/update_jpa1", jpa1)

                var jpa2s = this.$store.state.mou.jpa2s
                var idx_jpa2 = _.findIndex(jpa2s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa2Nat_JpaID
                })
                var jpa2 = jpa2s[idx_jpa2]
                this.$store.commit("mou/update_jpa2", jpa2)

                var jpa3s = this.$store.state.mou.jpa3s
                var idx_jpa3 = _.findIndex(jpa3s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa3Nat_JpaID
                })
                var jpa3 = jpa3s[idx_jpa3]
                this.$store.commit("mou/update_jpa3", jpa3)

                var jpa4s = this.$store.state.mou.jpa4s
                var idx_jpa4 = _.findIndex(jpa4s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa4Nat_JpaID
                })
                var jpa4 = jpa4s[idx_jpa4]
                this.$store.commit("mou/update_jpa4", jpa4)
            },
            closeEditAfterReleadeAlertMou() {
                this.$store.dispatch("mou/saveafterrelease", {
                    xid: this.xid,
                    companyid: this.$store.state.company.selected_company.id,
                    companyname: this.$store.state.company.selected_company.name,
                    name: this.name,
                    picname: this.xpicname,
                    pichp: this.xpichp,
                    fincname: this.xfincname,
                    finchp: this.xfinchp,
                    isbill: this.isbill === true ? "Y" : "N",
                    isdefault: this.isdefault === true ? "Y" : "N",
                    ismcu: this.ismcu === true ? "Y" : "N",
                    isonline: this.isonline === true ? "Y" : "N",
                    isemail: this.isemail === true ? "Y" : "N",
                    mindp: this.mindp ? this.mindp : 0,
                    mouemail: this.mouemail ? this.mouemail : "",
                    mouemailpic: this.mouemailpic ? this.mouemailpic : "",
                    mouemailfinc: this.mouemailfinc ? this.mouemailfinc : "",
                    note: this.xnote,
                    billtype: this.xbilltype ? this.xbilltype.M_BillTypeID : 0,
                    branch: this.xbranch ? this.xbranch.M_BranchID : 0,
                    isaging: this.isaging === true ? "Y" : "N",
                    agingnote: this.agingnote ? this.agingnote : 0,
                    search: this.xsearch
                })
                this.dialogeditafterreleasealertmou = false

            },
            checkError(value) {
                var errors = this.$store.state.mou.errors
                if (errors.includes(value)) {
                    return true
                } else {
                    return false
                }
            },
            saveFormMou() {
                this.$store.commit("mou/update_errors", [])
                var errors = this.$store.state.mou.errors
                if (this.name === '') {
                    errors.push("requirename")
                }
                if (_.isEmpty(this.xbase)) {
                    errors.push("requirebase")
                }
                if (_.isEmpty(this.xomzettype)) {
                    errors.push("requireomzet")
                }
                if (_.isEmpty(this.xmoutype)) {
                    errors.push("requiremoutypr")
                }
                if (_.isEmpty(this.xagingtype)) {
                    errors.push("requireagingtype")
                }
                if (this.isemail === true && this.mouemail === '') {
                    errors.push("requireemail")
                }
                if (this.isaging === true && this.agingnote == 0) {
                    errors.push("requireaging")
                }
                if (this.mouemail.match(';')) {
                    errors.push("requireemailtext")
                }
                if (this.mouemailpic.match(';')) {
                    errors.push("requireemailtextpic")
                }
                if (this.mouemailfinc.match(';')) {
                    errors.push("requireemailtextfinc")
                }
                if (this.xnote.match(';')) {
                    errors.push("requirenote")
                }
                var dnow = moment(new Date()).format('DD-MM-YYYY')
                if (moment(this.xenddate, 'DDMMYYYY').format('YYYY-MM-DD') < moment(this.xstartdate, 'DDMMYYYY').format(
                        'YYYY-MM-DD')) {
                    errors.push("requireenddate")
                }
                if (errors.length === 0) {
                    this.$store.dispatch("mou/save", {
                        xid: this.xid,
                        companyid: this.$store.state.company.selected_company.id,
                        companyname: this.$store.state.company.selected_company.name,
                        name: this.name,
                        startdate: moment(this.xstartdate, 'DDMMYYYY').format('DD-MM-YYYY'),
                        enddate: moment(this.xenddate, 'DDMMYYYY').format('DD-MM-YYYY'),
                        picname: this.xpicname,
                        pichp: this.xpichp,
                        fincname: this.xfincname,
                        finchp: this.xfinchp,
                        isbill: this.isbill === true ? "Y" : "N",
                        isdefault: this.isdefault === true ? "Y" : "N",
                        isfavorit: this.isfavorit === true ? "Y" : "N",
                        isjpanetto: this.isjpanetto === true ? "Y" : "N",
                        ismcu: this.ismcu === true ? "Y" : "N",
                        isonline: this.isonline === true ? "Y" : "N",
                        isaging: this.isaging === true ? "Y" : "N",
                        isemail: this.isemail === true ? "Y" : "N",
                        number: this.number,
                        refnumber: this.refnumber,
                        mindp: this.mindp ? this.mindp : 0,
                        agingnote: this.agingnote ? this.agingnote : 0,
                        xnote: this.xnote,
                        mouemail: this.mouemail ? this.mouemail : "",
                        mouemailpic: this.mouemailpic ? this.mouemailpic : "",
                        mouemailfinc: this.mouemailfinc ? this.mouemailfinc : "",
                        base: this.xbase.baseid,
                        omzettype: this.xomzettype.M_OmzetTypeID,
                        moutype: this.xmoutype.M_MouTypeID,
                        agingtype: this.xagingtype.M_AgingTypeID,
                        jpa1Name: this.jpa1Name,
                        jpa2Name: this.jpa2Name,
                        jpa3Name: this.jpa3Name,
                        jpa4Name: this.jpa4Name,
                        jpa1Percent: this.jpa1Percent ? this.jpa1Percent : 0,
                        jpa2Percent: this.jpa2Percent ? this.jpa2Percent : 0,
                        jpa3Percent: this.jpa3Percent ? this.jpa3Percent : 0,
                        jpa4Percent: this.jpa4Percent ? this.jpa4Percent : 0,
                        billtype: this.xbilltype ? this.xbilltype.M_BillTypeID : 0,
                        branch: this.xbranch ? this.xbranch.M_BranchID : 0,
                        search: this.xsearch,
                        natjpa1: this.xjpa1 ? this.xjpa1.Nat_JpaID : 0,
                        natjpa2: this.xjpa2 ? this.xjpa2.Nat_JpaID : 0,
                        natjpa3: this.xjpa3 ? this.xjpa3.Nat_JpaID : 0,
                        natjpa4: this.xjpa4 ? this.xjpa4.Nat_JpaID : 0,
                        jpa1amount: this.xjpa1amount ? this.xjpa1amount : 0,
                        jpa2amount: this.xjpa2amount ? this.xjpa2amount : 0,
                        jpa3amount: this.xjpa3amount ? this.xjpa3amount : 0,
                        jpa4amount: this.xjpa4amount ? this.xjpa4amount : 0
                    })
                }
            },
            set_date2(x) {
                this.startdate = x.new_date
            },
            set_date3(x) {
                this.enddate = x.new_date
            },
            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')}`
            },
            updateAlert_success(val) {
                this.$store.commit("company/update_alert_success", val)
            },
            deleteMou(data) {
                this.xid = data.id

                this.msgalertmou = "Yakin, mau hapus agreement ini?"
                this.dialogdeletealertmou = true
            },
            closeDeleteAlertMou() {
                this.$store.dispatch("mou/delete", {
                    xid: this.xid,
                    companyid: this.$store.state.company.selected_company.id,
                    companyname: this.$store.state.company.selected_company.name,
                    name: this.name,
                    search: this.xsearch
                })
                this.dialogdeletealertmou = false
            },
            doViewRelease(val) {
                this.name = val.name
                this.number = val.number
                this.$store.dispatch("mou/lookupreleasebyid", {
                    id: val.id
                })
                this.$store.commit("mou/update_dialog_form_viewrelease", true)
            },
            closeViewRelease() {
                this.$store.commit("mou/update_dialog_form_viewrelease", false)
            },
            verifyMou(val) {
                // this.xid = data.id

                //  this.msgalertmou = "Apakah Anda yakin akan mem-verifikasi agreement ini?"
                this.dialogverifyalertmou = true
                this.xid = val.id
                this.countprice = val.countprice
                this.name = val.name
                this.number = val.number
                this.refnumber = val.refnumber
                this.xstartdate = val.startdate
                this.xenddate = val.enddate
                this.xpicname = val.picname
                this.xpichp = val.pichp
                this.xfincname = val.fincname
                this.xfinchp = val.finchp
                this.isbill = val.isbill === 'N' ? false : true
                this.isdefault = val.isdefault === 'N' ? false : true
                this.isfavorit = val.isfavorit === 'N' ? false : true
                this.isjpanetto = val.isjpanetto === 'N' ? false : true
                this.ismcu = val.ismcu === 'N' ? false : true
                this.isonline = val.isonline === 'N' ? false : true
                this.isaging = val.isaging === 'N' ? false : true
                this.isemail = val.isemail === 'N' ? false : true
                this.mindp = val.mindp
                this.agingnote = val.agingday
                this.xnote = val.xnote
                this.mouemail = val.mouemail
                this.mouemailpic = val.mouemailpic
                this.mouemailfinc = val.mouemailfinc
                this.jpa1Name = val.M_MouJpa1Name
                this.jpa2Name = val.M_MouJpa2Name
                this.jpa3Name = val.M_MouJpa3Name
                this.jpa4Name = val.M_MouJpa4Name
                this.jpa1Percent = val.M_MouJpa1Percent
                this.jpa2Percent = val.M_MouJpa2Percent
                this.jpa3Percent = val.M_MouJpa3Percent
                this.jpa4Percent = val.M_MouJpa4Percent
                var bases = this.$store.state.mou.bases
                var idx_base = _.findIndex(bases, function (o) {
                    return o.baseid == val.baseid
                })
                var base = bases[idx_base]
                this.$store.commit("mou/update_base", base)

                var omzettypes = this.$store.state.mou.omzettypes
                var idx_omzettype = _.findIndex(omzettypes, function (o) {
                    return o.M_OmzetTypeID == val.M_OmzetTypeID
                })
                var omzettype = omzettypes[idx_omzettype]
                this.$store.commit("mou/update_omzettype", omzettype)

                var billtypes = this.$store.state.mou.billtypes
                var idx_billtype = _.findIndex(billtypes, function (o) {
                    return o.M_BillTypeID == val.M_BillTypeID
                })
                var billtype = billtypes[idx_billtype]
                this.$store.commit("mou/update_billtype", billtype)

                var branchs = this.$store.state.mou.branchs
                var idx_branch = _.findIndex(branchs, function (o) {
                    return o.M_BranchID == val.M_BranchID
                })
                var branch = branchs[idx_branch]
                this.$store.commit("mou/update_branch", branch)

                var moutypes = this.$store.state.mou.moutypes
                var idx_moutype = _.findIndex(moutypes, function (o) {
                    return o.M_MouTypeID == val.M_MouTypeID
                })
                var moutype = moutypes[idx_moutype]
                this.$store.commit("mou/update_moutype", moutype)

                var agingtypes = this.$store.state.mou.agingtypes
                var idx_agingtype = _.findIndex(agingtypes, function (o) {
                    return o.M_AgingTypeID == val.M_AgingTypeID
                })
                var agingtype = agingtypes[idx_agingtype]
                this.$store.commit("mou/update_agingtype", agingtype)
                this.xjpa1amount = val.M_MouJpa1Amount
                this.xjpa2amount = val.M_MouJpa2Amount
                this.xjpa3amount = val.M_MouJpa3Amount
                this.xjpa4amount = val.M_MouJpa4Amount

                var jpa1s = this.$store.state.mou.jpa1s
                var idx_jpa1 = _.findIndex(jpa1s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa1Nat_JpaID
                })
                var jpa1 = jpa1s[idx_jpa1]
                this.$store.commit("mou/update_jpa1", jpa1)

                var jpa2s = this.$store.state.mou.jpa2s
                var idx_jpa2 = _.findIndex(jpa2s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa2Nat_JpaID
                })
                var jpa2 = jpa2s[idx_jpa2]
                this.$store.commit("mou/update_jpa2", jpa2)

                var jpa3s = this.$store.state.mou.jpa3s
                var idx_jpa3 = _.findIndex(jpa3s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa3Nat_JpaID
                })
                var jpa3 = jpa3s[idx_jpa3]
                this.$store.commit("mou/update_jpa3", jpa3)

                var jpa4s = this.$store.state.mou.jpa4s
                var idx_jpa4 = _.findIndex(jpa4s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa4Nat_JpaID
                })
                var jpa4 = jpa4s[idx_jpa4]
                this.$store.commit("mou/update_jpa4", jpa4)
            },
            closeVerifyAlertMou() {
                if (this.countprice == 0) {
                    this.msgalertmou = "Buat harga dulu sebelum verifikasi !"
                    this.alertverify = true
                } else {
                    this.$store.dispatch("mou/verify", {
                        xid: this.xid,
                        companyid: this.$store.state.company.selected_company.id,
                        companyname: this.$store.state.company.selected_company.name,
                        name: this.name,
                        search: this.xsearch
                    })
                    this.dialogverifyalertmou = false
                }

            },
            releaseMou(val) {
                //this.xid = data.id
                //this.msgalertmou = "Apakah Anda yakin akan merilis agreement ini?"
                this.dialogreleasealertmou = true
                this.xid = val.id
                this.countprice = val.countprice
                this.name = val.name
                this.number = val.number
                this.refnumber = val.refnumber
                this.xstartdate = val.startdate
                this.xenddate = val.enddate
                this.xpicname = val.picname
                this.xpichp = val.pichp
                this.xfincname = val.fincname
                this.xfinchp = val.finchp
                this.isbill = val.isbill === 'N' ? false : true
                this.isdefault = val.isdefault === 'N' ? false : true
                this.isfavorit = val.isfavorit === 'N' ? false : true
                this.isjpanetto = val.isjpanetto === 'N' ? false : true
                this.ismcu = val.ismcu === 'N' ? false : true
                this.isonline = val.isonline === 'N' ? false : true
                this.isaging = val.isaging === 'N' ? false : true
                this.isemail = val.isemail === 'N' ? false : true
                this.mindp = val.mindp
                this.agingnote = val.agingday
                this.xnote = val.xnote
                this.mouemail = val.mouemail
                this.mouemailpic = val.mouemailpic
                this.mouemailfinc = val.mouemailfinc
                this.jpa1Name = val.M_MouJpa1Name
                this.jpa2Name = val.M_MouJpa2Name
                this.jpa3Name = val.M_MouJpa3Name
                this.jpa4Name = val.M_MouJpa4Name
                this.jpa1Percent = val.M_MouJpa1Percent
                this.jpa2Percent = val.M_MouJpa2Percent
                this.jpa3Percent = val.M_MouJpa3Percent
                this.jpa4Percent = val.M_MouJpa4Percent
                var bases = this.$store.state.mou.bases
                var idx_base = _.findIndex(bases, function (o) {
                    return o.baseid == val.baseid
                })
                var base = bases[idx_base]
                this.$store.commit("mou/update_base", base)

                var omzettypes = this.$store.state.mou.omzettypes
                var idx_omzettype = _.findIndex(omzettypes, function (o) {
                    return o.M_OmzetTypeID == val.M_OmzetTypeID
                })
                var omzettype = omzettypes[idx_omzettype]
                this.$store.commit("mou/update_omzettype", omzettype)

                var billtypes = this.$store.state.mou.billtypes
                var idx_billtype = _.findIndex(billtypes, function (o) {
                    return o.M_BillTypeID == val.M_BillTypeID
                })
                var billtype = billtypes[idx_billtype]
                this.$store.commit("mou/update_billtype", billtype)

                var branchs = this.$store.state.mou.branchs
                var idx_branch = _.findIndex(branchs, function (o) {
                    return o.M_BranchID == val.M_BranchID
                })
                var branch = branchs[idx_branch]
                this.$store.commit("mou/update_branch", branch)

                var moutypes = this.$store.state.mou.moutypes
                var idx_moutype = _.findIndex(moutypes, function (o) {
                    return o.M_MouTypeID == val.M_MouTypeID
                })
                var moutype = moutypes[idx_moutype]
                this.$store.commit("mou/update_moutype", moutype)

                var agingtypes = this.$store.state.mou.agingtypes
                var idx_agingtype = _.findIndex(agingtypes, function (o) {
                    return o.M_AgingTypeID == val.M_AgingTypeID
                })
                var agingtype = agingtypes[idx_agingtype]
                this.$store.commit("mou/update_agingtype", agingtype)
                this.xjpa1amount = val.M_MouJpa1Amount
                this.xjpa2amount = val.M_MouJpa2Amount
                this.xjpa3amount = val.M_MouJpa3Amount
                this.xjpa4amount = val.M_MouJpa4Amount

                var jpa1s = this.$store.state.mou.jpa1s
                var idx_jpa1 = _.findIndex(jpa1s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa1Nat_JpaID
                })
                var jpa1 = jpa1s[idx_jpa1]
                this.$store.commit("mou/update_jpa1", jpa1)

                var jpa2s = this.$store.state.mou.jpa2s
                var idx_jpa2 = _.findIndex(jpa2s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa2Nat_JpaID
                })
                var jpa2 = jpa2s[idx_jpa2]
                this.$store.commit("mou/update_jpa2", jpa2)

                var jpa3s = this.$store.state.mou.jpa3s
                var idx_jpa3 = _.findIndex(jpa3s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa3Nat_JpaID
                })
                var jpa3 = jpa3s[idx_jpa3]
                this.$store.commit("mou/update_jpa3", jpa3)

                var jpa4s = this.$store.state.mou.jpa4s
                var idx_jpa4 = _.findIndex(jpa4s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa4Nat_JpaID
                })
                var jpa4 = jpa4s[idx_jpa4]
                this.$store.commit("mou/update_jpa4", jpa4)
            },
            closeReleaseAlertMou() {
                this.$store.dispatch("mou/release", {
                    xid: this.xid,
                    companyid: this.$store.state.company.selected_company.id,
                    companyname: this.$store.state.company.selected_company.name,
                    name: this.name,
                    search: this.xsearch
                })
                this.dialogreleasealertmou = false
            },
            unreleaseMou(val) {
                // this.xid = data.id

                //  this.msgalertmou = "Apakah Anda yakin akan membatalkan rilis agreement ini?"
                this.dialogunreleasealertmou = true
                this.xid = val.id
                this.countprice = val.countprice
                this.name = val.name
                this.number = val.number
                this.refnumber = val.refnumber
                this.xstartdate = val.startdate
                this.xenddate = val.enddate
                this.xpicname = val.picname
                this.xpichp = val.pichp
                this.xfincname = val.fincname
                this.xfinchp = val.finchp
                this.isbill = val.isbill === 'N' ? false : true
                this.isdefault = val.isdefault === 'N' ? false : true
                this.isfavorit = val.isfavorit === 'N' ? false : true
                this.isjpanetto = val.isjpanetto === 'N' ? false : true
                this.ismcu = val.ismcu === 'N' ? false : true
                this.isonline = val.isonline === 'N' ? false : true
                this.isaging = val.isaging === 'N' ? false : true
                this.isemail = val.isemail === 'N' ? false : true
                this.mindp = val.mindp
                this.agingnote = val.agingday
                this.xnote = val.xnote
                this.mouemail = val.mouemail
                this.mouemailpic = val.mouemailpic
                this.mouemailfinc = val.mouemailfinc
                this.jpa1Name = val.M_MouJpa1Name
                this.jpa2Name = val.M_MouJpa2Name
                this.jpa3Name = val.M_MouJpa3Name
                this.jpa4Name = val.M_MouJpa4Name
                this.jpa1Percent = val.M_MouJpa1Percent
                this.jpa2Percent = val.M_MouJpa2Percent
                this.jpa3Percent = val.M_MouJpa3Percent
                this.jpa4Percent = val.M_MouJpa4Percent
                var bases = this.$store.state.mou.bases
                var idx_base = _.findIndex(bases, function (o) {
                    return o.baseid == val.baseid
                })
                var base = bases[idx_base]
                this.$store.commit("mou/update_base", base)

                var omzettypes = this.$store.state.mou.omzettypes
                var idx_omzettype = _.findIndex(omzettypes, function (o) {
                    return o.M_OmzetTypeID == val.M_OmzetTypeID
                })
                var omzettype = omzettypes[idx_omzettype]
                this.$store.commit("mou/update_omzettype", omzettype)

                var billtypes = this.$store.state.mou.billtypes
                var idx_billtype = _.findIndex(billtypes, function (o) {
                    return o.M_BillTypeID == val.M_BillTypeID
                })
                var billtype = billtypes[idx_billtype]
                this.$store.commit("mou/update_billtype", billtype)

                var branchs = this.$store.state.mou.branchs
                var idx_branch = _.findIndex(branchs, function (o) {
                    return o.M_BranchID == val.M_BranchID
                })
                var branch = branchs[idx_branch]
                this.$store.commit("mou/update_branch", branch)

                var moutypes = this.$store.state.mou.moutypes
                var idx_moutype = _.findIndex(moutypes, function (o) {
                    return o.M_MouTypeID == val.M_MouTypeID
                })
                var moutype = moutypes[idx_moutype]
                this.$store.commit("mou/update_moutype", moutype)

                var agingtypes = this.$store.state.mou.agingtypes
                var idx_agingtype = _.findIndex(agingtypes, function (o) {
                    return o.M_AgingTypeID == val.M_AgingTypeID
                })
                var agingtype = agingtypes[idx_agingtype]
                this.$store.commit("mou/update_agingtype", agingtype)
                this.xjpa1amount = val.M_MouJpa1Amount
                this.xjpa2amount = val.M_MouJpa2Amount
                this.xjpa3amount = val.M_MouJpa3Amount
                this.xjpa4amount = val.M_MouJpa4Amount

                var jpa1s = this.$store.state.mou.jpa1s
                var idx_jpa1 = _.findIndex(jpa1s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa1Nat_JpaID
                })
                var jpa1 = jpa1s[idx_jpa1]
                this.$store.commit("mou/update_jpa1", jpa1)

                var jpa2s = this.$store.state.mou.jpa2s
                var idx_jpa2 = _.findIndex(jpa2s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa2Nat_JpaID
                })
                var jpa2 = jpa2s[idx_jpa2]
                this.$store.commit("mou/update_jpa2", jpa2)

                var jpa3s = this.$store.state.mou.jpa3s
                var idx_jpa3 = _.findIndex(jpa3s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa3Nat_JpaID
                })
                var jpa3 = jpa3s[idx_jpa3]
                this.$store.commit("mou/update_jpa3", jpa3)

                var jpa4s = this.$store.state.mou.jpa4s
                var idx_jpa4 = _.findIndex(jpa4s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa4Nat_JpaID
                })
                var jpa4 = jpa4s[idx_jpa4]
                this.$store.commit("mou/update_jpa4", jpa4)
            },
            closeUnReleaseAlertMou() {
                this.$store.dispatch("mou/unrelease", {
                    xid: this.xid,
                    companyid: this.$store.state.company.selected_company.id,
                    companyname: this.$store.state.company.selected_company.name,
                    name: this.name,
                    search: this.xsearch
                })
                this.dialogunreleasealertmou = false
            },
            unverifyMou(val) {
                //  this.xid = data.id

                // this.msgalertmou = "Apakah Anda yakin akan membatalkan verifikasi agreement ini?"
                this.dialogunverifyalertmou = true
                this.xid = val.id
                this.countprice = val.countprice
                this.name = val.name
                this.number = val.number
                this.refnumber = val.refnumber
                this.xstartdate = val.startdate
                this.xenddate = val.enddate
                this.xpicname = val.picname
                this.xpichp = val.pichp
                this.xfincname = val.fincname
                this.xfinchp = val.finchp
                this.isbill = val.isbill === 'N' ? false : true
                this.isdefault = val.isdefault === 'N' ? false : true
                this.isfavorit = val.isfavorit === 'N' ? false : true
                this.isjpanetto = val.isjpanetto === 'N' ? false : true
                this.ismcu = val.ismcu === 'N' ? false : true
                this.isonline = val.isonline === 'N' ? false : true
                this.isaging = val.isaging === 'N' ? false : true
                this.isemail = val.isemail === 'N' ? false : true
                this.mindp = val.mindp
                this.agingnote = val.agingday
                this.xnote = val.xnote
                this.mouemail = val.mouemail
                this.mouemailpic = val.mouemailpic
                this.mouemailfinc = val.mouemailfinc
                this.jpa1Name = val.M_MouJpa1Name
                this.jpa2Name = val.M_MouJpa2Name
                this.jpa3Name = val.M_MouJpa3Name
                this.jpa4Name = val.M_MouJpa4Name
                this.jpa1Percent = val.M_MouJpa1Percent
                this.jpa2Percent = val.M_MouJpa2Percent
                this.jpa3Percent = val.M_MouJpa3Percent
                this.jpa4Percent = val.M_MouJpa4Percent
                var bases = this.$store.state.mou.bases
                var idx_base = _.findIndex(bases, function (o) {
                    return o.baseid == val.baseid
                })
                var base = bases[idx_base]
                this.$store.commit("mou/update_base", base)

                var omzettypes = this.$store.state.mou.omzettypes
                var idx_omzettype = _.findIndex(omzettypes, function (o) {
                    return o.M_OmzetTypeID == val.M_OmzetTypeID
                })
                var omzettype = omzettypes[idx_omzettype]
                this.$store.commit("mou/update_omzettype", omzettype)

                var billtypes = this.$store.state.mou.billtypes
                var idx_billtype = _.findIndex(billtypes, function (o) {
                    return o.M_BillTypeID == val.M_BillTypeID
                })
                var billtype = billtypes[idx_billtype]
                this.$store.commit("mou/update_billtype", billtype)

                var branchs = this.$store.state.mou.branchs
                var idx_branch = _.findIndex(branchs, function (o) {
                    return o.M_BranchID == val.M_BranchID
                })
                var branch = branchs[idx_branch]
                this.$store.commit("mou/update_branch", branch)

                var moutypes = this.$store.state.mou.moutypes
                var idx_moutype = _.findIndex(moutypes, function (o) {
                    return o.M_MouTypeID == val.M_MouTypeID
                })
                var moutype = moutypes[idx_moutype]
                this.$store.commit("mou/update_moutype", moutype)

                var agingtypes = this.$store.state.mou.agingtypes
                var idx_agingtype = _.findIndex(agingtypes, function (o) {
                    return o.M_AgingTypeID == val.M_AgingTypeID
                })
                var agingtype = agingtypes[idx_agingtype]
                this.$store.commit("mou/update_agingtype", agingtype)
                this.xjpa1amount = val.M_MouJpa1Amount
                this.xjpa2amount = val.M_MouJpa2Amount
                this.xjpa3amount = val.M_MouJpa3Amount
                this.xjpa4amount = val.M_MouJpa4Amount

                var jpa1s = this.$store.state.mou.jpa1s
                var idx_jpa1 = _.findIndex(jpa1s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa1Nat_JpaID
                })
                var jpa1 = jpa1s[idx_jpa1]
                this.$store.commit("mou/update_jpa1", jpa1)

                var jpa2s = this.$store.state.mou.jpa2s
                var idx_jpa2 = _.findIndex(jpa2s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa2Nat_JpaID
                })
                var jpa2 = jpa2s[idx_jpa2]
                this.$store.commit("mou/update_jpa2", jpa2)

                var jpa3s = this.$store.state.mou.jpa3s
                var idx_jpa3 = _.findIndex(jpa3s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa3Nat_JpaID
                })
                var jpa3 = jpa3s[idx_jpa3]
                this.$store.commit("mou/update_jpa3", jpa3)

                var jpa4s = this.$store.state.mou.jpa4s
                var idx_jpa4 = _.findIndex(jpa4s, function (o) {
                    return o.Nat_JpaID == val.M_MouJpa4Nat_JpaID
                })
                var jpa4 = jpa4s[idx_jpa4]
                this.$store.commit("mou/update_jpa4", jpa4)
            },
            closeUnVerifyAlertMou() {
                this.$store.dispatch("mou/unverify", {
                    xid: this.xid,
                    companyid: this.$store.state.company.selected_company.id,
                    companyname: this.$store.state.company.selected_company.name,
                    name: this.name,
                    search: this.xsearch
                })
                this.dialogunverifyalertmou = false
            },
            thr_search: _.debounce(function () {
                this.$store.dispatch("mou/lookup", {
                    id: this.$store.state.company.selected_company.id,
                    search: this.xsearch
                })
            }, 1000)
        },
        watch: {
            xsearch(val, old) {
                if (val !== old && this.lookupstatus !== 1) {
                    console.log(val)
                    this.xsearch = val
                    this.thr_search()
                }
            }
        }
    }
</script>