Flatten nested repos
This commit is contained in:
88
test/vuex/one-process-ref-out-status/api/order.js
Normal file
88
test/vuex/one-process-ref-out-status/api/order.js
Normal file
@@ -0,0 +1,88 @@
|
||||
const URL = "/one-api/mockup/refout/status/";
|
||||
|
||||
export async function search(search, is_internal, status) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'status/search', {
|
||||
search: search,
|
||||
is_internal: is_internal,
|
||||
status: status
|
||||
});
|
||||
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_sample(header_id) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'status/search_sample', {
|
||||
header_id: header_id
|
||||
});
|
||||
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_courier() {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'status/search_courier', {});
|
||||
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 send(token, header_id, ids, courier_id) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'status/send', {
|
||||
token: token,
|
||||
header_id: header_id,
|
||||
courier_id: courier_id,
|
||||
ids: ids
|
||||
});
|
||||
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,346 @@
|
||||
<template>
|
||||
<v-layout class="fill-height" column>
|
||||
|
||||
<v-card class="mb-2 pa-2 searchbox">
|
||||
<v-layout >
|
||||
<v-flex xs5>
|
||||
<v-select
|
||||
:items="statuses"
|
||||
v-model="selected_status"
|
||||
item-value="val"
|
||||
item-text="label"
|
||||
outline
|
||||
hide-details
|
||||
class="ma-1"
|
||||
></v-select>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs4>
|
||||
<v-select
|
||||
:items="ref_type"
|
||||
v-model="is_internal"
|
||||
item-value="val"
|
||||
item-text="label"
|
||||
outline
|
||||
hide-details
|
||||
class="ma-1"
|
||||
></v-select>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs3>
|
||||
<v-text-field class="ma-1"
|
||||
label=""
|
||||
placeholder="Pencarian"
|
||||
single-line
|
||||
outline
|
||||
v-model="query"
|
||||
hide-details
|
||||
:height="height"
|
||||
@keyup.native="searchUp"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
|
||||
<v-btn class="xs3 ma-1 one-btn-icon" color="success" @click="search">
|
||||
<span class="icon-search"></span>
|
||||
</v-btn>
|
||||
<!-- <v-spacer></v-spacer>
|
||||
<v-btn color="primary" :disabled="selected_order.length < 1" :dark="selected_order.length > 0" class=" one-btn-icon" @click="sendSome">
|
||||
<v-icon>send</v-icon>
|
||||
</v-btn> -->
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<v-card >
|
||||
<v-layout row>
|
||||
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="orders"
|
||||
: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.T_OrderRefOutHeaderDate.split(" "))[0].split('-').reverse().join('-') }}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.company_name }}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.T_OrderRefOutHeaderNumber }}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.T_OrderRefOutHeaderIsSent == 'Y' ? 'Sudah Serah Terima' : 'Belum Serah Terima' }}</td>
|
||||
<td class="text-xs-left pr-1 pl-1 pa-0" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
|
||||
<v-btn color="orange" small dark class="ma-0" v-show="props.item.T_OrderRefOutHeaderIsSent == 'Y'" @click="printSJMe(props.item)">Cetak SJ</v-btn>
|
||||
</td>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
</v-data-table>
|
||||
<v-pagination
|
||||
v-model="curr_order_page"
|
||||
:length="total_order_page"
|
||||
:total-visible="5"
|
||||
@input="change_page"
|
||||
></v-pagination>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
|
||||
<v-snackbar
|
||||
v-model="snackbar"
|
||||
top
|
||||
>
|
||||
Order berhasil dikirim
|
||||
<v-btn flat color="red" @click.native="snackbar = false">Tutup</v-btn>
|
||||
</v-snackbar>
|
||||
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
table tr th:first-child {
|
||||
background-color: #90caf9!important;
|
||||
border-color: #90caf9!important;
|
||||
}
|
||||
/* .searchbox .v-input.v-text-field .v-input__slot{
|
||||
min-height:50px;
|
||||
} */
|
||||
/* .v-autocomplete.v-text-field--enclosed:not(.v-text-field--solo):not(.v-text-field--single-line) .v-select__slot>input {
|
||||
margin-top: 14px;
|
||||
} */
|
||||
.searchbox .v-btn {
|
||||
min-height:50px;
|
||||
}
|
||||
table.v-table tbody td,table.v-table tbody th {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
table.v-table thead tr {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.searchbox .one-btn-icon {
|
||||
font-size: 1.5em
|
||||
}
|
||||
|
||||
/* Overwrite */
|
||||
.v-text-field--box>.v-input__control>.v-input__slot,
|
||||
.v-text-field--full-width>.v-input__control>.v-input__slot,
|
||||
.v-text-field--outline>.v-input__control>.v-input__slot {
|
||||
align-items: stretch;
|
||||
min-height: 50px
|
||||
}
|
||||
|
||||
.v-text-field--box .v-label, .v-text-field--full-width .v-label, .v-text-field--outline .v-label {
|
||||
top: 12px;
|
||||
}
|
||||
|
||||
.v-text-field.v-text-field--enclosed .v-input__append-inner {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.v-text-field--outline.v-text-field--single-line input {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.v-select.v-text-field--enclosed:not(.v-text-field--single-line) .v-select__selections {
|
||||
padding-top: 6px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components : {
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
headers: [
|
||||
{
|
||||
text: "TANGGAL",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "13%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "TUJUAN RUJUKAN",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "22%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NOMOR RUJUKAN",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "20%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "STATUS",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "20%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "CETAK",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "10%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
}
|
||||
],
|
||||
|
||||
pagination : {
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 5,
|
||||
sortBy: 'T_OrderRefOutHeaderNumber',
|
||||
totalItems: this.$store.state.order.total_order
|
||||
},
|
||||
|
||||
ref_type : [
|
||||
{val:'N', label:'Rujuk Eksternal'},
|
||||
{val:'Y', label:'Rujuk Internal'}
|
||||
],
|
||||
|
||||
height: 50
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
|
||||
query : {
|
||||
get () {
|
||||
return this.$store.state.order.query
|
||||
},
|
||||
set (v) {
|
||||
this.$store.commit('order/update_query', v)
|
||||
}
|
||||
},
|
||||
|
||||
orders () {
|
||||
return this.$store.state.order.orders
|
||||
},
|
||||
|
||||
isLoading () {
|
||||
return false
|
||||
},
|
||||
|
||||
is_loading () {
|
||||
return false
|
||||
},
|
||||
|
||||
total_order_page () {
|
||||
return this.$store.state.order.total_order_page
|
||||
},
|
||||
|
||||
curr_order_page : {
|
||||
get () { return this.$store.state.order.curr_order_page },
|
||||
set (v) { this.$store.commit('order/update_curr_order_page', v) }
|
||||
},
|
||||
|
||||
snackbar : {
|
||||
get () { return this.$store.state.order.snackbar },
|
||||
set (v) { this.$store.commit('order/update_snackbar', v) }
|
||||
},
|
||||
|
||||
selected_order : {
|
||||
get () { return this.$store.state.order.selected_order },
|
||||
set (v) { this.$store.commit('order/update_selected_order', v) }
|
||||
},
|
||||
|
||||
is_internal : {
|
||||
get () { return this.$store.state.order.is_internal },
|
||||
set (v) {
|
||||
this.$store.commit('order/update_is_internal', v)
|
||||
this.search()
|
||||
}
|
||||
},
|
||||
|
||||
statuses () {
|
||||
return this.$store.state.order.statuses
|
||||
},
|
||||
|
||||
selected_status : {
|
||||
get () { return this.$store.state.order.selected_status },
|
||||
set (v) {
|
||||
this.$store.commit('order/update_selected_status', v)
|
||||
this.search()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.$store.dispatch('order/search')
|
||||
},
|
||||
|
||||
methods : {
|
||||
isSelected(p) {
|
||||
let x = this.$store.state.order.selected_order
|
||||
if (!x)
|
||||
return false
|
||||
|
||||
if (x.T_OrderRefOutHeaderID == p.T_OrderRefOutHeaderID)
|
||||
return true
|
||||
|
||||
return false
|
||||
},
|
||||
|
||||
search() {
|
||||
this.$store.dispatch("order/search")
|
||||
},
|
||||
|
||||
searchUp(e) {
|
||||
if (e.which == 13) {
|
||||
this.search()
|
||||
}
|
||||
},
|
||||
|
||||
selectMe(doc) {
|
||||
this.$store.commit('order/update_selected_order', doc)
|
||||
this.$store.dispatch('order/search_sample')
|
||||
|
||||
this.$store.commit('order/update_selected_courier', {M_CourierID:doc.M_CourierID, M_StaffName:doc.M_StaffName})
|
||||
},
|
||||
|
||||
one_money (x) {
|
||||
return window.one_money(x)
|
||||
},
|
||||
|
||||
change_page(x) {
|
||||
this.curr_order_page = x
|
||||
this.$store.dispatch('order/search')
|
||||
},
|
||||
|
||||
sendMe (doc) {
|
||||
this.$store.dispatch("order/send", doc.T_OrderRefOutID)
|
||||
},
|
||||
|
||||
sendSome (doc) {
|
||||
if (this.selected_order.length < 1) {
|
||||
alert('Tidak ada yang perlu di kirim')
|
||||
return
|
||||
}
|
||||
|
||||
let x = []
|
||||
for (let i in this.selected_order)
|
||||
x.push(this.selected_order[i].T_OrderRefOutID)
|
||||
|
||||
this.$store.dispatch("order/send", x.join(","))
|
||||
},
|
||||
|
||||
printSJMe (x) {
|
||||
this.$store.commit('order/update_dialog_print', true);
|
||||
}
|
||||
},
|
||||
|
||||
watch : {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,69 @@
|
||||
<template>
|
||||
|
||||
<v-dialog
|
||||
v-model="dialog"
|
||||
width="1000px"
|
||||
>
|
||||
|
||||
|
||||
<v-card>
|
||||
<v-card-title
|
||||
class="headline grey lighten-2 pt-2 pb-2"
|
||||
primary-title
|
||||
>
|
||||
Cetak Surat Jalan
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-2 pb-2">
|
||||
<v-layout>
|
||||
<v-flex xs12>
|
||||
<v-divider class="mt-1 mb-1"></v-divider>
|
||||
<object :data="rpt_url"
|
||||
width="100%" height="512px"></object>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
|
||||
<v-btn
|
||||
color="primary"
|
||||
@click="dialog = false"
|
||||
flat
|
||||
>
|
||||
Tutup
|
||||
</v-btn>
|
||||
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components : {
|
||||
},
|
||||
methods : {
|
||||
},
|
||||
computed : {
|
||||
dialog: {
|
||||
get() {
|
||||
return this.$store.state.order.dialog_print;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit('order/update_dialog_print', val);
|
||||
}
|
||||
},
|
||||
|
||||
rpt_url () {
|
||||
return this.$store.state.order.rpt_url
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<v-layout class="fill-height" column>
|
||||
|
||||
<v-card class="mb-2 pa-2 fill-height">
|
||||
<v-card-text class="grow pa-1">
|
||||
<v-layout >
|
||||
<v-flex xs5>
|
||||
<v-layout row wrap v-show="selected_order">
|
||||
<!-- <v-flex xs12>
|
||||
<v-text-field
|
||||
outline
|
||||
hide-details
|
||||
solo
|
||||
label="Scan Barcode Specimen"
|
||||
v-model="query_barcode"
|
||||
@keyup.native="barcodeMeUp"
|
||||
></v-text-field>
|
||||
|
||||
<hr class="mt-2">
|
||||
</v-flex> -->
|
||||
|
||||
<v-flex xs12>
|
||||
<v-select
|
||||
:items="couriers"
|
||||
v-model="selected_courier"
|
||||
item-value="M_CourierID"
|
||||
item-text="M_StaffName"
|
||||
return-object
|
||||
label="Pilih Kurir"
|
||||
hide-details
|
||||
outline
|
||||
:disabled="selected_order.T_OrderRefOutHeaderIsSent == 'Y'"
|
||||
></v-select>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs12 pt-3>
|
||||
<p class="body-1 mb-1">Tujuan pengiriman :</p>
|
||||
<hr class="mt-1 mb-2">
|
||||
<h3 class="title mb-1">{{ selected_order ? selected_order.company_name : '' }}</h3>
|
||||
<p class="body-1 mb-1">{{ selected_order ? selected_order.company_address : '' }}</p>
|
||||
<p class="body-1 mb-1">Kel. {{ selected_order ? selected_order.M_KelurahanName : '' }}</p>
|
||||
<p class="body-1 mb-1">Kec. {{ selected_order ? selected_order.M_DistrictName : '' }}</p>
|
||||
<p class="body-1 mb-1">{{ selected_order ? selected_order.M_CityName : '' }}</p>
|
||||
<hr class="mt-2 mb-2">
|
||||
</v-flex>
|
||||
|
||||
|
||||
|
||||
<v-flex xs12 class="text-xs-right">
|
||||
<v-spacer></v-spacer>
|
||||
<!-- <v-btn color="orange"
|
||||
@click="printDO"
|
||||
dark>Cetak SJ</v-btn> -->
|
||||
|
||||
<v-btn color="success"
|
||||
:disabled="!selected_courier.M_CourierID || selected_sample_length == 0"
|
||||
:dark="selected_sample_length > 0 && selected_courier.M_CourierID > 0"
|
||||
@click="send">Serahkan ke Kurir</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs7 pl-3>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field
|
||||
outline
|
||||
hide-details
|
||||
solo
|
||||
label="Scan Barcode Specimen"
|
||||
v-model="query_barcode"
|
||||
@keyup.native="barcodeMeUp"
|
||||
:disabled="selected_order.T_OrderRefOutHeaderIsSent == 'Y'"
|
||||
></v-text-field>
|
||||
<hr class="mt-2 mb-1">
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
|
||||
<v-btn color="success" v-for="(sample, n) in samples"
|
||||
v-bind:key="n"
|
||||
small
|
||||
class="mr-2 mb-2 ma-0"
|
||||
:outline="sample.selected == 'N'"
|
||||
:dark="sample.selected == 'Y'"
|
||||
:disabled="selected_order.T_OrderRefOutHeaderIsSent == 'Y'"
|
||||
block
|
||||
@click="barcodeClick(sample)">{{sample.T_BarcodeLabBarcode}} - {{sample.T_SampleTypeName}}</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
</v-flex>
|
||||
|
||||
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
|
||||
<!-- <v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="success"
|
||||
:disabled="!selected_courier.M_CourierID || selected_sample_length == 0"
|
||||
:dark="selected_sample_length > 0 && selected_courier.M_CourierID > 0"
|
||||
@click="send">Kirim</v-btn>
|
||||
</v-card-actions> -->
|
||||
|
||||
</v-card>
|
||||
|
||||
|
||||
<v-snackbar
|
||||
v-model="snackbar"
|
||||
top
|
||||
>
|
||||
Order berhasil diserahkan ke kurir
|
||||
<v-btn flat color="red" @click.native="snackbar = false">Tutup</v-btn>
|
||||
</v-snackbar>
|
||||
|
||||
<one-process-ref-out-status-sent></one-process-ref-out-status-sent>
|
||||
<one-process-ref-out-status-print-dialog></one-process-ref-out-status-print-dialog>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components : {
|
||||
'one-process-ref-out-status-sent' : httpVueLoader('./oneProcessRefOutStatusSent.vue'),
|
||||
'one-process-ref-out-status-print-dialog' : httpVueLoader('./oneProcessRefOutStatusPrintDialog.vue')
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
query_barcode: "",
|
||||
pagination:{
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 5,
|
||||
sortBy: 'T_OrderRefOutHeaderNumber',
|
||||
totalItems: this.$store.state.order.total_order
|
||||
},
|
||||
|
||||
height: 50
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
samples () {
|
||||
return this.$store.state.order.samples
|
||||
},
|
||||
|
||||
couriers () {
|
||||
return this.$store.state.order.couriers
|
||||
},
|
||||
|
||||
selected_courier : {
|
||||
get () { return this.$store.state.order.selected_courier },
|
||||
set (v) { this.$store.commit('order/update_selected_courier', v) }
|
||||
},
|
||||
|
||||
selected_sample_length () {
|
||||
let n = 0
|
||||
for (let i in this.samples) {
|
||||
if (this.samples[i].selected == "Y")
|
||||
n++
|
||||
}
|
||||
|
||||
return n
|
||||
},
|
||||
|
||||
selected_order () {
|
||||
return this.$store.state.order.selected_order
|
||||
},
|
||||
|
||||
snackbar : {
|
||||
get () { return this.$store.state.order.snackbar },
|
||||
set (v) { this.$store.commit('order/update_snackbar', v) }
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.$store.dispatch('order/search_courier')
|
||||
|
||||
},
|
||||
|
||||
methods : {
|
||||
barcodeMeUp(e) {
|
||||
if (e.which == 13) {
|
||||
return this.barcodeMe(e)
|
||||
}
|
||||
},
|
||||
|
||||
barcodeMe (e) {
|
||||
let x = this.query_barcode
|
||||
let y = this.samples
|
||||
let found = false
|
||||
for (let i in y) {
|
||||
if (y[i].T_BarcodeLabBarcode == x) {
|
||||
found = true
|
||||
if (y[i].selected == 'N')
|
||||
y[i].selected = "Y"
|
||||
else
|
||||
alert('Sampel tersebut sudah dibarcode !!!')
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
this.$store.commit('order/update_samples', {records:y})
|
||||
else
|
||||
alert('No barcode Found !!!')
|
||||
|
||||
e.target.select()
|
||||
},
|
||||
|
||||
barcodeClick (x) {
|
||||
x.selected = x.selected == "Y" ? "N" : "Y"
|
||||
let y = this.samples
|
||||
for (let i in y) {
|
||||
if (y[i].T_BarcodeLabBarcode == x.T_BarcodeLabBarcode)
|
||||
y[i] = x
|
||||
}
|
||||
|
||||
this.$store.commit('order/update_samples', {records:y})
|
||||
},
|
||||
|
||||
send () {
|
||||
this.$store.dispatch('order/send')
|
||||
},
|
||||
|
||||
printDO () {
|
||||
return
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
watch : {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,60 @@
|
||||
<template>
|
||||
<v-dialog
|
||||
v-model="dialog"
|
||||
persistent
|
||||
max-width="500px"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-text>
|
||||
<h3 class="title mb-2">Serah terima kurir berhasil.</h3>
|
||||
<h3 class="subheading">Nomor SJ : {{ selected_order.T_OrderRefOutHeaderNumber }}</h3>
|
||||
<h3 class="subheading">Kurir : {{ selected_courier.M_StaffName }}</h3>
|
||||
|
||||
</v-card-text>
|
||||
|
||||
<v-card-actions>
|
||||
<v-btn color="primary" flat @click="dialog=false">Tutup</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="orange" dark @click="printSJ">Cetak Surat Jalan</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data () {
|
||||
return {
|
||||
}
|
||||
},
|
||||
|
||||
computed : {
|
||||
selected_order () {
|
||||
return this.$store.state.order.selected_order
|
||||
},
|
||||
|
||||
selected_courier () {
|
||||
return this.$store.state.order.selected_courier
|
||||
},
|
||||
|
||||
dialog : {
|
||||
get () { return this.$store.state.order.dialog_finish },
|
||||
set (v) { this.$store.commit('order/update_dialog_finish', v) }
|
||||
}
|
||||
},
|
||||
|
||||
methods : {
|
||||
printSJ () {
|
||||
this.$store.commit('order/update_dialog_print', true)
|
||||
}
|
||||
},
|
||||
|
||||
watch : {
|
||||
dialog (val, old) {
|
||||
if (!val && old) {
|
||||
this.$store.dispatch('order/search')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
81
test/vuex/one-process-ref-out-status/index.php
Normal file
81
test/vuex/one-process-ref-out-status/index.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<!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 style="background:#F5E8DF!important" >
|
||||
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
|
||||
<v-layout row wrap >
|
||||
<v-flex xs6 class="left" fill-height pa-1>
|
||||
<one-process-ref-out-status-list></one-process-ref-out-status-list>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs6 class="left" fill-height pa-1>
|
||||
<one-process-ref-out-status-sample></one-process-ref-out-status-sample>
|
||||
</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',
|
||||
methods: {
|
||||
tab_selected : function(tab) {
|
||||
return this.$store.state.tab_selected == tab
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-process-ref-out-status-list': httpVueLoader('./components/oneProcessRefOutStatusList.vue'),
|
||||
'one-process-ref-out-status-sample': httpVueLoader('./components/oneProcessRefOutStatusSample.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
.left {
|
||||
}
|
||||
.right {
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
227
test/vuex/one-process-ref-out-status/modules/order.js
Normal file
227
test/vuex/one-process-ref-out-status/modules/order.js
Normal file
@@ -0,0 +1,227 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/order.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
search_status: 0,
|
||||
search_error_message: '',
|
||||
|
||||
query: '',
|
||||
orders: [],
|
||||
selected_order: {},
|
||||
total_order: 0,
|
||||
total_order_page: 0,
|
||||
curr_order_page: 1,
|
||||
|
||||
is_internal: "N",
|
||||
snackbar: false,
|
||||
selected_order: [],
|
||||
|
||||
statuses: [{"val":"N", "label":"Belum Serah Terima"}, {"val":"Y", "label":"Sudah Serah Terima"}],
|
||||
selected_status: "N",
|
||||
|
||||
samples: [],
|
||||
selected_sample: {},
|
||||
|
||||
couriers: [],
|
||||
selected_courier: {},
|
||||
|
||||
dialog_finish: false,
|
||||
dialog_print: false,
|
||||
rpt_url: ''
|
||||
},
|
||||
mutations: {
|
||||
|
||||
update_search_error_message(state, order) {
|
||||
state.search_error_message = order
|
||||
},
|
||||
|
||||
update_search_status(state, v) {
|
||||
state.search_status = v
|
||||
},
|
||||
|
||||
update_query(state, q) {
|
||||
state.query = q
|
||||
},
|
||||
|
||||
update_orders(state, d) {
|
||||
state.orders = d.records
|
||||
state.total_order = d.total
|
||||
state.total_order_page = d.total_page
|
||||
},
|
||||
|
||||
update_selected_order(state, d) {
|
||||
state.selected_order = d
|
||||
},
|
||||
|
||||
update_curr_order_page(state, d) {
|
||||
state.curr_order_page = d
|
||||
},
|
||||
|
||||
update_is_internal(state, d) {
|
||||
state.is_internal = d
|
||||
},
|
||||
|
||||
update_snackbar(state, d) {
|
||||
state.snackbar = d
|
||||
},
|
||||
|
||||
update_selected_order(state, d) {
|
||||
state.selected_order = d
|
||||
},
|
||||
|
||||
update_selected_status(state, d) {
|
||||
state.selected_status = d
|
||||
},
|
||||
|
||||
update_samples(state, d) {
|
||||
state.samples = d.records
|
||||
},
|
||||
|
||||
update_selected_sample(state, d) {
|
||||
state.selected_sample = d
|
||||
},
|
||||
|
||||
update_couriers(state, d) {
|
||||
state.couriers = d.records
|
||||
},
|
||||
|
||||
update_selected_courier(state, d) {
|
||||
state.selected_courier = d
|
||||
},
|
||||
|
||||
update_dialog_finish(state, d) {
|
||||
state.dialog_finish = d
|
||||
},
|
||||
|
||||
update_dialog_print(state, d) {
|
||||
state.dialog_print = d
|
||||
},
|
||||
|
||||
update_rpt_dialog(state, d) {
|
||||
state.rpt_url = d
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
|
||||
try {
|
||||
let resp = await api.search(context.state.query, context.state.is_internal, context.state.selected_status)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_page: resp.data.total_page
|
||||
}
|
||||
|
||||
context.commit("update_orders", data)
|
||||
|
||||
try {
|
||||
context.commit('update_selected_order', data.records[0])
|
||||
context.commit('update_selected_courier', {M_CourierID:data.records[0].M_CourierID, M_StaffName:data.records[0].M_StaffName})
|
||||
context.dispatch('search_sample')
|
||||
} catch (error) {
|
||||
context.commit('update_selected_order', {})
|
||||
context.commit('update_samples', {records:[]})
|
||||
context.commit('update_selected_courier', {})
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
},
|
||||
|
||||
async search_sample(context) {
|
||||
|
||||
try {
|
||||
let resp = await api.search_sample(context.state.selected_order.T_OrderRefOutHeaderID)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_page: resp.data.total_page
|
||||
}
|
||||
|
||||
context.commit("update_samples", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
|
||||
context.commit('update_samples', {records:[]})
|
||||
}
|
||||
},
|
||||
|
||||
async search_courier(context) {
|
||||
|
||||
try {
|
||||
let resp = await api.search_courier()
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
|
||||
context.commit("update_couriers", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
},
|
||||
|
||||
async send(context) {
|
||||
|
||||
try {
|
||||
let samples = context.state.samples
|
||||
let x = []
|
||||
for (let i in samples)
|
||||
if (samples[i].selected == "Y")
|
||||
x.push(samples[i].T_OrderRefOutSampleID)
|
||||
|
||||
if (x.length < 1) {
|
||||
alert('Tidak ada sampel yang dikirim !')
|
||||
return
|
||||
}
|
||||
|
||||
let resp = await api.send(one_token(), context.state.selected_order.T_OrderRefOutHeaderID, JSON.stringify(x), context.state.selected_courier.M_CourierID)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
|
||||
context.commit('update_snackbar', true)
|
||||
context.commit('update_dialog_finish', true)
|
||||
// context.dispatch('search')
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
test/vuex/one-process-ref-out-status/store.js
Normal file
26
test/vuex/one-process-ref-out-status/store.js
Normal file
@@ -0,0 +1,26 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import order from "./modules/order.js";
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
order: order,
|
||||
system: system
|
||||
},
|
||||
|
||||
state: {
|
||||
dialog_confirm: false
|
||||
},
|
||||
|
||||
mutations: {
|
||||
update_dialog_confirm(state, v) {
|
||||
state.dialog_confirm = v
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user