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,134 @@
const URL = "/one-api/one_consumable/patient/";
export async function gettest(prm) {
try {
var resp = await axios.post(URL + 'gettest', 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 searchconsumable(prm) {
try {
var resp = await axios.post(URL + 'searchconsumable',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 get_satuan(prm) {
try {
var resp = await axios.post(URL + 'get_satuan',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 get_item(prm) {
try {
var resp = await axios.post(URL + 'get_item',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 addconsumable(prm) {
try {
var resp = await axios.post(URL + 'addconsumable',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 reset(prm) {
try {
var resp = await axios.post(URL + 'reset',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 saveAllConsumable(prm) {
try {
var resp = await axios.post(URL + 'saveAllConsumable',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,39 @@
const URL = "/one-api/one_consumable/patient/";
export async function getcompany(token,prm) {
try {
var resp = await axios.post(URL + 'getcompany',{token:token,search:prm});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch(e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function search(prm) {
try {
var resp = await axios.post(URL + '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
};
}
}

View File

@@ -0,0 +1,574 @@
<template>
<v-layout class="fill-height" column>
<!-- Alert dialog -->
<v-dialog v-model="dialogdeletealert" max-width="30%">
<v-card>
<v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
Peringatan !
</v-card-title>
<v-card-text class="pt-2 pb-2">
<v-layout row>
<v-flex xs12 d-flex>
<v-layout row>
<v-flex pb-1 xs12>
<v-layout row>
<v-flex pt-2 pr-2 xs12>
{{ msgalert }}
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn v-if="xact_notreset === 'notreset' || xact === 'reset' || xact === 'save'" color="primary" flat @click="dialogdeletealert = false">
Tutup
</v-btn>
<v-btn v-if="xact === 'reset'" color="primary" flat
@click="resetAll()">
Yakin lah
</v-btn>
<v-btn v-if="xact === 'save'" color="primary" flat
@click="saveConsumableAll()">
Yakin lah
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- End alert dialog -->
<!-- ERROR DIALOG -->
<v-dialog v-model="dialog_error" max-width="500px">
<v-card>
<v-card-title>
<span>ERROR !</span>
<v-spacer></v-spacer>
</v-card-title>
<v-divider></v-divider>
<div class="ma-3 red--text">{{ msgError }}</div>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" flat @click="dialog_error = false">Close</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- END ERROR DIALOG -->
<!-- Snackbar -->
<v-snackbar v-model="snackbar" :timeout="5000" :multi-line="false" :vertical="false" :top="true" :color="clr"
:value="snackbar">
{{ msgsnackbar }}
<v-btn flat @click="snackbar = false"> Tutup </v-btn>
</v-snackbar>
<!-- End Snackbar -->
<!-- Form Dialog -->
<v-dialog v-model="dialog_form" persistent width="50%">
<v-card>
<v-card-title>
<span class="title">Tambah Consumable</span>
</v-card-title>
<v-divider></v-divider>
<v-card-text class="pt-3 pb-0">
<v-layout row wrap>
<v-flex xs12>
<v-select v-model="xgetitemconsumable" :items="vitems" item-text="M_ConsumableName"
item-value="consumableid" :error="itemconsumable_error_message !== ''" :error-messages="itemconsumable_error_message"
@blur="itemconsumableValidation"
return-object label="Pilih Item" required>
</v-select>
</v-flex>
</v-layout>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" flat @click="dialog_form = false">Tutup</v-btn>
<v-btn color="primary" flat
@click="saveAdd()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- End Form Dialog -->
<v-card class="mb-2 pa-2">
<v-card-title>
<span class="title font-weight-light">PEMERIKSAAN :</span>
</v-card-title>
<v-layout row wrap class="scroll-container" style="max-height:200px;overflow: auto;">
<v-flex class="border-bottom-dashed" xs12 pt-2 pl-2 pr-2 pb-4>
<v-layout xs12 row wrap>
<v-flex xs6 v-for="(vst,idx) in vtests" :key="`6${idx}`" class="pr-2 pb-1">
<v-layout row>
<v-chip
color="orange"
label
text-color="white"
style="white-space: normal; display: block;"
>{{ vst.testname }}</v-chip>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card>
<v-card>
<v-layout row>
<v-flex pt-2 pl-2>
<div class="text-md-right">
<v-btn
v-if="this.selected_consumable.isHidden == true"
color="primary"
@click="addConsumable()"
>
Tambah Consumable
</v-btn>
</div>
</v-flex>
</v-layout>
<v-layout row style="max-height:500px;overflow: auto;">
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
<v-data-table :headers="headers" :items="xconsumables" :isLoading="isLoading" hide-actions class="elevation-1 fixed_header">
<template slot="items" slot-scope="props">
<td class="text-xs-left px-2">
{{ props.item.M_ConsumableName }}
</td>
<td class="text-xs-center px-2">
<div v-if="props.item.isHidden === true">
<v-text-field class="mt-3"
v-model="props.item.T_ConsumableQty"
item-value="T_ConsumableQty"
solo single-line label="" type="number"></v-text-field>
</div>
<div v-if="props.item.isHidden === false">
<v-text-field class="mt-3"
v-model="props.item.M_ConsumableDefaultQty"
item-value="M_ConsumableDefaultQty"
solo single-line label="" type="number"></v-text-field>
</div>
</td>
<td class="text-xs-center px-2">
<div v-if="props.item.isHidden === true">
<v-layout row>
<v-flex>
<v-select
:items="props.item.units"
v-model="props.item.M_SatuanID"
return-object
item-value="M_SatuanID"
item-text="M_SatuanName"
solo
class="mt-3"
></v-select>
</v-flex>
</v-layout>
</div>
<div v-if="props.item.isHidden === false">
<v-layout row>
<v-flex>
<v-select
:items="props.item.units"
v-model="props.item.M_SatuanID"
return-object
item-value="M_SatuanID"
item-text="M_SatuanName"
solo
class="mt-3"
></v-select>
</v-flex>
</v-layout>
</div>
</td>
</template>
</v-data-table>
<v-layout row>
<v-flex pt-2 pl-2>
<div class="text-md-right pt-2 pb-2">
<v-btn
color="error"
@click="confirmResetAll()"
>
Reset
</v-btn>
<v-btn
color="primary"
@click="openSaveConsumableAll()"
>
Simpan
</v-btn>
</div>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card>
</v-layout>
</template>
<style scoped>
.searchbox .v-input.v-text-field .v-input__slot {
min-height: 60px;
}
.searchbox .v-btn {
min-height: 60px;
}
table.v-table tbody td,
table.v-table tbody th {
height: 40px;
}
table.v-table thead tr {
height: 40px;
}
.scroll-container {
scroll-padding: 50px 0 0 50px;
}
::-webkit-scrollbar {
width: 7px;
}
/* this targets the default scrollbar (compulsory) */
::-webkit-scrollbar-track {
background-color: #73baf3;
}
/* the new scrollbar will have a flat appearance with the set background color */
::-webkit-scrollbar-thumb {
background-color: #2196f3;
}
/* this will style the thumb, ignoring the track */
::-webkit-scrollbar-button {
background-color: #0079da;
}
/* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */
::-webkit-scrollbar-corner {
background-color: black;
}
</style>
<script>
module.exports = {
data() {
return {
xgetitemconsumable: 0,
itemconsumable_error_message: "",
clr: "success",
msgalert: "",
dialogdeletealert: false,
headers: [{
text: "ITEM",
align: "center",
sortable: false,
value: "mr",
width: "10%",
class: "pa-2 teal lighten-3 white--text"
},
{
text: "QTY",
align: "center",
sortable: false,
value: "mr",
width: "10%",
class: "pa-2 teal lighten-3 white--text"
},
{
text: "UNIT",
align: "center",
sortable: false,
value: "mr",
width: "10%",
class: "pa-2 teal lighten-3 white--text"
},
],
};
},
mounted() {
},
computed: {
vtests() {
return this.$store.state.consumable.tests
},
selected_orderheaderid() {
return this.$store.state.consumable.selected_orderheaderid
},
xconsumables() {
return this.$store.state.consumable.consumables
},
isLoading() {
return this.$store.state.consumable.search_consumable == 1
},
dialog_form: {
get() {
return this.$store.state.consumable.dialog_form
},
set(val) {
this.$store.commit("consumable/update_dialog_form", val)
this.$store.dispatch("consumable/get_item")
}
},
units() {
return this.$store.state.consumable.satuans
},
selected_consumable: {
get() {
return this.$store.state.consumable.selected_consumable
},
set(val) {
this.$store.commit("consumable/update_selected_consumable", val)
}
},
vitems() {
return this.$store.state.consumable.items
},
snackbar: {
get() {
return this.$store.state.consumable.alert_success
},
set(val) {
this.$store.commit("consumable/update_alert_success", val)
}
},
msgsnackbar: {
get() {
return this.$store.state.consumable.msg_success
},
set(val) {
this.$store.commit("consumable/update_msg_success", val)
}
},
dialog_error: {
get() {
return this.$store.state.consumable.alert_error
},
set(val) {
this.$store.commit("consumable/update_alert_error", val)
},
},
msgError() {
return this.$store.state.consumable.error_message
},
xact: {
get() {
return this.$store.state.consumable.act
},
set(val) {
this.$store.commit("consumable/update_act", val)
}
},
xact_notreset: {
get() {
return this.$store.state.consumable.act_notreset
},
set(val) {
this.$store.commit("consumable/update_act_notreset", val)
}
}
},
methods: {
thr_search_orderheader: _.debounce(function () {
this.$store.dispatch("consumable/gettest")
this.$store.dispatch("consumable/searchconsumable")
this.$store.dispatch("consumable/get_item")
// this.$store.dispatch("consumable/get_satuan")
}, 1000),
// isSelected(p) {
// return p.M_ConsumableID == this.$store.state.consumable.selected_consumable.M_ConsumableID
// },
selectMe(selected) {
this.$store.commit("consumable/update_selected_consumable", selected)
// this.$store.commit("consumable/update_last_id", selected.M_ConsumableID)
},
//validation
itemconsumableValidation() {
if (this.xgetitemconsumable.consumableid < 1 || !this.xgetitemconsumable.consumableid) {
this.itemconsumable_error_message = "Pilih salah satu item"
}
if (this.xgetitemconsumable.consumableid > 0) {
this.itemconsumable_error_message = ""
}
},
resetAllInput() {
this.xgetitemconsumable.consumableid = 0
this.itemconsumable_error_message = ""
},
// tambah consumable
addConsumable() {
this.dialog_form = true
this.xgetitemconsumable = ""
this.resetAllInput()
},
saveAdd() {
this.itemconsumableValidation()
if (this.itemconsumable_error_message === "") {
let prm = {
orderheaderid: this.$store.state.consumable.selected_orderheaderid,
consumableid: this.xgetitemconsumable.consumableid,
satuanid: this.xgetitemconsumable.M_ConsumableDefaultM_SatuanID,
qty: this.xgetitemconsumable.M_ConsumableDefaultQty,
name: this.xgetitemconsumable.M_ConsumableName
}
this.$store.dispatch("consumable/addconsumable", prm)
}
},
// reset
confirmResetAll() {
if (this.selected_consumable.isHidden === false) {
this.$store.commit("consumable/update_act_notreset", "notreset")
this.$store.commit("consumable/update_act", "")
this.msgalert = "Tidak bisa di reset, Pasien belum memiliki item consumable"
this.dialogdeletealert = true
} else if (this.selected_consumable.isHidden === true) {
this.$store.commit("consumable/update_act", "reset")
this.msgalert = "Yakin, mau reset semua consumable ?"
this.dialogdeletealert = true
}
},
resetAll() {
let prm = {
orderheaderid: this.$store.state.consumable.selected_orderheaderid
}
this.$store.dispatch("consumable/reset", prm)
this.dialogdeletealert = false
},
// save consumable
openSaveConsumableAll() {
this.$store.commit("consumable/update_act", "save")
this.msgalert = "Yakin, mau simpan CONSUMABLE ?"
let datas = []
for (let i = 0; i < this.xconsumables.length; i++) {
const item = this.xconsumables[i];
// console.log(item)
var unitx = item.units
// console.log(unitx)
for (let j = 0; j < unitx.length; j++) {
const itemUnit = unitx[j];
var unit = itemUnit.M_SatuanID
// console.log(unit)
}
if (item.M_ConsumableDefaultQty === null ||
item.M_ConsumableDefaultQty === "" ||
item.T_ConsumableQty === null ||
item.T_ConsumableQty === "")
{
this.clr = "black";
this.msgsnackbar = "QTY ada yang kosong"
this.snackbar = true;
this.dialogdeletealert = false
break;
} else if (item.M_ConsumableDefaultQty !== null &&
item.M_ConsumableDefaultQty !== "" &&
item.T_ConsumableQty !== null &&
item.T_ConsumableQty !== "")
{
this.dialogdeletealert = true
}
}
},
saveConsumableAll() {
if (this.selected_consumable.isHidden === false) {
let datas = []
for (let i = 0; i < this.xconsumables.length; i++) {
const item = this.xconsumables[i];
// console.log(item)
var unitx = item.units
// console.log(unitx)
for (let j = 0; j < unitx.length; j++) {
const itemUnit = unitx[j];
var unit = itemUnit.M_SatuanID
}
if (item.M_ConsumableDefaultQty === null ||
item.M_ConsumableDefaultQty === "" ||
item.M_ConsumableDefaultQty === "0" ||
item.M_ConsumableDefaultQty === 0)
{
this.clr = "black";
this.msgsnackbar = "QTY ada yang kosong"
this.snackbar = true;
this.dialogdeletealert = true
break;
} else if (item.M_ConsumableDefaultQty !== null &&
item.M_ConsumableDefaultQty !== "")
{
this.dialogdeletealert = false
const prm = {
"orderheaderId": this.$store.state.consumable.selected_orderheaderid,
"satuanId": item.M_SatuanID,
"consumableId": item.M_ConsumableID,
"consumableQty": item.M_ConsumableDefaultQty,
"type": item.isHidden
}
datas.push(prm)
}
}
// console.log("prm" + JSON.stringify(datas))
if (datas.length > 0) {
this.$store.dispatch("consumable/saveAllConsumable", {"data": datas})
}
} else if (this.selected_consumable.isHidden === true) {
let datas = []
for (let i = 0; i < this.xconsumables.length; i++) {
const item = this.xconsumables[i];
// console.log(item)
var unitx = item.units
// console.log(unitx)
for (let j = 0; j < unitx.length; j++) {
const itemUnit = unitx[j];
var unit = itemUnit.M_SatuanID
}
if (item.T_ConsumableQty === null ||
item.T_ConsumableQty === "")
{
this.clr = "black";
this.msgsnackbar = "QTY ada yang kosong"
this.snackbar = true;
this.dialogdeletealert = true
break;
} else if (item.T_ConsumableQty !== null &&
item.T_ConsumableQty !== "")
{
this.dialogdeletealert = false
const prm = {
"orderheaderId": this.$store.state.consumable.selected_orderheaderid,
"satuanId": item.M_SatuanID,
"consumableId": item.M_ConsumableID,
"consumableQty": item.T_ConsumableQty,
"type": item.isHidden
}
datas.push(prm)
}
}
// console.log("prm" + JSON.stringify(datas))
if (datas.length > 0) {
this.$store.dispatch("consumable/saveAllConsumable", {"data": datas})
}
}
}
},
watch: {
selected_orderheaderid(val, old) {
this.thr_search_orderheader()
},
}
}
</script>

View File

@@ -0,0 +1,315 @@
<template>
<v-layout class="fill-height" column>
<v-card class="mb-2 pa-2 searchbox">
<v-layout row>
<v-flex xs6>
<v-menu
v-model="menufilterdatestart"
: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
v-model="filterComputedDateFormattedStart"
class="mr-3" label="Tanggal Awal"
outline hide-details readonly v-on="on"
@blur="date = deFormatedDate(filterComputedDateFormattedStart)"></v-text-field>
</template>
<v-date-picker no-title
v-model="xdatestart" @input="menufilterdatestart = false"></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs6>
<v-menu
v-model="menufilterdateend"
: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
v-model="filterComputedDateFormattedEnd"
label="Tanggal Akhir"
outline hide-details readonly v-on="on"
@blur="date = deFormatedDate(filterComputedDateFormattedEnd)"></v-text-field>
</template>
<v-date-picker no-title
v-model="xdateend" @input="menufilterdateend = false"></v-date-picker>
</v-menu>
</v-flex>
</v-layout>
<v-layout row class="pt-2">
<v-flex xs6>
<v-text-field style="font-size:14px" label="No Reg / Nama" class="mr-3" outline
v-model="vsearch" hide-details></v-text-field>
</v-flex>
<v-flex xs6>
<v-autocomplete label="Kel. Pelanggan" v-model="selected_company" :items="xcompanys"
:search-input.sync="search_company" auto-select-first hide-details style="font-size:14px" outline
no-filter item-text="name" return-object no-data-text="Semua Kel. Pelanggan">
<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-card>
<v-layout row style="max-height:650px;overflow: auto;">
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
<v-data-table :headers="headers" :items="xpatients" :isLoading="isLoading" :pagination.sync="pagination" class="elevation-1 fixed_header">
<template slot="items" slot-scope="props">
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
{{ props.item.rownumber }}
</td>
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
{{ props.item.T_OrderHeaderLabNumber }}
</td>
<td class="text-xs-center pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
{{ props.item.patient_fullname }}
</td>
</template>
<template>
<div class="text-xs-center">
<v-pagination v-model="page" :length="15" :total-visible="7"></v-pagination>
</div>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-card>
</v-layout>
</template>
<style scoped>
.searchbox .v-input.v-text-field .v-input__slot {
min-height: 60px;
}
.searchbox .v-btn {
min-height: 60px;
}
table.v-table tbody td,
table.v-table tbody th {
height: 40px;
}
table.v-table thead tr {
height: 40px;
}
.scroll-container {
scroll-padding: 50px 0 0 50px;
}
::-webkit-scrollbar {
width: 7px;
}
/* this targets the default scrollbar (compulsory) */
::-webkit-scrollbar-track {
background-color: #73baf3;
}
/* the new scrollbar will have a flat appearance with the set background color */
::-webkit-scrollbar-thumb {
background-color: #2196f3;
}
/* this will style the thumb, ignoring the track */
::-webkit-scrollbar-button {
background-color: #0079da;
}
/* optionally, you can style the top and the bottom buttons (left and right for horizontal bars) */
::-webkit-scrollbar-corner {
background-color: black;
}
</style>
<script>
module.exports = {
data() {
return {
search_company: "",
menufilterdatestart: false,
menufilterdateend:false,
date: new Date().toISOString().substr(0, 10),
headers: [{
text: "NO",
align: "center",
sortable: false,
value: "mr",
width: "5%",
class: "pa-2 teal lighten-3 white--text"
},
{
text: "NO REG",
align: "center",
sortable: false,
value: "mr",
width: "8%",
class: "pa-2 teal lighten-3 white--text"
},
{
text: "NAMA",
align: "center",
sortable: false,
value: "mr",
width: "20%",
class: "pa-2 teal lighten-3 white--text"
},
],
page: 1,
pagination: {
descending: false,
page: 1,
rowsPerPage: 5,
sortBy: 'T_OrderHeaderLabNumber',
totalItems: this.$store.state.patient.total_patients
},
};
},
mounted() {
this.$store.dispatch("patient/search", {
startdate: this.$store.state.patient.start_date,
enddate: this.$store.state.patient.end_date,
search: this.vsearch,
companyid: this.selected_company.id,
last_id: -1
})
},
computed: {
xcompanys() {
return this.$store.state.patient.companys
},
selected_company: {
get() {
return this.$store.state.patient.selected_company
},
set(val) {
this.$store.commit("patient/update_selected_company", val)
this.searchPatient()
}
},
xpatients() {
return this.$store.state.patient.patients
},
isLoading() {
return this.$store.state.patient.search_status == 1
},
vsearch: {
get() {
return this.$store.state.patient.x_search
},
set(val) {
this.$store.commit("patient/update_x_search", val)
}
},
xdatestart: {
get() {
return this.$store.state.patient.start_date
},
set(val) {
this.$store.commit("patient/update_start_date",val)
this.$store.commit("patient/update_last_id", -1)
}
},
xdateend: {
get() {
return this.$store.state.patient.end_date
},
set(val) {
this.$store.commit("patient/update_end_date",val)
this.$store.commit("patient/update_last_id", -1)
}
},
filterComputedDateFormattedStart () {
return this.formatDate(this.xdatestart)
},
filterComputedDateFormattedEnd () {
return this.formatDate(this.xdateend)
},
selected_patient: {
get() {
return this.$store.state.patient.selected_patient
}
}
},
methods: {
isSelected(p) {
return p.T_OrderHeaderID == this.$store.state.patient.selected_patient.T_OrderHeaderID
},
selectMe(selected) {
this.$store.commit("patient/update_selected_patient", selected)
this.$store.commit("patient/update_last_id", selected.T_OrderHeaderID)
this.$store.commit("consumable/update_last_id", -1)
},
thr_search_company: _.debounce(function () {
this.$store.dispatch("patient/getcompany", this.search_company)
}, 1000),
thr_search: _.debounce(function () {
this.$store.dispatch("patient/search", {
startdate: this.$store.state.patient.start_date,
enddate: this.$store.state.patient.end_date,
search: this.vsearch,
companyid: this.selected_company.id,
last_id: -1
})
}, 1000),
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')}`
},
searchPatient() {
this.$store.dispatch("patient/search", {
startdate: this.$store.state.patient.start_date,
enddate: this.$store.state.patient.end_date,
search: this.vsearch,
companyid: this.selected_company.id,
last_id: -1
})
}
},
watch: {
search_company(val, old) {
if (val == old) return;
if (!val) return;
if (val.length < 1) return;
if (this.$store.state.patient.update_autocomplete_status == 1) return;
this.thr_search_company();
},
vsearch(val, old) {
this.vsearch = val
this.thr_search()
},
xdatestart(val, old) {
this.xdatestart = val
this.thr_search()
},
xdateend(val, old) {
this.xdateend = val
this.thr_search()
},
selected_patient(val, old) {
this.$store.commit("consumable/update_selected_orderheaderid", val.T_OrderHeaderID)
}
}
}
</script>

View File

@@ -0,0 +1,92 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>One</title>
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
<link rel="stylesheet" href="../../../libs/vendor/css/icomoon-fonts.css">
<link rel="stylesheet" href="../../../libs/vendor/css/vuetify.min.css">
</head>
<body>
<div v-cloak id="app">
<v-app id="smartApp">
<one-navbar></one-navbar>
<v-content class="blue lighten-5">
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
<v-layout row wrap>
<v-flex xs5 class="left" fill-height pa-1>
<one-patient-list></one-patient-list>
</v-flex>
<v-flex xs7 class="right" fill-height pa-1>
<one-consumable-list></one-consumable-list>
</v-flex>
</v-layout>
</v-container>
</v-content>
<one-footer> </one-footer>
</v-app>
</div>
<!-- Vendor -->
<script src="../../../libs/vendor/moment.min.js"></script>
<script src="../../../libs/vendor/numeral.min.js"></script>
<script src="../../../libs/vendor/moment-locale-id.js"></script>
<script src="../../../libs/vendor/lodash.js"></script>
<script src="../../../libs/vendor/axios.min.js"></script>
<script src="../../../libs/vendor/vue.js"></script>
<script src="../../../libs/vendor/vuex.js"></script>
<script src="../../../libs/vendor/vuetify.js"></script>
<script src="../../../libs/vendor/httpVueLoader.js"></script>
<script src="../../../libs/one_global.js"></script>
<script src="../../../libs/one_print_barcode_v7.js"></script>
<script src="../../../libs/one_print_robo.js"></script>
<!-- App Script -->
<?php
$ts = "?ts=" . Date("ymdhis");
?>
<script type="module">
window.calculate_age = function(inp_dob) {
var now = moment(new Date())
var dob = moment(new Date(inp_dob))
var year = now.diff(dob, 'years')
dob.add(year, 'years')
var month = now.diff(dob, 'months')
dob.add(month, 'months')
var day = now.diff(dob, 'days')
if (isNaN(year)) return ''
return `${year} tahun ${month} bulan ${day} hari`
}
import {
store
} from './store.js<?php echo $ts ?>';
//for testing
window.store = store;
new Vue({
store,
el: '#app',
components: {
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
'one-patient-list': httpVueLoader('./components/onePatientList.vue'),
'one-consumable-list': httpVueLoader('./components/oneConsumableList.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {}
.right {}
</style>
</body>
</html>

View File

@@ -0,0 +1,316 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/consumable.js"
export default {
namespaced: true,
state: {
tests: [],
test_status: 0,
selected_orderheaderid: 0,
consumables: [],
total_consumables: 0,
search_consumable: 0,
search_error_message: "",
last_id: -1,
selected_consumable: {},
dialog_form: false,
satuans: [],
satuan_status: 0,
satuan_error_message: "",
items: [],
item_status: 0,
item_error_message: "",
alert_success: false,
msg_success: "",
alert_error: false,
error_message: "",
addconsumable_status: 0,
reset_status: 0,
dialog_error: false,
act: "",
selected_itemconsum: [],
act_notreset: "",
saveAllConsumable_status: 0
},
mutations: {
update_tests(state, val) {
state.tests = val
},
update_test_status(state, val) {
state.test_status = val
},
update_selected_orderheaderid(state, val) {
state.selected_orderheaderid = val
},
update_consumables(state, val) {
state.consumables = val
},
update_total_consumables(state, val) {
state.total_consumables = val
},
update_search_consumable(state, val) {
state.search_consumable = val
},
update_search_error_message(state, val) {
state.search_error_message = val
},
update_last_id(state, val) {
state.last_id = val
},
update_selected_consumable(state, val) {
state.selected_consumable = val
},
update_dialog_form(state, val) {
state.dialog_form = val
},
update_satuans(state, val) {
state.satuans = val
},
update_satuan_status(state, val) {
state.satuan_status = val
},
update_satuan_error_message(state, val) {
state.satuan_error_message = val
},
update_items(state, val) {
state.items = val
},
update_item_status(state, val) {
state.item_status = val
},
update_item_error_message(state, val) {
state.item_error_message = val
},
update_alert_success(state, val) {
state.alert_success = val
},
update_msg_success(state, val) {
state.msg_success = val
},
update_alert_error(state, val) {
state.alert_error = val;
},
update_error_message(state, val) {
state.error_message = val
},
update_addconsumable_status(state, val) {
state.addconsumable_status = val
},
update_reset_status(state, val) {
state.reset_status = val
},
update_dialog_error(state, val) {
state.dialog_error = val
},
update_act(state, val) {
state.act = val
},
update_act_notreset(state, val) {
state.act_notreset = val
},
update_saveAllConsumable_status(state, val) {
state.saveAllConsumable_status = val
}
},
actions: {
async gettest(context, prm) {
context.commit("update_test_status",1)
try {
var prm = {
token: one_token(),
orderheaderid: context.state.selected_orderheaderid
}
let resp = await api.gettest(prm)
if (resp.status != "OK") {
context.commit("update_test_status",3)
console.log(resp.message)
} else {
context.commit("update_test_status",2)
let data = {
records: resp.data.records
}
context.commit("update_tests", resp.data.records)
}
} catch (e) {
context.commit("update_test_status",3)
console.log(e)
}
},
async searchconsumable(context, prm) {
context.commit("update_search_consumable", 1)
try {
var prm = {
token: one_token(),
orderheaderid: context.state.selected_orderheaderid
}
let resp = await api.searchconsumable(prm)
if (resp.status != "OK") {
context.commit("update_search_consumable", 3)
context.commit("update_search_error_message", resp.message)
} else {
context.commit("update_search_consumable", 2)
context.commit("update_search_error_message", "")
let records = resp.data.records
let total = resp.data.total_filter
context.commit("update_consumables", records)
context.commit("update_total_consumables", total)
if (context.state.last_id == -1) {
if (resp.data && resp.data.records.length > 0) {
context.commit("update_selected_consumable", resp.data.records[0])
}
} else {
let idx = _.findIndex(resp.data.records, function (o) {
return o.M_ConsumableID == context.state.selected_consumable.M_ConsumableID
});
if (idx >= 0) {
context.commit("update_selected_consumable", resp.data.records[idx]);
}
}
}
} catch (e) {
context.commit("update_search_consumable", 3)
context.commit("update_search_error_message", e.message)
console.log(e)
}
},
async get_satuan(context,prm) {
context.commit("update_satuan_status",1)
try {
// prm.token = one_token()
var prm = {
token: one_token()
}
let resp = await api.get_satuan(prm)
if (resp.status != "OK") {
context.commit("update_satuan_status",3)
context.commit("update_satuan_error_message", resp.message)
} else {
context.commit("update_satuan_status",2)
context.commit("update_satuan_error_message", "")
let data = {
records: resp.data.records
}
context.commit("update_satuans", data.records)
}
} catch (e) {
context.commit("update_satuan_status",3)
context.commit("update_satuan_error_message", e.message)
}
},
async get_item(context,prm) {
context.commit("update_item_status",1)
try {
var prm = {
token: one_token(),
orderheaderid: context.state.selected_orderheaderid
}
let resp = await api.get_item(prm)
if (resp.status != "OK") {
context.commit("update_item_status",3)
context.commit("update_item_error_message", resp.message)
} else {
context.commit("update_item_status",2)
context.commit("update_item_error_message", "")
let data = {
records: resp.data.records
}
context.commit("update_items", data.records)
}
} catch (e) {
context.commit("update_item_status",3)
context.commit("update_item_error_message", e.message)
}
},
async addconsumable(context,prm) {
context.commit("update_addconsumable_status",1)
try {
prm.token = one_token()
let resp = await api.addconsumable(prm)
if (resp.status != "OK") {
context.commit("update_addconsumable_status",3)
context.commit("update_error_message", resp.message)
context.commit("update_alert_error", true)
context.commit("update_dialog_error", true)
} else {
context.commit("update_addconsumable_status",2)
context.commit("update_error_message", "")
context.commit("update_dialog_error", false)
context.commit("update_dialog_form", false)
var msg = "Item " + prm.name + " berhasil disimpan"
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.dispatch("searchconsumable")
}
} catch (e) {
context.commit("update_addconsumable_status",3)
context.commit("update_alert_error", true)
context.commit("update_error_message", e.message)
context.commit("update_dialog_error", true)
}
},
async reset(context,prm) {
context.commit("update_reset_status",1)
try {
prm.token = one_token()
let resp = await api.reset(prm)
if (resp.status != "OK") {
context.commit("update_reset_status",3)
context.commit("update_alert_error", true)
context.commit("update_error_message", resp.message)
context.commit("update_dialog_error", true)
} else {
context.commit("update_reset_status",2)
context.commit("update_error_message", "")
context.commit("update_dialog_error", false)
var msg = "Consumable berhasil di reset semua"
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.dispatch("searchconsumable")
}
} catch (e) {
context.commit("update_reset_status",3)
context.commit("update_alert_error", true)
context.commit("update_error_message", e.message)
context.commit("update_dialog_error", true)
}
},
async saveAllConsumable(context, prm) {
context.commit("update_saveAllConsumable_status",1)
try {
prm.token = one_token();
let resp = await api.saveAllConsumable(prm)
if (resp.status != "OK") {
context.commit("update_saveAllConsumable_status",3)
context.commit("update_error_message", resp.message)
context.commit("update_alert_error", true)
context.commit("update_dialog_error", true)
} else {
context.commit("update_saveAllConsumable_status",2)
let total = resp.data.total
context.commit("update_error_message", "")
context.commit("update_dialog_error", false)
var msg = "Consumable berhasil di simpan"
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.dispatch("searchconsumable")
}
} catch (e) {
context.commit("update_saveAllConsumable_status",3)
context.commit("update_alert_error", true)
context.commit("update_error_message", e.message)
context.commit("update_dialog_error", true)
}
}
}
}

View File

@@ -0,0 +1,132 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/patient.js"
export default {
namespaced: true,
state: {
companys: [],
autocomplete_status: 0,
selected_company: {id:0, name:'Semua'},
patients: [],
total_patients: 0,
search_patient: 0,
search_error_message: "",
selected_patient: {},
x_search: "",
start_date: moment(new Date()).format('YYYY-MM-DD'),
end_date: moment(new Date()).format('YYYY-MM-DD'),
companyid: 0,
last_id: -1
},
mutations: {
update_companys(state, val) {
state.companys = val
},
update_autocomplete_status(state, val) {
state.autocomplete_status = val
},
update_selected_company(state, val) {
state.selected_company = val
},
update_patients(state, val) {
state.patients = val
},
update_search_patient(state, val) {
state.search_patient = val
},
update_search_error_message(state, val) {
state.search_error_message = val
},
update_total_patients(state, val) {
state.total_patients = val
},
update_selected_patient(state, val) {
state.selected_patient = val
},
update_x_search(state, val) {
state.x_search = val
},
update_start_date(state, val) {
state.start_date = val
},
update_end_date(state, val) {
state.end_date = val
},
update_companyid(state, val) {
state.companyid = val
},
update_last_id(state, val) {
state.last_id = val
}
},
actions: {
async getcompany(context,prm) {
context.commit("update_autocomplete_status",1)
try {
let resp= await api.getcompany(one_token(),prm)
if (resp.status != "OK") {
context.commit("update_autocomplete_status",3)
} else {
context.commit("update_autocomplete_status",2)
let data = {
records : resp.data.records,
total: resp.data.total_display
}
context.commit("update_companys",resp.data.records)
}
} catch(e) {
context.commit("update_autocomplete_status",3)
}
},
async search(context, prm) {
context.commit("update_search_patient", 1)
try {
prm.token = one_token()
let resp = await api.search(prm)
if (resp.status != "OK") {
context.commit("update_search_patient", 3)
context.commit("update_search_error_message", resp.message)
} else {
context.commit("update_search_patient", 2)
context.commit("update_search_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total_filter
}
context.commit("update_patients", data.records)
context.commit("update_total_patients", data.total)
// if (prm.lastid === -1) {
// if (resp.data && data.records.length > 0) {
// context.commit("update_selected_patient", data.records[0])
// } else {
// context.commit("update_selected_patient", {})
// }
// } else {
// context.commit("update_selected_patient", data.records[prm.lastid])
// }
if (context.state.last_id == -1) {
if (resp.data && resp.data.records.length > 0) {
context.commit("update_selected_patient", resp.data.records[0])
}
} else {
let idx = _.findIndex(resp.data.records, function (o) {
return o.T_OrderHeaderID == context.state.selected_patient.T_OrderHeaderID
});
if (idx >= 0) {
context.commit("update_selected_patient", resp.data.records[idx]);
}
}
}
} catch (e) {
context.commit("update_search_patient", 3)
context.commit("update_search_error_message", e.message)
console.log(e)
}
}
}
}

View File

@@ -0,0 +1,25 @@
// State
// data ...
// Mutations
//
//
// Actions
import patient from "./modules/patient.js";
import consumable from "./modules/consumable.js"
import system from "../../../apps/modules/system/system.js";
export const store = new Vuex.Store({
modules: {
patient:patient,
consumable:consumable,
system:system
},
state: {
},
mutations: {
},
actions: {
}
});