825 lines
32 KiB
Vue
825 lines
32 KiB
Vue
<template>
|
|
<v-layout>
|
|
<v-dialog v-model="dialog_data_edit" width="500">
|
|
<v-card>
|
|
<v-card-title
|
|
class="headline grey lighten-2 pt-2 pb-2"
|
|
primary-title
|
|
>
|
|
Perhatian
|
|
</v-card-title>
|
|
<v-card-text class="pt-2 pb-2">
|
|
<span class="text-center pt-5">{{ text_not_edit }}</span>
|
|
</v-card-text>
|
|
<v-divider></v-divider>
|
|
|
|
<v-card-actions>
|
|
<v-spacer></v-spacer>
|
|
<v-btn
|
|
color="primary"
|
|
flat
|
|
@click="dialog_data_edit = false"
|
|
>
|
|
Tutup
|
|
</v-btn>
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
|
|
<!-- Alert dialog -->
|
|
<v-dialog v-model="dialogdeletealert" max-width="30%">
|
|
<v-card>
|
|
<v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
|
|
Peringatan !
|
|
</v-card-title>
|
|
<v-card-text class="pt-2 pb-2">
|
|
<v-layout row>
|
|
<v-flex xs12 d-flex>
|
|
<v-layout row>
|
|
<v-flex pb-1 xs12>
|
|
<v-layout row>
|
|
<v-flex pt-2 pr-2 xs12>
|
|
{{ msgalert }}
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card-text>
|
|
<v-divider></v-divider>
|
|
<v-card-actions>
|
|
<v-spacer></v-spacer>
|
|
<v-btn color="primary" flat @click="dialogdeletealert = false">
|
|
Tutup
|
|
</v-btn>
|
|
<v-btn color="primary" flat @click="deleteRow()">
|
|
Yakin lah
|
|
</v-btn>
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
<!-- End alert dialog -->
|
|
|
|
<!-- ERROR DIALOG -->
|
|
<v-dialog v-model="dialog_error" max-width="500px">
|
|
<v-card>
|
|
<v-card-title>
|
|
<span>ERROR !</span>
|
|
<v-spacer></v-spacer>
|
|
</v-card-title>
|
|
<v-divider></v-divider>
|
|
<div class="ma-3 red--text">{{ msgError }}</div>
|
|
<v-divider></v-divider>
|
|
<v-card-actions>
|
|
<v-spacer></v-spacer>
|
|
<v-btn color="primary" flat @click="dialog_error = false">Close</v-btn>
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
<!-- END ERROR DIALOG -->
|
|
<!-- Snackbar -->
|
|
<v-snackbar v-model="snackbar" :timeout="5000" :multi-line="false" :vertical="false" :top="true" :color="clr"
|
|
:value="snackbar">
|
|
{{ msgsnackbar }}
|
|
<v-btn flat @click="snackbar = false"> Tutup </v-btn>
|
|
</v-snackbar>
|
|
<!-- End Snackbar -->
|
|
<!-- Form Dialog -->
|
|
<v-dialog v-model="dialog_form" persistent width="50%">
|
|
<v-card>
|
|
<v-card-title>
|
|
<span class="title">Form Admin MCU</span>
|
|
</v-card-title>
|
|
<v-divider></v-divider>
|
|
<v-progress-linear v-if="loading_save" :indeterminate="true"></v-progress-linear>
|
|
<v-card-text class="pt-0 pb-0">
|
|
<v-layout row wrap>
|
|
<v-flex xs12>
|
|
<v-autocomplete label="Company*" :items="xcompany" v-model="vcompany"
|
|
:search-input.sync="search_item_company"
|
|
auto-select-first no-filter item-text="M_CompanyName" return-object
|
|
no-data-text="Pilih Nama Company" clearable
|
|
:error="company_error_message !== ''"
|
|
:error-messages="company_error_message"
|
|
@blur="companyValidation">
|
|
<template slot="item" slot-scope="{ item }">
|
|
<v-list-tile-content>
|
|
<v-list-tile-title v-text="item.M_CompanyName"></v-list-tile-title>
|
|
</v-list-tile-content>
|
|
</template>
|
|
</v-autocomplete>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card-text>
|
|
<!-- <v-card-text class="pt-0 pb-0">
|
|
<v-layout row wrap>
|
|
<v-flex xs12>
|
|
<v-text-field disabled label="Number* (automation)" required></v-text-field>
|
|
</v-flex xs12>
|
|
</v-layout>
|
|
</v-card-text> -->
|
|
<v-card-text class="pt-0 pb-0">
|
|
<v-layout row wrap>
|
|
<v-flex xs12>
|
|
<v-text-field v-model="vnationalNumber" label="National Number"
|
|
></v-text-field>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card-text>
|
|
<v-card-text class="pt-2 pb-0">
|
|
<v-layout row>
|
|
<v-flex xs12>
|
|
<v-menu v-model="menufilterdatestart" :close-on-content-click="false" :nudge-right="40" lazy
|
|
transition="scale-transition" offset-y full-width max-width="290px" min-width="290px">
|
|
<template v-slot:activator="{ on }">
|
|
<v-text-field class="mr-2" v-model="filterComputedDateFormattedStart" label="Start Date"
|
|
hide-details readonly v-on="on"
|
|
@blur="date = deFormatedDate(filterComputedDateFormattedStart)"></v-text-field>
|
|
</template>
|
|
<v-date-picker v-model="xdatestart" no-title @input="menufilterdatestart = false"></v-date-picker>
|
|
</v-menu>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card-text>
|
|
<v-card-text class="pt-2 pb-0">
|
|
<v-layout row>
|
|
<v-flex xs12>
|
|
<v-menu v-model="menufilterdateend" :close-on-content-click="false" :nudge-right="40" lazy
|
|
transition="scale-transition" offset-y full-width max-width="290px" min-width="290px">
|
|
<template v-slot:activator="{ on }">
|
|
<v-text-field class="mr-2" v-model="filterComputedDateFormattedEnd" label="End Date"
|
|
hide-details readonly v-on="on"
|
|
@blur="date = deFormatedDate(filterComputedDateFormattedEnd)"></v-text-field>
|
|
</template>
|
|
<v-date-picker v-model="xdateend" no-title @input="menufilterdateend = false"></v-date-picker>
|
|
</v-menu>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card-text>
|
|
<v-card-text class="pt-2 pb-0">
|
|
<v-layout row wrap>
|
|
<v-flex xs12>
|
|
<!-- <v-select
|
|
label="Agreement*"
|
|
item-text="M_MouName"
|
|
return-object
|
|
:items="xmou"
|
|
v-model="vmou"
|
|
multiple
|
|
chips
|
|
small-chips
|
|
clearable
|
|
item-value="M_MouID"
|
|
no-data-text="Pilih Company Dulu"
|
|
:error="mou_error_message !== ''"
|
|
:error-messages="mou_error_message"
|
|
@blur="mouValidation"
|
|
>
|
|
</v-select> -->
|
|
|
|
<!-- <v-autocomplete label="Agreement*"
|
|
:items="xmou"
|
|
v-model="vmou"
|
|
multiple chips deletable-chips
|
|
item-text="M_MouName"
|
|
item-value="M_MouID" return-object
|
|
no-data-text="Pilih Company Dulu" clearable
|
|
:error="mou_error_message !== ''"
|
|
:error-messages="mou_error_message"
|
|
@blur="mouValidation">
|
|
<template slot="item" slot-scope="{ item }">
|
|
<v-list-tile-content>
|
|
<v-list-tile-title v-text="item.M_MouName"></v-list-tile-title>
|
|
</v-list-tile-content>
|
|
</template>
|
|
</v-autocomplete> -->
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card-text>
|
|
<v-card-text class="pt-2 pb-0">
|
|
<v-layout row>
|
|
<v-flex xs12>
|
|
<v-text-field v-model="vparticipant" label="Partisipan"
|
|
></v-text-field>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card-text>
|
|
<v-divider></v-divider>
|
|
<v-card-actions>
|
|
<v-spacer></v-spacer>
|
|
<v-btn color="primary" flat @click="dialog_form = false" :disabled="loading_save">Tutup</v-btn>
|
|
<v-btn v-if="xact === 'add'" color="primary" flat :disabled="loading_save"
|
|
@click="saveAdd()">Simpan</v-btn>
|
|
<v-btn v-if="xact === 'edit'" color="primary" flat :disabled="loading_save" @click="saveEdit()">Simpan
|
|
Perubahan</v-btn>
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
<!-- End Form Dialog -->
|
|
|
|
<v-flex xs12>
|
|
<v-card class="mb-2" color="white">
|
|
<v-toolbar color="blue lighten-3" dark height="50px">
|
|
<v-toolbar-title>Master Pola Kelainan MCU</v-toolbar-title>
|
|
<v-spacer></v-spacer>
|
|
<v-btn @click="openForm(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" class="textinput" label="Deskripsi Harga"
|
|
v-model="xsearch"
|
|
placeholder="Cari ..." />
|
|
</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="vmcu" :loading="isLoading" hide-actions class="elevation-1">
|
|
<template slot="items" slot-scope="props">
|
|
<td class="text-xs-center pa-2" v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
|
@click="selectMe(props.item)">{{ props.item.Mgm_McuNumber }}
|
|
</td>
|
|
<td class="text-xs-center pa-2" v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
|
@click="selectMe(props.item)">{{ props.item.M_CompanyName }}
|
|
</td>
|
|
<td class="text-xs-center pa-2" v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
|
@click="selectMe(props.item)">{{ formatDateUI(props.item.Mgm_McuStartDate) }} - {{ formatDateUI(props.item.Mgm_McuEndDate) }}
|
|
</td>
|
|
<!-- <td class="text-xs-center pa-2" v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
|
@click="selectMe(props.item)">{{ props.item.M_MouName }}
|
|
</td> -->
|
|
<td class="text-xs-center pa-2" v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
|
@click="selectMe(props.item)">{{ props.item.Mgm_McuTotalParticipant }}
|
|
</td>
|
|
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
|
|
<v-tooltip bottom>
|
|
<template v-slot:activator="{ on, attrs }">
|
|
<v-icon
|
|
v-bind="attrs"
|
|
v-on="on"
|
|
small class="ml-3"
|
|
@click="openEdit(props.item)"
|
|
color="primary">edit
|
|
</v-icon>
|
|
</template>
|
|
<span>Edit</span>
|
|
</v-tooltip>
|
|
<v-tooltip bottom>
|
|
<template v-slot:activator="{ on, attrs }">
|
|
<v-icon
|
|
v-bind="attrs"
|
|
v-on="on"
|
|
small
|
|
class="ml-3"
|
|
@click="confirmDelete(props.item)"
|
|
color="error">clear
|
|
</v-icon>
|
|
</template>
|
|
<span>Hapus</span>
|
|
</v-tooltip>
|
|
</td>
|
|
</template>
|
|
</v-data-table>
|
|
<v-divider></v-divider>
|
|
<v-layout>
|
|
<v-flex>
|
|
<v-pagination style="margin-top:10px;margin-bottom:10px" v-model="curr_page" :length="xtotal_page">
|
|
</v-pagination>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-flex>
|
|
</v-layout>
|
|
|
|
</v-card>
|
|
</v-flex>
|
|
|
|
|
|
</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 = {
|
|
data() {
|
|
return {
|
|
menufilterdatestart: false,
|
|
menufilterdateend: false,
|
|
date: new Date().toISOString().substr(0, 10),
|
|
search_item_company: "",
|
|
company_error_message: "",
|
|
vnationalNumber: "",
|
|
// mou_error_message: "",
|
|
clr: "success",
|
|
vparticipant: "",
|
|
dialog_data_edit: false,
|
|
text_not_edit: "",
|
|
xid: "",
|
|
dialogdeletealert: false,
|
|
msgalert: "",
|
|
headers: [{
|
|
text: "NUMBER",
|
|
align: "Center",
|
|
sortable: false,
|
|
value: "mr",
|
|
width: "15%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
{
|
|
text: "COMPANY",
|
|
align: "Center",
|
|
sortable: false,
|
|
value: "mr",
|
|
width: "15%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
{
|
|
text: "STAR DATE - END DATE",
|
|
align: "Center",
|
|
sortable: false,
|
|
value: "mr",
|
|
width: "20%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
// {
|
|
// text: "AGREEMENT",
|
|
// align: "Center",
|
|
// sortable: false,
|
|
// value: "mr",
|
|
// width: "20%",
|
|
// class: "pa-2 blue lighten-3 white--text"
|
|
// },
|
|
{
|
|
text: "PARTISIPAN",
|
|
align: "Center",
|
|
sortable: false,
|
|
value: "mr",
|
|
width: "10%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
{
|
|
text: "AKSI",
|
|
align: "Center",
|
|
sortable: false,
|
|
value: "mr",
|
|
width: "10%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
}]
|
|
|
|
};
|
|
},
|
|
mounted() {
|
|
this.$store.dispatch("admin/search")
|
|
},
|
|
computed: {
|
|
vmcu() {
|
|
return this.$store.state.admin.mcu
|
|
},
|
|
isLoading() {
|
|
return this.$store.state.admin.search_status == 1
|
|
},
|
|
curr_page: {
|
|
get() {
|
|
return this.$store.state.admin.current_page
|
|
},
|
|
set(val) {
|
|
this.$store.commit("admin/update_current_page", val)
|
|
this.$store.commit("admin/update_last_id", -1)
|
|
this.$store.dispatch("admin/search")
|
|
}
|
|
},
|
|
xtotal_page: {
|
|
get() {
|
|
return this.$store.state.admin.total_mcu
|
|
},
|
|
set(val) {
|
|
this.$store.commit("admin/update_total_mcu", val)
|
|
}
|
|
},
|
|
xsearch: {
|
|
get() {
|
|
return this.$store.state.admin.x_search
|
|
},
|
|
set(val) {
|
|
this.$store.commit("admin/update_x_search", val)
|
|
}
|
|
},
|
|
xact: {
|
|
get() {
|
|
return this.$store.state.admin.act
|
|
},
|
|
set(val) {
|
|
this.$store.commit("admin/update_act", val)
|
|
}
|
|
},
|
|
dialog_form: {
|
|
get() {
|
|
return this.$store.state.admin.dialog_form
|
|
},
|
|
set(val) {
|
|
this.$store.commit("admin/update_dialog_form", val)
|
|
},
|
|
},
|
|
loading_save: {
|
|
get() {
|
|
return this.$store.state.admin.loading_save
|
|
},
|
|
set(val) {
|
|
this.$store.commit("admin/update_loading_save", val)
|
|
},
|
|
},
|
|
filterComputedDateFormattedStart() {
|
|
return this.formatDate(this.xdatestart)
|
|
},
|
|
filterComputedDateFormattedEnd() {
|
|
return this.formatDate(this.xdateend)
|
|
},
|
|
xdatestart: {
|
|
get() {
|
|
return this.$store.state.admin.start_date
|
|
},
|
|
set(val) {
|
|
this.$store.commit("admin/update_start_date", val)
|
|
}
|
|
},
|
|
xdateend: {
|
|
get() {
|
|
return this.$store.state.admin.end_date
|
|
},
|
|
set(val) {
|
|
this.$store.commit("admin/update_end_date", val)
|
|
}
|
|
},
|
|
xcompany() {
|
|
return this.$store.state.admin.companys
|
|
},
|
|
vcompany: {
|
|
get() {
|
|
return this.$store.state.admin.selected_company
|
|
},
|
|
set(val) {
|
|
this.$store.commit("admin/update_selected_company", val)
|
|
// if (this.vcompany != undefined) {
|
|
// this.$store.dispatch("admin/search_mou_multiple",
|
|
// this.vcompany.M_CompanyID
|
|
// )
|
|
// }
|
|
}
|
|
},
|
|
// xmou() {
|
|
// return this.$store.state.admin.mous
|
|
// },
|
|
// vmou: {
|
|
// get() {
|
|
// return this.$store.state.admin.selected_mou_multiple
|
|
// },
|
|
// set(val) {
|
|
// this.$store.commit("admin/update_selected_mou_multiple", val)
|
|
// }
|
|
// },
|
|
snackbar: {
|
|
get() {
|
|
return this.$store.state.admin.alert_success
|
|
},
|
|
set(val) {
|
|
this.$store.commit("admin/update_alert_success", val)
|
|
}
|
|
},
|
|
msgsnackbar() {
|
|
return this.$store.state.admin.msg_success
|
|
},
|
|
dialog_error: {
|
|
get() {
|
|
return this.$store.state.admin.alert_error
|
|
},
|
|
set(val) {
|
|
this.$store.commit("admin/update_alert_error", val)
|
|
},
|
|
},
|
|
msgError() {
|
|
return this.$store.state.admin.error_message
|
|
}
|
|
},
|
|
methods: {
|
|
isSelected(p) {
|
|
return p.Mgm_McuID == this.$store.state.admin.selected_mcu.Mgm_McuID
|
|
},
|
|
selectMe(selected) {
|
|
this.$store.commit("admin/update_selected_mcu", selected)
|
|
this.$store.commit("order/update_selected_mcu_id", selected.Mgm_McuID)
|
|
this.$store.commit("order/update_readyconfirm", selected.readyconfirm)
|
|
// set value selected company
|
|
this.$store.commit("admin/update_companys", [
|
|
{
|
|
M_CompanyID: selected.M_CompanyID,
|
|
M_CompanyName: selected.M_CompanyName
|
|
}
|
|
])
|
|
this.$store.commit("admin/update_selected_company", {
|
|
M_CompanyID: selected.M_CompanyID,
|
|
M_CompanyName: selected.M_CompanyName
|
|
})
|
|
|
|
// // Split string menjadi array berdasarkan koma
|
|
// const mouIdArray = selected.M_MouID.split(", ");
|
|
|
|
// // Split string M_MouName menjadi array berdasarkan koma
|
|
// const mouNameArray = selected.M_MouName.split(", ");
|
|
|
|
// Membuat array objek untuk diupdate
|
|
// const mousArray = mouIdArray.map((id, index) => ({
|
|
// M_MouID: id,
|
|
// M_MouName: mouNameArray[index]
|
|
// }));
|
|
|
|
// // Update state dengan array objek
|
|
// this.$store.commit("admin/update_mous", mousArray);
|
|
// this.$store.commit("admin/update_selected_mou_multiple", mousArray);
|
|
},
|
|
thr_search: _.debounce(function () {
|
|
this.$store.dispatch("admin/search")
|
|
}, 1000),
|
|
thr_search_company: _.debounce(function () {
|
|
this.$store.dispatch("admin/search_company", this.search_item_company)
|
|
}, 2000),
|
|
// thr_search_mou: _.debounce(function () {
|
|
// this.$store.dispatch("admin/search_mou_multiple", this.vcompany.M_CompanyID)
|
|
// }, 1000),
|
|
companyValidation() {
|
|
if (_.isEmpty(this.vcompany)) {
|
|
this.company_error_message = 'Anda belum memilih company'
|
|
}
|
|
if (this.vcompany) {
|
|
this.company_error_message = ""
|
|
}
|
|
},
|
|
// mouValidation() {
|
|
// if (_.isEmpty(this.vmou)) {
|
|
// this.mou_error_message = 'Anda belum mengisi'
|
|
// }
|
|
// if (this.vmou) {
|
|
// this.mou_error_message = ""
|
|
// }
|
|
// },
|
|
resetAllInput() {
|
|
this.vcompany = ""
|
|
this.vnationalNumber = ""
|
|
// this.vmou = ""
|
|
this.vparticipant = ""
|
|
this.company_error_message = ""
|
|
// this.mou_error_message = ""
|
|
},
|
|
resetAllError() {
|
|
this.company_error_message = ""
|
|
// this.mou_error_message = ""
|
|
},
|
|
openForm() {
|
|
this.$store.commit("admin/update_act", "add")
|
|
this.$store.commit("admin/update_last_id", -1)
|
|
this.resetAllInput()
|
|
this.dialog_form = true
|
|
},
|
|
saveAdd() {
|
|
this.companyValidation()
|
|
// this.mouValidation()
|
|
if (this.company_error_message === ""){
|
|
// &&
|
|
// this.mou_error_message === "") {
|
|
|
|
// let arrMouID = []
|
|
// for (let i = 0; i < this.vmou.length; i++) {
|
|
// const item = this.vmou[i];
|
|
// // console.log(item)
|
|
// arrMouID.push(item.M_MouID);
|
|
// }
|
|
// console.log(arrMouID)
|
|
|
|
let prm = {
|
|
companyId: this.vcompany.M_CompanyID,
|
|
nationalNumber: this.vnationalNumber,
|
|
startdate: this.xdatestart,
|
|
enddate: this.xdateend,
|
|
// selectedMou: arrMouID,
|
|
participant: this.vparticipant
|
|
}
|
|
|
|
// console.log('cek prm', prm)
|
|
this.$store.dispatch("admin/addMcu", prm)
|
|
|
|
}
|
|
},
|
|
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')}`
|
|
},
|
|
formatDateUI(dateStr) {
|
|
if (!dateStr) return null;
|
|
const [year, month, day] = dateStr.split('-');
|
|
return `${day}-${month}-${year}`;
|
|
},
|
|
openEdit(data) {
|
|
if (this.$store.state.order.total_mcuorder > 0) {
|
|
this.text_not_edit = "Tidak bisa di edit karena sudah melakukan generate order!"
|
|
this.dialog_data_edit = true
|
|
} else {
|
|
this.selectMe(data);
|
|
this.dialog_form = true
|
|
this.$store.commit("admin/update_act", "edit")
|
|
this.xid = data.Mgm_McuID
|
|
this.vcompany = data.M_CompanyID
|
|
this.vnationalNumber = data.Mgm_McuNumberNational
|
|
this.xdatestart = data.Mgm_McuStartDate
|
|
this.xdateend = data.Mgm_McuEndDate
|
|
// this.vmou = data.M_MouID
|
|
// this.vmou = data.M_MouID.split(", ").map(Number)
|
|
// console.log('data ouid',data.M_MouID.split(", ").map(Number))
|
|
this.vparticipant = data.Mgm_McuTotalParticipant
|
|
this.resetAllError()
|
|
this.$store.commit("admin/update_last_id", data.Mgm_McuID)
|
|
}
|
|
},
|
|
saveEdit() {
|
|
this.companyValidation()
|
|
// this.mouValidation()
|
|
if (this.company_error_message === "" ){
|
|
// &&
|
|
// this.mou_error_message === "") {
|
|
// let arrMouID = []
|
|
// for (let i = 0; i < this.vmou.length; i++) {
|
|
// const item = this.vmou[i];
|
|
// // console.log(item)
|
|
// arrMouID.push(item.M_MouID);
|
|
// }
|
|
// console.log(arrMouID)
|
|
|
|
let prm = {
|
|
mgmmcuid: this.$store.state.admin.selected_mcu.Mgm_McuID,
|
|
companyId: this.vcompany.M_CompanyID,
|
|
nationalNumber: this.vnationalNumber,
|
|
startdate: this.xdatestart,
|
|
enddate: this.xdateend,
|
|
// selectedMou: arrMouID,
|
|
participant: this.vparticipant
|
|
}
|
|
|
|
// console.log('cek prm', prm)
|
|
this.$store.dispatch("admin/editMcu", prm)
|
|
}
|
|
},
|
|
confirmDelete(data) {
|
|
if (this.$store.state.order.total_mcuorder > 0) {
|
|
this.text_not_edit = "Tidak bisa di hapus karena sudah melakukan generate order!"
|
|
this.dialog_data_edit = true
|
|
} else {
|
|
this.selectMe(data)
|
|
this.xid = data.Mgm_McuID
|
|
this.msgalert = "Yakin, mau hapus mcu ?"
|
|
|
|
this.dialogdeletealert = true
|
|
}
|
|
},
|
|
deleteRow() {
|
|
this.$store.commit("admin/update_last_id", -1)
|
|
let prm = {
|
|
mgmmcuid: this.xid
|
|
}
|
|
this.$store.dispatch("admin/deleteMcu", prm)
|
|
this.dialogdeletealert = false
|
|
}
|
|
},
|
|
watch: {
|
|
xsearch(val, old) {
|
|
this.xsearch = val
|
|
this.thr_search()
|
|
},
|
|
|
|
search_item_company(val, old) {
|
|
if (val == old) return
|
|
if (!val) return
|
|
|
|
if (val.length < 1) {
|
|
this.$store.dispatch("admin/search_company", this.search_item_company)
|
|
return this.thr_search_company()
|
|
}
|
|
|
|
if (val.length > 2) {
|
|
this.$store.dispatch("admin/search_company", this.search_item_company)
|
|
return this.thr_search_company()
|
|
}
|
|
},
|
|
|
|
// vmou(val, old) {
|
|
// // console.log('val mou',val)
|
|
// // console.log('old mou',old)
|
|
// if (val == old) return
|
|
// if (!val) return
|
|
|
|
// if (val.length < 1) {
|
|
// this.$store.dispatch("admin/search_mou_multiple",
|
|
// this.vcompany.M_CompanyID
|
|
// )
|
|
// return this.thr_search_mou()
|
|
// }
|
|
|
|
// if (val.length > 2) {
|
|
// this.$store.dispatch("admin/search_mou_multiple",
|
|
// this.vcompany.M_CompanyID
|
|
// )
|
|
// return this.thr_search_mou()
|
|
// }
|
|
|
|
// }
|
|
}
|
|
}
|
|
</script> |