Flatten nested repos
This commit is contained in:
@@ -0,0 +1,314 @@
|
||||
const URL = "/one-api/mockup/process/refdeliverysamplev3/";
|
||||
|
||||
export async function lookup(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/lookup', 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 lookupbydeliveryorderdetail(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/lookupdeliveryorderbydeliveryorderdetail', 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 lookupbydistrict(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/lookupdeliveryorderbydistrict', 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 lookupbykelurahan(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/lookupdeliveryorderbykelurahan', 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 lookupbyname(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/lookupdeliveryorderbyname', 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 lookupbybarcode(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/lookupdeliveryorderbybarcode', 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(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/addnewdeliveryorder', 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(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/editdeliveryorder', 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 xdelete(token,id) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/deletedeliveryorder', { id: id, token:token });
|
||||
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 searchdeliveryorderdetail(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/searchdeliveryorderdetail',{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 searchbranch(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/searchbranch',{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 searchdestination(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/searchdestination',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 searchsample(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/searchsample',{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 searchcourier(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/searchcourier',{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 searchcity(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/searchcity',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 searchdistrict(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/searchdistrict',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 searchkelurahan(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/searchkelurahan',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
|
||||
};
|
||||
}
|
||||
}
|
||||
92
test/vuex/one-process-ref-delivery-sample-v3/api/sample.js
Normal file
92
test/vuex/one-process-ref-delivery-sample-v3/api/sample.js
Normal file
@@ -0,0 +1,92 @@
|
||||
const URL = "/one-api/mockup/process/refdeliverysamplev3/";
|
||||
|
||||
export async function selected(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/selected_sample', 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 selectedbybarcode(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/selected_samplebybarcode', 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 lookupbyname(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/lookupsamplebyname', 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 searchcourier(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/searchcourier',{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 save(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'refdeliverysamplev3/confirmdeliveryorder', 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
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<v-menu
|
||||
v-model="menu2"
|
||||
:close-on-content-click="false"
|
||||
:nudge-right="40"
|
||||
lazy
|
||||
transition="scale-transition"
|
||||
offset-y
|
||||
full-width
|
||||
max-width="290px"
|
||||
min-width="290px"
|
||||
>
|
||||
<v-text-field
|
||||
slot="activator"
|
||||
v-model="computedDateFormatted"
|
||||
:label=init_label
|
||||
persistent-hint
|
||||
readonly
|
||||
browser-autocomplete="off"
|
||||
></v-text-field>
|
||||
<v-date-picker v-model="init_date" no-title @input="menu2 = false" :max="init_max_date"></v-date-picker>
|
||||
</v-menu>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
props : ['label', 'date', 'data', 'max_date'],
|
||||
|
||||
data () {
|
||||
return {
|
||||
init_date: this.date && this.date != "0000-00-00" ? this.date : null, //new Date().toISOString().substr(0, 10),
|
||||
init_max_date: this.max_date ? this.max_date : '2999-09-09',
|
||||
dateFormatted: this.formatDate(new Date().toISOString().substr(0, 10)),
|
||||
menu1: false,
|
||||
menu2: false,
|
||||
|
||||
init_label: this.label ? this.label : 'Date',
|
||||
init_data: this.data ? this.data : ''
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
computedDateFormatted () {
|
||||
return this.formatDate(this.init_date)
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
init_date (n, o) {
|
||||
this.dateFormatted = this.formatDate(this.init_date)
|
||||
|
||||
this.$emit('change', {"old_date":o, "new_date":n, "data":this.init_data});
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
formatDate (date) {
|
||||
if (!date) { return null }
|
||||
|
||||
const [year, month, day] = date.split('-')
|
||||
return `${day}-${month}-${year}`
|
||||
},
|
||||
parseDate (date) {
|
||||
if (!date) return null
|
||||
|
||||
const [month, day, year] = date.split('/')
|
||||
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`
|
||||
},
|
||||
|
||||
emitChange (n, o) {
|
||||
console.log("old:"+o)
|
||||
console.log("new:"+n)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
110
test/vuex/one-process-ref-delivery-sample-v3/index.php
Normal file
110
test/vuex/one-process-ref-delivery-sample-v3/index.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<!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/vuetify.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div v-cloak id="app">
|
||||
<v-app id="smartApp" >
|
||||
<one-navbar></one-navbar>
|
||||
<v-content class="blue lighten-5" >
|
||||
<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>
|
||||
<!-- komponen kiri -->
|
||||
<one-md-deliveryorder-list></one-md-deliveryorder-list>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="left" fill-height pa-1>
|
||||
<!-- komponen kiri -->
|
||||
<one-md-sample-list></one-md-sample-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 -->
|
||||
<?php
|
||||
$ts = "?ts=" . Date("ymdhis");
|
||||
?>
|
||||
<script type="module">
|
||||
import { store } from './store.js<?php echo $ts ?>';
|
||||
//for testing
|
||||
// window.store = store;
|
||||
new Vue({
|
||||
store,
|
||||
el: '#app',
|
||||
mounted(){
|
||||
document.addEventListener('keypress',logKeyboard)
|
||||
window.key_enter = ''
|
||||
let self = this;
|
||||
async function logKeyboard(e) {
|
||||
|
||||
window.key_enter = (window.key_enter + e.key).toUpperCase()
|
||||
if(e.key == 'Enter') {
|
||||
var prm = window.key_enter.replace('ENTER','').trim()
|
||||
// await store.dispatch("samplecall/search_staff",prm)
|
||||
await store.dispatch("deliveryorder/lookupbybarcode", {
|
||||
deliveryorder: self.$store.state.deliveryorder.init_date,
|
||||
detail: self.$store.state.sample.selected,
|
||||
search: prm,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
let cek = self.$store.state.deliveryorder.xcek + 1
|
||||
self.$store.commit("deliveryorder/update_xcek", cek)
|
||||
window.key_enter = ''
|
||||
let arr = self.$store.state.sample.selected
|
||||
console.log(arr)
|
||||
var idx = arr.findIndex(item => item.nosample === prm)
|
||||
console.log(prm)
|
||||
console.log(idx)
|
||||
arr[idx].ischoose = 'Y'
|
||||
self.$store.commit("sample/update_samples", arr)
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-md-deliveryorder-list': httpVueLoader('./components/oneDeliveryOrderList.vue'),
|
||||
'one-md-sample-list': httpVueLoader('./components/oneSampleList.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
.left {
|
||||
}
|
||||
.right {
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,786 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/deliveryorder.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
last_id: -1,
|
||||
act: 'new',
|
||||
lookup_deliveryorder: 0,
|
||||
lookup_error_message: '',
|
||||
deliveryorders: [],
|
||||
total_deliveryorders: 0,
|
||||
total_filter_deliveryorders: 0,
|
||||
startdate: moment(new Date()).format('DD-MM-YYYY'),
|
||||
selected_deliveryorder: {},
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_deliveryorder: false,
|
||||
dialog_edit_form_deliveryorder: false,
|
||||
alert_success: false,
|
||||
msg_success: "",
|
||||
show_all: 'N',
|
||||
errors: [],
|
||||
deliveryordertypes: [],
|
||||
deliveryordertype: {},
|
||||
branchs: [],
|
||||
branch: {},
|
||||
destinations: [],
|
||||
destination: {},
|
||||
samples: [],
|
||||
sample: {},
|
||||
couriers: [],
|
||||
courier: {},
|
||||
get_data_status: 0,
|
||||
get_data_error_message: '',
|
||||
cities: [],
|
||||
deliveryorderdetail_address: {},
|
||||
autocomplete_status: 0,
|
||||
search_status: 0,
|
||||
autocitys: [],
|
||||
autocity: {},
|
||||
autodistricts: [],
|
||||
autodistrict: {},
|
||||
autokelurahans: [],
|
||||
autokelurahan: {},
|
||||
nonlabs: [],
|
||||
selected_nonlab: {},
|
||||
current_page: 1,
|
||||
x_search: '',
|
||||
isexternal: 'N',
|
||||
init_date: moment().format("Y-M-D"),
|
||||
xcek: 0
|
||||
},
|
||||
mutations: {
|
||||
update_xcek(state, val) {
|
||||
state.xcek = val
|
||||
},
|
||||
update_init_date(state, val) {
|
||||
state.init_date = val
|
||||
},
|
||||
update_isexternal(state, val) {
|
||||
state.isexternal = val
|
||||
},
|
||||
update_x_search(state, val) {
|
||||
state.x_search = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_last_id(state, val) {
|
||||
state.last_id = val
|
||||
},
|
||||
update_act(state, val) {
|
||||
state.act = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_show_all(state, val) {
|
||||
state.show_all = val
|
||||
},
|
||||
update_startdate(state, val) {
|
||||
state.startdate = val
|
||||
},
|
||||
update_lookup_error_message(state, status) {
|
||||
state.lookup_error_message = status
|
||||
},
|
||||
update_lookup_deliveryorder(state, status) {
|
||||
state.lookup_deliveryorder = status
|
||||
},
|
||||
update_deliveryorders(state, data) {
|
||||
state.deliveryorders = data.records
|
||||
state.total_deliveryorders = data.total
|
||||
state.total_filter_deliveryorders = data.total_filter
|
||||
},
|
||||
update_selected_deliveryorder(state, val) {
|
||||
state.selected_deliveryorder = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_deliveryorder(state, val) {
|
||||
state.dialog_form_deliveryorder = val
|
||||
},
|
||||
update_dialog_edit_form_deliveryorder(state, val) {
|
||||
state.dialog_edit_form_deliveryorder = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
},
|
||||
update_deliveryordertypes(state, data) {
|
||||
state.deliveryordertypes = data
|
||||
},
|
||||
update_deliveryordertype(state, val) {
|
||||
state.deliveryordertype = val
|
||||
},
|
||||
update_branchs(state, data) {
|
||||
state.branchs = data
|
||||
},
|
||||
update_branch(state, val) {
|
||||
state.branch = val
|
||||
},
|
||||
update_destinations(state, data) {
|
||||
state.destinations = data
|
||||
},
|
||||
update_destination(state, val) {
|
||||
state.destination = val
|
||||
},
|
||||
update_samples(state, data) {
|
||||
state.samples = data
|
||||
},
|
||||
update_sample(state, val) {
|
||||
state.sample = val
|
||||
},
|
||||
update_couriers(state, data) {
|
||||
state.couriers = data
|
||||
},
|
||||
update_courier(state, val) {
|
||||
state.courier = val
|
||||
},
|
||||
update_autocitys(state, data) {
|
||||
state.autocitys = data
|
||||
},
|
||||
update_autocity(state, val) {
|
||||
state.autocity = val
|
||||
},
|
||||
update_autodistricts(state, data) {
|
||||
state.autodistricts = data
|
||||
},
|
||||
update_autodistrict(state, val) {
|
||||
state.autodistrict = val
|
||||
},
|
||||
update_autokelurahans(state, data) {
|
||||
state.autokelurahans = data
|
||||
},
|
||||
update_autokelurahan(state, val) {
|
||||
state.autokelurahan = val
|
||||
},
|
||||
update_get_data_status(state, val) {
|
||||
state.get_data_status = val
|
||||
},
|
||||
update_get_data_error_message(state, val) {
|
||||
state.get_data_error_message = val
|
||||
},
|
||||
update_cities(state, val) {
|
||||
state.cities = val
|
||||
},
|
||||
update_deliveryorderdetail_address(state, val) {
|
||||
state.deliveryorderdetail_address = val
|
||||
},
|
||||
update_autocomplete_status(state, val) {
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_districts(state, val) {
|
||||
state.districts = val
|
||||
},
|
||||
update_district_address(state, val) {
|
||||
state.district_address = val
|
||||
},
|
||||
update_kelurahans(state, val) {
|
||||
state.kelurahans = val
|
||||
},
|
||||
update_kelurahan_address(state, val) {
|
||||
state.kelurahan_address = val
|
||||
},
|
||||
update_instruments(state, data) {
|
||||
state.instruments = data
|
||||
},
|
||||
update_instrument(state, val) {
|
||||
state.instrument = val
|
||||
},
|
||||
update_autotemplates(state, data) {
|
||||
state.autotemplates = data
|
||||
},
|
||||
update_autotemplate(state, val) {
|
||||
state.autotemplate = val
|
||||
},
|
||||
update_nonlabs(state, val) {
|
||||
state.nonlabs = val
|
||||
},
|
||||
update_selected_nonlab(state, val) {
|
||||
state.selected_nonlab = val
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
actions: {
|
||||
async lookup(context, prm) {
|
||||
context.commit("update_lookup_deliveryorder", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookup(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_deliveryorder", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter
|
||||
}
|
||||
context.commit("update_deliveryorders", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbydeliveryorderdetail(context, prm) {
|
||||
context.commit("update_lookup_deliveryorder", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbydeliveryorderdetail(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_deliveryorder", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter
|
||||
}
|
||||
context.commit("update_deliveryorders", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbydistrict(context, prm) {
|
||||
context.commit("update_lookup_deliveryorder", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbydistrict(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_deliveryorder", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter
|
||||
}
|
||||
context.commit("update_deliveryorders", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbykelurahan(context, prm) {
|
||||
context.commit("update_lookup_deliveryorder", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbykelurahan(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_deliveryorder", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter
|
||||
}
|
||||
context.commit("update_deliveryorders", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbyname(context, prm) {
|
||||
context.commit("update_lookup_deliveryorder", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbyname(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_deliveryorder", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter,
|
||||
branchid: resp.data.branchid,
|
||||
branchname: resp.data.branchname
|
||||
}
|
||||
context.commit("update_deliveryorders", data)
|
||||
console.log(data.branchname)
|
||||
context.commit("update_branchs", [{
|
||||
M_BranchID: data.branchid,
|
||||
M_BranchName: data.branchname
|
||||
}])
|
||||
context.commit("update_branch", {
|
||||
M_BranchID: data.branchid,
|
||||
M_BranchName: data.branchname
|
||||
})
|
||||
//context.dispatch("sample/selected", null,{ root: true })
|
||||
if (prm.lastid === -1) {
|
||||
context.commit("update_selected_deliveryorder", data.records[0])
|
||||
var pat = data.records[0]
|
||||
if(data.total !== 0){
|
||||
context.dispatch("sample/selected", {
|
||||
id: pat.id
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_couriers", [{
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
}else{
|
||||
context.dispatch("sample/selected", {
|
||||
id: 0
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_couriers", [], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {}, {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
|
||||
} else {
|
||||
context.commit("update_selected_deliveryorder", data.records[prm.lastid])
|
||||
var pat = data.records[prm.lastid]
|
||||
if(data.total !== 0){
|
||||
context.dispatch("sample/selected", {
|
||||
id: pat.id
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_couriers", [{
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
}else{
|
||||
context.dispatch("sample/selected", {
|
||||
id: 0
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_couriers", [], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {}, {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbybarcode(context, prm) {
|
||||
context.commit("update_lookup_deliveryorder", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbybarcode(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_deliveryorder", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter,
|
||||
branchid: resp.data.branchid,
|
||||
branchname: resp.data.branchname
|
||||
}
|
||||
console.log(data.branchname)
|
||||
context.commit("update_branchs", [{
|
||||
M_BranchID: data.branchid,
|
||||
M_BranchName: data.branchname
|
||||
}])
|
||||
context.commit("update_branch", {
|
||||
M_BranchID: data.branchid,
|
||||
M_BranchName: data.branchname
|
||||
})
|
||||
//context.dispatch("sample/selected", null,{ root: true })
|
||||
if (prm.lastid === -1) {
|
||||
context.commit("update_selected_deliveryorder", data.records[0])
|
||||
var pat = data.records[0]
|
||||
if(data.total !== 0){
|
||||
var cek = context.state.xcek
|
||||
console.log('cek di modules')
|
||||
console.log(cek)
|
||||
if(cek === 0){
|
||||
context.dispatch("sample/selectedbybarcode", {
|
||||
id: pat.id,
|
||||
barcode: prm.search,
|
||||
detail: prm.detail
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
context.commit("sample/update_couriers", [{
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
}else{
|
||||
context.dispatch("sample/selected", {
|
||||
id: 0
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_couriers", [], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {}, {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
|
||||
} else {
|
||||
context.commit("update_selected_deliveryorder", data.records[prm.lastid])
|
||||
var pat = data.records[prm.lastid]
|
||||
if(data.total !== 0){
|
||||
context.dispatch("sample/selected", {
|
||||
id: pat.id,
|
||||
barcode: prm.search
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_couriers", [{
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
}else{
|
||||
context.dispatch("sample/selected", {
|
||||
id: 0
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_couriers", [], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {}, {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async save(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.save(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form_deliveryorder", false)
|
||||
var msg = " Surat Jalan sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("lookupbyname", {
|
||||
deliveryorder: prm.sdeliveryorder,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
// context.dispatch("sample/selected", null, { root: true })
|
||||
|
||||
} else {
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async update(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.update(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form_deliveryorder", false)
|
||||
var msg = " Surat Jalan sudah terupdate dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
// context.dispatch("sample/selected", null, { root: true })
|
||||
context.dispatch("lookupbyname", {
|
||||
deliveryorder: prm.sdeliveryorder,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
} else {
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async delete(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xdelete(one_token(), prm.deliveryorderid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_alert_success", true)
|
||||
|
||||
var msg = " Surat Jalan sudah dihapus dong"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_selected_deliveryorder", {})
|
||||
// context.dispatch("sample/selected", null, { root: true })
|
||||
context.dispatch("lookupbyname", {
|
||||
deliveryorder: prm.sdeliveryorder,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async searchdeliveryorderdetail(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchdeliveryorderdetail(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,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_cities", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchbranch(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchbranch(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,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_branchs", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchdestination(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchdestination(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
} else {
|
||||
context.commit("update_autocomplete_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_destinations", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchsample(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchsample(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,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_samples", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchcourier(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchcourier(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,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_couriers", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchcity(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchcity(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
} else {
|
||||
context.commit("update_autocomplete_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autocitys", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchdistrict(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchdistrict(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
} else {
|
||||
context.commit("update_autocomplete_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autodistricts", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchkelurahan(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchkelurahan(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
} else {
|
||||
context.commit("update_autocomplete_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autokelurahans", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
300
test/vuex/one-process-ref-delivery-sample-v3/modules/sample.js
Normal file
300
test/vuex/one-process-ref-delivery-sample-v3/modules/sample.js
Normal file
@@ -0,0 +1,300 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/sample.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
samples: [],
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_sample: false,
|
||||
dialog_status_order: false,
|
||||
lookup_sample: 0,
|
||||
search_status: 0,
|
||||
errors: [],
|
||||
startdate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
enddate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
bases: [],
|
||||
base: {},
|
||||
omzettypes: [],
|
||||
omzettype: {},
|
||||
sampletypes: [],
|
||||
sampletype: {},
|
||||
agingtypes: [],
|
||||
agingtype: {},
|
||||
statuss: [],
|
||||
autodeliveryorders:[],
|
||||
autodeliveryorder:{},
|
||||
autocitys:[],
|
||||
autocity:{},
|
||||
autodistricts:[],
|
||||
autodistrict:{},
|
||||
autokelurahans:[],
|
||||
autokelurahan:{},
|
||||
current_page:1,
|
||||
x_search: '',
|
||||
total_data: 0,
|
||||
total_datasemua: 0,
|
||||
total_dataterima: 0,
|
||||
selected_sample: {
|
||||
name: ""
|
||||
},
|
||||
selected: [],
|
||||
lookup_selected_sample: 0,
|
||||
lookup_error_message: '',
|
||||
couriers: [],
|
||||
courier: {},
|
||||
xcek: 0,
|
||||
in_saving: false
|
||||
},
|
||||
mutations: {
|
||||
update_in_saving(state, val) {
|
||||
state.in_saving = val
|
||||
},
|
||||
update_xcek(state, val) {
|
||||
state.xcek = val
|
||||
},
|
||||
update_selected_sample(state, val) {
|
||||
state.selected_sample = val
|
||||
},
|
||||
update_x_search(state, val) {
|
||||
state.x_search = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_total_data(state, val) {
|
||||
state.total_data = val
|
||||
},
|
||||
update_total_datasemua(state, val) {
|
||||
state.total_datasemua = val
|
||||
},
|
||||
update_total_dataterima(state, val) {
|
||||
state.total_dataterima = val
|
||||
},
|
||||
update_autodeliveryorders(state,data){
|
||||
state.autodeliveryorders = data
|
||||
},
|
||||
update_autodeliveryorder(state,val){
|
||||
state.autodeliveryorder = val
|
||||
},
|
||||
update_autocitys(state,data){
|
||||
state.autocitys = data
|
||||
},
|
||||
update_autocity(state,val){
|
||||
state.autocity = val
|
||||
},
|
||||
update_autodistricts(state,data){
|
||||
state.autodistricts = data
|
||||
},
|
||||
update_autodistrict(state,val){
|
||||
state.autodistrict = val
|
||||
},
|
||||
update_autokelurahans(state,data){
|
||||
state.autokelurahans = data
|
||||
},
|
||||
update_autokelurahan(state,val){
|
||||
state.autokelurahan = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_samples(state, data) {
|
||||
state.samples = data
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_sample(state, val) {
|
||||
state.dialog_form_sample = val
|
||||
},
|
||||
update_lookup_sample(state, val) {
|
||||
state.lookup_sample = val
|
||||
},
|
||||
update_startdate(state, val) {
|
||||
state.startdate = val
|
||||
},
|
||||
update_enddate(state, val) {
|
||||
state.enddate = val
|
||||
},
|
||||
update_bases(state, data) {
|
||||
state.bases = data
|
||||
},
|
||||
update_base(state, val) {
|
||||
state.base = val
|
||||
},
|
||||
update_omzettypes(state, data) {
|
||||
state.omzettypes = data
|
||||
},
|
||||
update_omzettype(state, val) {
|
||||
state.omzettype = val
|
||||
},
|
||||
update_sampletypes(state, data) {
|
||||
state.sampletypes = data
|
||||
},
|
||||
update_sampletype(state, val) {
|
||||
state.sampletype = val
|
||||
},
|
||||
update_agingtypes(state, data) {
|
||||
state.agingtypes = data
|
||||
},
|
||||
update_agingtype(state, val) {
|
||||
state.agingtype = val
|
||||
},
|
||||
update_search_status(state, val) {
|
||||
state.search_status = val
|
||||
},
|
||||
update_statuss(state, data) {
|
||||
state.statuss = data
|
||||
},
|
||||
update_dialog_status_order(state, val) {
|
||||
state.dialog_status_order = val
|
||||
},
|
||||
update_selected(state,data) {
|
||||
state.selected = data
|
||||
},
|
||||
update_lookup_selected_sample(state, val) {
|
||||
state.lookup_selected_sample=val
|
||||
},
|
||||
update_lookup_error_message(state, status) {
|
||||
state.lookup_error_message = status
|
||||
},
|
||||
update_couriers(state, data) {
|
||||
state.couriers = data
|
||||
},
|
||||
update_courier(state, val) {
|
||||
state.courier = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async selected(context,prm) {
|
||||
context.commit("update_lookup_selected_sample", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.selected(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_selected_sample", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_selected_sample", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
context.commit("update_selected", resp.data.records)
|
||||
context.commit("update_total_data", resp.data.total)
|
||||
context.commit("update_total_datasemua", resp.data.semua)
|
||||
context.commit("update_total_dataterima", resp.data.terima)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_selected_sample", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async selectedbybarcode(context,prm) {
|
||||
context.commit("update_lookup_selected_sample", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.selectedbybarcode(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_selected_sample", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_selected_sample", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
context.commit("update_selected", resp.data.records)
|
||||
context.commit("update_total_data", resp.data.total)
|
||||
context.commit("update_total_datasemua", resp.data.semua)
|
||||
context.commit("update_total_dataterima", resp.data.terima)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_selected_sample", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbyname(context,prm) {
|
||||
context.commit("update_lookup_selected_sample", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbyname(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_selected_sample", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_selected_sample", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
context.commit("update_selected", resp.data.records)
|
||||
context.commit("update_total_data", resp.data.total)
|
||||
context.commit("update_total_datasemua", resp.data.semua)
|
||||
context.commit("update_total_dataterima", resp.data.terima)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_selected_sample", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async searchcourier(context, prm) {
|
||||
context.commit("deliveryorder/update_autocomplete_status", 1,{ root: true })
|
||||
try {
|
||||
let resp = await api.searchcourier(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("deliveryorder/update_autocomplete_status", 3,{ root: true })
|
||||
} else {
|
||||
context.commit("deliveryorder/update_autocomplete_status", 2,{ root: true })
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_couriers", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("deliveryorder/update_autocomplete_status", 3,{ root: true })
|
||||
}
|
||||
},
|
||||
async save(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.save(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("deliveryorder/update_alert_success", true,{ root: true })
|
||||
var msg = "Serah terima sampel telah berhasil"
|
||||
context.commit("deliveryorder/update_msg_success", msg,{ root: true })
|
||||
context.commit("deliveryorder/uupdate_selected_deliveryorder", data.records[0],{ root: true })
|
||||
context.commit("update_xcek", 0)
|
||||
context.dispatch("deliveryorder/lookupbyname", {
|
||||
deliveryorder: prm.sdeliveryorder,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
},{ root: true })
|
||||
context.dispatch("selected", {
|
||||
id: prm.id
|
||||
})
|
||||
context.commit("update_in_saving", false)
|
||||
} else {
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
25
test/vuex/one-process-ref-delivery-sample-v3/store.js
Normal file
25
test/vuex/one-process-ref-delivery-sample-v3/store.js
Normal file
@@ -0,0 +1,25 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import deliveryorder from "./modules/deliveryorder.js";
|
||||
import sample from "./modules/sample.js";
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
deliveryorder: deliveryorder,
|
||||
sample: sample,
|
||||
system:system
|
||||
},
|
||||
state: {
|
||||
|
||||
},
|
||||
mutations: {
|
||||
|
||||
},
|
||||
actions: {
|
||||
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user