add modules folder based on s_menu
This commit is contained in:
80
test/vuex/acc-one-md-itemdivision/api/a_itemdiv.js
Normal file
80
test/vuex/acc-one-md-itemdivision/api/a_itemdiv.js
Normal file
@@ -0,0 +1,80 @@
|
||||
const URL = "/one-api/itemdivision/Itemdivision";
|
||||
|
||||
export async function getDropdownCategory(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/dropdown_item_category', 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 searchItem(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "/search_item", 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 itemDivisionList(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "/item_division_list", 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 updateItemDivision(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "/update_item_division", 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,
|
||||
};
|
||||
}
|
||||
}
|
||||
529
test/vuex/acc-one-md-itemdivision/components/itemdivList.vue
Normal file
529
test/vuex/acc-one-md-itemdivision/components/itemdivList.vue
Normal file
@@ -0,0 +1,529 @@
|
||||
<template>
|
||||
<div style="width: 100%;">
|
||||
|
||||
<!-- SNACKBAR -->
|
||||
<v-snackbar v-model="snackbar" :timeout="5000" :multi-line="false" :vertical="false" :top="true">
|
||||
{{ msgSnackbar }}
|
||||
<v-btn flat @click="updateAlertSuccess(false)"> Tutup </v-btn>
|
||||
</v-snackbar>
|
||||
|
||||
<!-- 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">Tutup</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<!-- END ERROR DIALOG -->
|
||||
|
||||
<!-- dialog error -->
|
||||
<v-dialog v-model="dialoggagal" persistent max-width="290">
|
||||
<v-card>
|
||||
<v-card-title class="headline yellow darken-2 white--text">
|
||||
ERROR !
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
{{ msggagal }}
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="black--text" text @click="closeDialogGagal">OK</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<!-- dialog error -->
|
||||
|
||||
<!-- dialog success -->
|
||||
<v-dialog v-model="dialogsuccess" persistent max-width="290">
|
||||
<v-card>
|
||||
<v-card-title color="success" class="headline">Berhasil !</v-card-title>
|
||||
<v-card-text>
|
||||
{{ msgsuccess }}
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="green darken-1" flat @click="closeDialogSuccess">OK</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<!-- dialog success -->
|
||||
|
||||
<v-layout row wrap>
|
||||
<!-- kiri start -->
|
||||
<v-flex xs12 md6 style="padding: 10px;">
|
||||
<v-card>
|
||||
<!-- table list start -->
|
||||
<v-toolbar color="primary" dark>
|
||||
<v-toolbar-title class="white--text">ITEM DIVISION</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
<v-card class="pa-2">
|
||||
<v-layout row>
|
||||
<v-flex xs2 pl-2>
|
||||
<v-select item-text="itemCategoryName" return-object :items="xcategorys"
|
||||
v-model="selected_category" hide-details label="Category" outlined></v-select>
|
||||
</v-flex>
|
||||
<v-flex xs8 pl-2>
|
||||
<v-text-field v-model="xsearch" label="Cari" outline hide-details></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex pl-2>
|
||||
<v-btn class="ml-2" dark color="primary"
|
||||
style="min-width: 50px; height: 50px; margin: 0;" @click="searchItem()">
|
||||
<v-icon>search</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<v-card class="pa-2 mt-2">
|
||||
<v-layout row wrap class="scroll-container" style="max-height: 600px; overflow: auto;">
|
||||
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
||||
<v-data-table :headers="headers" :items="xitems" :loading="isLoading" hide-actions
|
||||
class="elevation-1">
|
||||
<template slot="items" slot-scope="props">
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">
|
||||
{{ props.item.itemCategoryName }}
|
||||
</td>
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">
|
||||
{{ props.item.M_ItemCode }}
|
||||
</td>
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)">
|
||||
{{ props.item.M_ItemDesc }}
|
||||
</td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider></v-divider>
|
||||
<v-pagination style="margin-top: 10px; margin-bottom: 10px;" v-model="curr_page"
|
||||
:length="xtotal_page"></v-pagination>
|
||||
</v-card>
|
||||
<!-- table list end -->
|
||||
</v-card>
|
||||
</v-flex>
|
||||
<!-- kiri end -->
|
||||
<!-- kanan start -->
|
||||
<v-flex xs12 md6 style="padding: 10px;">
|
||||
<v-card>
|
||||
<!-- table list start -->
|
||||
<v-toolbar color="blue darken-1" dark>
|
||||
<v-toolbar-title class="white--text">ITEM TERPILIH</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn v-if="selected_item && selected_item.M_ItemID > 0 && itemDivisionArr.length > 0"
|
||||
class="ma-1" color="white" elevation="2" @click="updateItemDivision()">
|
||||
<v-icon color="green darken-2">edit</v-icon>
|
||||
</v-btn>
|
||||
<v-btn v-else disabled class="ma-1" color="white" elevation="2" @click="updateItemDivision()">
|
||||
<v-icon color="green darken-2">edit</v-icon>
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
<v-card elevation="0">
|
||||
<p v-if="selected_item && selected_item.M_ItemID > 0" class="pa-2" style="color: blue;">
|
||||
Item Terpilih : {{ selected_item.M_ItemDesc }}
|
||||
</p>
|
||||
<p v-else class="pa-2" style="color: blue;">
|
||||
Item Terpilih : -
|
||||
</p>
|
||||
|
||||
<v-divider></v-divider>
|
||||
|
||||
<v-data-table :headers="headersl" :items="vitemdivisions" :loading="isLoadingr" hide-actions>
|
||||
<template slot="items" slot-scope="props">
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'green lighten-4': isSelectedDivisionList(props.item) }"
|
||||
@click="selectedMeDivisionList(props.item)">
|
||||
<v-checkbox class="mt-2" :input-value="props.item.IsChecked == '1'"
|
||||
@change="onSelectedChecked(props.item)" />
|
||||
</td>
|
||||
<td class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'green lighten-4': isSelectedDivisionList(props.item) }"
|
||||
@click="selectedMeDivisionList(props.item)">{{ props.item.DivisionName }}</td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
|
||||
<v-divider></v-divider>
|
||||
<!-- <v-flex xs12 class="text-xs-left pt-3 pb-3">
|
||||
<v-pagination v-model="curr_pager" :length="xtotal_pager"></v-pagination>
|
||||
</v-flex> -->
|
||||
</v-card>
|
||||
<!-- table list end -->
|
||||
</v-card>
|
||||
</v-flex>
|
||||
<!-- kanan end -->
|
||||
</v-layout>
|
||||
|
||||
|
||||
<!-- dialog delete start -->
|
||||
<template>
|
||||
<v-dialog v-model="dialogdeletealecoa" 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>
|
||||
{{ msgalertcoa }}
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" flat @click="dialogdeletealecoa = false">
|
||||
Tutup
|
||||
</v-btn>
|
||||
<v-btn color="primary" @click="closeDeleteAlertCoa()">
|
||||
Ya
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
<!-- dialog delete end -->
|
||||
|
||||
<template>
|
||||
<one-dialog-info :status="opendialoginfo" :msg="msginfo"
|
||||
@close-dialog-info="opendialoginfo = false"></one-dialog-info>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
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;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {
|
||||
"one-dialog-info": httpVueLoader("../../common/oneDialogInfo.vue"),
|
||||
"one-dialog-alert": httpVueLoader("../../common/oneDialogAlert.vue"),
|
||||
"one-dialog-error": httpVueLoader("../../common/oneDialogError.vue"),
|
||||
"one-dialog-print": httpVueLoader("../../common/oneDialogPrintX.vue"),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formatreport: "pdf",
|
||||
urlprint: "",
|
||||
printtitle: "",
|
||||
printwidth: "100%",
|
||||
page: 1,
|
||||
headers: [
|
||||
{
|
||||
text: "CATEGORY",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "date",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "CODE",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "jurnal",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "NAME",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "location",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
],
|
||||
|
||||
headersl: [
|
||||
{
|
||||
text: "#",
|
||||
align: "start",
|
||||
sortable: false,
|
||||
value: "M_ItemDivisionID",
|
||||
width: "20%",
|
||||
class: "pa-3 blue darken-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "DIVISION NAME",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
sort: false,
|
||||
value: "DivisionName",
|
||||
width: "80%",
|
||||
class: "pa-2 blue darken-3 white--text"
|
||||
},
|
||||
],
|
||||
dialogdeletealecoa: false,
|
||||
msgalertcoa: "",
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("a_itemdiv/searchItemA", {
|
||||
current_page: this.$store.state.a_itemdiv.a_current_page,
|
||||
search_item: this.$store.state.a_itemdiv.a_x_search,
|
||||
itemCategoryID: -1,
|
||||
last_id: -1,
|
||||
});
|
||||
|
||||
this.$store.dispatch("a_itemdiv/getDropdownCategoryA");
|
||||
},
|
||||
computed: {
|
||||
dialoggagal: {
|
||||
get() {
|
||||
return this.$store.state.a_itemdiv.dialog_gagal;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("a_itemdiv/update_dialog_gagal", val);
|
||||
},
|
||||
},
|
||||
dialogsuccess: {
|
||||
get() {
|
||||
return this.$store.state.a_itemdiv.dialog_success;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("a_itemdiv/update_dialog_success", val);
|
||||
},
|
||||
},
|
||||
msgsuccess() {
|
||||
return this.$store.state.a_itemdiv.msg_success;
|
||||
},
|
||||
msggagal() {
|
||||
return this.$store.state.a_itemdiv.msg_gagal;
|
||||
},
|
||||
opendialoginfo: {
|
||||
get() {
|
||||
return this.$store.state.a_itemdiv.a_open_dialog_info;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("a_itemdiv/update_a_open_dialog_info", false);
|
||||
},
|
||||
},
|
||||
msginfo: {
|
||||
get() {
|
||||
return this.$store.state.a_itemdiv.a_msg_info;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("a_itemdiv/update_a_msg_info", false);
|
||||
},
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.a_itemdiv.a_alert_success;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("a_itemdiv/update_a_alert_success", val);
|
||||
},
|
||||
},
|
||||
msgSnackbar() {
|
||||
return this.$store.state.a_itemdiv.a_msg_success;
|
||||
},
|
||||
dialog_error: {
|
||||
get() {
|
||||
return this.$store.state.a_itemdiv.a_alert_error;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("a_itemdiv/update_a_alert_error", val);
|
||||
},
|
||||
},
|
||||
msgError() {
|
||||
return this.$store.state.a_itemdiv.a_save_error_message;
|
||||
},
|
||||
|
||||
// search table start
|
||||
xitems() {
|
||||
return this.$store.state.a_itemdiv.items;
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.a_itemdiv.a_search_status === 1;
|
||||
},
|
||||
isLoadingr() {
|
||||
return this.$store.state.a_itemdiv.a_search_statusr === 1;
|
||||
},
|
||||
xsearch: {
|
||||
get() {
|
||||
return this.$store.state.a_itemdiv.a_x_search;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("a_itemdiv/update_a_x_search", val);
|
||||
},
|
||||
},
|
||||
curr_page: {
|
||||
get() {
|
||||
return this.$store.state.a_itemdiv.a_current_page;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("a_itemdiv/update_a_current_page", val);
|
||||
this.$store.commit("a_itemdiv/update_a_last_id", -1);
|
||||
this.searchItem();
|
||||
},
|
||||
},
|
||||
xtotal_page: {
|
||||
get() {
|
||||
return this.$store.state.a_itemdiv.total_item;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("a_itemdiv/update_total_item", val);
|
||||
},
|
||||
},
|
||||
// search table end
|
||||
|
||||
// selected item
|
||||
selected_item() {
|
||||
return this.$store.state.a_itemdiv.selected_item
|
||||
},
|
||||
|
||||
// dropdown category
|
||||
xcategorys() {
|
||||
return this.$store.state.a_itemdiv.categorys
|
||||
},
|
||||
selected_category: {
|
||||
get() {
|
||||
return this.$store.state.a_itemdiv.selected_category
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("a_itemdiv/update_selected_category", val)
|
||||
}
|
||||
},
|
||||
|
||||
// array itemdivision
|
||||
itemDivisionArr() {
|
||||
return this.$store.state.a_itemdiv.item_division_arr;
|
||||
},
|
||||
|
||||
vitemdivisions() {
|
||||
return this.$store.state.a_itemdiv.itemdivisions;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
closeDialogGagal() {
|
||||
this.$store.commit("a_itemdiv/update_dialog_gagal", false);
|
||||
},
|
||||
|
||||
closeDialogSuccess() {
|
||||
this.$store.commit("a_itemdiv/update_dialog_success", false);
|
||||
},
|
||||
|
||||
updateItemDivision() {
|
||||
// console.log("selected_item", this.selected_item);
|
||||
// console.log("itemDivisionArr.length", this.itemDivisionArr.length);
|
||||
// console.log('item division add ', this.$store.state.a_itemdiv.item_division_arr)
|
||||
this.$store.dispatch("a_itemdiv/updateItemDivisionA");
|
||||
},
|
||||
onSelectedChecked(item) {
|
||||
const updatedItem = {
|
||||
...item,
|
||||
IsChecked: item.IsChecked === "1" ? "0" : "1"
|
||||
}
|
||||
|
||||
this.$store.commit("a_itemdiv/update_itemdivision_arr", updatedItem);
|
||||
},
|
||||
searchItem() {
|
||||
let itemCategoryID = 0;
|
||||
|
||||
const selected = this.$store.state.a_itemdiv.selected_category;
|
||||
|
||||
if (selected && typeof selected === 'object' && Object.keys(selected).length > 0) {
|
||||
itemCategoryID = selected.itemCategoryID;
|
||||
}
|
||||
|
||||
this.$store.dispatch("a_itemdiv/searchItemA", {
|
||||
current_page: this.$store.state.a_itemdiv.a_current_page,
|
||||
search_item: this.$store.state.a_itemdiv.a_x_search,
|
||||
itemCategoryID: itemCategoryID,
|
||||
last_id: -1,
|
||||
});
|
||||
},
|
||||
updateAlertSuccess(val) {
|
||||
this.$store.commit("a_itemdiv/update_a_alert_success", val);
|
||||
},
|
||||
isSelected(p) {
|
||||
return p.M_ItemID == this.$store.state.a_itemdiv.selected_item.M_ItemID
|
||||
},
|
||||
selectMe(selected) {
|
||||
if (selected && typeof selected === 'object' && Object.keys(selected).length > 0) {
|
||||
this.$store.commit("a_itemdiv/update_selected_item", selected);
|
||||
this.$store.dispatch("a_itemdiv/itemDivisionListA");
|
||||
} else {
|
||||
console.log('Object Item Selected');
|
||||
}
|
||||
},
|
||||
|
||||
// division check
|
||||
isSelectedDivisionList(p) {
|
||||
return p.M_ItemDivisionID == this.$store.state.a_itemdiv.selected_itemdivision.M_ItemDivisionID
|
||||
},
|
||||
|
||||
selectedMeDivisionList(selected) {
|
||||
if (selected && typeof selected === 'object' && Object.keys(selected).length > 0) {
|
||||
this.$store.commit("a_itemdiv/update_selected_itemdivision", selected);
|
||||
} else {
|
||||
console.log('Object Division List Not Selected');
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
};
|
||||
69
test/vuex/acc-one-md-itemdivision/index.php
Normal file
69
test/vuex/acc-one-md-itemdivision/index.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<!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">
|
||||
<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">
|
||||
<title>One</title>
|
||||
</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 xs12 class="left" fill-height pa-1>
|
||||
<one-itemdiv-list></one-itemdiv-list>
|
||||
</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>
|
||||
|
||||
<!-- App Script -->
|
||||
<script type="module">
|
||||
import {
|
||||
store
|
||||
} from './store.js';
|
||||
window.store = store;
|
||||
new Vue({
|
||||
store,
|
||||
el: '#app',
|
||||
methods: {
|
||||
|
||||
},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-itemdiv-list': httpVueLoader('./components/itemdivList.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
313
test/vuex/acc-one-md-itemdivision/modules/a_itemdiv.js
Normal file
313
test/vuex/acc-one-md-itemdivision/modules/a_itemdiv.js
Normal file
@@ -0,0 +1,313 @@
|
||||
import * as api from "../api/a_itemdiv.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
a_errors_save_coa: [],
|
||||
selected_item: {},
|
||||
items: [],
|
||||
a_save_status: 0,
|
||||
a_save_error_message: '',
|
||||
a_msg_success: '',
|
||||
a_msg_info: '',
|
||||
a_open_dialog_info: false,
|
||||
a_alert_error: false,
|
||||
a_alert_success: false,
|
||||
// search table
|
||||
a_x_search: '',
|
||||
a_current_page: 1,
|
||||
a_last_id: -1,
|
||||
total_item: 0,
|
||||
// search table
|
||||
|
||||
// dropdown category
|
||||
selected_category: {},
|
||||
categorys: [],
|
||||
|
||||
// array item division
|
||||
item_division_arr: [],
|
||||
|
||||
// item division selected
|
||||
selected_itemdivision: {},
|
||||
// list item division
|
||||
itemdivisions: [],
|
||||
|
||||
// state dialog
|
||||
msg_gagal: "",
|
||||
dialog_gagal: false,
|
||||
msg_success: "",
|
||||
dialog_success: false,
|
||||
},
|
||||
mutations: {
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val;
|
||||
},
|
||||
update_dialog_success(state, val) {
|
||||
state.dialog_success = val;
|
||||
},
|
||||
update_msg_gagal(state, val) {
|
||||
state.msg_gagal = val;
|
||||
},
|
||||
update_dialog_gagal(state, val) {
|
||||
state.dialog_gagal = val;
|
||||
},
|
||||
update_a_errors_save_coa(state, val) {
|
||||
state.a_errors_save_coa = val
|
||||
},
|
||||
update_a_search_error_message(state, val) {
|
||||
state.a_search_error_message = val
|
||||
},
|
||||
update_a_search_status(state, val) {
|
||||
state.a_search_status = val
|
||||
},
|
||||
update_a_search_statusr(state, val) {
|
||||
state.a_search_statusr = val
|
||||
},
|
||||
update_selected_item(state, val) {
|
||||
state.selected_item = val
|
||||
},
|
||||
update_items(state, val) {
|
||||
state.items = val
|
||||
},
|
||||
update_a_open_dialog_info(state, val) {
|
||||
state.a_open_dialog_info = val
|
||||
},
|
||||
update_a_msg_info(state, val) {
|
||||
state.a_msg_info = val
|
||||
},
|
||||
update_a_x_search(state, val) {
|
||||
state.a_x_search = val
|
||||
},
|
||||
update_a_current_page(state, val) {
|
||||
state.a_current_page = val
|
||||
},
|
||||
update_a_last_id(state, val) {
|
||||
state.a_last_id = val
|
||||
},
|
||||
update_total_item(state, val) {
|
||||
state.total_item = val
|
||||
},
|
||||
update_a_msg_success(state, val) {
|
||||
state.a_msg_success = val
|
||||
},
|
||||
update_a_save_status(state, val) {
|
||||
state.a_save_status = val
|
||||
},
|
||||
update_a_save_error_message(state, val) {
|
||||
state.a_save_error_message = val
|
||||
},
|
||||
update_a_alert_success(state, val) {
|
||||
state.a_alert_success = val
|
||||
},
|
||||
update_a_alert_error(state, val) {
|
||||
state.a_alert_error = val
|
||||
},
|
||||
update_dialog_add_coa(state, val) {
|
||||
state.dialog_add_coa = val
|
||||
},
|
||||
update_dialog_edit_coa(state, val) {
|
||||
state.dialog_edit_coa = val
|
||||
},
|
||||
update_a_loading_category(state, val) {
|
||||
state.a_loading_nat_group = val
|
||||
},
|
||||
update_e_loading_nat_group(state, val) {
|
||||
state.e_loading_nat_group = val
|
||||
},
|
||||
update_a_nat_group(state, val) {
|
||||
state.a_nat_group = val
|
||||
},
|
||||
update_e_nat_group(state, val) {
|
||||
state.e_nat_group = val
|
||||
},
|
||||
update_a_nat_group_list(state, val) {
|
||||
state.a_nat_group_list = val
|
||||
},
|
||||
update_e_nat_group_list(state, val) {
|
||||
state.e_nat_group_list = val
|
||||
},
|
||||
|
||||
// dropdown category
|
||||
update_selected_category(state, val) {
|
||||
state.selected_category = val
|
||||
},
|
||||
|
||||
update_categorys(state, val) {
|
||||
state.categorys = val
|
||||
},
|
||||
|
||||
// array item division
|
||||
update_item_division_arr(state, val) {
|
||||
state.item_division_arr = val
|
||||
},
|
||||
|
||||
// item division selected
|
||||
update_selected_itemdivision(state, val) {
|
||||
state.selected_itemdivision = val
|
||||
},
|
||||
|
||||
update_itemdivisions(state, val) {
|
||||
state.itemdivisions = val
|
||||
},
|
||||
|
||||
// update item division arr
|
||||
update_itemdivision_arr(state, val) {
|
||||
const idx = state.itemdivisions.findIndex(
|
||||
item => item.M_ItemDivisionID === val.M_ItemDivisionID
|
||||
);
|
||||
|
||||
if (idx !== -1) {
|
||||
state.itemdivisions[idx].IsChecked = val.IsChecked;
|
||||
}
|
||||
|
||||
const arrIndex = state.item_division_arr.findIndex(
|
||||
item => item.M_ItemDivisionID === val.M_ItemDivisionID
|
||||
);
|
||||
|
||||
if (arrIndex !== -1) {
|
||||
state.item_division_arr.splice(arrIndex, 1);
|
||||
state.item_division_arr.push(val);
|
||||
} else {
|
||||
if (val.IsChecked === "1") {
|
||||
state.item_division_arr.push(val);
|
||||
} else {
|
||||
state.item_division_arr.push(val);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
// get category from api
|
||||
async getDropdownCategoryA(context) {
|
||||
context.commit("update_a_loading_category", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.token = one_token()
|
||||
let resp = await api.getDropdownCategory(prm)
|
||||
// console.log('data nat_group ',resp)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_a_loading_category", false)
|
||||
} else {
|
||||
// console.log('data nat_group ',resp.data)
|
||||
context.commit("update_a_loading_category", false)
|
||||
context.commit("update_categorys", resp.data.records)
|
||||
// context.commit("update_selected_category", resp.data.records[0])
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_a_loading_category", false)
|
||||
}
|
||||
},
|
||||
|
||||
// searchItem
|
||||
async searchItemA(context, prm) {
|
||||
context.commit("update_a_search_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchItem(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_a_search_status", 3)
|
||||
context.commit("update_a_search_error_message", resp.message)
|
||||
context.commit("update_a_msg_info", resp.message)
|
||||
context.commit("update_a_open_dialog_info", true)
|
||||
} else {
|
||||
context.commit("update_a_search_status", 2)
|
||||
context.commit("update_a_search_error_message", "")
|
||||
context.commit("update_a_msg_info", resp.message)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
context.commit("update_items", data.records)
|
||||
context.commit("update_total_item", data.total)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_a_search_status", 3)
|
||||
context.commit("update_a_search_error_message", e.message)
|
||||
context.commit("update_a_msg_info", e.message)
|
||||
context.commit("update_a_open_dialog_info", true)
|
||||
}
|
||||
},
|
||||
|
||||
// item division list by item selected
|
||||
async itemDivisionListA(context, prm) {
|
||||
context.commit("update_a_search_status", 1)
|
||||
try {
|
||||
// prm.token = one_token()
|
||||
var prm = {
|
||||
current_page: context.state.current_pager,
|
||||
M_ItemID: context.state.selected_item.M_ItemID,
|
||||
last_id: -1,
|
||||
current_page: -1,
|
||||
token: one_token()
|
||||
};
|
||||
|
||||
let resp = await api.itemDivisionList(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_a_search_status", 3)
|
||||
context.commit("update_a_search_error_message", resp.message)
|
||||
context.commit("update_a_msg_info", resp.message)
|
||||
context.commit("update_a_open_dialog_info", true)
|
||||
} else {
|
||||
context.commit("update_a_search_status", 2)
|
||||
context.commit("update_a_search_error_message", "")
|
||||
context.commit("update_a_msg_info", resp.message)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
context.commit("update_itemdivisions", data.records)
|
||||
// context.commit("update_total_item", data.total)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_a_search_status", 3)
|
||||
context.commit("update_a_search_error_message", e.message)
|
||||
context.commit("update_a_msg_info", e.message)
|
||||
context.commit("update_a_open_dialog_info", true)
|
||||
}
|
||||
},
|
||||
|
||||
// update item division
|
||||
async updateItemDivisionA(context, prm) {
|
||||
context.commit("update_a_search_status", 1)
|
||||
try {
|
||||
var prm = {
|
||||
M_ItemID: context.state.selected_item.M_ItemID,
|
||||
M_ItemDivisionID: context.state.item_division_arr,
|
||||
last_id: -1,
|
||||
current_page: -1,
|
||||
token: one_token()
|
||||
};
|
||||
|
||||
let resp = await api.updateItemDivision(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_a_search_status", 3)
|
||||
context.commit("update_a_search_error_message", resp.message)
|
||||
context.commit("update_a_msg_info", resp.message)
|
||||
context.commit("update_a_open_dialog_info", true)
|
||||
} else {
|
||||
context.commit("update_a_search_status", 2)
|
||||
context.commit("update_a_search_error_message", "")
|
||||
context.commit("update_a_msg_info", resp.message)
|
||||
|
||||
context.commit("update_dialog_success", true);
|
||||
var msg = "Update Sukses";
|
||||
context.commit("update_msg_success", msg);
|
||||
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
context.commit("update_itemdivisions", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_a_search_status", 3)
|
||||
context.commit("update_a_search_error_message", e.message)
|
||||
context.commit("update_a_msg_info", e.message)
|
||||
context.commit("update_a_open_dialog_info", true)
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
12
test/vuex/acc-one-md-itemdivision/store.js
Normal file
12
test/vuex/acc-one-md-itemdivision/store.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
import a_itemdiv from "./modules/a_itemdiv.js";
|
||||
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
system: system,
|
||||
a_itemdiv:a_itemdiv,
|
||||
},
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {},
|
||||
});
|
||||
Reference in New Issue
Block a user