Initial import

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

View File

@@ -0,0 +1,20 @@
const URL = "/one-api/v1/one-doctor/doctortestv3/";
export async function lookup(prm) {
try {
var resp = await axios.post(URL + 'lookup', 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,97 @@
const URL = "/one-api/v1/one-doctor/doctortestv3/";
export async function lookuptest(prm) {
try {
var resp = await axios.post(URL + 'lookuptest', 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 saveeditstatus(prm) {
try {
var resp = await axios.post(URL + 'saveeditstatus', 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 getstatus(prm) {
try {
var resp = await axios.post(URL + 'getstatus', 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
};
}
}
// dropdown doctors
export async function getdoctor(prm) {
try {
var resp = await axios.post(URL + 'getdoctor', 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 copyfromdoctor(prm) {
try {
var resp = await axios.post(URL + 'copyfromdoctor', 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,271 @@
<template>
<v-layout>
<template>
<v-dialog max-width="30%">
<v-card>
</v-card>
</v-dialog>
</template>
<v-flex xs12>
<v-card>
<v-toolbar color="blue lighten-3" dark height="50px">
<v-toolbar-title>DOKTER</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<v-layout row style="background:white;padding-top:5px;" justify-left>
<v-text-field class=" xs4 ma-1" label="Cari"
placeholder="Ketikkan Dokter atau Nama Agreement atau Perusahaan" outline v-model="xsearch"
hide-details></v-text-field>
</v-layout>
<v-divider></v-divider>
<div>
<v-layout row class="scroll-container" style="max-height:600px;overflow: auto;">
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
<v-data-table :headers="headers" :items="vdoctor" :loading="isLoading" hide-actions
class="elevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-left pa-2" v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
@click="selectMe(props.item)">{{ props.item.doctorName }}</td>
<td class="text-xs-left pa-2" v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
@click="selectMe(props.item)">{{ props.item.M_MouName }}</td>
<td class="text-xs-left pa-2" v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
@click="selectMe(props.item)">{{ props.item.M_CompanyName }}</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-divider></v-divider>
<v-flex xs12 class="text-xs-left pt-3 pb-3">
<v-pagination v-model="curr_page" :length="xtotal_page"></v-pagination>
</v-flex>
</div>
</v-card>
</v-flex>
</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;
}
.textinput {
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding-left: 40px;
width: 100%;
padding: 8px 10px;
margin-bottom: 5px;
box-sizing: border-box;
border: 1px solid #607d8b;
}
.textinput:focus {
width: 100%;
}
.textinput:focus::-webkit-input-placeholder {
color: transparent;
}
.textinput:focus::-moz-placeholder {
color: transparent;
}
.textinput:-moz-placeholder {
color: transparent;
}
.boxoutline {
color: red;
border: 1px solid red;
justify-content: center;
height: 45px;
line-height: 45px;
padding-left: 10px;
background: #ffffff;
font-size: 14px;
font-weight: 500;
border-radius: 1px
}
.boxoutline:hover {
background: rgba(0, 0, 0, 0.07) !important;
font-size: 15px;
font-weight: 700;
}
.boxsolid {
color: #ffffff;
border: 1px solid #ffffff;
justify-content: center;
height: 45px;
line-height: 45px;
padding-left: 10px;
background: #f44336;
font-size: 14px;
font-weight: 500;
border-radius: 1px
}
.boxsolid:hover {
background: #f44336de;
font-size: 15px;
font-weight: 700;
}
.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;
}
/* if both the vertical and the horizontal bars appear, then perhaps the right bottom corner also needs to be styled */
</style>
<script>
module.exports = {
data() {
return {
headers: [{
text: "DOKTER",
align: "left",
sortable: false,
value: "mr",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "NAMA AGREEMENT",
align: "left",
sortable: false,
value: "mr",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "NAMA PERUSAHAAN",
align: "left",
sortable: false,
value: "mr",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
}
]
};
},
mounted() {
this.$store.dispatch("doctor/lookup")
},
computed: {
vdoctor() {
return this.$store.state.doctor.doctors
},
isLoading() {
return this.$store.state.doctor.lookup_status == 1
},
curr_page: {
get() {
return this.$store.state.doctor.current_page
},
set(val) {
this.$store.commit("doctor/update_current_page", val)
this.$store.dispatch("doctor/lookup")
}
},
xtotal_page: {
get() {
return this.$store.state.doctor.total_doctors
},
set(val) {
this.$store.commit("doctor/update_total_doctors", val)
}
},
xsearch: {
get() {
return this.$store.state.doctor.x_search
},
set(val) {
this.$store.commit("doctor/update_x_search", val)
}
},
selected_doctor() {
return this.$store.state.doctor.selected_doctor
}
},
methods: {
isSelected(p) {
return p.doctor_id == this.$store.state.doctor.selected_doctor.doctor_id
},
selectMe(selected) {
this.$store.commit("doctor/update_selected_doctor", selected)
this.$store.commit("doctortest/update_selected_doctor_id", selected.doctor_id)
this.$store.commit("doctortest/update_selected_mou_id", selected.M_UserM_MouID)
},
thr_search: _.debounce(function () {
this.$store.dispatch("doctor/lookup")
}, 1000)
},
watch: {
xsearch(val, old) {
this.xsearch = val
this.thr_search()
},
selected_doctor(val, old) {
this.$store.commit("doctortest/update_selected_doctor_id", val.doctor_id)
}
}
}
</script>

View File

@@ -0,0 +1,456 @@
<template>
<v-layout>
<!-- 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 -->
<!-- dialog dokter -->
<v-dialog v-model="dialog_form" persistent width="50%">
<v-card>
<v-card-title>
<span class="title">Form Dokter</span>
</v-card-title>
<v-divider></v-divider>
<v-progress-linear v-if="loading_save" :indeterminate="true"></v-progress-linear>
<v-card-text class="pt-3 pb-0">
<v-layout row wrap>
<v-flex xs12>
<v-select v-model="xdoctors" autocomplete :items="doctorss" item-text="doctorName"
item-value="doctor_id" return-object label="Pilih Nama Dokter"
:error="error_doctor_message !== ''" :error-messages="error_doctor_message"
@blur="doctorValidation" 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" :disabled="loading_save">Tutup</v-btn>
<v-btn color="primary" flat :disabled="loading_save" @click="saveAdd()">Pilih Dokter</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- end dialog dokter -->
<v-flex xs12>
<v-card class="mb-2" color="white">
<v-toolbar color="blue lighten-3" dark height="50px">
<v-toolbar-title>PEMERIKSAAN</v-toolbar-title>
<v-spacer></v-spacer>
<div>
<v-btn small @click="openFormDoctor()">COPY FROM DOCTOR</v-btn>
</div>
</v-toolbar>
<v-layout row style="background:white">
<v-layout row justify-space-between>
<v-flex xs4>
<v-text-field class="ma-1" label="Cari" placeholder="Ketikkan Kode atau Pemeriksaan" outline
v-model="xsearch" hide-details></v-text-field>
</v-flex>
<v-flex xs3>
<v-select item-text="M_StatusName" return-object :items="f_statuss" style="font-size:14px"
class="mini-select ma-1" v-model="selected_filter_status" outline hide-details
label="Status"></v-select>
</v-flex>
</v-layout>
</v-layout>
<v-divider></v-divider>
<v-layout row wrap class="scroll-container" style="max-height:600px;overflow: auto;">
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
<v-data-table :headers="headers" :items="vdoctortest" :loading="isLoading" hide-actions
class="elevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-left pa-2" v-html="props.item.T_TestSasCode">
</td>
<td class="text-xs-left pa-2" v-html="props.item.T_TestName">
</td>
<td class="text-xs-left pa-2">
<div>
<v-btn @click="changeBtn(props.item)" v-if="props.item.status === 'N'" small
color="error">
<v-icon left>close</v-icon> Belum dipilih</v-btn>
<v-btn @click="changeBtn(props.item)" v-if="props.item.status === 'Y'" small
color="success">
<v-icon left>check</v-icon> Sudah terpilih</v-btn>
</div>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-divider></v-divider>
<v-pagination style="margin-top:10px;margin-bottom:10px" v-model="curr_page"
:length="xtotal_page"></v-pagination>
</v-card>
</v-flex>
</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;
}
.textinput {
-webkit-transition: width 0.4s ease-in-out;
transition: width 0.4s ease-in-out;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding-left: 40px;
width: 100%;
padding: 8px 10px;
margin-bottom: 5px;
box-sizing: border-box;
border: 1px solid #607d8b;
}
.textinput:focus {
width: 100%;
}
.textinput:focus::-webkit-input-placeholder {
color: transparent;
}
.textinput:focus::-moz-placeholder {
color: transparent;
}
.textinput:-moz-placeholder {
color: transparent;
}
.boxoutline {
color: red;
border: 1px solid red;
justify-content: center;
height: 45px;
line-height: 45px;
padding-left: 10px;
background: #ffffff;
font-size: 14px;
font-weight: 500;
border-radius: 1px
}
.boxoutline:hover {
background: rgba(0, 0, 0, 0.07) !important;
font-size: 15px;
font-weight: 700;
}
.boxsolid {
color: #ffffff;
border: 1px solid #ffffff;
justify-content: center;
height: 45px;
line-height: 45px;
padding-left: 10px;
background: #f44336;
font-size: 14px;
font-weight: 500;
border-radius: 1px
}
.boxsolid:hover {
background: #f44336de;
font-size: 15px;
font-weight: 700;
}
.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;
}
/* if both the vertical and the horizontal bars appear, then perhaps the right bottom corner also needs to be styled */
</style>
<script>
module.exports = {
data() {
return {
clr: "success",
xdoctors: 0,
error_doctor_message: "",
headers: [
{
text: "KODE",
align: "left",
sortable: false,
value: "mr",
width: "20%",
class: "blue lighten-3 white--text"
},
{
text: "PEMERIKSAAN",
align: "left",
sortable: false,
value: "mr",
width: "30%",
class: "blue lighten-3 white--text"
},
{
text: "STATUS",
align: "left",
sortable: false,
value: "mr",
width: "10%",
class: "blue lighten-3 white--text"
}
]
};
},
mounted() {
this.$store.dispatch("doctortest/getstatus")
},
computed: {
selected_filter_status: {
get() {
return this.$store.state.doctortest.selected_filter_status
},
set(val) {
this.$store.commit("doctortest/update_selected_filter_status", val)
}
},
f_statuss: {
get() {
return this.$store.state.doctortest.f_statuss
},
set(val) {
this.$store.commit("doctortest/update_f_statuss", val)
}
},
vdoctortest() {
return this.$store.state.doctortest.doctortests
},
xdoctor() {
return this.$store.state.doctor.selected_doctor
},
isLoading() {
return this.$store.state.doctortest.lookup_status == 1
},
curr_page: {
get() {
return this.$store.state.doctortest.current_page
},
set(val) {
this.$store.commit("doctortest/update_current_page", val)
this.$store.commit("doctortest/update_last_id", -1)
this.$store.dispatch("doctortest/lookuptest")
}
},
xtotal_page: {
get() {
return this.$store.state.doctortest.total_doctortests
},
set(val) {
this.$store.commit("doctortest/update_total_doctortests", val)
}
},
xsearch: {
get() {
return this.$store.state.doctortest.x_search
},
set(val) {
this.$store.commit("doctortest/update_x_search", val)
}
},
selected_doctor_id() {
return this.$store.state.doctortest.selected_doctor_id
},
snackbar: {
get() {
return this.$store.state.doctortest.alert_success;
},
set(val) {
this.$store.commit("doctortest/update_alert_success", val);
}
},
msgsnackbar() {
return this.$store.state.doctortest.msg_success;
},
msgError() {
return this.$store.state.doctortest.save_error_message;
},
dialog_error: {
get() {
return this.$store.state.doctortest.alert_error;
},
set(val) {
this.$store.commit("doctortest/update_alert_error", val);
},
},
loading_save: {
get() {
return this.$store.state.doctortest.loading_save
},
set(val) {
this.$store.commit("doctortest/update_loading_save", val)
},
},
dialog_form: {
get() {
return this.$store.state.doctortest.dialog_form
},
set(val) {
this.$store.commit("doctortest/update_dialog_form", val)
},
},
// dropdown doctor
doctorss() {
return this.$store.state.doctortest.doctors
},
xdoctorr() {
return this.$store.state.doctor.selected_doctor
},
xact: {
get() {
return this.$store.state.doctortest.act
},
set(val) {
this.$store.commit("doctortest/update_act", val)
}
},
},
methods: {
thr_search: _.debounce(function () {
this.$store.dispatch("doctortest/lookuptest")
}, 1000),
thr_search_doctor: _.debounce(function () {
this.$store.dispatch("doctortest/lookuptest")
}, 300),
thr_search_doctor_mou: _.debounce(function () {
this.$store.dispatch("doctortest/getdoctor")
}, 1000),
changeBtn(value) {
var prm = {
doctor_id: this.$store.state.doctortest.selected_doctor_id,
test_id: value.testid,
status: value.status === 'N' ? 'Y' : 'N',
T_TestName: value.T_TestName
}
this.$store.dispatch("doctortest/saveeditstatus", prm)
},
doctorValidation() {
if (_.isEmpty(this.xdoctors)) {
this.error_doctor_message = 'Anda belum mengisi'
}
if (this.xdoctors) {
this.error_doctor_message = ""
}
},
resetAllInput() {
this.xdoctors = ""
this.error_doctor_message = ""
},
openFormDoctor() {
this.dialog_form = true
this.$store.commit("doctortest/update_act", "add")
this.xdoctors = ""
this.resetAllInput()
this.$store.commit("doctortest/update_last_id", -1)
},
saveAdd() {
this.doctorValidation()
if (this.error_doctor_message === "") {
var prm = {
doctor_name: this.xdoctors.doctorName,
doctoridfrom: this.xdoctors.doctor_id,
doctoridto: this.$store.state.doctor.selected_doctor.doctor_id
}
this.$store.dispatch("doctortest/copyfromdoctor", prm)
this.dialog_form = false
}
}
},
watch: {
xsearch(val, old) {
this.xsearch = val
this.thr_search()
},
xdoctor(val, old) {
this.thr_search_doctor()
},
selected_doctor_id(val, old) {
this.thr_search_doctor()
},
selected_filter_status(val, old) {
if (this.$store.state.doctortest.selected_doctor_id === 0) {
return
}
this.thr_search()
},
xdoctorr(val, old) {
this.thr_search_doctor_mou()
}
}
}
</script>

View File

@@ -0,0 +1,77 @@
<!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 xs4 class="left" fill-height pa-1>
<!-- komponen kiri -->
<one-doctor-list></one-doctor-list>
</v-flex>
<v-flex xs8 class="right" fill-height pa-1>
<!-- komponen kanan -->
<one-doctortest-list></one-doctortest-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>
<!-- App Script -->
<?php
$ts = "?ts=" . Date("ymdhis");
?>
<script type="module">
import { store } from './store.js<?php echo $ts ?>';
//for testing
window.store = store;
new Vue({
store,
el: '#app',
components: {
'one-navbar': httpVueLoader('../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../apps/components/oneFooter.vue'),
'one-doctor-list': httpVueLoader('./components/oneMdDoctorList.vue'),
'one-doctortest-list': httpVueLoader('./components/oneMdDoctortestList.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {
}
.right {
}
</style>
</body>
</html>

View File

@@ -0,0 +1,85 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/doctor.js"
export default {
namespaced: true,
state: {
doctors: [],
lookup_status: 0,
current_page: 1,
total_doctors: 0,
x_search: "",
error_message: "",
selected_doctor: {}
},
mutations: {
update_doctors(state, data) {
state.doctors = data
},
update_lookup_status(state, status) {
state.lookup_status = status
},
update_current_page(state, val) {
state.current_page = val
},
update_total_doctors(state, val) {
state.total_doctors = val
},
update_error_message(state, data) {
state.error_message = data
},
update_selected_doctor(state, val) {
state.selected_doctor = val
},
update_x_search(state, val) {
state.x_search = val
state.current_page = 1
}
},
actions: {
async lookup(context, prm) {
context.commit("update_lookup_status", 1)
try {
var prm = {
token: one_token(),
search: context.state.x_search,
current_page: context.state.current_page
}
let resp = await api.lookup(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_error_message", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_error_message", "")
let data = {
records: resp.data.records,
total_page: resp.data.total_page,
total_filter: resp.data.total_filter
}
context.commit("update_doctors", resp.data.records)
context.commit("update_total_doctors", resp.data.total_page)
if (
!(
Object.keys(context.state.selected_doctor).length === 0 &&
context.state.selected_doctor.constructor === Object
)
) {
let idx = _.findIndex(resp.data.records, function (o) {
return o.id == context.state.selected_doctor.doctor_id
});
if (idx >= 0) {
context.commit("update_selected_doctor", resp.data.records[idx]);
}
}
}
} catch (e) {
context.commit("update_lookup_status", 3)
context.commit("update_error_message", e.message)
}
}
}
}

View File

@@ -0,0 +1,263 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/doctortest.js"
export default {
namespaced: true,
state: {
doctortests: [],
lookup_status: 0,
current_page: 1,
selected_doctortest: {},
total_doctortests: 0,
last_id: -1,
x_search: "",
selected_doctor_id: 0,
error_message: "",
save_status: 0,
save_error_message: "",
alert_success: false,
msg_success: "",
alert_error: false,
get_data_status: 0,
f_statuss: [],
selected_filter_status: { "M_StatusID": "A", "M_StatusName": "Semua" },
dialog_form: false,
loading_save: false,
autocomplete_status: 0,
doctors: [],
selected_mou_id: 0,
act: "add",
copy_status: 0
},
mutations: {
update_doctortests(state, data) {
state.doctortests = data
},
update_lookup_status(state, status) {
state.lookup_status = status
},
update_current_page(state, val) {
state.current_page = val
},
update_selected_doctortest(state, val) {
state.selected_doctortest = val
},
update_total_doctortests(state, val) {
state.total_doctortests = val
},
update_x_search(state, val) {
state.x_search = val
state.current_page = 1
},
update_selected_doctor_id(state, val) {
state.selected_doctor_id = val
},
update_last_id(state, val) {
state.last_id = val
},
update_error_message(state, data) {
state.error_message = data
},
update_save_status(state, val) {
state.save_status = val
},
update_save_error_message(state, val) {
state.save_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_dialog_error(state, data) {
state.dialog_error = data
},
update_get_data_status(state, val) {
state.get_data_status = val
},
update_f_statuss(state, val) {
state.f_statuss = val
},
update_selected_filter_status(state, val) {
state.selected_filter_status = val
},
update_dialog_form(state, val) {
state.dialog_form = val
},
update_loading_save(state, val) {
state.loading_save = val
},
update_doctors(state, val) {
state.doctors = val
},
update_autocomplete_status(state, val) {
state.autocomplete_status = val
},
update_selected_mou_id(state, val) {
state.selected_mou_id = val
},
update_act(state, val) {
state.act = val
},
update_copy_status(state, val) {
state.copy_status = val
}
},
actions: {
async lookuptest(context, prm) {
context.commit("update_lookup_status", 1)
try {
var prm = {
token: one_token(),
doctor_id: context.state.selected_doctor_id,
search: context.state.x_search,
current_page: context.state.current_page,
status: context.state.selected_filter_status.M_StatusID
}
let resp = await api.lookuptest(prm)
if (resp.status != "OK") {
context.commit("update_lookup_status", 3)
context.commit("update_error_message", resp.message)
} else {
context.commit("update_lookup_status", 2)
context.commit("update_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total,
total_filter: resp.data.total_filter
}
context.commit("update_doctortests", resp.data.records)
context.commit("update_total_doctortests", resp.data.total)
if (context.state.last_id == -1) {
if (resp.data && resp.data.records.length > 0) {
context.commit("update_selected_doctortest", resp.data.records[0])
}
}
else {
if (resp.data && resp.data.records.length > 0) {
let idx = _.findIndex(resp.data.records, function (o) { return o.testid == context.state.last_id })
context.commit("update_selected_doctortest", resp.data.records[idx])
}
}
}
} catch (e) {
context.commit("update_lookup_status", 3)
context.commit("update_error_message", e.message)
console.log(e)
}
},
async saveeditstatus(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.saveeditstatus(prm)
if (resp.status != 'OK') {
context.commit("update_save_status", 3)
context.commit("update_save_error_message", resp.message)
context.commit("update_dialog_error", true)
context.commit("update_alert_error", true)
} else {
context.commit("update_save_status", 2)
let data = resp.data
var msg = ''
if (prm.status === 'N') {
msg = "Pemeriksaan " + prm.T_TestName + " batal dipilih"
} else {
msg = "Pemeriksaan " + prm.T_TestName + " berhasil dipilih"
}
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.dispatch("lookuptest")
}
} catch (e) {
context.commit("update_save_status", 3)
context.commit("update_dialog_error", true)
context.commit("update_save_error_message", resp.message)
context.commit("update_alert_error", true)
console.log(e)
}
},
async getstatus(context, prm) {
context.commit("update_get_data_status", 1)
try {
var prm = {
token: one_token()
}
let resp = await api.getstatus(prm)
if (resp.status != "OK") {
context.commit("update_get_data_status", 3)
} else {
context.commit("update_get_data_status", 2)
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_f_statuss", data.records.f_statuss)
context.commit("update_selected_filter_status", data.records.f_statuss[0])
// context.dispatch("lookuptest")
}
} catch (e) {
context.commit("update_get_data_status", 3)
console.log(e)
}
},
// dropdown doctors
async getdoctor(context, prm) {
context.commit("update_autocomplete_status", 1)
try {
var prm = {
token: one_token(),
mouid: context.state.selected_mou_id
}
let resp = await api.getdoctor(prm)
if (resp.status != "OK") {
context.commit("update_autocomplete_status", 3)
} else {
context.commit("update_autocomplete_status", 2)
let data = {
records: resp.data.records
}
context.commit("update_doctors", resp.data.records)
}
} catch (e) {
context.commit("update_autocomplete_status", 3)
}
},
async copyfromdoctor(context, prm) {
context.commit("update_copy_status", 1)
try {
prm.token = one_token()
let resp = await api.copyfromdoctor(prm)
if (resp.status != 'OK') {
context.commit("update_copy_status", 3)
context.commit("update_save_error_message", resp.message)
context.commit("update_dialog_error", true)
context.commit("update_alert_error", true)
} else {
context.commit("update_copy_status", 2)
let data = resp.total
var msg = "Pemeriksaan berhasil di copy dari dokter " + prm.doctor_name
context.commit("update_msg_success", msg)
context.commit("update_alert_success", true)
context.dispatch("lookuptest")
}
} catch (e) {
context.commit("update_copy_status", 3)
context.commit("update_dialog_error", true)
context.commit("update_save_error_message", resp.message)
context.commit("update_alert_error", true)
console.log(e)
}
}
}
}

View File

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