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,59 @@
const URL =
"/one-api/mockup/masterdata/one-map-setup-kelainangroupsummary/setupmapkelainan/";
// https://devcpone.aplikasi.web.id/one-api/mockup/mdprice/mdprice/searchpriceheader/
export async function search(prm) {
try {
var resp = await axios.post(URL + "getsetup", 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 getdetail(prm) {
try {
var resp = await axios.post(URL + "getdetail", 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 + "save", 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,
};
}
}

View File

@@ -0,0 +1,58 @@
const URL = "/one-api/mockup/fo/cashier/";
export async function lookup_type(token) {
try {
var resp = await axios.post(URL + 'payment/lookup_type',{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 pay(prm) {
try {
var resp = await axios.post(URL + 'payment/pay',prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function delete_note(prm) {
try {
var resp = await axios.post(URL + 'payment/delete_note',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
};
}
}

View File

@@ -0,0 +1,187 @@
const URL = "/one-api/mockup/cpone-map-setup-kelainangroupsummary/Setupmapkelainan/";
// https://devcpone.aplikasi.web.id/one-api/mockup/mdprice/mdprice/searchpriceheader/
export async function search(prm) {
try {
var resp = await axios.post(URL + 'searchpriceheader', 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 insertheader(prm) {
try {
var resp = await axios.post(URL + 'insertpriceheader', 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 editheader(prm) {
try {
var resp = await axios.post(URL + 'editpriceheader', 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 deleteheader(prm) {
try {
var resp = await axios.post(URL + 'deletepriceheader', 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 getfilterprice(prm) {
try {
var resp = await axios.post(URL + 'getfilterprice', 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 searchpricetest(prm) {
try {
var resp = await axios.post(URL + 'searchpricetest', 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 savetest(prm) {
try {
var resp = await axios.post(URL + 'savetest', 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 searchpricetestautocomplete(prm) {
try {
var resp = await axios.post(URL + 'searchpriceheaderautocomplete', 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 copyharga(prm) {
try {
var resp = await axios.post(URL + 'copyharga', 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 validateheader(prm) {
try {
var resp = await axios.post(URL + 'validateheader', 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
};
}
}

View File

@@ -0,0 +1,814 @@
<template>
<div>
<v-dialog persistent v-model="dialogValidasi" width="500">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
<v-layout align-center justify-space-between row fill-height>
<div>KONFIRMASI</div>
</v-layout>
</v-card-title>
<v-card-text
>Apakah anda yakin akan mevalidasi
<kbd class="mx-2">{{ selectedPriceHeader.headerCode }}</kbd>
<span>{{ selectedPriceHeader.headerName }}</span> ?
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="error"
:disabled="loading"
flat
@click="dialogValidasi = false"
>
BATAL
</v-btn>
<v-btn
color="success"
:disabled="loading"
flat
@click="validateHeader()"
>
YAKIN
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-layout class="fill-height" column>
<v-layout align-center column>
<v-toolbar dark color="primary">
<v-toolbar-title class="white--text">
<kbd class="mr-2">{{ selectedSetup.Mgm_McuNumber }}</kbd>
{{ selectedSetup.Mgm_McuLabel }}</v-toolbar-title
>
<v-spacer></v-spacer>
</v-toolbar>
<v-card style="width: 100%;" class="mb-2 pa-2 searchbox">
<v-layout row>
<v-flex xs12 class="mr-1">
<v-text-field
label="Kode/nama"
hide-details
:loading="loading"
v-model="searchDetail"
outline
></v-text-field>
</v-flex>
</v-layout>
</v-card>
</v-layout>
<v-card style="overflow-y: scroll; height: 65vh;" class="fill-height">
<v-data-table
:loading="loading"
:items="kelainanList"
:headers="headers"
class="v-table elevation-1"
hide-actions
>
<template v-slot:headers="props">
<tr>
<th
v-for="header in props.headers"
:width="header.width"
:class="header.class"
>
{{ header.text }}
</th>
</tr>
</template>
<v-progress-linear
v-slot:progress="loading"
color="blue"
:indeterminate="true"
></v-progress-linear>
<template v-slot:items="props">
<tr>
<td class="py-2">
{{ props.item.kelainanGroupSummaryName }}
</td>
<td class="py-2">
<div style="color: brown;" class="mb-0">
<v-btn
v-if="props.item.status === 'N'"
flat
@click="save(props.item)"
icon
:disabled="loading"
color="blue"
>
<v-icon>add_box</v-icon>
</v-btn>
<v-btn
v-if="props.item.status === 'Y'"
:disabled="loading"
@click="save(props.item)"
flat
icon
color="red"
>
<v-icon>delete</v-icon>
</v-btn>
</div>
</td>
</tr>
</template>
</v-data-table>
</v-card>
<v-card class="pa-2">
<div class="text-xs-left">
<v-pagination
v-model="pageDetail"
:length="totalPageDetail"
></v-pagination>
</div>
</v-card>
</v-layout>
</div>
</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;
}
.scroll-container {
scroll-padding: 50px 0 0 50px;
}
::-webkit-scrollbar {
width: 7px;
}
/* this targets the default scrollbar (compulsory) */
::-webkit-scrollbar-track {
background-color: #73baf3;
}
/* the new scrollbar will have a flat appearance with the set background color */
::-webkit-scrollbar-thumb {
background-color: #2196f3;
}
/* this will style the thumb, ignoring the track */
::-webkit-scrollbar-button {
background-color: #0079da;
}
/* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */
::-webkit-scrollbar-corner {
background-color: black;
}
</style>
<script>
// const { data } = require("./onePriceHeader.vue");
module.exports = {
// components: {
// "one-dialog-info": httpVueLoader("../../common/oneDialogInfo.vue"),
// "one-dialog-alert": httpVueLoader("../../common/oneDialogAlert.vue"),
// },
mounted() {},
methods: {
save(val) {
// addKelainanGroup
this.$store.dispatch("mapping/addKelainanGroup", val);
},
closeDialogQrCode() {
this.dialogQrCode = false;
},
handleChangeAmount(data) {
console.log(data);
// priceAmount
// priceDisc
// priceDiscRp
// subTotal
// testID
if (data.priceAmount.trim() === "") {
return;
}
data.isChange = "Y";
cek = parseFloat(data.priceAmount);
if (isNaN(cek)) {
data.subTotal = 0;
alert("Inputan tes " + data.testName + "harus berupa angka");
return;
}
if (parseFloat(data.priceAmount) < 0) {
alert(" price amount test " + data.testName + "Kurang dari 0");
return;
}
amount = parseFloat(data.priceAmount);
diskon = 0;
if (
data.priceDisc !== "" &&
data.priceDisc !== null &&
data.priceDisc !== "0" &&
data.priceDisc !== 0
) {
diskon = parseFloat(data.priceDisc);
}
diskonRp = 0;
if (
data.priceDiscRp !== "" &&
data.priceDiscRp !== null &&
data.priceDiscRp !== "0" &&
data.priceDiscRp !== 0
) {
diskonRp = parseFloat(data.priceDiscRp);
}
total = 0;
if (data.subTotal !== "" && data.subTotal !== null) {
total = parseFloat(data.subTotal);
}
let newTotal = 0;
diskonAmount = (diskon / 100) * amount;
newTotal = amount - diskonAmount - diskonRp;
console.log("new total");
console.log(newTotal);
if (newTotal < 0) {
alert("Total tes " + data.testName + " tidak boleh kurang dari 0");
return;
}
if (newTotal == NaN) {
newTotal = 0;
}
data.subTotal = newTotal;
},
handleChangeDisc(data) {
data.isChange = "Y";
console.log(data);
// data.priceDiscRp = 0;
// priceAmount
// priceDisc
// priceDiscRp
// subTotal
// testID
if (data.priceDisc.trim() === "") {
return;
}
cek = parseFloat(data.priceDisc);
if (isNaN(cek)) {
alert("Inputan tes " + data.testName + "harus berupa angka");
return;
}
if (parseFloat(data.priceAmount) < 0) {
alert(" price amount test " + data.testName + "Kurang dari 0");
return;
}
amount = parseFloat(data.priceAmount);
diskon = 0;
if (
data.priceDisc !== "" &&
data.priceDisc !== null &&
data.priceDisc !== "0" &&
data.priceDisc !== 0
) {
diskon = parseFloat(data.priceDisc);
}
if (diskon < 0 || diskon > 100) {
alert(
"Diskon tes " +
data.testName +
" tidak boleh kurang dari 0 dan tidak boleh lebih dari 100"
);
return;
}
diskonRp = 0;
if (
data.priceDiscRp !== "" &&
data.priceDiscRp !== null &&
data.priceDiscRp !== "0" &&
data.priceDiscRp !== 0
) {
diskonRp = parseFloat(data.priceDiscRp);
}
total = 0;
if (data.subTotal !== "" && data.subTotal !== null) {
total = parseFloat(data.subTotal);
}
let newTotal = 0;
diskonAmount = (diskon / 100) * amount;
newTotal = amount - diskonAmount - diskonRp;
if (newTotal < 0) {
alert("Total tes " + data.testName + " tidak boleh kurang dari 0");
return;
}
console.log("new total");
console.log(newTotal);
if (newTotal < 0) {
alert(
"Total tes " +
data.testName +
" tidak boleh kurang dari price amount"
);
return;
}
if (newTotal == NaN) {
newTotal = 0;
}
data.subTotal = newTotal;
},
handleChangeDiscRp(data) {
data.isChange = "Y";
if (data.priceDisc.trim() === "") {
return;
}
console.log(data);
// priceAmount
// priceDisc
// priceDiscRp
// subTotal
// testID
if (data.priceDiscRp.trim() === "") {
return;
}
cek = parseFloat(data.priceDiscRp);
if (isNaN(cek) && data.priceDiscRp !== "") {
alert("Inputan tes " + data.testName + "harus berupa angka");
return;
}
if (parseFloat(data.priceDiscRp) < 0) {
alert(" price amount test " + data.testName + "Kurang dari 0");
return;
}
amount = parseFloat(data.priceAmount);
diskon = 0;
if (
data.priceDisc !== "" &&
data.priceDisc !== null &&
data.priceDisc !== "0" &&
data.priceDisc !== 0
) {
diskon = parseFloat(data.priceDisc);
}
diskonRp = 0;
if (
data.priceDiscRp !== "" &&
data.priceDiscRp !== null &&
data.priceDiscRp !== "0" &&
data.priceDiscRp !== 0
) {
diskonRp = parseFloat(data.priceDiscRp);
}
if (diskonRp < 0 || diskonRp > amount) {
alert(
"Diskon tes " +
data.testName +
" tidak boleh kurang dari 0 dan tidak boleh lebih dari price amount"
);
return;
}
total = 0;
if (data.subTotal !== "" && data.subTotal !== null) {
total = parseFloat(data.subTotal);
}
let newTotal = 0;
diskonAmount = (diskon / 100) * amount;
newTotal = amount - diskonAmount - diskonRp;
console.log("new total");
console.log(newTotal);
if (newTotal < 0) {
alert("Total tes " + data.testName + " tidak boleh kurang dari 0");
return;
}
if (newTotal == NaN) {
newTotal = 0;
}
data.subTotal = newTotal;
},
handleSave() {
let submitted = [];
data = this.priceTestList;
for (let i = 0; i < data.length; i++) {
const e = data[i];
if (
e.priceAmount !== "" &&
e.priceAmount !== null &&
e.priceAmount !== undefined
) {
if (
isNaN(e.priceAmount) ||
isNaN(e.priceDisc) ||
isNaN(e.priceDiscRp)
) {
alert("Input test " + e.testName + " salah, mohon ulangi");
return;
}
diskon = parseFloat(e.priceDisc);
diskonRp = parseFloat(e.priceDiscRp);
amount = parseFloat(e.priceAmount);
total = parseFloat(e.subTotal);
if (diskon > 100) {
alert(
"Diskon % test " +
e.testName +
" Tidak boleh lebih dari 100, mohon ulangi"
);
return;
}
if (diskon < 0) {
alert(
"Diskon % test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (diskonRp > amount) {
alert(
"Diskon Rp test " +
e.testName +
" Tidak boleh lebih dari price amount, mohon ulangi"
);
return;
}
if (diskonRp < 0) {
alert(
"Diskon Rp test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (total < 0) {
alert(
"Total test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (total > amount) {
console.log(total);
console.log(amount);
alert(
"Total test " +
e.testName +
" Tidak boleh lebih dari price amount, mohon ulangi"
);
return;
}
if (e.isChange == "Y") {
submitted.push(e);
}
}
}
console.log(submitted);
if (submitted.length > 0) {
console.log("submitted > 0");
this.$store.dispatch("price/savetest", {
test: submitted,
});
} else {
alert("Tidak ada yang perlu disimpan");
}
// priceAmount
// priceDisc
// priceDiscRp
// subTotal
// testID
},
handleChangeFIlter() {
let submitted = [];
data = this.priceTestList;
if (data !== undefined && data !== null) {
for (let i = 0; i < data.length; i++) {
const e = data[i];
if (
e.priceAmount !== "" &&
e.priceAmount !== null &&
e.priceAmount !== undefined
) {
if (
isNaN(e.priceAmount) ||
isNaN(e.priceDisc) ||
isNaN(e.priceDiscRp)
) {
alert("Input test " + e.testName + " salah, mohon ulangi");
return;
}
diskon = parseFloat(e.priceDisc);
diskonRp = parseFloat(e.priceDiscRp);
amount = parseFloat(e.priceAmount);
total = parseFloat(e.subTotal);
if (diskon > 100) {
alert(
"Diskon % test " +
e.testName +
" Tidak boleh lebih dari 100, mohon ulangi"
);
return;
}
if (diskon < 0) {
alert(
"Diskon % test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (diskonRp > amount) {
alert(
"Diskon Rp test " +
e.testName +
" Tidak boleh lebih dari price amount, mohon ulangi"
);
return;
}
if (diskonRp < 0) {
alert(
"Diskon Rp test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (total < 0) {
alert(
"Total test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (total > amount) {
console.log(total);
console.log(amount);
alert(
"Total test " +
e.testName +
" Tidak boleh lebih dari price amount, mohon ulangi"
);
return;
}
if (e.isChange == "Y") {
submitted.push(e);
}
}
}
}
console.log(submitted);
// priceAmount
// priceDisc
// priceDiscRp
// subTotal
// testID
return submitted;
},
validateHeader() {
this.$store.dispatch("price/validateheader");
},
},
computed: {
searchDetail: {
get() {
return this.$store.state.mapping.searchDetail;
},
set(val) {
this.$store.commit("mapping/update_searchDetail", val);
this.$store.dispatch("mapping/searchDetail");
},
},
filterSubGroup: {
get() {
return this.$store.state.price.filterSubGroup;
},
set(val) {
this.$store.commit("price/update_filterSubGroup", val);
},
},
filterStatus: {
get() {
return this.$store.state.price.filterStatus;
},
set(val) {
this.$store.commit("price/update_filterStatus", val);
},
},
selectedFilterSubGroup: {
get() {
return this.$store.state.price.selectedFilterSubGroup;
},
set(val) {
let dt = this.handleChangeFIlter();
if (dt !== undefined && dt !== null) {
if (dt.length > 0) {
if (
confirm(
"Data belum belum tersimpan, Apakah anda yakin untuk melanjutkan ?"
)
) {
this.$store.commit("price/update_selectedFilterSubGroup", val);
this.$store.dispatch("price/searchpricetest");
return;
} else {
return;
}
} else {
this.$store.commit("price/update_selectedFilterSubGroup", val);
this.$store.dispatch("price/searchpricetest");
}
}
},
},
selectedFilterStatus: {
get() {
return this.$store.state.price.selectedFilterStatus;
},
set(val) {
let dt = this.handleChangeFIlter();
if (dt !== undefined && dt !== null) {
if (dt.length > 0) {
if (
confirm(
"Data belum belum tersimpan, Apakah anda yakin untuk melanjutkan ?"
)
) {
this.$store.commit("price/update_selectedFilterStatus", val);
this.$store.dispatch("price/searchpricetest");
return;
} else {
return;
}
} else {
this.$store.commit("price/update_selectedFilterStatus", val);
this.$store.dispatch("price/searchpricetest");
}
}
},
},
loading: {
get() {
return this.$store.state.mapping.loading;
},
set(val) {
this.$store.commit("mapping/update_loading", val);
},
},
errorMsg: {
get() {
return this.$store.state.mapping.errorMsg;
},
set(val) {
this.$store.commit("mapping/update_errorMsg", val);
},
},
snackbarError: {
get() {
return this.$store.state.mapping.snackbarError;
},
set(val) {
this.$store.commit("mapping/update_snackbarError", val);
},
},
snackbarSuccess: {
get() {
return this.$store.state.mapping.snackbarSuccess;
},
set(val) {
this.$store.commit("mapping/update_snackbarSuccess", val);
},
},
selectedPriceHeader: {
get() {
return this.$store.state.price.selectedPriceHeader;
},
set(val) {
this.$store.commit("price/update_selectedPriceHeader", val);
this.$store.dispatch("price/searchpricetest");
},
},
selectedSetup: {
get() {
return this.$store.state.mapping.selectedSetup;
},
set(val) {
this.$store.commit("mapping/update_selectedSetup", val);
},
},
successMsg: {
get() {
return this.$store.state.mapping.successMsg;
},
set(val) {
this.$store.commit("mapping/update_successMsg", val);
},
},
priceTestList: {
get() {
return this.$store.state.price.priceTestList;
},
set(val) {
this.$store.commit("price/update_priceTestList", val);
},
},
kelainanList: {
get() {
return this.$store.state.mapping.kelainanList;
},
set(val) {
this.$store.commit("mapping/update_kelainanList", val);
},
},
totalPageDetail: {
get() {
return this.$store.state.mapping.totalPageDetail;
},
set(val) {
this.$store.commit("mapping/update_totalPageDetail", val);
},
},
dialogValidasi: {
get() {
return this.$store.state.price.dialogValidasi;
},
set(val) {
this.$store.commit("price/update_dialogValidasi", val);
},
},
pageDetail: {
get() {
return this.$store.state.mapping.pageDetail;
},
set(val) {
this.$store.commit("mapping/update_pageDetail", val);
this.$store.dispatch("mapping/searchDetail");
},
},
},
watch: {},
data() {
return {
selected_delivery: {},
search_company: "",
search_test: "",
menufilterdatestart: false,
menufilterdateend: false,
date: new Date().toISOString().substr(0, 10),
items: [],
menustartdate: false,
menuenddate: false,
errors: [],
sheet: false,
indeterminatex: false,
checkednotall: false,
bar_chx_all: false,
selected_barcode: [],
dialogtimeline: false,
search_doctor: "",
dialogWarning: false,
dialogWarningMsg: "",
rules: {
min: (v) => v > 0 || "Minimum value 1",
maxPersen: (v) => v <= 100 || "Maximum value 100",
},
headers: [
{
text: "NAMA",
align: "center",
sortable: false,
value: "lab",
width: "90%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "AKSI",
align: "center",
sortable: false,
value: "lab",
width: "10%",
class: "pa-2 blue darken-2 white--text",
},
],
};
},
};
</script>

View File

@@ -0,0 +1,773 @@
<template>
<div>
<v-snackbar
color="success"
v-model="snackbarSuccess"
right="right"
:timeout="3000"
top="top"
>
{{ successMsg }}
<v-btn color="white" flat @click="snackbarSuccess = false"> Close </v-btn>
</v-snackbar>
<v-snackbar
color="error"
v-model="snackbarError"
right="right"
:timeout="3000"
top="top"
>
{{ errorMsg }}
<v-btn color="white" flat @click="snackbarError = false"> Close </v-btn>
</v-snackbar>
<v-dialog persistent v-model="dialogPriceHeader" width="500">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
<v-layout align-center justify-space-between row fill-height>
<div>FORM HARGA</div>
<kbd v-if="dialogAct === 'edit'">{{
selectedPriceHeader.headerCode
}}</kbd>
<kbd v-if="dialogAct === 'add'">CODE</kbd>
</v-layout>
</v-card-title>
<v-card-text>
<v-text-field
label="Nama"
placeholder="masukan nama"
v-model="nameHeader"
outline
></v-text-field>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="error"
:disabled="loading"
flat
@click="dialogPriceHeader = false"
>
BATAL
</v-btn>
<v-btn
color="primary"
:disabled="loading"
flat
@click="savePriceHeader"
>
SIMPAN
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog persistent v-model="dialogDeleteHeader" width="500">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
<v-layout align-center justify-space-between row fill-height>
<div>KONFIRMASI</div>
</v-layout>
</v-card-title>
<v-card-text
>Apakah anda yakin akan menghapus harga
<kbd class="mx-2">{{ selectedPriceHeader.headerCode }}</kbd>
<span>{{ selectedPriceHeader.headerName }}</span> ?
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="error"
:disabled="loading"
flat
@click="dialogDeleteHeader = false"
>
BATAL
</v-btn>
<v-btn
color="warning"
:disabled="loading"
flat
@click="deletePriceHeader()"
>
YAKIN
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog persistent v-model="dialogCopyHarga" width="500">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
<v-layout align-center justify-space-between row fill-height>
<div>FORM COPY HARGA</div>
<kbd>CODE</kbd>
</v-layout>
</v-card-title>
<v-card-text>
<v-text-field
label="Nama"
placeholder="masukan nama"
v-model="nameHeader"
outline
></v-text-field>
<v-autocomplete
label="Price Header"
v-model="selectedPriceHeaderCopy"
:items="priceHeaderCopyList"
item-text="headerName"
outline
return-object
:search-input.sync="searchPriceHeaderCopy"
no-data-text="Pilih Price Header"
>
<template slot="item" slot-scope="{ item }">
<v-list-tile-content>
<v-list-tile-title v-text="item.headerName"></v-list-tile-title>
</v-list-tile-content>
</template>
</v-autocomplete>
<v-checkbox v-model="copyPacket" label="Copy Packet"></v-checkbox>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="error"
:disabled="loading"
flat
@click="dialogCopyHarga = false"
>
BATAL
</v-btn>
<v-btn color="primary" :disabled="loading" flat @click="copyprice">
SIMPAN
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-layout column>
<v-layout align-center column>
<v-toolbar dark color="primary">
<v-toolbar-title class="white--text">MAPPING</v-toolbar-title>
<v-spacer></v-spacer>
<!-- <v-btn @click="openDialogAdd()" icon>
<v-icon>add_box</v-icon>
</v-btn>
<v-btn @click="openDialogCopy()" icon>
<v-icon>content_copy</v-icon>
</v-btn> -->
</v-toolbar>
<v-card style="width: 100%;" class="mb-2 pa-2 searchbox">
<!-- :disabled="loading" -->
<v-text-field
v-model="searchHeader"
label="Cari nama"
:loading="loading"
hide-details
outline
></v-text-field>
</v-card>
</v-layout>
<v-card style="overflow-y: scroll; height: 65vh;" class="fill-height">
<v-data-table
:loading="loading"
:items="setupList"
class="v-table elevation-1"
hide-actions
hide-headers
>
<v-progress-linear
v-slot:progress="loading"
color="blue"
:indeterminate="true"
></v-progress-linear>
<template v-slot:items="props">
<tr
v-bind:class="{
'deep-orange lighten-4': isSelected(props.item),
}"
@click="selectMe(props.item)"
>
<td class="py-2">
<v-layout align-start justify-start row fill-height>
<v-flex xs10>
<p style="" class="mb-1">
<kbd class="mr-2">{{ props.item.Mgm_McuNumber }}</kbd>
<span class="font-weight-bold">
{{ props.item.Mgm_McuLabel }}
</span>
</p>
</v-flex>
</v-layout>
</td>
</tr>
</template>
</v-data-table>
</v-card>
<v-card class="pa-2">
<div class="text-xs-left">
<v-pagination v-model="page" :length="totalPageHeader"></v-pagination>
</div>
</v-card>
</v-layout>
</div>
</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;
}
.scroll-container {
scroll-padding: 50px 0 0 50px;
}
::-webkit-scrollbar {
width: 7px;
}
/* this targets the default scrollbar (compulsory) */
::-webkit-scrollbar-track {
background-color: #73baf3;
}
/* the new scrollbar will have a flat appearance with the set background color */
::-webkit-scrollbar-thumb {
background-color: #2196f3;
}
/* this will style the thumb, ignoring the track */
::-webkit-scrollbar-button {
background-color: #0079da;
}
/* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */
::-webkit-scrollbar-corner {
background-color: black;
}
</style>
<script>
module.exports = {
// components: {
// "one-dialog-info": httpVueLoader("../../common/oneDialogInfo.vue"),
// "one-dialog-alert": httpVueLoader("../../common/oneDialogAlert.vue"),
// },
mounted() {
this.$store.dispatch("mapping/searchSetup");
// this.$store.dispatch("price/getpricefilter");
// this.$store.dispatch("price/getpricefilter");
},
methods: {
formatDate(date) {
if (!date) return null;
const [year, month, day] = date.split("-");
return `${day}-${month}-${year}`;
},
deFormatedDate(date) {
if (!date) return null;
const [day, month, year] = date.split("-");
return `${year}-${month.padStart(2, "0")}-${day.padStart(2, "0")}`;
},
closeDialogQrCode() {
this.dialogQrCode = false;
},
copyprice() {
this.$store.dispatch("price/copyharga");
},
savePriceHeader() {
console.log(this.dialogAct);
if (this.dialogAct === "add") {
this.$store.dispatch("price/insertPriceHeader");
} else if (this.dialogAct === "edit") {
this.$store.dispatch("price/editPriceHeader");
}
},
deletePriceHeader() {
this.$store.dispatch("price/deletePriceHeader");
},
selectMe(val) {
if (this.loading) {
return;
}
this.selectedSetup = val;
},
isSelected(val) {
return this.selectedSetup.Mgm_McuID === val.Mgm_McuID;
},
openDialogAdd() {
this.dialogAct = "add";
this.dialogPriceHeader = true;
},
openDialogCopy() {
this.dialogCopyHarga = true;
this.selectedPriceHeaderCopy = {};
this.headerName = "";
},
openDialogDelete(val) {
if (this.loading) {
return;
}
this.selectedPriceHeader = val;
this.dialogDeleteHeader = true;
},
openDialogEdit(val) {
if (this.loading) {
return;
}
this.dialogAct = "edit";
// {
// "headerID": "0",
// "headerName": "",
// "headerStartDate": "",
// "headerEndDate": "",
// "headerCode": "CODE"
// }
this.selectedPriceHeader = val;
this.nameHeader = this.selectedPriceHeader.headerName;
this.startDateHeaderForm = this.selectedPriceHeader.headerStartDate;
this.endDateHeaderForm = this.selectedPriceHeader.headerEndDate;
this.dialogPriceHeader = true;
},
handleChangeFIlter() {
let submitted = [];
data = this.priceTestList;
if (data !== undefined && data !== null) {
for (let i = 0; i < data.length; i++) {
const e = data[i];
if (
e.priceAmount !== "" &&
e.priceAmount !== null &&
e.priceAmount !== undefined
) {
if (
isNaN(e.priceAmount) ||
isNaN(e.priceDisc) ||
isNaN(e.priceDiscRp)
) {
alert("Input test " + e.testName + " salah, mohon ulangi");
return;
}
diskon = parseFloat(e.priceDisc);
diskonRp = parseFloat(e.priceDiscRp);
amount = parseFloat(e.priceAmount);
total = parseFloat(e.subTotal);
if (diskon > 100) {
alert(
"Diskon % test " +
e.testName +
" Tidak boleh lebih dari 100, mohon ulangi"
);
return;
}
if (diskon < 0) {
alert(
"Diskon % test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (diskonRp > amount) {
alert(
"Diskon Rp test " +
e.testName +
" Tidak boleh lebih dari price amount, mohon ulangi"
);
return;
}
if (diskonRp < 0) {
alert(
"Diskon Rp test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (total < 0) {
alert(
"Total test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (total > amount) {
console.log(total);
console.log(amount);
alert(
"Total test " +
e.testName +
" Tidak boleh lebih dari price amount, mohon ulangi"
);
return;
}
if (e.isChange == "Y") {
submitted.push(e);
}
}
}
}
console.log(submitted);
// priceAmount
// priceDisc
// priceDiscRp
// subTotal
// testID
return submitted;
},
thrsearchphautocomplete: _.debounce(function () {
this.$store.dispatch("price/searchPriceHeaderAutocomplete", {
search: this.searchPriceHeaderCopy,
});
}, 800),
},
computed: {
priceTestList: {
get() {
return this.$store.state.price.priceTestList;
},
set(val) {
this.$store.commit("price/update_priceTestList", val);
},
},
searchHeader: {
get() {
return this.$store.state.mapping.searchHeader;
},
set(val) {
this.$store.commit("mapping/update_searchHeader", val);
this.$store.dispatch("mapping/searchSetup");
},
},
setupList: {
get() {
return this.$store.state.mapping.setupList;
},
set(val) {
this.$store.commit("mapping/update_setupList", val);
},
},
loading: {
get() {
return this.$store.state.mapping.loading;
},
set(val) {
this.$store.commit("mapping/update_loading", val);
},
},
page: {
get() {
return this.$store.state.mapping.page;
},
set(val) {
this.selectedSetup = {
Mgm_McuID: "0",
};
this.$store.commit("mapping/update_page", val);
this.$store.dispatch("mapping/searchSetup");
},
},
totalPageHeader: {
get() {
return this.$store.state.mapping.totalPageHeader;
},
set(val) {
this.$store.commit("mapping/update_totalPageHeader", val);
},
},
errorMsg: {
get() {
return this.$store.state.mapping.errorMsg;
},
set(val) {
this.$store.commit("mapping/update_errorMsg", val);
},
},
snackbarError: {
get() {
return this.$store.state.mapping.snackbarError;
},
set(val) {
this.$store.commit("mapping/update_snackbarError", val);
},
},
selectedSetup: {
get() {
return this.$store.state.mapping.selectedSetup;
},
set(val) {
this.$store.commit("mapping/update_selectedSetup", val);
this.$store.dispatch("mapping/searchDetail");
},
},
snackbarSuccess: {
get() {
return this.$store.state.mapping.snackbarSuccess;
},
set(val) {
this.$store.commit("mapping/update_snackbarSuccess", val);
},
},
selectedPriceHeader: {
get() {
return this.$store.state.price.selectedPriceHeader;
},
set(val) {
let dt = this.handleChangeFIlter();
if (dt.length > 0) {
if (
confirm(
"Data belum belum tersimpan, Apakah anda yakin untuk melanjutkan ?"
)
) {
this.$store.commit("price/update_selectedPriceHeader", val);
this.$store.dispatch("price/searchpricetest");
return;
} else {
return;
}
} else {
this.$store.commit("price/update_selectedPriceHeader", val);
this.$store.dispatch("price/searchpricetest");
}
},
},
successMsg: {
get() {
return this.$store.state.mapping.successMsg;
},
set(val) {
this.$store.commit("mapping/update_successMsg", val);
},
},
dialogPriceHeader: {
get() {
return this.$store.state.price.dialogPriceHeader;
},
set(val) {
this.$store.commit("price/update_dialogPriceHeader", val);
if (val === false) {
this.nameHeader = "";
}
},
},
startDateHeaderForm: {
get() {
return this.$store.state.price.startDateHeader;
},
set(val) {
console.log("sd");
console.log(val);
this.$store.commit("price/update_startDateHeader", val);
let sd = new Date(val);
let ed = new Date(this.endDateHeaderForm);
if (sd > ed) {
this.endDateHeaderForm = val;
}
},
},
endDateHeaderForm: {
get() {
return this.$store.state.price.endDateHeader;
},
set(val) {
this.$store.commit("price/update_endDateHeader", val);
console.log("ed");
console.log(val);
},
},
nameHeader: {
get() {
return this.$store.state.price.nameHeader;
},
set(val) {
this.$store.commit("price/update_nameHeader", val);
},
},
dialogDeleteHeader: {
get() {
return this.$store.state.price.dialogDeleteHeader;
},
set(val) {
this.$store.commit("price/update_dialogDeleteHeader", val);
},
},
dialogCopyHarga: {
get() {
return this.$store.state.price.dialogCopyHarga;
},
set(val) {
this.$store.commit("price/update_dialogCopyHarga", val);
if (val === false) {
this.nameHeader = "";
}
},
},
priceHeaderCopyList: {
get() {
return this.$store.state.price.priceHeaderCopyList;
},
set(val) {
this.$store.commit("price/update_priceHeaderCopyList", val);
},
},
selectedPriceHeaderCopy: {
get() {
return this.$store.state.price.selectedPriceHeaderCopy;
},
set(val) {
this.$store.commit("price/update_selectedPriceHeaderCopy", val);
},
},
copyPacket: {
get() {
return this.$store.state.price.copyPacket;
},
set(val) {
this.$store.commit("price/update_copyPacket", val);
},
},
formatedStartDateHeader() {
return this.formatDate(this.startDateHeaderForm);
},
formatedEndDateHeader() {
return this.formatDate(this.endDateHeaderForm);
},
},
watch: {
// search_company(val, old) {
// if (val == old) return;
// if (!val) return;
// if (val.length < 1) return;
// if (this.$store.state.patient.update_autocomplete_status == 1) return;
// this.thr_search_company();
// },
// search_doctor(val, old) {
// if (val == old) return;
// if (!val) return;
// if (val.length < 1) return;
// if (this.$store.state.patient.update_autocomplete_status == 1) return;
// this.thr_search_doctor();
// },
// search_test(val, old) {
// if (val == old) return;
// if (!val) return;
// if (val.length < 1) return;
// if (this.$store.state.patient.update_autocomplete_status == 1) return;
// this.thr_search_test();
// },
searchPriceHeaderCopy(val, old) {
if (val == old) return;
if (!val) return;
if (val.length < 1) return;
this.thrsearchphautocomplete();
},
},
data() {
return {
searchPriceHeaderCopy: "",
selected_delivery: {},
search_company: "",
search_test: "",
menuFormDateStart: false,
menuFormDateEnd: false,
date: new Date().toISOString().substr(0, 10),
dialogAct: "add",
items: [],
menustartdate: false,
menuenddate: false,
errors: [],
sheet: false,
indeterminatex: false,
checkednotall: false,
bar_chx_all: false,
selected_barcode: [],
dialogtimeline: false,
search_doctor: "",
headers: [
{
text: "",
align: "center",
sortable: false,
value: "lab",
width: "2%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "NO",
align: "center",
sortable: false,
value: "lab",
width: "5%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "NO REG",
align: "center",
sortable: false,
value: "lab",
width: "8%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "NAMA",
align: "center",
sortable: false,
value: "name",
width: "15%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "CORPORATE",
align: "center",
sortable: false,
value: "name",
width: "15%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "PEMERIKSAAN",
align: "center",
sortable: false,
value: "status",
width: "20%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "TOTAL",
align: "center",
sortable: false,
value: "status",
width: "5%",
class: "pa-2 blue darken-2 white--text",
},
],
};
},
};
</script>

View File

@@ -0,0 +1,994 @@
<template>
<div>
<v-dialog persistent v-model="dialogValidasi" width="500">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
<v-layout align-center justify-space-between row fill-height>
<div>KONFIRMASI</div>
</v-layout>
</v-card-title>
<v-card-text
>Apakah anda yakin akan mevalidasi
<kbd class="mx-2">{{ selectedPriceHeader.headerCode }}</kbd>
<span>{{ selectedPriceHeader.headerName }}</span> ?
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="error"
:disabled="loading"
flat
@click="dialogValidasi = false"
>
BATAL
</v-btn>
<v-btn
color="success"
:disabled="loading"
flat
@click="validateHeader()"
>
YAKIN
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-layout class="fill-height" column>
<v-layout align-center column>
<v-toolbar dark color="primary">
<v-toolbar-title class="white--text">
<kbd class="mr-2">{{ this.selectedPriceHeader.headerCode }}</kbd>
{{ this.selectedPriceHeader.headerName }}</v-toolbar-title
>
<v-spacer></v-spacer>
<!-- v-if="selectedPriceHeader.headerValidate === 'N'" -->
<v-btn color="success" :disabled="loading" @click="handleSave()"
>Simpan</v-btn
>
<!-- selectedPriceHeader.headerValidate === 'N' && -->
<v-btn
:disabled="loading"
color="warning"
@click="dialogValidasi = true"
>Validasi
</v-btn>
<!-- <v-btn
:disabled="loading"
v-if="
selectedPriceHeader.headerValidate === 'Y' &&
selectedPriceHeader.validatePacket === 'Y' &&
selectedPriceHeader.readyValidate === 'Y'
"
color="warning"
@click="dialogValidasi = true"
>Validasi
</v-btn> -->
</v-toolbar>
<v-card style="width: 100%;" class="mb-2 pa-2 searchbox">
<v-layout row>
<v-flex xs4 class="mr-1">
<v-text-field
label="Kode/nama"
hide-details
:loading="loading"
v-model="filterName"
outline
></v-text-field>
</v-flex>
<v-flex xs4 class="mr-1 ml-1">
<v-autocomplete
label="Sub Group"
v-model="selectedFilterSubGroup"
:items="filterSubGroup"
item-text="name"
outline
hide-details
:disabled="loading"
return-object
:loading="loading"
no-data-text="Pilih Sub Group"
>
<template slot="item" slot-scope="{ item }">
<v-list-tile-content>
<v-list-tile-title v-text="item.name"></v-list-tile-title>
</v-list-tile-content>
</template>
</v-autocomplete>
</v-flex>
<v-flex xs4 class="ml-1">
<v-autocomplete
label="Status"
v-model="selectedFilterStatus"
:items="filterStatus"
item-text="name"
outline
hide-details
return-object
:disabled="loading"
:loading="loading"
no-data-text="Pilih Status"
>
<template slot="item" slot-scope="{ item }">
<v-list-tile-content>
<v-list-tile-title v-text="item.name"></v-list-tile-title>
</v-list-tile-content>
</template>
</v-autocomplete>
</v-flex>
</v-layout>
</v-card>
</v-layout>
<v-card style="overflow-y: scroll; height: 65vh;" class="fill-height">
<v-data-table
:loading="loading"
:items="priceTestList"
:headers="headers"
class="v-table elevation-1"
hide-actions
>
<template v-slot:headers="props">
<tr>
<th
v-for="header in props.headers"
:width="header.width"
:class="header.class"
>
{{ header.text }}
</th>
</tr>
</template>
<v-progress-linear
v-slot:progress="loading"
color="blue"
:indeterminate="true"
></v-progress-linear>
<template v-slot:items="props">
<tr>
<td class="py-2">
<div style="color: brown;" class="mb-0">
<v-btn
small
color="success"
class="white--text"
v-if="props.item.status === 'Y'"
>
<v-icon left dark>check</v-icon>
</v-btn>
<v-btn
small
color="error"
class="white--text"
v-if="props.item.status === 'N'"
>
<v-icon right dark>close</v-icon>
</v-btn>
</div>
</td>
<td class="py-2">
<!-- v-bind:class="{ 'amber lighten-4': isSelected(props.item) }" -->
<p style="" class="mb-1">
<kbd class="mr-2">{{ props.item.testCode }}</kbd>
<span class="font-weight-bold">
{{ props.item.testName }}
</span>
</p>
</td>
<td class="py-2">
<!-- v-bind:class="{ 'amber lighten-4': isSelected(props.item) }" -->
<v-text-field
label="Amount"
class="input-auto-tab"
@keydown.enter="focusNext"
type="number"
v-model="props.item.priceAmount"
hide-details
:disabled="
(selectedPriceHeader.headerValidate === 'Y' &&
props.item.status === 'Y') ||
loading
"
@input="handleChangeAmount(props.item)"
outline
></v-text-field>
<!-- v-on:change="handleChangeAmount(props.item.priceAmount)" -->
<!-- :rules="[rules.min]" -->
</td>
<td class="py-2">
<v-text-field
label="Diskon %"
type="number"
v-model="props.item.priceDisc"
@input="handleChangeDisc(props.item)"
:disabled="
props.item.priceAmount === NaN ||
props.item.priceAmount === null ||
props.item.priceAmount === undefined ||
props.item.priceAmount <= 0 ||
props.item.priceAmount === '' ||
(selectedPriceHeader.headerValidate === 'Y' &&
props.item.status === 'Y') ||
loading
"
hide-details
outline
></v-text-field>
<!-- :rules="[rules.min, rules.maxPersen]" -->
</td>
<td class="py-2">
<!-- v-bind:class="{ 'amber lighten-4': isSelected(props.item) }" -->
<v-text-field
label="Diskon Rp"
type="number"
v-model="props.item.priceDiscRp"
@input="handleChangeDiscRp(props.item)"
:disabled="
props.item.priceAmount === NaN ||
props.item.priceAmount === null ||
props.item.priceAmount === undefined ||
props.item.priceAmount <= 0 ||
props.item.priceAmount === '' ||
(selectedPriceHeader.headerValidate === 'Y' &&
props.item.status === 'Y') ||
loading
"
hide-details
outline
></v-text-field>
<!-- :rules="[rules.min]" -->
</td>
<td class="py-2">
<!-- v-bind:class="{ 'amber lighten-4': isSelected(props.item) }" -->
<v-text-field
label="Total"
type="number"
readonly
v-model="props.item.subTotal"
hide-details
outline
></v-text-field>
<!-- :rules="[rules.min]" -->
</td>
</tr>
</template>
</v-data-table>
</v-card>
<v-card class="pa-2">
<div class="text-xs-left">
<v-pagination
v-model="priceTestPage"
:length="priceTestPageTotal"
></v-pagination>
</div>
</v-card>
</v-layout>
</div>
</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;
}
.scroll-container {
scroll-padding: 50px 0 0 50px;
}
::-webkit-scrollbar {
width: 7px;
}
/* this targets the default scrollbar (compulsory) */
::-webkit-scrollbar-track {
background-color: #73baf3;
}
/* the new scrollbar will have a flat appearance with the set background color */
::-webkit-scrollbar-thumb {
background-color: #2196f3;
}
/* this will style the thumb, ignoring the track */
::-webkit-scrollbar-button {
background-color: #0079da;
}
/* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */
::-webkit-scrollbar-corner {
background-color: black;
}
</style>
<script>
// const { data } = require("./onePriceHeader.vue");
module.exports = {
// components: {
// "one-dialog-info": httpVueLoader("../../common/oneDialogInfo.vue"),
// "one-dialog-alert": httpVueLoader("../../common/oneDialogAlert.vue"),
// },
mounted() {},
methods: {
closeDialogQrCode() {
this.dialogQrCode = false;
},
handleChangeAmount(data) {
console.log(data);
// priceAmount
// priceDisc
// priceDiscRp
// subTotal
// testID
if (data.priceAmount.trim() === "") {
return;
}
data.isChange = "Y";
cek = parseFloat(data.priceAmount);
if (isNaN(cek)) {
data.subTotal = 0;
alert("Inputan tes " + data.testName + "harus berupa angka");
return;
}
if (parseFloat(data.priceAmount) < 0) {
alert(" price amount test " + data.testName + "Kurang dari 0");
return;
}
amount = parseFloat(data.priceAmount);
diskon = 0;
if (
data.priceDisc !== "" &&
data.priceDisc !== null &&
data.priceDisc !== "0" &&
data.priceDisc !== 0
) {
diskon = parseFloat(data.priceDisc);
}
diskonRp = 0;
if (
data.priceDiscRp !== "" &&
data.priceDiscRp !== null &&
data.priceDiscRp !== "0" &&
data.priceDiscRp !== 0
) {
diskonRp = parseFloat(data.priceDiscRp);
}
total = 0;
if (data.subTotal !== "" && data.subTotal !== null) {
total = parseFloat(data.subTotal);
}
let newTotal = 0;
diskonAmount = (diskon / 100) * amount;
newTotal = amount - diskonAmount - diskonRp;
console.log("new total");
console.log(newTotal);
if (newTotal < 0) {
alert("Total tes " + data.testName + " tidak boleh kurang dari 0");
return;
}
if (newTotal == NaN) {
newTotal = 0;
}
data.subTotal = newTotal;
},
handleChangeDisc(data) {
data.isChange = "Y";
console.log(data);
// data.priceDiscRp = 0;
// priceAmount
// priceDisc
// priceDiscRp
// subTotal
// testID
if (data.priceDisc.trim() === "") {
return;
}
cek = parseFloat(data.priceDisc);
if (isNaN(cek)) {
alert("Inputan tes " + data.testName + "harus berupa angka");
return;
}
if (parseFloat(data.priceAmount) < 0) {
alert(" price amount test " + data.testName + "Kurang dari 0");
return;
}
amount = parseFloat(data.priceAmount);
diskon = 0;
if (
data.priceDisc !== "" &&
data.priceDisc !== null &&
data.priceDisc !== "0" &&
data.priceDisc !== 0
) {
diskon = parseFloat(data.priceDisc);
}
if (diskon < 0 || diskon > 100) {
alert(
"Diskon tes " +
data.testName +
" tidak boleh kurang dari 0 dan tidak boleh lebih dari 100"
);
return;
}
diskonRp = 0;
if (
data.priceDiscRp !== "" &&
data.priceDiscRp !== null &&
data.priceDiscRp !== "0" &&
data.priceDiscRp !== 0
) {
diskonRp = parseFloat(data.priceDiscRp);
}
total = 0;
if (data.subTotal !== "" && data.subTotal !== null) {
total = parseFloat(data.subTotal);
}
let newTotal = 0;
diskonAmount = (diskon / 100) * amount;
newTotal = amount - diskonAmount - diskonRp;
if (newTotal < 0) {
alert("Total tes " + data.testName + " tidak boleh kurang dari 0");
return;
}
console.log("new total");
console.log(newTotal);
if (newTotal < 0) {
alert(
"Total tes " +
data.testName +
" tidak boleh kurang dari price amount"
);
return;
}
if (newTotal == NaN) {
newTotal = 0;
}
data.subTotal = newTotal;
},
handleChangeDiscRp(data) {
data.isChange = "Y";
if (data.priceDisc.trim() === "") {
return;
}
console.log(data);
// priceAmount
// priceDisc
// priceDiscRp
// subTotal
// testID
if (data.priceDiscRp.trim() === "") {
return;
}
cek = parseFloat(data.priceDiscRp);
if (isNaN(cek) && data.priceDiscRp !== "") {
alert("Inputan tes " + data.testName + "harus berupa angka");
return;
}
if (parseFloat(data.priceDiscRp) < 0) {
alert(" price amount test " + data.testName + "Kurang dari 0");
return;
}
amount = parseFloat(data.priceAmount);
diskon = 0;
if (
data.priceDisc !== "" &&
data.priceDisc !== null &&
data.priceDisc !== "0" &&
data.priceDisc !== 0
) {
diskon = parseFloat(data.priceDisc);
}
diskonRp = 0;
if (
data.priceDiscRp !== "" &&
data.priceDiscRp !== null &&
data.priceDiscRp !== "0" &&
data.priceDiscRp !== 0
) {
diskonRp = parseFloat(data.priceDiscRp);
}
if (diskonRp < 0 || diskonRp > amount) {
alert(
"Diskon tes " +
data.testName +
" tidak boleh kurang dari 0 dan tidak boleh lebih dari price amount"
);
return;
}
total = 0;
if (data.subTotal !== "" && data.subTotal !== null) {
total = parseFloat(data.subTotal);
}
let newTotal = 0;
diskonAmount = (diskon / 100) * amount;
newTotal = amount - diskonAmount - diskonRp;
console.log("new total");
console.log(newTotal);
if (newTotal < 0) {
alert("Total tes " + data.testName + " tidak boleh kurang dari 0");
return;
}
if (newTotal == NaN) {
newTotal = 0;
}
data.subTotal = newTotal;
},
handleSave() {
let submitted = [];
data = this.priceTestList;
for (let i = 0; i < data.length; i++) {
const e = data[i];
if (
e.priceAmount !== "" &&
e.priceAmount !== null &&
e.priceAmount !== undefined
) {
if (
isNaN(e.priceAmount) ||
isNaN(e.priceDisc) ||
isNaN(e.priceDiscRp)
) {
alert("Input test " + e.testName + " salah, mohon ulangi");
return;
}
diskon = parseFloat(e.priceDisc);
diskonRp = parseFloat(e.priceDiscRp);
amount = parseFloat(e.priceAmount);
total = parseFloat(e.subTotal);
if (diskon > 100) {
alert(
"Diskon % test " +
e.testName +
" Tidak boleh lebih dari 100, mohon ulangi"
);
return;
}
if (diskon < 0) {
alert(
"Diskon % test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (diskonRp > amount) {
alert(
"Diskon Rp test " +
e.testName +
" Tidak boleh lebih dari price amount, mohon ulangi"
);
return;
}
if (diskonRp < 0) {
alert(
"Diskon Rp test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (total < 0) {
alert(
"Total test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (total > amount) {
console.log(total);
console.log(amount);
alert(
"Total test " +
e.testName +
" Tidak boleh lebih dari price amount, mohon ulangi"
);
return;
}
if (e.isChange == "Y") {
submitted.push(e);
}
}
}
console.log(submitted);
if (submitted.length > 0) {
console.log("submitted > 0");
this.$store.dispatch("price/savetest", {
test: submitted,
});
} else {
alert("Tidak ada yang perlu disimpan");
}
// priceAmount
// priceDisc
// priceDiscRp
// subTotal
// testID
},
handleChangeFIlter() {
let submitted = [];
data = this.priceTestList;
if (data !== undefined && data !== null) {
for (let i = 0; i < data.length; i++) {
const e = data[i];
if (
e.priceAmount !== "" &&
e.priceAmount !== null &&
e.priceAmount !== undefined
) {
if (
isNaN(e.priceAmount) ||
isNaN(e.priceDisc) ||
isNaN(e.priceDiscRp)
) {
alert("Input test " + e.testName + " salah, mohon ulangi");
return;
}
diskon = parseFloat(e.priceDisc);
diskonRp = parseFloat(e.priceDiscRp);
amount = parseFloat(e.priceAmount);
total = parseFloat(e.subTotal);
if (diskon > 100) {
alert(
"Diskon % test " +
e.testName +
" Tidak boleh lebih dari 100, mohon ulangi"
);
return;
}
if (diskon < 0) {
alert(
"Diskon % test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (diskonRp > amount) {
alert(
"Diskon Rp test " +
e.testName +
" Tidak boleh lebih dari price amount, mohon ulangi"
);
return;
}
if (diskonRp < 0) {
alert(
"Diskon Rp test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (total < 0) {
alert(
"Total test " +
e.testName +
" Tidak boleh kurang dari 0, mohon ulangi"
);
return;
}
if (total > amount) {
console.log(total);
console.log(amount);
alert(
"Total test " +
e.testName +
" Tidak boleh lebih dari price amount, mohon ulangi"
);
return;
}
if (e.isChange == "Y") {
submitted.push(e);
}
}
}
}
console.log(submitted);
// priceAmount
// priceDisc
// priceDiscRp
// subTotal
// testID
return submitted;
},
validateHeader() {
this.$store.dispatch("price/validateheader");
},
},
computed: {
filterName: {
get() {
return this.$store.state.price.filterName;
},
set(val) {
let dt = this.handleChangeFIlter();
if (dt !== undefined && dt !== null) {
if (dt.length > 0) {
if (
confirm(
"Data belum belum tersimpan, Apakah anda yakin untuk melanjutkan ?"
)
) {
this.$store.commit("price/update_filterName", val);
this.$store.dispatch("price/searchpricetest");
return;
} else {
return;
}
} else {
this.$store.commit("price/update_filterName", val);
this.$store.dispatch("price/searchpricetest");
}
}
},
},
filterSubGroup: {
get() {
return this.$store.state.price.filterSubGroup;
},
set(val) {
this.$store.commit("price/update_filterSubGroup", val);
},
},
filterStatus: {
get() {
return this.$store.state.price.filterStatus;
},
set(val) {
this.$store.commit("price/update_filterStatus", val);
},
},
selectedFilterSubGroup: {
get() {
return this.$store.state.price.selectedFilterSubGroup;
},
set(val) {
let dt = this.handleChangeFIlter();
if (dt !== undefined && dt !== null) {
if (dt.length > 0) {
if (
confirm(
"Data belum belum tersimpan, Apakah anda yakin untuk melanjutkan ?"
)
) {
this.$store.commit("price/update_selectedFilterSubGroup", val);
this.$store.dispatch("price/searchpricetest");
return;
} else {
return;
}
} else {
this.$store.commit("price/update_selectedFilterSubGroup", val);
this.$store.dispatch("price/searchpricetest");
}
}
},
},
selectedFilterStatus: {
get() {
return this.$store.state.price.selectedFilterStatus;
},
set(val) {
let dt = this.handleChangeFIlter();
if (dt !== undefined && dt !== null) {
if (dt.length > 0) {
if (
confirm(
"Data belum belum tersimpan, Apakah anda yakin untuk melanjutkan ?"
)
) {
this.$store.commit("price/update_selectedFilterStatus", val);
this.$store.dispatch("price/searchpricetest");
return;
} else {
return;
}
} else {
this.$store.commit("price/update_selectedFilterStatus", val);
this.$store.dispatch("price/searchpricetest");
}
}
},
},
loading: {
get() {
return this.$store.state.price.loading;
},
set(val) {
this.$store.commit("price/update_loading", val);
},
},
errorMsg: {
get() {
return this.$store.state.price.errorMsg;
},
set(val) {
this.$store.commit("price/update_errorMsg", val);
},
},
snackbarError: {
get() {
return this.$store.state.price.snackbarError;
},
set(val) {
this.$store.commit("price/update_snackbarError", val);
},
},
snackbarSuccess: {
get() {
return this.$store.state.price.snackbarSuccess;
},
set(val) {
this.$store.commit("price/update_snackbarSuccess", val);
},
},
selectedPriceHeader: {
get() {
return this.$store.state.price.selectedPriceHeader;
},
set(val) {
this.$store.commit("price/update_selectedPriceHeader", val);
this.$store.dispatch("price/searchpricetest");
},
},
successMsg: {
get() {
return this.$store.state.price.successMsg;
},
set(val) {
this.$store.commit("price/update_successMsg", val);
},
},
priceTestList: {
get() {
return this.$store.state.price.priceTestList;
},
set(val) {
this.$store.commit("price/update_priceTestList", val);
},
},
priceTestPageTotal: {
get() {
return this.$store.state.price.priceTestPageTotal;
},
set(val) {
this.$store.commit("price/update_priceTestPageTotal", val);
},
},
dialogValidasi: {
get() {
return this.$store.state.price.dialogValidasi;
},
set(val) {
this.$store.commit("price/update_dialogValidasi", val);
},
},
priceTestPage: {
get() {
return this.$store.state.price.priceTestPage;
},
set(val) {
dt = this.handleChangeFIlter();
if (dt.length > 0) {
if (
confirm(
"Data belum belum tersimpan, Apakah anda yakin untuk melanjutkan ?"
)
) {
this.$store.commit("price/update_priceTestPage", val);
this.$store.dispatch("price/searchpricetest");
}
} else {
this.$store.commit("price/update_priceTestPage", val);
this.$store.dispatch("price/searchpricetest");
}
},
},
},
watch: {},
data() {
return {
selected_delivery: {},
search_company: "",
search_test: "",
menufilterdatestart: false,
menufilterdateend: false,
date: new Date().toISOString().substr(0, 10),
items: [],
menustartdate: false,
menuenddate: false,
errors: [],
sheet: false,
indeterminatex: false,
checkednotall: false,
bar_chx_all: false,
selected_barcode: [],
dialogtimeline: false,
search_doctor: "",
dialogWarning: false,
dialogWarningMsg: "",
rules: {
min: (v) => v > 0 || "Minimum value 1",
maxPersen: (v) => v <= 100 || "Maximum value 100",
},
headers: [
{
text: "STATUS",
align: "center",
sortable: false,
value: "lab",
width: "10%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "TEST",
align: "center",
sortable: false,
value: "lab",
width: "25%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "AMOUNT",
align: "center",
sortable: false,
value: "lab",
width: "15%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "DISKON",
align: "center",
sortable: false,
value: "name",
width: "15%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "DISKON RP",
align: "center",
sortable: false,
value: "name",
width: "15%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "TOTAL",
align: "center",
sortable: false,
value: "status",
width: "20%",
class: "pa-2 blue darken-2 white--text",
},
],
};
},
};
</script>

View File

@@ -0,0 +1,59 @@
POST https://devcpone.aplikasi.web.id/one-api/mockup/cpone-map-setup-kelainangroupsummary/Setupmapkelainan/getsetup/
Content-Type: "application/json"
{
"search":"adm",
"page":"1",
"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJNX1VzZXJJRCI6IjIiLCJNX1VzZXJFbWFpbCI6Impva29AZ21haWwuY29tIiwiTV9Vc2VyVXNlcm5hbWUiOiJqb2tvQGdtYWlsLmNvbSIsIk1fVXNlckdyb3VwRGFzaGJvYXJkIjoib25lLXVpXC90ZXN0XC92dWV4XC9jcG9uZS1zZXR1cC1tY3UtdjNcLyIsIk1fVXNlckRlZmF1bHRUX1NhbXBsZVN0YXRpb25JRCI6IjEiLCJNX1N0YWZmTmFtZSI6IlBFVFVHQVMgU0FNUExFIExBQiIsImlzX2NvdXJpZXIiOiJOIiwidGltZV9hdXRvbG9nb3V0IjoiMTAwMDAwMDAiLCJpcCI6IjEyOC4xOTkuODYuNyIsImFnZW50IjoiR28taHR0cC1jbGllbnRcLzEuMSIsInZlcnNpb24iOiJ2MiIsImxhc3QtbG9naW4iOiIyMDI0LTA3LTE2IDE0OjEzOjUwIn0.8quyx-y_QBNvfFKx3Ez0ZvXzeLrhn-SYlO2YzNrtFCc"
}
###
POST https://devcpone.aplikasi.web.id/one-api/mockup/cpone-map-setup-kelainangroupsummary/Setupmapkelainan/getdetail/
Content-Type: "application/json"
{
"setup":"66",
"page":"1",
"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJNX1VzZXJJRCI6IjIiLCJNX1VzZXJFbWFpbCI6Impva29AZ21haWwuY29tIiwiTV9Vc2VyVXNlcm5hbWUiOiJqb2tvQGdtYWlsLmNvbSIsIk1fVXNlckdyb3VwRGFzaGJvYXJkIjoib25lLXVpXC90ZXN0XC92dWV4XC9jcG9uZS1zZXR1cC1tY3UtdjNcLyIsIk1fVXNlckRlZmF1bHRUX1NhbXBsZVN0YXRpb25JRCI6IjEiLCJNX1N0YWZmTmFtZSI6IlBFVFVHQVMgU0FNUExFIExBQiIsImlzX2NvdXJpZXIiOiJOIiwidGltZV9hdXRvbG9nb3V0IjoiMTAwMDAwMDAiLCJpcCI6IjEyOC4xOTkuODYuNyIsImFnZW50IjoiR28taHR0cC1jbGllbnRcLzEuMSIsInZlcnNpb24iOiJ2MiIsImxhc3QtbG9naW4iOiIyMDI0LTA3LTE2IDE0OjEzOjUwIn0.8quyx-y_QBNvfFKx3Ez0ZvXzeLrhn-SYlO2YzNrtFCc"
}
###
POST https://devcpone.aplikasi.web.id/one-api/mockup/cpone-map-setup-kelainangroupsummary/Setupmapkelainan/save/
Content-Type: "application/json"
{
"setup":{
"Mgm_McuID": "61",
"Mgm_McuReportHasil": "1",
"Mgm_McuT_PriceHeaderID": "53",
"Mgm_McuM_BranchID": "1",
"Mgm_McuFlagTagihanSebagian": "N",
"Mgm_McuLabel": "ADM SUNTER",
"Mgm_McuFlagRelasiBayarSendiri": "N",
"Mgm_McuBisaTambahPemeriksaan": "Y",
"Mgm_McuCorporateID": "49",
"Mgm_McuNumber": "MGM240700014",
"Mgm_McuNumberNational": "",
"Mgm_McuNote": "",
"Mgm_McuStartDate": "2024-07-14",
"Mgm_McuEndDate": "2024-10-31",
"Mgm_McuPicName": "ELVIRA",
"Mgm_McuPicEmail": "virakatepul@gmail.com",
"Mgm_McuPicPassword": "f8b21215aeda4cf28fc27f529f977d99",
"Mgm_McuGeneratePasswordBY": "hrd",
"Mgm_McuIsActive": "Y",
"Mgm_McuCreated": "2024-07-14 18:07:47",
"Mgm_McuCreatedUserID": "2",
"Mgm_McuLastUpdated": "2024-07-15 03:24:04",
"Mgm_McuLastUpdatedUserID": "17",
"Mgm_McuLastDeleted": "0000-00-00 00:00:00",
"Mgm_McuLastDeletedUserID": "0",
"Mgm_McuTotalParticipant": "0"
},
"data":{
"kelainanGroupSummaryID": "1",
"kelainanGroupSummaryName": "Kelainan Merokok",
"mappingID": null,
"status": "N"
},
"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJNX1VzZXJJRCI6IjIiLCJNX1VzZXJFbWFpbCI6Impva29AZ21haWwuY29tIiwiTV9Vc2VyVXNlcm5hbWUiOiJqb2tvQGdtYWlsLmNvbSIsIk1fVXNlckdyb3VwRGFzaGJvYXJkIjoib25lLXVpXC90ZXN0XC92dWV4XC9jcG9uZS1zZXR1cC1tY3UtdjNcLyIsIk1fVXNlckRlZmF1bHRUX1NhbXBsZVN0YXRpb25JRCI6IjEiLCJNX1N0YWZmTmFtZSI6IlBFVFVHQVMgU0FNUExFIExBQiIsImlzX2NvdXJpZXIiOiJOIiwidGltZV9hdXRvbG9nb3V0IjoiMTAwMDAwMDAiLCJpcCI6IjEyOC4xOTkuODYuNyIsImFnZW50IjoiR28taHR0cC1jbGllbnRcLzEuMSIsInZlcnNpb24iOiJ2MiIsImxhc3QtbG9naW4iOiIyMDI0LTA3LTE2IDE0OjEzOjUwIn0.8quyx-y_QBNvfFKx3Ez0ZvXzeLrhn-SYlO2YzNrtFCc"
}

View File

@@ -0,0 +1,101 @@
<!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/icomoon-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 xs5 class="left" fill-height pa-1>
<one-header></one-header>
</v-flex>
<v-flex xs7 class="right" fill-height pa-1>
<one-list></one-list>
</v-flex>
<!-- <v-flex xs6 class="right" fill-height pa-1> -->
<!-- komponen kanan -->
<!-- <one-fo-cashier-payment></one-fo-cashier-payment>-->
<!-- </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>
<!-- <script src="../../libs/one_print_barcode.js"></script>
<script src="../../libs/one_print_robo.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/oneNavbarComponentNoMenu.vue'),
'one-footer': httpVueLoader('../../apps/components/oneFooter.vue'),
'one-header': httpVueLoader('./components/header.vue'),
'one-list': httpVueLoader('./components/detail.vue'),
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {}
.right {}
</style>
</body>
</html>

View File

@@ -0,0 +1,480 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/mapping.js"
export default {
namespaced: true,
state: {
lookup_status: 0,
loading: false,
page: 1,
totalPageHeader: 0,
pageDetail: 1,
totalPageDetail: 0,
searchHeader: "",
searchDetail: "",
selectedSetup: {
Mgm_McuID: '0',
},
setupList: [],
kelainanList: [],
errorMsg: '',
snackbarSuccess: false,
snackbarError: false,
successMsg: '',
},
mutations: {
update_lookup_status(state, val) {
state.lookup_status = val
},
update_searchHeader(state, val) {
state.searchHeader = val
},
update_searchDetail(state, val) {
state.searchDetail = val
},
update_loading(state, val) {
state.loading = val
},
update_page(state, val) {
state.page = val
},
update_totalPageHeader(state, val) {
state.totalPageHeader = val
},
update_pageDetail(state, val) {
state.pageDetail = val
},
update_totalPageDetail(state, val) {
state.totalPageDetail = val
},
update_errorMsg(state, val) {
state.errorMsg = val
},
update_snackbarSuccess(state, val) {
state.snackbarSuccess = val
},
update_snackbarError(state, val) {
state.snackbarError = val
},
update_successMsg(state, val) {
state.successMsg = val
},
update_selectedSetup(state, val) {
state.selectedSetup = val
},
update_setupList(state, val) {
state.setupList = val
},
update_kelainanList(state, val) {
state.kelainanList = val
},
},
actions: {
async searchSetup(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
token: one_token(),
page: context.state.page,
search: context.state.searchHeader
}
let resp = await api.search(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", false)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_setupList", resp.data.records)
if (resp.data.records.length > 0 && context.state.selectedSetup.Mgm_McuID === "0") {
context.commit("update_selectedSetup", resp.data.records[0])
context.dispatch("searchDetail")
// this.$store.dispatch("price/searchpricetest");
} else if (resp.data.records.length > 0 && context.state.selectedSetup.Mgm_McuID !== "0") {
for (let i = 0; i < resp.data.records.length; i++) {
const e = resp.data.records[i];
if (e.headerID === context.state.selectedSetup.Mgm_McuID) {
context.commit("update_selectedSetup", e)
}
}
}
context.commit("update_totalPageHeader", resp.data.total)
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
context.commit("update_snackbarError", false)
}
},
async searchDetail(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
token: one_token(),
setupid: context.state.selectedSetup.Mgm_McuID,
page: context.state.pageDetail,
search: context.state.searchDetail
}
let resp = await api.getdetail(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", false)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_kelainanList", resp.data.records)
context.commit("update_totalPageDetail", resp.data.total)
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
context.commit("update_snackbarError", false)
}
},
async addKelainanGroup(context, data) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
token: one_token(),
setup: context.state.selectedSetup,
data: data,
}
let resp = await api.save(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", true)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_successMsg", 'Berhasil ubah data')
context.commit("update_snackbarSuccess", true)
context.commit("update_loading", false)
context.dispatch("searchDetail")
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
context.commit("update_snackbarError", true)
}
},
async insertPriceHeader(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
token: one_token(),
name: context.state.nameHeader,
sd: context.state.startDateHeader,
ed: context.state.endDateHeader
}
let resp = await api.insertheader(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_snackbarError", true)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_successMsg", 'Berhasil Membuat Harga ' + context.state.nameHeader)
context.commit("update_loading", false)
context.commit("update_snackbarSuccess", true)
context.commit("update_dialogPriceHeader", false)
context.commit("update_nameHeader", '')
context.dispatch("searchPriceHeader")
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_snackbarError", true)
context.commit("update_errorMsg", e)
}
},
async editPriceHeader(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
id: context.state.selectedPriceHeader.headerID,
token: one_token(),
name: context.state.nameHeader,
sd: context.state.startDateHeader,
ed: context.state.endDateHeader
}
let resp = await api.editheader(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_snackbarError", true)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_successMsg", 'Berhasil Edit Harga ' + context.state.nameHeader)
context.commit("update_loading", false)
context.commit("update_snackbarSuccess", true)
context.commit("update_dialogPriceHeader", false)
context.commit("update_nameHeader", '')
context.dispatch("searchPriceHeader")
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_snackbarError", true)
context.commit("update_errorMsg", e)
}
},
async deletePriceHeader(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
id: context.state.selectedPriceHeader.headerID,
token: one_token(),
}
let resp = await api.deleteheader(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_snackbarError", true)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_successMsg", 'Berhasil Hapus Harga ' + context.state.nameHeader)
context.commit("update_loading", false)
context.commit("update_snackbarSuccess", true)
context.commit("update_dialogDeleteHeader", false)
context.commit("update_nameHeader", '')
context.dispatch("searchPriceHeader")
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_snackbarError", true)
context.commit("update_errorMsg", e)
}
},
async getpricefilter(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
token: one_token(),
}
let resp = await api.getfilterprice(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
context.commit("update_filterStatus", resp.data.status)
context.commit("update_filterSubGroup", resp.data.subgroup)
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
}
},
async searchpricetest(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
token: one_token(),
search: context.state.filterName,
subgroup: context.state.selectedFilterSubGroup.id,
status: context.state.selectedFilterStatus.id,
headerid: context.state.selectedPriceHeader.headerID,
page: context.state.priceTestPage,
}
let resp = await api.searchpricetest(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
context.commit("update_priceTestList", resp.data.records)
context.commit("update_priceTestPageTotal", resp.data.total)
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
}
},
async savetest(context, prm) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
prm.token = one_token();
prm.headerid = context.state.selectedPriceHeader.headerID
let resp = await api.savetest(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_snackbarError", false)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_successMsg", 'Berhasil simpan harga')
context.commit("update_snackbarSuccess", false)
context.commit("update_loading", false)
context.dispatch("searchpricetest");
context.dispatch("searchPriceHeader");
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
}
},
async copyharga(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
token: one_token(),
headerid: context.state.selectedPriceHeaderCopy.headerID,
name: context.state.nameHeader,
copypacket: context.state.copyPacket
}
let resp = await api.copyharga(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", false)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
context.commit("update_successMsg", 'Berhasil copy harga')
context.commit("update_snackbarSuccess", false)
context.dispatch("searchPriceHeader");
context.commit("update_dialogCopyHarga", false)
context.commit("update_nameHeader", '')
context.commit("update_selectedPriceHeaderCopy", {})
context.commit("update_copyPacket", false)
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
}
},
async validateheader(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
token: one_token(),
id: context.state.selectedPriceHeader.headerID,
}
let resp = await api.validateheader(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_successMsg", 'Berhasil validasi price header')
context.commit("update_snackbarSuccess", false)
context.commit("update_loading", false)
context.commit("update_dialogValidasi", false)
context.dispatch("searchPriceHeader");
context.dispatch("searchpricetest");
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
}
},
async searchPriceHeaderAutocomplete(context, prm) {
context.commit("update_lookup_status", 1)
try {
prm.token = one_token();
prm.headerid = context.state.selectedPriceHeader.headerID
let resp = await api.searchpricetestautocomplete(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_priceHeaderCopyList", resp.data.records)
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_errorMsg", e)
}
},
}
}

View File

@@ -0,0 +1,442 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/price.js"
export default {
namespaced: true,
state: {
lastidx: 0,
lookup_status: 0,
lookup_error_message: '',
search_patient: 0,
search_error_message: '',
start_date: moment(new Date()).format('YYYY-MM-DD'),
end_date: moment(new Date()).format('YYYY-MM-DD'),
search: '',
total_patiens: 0,
total_filter_patiens: 0,
total_patients_all: 0,
patients: [],
total_patient: 0,
selected_patient: { totalbill: 0 },
save_error_message: '',
statuses: [{ name: 'Belum Lunas', value: 'N' }, { name: 'Lunas', value: 'Y' }, { name: 'Semua', value: 'A' }],
selected_status: { name: 'Belum Lunas', value: 'N' },
open_alert_no_pay: false,
msg_alert_no_pay: "Loh ... Gak jadi bayar dong ?",
current_page: 1,
total_page: 0,
filters: [{ id: 'day', name: 'Hari ini' }, { id: 'notsampled', name: 'Belum sampling' }, { id: 'all', name: 'Tampilkan semua' }],
selected_filter: { id: 'day', name: 'Hari ini' },
promise_dialog: false,
promises: [],
errors: [],
save_status: 0,
save_error_message: '',
barcodes: [],
dialog_barcode: false,
autocomplete_status: 0,
companies: [],
selected_company: { id: 0, name: 'Semua' },
doctors: [],
selected_doctor: { id: 0, name: 'Semua' },
dialog_timeline_delivery: false,
timeline_delivery: [],
dialog_update_dob: false,
show_form_dob: 'N',
data_patient: {},
alert_success: false,
msg_success: "",
filter_tests: [],
selected_filter_test: {},
dialogQrCode: false,
urlQrCode: ''
},
mutations: {
update_filter_tests(state, val) {
state.filter_tests = val
},
update_selected_filter_test(state, val) {
state.selected_filter_test = val
},
update_alert_success(state, val) {
state.alert_success = val
},
update_msg_success(state, val) {
state.msg_success = val
},
update_data_patient(state, val) {
state.data_patient = val
},
update_show_form_dob(state, val) {
state.show_form_dob = val
},
update_dialog_update_dob(state, val) {
state.dialog_update_dob = val
},
update_timeline_delivery(state, val) {
state.timeline_delivery = val
},
update_dialog_timeline_delivery(state, val) {
state.dialog_timeline_delivery = val
},
update_companies(state, val) {
state.companies = val
},
update_selected_company(state, val) {
state.selected_company = val
},
update_doctors(state, val) {
state.doctors = val
},
update_selected_doctor(state, val) {
state.selected_doctor = val
},
update_dialog_barcode(state, val) {
state.dialog_barcode = val
},
update_barcodes(state, val) {
state.barcodes = val
},
update_total_patients_all(state, val) {
state.total_patients_all = val
},
update_save_status(state, val) {
state.save_status = val
},
update_save_error_message(state, val) {
state.save_error_message = val
},
update_lookup_error_message(state, val) {
state.lookup_error_message = val
},
update_lookup_status(state, status) {
state.lookup_status = status
},
update_promise_dialog(state, val) {
state.promise_dialog = val
},
update_promises(state, val) {
state.promises = val
},
update_errors(state, val) {
state.errors = val
},
update_lastidx(state, val) {
state.lastidx = val
},
update_selected_filter(state, val) {
state.selected_filter = val
},
update_filters(state, val) {
state.filters = val
},
update_total_page(state, val) {
state.total_page = val
},
update_total_patient(state, val) {
state.total_patient = val
},
update_current_page(state, val) {
state.current_page = val
},
update_search_error_message(state, patient) {
state.search_error_message = patient
},
update_search_patient(state, patient) {
state.search_patient = patient
},
update_patients(state, data) {
state.patients = data.records
state.total_patient = data.total
state.total_page = data.total
state.total_patients = data.total
state.total_filter_patients = data.total_filter
},
update_selected_patient(state, val) {
state.selected_patient = val
},
update_start_date(state, val) {
state.start_date = val
},
update_autocomplete_status(state, val) {
state.autocomplete_status = val
},
update_end_date(state, val) {
state.end_date = val
},
update_search(state, val) {
state.search = val
},
update_selected_status(state, val) {
state.selected_status = val
},
update_open_alert_no_pay(state, val) {
state.open_alert_no_pay = val
},
update_msg_alert_no_pay(state, val) {
state.msg_alert_no_pay = val
},
update_dialogQrCode(state, val) {
state.dialogQrCode = val
},
update_urlQrCode(state, val) {
state.urlQrCode = val
}
},
actions: {
async search(context, prm) {
context.commit("update_search_patient", 1)
try {
console.log(prm)
prm.token = one_token()
let data = {
records: [],
total: 0,
total_filter: 0
}
context.commit("update_patients", data)
let resp = await api.search(prm)
if (resp.status != "OK") {
context.commit("update_search_patient", 3)
context.commit("update_search_error_message", resp.message)
} else {
context.commit("update_search_patient", 2)
context.commit("update_search_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total,
total_filter: resp.data.total_filter
}
console.log("")
console.log(data.records)
context.commit("update_patients", data)
context.commit("update_total_page", data.total)
context.commit("update_total_patients_all", resp.data.total_all)
if (prm.lastidx === -1) {
context.commit("update_selected_patient", data.records[0])
if (!_.isEmpty(data.records[0]))
context.commit("payment/update_notes", data.records[0].notes, { root: true })
else
context.commit("payment/update_notes", [], { root: true })
}
else {
context.commit("update_selected_patient", data.records[prm.lastidx])
context.commit("payment/update_notes", data.records[prm.lastidx].notes, { root: true })
}
}
} catch (e) {
context.commit("update_search_patient", 3)
context.commit("update_search_error_message", e.message)
console.log(e)
}
},
async lookup_promises(context, prm) {
context.commit("update_lookup_status", 1)
try {
prm.token = one_token()
let resp = await api.lookup_promises(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_lookup_error_message", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_lookup_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_promises", data.records)
context.commit("update_promise_dialog", true)
}
} catch (e) {
context.commit("update_lookup_status", 3)
context.commit("update_lookup_error_message", e.message)
}
},
async getdatabarcodes(context, prm) {
context.commit("update_lookup_status", 1)
try {
prm.token = one_token()
let resp = await api.getdatabarcodes(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_lookup_error_message", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_lookup_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_barcodes", data.records)
context.commit("update_dialog_barcode", true)
}
} catch (e) {
context.commit("update_lookup_status", 3)
context.commit("update_lookup_error_message", e.message)
}
},
async getdatadob(context, prm) {
context.commit("update_lookup_status", 1)
try {
prm.token = one_token()
let resp = await api.getdatadob(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_lookup_error_message", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_lookup_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_data_patient", data.records)
context.commit("update_show_form_dob", resp.data.status)
context.commit("update_dialog_update_dob", true)
}
} catch (e) {
context.commit("update_lookup_status", 3)
context.commit("update_lookup_error_message", e.message)
}
},
async gettimelinedelivery(context, prm) {
context.commit("update_lookup_status", 1)
try {
prm.token = one_token()
let resp = await api.gettimelinedelivery(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_lookup_error_message", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_lookup_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_timeline_delivery", data.records)
context.commit("update_dialog_timeline_delivery", true)
}
} catch (e) {
context.commit("update_lookup_status", 3)
context.commit("update_lookup_error_message", e.message)
}
},
async savepromises(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.save_promises(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", "")
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_promises", data.records)
context.commit("update_promise_dialog", false)
var xsearch = prm.search
context.dispatch("search", xsearch)
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", e.message)
console.log(e)
}
},
async searchcompany(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.searchcompany(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_companies", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async searchdoctor(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.searchdoctor(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_doctors", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async searchtest(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
let resp = await api.searchtest(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_filter_tests", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async updatedob(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
prm.orderid = context.state.selected_patient.T_OrderHeaderID
prm.token = one_token()
let resp = await api.updatedob(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_dialog_update_dob", false)
var msg = "Terima kasih telah meng-update tanggal lahir, jadi gak bingung dong kalo mau ultah"
if (prm.status === 'Y') {
msg = "Terima kasih, Mimin akan melanjutkan request ini ke bagian proses"
}
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
}
}
}

View File

@@ -0,0 +1,149 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/payment.js"
export default {
namespaced: true,
state: {
lookup_status:0,
lookup_error_message:'',
types: [],
total_payment:0,
reload_after_save: false,
dialog_pay_success:false,
paynumber :'',
notes :[],
dialog_delete:false,
msg_delete:'',
note_delete:'',
nota_delete:{},
open_print_note:false,
idx:0,
last_payments:{}
},
mutations: {
update_lookup_error_message(state,val) {
state.lookup_error_message = val
},
update_lookup_status(state,status) {
state.lookup_status = status
},
update_types(state,data) {
state.types = data.records
state.total_type = data.total
},
update_selected_status(state,val) {
state.selected_status=val
},
update_total_payment(state,val) {
state.total_payment=val
},
update_reload_after_save(state,val) {
state.reload_after_save=val
},
update_dialog_pay_success(state,val) {
state.dialog_pay_success=val
},
update_paynumber(state,val) {
state.paynumber=val
},
update_notes(state,val) {
state.notes=val
},
update_dialog_delete(state,val) {
state.dialog_delete=val
},
update_note_delete(state,val) {
state.note_delete=val
},
update_msg_delete(state,val) {
state.msg_delete=val
},
update_nota_delete(state,val) {
state.nota_delete=val
},
update_open_print_note(state,val) {
state.open_print_note=val
},
update_idx(state,val) {
state.idx=val
},
update_last_payments(state,val) {
state.last_payments=val
}
},
actions: {
async lookup_type(context) {
context.commit("update_lookup_status",1)
try {
let resp= await api.lookup_type(one_token())
if (resp.status != "OK") {
context.commit("update_lookup_status",3)
context.commit("update_lookup_error_message",resp.message)
} else {
context.commit("update_lookup_status",2)
context.commit("update_lookup_error_message","")
let data = {
records : resp.data.records,
total: resp.data.total
}
context.commit("update_types",data)
}
} catch(e) {
context.commit("update_lookup_status",3)
context.commit("update_lookup_error_message",e.message )
}
},
async pay(context,prm) {
context.commit("update_lookup_status",1)
try {
prm.token = one_token()
let resp= await api.pay(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status",3)
context.commit("update_lookup_error_message",resp.message)
} else {
context.commit("update_lookup_status",2)
context.commit("update_lookup_error_message","")
let data = {
records : resp.data.records.types,
total: resp.data.total
}
let xnumber = resp.data.records.data.numberx
let id = resp.data.records.data.idx
context.commit("update_types",data)
context.commit("update_last_payments",prm.payments)
context.commit("update_idx",id)
context.commit("update_total_payment",0)
context.commit("update_paynumber","Pembayaran nomor <span style='color:red'>"+xnumber+"</span> telah berhasil")
context.commit("update_dialog_pay_success",true)
}
} catch(e) {
context.commit("update_lookup_status",3)
context.commit("update_lookup_error_message",e.message )
}
},
async delete_note(context,prm) {
context.commit("update_lookup_status",1)
try {
prm.token = one_token()
let resp= await api.delete_note(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status",3)
context.commit("update_lookup_error_message",resp.message)
} else {
context.commit("update_lookup_status",2)
context.commit("update_lookup_error_message","")
let xmsg = "Nota nomor <span style='color:red'>"+prm.nota.note_number+"</span> telah dihapus"
context.commit("update_msg_delete",xmsg)
context.commit("update_note_delete",'')
context.commit("update_nota_delete",{})
}
} catch(e) {
context.commit("update_lookup_status",3)
context.commit("update_lookup_error_message",e.message )
}
}
}
}

View File

@@ -0,0 +1,475 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/price.js"
export default {
namespaced: true,
state: {
lookup_status: 0,
searchPrice: "",
priceHeaderList: [],
loading: false,
page: 1,
totalPageHeader: 0,
errorMsg: '',
snackbarSuccess: false,
snackbarError: false,
successMsg: '',
selectedPriceHeader: {
"headerID": "0",
"headerName": "",
"headerStartDate": "",
"headerEndDate": "",
"headerCode": "CODE"
},
dialogPriceHeader: false,
dialogDeleteHeader: false,
startDateHeader: moment(new Date()).format('YYYY-MM-DD'),
endDateHeader: moment(new Date()).format('YYYY-MM-DD'),
nameHeader: "",
filterName: "",
filterSubGroup: [],
filterStatus: [],
selectedFilterSubGroup: {
"id": "0",
'name': 'Semua'
},
selectedFilterStatus: {
"id": "A",
'name': 'Semua'
},
priceTestList: [],
priceTestPageTotal: 0,
priceTestPage: 1,
priceHeaderCopyList: [],
selectedPriceHeaderCopy: {},
dialogCopyHarga: false,
copyPacket: false,
dialogValidasi: false,
},
mutations: {
update_lookup_status(state, val) {
state.lookup_status = val
},
update_searchPrice(state, val) {
state.searchPrice = val
},
update_priceHeaderList(state, val) {
state.priceHeaderList = val
},
update_loading(state, val) {
state.loading = val
},
update_page(state, val) {
state.page = val
},
update_totalPageHeader(state, val) {
state.totalPageHeader = val
},
update_errorMsg(state, val) {
state.errorMsg = val
},
update_snackbarSuccess(state, val) {
state.snackbarSuccess = val
},
update_snackbarError(state, val) {
state.snackbarError = val
},
update_successMsg(state, val) {
state.successMsg = val
},
update_selectedPriceHeader(state, val) {
state.selectedPriceHeader = val
},
update_dialogPriceHeader(state, val) {
state.dialogPriceHeader = val
},
update_startDateHeader(state, val) {
state.startDateHeader = val
},
update_endDateHeader(state, val) {
state.endDateHeader = val
},
update_nameHeader(state, val) {
state.nameHeader = val
},
update_dialogDeleteHeader(state, val) {
state.dialogDeleteHeader = val
},
update_filterName(state, val) {
state.filterName = val
},
update_filterStatus(state, val) {
state.filterStatus = val
},
update_filterSubGroup(state, val) {
state.filterSubGroup = val
},
update_selectedFilterStatus(state, val) {
state.selectedFilterStatus = val
},
update_selectedFilterSubGroup(state, val) {
state.selectedFilterSubGroup = val
},
update_priceTestList(state, val) {
state.priceTestList = val
},
update_priceTestPageTotal(state, val) {
state.priceTestPageTotal = val
},
update_priceTestPage(state, val) {
state.priceTestPage = val
},
update_priceHeaderCopyList(state, val) {
state.priceHeaderCopyList = val
},
update_selectedPriceHeaderCopy(state, val) {
state.selectedPriceHeaderCopy = val
},
update_dialogCopyHarga(state, val) {
state.dialogCopyHarga = val
},
update_copyPacket(state, val) {
state.copyPacket = val
},
update_dialogValidasi(state, val) {
state.dialogValidasi = val
},
},
actions: {
async searchPriceHeader(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
token: one_token(),
page: context.state.page,
search: context.state.searchPrice
}
let resp = await api.search(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", false)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_priceHeaderList", resp.data.records)
if (resp.data.records.length > 0 && context.state.selectedPriceHeader.headerID === "0") {
context.commit("update_selectedPriceHeader", resp.data.records[0])
context.dispatch("searchpricetest")
// this.$store.dispatch("price/searchpricetest");
} else if (resp.data.records.length > 0 && context.state.selectedPriceHeader.headerID !== "0") {
for (let i = 0; i < resp.data.records.length; i++) {
const e = resp.data.records[i];
if (e.headerID === context.state.selectedPriceHeader.headerID) {
context.commit("update_selectedPriceHeader", e)
}
}
}
context.commit("update_totalPageHeader", resp.data.total)
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
context.commit("update_snackbarError", false)
}
},
async insertPriceHeader(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
token: one_token(),
name: context.state.nameHeader,
sd: context.state.startDateHeader,
ed: context.state.endDateHeader
}
let resp = await api.insertheader(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_snackbarError", true)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_successMsg", 'Berhasil Membuat Harga ' + context.state.nameHeader)
context.commit("update_loading", false)
context.commit("update_snackbarSuccess", true)
context.commit("update_dialogPriceHeader", false)
context.commit("update_nameHeader", '')
context.dispatch("searchPriceHeader")
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_snackbarError", true)
context.commit("update_errorMsg", e)
}
},
async editPriceHeader(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
id: context.state.selectedPriceHeader.headerID,
token: one_token(),
name: context.state.nameHeader,
sd: context.state.startDateHeader,
ed: context.state.endDateHeader
}
let resp = await api.editheader(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_snackbarError", true)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_successMsg", 'Berhasil Edit Harga ' + context.state.nameHeader)
context.commit("update_loading", false)
context.commit("update_snackbarSuccess", true)
context.commit("update_dialogPriceHeader", false)
context.commit("update_nameHeader", '')
context.dispatch("searchPriceHeader")
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_snackbarError", true)
context.commit("update_errorMsg", e)
}
},
async deletePriceHeader(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
id: context.state.selectedPriceHeader.headerID,
token: one_token(),
}
let resp = await api.deleteheader(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_snackbarError", true)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_successMsg", 'Berhasil Hapus Harga ' + context.state.nameHeader)
context.commit("update_loading", false)
context.commit("update_snackbarSuccess", true)
context.commit("update_dialogDeleteHeader", false)
context.commit("update_nameHeader", '')
context.dispatch("searchPriceHeader")
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_snackbarError", true)
context.commit("update_errorMsg", e)
}
},
async getpricefilter(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
token: one_token(),
}
let resp = await api.getfilterprice(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
context.commit("update_filterStatus", resp.data.status)
context.commit("update_filterSubGroup", resp.data.subgroup)
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
}
},
async searchpricetest(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
token: one_token(),
search: context.state.filterName,
subgroup: context.state.selectedFilterSubGroup.id,
status: context.state.selectedFilterStatus.id,
headerid: context.state.selectedPriceHeader.headerID,
page: context.state.priceTestPage,
}
let resp = await api.searchpricetest(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
context.commit("update_priceTestList", resp.data.records)
context.commit("update_priceTestPageTotal", resp.data.total)
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
}
},
async savetest(context, prm) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
prm.token = one_token();
prm.headerid = context.state.selectedPriceHeader.headerID
let resp = await api.savetest(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_snackbarError", false)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_successMsg", 'Berhasil simpan harga')
context.commit("update_snackbarSuccess", false)
context.commit("update_loading", false)
context.dispatch("searchpricetest");
context.dispatch("searchPriceHeader");
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
}
},
async copyharga(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
token: one_token(),
headerid: context.state.selectedPriceHeaderCopy.headerID,
name: context.state.nameHeader,
copypacket: context.state.copyPacket
}
let resp = await api.copyharga(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", false)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
context.commit("update_successMsg", 'Berhasil copy harga')
context.commit("update_snackbarSuccess", false)
context.dispatch("searchPriceHeader");
context.commit("update_dialogCopyHarga", false)
context.commit("update_nameHeader", '')
context.commit("update_selectedPriceHeaderCopy", {})
context.commit("update_copyPacket", false)
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
}
},
async validateheader(context) {
context.commit("update_lookup_status", 1)
context.commit("update_loading", true)
try {
let prm = {
token: one_token(),
id: context.state.selectedPriceHeader.headerID,
}
let resp = await api.validateheader(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_successMsg", 'Berhasil validasi price header')
context.commit("update_snackbarSuccess", false)
context.commit("update_loading", false)
context.commit("update_dialogValidasi", false)
context.dispatch("searchPriceHeader");
context.dispatch("searchpricetest");
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
}
},
async searchPriceHeaderAutocomplete(context, prm) {
context.commit("update_lookup_status", 1)
try {
prm.token = one_token();
prm.headerid = context.state.selectedPriceHeader.headerID
let resp = await api.searchpricetestautocomplete(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_errorMsg", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_errorMsg", '')
context.commit("update_priceHeaderCopyList", resp.data.records)
}
} catch (e) {
console.log(e)
context.commit("update_lookup_status", 3)
context.commit("update_errorMsg", e)
}
},
}
}

View File

@@ -0,0 +1,29 @@
// State
// data ...
// Mutations
//
//
// Actions
import mapping from "./modules/mapping.js";
import price from "./modules/price.js";
import system from "../../apps/modules/system/system.js";
export const store = new Vuex.Store({
modules: {
mapping: mapping,
price: price,
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)
}
}
});