Initial import

This commit is contained in:
sas.fajri
2026-05-25 20:01:37 +07:00
commit 710d7c1b97
10371 changed files with 2381698 additions and 0 deletions

View File

@@ -0,0 +1,248 @@
const URL = "/one-api/mockup/masterdata/";
export async function search_company(token, search) {
try {
var resp = await axios.post(URL + 'price/search_company', {
token:token,
search:search
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function search_company_2(token) {
try {
var resp = await axios.post(URL + 'price/search_company_2', {
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 search_single_company(token, id) {
try {
var resp = await axios.post(URL + 'price/search_single_company', {
token:token,
id: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 copy_price(token, source_id, target_id, disc) {
try {
var resp = await axios.post(URL + 'price/copy_price', {
token: token,
source_id: source_id,
target_id: target_id,
disc: disc
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function search_mou(token, company, query) {
try {
var resp = await axios.post(URL + 'price/search_mou', {
token:token,
company_id: company,
search: query
});
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_price(token, mou, query, page) {
try {
var resp = await axios.post(URL + 'price/search_price', {
token:token,
mou_id: mou,
search: query,
page: page
});
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 del_price(token, id) {
try {
var resp = await axios.post(URL + 'price/del_price', {
token:token,
id: 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_px(token, query) {
try {
var resp = await axios.post(URL + 'price/search_px', {
token:token,
search: query
});
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_px(token, datax, datay) {
try {
var resp = await axios.post(URL + 'price/save_px', {
token:token,
data: datax,
data_others: datay
});
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_addon(token, query) {
try {
var resp = await axios.post(URL + 'price/search_addon', {
token:token,
search: query
});
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_addon(token, name) {
try {
var resp = await axios.post(URL + 'price/save_addon', {
token:token,
name: name
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,56 @@
<template>
<v-dialog
v-model="dialog"
persistent
:overlay="false"
max-width="400px"
transition="dialog-transition"
>
<v-card>
<v-card-title primary-title color="orange">
<h3 class="title">DUPLIKASI HARGA</h3>
</v-card-title>
<v-card-text>
<v-layout row wrap>
<v-flex xs12>
<one-md-price-copy-list></one-md-price-copy-list>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-btn color="primary" flat dark @click="dialog=!dialog">Tutup</v-btn>
<v-spacer></v-spacer>
<v-btn color="primary" dark @click="save">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
components : {
'one-md-price-copy-list': httpVueLoader('./oneMdPriceCopyList.vue')
},
data() {
return {
}
},
computed : {
dialog : {
get() { return this.$store.state.price_copy.dialog_copy },
set(v) { this.$store.commit('price_copy/update_dialog_copy', v) }
}
},
methods : {
save () {
this.$store.dispatch('price_copy/save_copy')
}
}
}
</script>

View File

@@ -0,0 +1,238 @@
<template>
<v-layout row wrap>
<v-flex xs12 mb-5>
<h5 class="caption">Target Agreement</h5>
<v-divider class="mt-1 mb-1"></v-divider>
<h3 class="title">{{target_company.M_CompanyName}} > {{target_mou.M_MouName}}</h3>
</v-flex>
<v-flex xs12 mb-2>
<h5 class="caption">Sumber Agreement</h5>
<v-divider class="mt-1 mb-1"></v-divider>
</v-flex>
<v-flex xs12>
<v-autocomplete
label="Kelompok Pelanggan"
v-model="selected_company"
:items="companies"
:search-input.sync="query_company"
auto-select-first
no-filter
return-object
clearable
item-text="M_CompanyName"
:loading="is_loading"
no-data-text="Pilih Kel. Pelanggan"
>
<template
slot="item"
slot-scope="{ item }"
>
<v-list-tile-content>
<v-list-tile-title v-text="item.M_CompanyName"></v-list-tile-title>
<!-- <v-list-tile-sub-title v-text="'aaa'"></v-list-tile-sub-title> -->
</v-list-tile-content>
</template>
</v-autocomplete>
</v-flex>
<v-flex xs12>
<v-select class="xs12" :items="mous"
item-text="M_MouName"
item-value="M_MouID"
return-object
v-model="selected_mou"
label="Agreement"></v-select>
</v-flex>
<v-flex xs12>
<v-text-field
label="Diskon"
v-model="target_disc"
></v-text-field>
</v-flex>
<!-- <v-btn class="xs3 ma-1" color="info" @click="set" >Baru</v-btn> -->
</v-layout>
<!-- -->
</template>
<style scoped>
.searchbox .v-input.v-text-field .v-input__slot{
min-height:60px;
}
.searchbox .v-btn {
min-height:60px;
}
table.v-table tbody td,table.v-table tbody th {
height: 40px;
}
table.v-table thead tr {
height: 40px;
}
.searchbox .one-btn-icon {
font-size: 1.5em
}
</style>
<script>
module.exports = {
components : {
},
mounted() {
},
methods : {
search_price() {
return
},
thr_search: _.debounce( function () {
this.$store.dispatch("price_copy/search_company")
}, 700),
one_money (x) {
return window.one_money(x)
},
copy_me (p) {
this.selectMe(p)
this.$store.dispatch('price_copy/save_copy')
}
},
computed: {
query_company : {
get () {
return this.$store.state.price_copy.query_company
},
set (v) {
this.$store.commit('price_copy/update_query_company', v)
}
},
search_mou : {
get () {
return this.$store.state.price_copy.search_mou
},
set (v) {
this.$store.commit('price_copy/update_search_mou', v)
}
},
companies : {
get () {
return this.$store.state.price_copy.companies
},
set (v) {
this.$store.commit('price_copy/update_companies', v)
}
},
mous : {
get () {
return this.$store.state.price_copy.mous
},
set (v) {
this.$store.commit('price_copy/update_mous', v)
}
},
selected_company : {
get () {
return this.$store.state.price_copy.selected_company
},
set (v) {
this.$store.commit('price_copy/update_selected_company', v)
}
},
selected_mou : {
get () {
return this.$store.state.price_copy.selected_mou
},
set (v) {
this.$store.commit('price_copy/update_selected_mou', v)
}
},
query_mou : {
get () {
return this.$store.state.price_copy.query_mou
},
set (v) {
this.$store.commit('price_copy/update_query_mou', v)
}
},
isLoading () {
return false
},
is_loading () {
return false
},
dialog_confirm () {
return this.$store.state.dialog_confirm
},
target_disc : {
get () { return this.$store.state.price_copy.target_disc },
set (v) { this.$store.commit('price_copy/update_target_disc', v)}
},
target_company () {
let x = this.$store.state.price.selected_company
if (x) return x
return {}
},
target_mou () {
let x = this.$store.state.price.selected_mou
if (x) return x
return {}
}
},
data() {
return {
expand : false
};
},
watch : {
query_company(val, old) {
if (val == null || typeof val == 'undefined') val = ""
// console.log("1-val:"+val)
if (val == old ) return
// console.log("2-val:"+val)
// if (! val) return
// console.log("3-val:"+val)
// if (val.length < 1 ) return
// console.log("4-val:"+val)
if (this.$store.state.price.search_status == 1 ) return
// console.log("5-val:"+val)
this.$store.commit("price_copy/update_query_company", val)
this.thr_search()
}
}
}
</script>

View File

@@ -0,0 +1,294 @@
<template>
<v-layout class="fill-height" column>
<v-card class="mb-2 pa-2 searchbox">
<v-layout row>
<v-flex xs12>
<v-text-field class="xs6 ma-1"
label=""
placeholder="Pencarian"
single-line
outline
v-model="query_mou"
hide-details
@keyup.native="keySearch"
></v-text-field>
</v-flex>
<v-flex xs12>
<v-autocomplete
label="Kelompok Pelanggan"
v-model="selected_company"
:items="companies"
:search-input.sync="query_company"
auto-select-first
no-filter
return-object
clearable
item-text="M_CompanyName"
:loading="is_loading"
no-data-text="Pilih Kel. Pelanggan"
hide-details
outline
class="ma-1"
>
<template
slot="item"
slot-scope="{ item }"
>
<v-list-tile-content>
<v-list-tile-title v-text="item.M_CompanyName"></v-list-tile-title>
<!-- <v-list-tile-sub-title v-text="'aaa'"></v-list-tile-sub-title> -->
</v-list-tile-content>
</template>
</v-autocomplete>
<!-- <v-autocomplete
class="xs6 ma-1" :items="companies"
item-text="M_CompanyName"
item-value="M_CompanyID"
return-object
v-model="selected_company"
label="Company" outline hide-details
@change="search_mou"></v-autocomplete> -->
<!-- <v-select class="xs6 ma-1" :items="companies"
item-text="M_CompanyName"
item-value="M_CompanyID"
return-object
v-model="selected_company"
label="Company" outline hide-details
@change="search_mou"></v-select> -->
</v-flex>
<v-flex xs3 pr-0 pa-1>
<v-btn color="success" class="ma-0 one-btn-icon" fill-height @click="search_mou">
<span class="icon-search"></span>
</v-btn>
</v-flex>
<!-- <v-btn class="xs3 ma-1" color="success" @click="search_mou" >Search</v-btn> -->
<!-- <v-btn class="xs3 ma-1" color="info" @click="set" >Baru</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="mous"
:loading="isLoading"
:pagination.sync="pagination"
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.M_MouName }}</td>
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.M_MouStartDate }}</td>
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.M_MouEndDate }}</td>
<!-- <td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.status}}</td> -->
</template>
<template>
<div class="text-xs-center">
<v-pagination
:length="15"
:total-visible="7"
></v-pagination>
</div>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-card>
</v-layout>
</template>
<style scoped>
.searchbox .v-input.v-text-field .v-input__slot{
min-height:60px;
}
.searchbox .v-btn {
min-height:60px;
}
table.v-table tbody td,table.v-table tbody th {
height: 40px;
}
table.v-table thead tr {
height: 40px;
}
.one-btn-icon {
font-size: 1.5em
}
</style>
<script>
module.exports = {
components : {
},
mounted() {
this.$store.dispatch("price/search_company")
var url_string = window.location.href
var url = new URL(url_string);
var id = url.searchParams.get("id");
if (id) {
this.$store.dispatch('price/search_single_company', id)
}
},
methods : {
isSelected(p) {
let x = this.$store.state.price.selected_mou
for(let i in x)
if (p.M_MouID == x.M_MouID)
return true
return false
},
search_mou() {
this.$store.dispatch("price/search_mou")
},
selectMe(doc) {
this.$store.commit('price/update_selected_mou', doc)
this.$store.dispatch('price/search_price')
},
keySearch(e) {
if (e.which == 13) {
this.search_mou()
}
},
thr_search: _.debounce( function () {
this.$store.dispatch("price/search_company")
}, 700)
},
computed: {
companies : {
get () {
return this.$store.state.price.companies
},
set (v) {
this.$store.commit('price/update_companies', v)
}
},
mous : {
get () {
return this.$store.state.price.mous
},
set (v) {
this.$store.commit('price/update_mous', v)
}
},
selected_company : {
get () {
return this.$store.state.price.selected_company
},
set (v) {
this.$store.commit('price/update_selected_company', v)
this.$store.dispatch('price/search_mou')
}
},
selected_mou : {
get () {
return this.$store.state.price.selected_mou
},
set (v) {
this.$store.commit('price/update_selected_mou', v)
}
},
query_mou : {
get () {
return this.$store.state.price.query_mou
},
set (v) {
this.$store.commit('price/update_query_mou', v)
}
},
isLoading () {
return false
},
is_loading () {
return false
},
query_company : {
get () {
return this.$store.state.price.query_company
},
set (v) {
this.$store.commit('price/update_query_company', v)
}
}
},
data() {
return {
headers: [
{
text: "NAMA",
align: "left",
sortable: false,
value: "mr",
width: "25%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "START DATE",
align: "center",
sortable: false,
value: "lab",
width: "10%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "END DATE",
align: "center",
sortable: false,
value: "name",
width: "10%",
class: "pa-2 blue lighten-3 white--text"
}
],
pagination:{
descending: false,
page: 1,
rowsPerPage: 5,
sortBy: 'M_MouName',
totalItems: this.$store.state.price.total_mous
}
};
},
watch : {
query_company(val, old) {
if (val == null || typeof val == 'undefined') val = ""
// console.log("1-val:"+val)
if (val == old ) return
// console.log("2-val:"+val)
// if (! val) return
// console.log("3-val:"+val)
// if (val.length < 1 ) return
// console.log("4-val:"+val)
if (this.$store.state.price.search_status == 1 ) return
// console.log("5-val:"+val)
this.$store.commit("price/update_query_company", val)
this.thr_search()
}
}
}
</script>

View File

@@ -0,0 +1,96 @@
<template>
<v-layout row justify-center>
<v-dialog v-model="dialog" persistent max-width="600px">
<v-card>
<v-card-title>
<span class="headline">Tambah Data Jasa Lain</span>
</v-card-title>
<v-card-text class="pt-0">
<v-container grid-list-md pa-0>
<v-layout row wrap>
<v-flex xs12>
<v-text-field
label="Nama item"
v-model="new_addon_name"
required
>
</v-text-field>
</v-flex>
</v-layout>
</v-container>
<small>*indicates required field</small>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" flat @click="dialog = false">Close</v-btn>
<v-btn color="blue darken-1" :dark="btn_save_enabled" @click="save_addon" :disabled="!btn_save_enabled">Save</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-layout>
</template>
<style scoped>
.v-input__append-outer {
margin: 0;
}
</style>
<script>
module.exports = {
data () {
return {
}
},
computed : {
dialog : {
get () {
return this.$store.state.price.dialog_addon_new
},
set (v) {
this.$store.commit('price/update_dialog_addon_new', v)
}
},
new_addon_name : {
get () {
return this.$store.state.price.new_addon_name
},
set(v) {
this.$store.commit('price/update_new_addon_name', v)
}
},
is_loading () {
return false
},
btn_save_enabled () {
if (this.new_addon_name == '')
return false
return true
}
},
methods : {
save_addon : function() {
this.$store.dispatch('price/save_addon')
}
},
watch : {
},
mounted () {
}
}
</script>

View File

@@ -0,0 +1,427 @@
<template>
<v-layout row justify-center>
<v-dialog v-model="dialog" persistent max-width="600px">
<v-card>
<v-card-title>
<span class="headline">Tambah Data Harga</span>
</v-card-title>
<v-card-text class="pt-0">
<v-container grid-list-md pa-0>
<v-layout row wrap>
<v-flex xs10 pr-3>
<v-autocomplete
v-show="!state_edit"
label="Nama Test"
v-model="selected_px"
:items="pxs"
:search-input.sync="query_px"
auto-select-first
no-filter
return-object
clearable
item-text="T_TestName"
:loading="is_loading"
no-data-text="Pilih Test"
ref="ref_px"
>
<template
slot="item"
slot-scope="{ item }"
>
<v-list-tile-content>
<v-list-tile-title v-text="item.T_TestName"></v-list-tile-title>
<v-list-tile-sub-title v-text="item.T_TestCode"></v-list-tile-sub-title>
</v-list-tile-content>
</template>
</v-autocomplete>
<v-text-field v-show="state_edit" label="Nama Test" readonly v-model="selected_px.T_TestName"></v-text-field>
</v-flex>
<v-flex xs2>
<v-checkbox
v-model="new_price_cito"
label="Cito ?"
></v-checkbox>
</v-flex>
<!-- <v-flex xs6>&nbsp;</v-flex> -->
<v-flex xs12 sm12 md12>
<v-text-field v-model="new_price_amount" v-on:keyup="update_new_price_amount" solo label="" hide-details required reverse suffix="Harga"></v-text-field>
</v-flex>
<!-- <v-flex xs6>&nbsp;</v-flex> -->
<v-flex xs6 sm6 md6>
<v-text-field v-model="new_price_disc" v-on:keyup="update_new_price_disc" label="" hide-details required reverse solo suffix="Diskon (%)"></v-text-field>
</v-flex>
<!-- <v-flex xs6>&nbsp;</v-flex> -->
<v-flex xs6 sm6 md6>
<v-text-field v-model="new_price_discrp" v-on:keyup="update_new_price_discrp" label="" hide-details required reverse solo suffix="Diskon (Rp)"></v-text-field>
</v-flex>
<!-- <v-flex xs6>&nbsp;</v-flex> -->
<v-flex xs12 sm12 md12>
<v-text-field v-model="new_price_subtotal" readonly label="" hide-details required reverse solo suffix="Sub Total"></v-text-field>
</v-flex>
<v-flex xs12 sm12 md12 pt-2 pb-2><v-divider></v-divider></v-flex>
<v-flex xs6>
<v-select
:items="addons"
label="Item Tambahan"
item-text="T_AddonName"
item-value="T_AddonID"
v-model="selected_addon"
return-object
class="mt-0"
>
<template v-slot:append-outer>
<!-- <v-btn fab small color="red" dark class="ml-0 btn-outer" @click="new_addon"><v-icon dark>add</v-icon></v-btn> -->
<!-- <v-btn fab small color="blue" dark @click="add_other" :disabled="!selected_addon.T_AddonID" class="btn-outer"><v-icon dark>arrow_forward</v-icon></v-btn> -->
<v-btn icon flat color="blue" @click="add_other" :disabled="!selected_addon.T_AddonID" class="btn-outer"><v-icon>arrow_forward</v-icon></v-btn>
</template>
<template v-slot:prepend>
<v-btn fab small color="green" dark class="ml-0 btn-outer-2" @click="new_addon"><v-icon dark>add</v-icon></v-btn>
<!-- <v-btn flat color="green" icon class="ml-0 btn-outer-2" @click="new_addon"><v-icon>add</v-icon></v-btn> -->
</template>
</v-select>
</v-flex>
<!-- <v-flex xs2 text-xs-right></v-flex> -->
<v-flex xs1>&nbsp;</v-flex>
<v-flex xs5 sm5 md5>
<v-layout column>
<v-flex v-for="(o, i) in others" v-bind:key="i">
<v-text-field v-model="o.price" :disabled="other_disabled(o)" v-on:keyup="update_other_price(i, o.price)" label="" hide-details required reverse solo :suffix="o.name">
<template v-slot:append-outer>
<!-- <v-btn fab small color="red" @click="remove_other(o)" dark class="ml-0 btn-outer"><v-icon dark>remove</v-icon></v-btn> -->
<v-btn icon color="red" @click="remove_other(o)" flat class="ml-0 btn-outer"><v-icon>clear</v-icon></v-btn>
</template>
</v-text-field>
<!-- <v-btn style="float:right">R</v-btn> -->
</v-flex>
</v-layout>
</v-flex>
<v-flex xs12 sm12 md12>
<v-text-field ref="ref_total" v-model="new_price_total" readonly label="" hide-details required reverse solo suffix="Total"></v-text-field>
</v-flex>
</v-layout>
</v-container>
<small>*indicates required field</small>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" flat @click="dialog = false">Tutup</v-btn>
<v-btn color="blue darken-1" :dark="btn_save_enabled" @click="save_price" :disabled="!btn_save_enabled">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-layout>
</template>
<style scoped>
.v-input__append-outer {
margin: 0;
}
</style>
<style>
.btn-outer, .btn-outer-2 {
margin-top: -6px;
/* border-radius: 5% !important; */
}
.btn-outer-2 {
margin-top: -10px;
margin-right: -5px;
}
</style>
<script>
module.exports = {
data () {
return {
// new_price_amount: this.$store.state.price.new_price.amount,
// new_price_disc: this.$store.state.price.new_price.disc,
// new_price_discrp: this.$store.state.price.new_price.discrp
}
},
computed : {
state_edit () {
return this.$store.state.price.edit_price
},
dialog : {
get () {
return this.$store.state.price.dialog_px_new
},
set (v) {
this.$store.commit('price/update_dialog_px_new', v)
}
},
pxs () {
return this.$store.state.price.pxs
},
selected_px : {
get () {
return this.$store.state.price.selected_px
},
set (v) {
this.$store.commit('price/update_selected_px', v)
}
},
query_px : {
get () {
return this.$store.state.price.query_px
},
set (v) {
this.$store.commit('price/update_query_px', v)
}
},
new_price : {
get () {
return this.$store.state.price.new_price
},
set (v) {
this.$store.commit('price/update_new_price', v)
}
},
new_price_amount : {
get () {
return this.$store.state.price.new_price.amount
},
set (v) {
let x = this.$store.state.price.new_price
x.amount = v
this.$store.commit('price/update_new_price', x)
}
},
new_price_disc : {
get () {
return this.$store.state.price.new_price.disc
},
set (v) {
let x = this.$store.state.price.new_price
x.disc = v
this.$store.commit('price/update_new_price', x)
}
},
new_price_discrp : {
get () {
return this.$store.state.price.new_price.discrp
},
set (v) {
let x = this.$store.state.price.new_price
x.discrp = v
this.$store.commit('price/update_new_price', x)
}
},
new_price_subtotal : {
get() {
return this.$store.state.price.new_price.sub_total
},
set (v) {
let x = this.new_price
x.sub_total = v
this.$store.commit('price/update_new_price', x)
}
},
new_price_total : {
get() {
return this.$store.state.price.new_price.total
},
set (v) {
let x = this.new_price
x.total = v
this.$store.commit('price/update_new_price', x)
}
},
new_price_other : {
get() {
return this.$store.state.price.new_price.other
},
set (v) {
let x = this.new_price
x.other = v
this.$store.commit('price/update_new_price', x)
}
},
new_price_cito : {
get() {
return this.$store.state.price.new_price.cito == 'Y' ? true : false
},
set (v) {
let x = this.new_price
x.cito = v == true ? 'Y' : 'N'
this.$store.commit('price/update_new_price', x)
}
},
addons () {
return this.$store.state.price.addons
},
selected_addon : {
get() {
return this.$store.state.price.selected_addon
},
set(v) {
this.$store.commit('price/update_selected_addon', v)
}
},
others : {
get() {
return this.$store.state.price.others
},
set(v) {
this.$store.commit('price/update_others', {records:v, total:v.length})
}
},
// new_price_amount : {
// get () {
// return this.$store.state.price.new_price.amount
// },
// set (v) {
// let x = this.new_price
// x.amount = v
// this.new_price = x
// }
// },
is_loading () {
return false
},
btn_save_enabled () {
if (!this.$store.state.price.selected_px.T_TestID)
return false
return true
}
},
methods : {
thr_search: _.debounce( function () {
this.$store.dispatch("price/search_px")
}, 700),
update_new_price_amount : _.debounce( function() { this.update_new_price('amount') }, 500),
update_new_price_disc : _.debounce( function() { this.update_new_price('disc') }, 500),
update_new_price_discrp : _.debounce( function() { this.update_new_price('discrp') }, 500),
update_new_price(type) {
let x = this.new_price
if (type == 'amount')
x.amount = this.new_price_amount
if (type == 'disc')
x.disc = this.new_price_disc
if (type == 'discrp')
x.discrp = this.new_price_discrp
this.new_price = x
this.new_price_subtotal = Math.round(this.new_price_amount * (100-parseFloat(this.new_price_disc))) / 100 - Math.round(this.new_price_discrp)
this.new_price_total = this.new_price_subtotal + Math.round(this.new_price_other)
},
update_other_price(idx, price) {
try {
this.$store.commit('price/update_other_price', {
idx: idx,
price: price
})
} catch(e) {
console.log(e.message())
}
},
add_other() {
this.$store.commit('price/add_other')
},
remove_other(item) {
// this.$refs.ref_px.$el.focus()
this.$store.commit('price/remove_other', item)
},
other_disabled(item) {
if (item.disabled)
return true
return false
},
new_addon() {
this.$store.commit('price/update_dialog_addon_new', true)
},
save_price () {
let x = this.state_edit
if (x == true)
this.$store.dispatch('price/save_px', this.$store.state.price.selected_price.T_PriceID)
else
this.$store.dispatch('price/save_px')
}
},
watch : {
query_px(val,old) {
if (val == null || typeof val == 'undefined') val = ""
console.log("1-val:"+val)
if (val == old ) return
console.log("2-val:"+val)
// if (! val) return
console.log("3-val:"+val)
// if (val.length < 1 ) return
console.log("4-val:"+val)
if (this.$store.state.price.search_status == 1 ) return
console.log("5-val:"+val)
this.$store.commit("price/update_query_px", val)
this.thr_search()
// if (this.$store.state.doctor.search_status == 1 ) return
// this.$store.commit("doctor/update_search",val)
// this.thr_search()
},
others (v, o) {
console.log(v)
}
},
mounted () {
this.$store.dispatch('price/search_addon')
}
}
</script>

View File

@@ -0,0 +1,317 @@
<template>
<v-layout class="fill-height" column>
<v-card class="mb-2 pa-2 searchbox">
<v-layout row>
<!-- <v-text-field class="xs6 ma-1"
label=""
placeholder="Pencarian"
single-line
outline
v-model="query_mou"
hide-details
></v-text-field>
<v-select class="xs6 ma-1" :items="companies"
item-text="M_CompanyName"
item-value="M_CompanyID"
return-object
v-model="selected_company"
label="Company" outline hide-details></v-select> -->
<v-flex xs12>
<v-text-field class="ma-1"
label=""
placeholder="Pencarian"
single-line
outline
v-model="query_price"
hide-details
@keyup.native="keySearch"
></v-text-field>
</v-flex>
<v-spacer></v-spacer>
<v-flex xs5 pr-0 pa-1>
<v-btn color="success" class="ma-0 one-btn-icon" fill-height @click="search_price">
<span class="icon-search"></span>
</v-btn>
<v-btn class="ma-0 one-btn-icon" color="orange"
:disabled="!btn_add_enabled || prices.length > 0 || selected_mou.M_MouIsVerified == 'Y'"
:dark="!!btn_add_enabled && prices.length == 0 && selected_mou.M_MouIsVerified != 'Y'" @click="copy">
<span class="icon-import"></span>
</v-btn>
<v-btn color="primary" class="ma-0 one-btn-icon" fill-height @click="add"
:disabled="!btn_add_enabled || selected_mou.M_MouIsVerified == 'Y'">
<span class="icon-add"></span>
</v-btn>
</v-flex>
<!-- <v-btn class="xs3 ma-1" color="success" @click="search_price" dark>Cari</v-btn> -->
<!-- <v-btn class="xs3 ma-1" color="primary" @click="add" :disabled="!btn_add_enabled" :dark="btn_add_enabled" >Tambah</v-btn> -->
<!-- <v-btn class="xs3 ma-1" color="info" @click="set" >Baru</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="prices"
: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_TestName }}</td>
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ one_money(props.item.T_PriceAmount) }}</td>
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ total_disc(props.item) }}</td>
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ one_money(props.item.T_PriceOther) }}</td>
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ one_money(props.item.T_PriceTotal) }}</td>
<td class="text-xs-center pa-0" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
<v-btn icon @click="edit_price(props.item)" color="blue" :disabled="props.item.M_MouIsVerified == 'Y'" :dark="props.item.M_MouIsVerified != 'Y'" class="ma-0" small><v-icon small>create</v-icon></v-btn>
<v-btn icon @click="del_price(props.item)" color="red" :disabled="props.item.M_MouIsVerified == 'Y'" :dark="props.item.M_MouIsVerified != 'Y'" class="ma-0" small><v-icon small>clear</v-icon></v-btn>
</td>
</template>
<!-- <template>
<div class="text-xs-center">
<v-pagination
:length="15"
:total-visible="7"
></v-pagination>
</div>
</template> -->
</v-data-table>
<v-pagination
v-model="curr_price_page"
:length="total_price_page"
:total-visible="10"
@input="change_page"
></v-pagination>
</v-flex>
</v-layout>
</v-card>
<one-md-price-new-dialog></one-md-price-new-dialog>
<one-md-price-new-addon-dialog></one-md-price-new-addon-dialog>
</v-layout>
</template>
<style scoped>
.searchbox .v-input.v-text-field .v-input__slot{
min-height:60px;
}
.searchbox .v-btn {
min-height:60px;
}
table.v-table tbody td,table.v-table tbody th {
height: 40px;
}
table.v-table thead tr {
height: 40px;
}
.one-btn-icon {
font-size: 1.5em
}
</style>
<script>
module.exports = {
components : {
'one-md-price-new-dialog': httpVueLoader('./oneMdPriceNewDialog.vue'),
'one-md-price-new-addon-dialog': httpVueLoader('./oneMdPriceNewAddonDialog.vue')
},
mounted() {
this.$store.dispatch("price/search_company")
},
methods : {
one_money (p) {
return window.one_money(p)
},
isSelected(p) {
return false
},
search_price() {
this.$store.dispatch("price/search_price")
},
selectMe(doc) {
this.$store.commit('price/update_selected_price', doc)
},
add() {
this.$store.commit('price/update_new_price', {
amount: 0, disc: 0, discrp: 0, other: 0, sub_total: 0, total: 0, cito: 'N'
})
this.$store.commit('price/update_others', {records:[], total:0})
this.$store.commit('price/update_selected_px', {})
this.$store.commit('price/update_edit_price', false)
this.$store.commit('price/update_dialog_px_new', true)
},
edit_price(data) {
this.$store.commit('price/update_others', {records:data.others, total:data.others.length})
this.$store.commit('price/update_new_price', {
amount: data.T_PriceAmount,
disc: data.T_PriceDisc,
discrp: data.T_PriceDiscRp,
other: data.T_PriceOther,
sub_total: data.T_PriceSubTotal,
total: data.T_PriceTotal,
cito: data.T_PriceIsCito
})
this.$store.commit('price/update_selected_px', data.px)
this.$store.commit('price/update_edit_price', true)
this.$store.commit('price/update_dialog_px_new', true)
},
del_price(data) {
this.$store.dispatch('price/del_price', data.T_PriceID)
},
total_disc(data) {
return this.one_money(data.T_PriceAmount - data.T_PriceSubTotal)
},
change_page(x) {
this.curr_price_page = x
this.$store.dispatch('price/search_price')
},
keySearch(e) {
if (e.which == 13) {
this.search_price()
}
},
copy() {
this.$store.commit('price_copy/update_dialog_copy', true)
}
},
computed: {
prices : {
get () {
return this.$store.state.price.prices
},
set (v) {
this.$store.commit('price/update_prices', v)
}
},
selected_price : {
get () {
return this.$store.state.price.selected_price
},
set (v) {
this.$store.commit('price/update_selected_price', v)
}
},
total_price () {
return this.$store.state.price.total_price
},
total_price_page () {
return this.$store.state.price.total_price_page
},
curr_price_page : {
get () { return this.$store.state.price.curr_price_page },
set (v) { this.$store.commit('price/update_curr_price_page', v) }
},
query_price : {
get () {
return this.$store.state.price.query_price
},
set (v) {
this.$store.commit('price/update_query_price', v)
}
},
isLoading () {
return false
},
btn_add_enabled () {
if (this.$store.state.price.selected_mou.M_MouID)
return true
return false
},
selected_mou () {
return this.$store.state.price.selected_mou
}
},
data() {
return {
headers: [
{
text: "NAMA",
align: "left",
sortable: false,
value: "mr",
width: "25%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "HARGA",
align: "center",
sortable: false,
value: "lab",
width: "10%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "DISKON",
align: "center",
sortable: false,
value: "name",
width: "10%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "LAIN - LAIN",
align: "center",
sortable: false,
value: "name",
width: "10%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "TOTAL",
align: "center",
sortable: false,
value: "name",
width: "10%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "ACTION",
align: "center",
sortable: false,
value: "name",
width: "20%",
class: "pa-2 blue lighten-3 white--text"
}
],
pagination:{
descending: false,
page: 1,
rowsPerPage: 5,
sortBy: 'T_TestName',
totalItems: this.$store.state.price.total_mous
}
};
}
}
</script>

View File

@@ -0,0 +1,95 @@
<!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-md-price-mou-list></one-md-price-mou-list>
</v-flex>
<v-flex xs6 class="right" fill-height pa-1>
<one-md-price-px-list></one-md-price-px-list>
</v-flex>
</v-layout>
</v-container>
</v-content>
<one-footer> </one-footer>
<one-md-price-copy-dialog></one-md-price-copy-dialog>
</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">
window.calculate_age = function (inp_dob) {
var now = moment(new Date())
var dob = moment(new Date(inp_dob))
var year = now.diff(dob,'years')
dob.add(year,'years')
var month = now.diff(dob,'months')
dob.add(month,'months')
var day = now.diff(dob,'days')
if (isNaN(year)) return ''
return `${year} tahun ${month} bulan ${day} hari`
}
import { store } from './store.js<?php echo $ts ?>';
//for testing
window.store = store;
new Vue({
store,
el: '#app',
methods: {
tab_selected : function(tab) {
return this.$store.state.tab_selected == tab
}
},
components: {
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
'one-md-price-mou-list': httpVueLoader('./components/oneMdPriceMouList.vue'),
'one-md-price-px-list': httpVueLoader('./components/oneMdPricePxList.vue'),
'one-md-price-copy-dialog': httpVueLoader('./components/oneMdPriceCopyDialog.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {
}
.right {
}
</style>
</body>
</html>

View File

@@ -0,0 +1,439 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/price.js"
export default {
namespaced: true,
state: {
search_status: 0,
search_error_message: '',
companies: [],
selected_company: {},
total_company: 0,
query_company:'',
query_mou: '',
mous: [],
selected_mou: {},
total_mou: 0,
query_price: '',
prices: [],
selected_price: {},
total_price: 0,
total_price_page: 0,
curr_price_page: 1,
new_price: {amount:0, disc:0, discrp:0, sub_total:0, other:0, total:0, cito:'N'},
edit_price: false,
query_px: '',
pxs: [],
selected_px: {},
total_px: 0,
query_addon: '',
addons: [],
selected_addon: {},
total_addon: 0,
new_addon_name: '',
// others: [{id:1, name:'Jasa Dokter', price:10000}, {id:2, name:'Lain - lain', price:5000}],
others: [],
selected_other: {},
total_other: 0,
dialog_px_new: false,
dialog_addon_new: false
},
mutations: {
update_search_error_message(state, patient) {
state.search_error_message = patient
},
// MOU
update_query_mou(state, q) {
state.query_mou = q
},
update_mous(state, d) {
state.mous = d.records
state.total_mou = d.total
},
update_selected_mou(state, d) {
state.selected_mou = d
},
// COMPANY
update_companies(state, d) {
state.companies = d.records
state.total_company = d.total
},
update_selected_company(state, d) {
state.selected_company = d
},
update_query_company(state, q) {
state.query_company = q
},
// PRICE
update_query_price(state, q) {
state.query_price = q
},
update_prices(state, d) {
state.prices = d.records
state.total_price = d.total
state.total_price_page = d.total_page
},
update_curr_price_page(state, data) {
state.curr_price_page = data
},
update_selected_price(state, d) {
state.selected_price = d
},
update_new_price(state, d) {
state.new_price = d
},
update_edit_price(state, d) {
state.edit_price = d
},
// PX
update_query_px(state, q) {
state.query_px = q
},
update_pxs(state, d) {
state.pxs = d.records
state.total_px = d.total
},
update_selected_px(state, d) {
state.selected_px = d
},
// ADDON
update_addons(state, d) {
state.addons = d.records
state.total_addon = d.total
},
update_selected_addon(state, d) {
state.selected_addon = d
},
// OTHER
update_others(state, d) {
state.others = d.records
state.total_other = d.total
},
update_selected_other(state, d) {
state.selected_other = d
},
add_other(state) {
let x = state.selected_addon
let y = state.others
y.push({id:x.T_AddonID, name:x.T_AddonName, price:0})
state.others = y
},
remove_other(state, item) {
// console.log('np')
// console.log(state.new_price)
let x = state.others
for (let i in x)
if (x[i].id == item.id)
{
x.splice(i, 1)
// x[i].disabled = true
let y = state.new_price
// console.log('y1')
// console.log(y)
y.other = Math.round(y.other) - Math.round(item.price)
y.total = Math.round(y.sub_total) + Math.round(y.other)
state.new_price = y
}
state.others = x
},
update_other_price(state, d) {
let x = state.others
x[d.idx].price = d.price
state.others = x
let y = state.new_price
y.other = 0
for (let i in state.others)
y.other = Math.round(y.other) + Math.round(state.others[i].price)
y.total = Math.round(y.sub_total) + Math.round(y.other)
state.new_price = y
},
update_search_status(state, val) {
state.search_status = val
},
update_errors(state, val) {
state.errors = val
},
update_dialog_px_new(state, val) {
state.dialog_px_new = val
},
update_dialog_addon_new(state, val) {
state.dialog_addon_new = val
},
update_new_addon_name(state, val) {
state.new_addon_name = val
}
},
actions: {
async search_company(context) {
try {
let resp = await api.search_company(one_token(), context.state.query_company)
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
}
context.commit("update_companies", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async search_mou(context) {
try {
let resp = await api.search_mou(one_token(), context.state.selected_company.M_CompanyID, context.state.query_mou)
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
}
context.commit("update_mous", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async search_price(context) {
try {
let resp = await api.search_price(one_token(), context.state.selected_mou.M_MouID, context.state.query_price, context.state.curr_price_page)
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_prices", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async del_price(context, id) {
try {
let resp = await api.del_price(one_token(), id)
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.dispatch('search_price')
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async search_px(context) {
try {
let resp = await api.search_px(one_token(), context.state.query_px)
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
}
context.commit("update_pxs", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async save_px(context, price_id) {
try {
let c = context.state.new_price
let data = {
test_id: context.state.selected_px.T_TestID,
mou_id: context.state.selected_mou.M_MouID,
price: c.amount,
disc: c.disc,
disc_rp: c.discrp,
other: c.other,
sub_total: c.sub_total,
total: c.total,
cito: c.cito
}
if (price_id) data.id = price_id
let resp = await api.save_px(one_token(), JSON.stringify(data), JSON.stringify(context.state.others))
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.dispatch("search_price")
context.commit("update_dialog_px_new", false)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async search_addon(context) {
try {
let resp = await api.search_addon(one_token(), context.state.query_adddon)
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
}
context.commit("update_addons", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async save_addon(context) {
try {
let resp = await api.save_addon(one_token(), context.state.new_addon_name)
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
// }
context.dispatch("search_addon")
context.commit('update_dialog_addon_new', false)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async search_single_company(context, id) {
try {
let resp = await api.search_single_company(one_token(), id)
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
}
context.commit("update_query_company", data.records[0].M_CompanyName)
context.commit("update_companies", data.records)
context.commit("update_selected_company", data.records[0])
context.commit('update_mous', {records:data.records[0].mou, total:1})
context.commit('update_selected_mou', data.records[0].mou[0])
context.commit('update_query_mou', data.records[0].mou[0].M_MouName)
context.dispatch('search_price')
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
}
}

View File

@@ -0,0 +1,191 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/price.js"
export default {
namespaced: true,
state: {
search_status: 0,
search_error_message: '',
query_company: '',
companies: [],
selected_company: {},
total_company: 0,
default_company: {},
query_mou: '',
mous: [],
selected_mou: null,
total_mou: 0,
default_mou: {},
dialog_copy: false,
target_disc: 0
},
mutations: {
update_search_error_message(state, patient) {
state.search_error_message = patient
},
// MOU
update_query_mou(state, q) {
state.query_mou = q
},
update_mous(state, d) {
state.mous = d.records
state.total_mou = d.total
},
update_selected_mou(state, d) {
state.selected_mou = d
},
// COMPANY
update_query_company(state, q) {
state.query_company = q
},
update_companies(state, d) {
state.companies = d.records
state.total_company = d.total
},
update_selected_company(state, d) {
state.selected_company = d
// update mous
if (d) {
state.mous = d.mou
state.selected_mou = {}
state.total_mou = d.mou.length
} else {
state.mous = []
state.selected_mou = {}
state.total_mou = 0
}
},
update_search_status(state, val) {
state.search_status = val
},
update_errors(state, val) {
state.errors = val
},
update_dialog_copy(state, val) {
state.dialog_copy = val
},
update_target_disc(state, val) {
state.target_disc = val
}
},
actions: {
async search_company(context) {
try {
let resp = await api.search_company_2(one_token(), context.state.query_company)
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
}
context.commit("update_companies", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async search_mou(context) {
try {
let resp = await api.search_mou(one_token(), context.state.selected_company.M_CompanyID, context.state.query_mou)
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
}
context.commit("update_mous", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async search_price(context) {
try {
let resp = await api.search_price(one_token(), context.state.selected_mou.M_MouID, context.rootState.packet.selected_price.T_priceType, context.state.query_price, true)
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
}
context.commit("update_prices", data)
// Auto selected after save
if (context.state.auto_selected_price_id) {
for(let i in data.records)
if (data.records[i].T_priceID == context.state.auto_selected_price_id)
context.commit('update_selected_price', data.records[i])
}
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async save_copy(context) {
try {
let target_id = context.rootState.price.selected_mou.M_MouID
let source_id = context.state.selected_mou.M_MouID
let resp = await api.copy_price(one_token(), source_id, target_id, context.state.target_disc)
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.dispatch('price/search_price', null, {root:true})
context.commit('update_dialog_copy', false)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
}
}
}

View File

@@ -0,0 +1,29 @@
// State
// data ...
// Mutations
//
//
// Actions
import price from "./modules/price.js";
import price_copy from "./modules/price_copy.js";
import system from "../../../apps/modules/system/system.js";
export const store = new Vuex.Store({
modules: {
price: price,
price_copy: price_copy,
system: system
},
state: {
tab_selected: 'pasien-dokter'
},
mutations: {
change_tab(state, ntab) {
state.tab_selected = ntab
}
},
actions: {
change_tab(context, ntab) {
context.commit('change_tab', ntab)
}
}
});