Flatten nested repos

This commit is contained in:
sas.fajri
2026-04-27 10:13:31 +07:00
parent 01c2963a43
commit 8347aef8f4
17935 changed files with 5015229 additions and 3 deletions

View File

@@ -0,0 +1,92 @@
const URL = "/one-api/tools/";
export async function getListData(prm) {
try {
var resp = await axios.post(URL + 'downloadbackup/list_backup', 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 getsetup(token) {
try {
var resp = await axios.post(URL + 'patient/getsetup', { 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 getCorporate(prm) {
try {
var resp = await axios.post(URL + 'patient/getCorporate', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function search(prm) {
try {
var resp = await axios.post(URL + 'patient/search', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function voidOrder(prm) {
try {
var resp = await axios.post(URL + 'patient/voidOrder', 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/mdprice/mdprice/";
// 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,110 @@
const URL = "/one-api/mockup/fo/antrian/";
export async function getStation() {
try {
var resp = await axios.post(URL + 'AntrianByStationAndLocation/getStation', {});
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 getbranch() {
try {
var resp = await axios.post(URL + 'AntrianByStationAndLocation/getbranch', {});
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 getAntrian(prm) {
try {
var resp = await axios.post(URL + 'AntrianByStationAndLocation/getAntrianV2', 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 getSetup(branchID) {
try {
var resp = await axios.post(URL + 'AntrianByStationAndLocation/getsetup/' + branchID);
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 getsetuponsite() {
try {
var resp = await axios.post(URL + 'AntrianByStationAndLocation/getsetuponsite');
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 getTicket(code) {
try {
var resp = await axios.post(URL + 'AntrianByStationAndLocation/getTicket/' + code);
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,460 @@
<template>
<v-layout
id="display_parent"
class="pa-3"
style="
width: 100%;
height: 96vh;
background-color: white;
border-radius: 24px;
overflow: auto;
"
column
>
<!-- <v-toolbar dark color="primary" style="border-radius: 24px 24px 0px 0px;"> -->
<!-- <v-toolbar-side-icon></v-toolbar-side-icon> -->
<!-- <v-toolbar-title class="display-1 font-weight-bold white--text">
ANTRIAN
</v-toolbar-title> -->
<!-- <v-spacer></v-spacer>
<span class="display-1 font-weight-bold" id="realTimeDateTime"></span> -->
<!-- </v-toolbar> -->
<v-container fluid>
<v-layout row wrap>
<v-flex xs12 class="text-xs-right subheading mb-3">
Ticket Booth : {{ dataTicket.ticketBoothName }}
</v-flex>
<v-flex xs12 class="text-xs-center headline mb-3">
Laboratoriun Westerindo
</v-flex>
<v-flex xs12 class="text-xs-center headline mb-3">
{{ dataTicket.M_BranchName }}
</v-flex>
<v-flex xs12 class="text-xs-center subheading mb-3">
{{ dataTicket.queueStatusTicket }}
</v-flex>
<!-- <v-flex xs12 class="text-xs-center title mb-3"> NOMOR ANTRIAN </v-flex> -->
<v-flex xs12 class="text-xs-center subheading mb-3">
{{ dataTicket.serviceName }}
<p class="subheading mt-3" v-if="statusStation.length > 0">
{{ dataPatient.T_OrderHeaderLabNumber }} -
{{ dataPatient.M_PatientName }}
</p>
</v-flex>
<v-flex xs12 class="text-xs-center display-3 mb-3 font-weight-bold">
{{ dataTicket.queueNumber }}
</v-flex>
<v-flex
xs12
class="text-xs-center title mb-3 font-weight-bold"
v-if="statusStation.length === 0"
>
<v-chip
color="primary"
@click="vibrate()"
class="title"
v-if="dataTicket.queueStatusID === '2' || dataTicket.queueStatusID === '5' || dataTicket.queueStatusID === '3'"
text-color="white"
>{{ dataTicket.statusName }}
</v-chip>
<v-chip
color="orange"
@click="vibrate()"
v-if="dataTicket.queueStatusID === '1'"
class="title"
text-color="white"
>{{ dataTicket.statusName }}
</v-chip>
<v-chip
color="green"
@click="vibrate()"
v-if="dataTicket.queueStatusID === '4'"
class="title"
text-color="white"
>{{ dataTicket.statusName }}
</v-chip>
</v-flex>
<v-flex
xs12
class="text-xs-center title mb-3 font-weight-bold"
v-if="statusStation.length > 0"
>
<p v-if="!isObjectEmpty(selectedStatusStation)">
{{ selectedStatusStation.T_SampleStationName }}
</p>
<v-chip
color="primary"
@click="vibrate()"
v-if="!isObjectEmpty(selectedStatusStation)"
class="title"
text-color="white"
>{{ selectedStatusStation.T_SamplingQueueStatusName }}
</v-chip>
<v-chip
color="primary"
@click="vibrate()"
v-if="isObjectEmpty(selectedStatusStation) && statusDone === 'N'"
class="title"
text-color="white"
>WAITING
</v-chip>
<v-chip
color="green"
@click="vibrate()"
v-if="statusDone === 'Y'"
class="title"
text-color="white"
>DONE
</v-chip>
</v-flex>
<v-flex xs12 class="text-xs-center">
<v-data-table
:headers="headers"
:items="statusFO"
class="elevation-1"
hide-actions
>
<template v-slot:items="props">
<td class="text-xs-left">{{ props.item.status }}</td>
<td class="text-xs-center">{{ props.item.time }}</td>
</template>
</v-data-table>
</v-flex>
<v-flex
xs12
class="text-xs-center mt-3"
v-if="statusStation.length > 0"
>
<v-divider></v-divider>
<v-data-table
:headers="headersStation"
:items="statusStation"
class="elevation-1 mt-3"
hide-actions
>
<template v-slot:items="props">
<td class="text-xs-left">{{ props.item.T_SampleStationName }}</td>
<td class="text-xs-center">
{{ props.item.T_SamplingQueueStatusName }}
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-container>
</v-layout>
</template>
<style scoped></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() {
console.log("ini mi=ounted");
document.addEventListener("DOMContentLoaded", this.updateDateTime());
// this.$store.dispatch("queue/getStation");
// this.$store.dispatch("queue/getStation");
const element = document.getElementById("display_parent");
const height = element.offsetHeight;
console.log("Offset Height:", height);
},
methods: {
isEmptyObject(obj) {
return Object.keys(obj).length === 0 && obj.constructor === Object;
},
vibrate() {
// navigator.vibrate(2000);
},
getHeight() {
const element = document.getElementById("display_parent");
const height = element.offsetHeight;
if (this.queueList.length == 1) {
return height;
} else {
return height / 2;
}
},
fullscreen() {
var elem = document.documentElement;
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.webkitRequestFullscreen) {
/* Safari */
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) {
/* IE11 */
elem.msRequestFullscreen();
}
},
back() {
this.screen = "setting";
},
adjustCardHeights() {
// Ambil tinggi layout-container
const layout = document.getElementById("display_parent");
const height = layout.offsetHeight;
// Hitung tinggi untuk setiap kartu
const cards = document.querySelectorAll(".card-wrapper");
const rows = Math.ceil(this.items.length / 2); // Maksimal 2 item per baris
const cardHeight = height / rows;
// Set tinggi untuk setiap kartu
cards.forEach((card) => {
card.style.height = `${cardHeight}px`;
});
},
getGridClass(length, index) {
// Atur grid berdasarkan jumlah item
if (length === 1) return "xs12 fill-height"; // 1 item: 1 kolom penuh
if (length === 2) return "xs12 "; // 2 item: 1 kolom per baris
if (length === 3) return index < 2 ? "xs6 " : "xs12 "; // 3 item: 2 atas, 1 bawah
if (length === 4) return "xs6 "; // 4 item: 2 atas, 2 bawah
},
updateDateTime() {
const dateTimeElement = document.getElementById("realTimeDateTime"); // Ganti dengan ID elemen HTML Anda
const monthNames = [
"Januari",
"Februari",
"Maret",
"April",
"Mei",
"Juni",
"Juli",
"Agustus",
"September",
"Oktober",
"November",
"Desember",
];
function formatDateTime() {
const now = new Date();
const day = now.getDate();
const month = monthNames[now.getMonth()];
const year = now.getFullYear();
const hours = String(now.getHours()).padStart(2, "0");
const minutes = String(now.getMinutes()).padStart(2, "0");
return `${day} ${month} ${year} ${hours}:${minutes}`;
}
function refresh() {
dateTimeElement.textContent = formatDateTime();
}
refresh(); // Menampilkan waktu saat pertama kali
setInterval(refresh, 1000); // Perbarui setiap detik
},
isObjectEmpty(obj) {
return Object.keys(obj).length === 0 && obj.constructor === Object;
},
save() {
if (this.loading) return;
if (this.title.trim() === "") {
alert("Judul tidak boleh Kosong");
return;
}
if (this.isObjectEmpty(this.selectedBranch)) {
alert("Pilih salah satu cabang");
return;
}
if (this.selectedStation.length === 0) {
alert("Pilih station terlebih dahulu");
return;
}
if (this.selectedStation.length > 4) {
alert("Pilih station maksimal 4");
return;
}
this.screen = "display";
},
},
computed: {
statusDone: {
get() {
return this.$store.state.queue.statusDone;
},
set(val) {
this.$store.commit("queue/update_statusDone", val);
},
},
selectedStatusStation: {
get() {
return this.$store.state.queue.selectedStatusStation;
},
set(val) {
this.$store.commit("queue/update_selectedStatusStation", val);
},
},
statusStation: {
get() {
return this.$store.state.queue.statusStation;
},
set(val) {
this.$store.commit("queue/update_statusStation", val);
},
},
dataPatient: {
get() {
return this.$store.state.queue.dataPatient;
},
set(val) {
this.$store.commit("queue/update_dataPatient", val);
},
},
dataTicket: {
get() {
return this.$store.state.queue.dataTicket;
},
set(val) {
this.$store.commit("queue/update_dataTicket", val);
},
},
statusFO: {
get() {
return this.$store.state.queue.statusFO;
},
set(val) {
this.$store.commit("queue/update_statusFO", val);
},
},
queueList: {
get() {
return this.$store.state.queue.queueList;
},
set(val) {
this.$store.commit("queue/update_queueList", val);
},
},
screen: {
get() {
return this.$store.state.queue.screen;
},
set(val) {
this.$store.commit("queue/update_screen", val);
},
},
title: {
get() {
return this.$store.state.queue.title;
},
set(val) {
this.$store.commit("queue/update_title", val);
},
},
loading: {
get() {
return this.$store.state.queue.loading;
},
set(val) {
this.$store.commit("queue/update_loading", val);
},
},
stationList: {
get() {
return this.$store.state.queue.stationList;
},
set(val) {
this.$store.commit("queue/update_stationList", val);
},
},
selectedStation: {
get() {
return this.$store.state.queue.selectedStation;
},
set(val) {
this.$store.commit("queue/update_selectedStation", val);
},
},
branchList: {
get() {
return this.$store.state.queue.branchList;
},
set(val) {
this.$store.commit("queue/update_branchList", val);
},
},
selectedBranch: {
get() {
return this.$store.state.queue.selectedBranch;
},
set(val) {
this.$store.commit("queue/update_selectedBranch", val);
},
},
},
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: "50%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "TIME",
align: "center",
sortable: false,
value: "lab",
width: "50%",
class: "pa-2 blue darken-2 white--text",
},
],
headersStation: [
{
text: "STATION",
align: "center",
sortable: false,
value: "lab",
width: "50%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "STATUS",
align: "center",
sortable: false,
value: "lab",
width: "50%",
class: "pa-2 blue darken-2 white--text",
},
],
};
},
};
</script>

View File

@@ -0,0 +1,187 @@
<template>
<v-layout
class="fill-height pa-2"
style="
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
justify-items: center;
"
column
>
<one-display></one-display>
</v-layout>
</template>
<style scoped></style>
<script>
// const { data } = require("./onePriceHeader.vue");
module.exports = {
components: {
"one-settings": httpVueLoader("./settings.vue"),
"one-display": httpVueLoader("./display.vue"),
// "one-dialog-alert": httpVueLoader("./oneDialogAlert.vue"),
},
async mounted() {
const urlParams = new URLSearchParams(window.location.search);
const qParam = urlParams.get("q");
let code = "";
if (qParam) {
code = qParam;
}
this.loading = true;
await this.$store.dispatch("queue/getTicket", code);
// await this.$store.dispatch("queue/getStation");
// await this.$store.dispatch("queue/getbranch");
// await this.$store.dispatch("queue/getSetup");
// await this.$store.dispatch("queue/getsetuponsite");
// let dataLocal = localStorage.getItem("queue-west");
// let local = JSON.parse(dataLocal);
// var elem = document.documentElement;
// if (dataLocal != null) {
// await this.$store.dispatch("queue/getAntrian");
// this.screen = "display";
// this.loading = false;
// }
},
methods: {},
computed: {
screen: {
get() {
return this.$store.state.queue.screen;
},
set(val) {
this.$store.commit("queue/update_screen", val);
},
},
title: {
get() {
return this.$store.state.queue.title;
},
set(val) {
this.$store.commit("queue/update_title", val);
},
},
loading: {
get() {
return this.$store.state.queue.loading;
},
set(val) {
this.$store.commit("queue/update_loading", val);
},
},
stationList: {
get() {
return this.$store.state.queue.stationList;
},
set(val) {
this.$store.commit("queue/update_stationList", val);
},
},
selectedStation: {
get() {
return this.$store.state.queue.selectedStation;
},
set(val) {
this.$store.commit("queue/update_selectedStation", val);
},
},
branchList: {
get() {
return this.$store.state.queue.branchList;
},
set(val) {
this.$store.commit("queue/update_branchList", val);
},
},
selectedBranch: {
get() {
return this.$store.state.queue.selectedBranch;
},
set(val) {
this.$store.commit("queue/update_selectedBranch", val);
},
},
},
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,793 @@
<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 v-model="dialogConfirmation" width="600">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
KONFIRMASI VOID ORDER {{ selectedPatient.labNumber }}
</v-card-title>
<v-card-text>
Apakah anda yakin melakukan void order
<span style="font-weight: bold;">
{{ selectedPatient.labNumber }}-{{ selectedPatient.patientName }}
</span>
?
<v-textarea
class="mt-3"
v-model="note"
auto-grow
:disabled="loading"
box
label="Alasan *"
rows="1"
></v-textarea>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="red"
:disabled="loading"
flat
:loading="loading"
@click="dialogConfirmation = false"
>
Batal
</v-btn>
<v-btn
color="primary"
:loading="loading"
:disabled="loading"
flat
@click="voidOrder()"
>
Yakin
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="showProgress" persistent width="400">
<v-card>
<v-card-title class="subtitle-1">
{{ currentFileName }}
</v-card-title>
<v-card-text>
<template v-if="typeof downloadProgress === 'number'">
<div class="mb-2">
Downloaded
{{
progressEvent ? formatFileSize(progressEvent.loaded) : "0 Bytes"
}}
</div>
<div class="mb-2">Progress : {{ downloadProgress }}%</div>
<v-progress-linear
:value="downloadProgress"
color="primary"
height="25"
class="text-center"
>
<template v-slot:default>
<strong style="color: white;" class="text-center ml-3"
>{{ downloadProgress }}%</strong
>
</template>
</v-progress-linear>
</template>
<template v-else>
<div class="mb-2">
{{ downloadProgress }}
</div>
<v-progress-linear indeterminate color="primary" height="25">
<template v-slot:default>
<strong>{{ downloadProgress }}</strong>
</template>
</v-progress-linear>
</template>
</v-card-text>
</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">DOWNLOAD BACKUP</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<v-card style="width: 100%;" class="mb-2 pa-2 searchbox">
<v-layout row wrap>
<!-- <v-flex xs3 class="">
<v-menu
v-model="menuFormDateStart"
:close-on-content-click="false"
:nudge-right="40"
lazy
transition="scale-transition"
offset-y
full-width
max-width="290px"
min-width="290px"
>
<template v-slot:activator="{ on }">
<v-text-field
class="mr-2 mb-2"
v-model="formatedStartDate"
label="Tanggal Awal"
outline
hide-details
readonly
v-on="on"
@blur="deFormatedDate(formatedStartDate)"
></v-text-field>
</template>
<v-date-picker
v-model="startDate"
no-title
@input="menuFormDateStart = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs3 class="">
<v-menu
v-model="menuFormDateEnd"
:close-on-content-click="false"
:nudge-right="40"
lazy
transition="scale-transition"
offset-y
full-width
max-width="290px"
min-width="290px"
>
<template v-slot:activator="{ on }">
<v-text-field
class="mr-2 mb-2"
v-model="formatedEndDate"
label="Tanggal Akhir"
outline
readonly
hide-details
v-on="on"
@blur="deFormatedDate(formatedEndDate)"
></v-text-field>
</template>
<v-date-picker
v-model="endDate"
no-title
@input="menuFormDateEnd = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs3>
<v-text-field
label="Cari..."
outline
class="mr-2 mb-2"
hide-details
v-model="search"
></v-text-field>
</v-flex> -->
<v-flex xs3>
<v-select
class="mini-select"
:items="type"
label="Tipe"
hide
hide-details
v-model="selectedType"
@input="changeType()"
outline
></v-select>
</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="listData"
: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 @click="redirectUploadDocument(props.item)">
<td class="py-2">
{{ props.item.last_modified }}
</td>
<td class="py-2">
{{ props.item.name }}
</td>
<td class="py-2">
{{ props.item.size }}
</td>
<td class="py-2 text--center">
<div
class="text-center"
style="width: 100%; display: flex; justify-content: center;"
>
<v-btn
@click="downloadFile(props.item.full_path)"
color="info"
:loading="loading"
:disabled="loading"
>DOWNLOAD</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="page" :length="total"></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() {
this.$store.dispatch("patient/getListData");
// this.$store.dispatch("patient/search");
},
methods: {
changeType() {
let type = this.selectedType;
console.log(type);
if (type === "cpone") {
this.listData = this.tmpListData.cpone ?? [];
}
if (type === "log") {
this.listData = this.tmpListData.cpone_log ?? [];
}
},
voidOrder() {
if (this.note.trim() == "") {
alert("Harus mengisi alasan ..... ");
return;
}
this.$store.dispatch("patient/voidOrder");
},
async downloadFile(path) {
try {
// Validasi input
if (!path) {
this.errorMsg = "Path file tidak valid";
this.snackbarError = true;
return;
}
// Cek waktu saat ini
const currentHour = new Date().getHours();
if (currentHour < 16) {
this.errorMsg =
"Download file hanya bisa dilakukan setelah jam 16:00";
this.snackbarError = true;
return;
}
this.currentFileName = path.split("/").pop();
let url =
window.location.protocol +
"//" +
window.location.host +
"/one-api/tools/downloadbackup/file";
let token = one_token();
this.loading = true;
this.showProgress = true;
this.downloadProgress = 0;
this.progressEvent = null;
try {
// Dapatkan ukuran file
const headResponse = await axios({
method: "HEAD",
url: url,
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
data: {
path: path,
token: one_token(),
},
});
this.totalSize = parseInt(
headResponse.headers["content-length"] || 0
);
// Lakukan download
const response = await axios({
method: "POST",
url: url,
data: {
path: path,
token: one_token(),
},
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
responseType: "blob",
onDownloadProgress: (progressEvent) => {
this.progressEvent = progressEvent;
const total = progressEvent.total || this.totalSize;
if (total) {
const progress = Math.round(
(progressEvent.loaded * 100) / total
);
this.downloadProgress = progress;
} else {
const loadedMB = this.formatFileSize(progressEvent.loaded);
this.downloadProgress = `${loadedMB} terdownload`;
}
},
});
// Validasi response
if (!response.data || response.data.size === 0) {
throw new Error("File download gagal atau file kosong");
}
const blob = response.data;
const contentDisposition = response.headers["content-disposition"];
let filename = path.split("/").pop();
if (contentDisposition) {
const matches = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(
contentDisposition
);
if (matches && matches[1]) {
filename = matches[1].replace(/['"]/g, "");
}
}
// Validasi blob
if (!(blob instanceof Blob)) {
throw new Error("Format file tidak valid");
}
const url_download = window.URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url_download;
link.download = filename;
document.body.appendChild(link);
link.click();
// Cleanup
link.remove();
window.URL.revokeObjectURL(url_download);
} catch (error) {
throw error; // Re-throw error untuk ditangkap oleh catch block luar
}
} catch (error) {
console.error("Error downloading file:", error);
// Handle specific errors
if (error.response) {
// Server returned error response
switch (error.response.status) {
case 401:
this.errorMsg = "Tidak memiliki akses, silahkan login ulang";
break;
case 404:
this.errorMsg = "File tidak ditemukan";
break;
case 403:
this.errorMsg = "Tidak memiliki izin untuk mengakses file";
break;
default:
this.errorMsg = `Error server: ${error.response.status}`;
}
} else if (error.request) {
this.errorMsg = "Tidak dapat terhubung ke server";
} else {
this.errorMsg =
error.message || "Terjadi kesalahan saat mengunduh file";
}
// Reset immediate saat error
this.showProgress = false;
this.downloadProgress = 0;
this.snackbarError = true;
} finally {
this.loading = false;
this.progressEvent = null;
this.totalSize = 0;
setTimeout(() => {
this.showProgress = false;
this.downloadProgress = 0;
}, 1000);
}
},
openDialogConfirm(data) {
this.note = "";
this.selectedPatient = data;
this.dialogConfirmation = true;
},
redirectUploadDocument(data) {
// noreg=R2407150001&id=322
let link =
window.location.protocol +
"//" +
window.location.hostname +
"/one-ui/" +
this.url +
"?noreg=" +
data.labNumber +
"&id=" +
data.orderID;
// window.open(link, "_blank");
},
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")}`;
},
formatFileSize(bytes) {
if (bytes === 0) return "0 Bytes";
const k = 1024;
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
},
},
computed: {
url: {
get() {
return this.$store.state.patient.url;
},
set(val) {
this.$store.commit("patient/update_url", val);
},
},
listData: {
get() {
return this.$store.state.patient.listData;
},
set(val) {
this.$store.commit("patient/update_listData", val);
},
},
tmpListData: {
get() {
return this.$store.state.patient.tmpListData;
},
set(val) {
this.$store.commit("patient/update_tmpListData", val);
},
},
type: {
get() {
return this.$store.state.patient.type;
},
set(val) {
this.$store.commit("patient/update_type", val);
},
},
selectedType: {
get() {
return this.$store.state.patient.selectedType;
},
set(val) {
this.$store.commit("patient/update_selectedType", val);
},
},
selectedPatient: {
get() {
return this.$store.state.patient.selectedPatient;
},
set(val) {
this.$store.commit("patient/update_selectedPatient", val);
},
},
total: {
get() {
return this.$store.state.patient.total;
},
set(val) {
this.$store.commit("patient/update_total", val);
},
},
dialogConfirmation: {
get() {
return this.$store.state.patient.dialogConfirmation;
},
set(val) {
this.$store.commit("patient/update_dialogConfirmation", val);
},
},
note: {
get() {
return this.$store.state.patient.note;
},
set(val) {
this.$store.commit("patient/update_note", val);
},
},
loading: {
get() {
return this.$store.state.patient.loading;
},
set(val) {
this.$store.commit("patient/update_loading", val);
},
},
search: {
get() {
return this.$store.state.patient.search;
},
set(val) {
this.$store.commit("patient/update_search", val);
this.$store.commit("patient/update_page", 1);
this.$store.dispatch("patient/search");
},
},
setupList: {
get() {
return this.$store.state.patient.setupList;
},
set(val) {
this.$store.commit("patient/update_setupList", val);
},
},
selectedSetup: {
get() {
return this.$store.state.patient.selectedSetup;
},
set(val) {
this.$store.commit("patient/update_selectedSetup", val);
this.$store.commit("patient/update_startDate", val.Mgm_McuStartDate);
this.$store.commit("patient/update_endDate", val.Mgm_McuEndDate);
this.$store.commit("patient/update_page", 1);
this.$store.dispatch("patient/search");
},
},
status() {
return this.$store.state.patient.status;
},
selectedStatus: {
get() {
return this.$store.state.patient.selectedStatus;
},
set(val) {
this.$store.commit("patient/update_selectedStatus", val);
this.$store.commit("patient/update_page", 1);
this.$store.dispatch("patient/search");
},
},
orderList: {
get() {
return this.$store.state.patient.orderList;
},
set(val) {
this.$store.commit("patient/update_orderList", val);
},
},
successMsg: {
get() {
return this.$store.state.patient.successMsg;
},
set(val) {
this.$store.commit("patient/update_successMsg", val);
},
},
errorMsg: {
get() {
return this.$store.state.patient.errorMsg;
},
set(val) {
this.$store.commit("patient/update_errorMsg", val);
},
},
snackbarError: {
get() {
return this.$store.state.patient.snackbarError;
},
set(val) {
this.$store.commit("patient/update_snackbarError", val);
},
},
snackbarSuccess: {
get() {
return this.$store.state.patient.snackbarSuccess;
},
set(val) {
this.$store.commit("patient/update_snackbarSuccess", val);
},
},
page: {
get() {
return this.$store.state.patient.page;
},
set(val) {
this.$store.commit("patient/update_page", val);
this.$store.dispatch("patient/search");
},
},
startDate: {
get() {
return this.$store.state.patient.startDate;
},
set(val) {
this.$store.commit("patient/update_startDate", val);
this.$store.dispatch("patient/search");
this.$store.commit("patient/update_page", 1);
},
},
endDate: {
get() {
return this.$store.state.patient.endDate;
},
set(val) {
this.$store.commit("patient/update_endDate", val);
this.$store.dispatch("patient/search");
this.$store.commit("patient/update_page", 1);
},
},
formatedStartDate() {
return this.formatDate(this.startDate);
},
formatedEndDate() {
return this.formatDate(this.endDate);
},
},
watch: {},
data() {
return {
menuFormDateStart: false,
menuFormDateEnd: false,
headers: [
{
text: "TANGGAL",
align: "center",
sortable: false,
value: "lab",
width: "10%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "NAMA",
align: "center",
sortable: false,
value: "lab",
width: "35%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "UKURAN",
align: "center",
sortable: false,
value: "lab",
width: "15%",
class: "pa-2 blue darken-2 white--text",
},
{
text: "AKSI",
align: "center",
sortable: false,
value: "lab",
width: "15%",
class: "pa-2 blue darken-2 white--text",
},
],
downloadProgress: 0,
showProgress: false,
currentFileName: "",
progressEvent: null,
totalSize: 0,
};
},
};
</script>

File diff suppressed because it is too large Load Diff

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,367 @@
<template>
<div>
<!-- style="width: 100%; height: 100%; background-color: red;" -->
<!-- <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" style="width: 100%; height: 100%;" column>
<v-card
v-if="!loading"
style="height: 100%; border-radius: 24px; width: 50vw;"
class="mx-5 p-3"
>
<v-card-title class="headline font-weight-bold">
SETTING ANTRIAN WESTERINDO
</v-card-title>
<v-card-text>
<v-layout row wrap>
<v-flex xs12>
<v-text-field
label="TITLE *"
v-model="title"
hide-details
outline
></v-text-field>
</v-flex>
<v-flex xs12>
<v-select
v-model="selectedStation"
:items="stationList"
class="mini-select mt-3"
:menu-props="{ maxHeight: '400' }"
item-text="stationName"
label="STATION *"
hide-details
return-object
multiple
outline
></v-select>
</v-flex>
<v-flex xs12>
<v-select
class="mt-3 mini-select"
v-model="selectedBranch"
:items="branchList"
return-object
hide-details
item-text="M_BranchName"
label="CABANG *"
outline
></v-select>
</v-flex>
<v-flex xs12>
<v-checkbox v-model="onSite" label="Antrian onsite"></v-checkbox>
</v-flex>
<v-flex xs12 v-if="onSite">
<v-autocomplete
class="mt-3"
label="Pilih Proyek MCU"
v-model="selectedSetup"
:items="setupList"
:item-text="
(item) => item.Mgm_McuNumber + ' - ' + item.Mgm_McuLabel
"
outline
hide-details
return-object
no-data-text="Pilih Proyek MCU"
>
<!-- <template slot="item" slot-scope="{ item }">
<v-list-tile-content>
<v-list-tile-title
:v-text="(itm) => itm.Mgm_McuNumber + ' - ' + itm.Mgm_McuLabel"
></v-list-tile-title>
</v-list-tile-content>
</template> -->
</v-autocomplete>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn flat color="success" @click="save()">SIMPAN</v-btn>
</v-card-actions>
</v-card>
<v-card v-if="loading" class="pa-5">
<v-progress-circular
v-if="loading"
:size="70"
:width="7"
color="green"
indeterminate
></v-progress-circular>
</v-card>
</v-layout>
</div>
</template>
<style scoped></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() {
// this.$store.dispatch("queue/getStation");
// this.$store.dispatch("queue/getStation");
},
methods: {
isObjectEmpty(obj) {
return Object.keys(obj).length === 0 && obj.constructor === Object;
},
save() {
if (this.loading) return;
if (this.title.trim() === "") {
alert("Judul tidak boleh Kosong");
return;
}
if (this.isObjectEmpty(this.selectedBranch)) {
alert("Pilih salah satu cabang");
return;
}
if (this.selectedStation.length === 0) {
alert("Pilih station terlebih dahulu");
return;
}
if (this.selectedStation.length > 4) {
alert("Pilih station maksimal 4");
return;
}
if (this.onSite) {
if (this.isObjectEmpty(this.selectedSetup)) {
alert("Pilih salah satu proyek mcu");
return;
}
// alert("Pilih station maksimal 4");
// return;
}
let local = {
title: this.title,
station: this.selectedStation,
branch: this.selectedBranch,
onSite: this.onSite,
setup: this.selectedSetup,
};
localStorage.setItem("queue-west", JSON.stringify(local));
var elem = document.documentElement;
/* View in fullscreen */
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.webkitRequestFullscreen) {
/* Safari */
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) {
/* IE11 */
elem.msRequestFullscreen();
}
this.$store.dispatch("queue/getAntrian");
this.screen = "display";
},
},
computed: {
onSite: {
get() {
return this.$store.state.queue.onSite;
},
set(val) {
this.$store.commit("queue/update_onSite", val);
},
},
selectedSetup: {
get() {
return this.$store.state.queue.selectedSetup;
},
set(val) {
this.$store.commit("queue/update_selectedSetup", val);
},
},
setupList: {
get() {
return this.$store.state.queue.setupList;
},
set(val) {
this.$store.commit("queue/update_setupList", val);
},
},
screen: {
get() {
return this.$store.state.queue.screen;
},
set(val) {
this.$store.commit("queue/update_screen", val);
},
},
title: {
get() {
return this.$store.state.queue.title;
},
set(val) {
this.$store.commit("queue/update_title", val);
},
},
loading: {
get() {
return this.$store.state.queue.loading;
},
set(val) {
this.$store.commit("queue/update_loading", val);
},
},
stationList: {
get() {
return this.$store.state.queue.stationList;
},
set(val) {
this.$store.commit("queue/update_stationList", val);
},
},
selectedStation: {
get() {
return this.$store.state.queue.selectedStation;
},
set(val) {
this.$store.commit("queue/update_selectedStation", val);
},
},
branchList: {
get() {
return this.$store.state.queue.branchList;
},
set(val) {
this.$store.commit("queue/update_branchList", val);
},
},
selectedBranch: {
get() {
return this.$store.state.queue.selectedBranch;
},
set(val) {
this.$store.commit("queue/update_selectedBranch", val);
this.selectedSetup = {};
this.$store.dispatch("queue/getSetup");
},
},
},
watch: {
onSite(val, old) {
if (val == false) {
this.selectedSetup = {};
}
},
},
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,292 @@
<!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>CPOne</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: #2196F3 !important"> -->
<!-- background: linear-gradient(180deg, rgba(33,150,243,1) 0%, rgba(255,255,255,1) 50%, rgba(33,150,243,1) 100%); -->
<v-content style="background: rgb(33,150,243);">
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
<v-layout row wrap>
<v-flex xs12 class="right" fill-height>
<!-- <one-price-list></one-price-list> -->
<one-main></one-main>
</v-flex>
<!-- <v-flex xs6 class="right" fill-height pa-1> -->
<!-- komponen kanan -->
<!-- <one-fo-cashier-payment></one-fo-cashier-payment>-->
<!-- </v-flex> -->
<!-- <div id="start"></div> -->
<div id="start" @click="getar()"></div>
</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/vendor/socket.io.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`
}
window.play_audio = function(prm) {
var url = "/audio/?prm=";
url = url + prm;
var audio = new Audio(url);
audio.addEventListener('canplay', function() {
if (document.readyState === 'complete') {
audio.play().catch(function(error) {
console.error("Error playing audio:", error);
});
} else {
window.addEventListener('click', function() {
audio.play().catch(function(error) {
console.error("Error playing audio:", error);
});
}, {
once: true
});
}
});
}
window.pisahkanAngka = function(angka) {
let hasil = [];
if (angka >= 100) {
let seratusan = Math.floor(angka / 100) * 100;
hasil.push(seratusan);
angka -= seratusan;
}
if (angka >= 20) {
let puluhan = Math.floor(angka / 10) * 10;
hasil.push(puluhan);
angka -= puluhan;
}
// Add the remaining units if any, or treat as a two-digit number if less than 10
if (angka > 0) {
hasil.push(angka);
}
return hasil.join(',');
}
window.processSound = function(queueNumber, stationCode) {
// Memisahkan huruf dan angka
let huruf = queueNumber.match(/[A-Z]/)[0]; // Mengambil huruf
let angka = parseInt(queueNumber.match(/\d+/)[0]); // Mengambil angka dan konversi ke integer
let splitQueueNumber = window.pisahkanAngka(angka);
let str = "antrian," + huruf + "," + splitQueueNumber + "," + stationCode;
console.log("Huruf:", huruf);
console.log("Angka:", angka);
console.log("Hasil split:", splitQueueNumber);
console.log("prm:", str);
window.play_audio(str);
}
import {
store
} from './store.js<?php echo $ts ?>';
//for testing
window.store = store;
let g_timeout = 0;
var socketIoUrl = "https://" + window.location.host + ":9099/";
// var socketIoUrl = "wss://" + window.location.host + ":9099/";
new Vue({
store,
el: '#app',
data: {
socket: io.connect(socketIoUrl, {
forceNew: false,
// transports: ['polling', 'flashsocket']
transports: ['websocket']
}).on('connect', function() {
console.log('connection established');
})
},
mounted() {
this.socket.on("notification", function(msg) {
console.log("iosocket message", msg.type);
let type = msg.type;
let data = type.split('.')
let dataTicket = window.store.state.queue.dataTicket;
// call.fo .1.A0005.A1 .1 .1
// skip.fo .1 .1 .1
if (data[1] === 'fo') {
if (data[0] === 'call' &&
data[2] === dataTicket['serviceID'] &&
data[3] === dataTicket['queueNumber'] &&
data[6] === dataTicket['M_BranchID']) {
store.dispatch("queue/getTicket", dataTicket['queueCode']);
navigator.vibrate(1000)
document.getElementById("start").click();
// document.getElementById("start").addEventListener("click", function() {
// console.log('getar');
// });
} else if (data[0] === 'skip' &&
data[2] === dataTicket['serviceID'] &&
data[4] === dataTicket['M_BranchID']) {
store.dispatch("queue/getTicket", dataTicket['queueCode']);
} else if (data[0] === 'serve' &&
data[2] === dataTicket['serviceID'] &&
data[4] === dataTicket['M_BranchID']) {
store.dispatch("queue/getTicket", dataTicket['queueCode']);
} else if (data[0] === 'done' &&
data[2] === dataTicket['serviceID'] &&
data[4] === dataTicket['M_BranchID']) {
store.dispatch("queue/getTicket", dataTicket['queueCode']);
}
}
let statusStation = window.store.state.queue.statusStation;
if (data[0] === 'sm') {
// 'sm.call.1.201.1.B0001'
statusStation.forEach(element => {
if (element.T_SampleStationID === data[2]) {
if (
dataTicket['M_BranchID'] == data[4] &&
element.T_OrderHeaderMgm_McuID === data[3]) {
if (data[5] === element.queueNumber && data[1] === 'call') {
store.dispatch("queue/getTicket", dataTicket['queueCode']);
navigator.vibrate(1000)
// Auto click button start
document.getElementById("start").click();
console.log('Masuk Call');
} else {
console.log('Masuk refresh');
store.dispatch("queue/getTicket", dataTicket['queueCode']);
}
}
}
});
}
});
},
methods: {
getar() {
navigator.vibrate(1000);
// document.addEventListener('click', function() {
// console.log("Getar");
// }, {
// once: true
// });
// window.addEventListener('load', function() {
// console.log("Getar");
// navigator.vibrate(1000);
// });
// }
},
tab_selected: function(tab) {
return this.$store.state.tab_selected == tab
},
selectedStation: function(tab) {
return window.store.state.queue.selectedStation
},
play_audio(prm) {
var url = "/audio/?prm=";
url = url + prm;
var audio = new Audio(url);
audio.addEventListener('canplay', function() {
audio.play();
});
},
processSound(queueNumber) {
// http: //devcpone.aplikasi.web.id/audio/?prm=antrian,D,1,counter,A,1
let splitQueueNumber = this.pisahkanAngka(queueNumber);
let str = "antrian," + splitQueueNumber
console.log("Hasil split", splitQueueNumber);
console.log("prm:", str);
this.play_audio(str);
},
pisahkanAngka(angka) {
let hasil = [];
if (angka >= 100) {
let seratusan = Math.floor(angka / 100) * 100;
hasil.push(seratusan);
angka -= seratusan;
}
if (angka >= 20) {
let puluhan = Math.floor(angka / 10) * 10;
hasil.push(puluhan);
angka -= puluhan;
}
// Add the remaining units if any, or treat as a two-digit number if less than 10
if (angka > 0) {
hasil.push(angka);
}
return hasil.join(',');
}
},
components: {
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
'one-patient-list': httpVueLoader('./components/onePatientList.vue'),
'one-main': httpVueLoader('./components/main.vue'),
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {}
.right {}
</style>
</body>
</html>

View File

@@ -0,0 +1,245 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/patient.js"
export default {
namespaced: true,
state: {
startDate: moment(new Date()).format('YYYY-MM-DD'),
endDate: moment(new Date()).format('YYYY-MM-DD'),
loading: false,
search: "",
setupList: [],
selectedSetup: {},
orderList: [],
url: '',
errorMsg: '',
snackbarSuccess: false,
snackbarError: false,
successMsg: '',
total: 0,
page: 1,
url: "",
dialogConfirmation: false,
note: "",
selectedPatient: {},
status: [
"Semua", 'Aktif', 'Void'
],
selectedStatus: 'Semua',
type: [
'cpone', 'log'
],
selectedType: 'cpone',
tmpListData: [],
listData: [],
},
mutations: {
update_listData(state, val) {
state.listData = val
},
update_tmpListData(state, val) {
state.tmpListData = val
},
update_selectedType(state, val) {
state.selectedType = val
},
update_type(state, val) {
state.type = val
},
update_selectedStatus(state, val) {
state.selectedStatus = val
},
update_selectedPatient(state, val) {
state.selectedPatient = val
},
update_dialogConfirmation(state, val) {
state.dialogConfirmation = val
},
update_note(state, val) {
state.note = val
},
update_url(state, val) {
state.url = val
},
update_startDate(state, val) {
state.startDate = val
},
update_endDate(state, val) {
state.endDate = val
},
update_loading(state, val) {
state.loading = val
},
update_search(state, val) {
state.search = val
},
update_orderList(state, val) {
state.orderList = val
},
update_url(state, val) {
state.url = val
},
update_setupList(state, val) {
state.setupList = val
},
update_selectedSetup(state, val) {
state.selectedSetup = 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_total(state, val) {
state.total = val
},
update_page(state, val) {
state.page = val
},
},
actions: {
async getListData(context) {
context.commit("update_loading", true)
try {
let prm = {}
prm.token = one_token()
let resp = await api.getListData(prm)
if (resp.status != "OK") {
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", true)
} else {
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
context.commit("update_tmpListData", resp.data ?? [])
context.commit("update_listData", resp.data.cpone ?? [])
context.commit("update_selectedType", 'cpone')
}
} catch (e) {
context.commit("update_loading", false)
context.commit("update_errorMsg", e.message)
context.commit("update_snackbarError", true)
console.log(e)
}
},
async getsetup(context) {
context.commit("update_loading", true)
try {
let prm = {}
prm.token = one_token()
let resp = await api.getsetup(prm)
if (resp.status != "OK") {
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", false)
} else {
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.commit("update_selectedSetup", resp.data.records[0])
context.dispatch("search");
}
}
} catch (e) {
context.commit("update_loading", false)
context.commit("update_errorMsg", e.message)
context.commit("update_snackbarError", false)
console.log(e)
}
},
async search(context) {
context.commit("update_loading", true)
try {
let prm = {}
prm.token = one_token()
prm.startDate = context.state.startDate
prm.endDate = context.state.endDate
prm.search = context.state.search
prm.setup = context.state.selectedSetup.Mgm_McuID
prm.page = context.state.page
prm.status = context.state.selectedStatus
let resp = await api.search(prm)
if (resp.status != "OK") {
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", true)
} else {
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
context.commit("update_orderList", resp.data.records)
context.commit("update_total", resp.data.total)
context.commit("update_url", resp.data.url)
let data = {
records: resp.data.records,
total: resp.data.total
}
}
} catch (e) {
context.commit("update_loading", false)
context.commit("update_errorMsg", e.message)
context.commit("update_snackbarError", true)
console.log(e)
}
},
async voidOrder(context) {
context.commit("update_loading", true)
try {
let prm = {}
prm.token = one_token()
prm.id = context.state.selectedPatient.orderID
prm.reason = context.state.note
let resp = await api.voidOrder(prm)
if (resp.status != "OK") {
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", true)
} else {
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
await context.dispatch("search")
context.commit("update_dialogConfirmation", false)
context.commit("update_note", "")
context.commit("update_successMsg", "Berhasil void order")
context.commit("update_snackbarSuccess", true)
context.commit("update_selectedPatient", {})
}
} catch (e) {
context.commit("update_loading", false)
context.commit("update_errorMsg", e.message)
context.commit("update_snackbarError", true)
console.log(e)
}
},
}
}

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,352 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/queue.js"
export default {
namespaced: true,
state: {
screen: 'setting',
loading: false,
stationList: [],
selectedStation: [],
branchList: [],
selectedBranch: {},
title: '',
errorMsg: '',
snackbarError: false,
queueList: [],
setupList: [],
selectedSetup: {},
onSite: false,
onSiteMcuID: [],
statusFO: [],
dataTicket: {},
dataPatient: {},
statusStation: [],
selectedStatusStation: {},
statusDone: 'N'
},
mutations: {
update_statusDone(state, val) {
state.statusDone = val;
},
update_dataPatient(state, val) {
state.dataPatient = val;
},
update_selectedStatusStation(state, val) {
state.selectedStatusStation = val;
},
update_statusStation(state, val) {
state.statusStation = val;
},
update_statusFO(state, val) {
state.statusFO = val;
},
update_dataTicket(state, val) {
state.dataTicket = val;
},
update_onSiteMcuID(state, val) {
state.onSiteMcuID = val;
},
update_onSite(state, val) {
state.onSite = val;
},
update_setupList(state, val) {
state.setupList = val;
},
update_selectedSetup(state, val) {
state.selectedSetup = val;
},
update_screen(state, val) {
state.screen = val;
},
update_queueList(state, val) {
state.queueList = val;
},
update_loading(state, val) {
state.loading = val;
},
update_stationList(state, val) {
state.stationList = val;
},
update_selectedStation(state, val) {
state.selectedStation = val;
},
update_branchList(state, val) {
state.branchList = val;
},
update_selectedBranch(state, val) {
state.selectedBranch = val;
},
update_title(state, val) {
state.title = val;
},
update_errorMsg(state, val) {
state.errorMsg = val;
},
update_snackbarError(state, val) {
state.snackbarError = val;
},
},
actions: {
async getStation(context) {
context.commit("update_loading", true)
try {
let resp = await api.getStation()
if (resp.status != "OK") {
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", false)
} else {
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
let data = {
records: resp.data.records,
total: resp.data.total
}
let dataLocal = localStorage.getItem("queue-west");
let local = JSON.parse(dataLocal);
if (dataLocal != null) {
context.commit("update_title", local.title)
context.commit("update_selectedStation", local.station)
context.commit("update_onSite", local.onSite)
}
context.commit("update_stationList", resp.data.records)
}
} catch (e) {
console.log(e)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
context.commit("update_snackbarError", false)
}
},
async getbranch(context) {
context.commit("update_loading", true)
try {
let resp = await api.getbranch()
if (resp.status != "OK") {
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", false)
} else {
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
let data = {
records: resp.data.records,
total: resp.data.total
}
let dataLocal = localStorage.getItem("queue-west");
let local = JSON.parse(dataLocal);
if (dataLocal != null) {
context.commit("update_selectedBranch", local.branch)
}
context.commit("update_branchList", resp.data.records)
}
} catch (e) {
console.log(e)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
context.commit("update_snackbarError", false)
}
},
async getAntrian(context) {
context.commit("update_loading", true)
try {
;
let selectedStation = context.state.selectedStation;
let arrStationID = [];
selectedStation.forEach(element => {
arrStationID.push(element.stationID);
});
let station = arrStationID.join(',')
// "arrStationID": "7",
// "branchID": "3",
// "onSite": "Y",
// "setupID": "201"
let prm = {
arrStationID: station,
branchID: context.state.selectedBranch.M_BranchID,
onSite: context.state.onSite ? 'Y' : 'N',
setupID: context.state.onSite ? context.state.selectedSetup.Mgm_McuID : '0'
};
let resp = await api.getAntrian(prm)
if (resp.status != "OK") {
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", false)
} else {
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
let data = {
records: resp.data.records,
total: resp.data.total
}
console.log('Call api result')
console.log(prm)
context.commit("update_queueList", resp.data)
}
} catch (e) {
console.log(e)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
context.commit("update_snackbarError", false)
}
},
async getTicket(context, code) {
context.commit("update_loading", true)
try {
let resp = await api.getTicket(code)
if (resp.status != "OK") {
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", false)
} else {
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
if (resp.data) {
context.commit("update_dataTicket", resp.data)
context.commit("update_statusFO", resp.data.statusFO)
context.commit("update_statusStation", resp.data.statusStation)
context.commit("update_statusDone", 'N')
context.commit("update_selectedStatusStation", {})
if (resp.data.statusStation.length > 0) {
context.commit("update_dataPatient", resp.data.statusStation[0])
let countDone = 0;
resp.data.statusStation.forEach(element => {
if (element.T_SamplingQueueStatusName === 'Call' ||
element.T_SamplingQueueStatusName === 'Process'
) {
context.commit("update_selectedStatusStation", element)
}
if (element.T_SamplingQueueStatusName === 'Done') {
countDone = countDone + 1;
}
});
if (countDone === resp.data.statusStation.length) {
context.commit("update_statusDone", 'Y')
}
}
}
}
} catch (e) {
console.log(e)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
context.commit("update_snackbarError", false)
}
},
async getSetup(context) {
context.commit("update_loading", true)
try {
let branchID = context.state.selectedBranch.M_BranchID;
let resp = await api.getSetup(branchID)
if (resp.status != "OK") {
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", false)
} else {
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
let data = {
records: resp.data.records,
total: resp.data.total
}
let dataLocal = localStorage.getItem("queue-west");
let local = JSON.parse(dataLocal);
context.commit("update_setupList", resp.data.records)
if (dataLocal != null) {
context.commit("update_selectedSetup", local.setup)
}
}
} catch (e) {
console.log(e)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
context.commit("update_snackbarError", false)
}
},
async getsetuponsite(context) {
context.commit("update_loading", true)
try {
let resp = await api.getsetuponsite()
if (resp.status != "OK") {
context.commit("update_loading", false)
context.commit("update_errorMsg", resp.message)
context.commit("update_snackbarError", false)
} else {
context.commit("update_errorMsg", '')
context.commit("update_loading", false)
let data = {
records: resp.data.records,
total: resp.data.total
}
let strMcuID = resp.data.records.mcuID
let arrMcuID = strMcuID.split(',')
context.commit("update_onSiteMcuID", arrMcuID)
}
} catch (e) {
console.log(e)
context.commit("update_loading", false)
context.commit("update_errorMsg", e)
context.commit("update_snackbarError", false)
}
},
}
}

View File

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