Flatten nested repos

This commit is contained in:
sas.fajri
2026-04-27 10:13:31 +07:00
parent 01c2963a43
commit 8347aef8f4
17935 changed files with 5015229 additions and 3 deletions

View File

@@ -0,0 +1,140 @@
const URL = "/one-api/etl/admin_v2/";
export async function search(prm) {
try {
var resp = await axios.post(URL + 'search', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function list_mcu_order(prm) {
try {
var resp = await axios.post(URL + 'list_mcu_order', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function search_company(token, prm) {
try {
var resp = await axios.post(URL + 'search_company', {
token: token,
search: prm
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
// export async function search_mou_multiple(token, companyId) {
// try {
// var resp = await axios.post(URL + 'search_mou_multiple', {
// token: token,
// companyId: companyId
// });
// if (resp.status != 200) {
// return {
// status: "ERR",
// message: resp.statusText
// };
// }
// let data = resp.data;
// return data;
// } catch (e) {
// return {
// status: "ERR",
// message: e.message
// };
// }
// }
export async function addMcu(prm) {
try {
var resp = await axios.post(URL + 'addMcu', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function editMcu(prm) {
try {
var resp = await axios.post(URL + 'editMcu', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function deleteMcu(prm) {
try {
var resp = await axios.post(URL + 'deleteMcu', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,58 @@
const URL = "/one-api/etl/admin_v2/";
export async function list_mcu_order(prm) {
try {
var resp = await axios.post(URL + 'list_mcu_order', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function insert_mcu_order(prm) {
try {
var resp = await axios.post(URL + 'insert_mcu_order', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function confirm_mcu_order(prm) {
try {
var resp = await axios.post(URL + 'confirm_mcu_order', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,825 @@
<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>

View File

@@ -0,0 +1,509 @@
<template>
<v-layout class="fill-height" column>
<v-dialog v-model="dialog_data_empty" 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">
<h6 class="display-1 text-center"><span class="blue--text">{{ text_data_empty }}</span></h6>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" flat @click="dialog_data_empty = false">
Tutup
</v-btn>
</v-card-actions>
</v-card>
</v-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-show="this.total_order === 0 ? false : true" 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 -->
<!-- Alert dialog -->
<v-dialog v-model="dialogalert" 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="dialogalert = false">
Tutup
</v-btn>
<v-btn color="primary" flat @click="saveGenerate()">
Yakin lah
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- End alert dialog -->
<!-- Alert dialog -->
<v-dialog v-model="dialogalertconfirm" max-width="30%">
<v-card>
<v-card-title class="headline green lighten-2 pt-2 pb-2" primary-title>
Konfirmasi
</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>
{{ msgalertconfirm }}
</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="dialogalertconfirm = false">
Tutup
</v-btn>
<v-btn color="primary" flat @click="saveConfirm()">
Yakin lah
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- End alert dialog -->
<v-card class="mb-2 pa-2 ">
<v-layout align-center row>
<v-flex xs4>
<v-text-field style="font-size:14px" label="No Lab / Nama" class="mr-1" v-model="xsearch"
hide-details></v-text-field>
</v-flex>
<v-flex v-show="Object.keys(this.$store.state.admin.selected_mcu).length != 0 ? true : false"
text-md-right>
<v-btn @click="doPrintPersentase()" color="primary" dark>Persentase <v-icon right
dark>print</v-icon></v-btn>
</v-flex>
<v-flex v-show="Object.keys(this.$store.state.admin.selected_mcu).length != 0 ? true : false"
text-md-right>
<v-btn @click="doPrintExecutive()" color="orange" dark>Executive <v-icon right
dark>print</v-icon></v-btn>
</v-flex>
<v-flex
v-show="Object.keys(this.$store.state.admin.selected_mcu).length != 0 && this.$store.state.order.mcuorder.length === 0 ? true : false"
text-md-right>
<v-btn class="ma-2" color="secondary" @click="openOrder()">
Generate Order
</v-btn>
</v-flex>
<v-flex
v-show="this.$store.state.order.readyconfirm == 'Y' ? true : false"
text-md-right>
<v-btn class="ma-2" color="success" @click="confirmOrder()">
Konfirmasi
</v-btn>
</v-flex>
</v-layout>
</v-card>
<v-card class="mb-2" color="white">
<v-layout align-center row>
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
<v-data-table :headers="headers" :items="vmcuorder" :loading="isLoading" hide-actions
class="elevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-left pa-2" @click="selectMe(props.item)"
v-html="props.item.T_OrderHeaderLabNumber">
</td>
<td class="text-xs-left pa-2" @click="selectMe(props.item)"
v-html="props.item.M_PatientName">
</td>
<td class="text-xs-center pa-2" @click="selectMe(props.item)">
<v-chip v-if="props.item.Mcu_OrderStatus === 'N'" color="blue" text-color="white" small
dark>NEW
</v-chip>
<v-chip v-if="props.item.Mcu_OrderStatus === 'S'" color="green" text-color="white" small
dark>SENT
</v-chip>
<v-chip v-if="props.item.Mcu_OrderStatus === 'C'" color="orange" text-color="white"
small dark>CONFIRM
</v-chip>
<v-chip v-if="props.item.Mcu_OrderStatus === 'P'" color="teal" text-color="white" small
dark>PROCESSING
</v-chip>
<v-chip v-if="props.item.Mcu_OrderStatus === 'D'" color="secondary" text-color="white"
small dark>PROCESSING LAB DONE
</v-chip>
<v-chip v-if="props.item.Mcu_OrderStatus === 'E'" color="red" text-color="white" small
dark>ERROR
</v-chip>
<v-chip v-if="props.item.Mcu_OrderStatus === 'R'" color="primary" text-color="white"
small dark>RE-SEND
</v-chip>
<v-chip v-if="props.item.Mcu_OrderStatus === 'F'" color="secondary" text-color="white"
small dark>DONE NONLAB
</v-chip>
</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>
<one-dialog-print :title="printtitle" :width="printwidth" :height="550" :status="openprintpersentase"
:urlprint="urlprintpersentase" @close-dialog-print="openprintpersentase = false"></one-dialog-print>
<one-dialog-print :title="printtitle" :width="printwidth" :height="550" :status="openprintexecutive"
:urlprint="urlprintexecutive" @close-dialog-print="openprintexecutive = false"></one-dialog-print>
</v-layout>
</template>
<style scoped>
.searchbox .v-input.v-text-field .v-input__slot {
min-height: 60px;
}
.searchbox .v-btn {
min-height: 60px;
}
table.v-table tbody td,
table.v-table tbody th {
height: 40px;
}
table.v-table thead tr {
height: 40px;
}
.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-dialog-print': httpVueLoader('../../common/oneDialogPrintX.vue')
},
data() {
return {
msgalert: "",
msgalertconfirm: "",
clr: "success",
urlprintpersentase: "",
printtitle: '',
printwidth: '80%',
urlprintexecutive: "",
headers: [{
text: "NOMOR LAB",
align: "left",
sortable: false,
value: "mr",
width: "20%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "PASIEN",
align: "left",
sortable: false,
value: "mr",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "STATUS",
align: "Center",
sortable: false,
value: "mr",
width: "20%",
class: "pa-2 blue lighten-3 white--text"
}]
};
},
mounted() {
},
computed: {
vmcuorder() {
return this.$store.state.order.mcuorder
},
isLoading() {
return this.$store.state.order.search_status == 1
},
curr_page: {
get() {
return this.$store.state.order.current_page
},
set(val) {
this.$store.commit("order/update_current_page", val)
this.$store.commit("order/update_last_id", -1)
this.$store.dispatch("order/list_mcu_order")
}
},
xtotal_page: {
get() {
return this.$store.state.order.total_mcuorder_page
},
set(val) {
this.$store.commit("order/update_total_mcuorder_page", val)
}
},
xsearch: {
get() {
return this.$store.state.order.x_search
},
set(val) {
this.$store.commit("order/update_x_search", val)
}
},
selected_mcu_id() {
return this.$store.state.order.selected_mcu_id
},
dialogalert: {
get() {
return this.$store.state.order.dialogalert
},
set(val) {
this.$store.commit("order/update_dialogalert", val)
},
},
dialogalertconfirm: {
get() {
return this.$store.state.order.dialogalertconfirm
},
set(val) {
this.$store.commit("order/update_dialogalertconfirm", val)
},
},
snackbar: {
get() {
return this.$store.state.order.alert_success
},
set(val) {
this.$store.commit("order/update_alert_success", val)
}
},
msgsnackbar() {
return this.$store.state.order.msg_success
},
dialog_error: {
get() {
return this.$store.state.order.alert_error
},
set(val) {
this.$store.commit("order/update_alert_error", val)
},
},
msgError() {
return this.$store.state.order.error_message
},
text_data_empty() {
return this.$store.state.order.text_empty
},
dialog_data_empty: {
get() {
return this.$store.state.order.dialog_is_active
},
set(val) {
this.$store.commit("order/update_dialog_is_active", val)
}
},
total_order: {
get() {
return this.$store.state.order.total_order
},
set(val) {
this.$store.commit("order/update_total_order", val)
}
},
openprintpersentase: {
get() {
return this.$store.state.order.open_print_persentase
},
set(val) {
this.$store.commit("order/update_open_print_persentase", false)
}
},
openprintexecutive: {
get() {
return this.$store.state.order.open_print_executive
},
set(val) {
this.$store.commit("order/update_open_print_executive", false)
}
}
},
methods: {
selectMe(selected) {
this.$store.commit("order/update_selected_mcuorder", selected)
this.$store.commit("order/update_last_id", selected.Mcu_OrderID)
},
thr_search: _.debounce(function () {
this.$store.dispatch("order/list_mcu_order")
}, 1000),
thr_search_mcu_order: _.debounce(function () {
this.$store.dispatch("order/list_mcu_order")
}, 1000),
openOrder() {
this.msgalert = "Yakin, Mau Generate Order ?"
this.dialogalert = true
},
saveGenerate() {
let prm = {
mgmmcuid: this.$store.state.admin.selected_mcu.Mgm_McuID
}
// console.log(mgmmcuid)
this.$store.dispatch('order/insert_mcu_order', prm)
},
confirmOrder() {
this.msgalertconfirm = "Yakin, Mau Dikonfirmasi ? Pastikan semua hasil resume individu sudah divalidasi."
this.dialogalertconfirm = true
},
saveConfirm() {
let prm = {
mgmmcuid: this.$store.state.admin.selected_mcu.Mgm_McuID
}
// console.log(mgmmcuid)
this.$store.dispatch('order/confirm_mcu_order', prm)
},
doPrintPersentase() {
id = this.$store.state.admin.selected_mcu.Mgm_McuID
let user = one_user()
this.printwidth = 1200
this.printtitle = ""
let rpt = 'pola_kelainan_mcu_001'
this.urlprintpersentase = "/birt/run?__report=report/one/rekap/" + rpt + ".rptdesign&__format=pdf&PID=" + id + "&username=" + user.M_StaffName
this.$store.commit("order/update_open_print_persentase", true)
},
doPrintExecutive() {
id = this.$store.state.admin.selected_mcu.Mgm_McuID
let user = one_user()
this.printwidth = 1200
this.printtitle = ""
let rpt = 'executive_summary_mcu_001'
this.urlprintexecutive = "/birt/run?__report=report/one/rekap/" + rpt + ".rptdesign&__format=pdf&PID=" + id + "&username=" + user.M_StaffName
this.$store.commit("order/update_open_print_executive", true)
}
},
watch: {
xsearch(val, old) {
this.xsearch = val
this.thr_search()
},
selected_mcu_id(val, old) {
this.thr_search_mcu_order()
}
}
}
</script>

View File

@@ -0,0 +1,97 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>One</title>
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
<link rel="stylesheet" href="../../../libs/vendor/css/icomoon-fonts.css">
<link rel="stylesheet" href="../../../libs/vendor/css/vuetify.min.css">
</head>
<body>
<div v-cloak id="app">
<v-app id="smartApp">
<one-navbar></one-navbar>
<v-content style="background:#F5E8DF!important">
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
<v-layout row wrap>
<v-flex xs6 class="left" fill-height pa-1>
<one-admin-mcu-left></one-admin-mcu-left>
</v-flex>
<v-flex xs6 class="right" fill-height pa-1>
<one-admin-mcu-right></one-admin-mcu-right>
</v-flex>
</v-layout>
</v-container>
</v-content>
<one-footer> </one-footer>
</v-app>
</div>
<!-- Vendor -->
<script src="../../../libs/vendor/moment.min.js"></script>
<script src="../../../libs/vendor/numeral.min.js"></script>
<script src="../../../libs/vendor/moment-locale-id.js"></script>
<script src="../../../libs/vendor/lodash.js"></script>
<script src="../../../libs/vendor/axios.min.js"></script>
<script src="../../../libs/vendor/vue.js"></script>
<script src="../../../libs/vendor/vuex.js"></script>
<script src="../../../libs/vendor/vuetify.js"></script>
<script src="../../../libs/vendor/httpVueLoader.js"></script>
<script src="../../../libs/one_global.js"></script>
<!-- <script src="../../../libs/one_print_barcode.js"></script> -->
<!-- <script src="../../../libs/one_print_robo.js"></script> -->
<!-- App Script -->
<?php
$ts = "?ts=" . Date("ymdhis");
?>
<script type="module">
window.calculate_age = function(inp_dob) {
var now = moment(new Date())
var dob = moment(new Date(inp_dob))
var year = now.diff(dob, 'years')
dob.add(year, 'years')
var month = now.diff(dob, 'months')
dob.add(month, 'months')
var day = now.diff(dob, 'days')
if (isNaN(year)) return ''
return `${year} tahun ${month} bulan ${day} hari`
}
import {
store
} from './store.js<?php echo $ts ?>';
//for testing
window.store = store;
new Vue({
store,
el: '#app',
methods: {
tab_selected: function(tab) {
return this.$store.state.tab_selected == tab
}
},
components: {
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
'one-admin-mcu-left': httpVueLoader('./components/oneAdminMcuLeft.vue'),
'one-admin-mcu-right': httpVueLoader('./components/oneAdminMcuRight.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {}
.right {}
</style>
</body>
</html>

View File

@@ -0,0 +1,282 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/admin.js"
export default {
namespaced: true,
state: {
mcu: [],
total_mcu: 0,
selected_mcu: {},
search_status: false,
error_message: "",
last_id: -1,
current_page: 1,
x_search: "",
act: "",
dialog_form: false,
loading_save: false,
start_date:moment(new Date()).format('YYYY-MM-DD'),
end_date:moment(new Date()).format('YYYY-MM-DD'),
autocomplete_status: 0,
companys: [],
selected_company: {},
// mous: [],
selected_mou_multiple: [],
save_status: 2,
alert_error: false,
dialog_error: false,
msg_success: "",
alert_success: false
},
mutations: {
update_mcu(state, val) {
state.mcu = val
},
update_total_mcu(state, val) {
state.total_mcu = val
},
update_selected_mcu(state, val) {
state.selected_mcu = val
},
update_search_status(state, val) {
state.search_status = val
},
update_error_message(state, val) {
state.error_message = val
},
update_last_id(state, val) {
state.last_id = val
},
update_current_page(state, val) {
state.current_page = val
},
update_x_search(state, val) {
state.x_search = val
state.current_page = 1
},
update_act(state, val) {
state.act = val
},
update_dialog_form(state, val) {
state.dialog_form = val
},
update_loading_save(state, val) {
state.loading_save = val
},
update_start_date(state, val) {
state.start_date = val
},
update_end_date(state, val) {
state.end_date = val
},
update_autocomplete_status(state, val) {
state.autocomplete_status = val
},
update_companys(state, val) {
state.companys = val
},
update_selected_company(state, val) {
state.selected_company = val
state.selected_mou_multiple = ''
},
// update_mous(state, val) {
// state.mous = val
// },
update_selected_mou_multiple(state, val) {
state.selected_mou_multiple = val
},
update_save_status(state, val) {
state.save_status = val
},
update_alert_error(state, val) {
state.alert_error = val
},
update_dialog_error(state, val) {
state.dialog_error = val
},
update_msg_success(state, val) {
state.msg_success = val
},
update_alert_success(state, val) {
state.alert_success = val
},
},
actions: {
async search(context) {
context.commit("update_search_status", true)
try {
var prm = {
token: one_token(),
search: context.state.x_search,
current_page: context.state.current_page,
last_id: context.state.last_id
}
let resp = await api.search(prm)
if (resp.status != "OK") {
context.commit("update_search_status", false)
context.commit("update_error_message", resp.message)
} else {
context.commit("update_search_status", false)
context.commit("update_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total,
total_page: resp.data.total_page
}
context.commit("update_mcu", data.records)
context.commit("update_total_mcu", data.total_page)
if (
!(
Object.keys(context.state.selected_mcu).length === 0 &&
context.state.selected_mcu.constructor === Object
)
) {
let idx = _.findIndex(resp.data.records, function (o) {
return o.Mgm_McuID == context.state.selected_mcu.Mgm_McuID
});
if (idx >= 0) {
context.commit("update_selected_mcu", resp.data.records[idx]);
}
}
}
} catch (e) {
context.commit("update_search_status", false)
context.commit("update_error_message", e.message)
}
},
async search_company(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.search_company(one_token(), prm)
if (resp.status != "OK") {
context.commit("update_autocomplete_status", 3)
} else {
context.commit("update_autocomplete_status", 2)
let data = {
records: resp.data.records
}
context.commit("update_companys", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
// async search_mou_multiple(context, companyId) {
// context.commit("update_autocomplete_status", 1)
// try {
// let resp = await api.search_mou_multiple(one_token(), companyId)
// if (resp.status != "OK") {
// context.commit("update_autocomplete_status", 3)
// } else {
// context.commit("update_autocomplete_status", 2)
// let data = {
// records: resp.data.records
// }
// context.commit("update_mous", resp.data.records)
// }
// } catch (e) {
// context.commit("update_autocomplete_status", 3)
// }
// },
async addMcu(context, prm) {
context.commit("update_save_status", 1)
try {
context.commit("update_loading_save", true)
prm.token = one_token()
let resp = await api.addMcu(prm)
if (resp.status != "OK") {
context.commit("update_save_status", 3)
context.commit("update_loading_save", false)
context.commit("update_error_message", resp.message)
context.commit("update_alert_error", true)
context.commit("update_dialog_error", true)
} else {
context.commit("update_save_status", 2)
context.commit("update_loading_save", false)
context.commit("update_error_message", "")
context.commit("update_dialog_error", false)
context.commit("update_dialog_form", false)
let data = resp.data
var msg = "Berhasil disimpan"
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.dispatch("search")
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_loading_save", false)
context.commit("update_error_message", e.message)
context.commit("update_alert_error", true)
}
},
async editMcu(context, prm) {
context.commit("update_save_status", 1)
try {
context.commit("update_loading_save", true)
prm.token = one_token()
let resp = await api.editMcu(prm)
if (resp.status != "OK") {
context.commit("update_save_status", 3)
context.commit("update_loading_save", false)
context.commit("update_error_message", resp.message)
context.commit("update_alert_error", true)
context.commit("update_dialog_error", true)
} else {
context.commit("update_save_status", 2)
context.commit("update_loading_save", false)
context.commit("update_error_message", "")
context.commit("update_dialog_error", false)
context.commit("update_dialog_form", false)
let data = resp.data
var msg = "Berhasil diedit"
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.dispatch("search")
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_loading_save", false)
context.commit("update_error_message", e.message)
context.commit("update_alert_error", true)
}
},
async deleteMcu(context, prm) {
context.commit("update_save_status", 1)
try {
context.commit("update_loading_save", true)
prm.token = one_token()
let resp = await api.deleteMcu(prm)
if (resp.status != "OK") {
context.commit("update_save_status", 3)
context.commit("update_loading_save", false)
context.commit("update_error_message", resp.message)
context.commit("update_alert_error", true)
context.commit("update_dialog_error", true)
} else {
context.commit("update_save_status", 2)
context.commit("update_loading_save", false)
context.commit("update_error_message", "")
context.commit("update_dialog_error", false)
context.commit("update_dialog_form", false)
let data = resp.data
var msg = "Berhasil dihapus"
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.dispatch("search")
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_loading_save", false)
context.commit("update_error_message", e.message)
context.commit("update_alert_error", true)
}
},
}
}

View File

@@ -0,0 +1,221 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/order.js"
export default {
namespaced: true,
state: {
search_status: false,
error_message: "",
last_id: -1,
current_page: 1,
x_search: "",
mcuorder: [],
total_mcuorder_page: 0,
total_mcuorder: 0,
selected_mcuorder: {},
selected_mcu_id: 0,
save_status: 2,
loading_save: false,
dialogalert: false,
dialogalertconfirm: false,
alert_error: false,
dialog_error: false,
msg_success: "",
alert_success: false,
text_empty: "",
dialog_is_active: false,
total_order: 0,
open_print_persentase: false,
open_print_executive: false,
readyconfirm : "N"
},
mutations: {
update_readyconfirm(state, val) {
state.readyconfirm = val
},
update_search_status(state, val) {
state.search_status = val
},
update_error_message(state, val) {
state.error_message = val
},
update_last_id(state, val) {
state.last_id = val
},
update_current_page(state, val) {
state.current_page = val
},
update_x_search(state, val) {
state.x_search = val
state.current_page = 1
},
update_mcuorder(state, val) {
state.mcuorder = val
},
update_total_mcuorder_page(state, val) {
state.total_mcuorder_page = val
},
update_total_mcuorder(state, val) {
state.total_mcuorder = val
},
update_selected_mcuorder(state, val) {
state.selected_mcuorder = val
},
update_selected_mcu_id(state, val) {
state.selected_mcu_id = val
},
update_save_status(state, val) {
state.save_status = val
},
update_loading_save(state, val) {
state.loading_save = val
},
update_dialogalert(state, val) {
state.dialogalert = val
},
update_dialogalertconfirm(state, val) {
state.dialogalertconfirm = val
},
update_alert_error(state, val) {
state.alert_error = val
},
update_dialog_error(state, val) {
state.dialog_error = val
},
update_msg_success(state, val) {
state.msg_success = val
},
update_alert_success(state, val) {
state.alert_success = val
},
update_text_empty(state, val) {
state.text_empty = val
},
update_dialog_is_active(state, val) {
state.dialog_is_active = val
},
update_total_order(state, val) {
state.total_order = val
},
update_open_print_persentase(state, val) {
state.open_print_persentase = val
},
update_open_print_executive(state, val) {
state.open_print_executive = val
}
},
actions: {
async list_mcu_order(context, prm) {
context.commit("update_search_status", true)
try {
var prm = {
token: one_token(),
search: context.state.x_search,
mgmmcuid: context.state.selected_mcu_id,
current_page: context.state.current_page
}
let resp = await api.list_mcu_order(prm)
if (resp.status != "OK") {
context.commit("update_search_status", false)
context.commit("update_error_message", resp.message)
} else {
context.commit("update_search_status", false)
context.commit("update_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total,
total_page: resp.data.total_page
}
context.commit("update_mcuorder", data.records)
context.commit("update_total_mcuorder_page", data.total_page)
context.commit("update_total_mcuorder", data.total)
if (context.state.last_id == -1) {
if (resp.data && resp.data.records.length > 0) {
context.commit("update_selected_mcuorder", resp.data.records[0])
}
} else {
if (resp.data && resp.data.records.length > 0) {
let idx = _.findIndex(resp.data.records, function (o) { return o.Mcu_OrderID == context.state.last_id })
context.commit("update_selected_mcuorder", resp.data.records[idx])
}
}
}
} catch (e) {
context.commit("update_search_status", false)
context.commit("update_error_message", e.message)
}
},
async insert_mcu_order(context, prm) {
context.commit("update_save_status", 1)
try {
context.commit("update_loading_save", true)
prm.token = one_token()
let resp = await api.insert_mcu_order(prm)
if (resp.status != "OK") {
context.commit("update_save_status", 3)
context.commit("update_loading_save", false)
context.commit("update_error_message", resp.message)
context.commit("update_alert_error", true)
context.commit("update_dialog_error", true)
} else {
context.commit("update_save_status", 2)
context.commit("update_loading_save", false)
context.commit("update_error_message", "")
context.commit("update_dialog_error", false)
context.commit("update_dialogalert", false)
if (resp.data.total === 0) {
context.commit("update_dialog_is_active", true)
let text = "Tidak Ada Data"
context.commit("update_text_empty", text)
}
context.commit("update_total_order", resp.data.total)
var msg = "Berhasil generate order"
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.dispatch("list_mcu_order")
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_loading_save", false)
context.commit("update_error_message", e.message)
context.commit("update_alert_error", true)
}
},
async confirm_mcu_order(context, prm) {
context.commit("update_save_status", 1)
try {
context.commit("update_loading_save", true)
prm.token = one_token()
let resp = await api.confirm_mcu_order(prm)
if (resp.status != "OK") {
context.commit("update_save_status", 3)
context.commit("update_loading_save", false)
context.commit("update_error_message", resp.message)
context.commit("update_alert_error", true)
context.commit("update_dialog_error", true)
} else {
context.commit("update_save_status", 2)
context.commit("update_loading_save", false)
context.commit("update_error_message", "")
context.commit("update_dialog_error", false)
context.commit("update_dialogalertconfirm", false)
context.commit("update_total_order", resp.data.total)
var msg = "Berhasil konfirmasi order"
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.dispatch("list_mcu_order")
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_loading_save", false)
context.commit("update_error_message", e.message)
context.commit("update_alert_error", true)
}
}
}
}

View File

@@ -0,0 +1,25 @@
// State
// data ...
// Mutations
//
//
// Actions
import admin from "./modules/admin.js";
import order from "./modules/order.js";
import system from "../../../apps/modules/system/system.js";
export const store = new Vuex.Store({
modules: {
admin:admin,
order:order,
system:system
},
state: {
},
mutations: {
},
actions: {
}
});