first commit + add fe component vue accone
This commit is contained in:
227
test/vuex/acc-one-md-item/api/item.js
Normal file
227
test/vuex/acc-one-md-item/api/item.js
Normal file
@@ -0,0 +1,227 @@
|
||||
const URL = "/one-api/mockup/masterdata/accounting/";
|
||||
|
||||
export async function getGroup(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "mditem/get_group_filter", 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(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "mditem/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 getCategory(token, prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "mditem/get_category", {
|
||||
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 getGroupX(token, prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "mditem/get_group", {
|
||||
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 get_subgroup(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "mditem/get_subgroup", 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 get_fa_class(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "mditem/get_fa_class", 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 get_inventaris_gol(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "mditem/get_inventaris_gol", 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 get_unit(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "mditem/get_unit", 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 save_item(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "mditem/save_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 update_item(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "mditem/update_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 delete_item(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "mditem/delete_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,
|
||||
};
|
||||
}
|
||||
}
|
||||
1466
test/vuex/acc-one-md-item/components/oneMdItemList.vue
Normal file
1466
test/vuex/acc-one-md-item/components/oneMdItemList.vue
Normal file
File diff suppressed because it is too large
Load Diff
69
test/vuex/acc-one-md-item/index.php
Normal file
69
test/vuex/acc-one-md-item/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-md-item-list></one-md-item-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-md-item-list': httpVueLoader('./components/oneMdItemList.vue'),
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
470
test/vuex/acc-one-md-item/modules/item.js
Normal file
470
test/vuex/acc-one-md-item/modules/item.js
Normal file
@@ -0,0 +1,470 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/item.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
autocomplete_status: 0,
|
||||
search_error_message: "",
|
||||
groups: [],
|
||||
selected_group: {"Nat_GroupID": "0", "Nat_GroupName": "All"},
|
||||
search_status: 0,
|
||||
items: [],
|
||||
total_page: 0,
|
||||
selected_item: {},
|
||||
current_page: 1,
|
||||
xsearch: "",
|
||||
dialog_form: false,
|
||||
act: "new",
|
||||
categories: [],
|
||||
selected_category: {},
|
||||
group_x: [],
|
||||
selected_group_x: {},
|
||||
subgroups: [],
|
||||
selected_subgroup: {},
|
||||
fa_class: [],
|
||||
selected_fa_class: {},
|
||||
fa_inventaris_gol: [],
|
||||
selected_fa_inventaris_gol: {},
|
||||
errors: [],
|
||||
item_units: [],
|
||||
selected_item_unit: {},
|
||||
class_type: [
|
||||
{"id": 1, "Fa_ClassType": "Kendaraan", "flagtype": "vehicle"},
|
||||
{"id": 2, "Fa_ClassType": "Operasional", "flagtype": "operational"},
|
||||
{"id": 3, "Fa_ClassType": "Gedung", "flagtype": "building"},
|
||||
{"id": 4, "Fa_ClassType": "Mechanical Elektrical & IT", "flagtype": "meit"},
|
||||
{"id": 5, "Fa_ClassType": "Software & Laboratorium System", "flagtype": "software"},
|
||||
{"id": 6, "Fa_ClassType": "Peralatan Kantor", "flagtype": "office"},
|
||||
{"id": 7, "Fa_ClassType": "Peralatan Umum", "flagtype": "general"},
|
||||
{"id": 8, "Fa_ClassType": "Tanah", "flagtype": "land"},
|
||||
],
|
||||
selected_class_type: {},
|
||||
|
||||
save_status: 0,
|
||||
item_errors: [],
|
||||
alert_success: false,
|
||||
alert_error: false,
|
||||
msg_success: "",
|
||||
save_error_message: "",
|
||||
opendialoginfo: false,
|
||||
msginfo: "",
|
||||
last_id: 0,
|
||||
},
|
||||
mutations: {
|
||||
update_autocomplete_status(state, val) {
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_search_error_message(state, val) {
|
||||
state.search_error_message = val
|
||||
},
|
||||
update_groups(state, val) {
|
||||
state.groups = val
|
||||
},
|
||||
update_selected_group(state, val) {
|
||||
state.selected_group = val
|
||||
},
|
||||
update_search_status(state, val) {
|
||||
state.search_status = val
|
||||
},
|
||||
update_items(state, val) {
|
||||
state.items = val
|
||||
},
|
||||
update_total_page(state, val) {
|
||||
state.total_page = val
|
||||
},
|
||||
update_selected_item(state, val) {
|
||||
state.selected_item = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_xsearch(state, val) {
|
||||
state.xsearch = val
|
||||
state.current_page = 1
|
||||
},
|
||||
update_dialog_form(state, val) {
|
||||
state.dialog_form = val
|
||||
},
|
||||
update_act(state, val) {
|
||||
state.act = val
|
||||
},
|
||||
update_categories(state, val) {
|
||||
state.categories = val
|
||||
},
|
||||
update_selected_category(state, val) {
|
||||
state.selected_category = val
|
||||
},
|
||||
update_group_x(state, val) {
|
||||
state.group_x = val
|
||||
},
|
||||
update_selected_group_x(state, val) {
|
||||
state.selected_group_x = val
|
||||
},
|
||||
update_subgroups(state, val) {
|
||||
state.subgroups = val
|
||||
},
|
||||
update_selected_subgroup(state, val) {
|
||||
state.selected_subgroup = val
|
||||
},
|
||||
update_fa_class(state, val) {
|
||||
state.fa_class = val
|
||||
},
|
||||
update_selected_fa_class(state, val) {
|
||||
state.selected_fa_class = val
|
||||
},
|
||||
update_fa_inventaris_gol(state, val) {
|
||||
state.fa_inventaris_gol = val
|
||||
},
|
||||
update_selected_fa_inventaris_gol(state, val) {
|
||||
state.selected_fa_inventaris_gol = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_item_units(state, val) {
|
||||
state.item_units = val
|
||||
},
|
||||
update_selected_item_unit(state, val) {
|
||||
state.selected_item_unit = val
|
||||
},
|
||||
update_class_type(state, val) {
|
||||
state.class_type = val
|
||||
},
|
||||
update_selected_class_type(state, val) {
|
||||
state.selected_class_type = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_item_errors(state, val) {
|
||||
state.item_errors = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_alert_error(state, val) {
|
||||
state.alert_error = val
|
||||
},
|
||||
update_opendialoginfo(state, val) {
|
||||
state.opendialoginfo = val
|
||||
},
|
||||
update_msginfo(state, val) {
|
||||
state.msginfo = val
|
||||
},
|
||||
update_last_id(state, val) {
|
||||
state.last_id = val
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async getGroup(context) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.getGroup({ token: one_token() });
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
} else {
|
||||
context.commit("update_search_error_message", "")
|
||||
context.commit("update_autocomplete_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
};
|
||||
|
||||
context.commit("update_groups", data.records);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_error_message", e.message)
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async search(context, prm) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.search(prm);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
context.commit("update_search_status", 3)
|
||||
} else {
|
||||
context.commit("update_search_error_message", "")
|
||||
context.commit("update_search_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total_page: resp.data.total_page,
|
||||
};
|
||||
|
||||
context.commit("update_items", data.records);
|
||||
context.commit("update_total_page", data.total_page);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_error_message", e.message)
|
||||
context.commit("update_search_status", 3)
|
||||
}
|
||||
},
|
||||
async getCategory(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.getCategory(one_token(), prm);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
} else {
|
||||
context.commit("update_search_error_message", "")
|
||||
context.commit("update_autocomplete_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
};
|
||||
|
||||
context.commit("update_categories", data.records);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_error_message", e.message)
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async getGroupX(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.getGroupX(one_token(), prm);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
} else {
|
||||
context.commit("update_search_error_message", "")
|
||||
context.commit("update_autocomplete_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
};
|
||||
|
||||
context.commit("update_group_x", data.records);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_error_message", e.message)
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async get_subgroup(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.get_subgroup(prm);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
} else {
|
||||
context.commit("update_search_error_message", "")
|
||||
context.commit("update_autocomplete_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
};
|
||||
|
||||
context.commit("update_subgroups", data.records);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_error_message", e.message)
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async get_fa_class(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.get_fa_class(prm);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
} else {
|
||||
context.commit("update_search_error_message", "")
|
||||
context.commit("update_autocomplete_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
};
|
||||
|
||||
context.commit("update_fa_class", data.records);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_error_message", e.message)
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async get_inventaris_gol(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.get_inventaris_gol(prm);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
} else {
|
||||
context.commit("update_search_error_message", "")
|
||||
context.commit("update_autocomplete_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
};
|
||||
|
||||
context.commit("update_fa_inventaris_gol", data.records);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_error_message", e.message)
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async get_unit(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.get_unit(prm);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
} else {
|
||||
context.commit("update_search_error_message", "")
|
||||
context.commit("update_autocomplete_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
};
|
||||
|
||||
context.commit("update_item_units", data.records);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_error_message", e.message)
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
|
||||
// save item
|
||||
async save_item(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.save_item(prm);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_alert_error", true)
|
||||
} else {
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
};
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_item_errors", [])
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form", false)
|
||||
var msg = "Item " + prm.itemname + " sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("search", {
|
||||
current_page: context.state.current_page,
|
||||
search: context.state.xsearch,
|
||||
group_id: context.state.selected_group.Nat_GroupID
|
||||
})
|
||||
} else {
|
||||
context.commit("update_item_errors", resp.data.errors)
|
||||
context.commit("update_opendialoginfo", true)
|
||||
context.commit("update_msginfo", resp.data.errors[0].msg)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_error_message", e.message)
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_alert_error", true)
|
||||
}
|
||||
},
|
||||
|
||||
// edit item
|
||||
async update_item(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.update_item(prm);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_alert_error", true)
|
||||
} else {
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
};
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_item_errors", [])
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form", false)
|
||||
var msg = "Item " + prm.itemname + " sudah terupdate dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("search", {
|
||||
current_page: context.state.current_page,
|
||||
search: context.state.xsearch,
|
||||
group_id: context.state.selected_group.Nat_GroupID
|
||||
})
|
||||
} else {
|
||||
context.commit("update_item_errors", [])
|
||||
context.commit("update_opendialoginfo", true)
|
||||
context.commit("update_msginfo", "error update")
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_error_message", e.message)
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_alert_error", true)
|
||||
}
|
||||
},
|
||||
|
||||
// delete item
|
||||
async delete_item(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.delete_item(prm);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_alert_error", true)
|
||||
} else {
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
};
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_item_errors", [])
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form", false)
|
||||
var msg = "Item " + prm.itemname + " sudah terhapus dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("search", {
|
||||
current_page: context.state.current_page,
|
||||
search: context.state.xsearch,
|
||||
group_id: context.state.selected_group.Nat_GroupID
|
||||
})
|
||||
} else {
|
||||
context.commit("update_item_errors", [])
|
||||
context.commit("update_opendialoginfo", true)
|
||||
context.commit("update_msginfo", "error delete")
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_error_message", e.message)
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_alert_error", true)
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
17
test/vuex/acc-one-md-item/store.js
Normal file
17
test/vuex/acc-one-md-item/store.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import item from "./modules/item.js";
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
item: item,
|
||||
system: system
|
||||
},
|
||||
state: {
|
||||
|
||||
},
|
||||
mutations: {
|
||||
|
||||
},
|
||||
actions: {
|
||||
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user