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,25 @@
const URL = "/one-api/mockup/process/refinternal/";
export async function search(token, order_id, query) {
try {
var resp = await axios.post(URL + 'ri_detail/search', {
token: token,
order_id: order_id,
query: query
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,47 @@
const URL = "/one-api/mockup/process/refinternal/";
export async function search(token, datex, page) {
try {
var resp = await axios.post(URL + 'ri_header/search', {
token: token,
sdate: datex,
page: page
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function confirm(token, ref_id) {
try {
var resp = await axios.post(URL + 'ri_header/confirm', {
token: token,
ref_id: ref_id
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}

View File

@@ -0,0 +1,88 @@
const URL = "/one-api/mockup/process/refinternal/";
export async function search_branch(token) {
try {
var resp = await axios.post(URL + 'ri_new/search_branch', {
token: token
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function search_worklist(token) {
try {
var resp = await axios.post(URL + 'ri_new/search_worklist', {
token: token
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function search_patient(token, ids) {
try {
var resp = await axios.post(URL + 'ri_new/search_patient', {
token: token,
ids: ids
});
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function save(token, branchid, ids) {
try {
var resp = await axios.post(URL + 'ri_new/save', {
token: token,
branch_id: branchid,
ids: ids
});
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,82 @@
<template>
<v-menu
v-model="menu2"
:close-on-content-click="false"
:nudge-right="40"
lazy
transition="scale-transition"
offset-y
full-width
max-width="290px"
min-width="290px"
>
<v-text-field
slot="activator"
v-model="computedDateFormatted"
:label=init_label
hint="DD-MM-YYYY format"
persistent-hint
readonly
solo
hide-details
class="ma-1"
></v-text-field>
<v-date-picker v-model="init_date" no-title @input="menu2 = false"></v-date-picker>
</v-menu>
</template>
<script>
module.exports = {
props : ['label', 'date', 'data'],
data () {
return {
init_date: this.date ? this.date : new Date().toISOString().substr(0, 10),
dateFormatted: this.formatDate(new Date().toISOString().substr(0, 10)),
menu1: false,
menu2: false,
init_label: this.label ? this.label : 'Date',
init_data: this.data ? this.data : ''
}
},
computed: {
computedDateFormatted () {
return this.formatDate(this.init_date)
}
},
watch: {
init_date (n, o) {
this.dateFormatted = this.formatDate(this.init_date)
this.$emit('change', {"old_date":o, "new_date":n, "data":this.init_data});
}
},
methods: {
formatDate (date) {
if (!date) return null
const [year, month, day] = date.split('-')
return `${day}-${month}-${year}`
},
parseDate (date) {
if (!date) return null
const [month, day, year] = date.split('/')
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`
},
emitChange (n, o) {
console.log("old:"+o)
console.log("new:"+n)
}
},
mounted () {
this.$store.dispatch('header/search')
}
}
</script>

View File

@@ -0,0 +1,170 @@
<template>
<v-layout class="fill-height" column>
<v-card class="grow">
<!-- <v-subheader>
<h3 class="title">DAFTAR PASIEN</h3>
</v-subheader> -->
<hr style="border-top:0px solid #c8c8c8;" />
<v-data-table
:headers="headers" :items="patients"
:loading="isLoading"
hide-actions class="xelevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-left pa-2 green--text" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
{{props.item.T_OrderRefIntDate}}
</td>
<td class="text-xs-left pa-2 green--text" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
{{props.item.T_OrderRefIntNumber}}
</td>
<td class="text-xs-left pa-2 green--text" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
{{props.item.M_BranchName}}
</td>
<td class="text-xs-left pa-2" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
{{props.item.T_OrderRefIntStatus}}
</td>
<td class="text-xs-left pa-0" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
<v-btn color="success" small title="konfirmasi" class="one-btn-icon"
:disabled="props.item.M_StatusRefCode != 'NEW'"
@click="confirm">
<!-- <v-icon>verified_user</v-icon> -->
<span class="icon-check"></span>
</v-btn>
</td>
</template>
</v-data-table>
<v-pagination
v-model="curr_patient_page"
:length="total_patient_page"
:total-visible="5"
@input="change_page"
></v-pagination>
</v-card>
</v-layout>
</template>
<style scoped>
.searchbox .v-input.v-text-field .v-input__slot{
min-height:60px;
}
.searchbox .v-btn {
min-height:60px;
}
table.v-table tbody td,table.v-table tbody th {
height: 40px;
}
table.v-table thead tr {
height: 40px;
}
.one-btn-icon {
font-size: 1.5em
}
</style>
<script>
module.exports = {
data() {
return {
query: "",
items: [],
headers: [
{
text: "TANGGAL",
align: "left",
sortable: false,
value: "mr",
width: "20%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "NOMOR",
align: "left",
sortable: false,
value: "mr",
width: "20%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "CABANG TUJUAN",
align: "left",
sortable: false,
value: "mr",
width: "35%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "STATUS",
align: "left",
sortable: false,
value: "mr",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "ACTION",
align: "left",
sortable: false,
value: "mr",
width: "10%",
class: "pa-2 blue lighten-3 white--text"
}
],
isLoading: false
}
},
computed : {
patients () {
return this.$store.state.header.headers
},
curr_patient_page () {
return this.$store.state.header.curr_header_page
},
total_patient_page () {
return this.$store.state.header.total_header_page
},
selected_patient : {
get () { return this.$store.state.header.selected_header },
set (v) { this.$store.commit('header/update_selected_header', v) }
}
},
methods : {
change_page () {
return
},
is_selected (x) {
let y = this.selected_patient
if (x.T_OrderRefIntID == y.T_OrderRefIntID)
return 'green lighten-4'
return ''
},
select (x) {
this.selected_patient = x
this.$store.dispatch('detail/search')
},
confirm () {
this.$store.dispatch('header/confirm')
}
},
mounted () {
this.$store.dispatch('header/search')
}
}
</script>

View File

@@ -0,0 +1,307 @@
<template>
<v-dialog
v-model="dialog"
width="1000"
>
<v-btn
slot="activator"
color="primary"
class="ma-1 one-btn-icon"
>
<span class="icon-add"></span>
</v-btn>
<v-card>
<v-card-title
class="headline grey lighten-2 pt-2 pb-2"
primary-title
>
Rujukan Baru
</v-card-title>
<v-card-text class="pt-2 pb-2">
<v-layout row style="height: 60vh">
<v-flex xs4>
<v-layout row wrap>
<v-flex xs12>
<v-text-field
label="Cabang Asal"
:value="default_branch.M_BranchName"
readonly
></v-text-field>
</v-flex>
<v-flex xs12>
<v-select
:items="branches"
item-value="M_BranchID"
item-text="M_BranchName"
return-object
v-model="selected_branch"
label="Cabang Tujuan Rujukan"
></v-select>
</v-flex>
<v-flex xs12>
<v-select
:items="worklists"
item-value="T_WorklistID"
item-text="T_WorklistName"
return-object
v-model="selected_worklist"
label="Worklist"
></v-select>
</v-flex>
<v-flex xs12 class="container_pxs">
<v-layout row wrap v-if="selected_worklist">
<v-flex xs12 v-for="(px, n) in selected_worklist.tests" v-bind:key="px.test_id" pt-1 pr-1>
<v-btn :color="is_selected_px(px) ? 'success':'red'" dark class="ma-0"
small block
@click="select_px(px)">{{px.test_name}}</v-btn>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-flex>
<v-flex xs8 pl-4 style="overflow: auto">
<v-data-table
:headers="headers" :items="patients"
:loading="isLoading"
hide-actions class="xelevation-1"
fixed-header>
<template slot="items" slot-scope="props">
<td class="text-xs-center pa-2 green--text" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
<v-checkbox v-model="selected_patients" :value="props.item.T_OrderDetailID" hide-details :label="props.item.T_OrderDetailID"></v-checkbox>
</td>
<td class="text-xs-center pa-2 green--text" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
{{props.item.T_OrderHeaderDate.substr(0,10)}}
</td>
<td class="text-xs-left pa-2 green--text" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
{{props.item.T_OrderHeaderLabNumber}}
</td>
<td class="text-xs-left pa-2 green--text" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
{{props.item.patient_name}}
</td>
<td class="text-xs-left pa-2" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
{{props.item.T_OrderDetailT_TestName}}
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="primary"
flat
@click="dialog = false"
>
Tutup
</v-btn>
<v-btn
color="primary"
@click="save"
:disabled="!btn_save_enabled"
>
Simpan
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style>
.container_pxs {
height: 300px;
overflow-y: scroll;
}
</style>
<script>
module.exports = {
data () {
return {
headers: [
{
text: "",
align: "left",
sortable: false,
value: "mr",
width: "5%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "TANGGAL",
align: "left",
sortable: false,
value: "mr",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "NO LAB",
align: "left",
sortable: false,
value: "mr",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "NAMA PASIEN",
align: "left",
sortable: false,
value: "mr",
width: "35%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "PEMERIKSAAN",
align: "left",
sortable: false,
value: "mr",
width: "30%",
class: "pa-2 blue lighten-3 white--text"
}
],
sx : []
}
},
computed : {
btn_save_enabled () {
if (!this.selected_branch) return false
if (!this.selected_worklist) return false
if (this.selected_px.length < 1)
return false
if (this.selected_patients.length < 1)
return false
return true
},
dialog : {
get () { return this.$store.state.dialog_new },
set (v) {
this.$store.commit('update_dialog_new', v)
if (v) {
this.selected_patients = []
this.selected_px = []
this.selected_branch = null
this.selected_worklist = null
this.$store.dispatch('newx/search_patient')
}
}
},
branches () {
return this.$store.state.newx.branches
},
selected_branch : {
get () { return this.$store.state.newx.selected_branch },
set (v) { this.$store.commit('newx/update_selected_branch', v) }
},
default_branch () {
return this.$store.state.newx.default_branch
},
worklists () {
return this.$store.state.newx.worklists
},
selected_worklist : {
get () { return this.$store.state.newx.selected_worklist },
set (v) {
this.$store.commit('newx/update_selected_worklist', v)
this.selected_patients = []
this.selected_px = []
}
},
patients () {
return this.$store.state.newx.patients
},
total_patient () {
return this.patients.length
},
selected_patients : {
get () { return this.$store.state.newx.selected_patients },
set (v) { this.$store.commit('newx/update_selected_patients', v) }
},
selected_px : {
get () { return this.$store.state.newx.selected_px },
set (v) { this.$store.commit('newx/update_selected_px', v) }
},
isLoading () {
return false
}
},
methods : {
add_new() {
return
},
new_order() {
this.$store.commit('update_dialog_new', true)
},
select_px(x) {
let y = this.selected_px
let z = y.indexOf(x.test_id)
if (z < 0)
y.push(x.test_id)
else
y.splice(z, 1)
this.selected_px = y
this.$store.dispatch('newx/search_patient')
},
is_selected_px(x) {
let y = this.selected_px
if (y.indexOf(x.test_id) < 0)
return false
return true
},
select(x) {
return
},
is_selected(x) {
return
},
save() {
this.$store.dispatch('newx/save')
}
},
mounted () {
this.$store.dispatch('newx/search_branch')
this.$store.dispatch('newx/search_worklist')
}
}
</script>

View File

@@ -0,0 +1,164 @@
<template>
<v-layout class="fill-height" column>
<v-card class="grow">
<!-- <v-subdetail>
<h3 class="title">DAFTAR PASIEN</h3>
</v-subdetail> -->
<hr style="border-top:0px solid #c8c8c8;" />
<v-data-table
:headers="headers" :items="patients"
:loading="isLoading"
hide-actions class="xelevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-center pa-2 green--text" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
{{props.item.T_OrderHeaderLabNumber}}
</td>
<td class="text-xs-left pa-2 green--text" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
{{props.item.patient_name}}
</td>
<td class="text-xs-left pa-2 green--text" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
{{props.item.T_TestName}}
</td>
<td class="text-xs-left pa-2" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
{{props.item.T_OrderRefIntDetailPromise}}
</td>
<td class="text-xs-left pa-2" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
{{props.item.M_StatusRefName}}
</td>
<td class="text-xs-left pa-2" v-bind:class="is_selected(props.item)"
@click="select(props.item)">
{{props.item.T_OrderRefIntDetailResult}}
</td>
</template>
</v-data-table>
<v-pagination
v-model="curr_patient_page"
:length="total_patient_page"
:total-visible="5"
@input="change_page"
></v-pagination>
</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;
}
</style>
<script>
module.exports = {
data() {
return {
query: "",
items: [],
headers: [
{
text: "NO LAB",
align: "left",
sortable: false,
value: "mr",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "NAMA",
align: "left",
sortable: false,
value: "mr",
width: "20%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "PEMERIKSAAN",
align: "left",
sortable: false,
value: "mr",
width: "20%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "JANJI HASIL",
align: "left",
sortable: false,
value: "mr",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "STATUS",
align: "left",
sortable: false,
value: "mr",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "HASIL",
align: "left",
sortable: false,
value: "mr",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
}
],
isLoading: false
}
},
computed : {
patients () {
return this.$store.state.detail.details
},
curr_patient_page () {
return this.$store.state.detail.curr_detail_page
},
total_patient_page () {
return this.$store.state.detail.total_detail_page
},
selected_patient : {
get () { return this.$store.state.detail.selected_detail },
set (v) { this.$store.commit('detail/update_selected_detail', v) }
}
},
methods : {
change_page () {
return
},
is_selected (x) {
let y = this.selected_patient
if (x.T_OrderRefIntDetailID == y.T_OrderRefIntDetailID)
return true
return false
},
select (x) {
this.selected_patient = x
}
}
}
</script>

View File

@@ -0,0 +1,55 @@
<template>
<v-layout row wrap mb-1>
<v-flex xs12>
<v-card>
<v-card-text class="pa-1">
<v-layout row wrap>
<v-flex xs4>
<one-date-picker
label="Tanggal"
:date="sdate"
data="0"
@change="changeDate"
></one-date-picker>
</v-flex>
<v-flex xs8 class="text-xs-right">
<one-process-ref-internal-new-dialog></one-process-ref-internal-new-dialog>
</v-flex>
</v-layout>
</v-card-text>
</v-card>
</v-flex>
</v-layout>
</template>
<style scoped>
button {
height: 48px;
}
.one-btn-icon {
font-size: 1.5em
}
</style>
<script>
module.exports = {
components : {
'one-process-ref-internal-new-dialog': httpVueLoader('./oneProcessRefInternalNewDialog.vue'),
'one-date-picker': httpVueLoader('./oneDatePicker.vue')
},
computed : {
sdate () {
return this.$store.state.header.sdate
}
},
methods : {
changeDate(x) {
this.$store.commit('header/update_sdate', x.new_date)
this.$store.dispatch('header/search')
}
}
}
</script>

View File

@@ -0,0 +1,63 @@
<template>
<v-layout row wrap mb-1>
<v-flex xs12>
<v-card>
<v-card-text class="pa-2">
<v-layout row wrap>
<v-flex xs4>
<v-text-field
label="Pencarian"
v-model="query"
hide-details
solo
@keyup.native="searchx"
></v-text-field>
</v-flex>
<v-flex xs8 class="text-xs-right">
<v-btn class="btn-search one-btn-icon ma-0" color="success" @click="searchs" >
<span class="icon-search"><span>
</v-btn>
</v-flex>
</v-layout>
</v-card-text>
</v-card>
</v-flex>
</v-layout>
</template>
<style scoped>
button {
height: 48px;
}
.one-btn-icon {
font-size: 1.5em
}
</style>
<script>
module.exports = {
components : {
},
computed : {
query : {
get () { return this.$store.state.detail.query },
set (v) { this.$store.commit('detail/update_query', v) }
}
},
methods : {
searchs() {
this.$store.dispatch('detail/search')
},
searchx(e) {
if (e.which == 13) {
this.searchs()
}
}
}
}
</script>

View File

@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>One</title>
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
<link rel="stylesheet" href="../../../libs/vendor/css/vuetify.min.css">
</head>
<body>
<div v-cloak id="app">
<v-app id="smartApp" >
<one-navbar></one-navbar>
<v-content style="background:#F5E8DF!important" >
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
<v-layout row wrap >
<v-flex xs5 class="left" fill-height pa-1>
<one-process-ref-internal-search-box-list></one-process-ref-internal-search-box-list>
<one-process-ref-internal-list></one-process-ref-internal-list>
</v-flex>
<v-flex xs7 pa-1>
<one-process-ref-internal-search-box-patient-list></one-process-ref-internal-search-box-patient-list>
<one-process-ref-internal-patient-list></one-process-ref-internal-patient-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',
methods: {
tab_selected : function(tab) {
return this.$store.state.tab_selected == tab
}
},
components: {
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
'one-process-ref-internal-list': httpVueLoader('./components/oneProcessRefInternalList.vue'),
'one-process-ref-internal-patient-list': httpVueLoader('./components/oneProcessRefInternalPatientList.vue'),
'one-process-ref-internal-search-box-list': httpVueLoader('./components/oneProcessRefInternalSearchBoxList.vue'),
'one-process-ref-internal-search-box-patient-list': httpVueLoader('./components/oneProcessRefInternalSearchBoxPatientList.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {
}
.right {
}
</style>
</body>
</html>

View File

@@ -0,0 +1,86 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/detail.js"
export default {
namespaced: true,
state: {
search_status: 0,
search_error_message: '',
query: '',
sdate: '',
details: [],
selected_detail: {},
total_detail: 0,
total_detail_page: 0,
curr_detail_page: 1,
snackbar: false
},
mutations: {
update_search_error_message(state, patient) {
state.search_error_message = patient
},
update_search_status(state, v) {
state.search_status = v
},
update_query(state, q) {
state.query = q
},
update_sdate(state, q) {
state.sdate = q
},
update_details(state, d) {
state.details = d.records
state.total_detail = d.total
state.total_detail_page = d.total_page
},
update_selected_detail(state, d) {
state.selected_detail = d
},
update_curr_detail_page(state, d) {
state.curr_detail_page = d
},
update_snackbar(state, d) {
state.snackbar = d
}
},
actions: {
async search(context) {
try {
let order_id = context.rootState.header.selected_header.T_OrderRefIntID
let query = context.state.query
let resp = await api.search(one_token(), order_id, query)
if (resp.status != "OK") {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", resp.message)
} else {
context.commit("update_search_status", 2)
context.commit("update_search_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total,
total_page: resp.data.total_page
}
context.commit("update_details", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
}
}
}

View File

@@ -0,0 +1,109 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/header.js"
export default {
namespaced: true,
state: {
search_status: 0,
search_error_message: '',
query: '',
sdate: new Date().toISOString().substr(0, 10),
headers: [],
selected_header: {},
total_header: 0,
total_header_page: 0,
curr_header_page: 1,
snackbar: false
},
mutations: {
update_search_error_message(state, patient) {
state.search_error_message = patient
},
update_search_status(state, v) {
state.search_status = v
},
update_query(state, q) {
state.query = q
},
update_sdate(state, q) {
state.sdate = q
},
update_headers(state, d) {
state.headers = d.records
state.total_header = d.total
state.total_header_page = d.total_page
},
update_selected_header(state, d) {
state.selected_header = d
},
update_curr_header_page(state, d) {
state.curr_header_page = d
},
update_snackbar(state, d) {
state.snackbar = d
}
},
actions: {
async search(context) {
try {
let resp = await api.search(one_token(), context.state.sdate, context.state.curr_header_page)
if (resp.status != "OK") {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", resp.message)
} else {
context.commit("update_search_status", 2)
context.commit("update_search_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total,
total_page: resp.data.total_page
}
context.commit("update_headers", data)
if (data.records.length > 0)
context.commit('update_selected_header', data.records[0])
else
context.commit('update_selected_header', null)
context.dispatch('detail/search', null, {root:true})
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async confirm(context) {
try {
let resp = await api.confirm(one_token(), context.state.selected_header.T_OrderRefIntID)
if (resp.status != "OK") {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", resp.message)
} else {
context.commit("update_search_status", 2)
context.commit("update_search_error_message", "")
context.dispatch("search")
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
}
}
}

View File

@@ -0,0 +1,181 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/new.js"
export default {
namespaced: true,
state: {
search_status: 0,
search_error_message: '',
query: '',
branches: [],
selected_branch: {},
default_branch: {},
worklists: [],
selected_worklist: {},
selected_px: [],
patients: [],
selected_patients: [],
snackbar: false
},
mutations: {
update_search_error_message(state, patient) {
state.search_error_message = patient
},
update_search_status(state, v) {
state.search_status = v
},
update_query(state, q) {
state.query = q
},
update_branches(state, d) {
state.branches = d.records
},
update_selected_branch(state, d) {
state.selected_branch = d
},
update_default_branch(state, d) {
state.default_branch = d
},
update_worklists(state, d) {
state.worklists = d.records
},
update_selected_worklist(state, d) {
state.selected_worklist = d
},
update_selected_px(state, d) {
state.selected_px = d
},
update_patients(state, d) {
state.patients = d.records
},
update_selected_patients(state, d) {
state.selected_patients = d
},
update_snackbar(state, d) {
state.snackbar = d
}
},
actions: {
async search_branch(context) {
try {
let resp = await api.search_branch(one_token())
if (resp.status != "OK") {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", resp.message)
} else {
context.commit("update_search_status", 2)
context.commit("update_search_error_message", "")
let data = { records: [] }
for (let i in resp.data.records) {
if (resp.data.records[i].default == 0)
data.records.push(resp.data.records[i])
else
context.commit('update_default_branch', resp.data.records[i])
}
context.commit("update_branches", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async search_worklist(context) {
try {
let resp = await api.search_worklist(one_token())
if (resp.status != "OK") {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", resp.message)
} else {
context.commit("update_search_status", 2)
context.commit("update_search_error_message", "")
let data = {
records: resp.data.records
}
context.commit("update_worklists", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async search_patient(context) {
try {
let pxs = context.state.selected_px.join(',')
let resp = await api.search_patient(one_token(), pxs)
if (resp.status != "OK") {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", resp.message)
} else {
context.commit("update_search_status", 2)
context.commit("update_search_error_message", "")
let data = {
records: resp.data.records
}
let x = context.state.selected_patients
context.commit("update_selected_patients", [])
context.commit("update_patients", data)
// console.log(x)
// setTimeout(function() {
// context.commit("update_selected_patients", x)
// }, 2000)
//
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async save(context) {
try {
let ids = context.state.selected_patients.join(',')
let resp = await api.save(one_token(), context.state.selected_branch.M_BranchID,
ids)
if (resp.status != "OK") {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", resp.message)
} else {
context.commit("update_search_status", 2)
context.commit("update_search_error_message", "")
context.commit("update_dialog_new", false, {root:true})
context.dispatch('header/search', null, {root:true})
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
}
}
}

View File

@@ -0,0 +1,35 @@
// State
// data ...
// Mutations
//
//
// Actions
import header from "./modules/header.js";
import detail from "./modules/detail.js";
import newx from "./modules/new.js";
import system from "../../../apps/modules/system/system.js";
export const store = new Vuex.Store({
modules: {
header: header,
detail: detail,
newx: newx,
system: system
},
state: {
dialog_confirm: false,
dialog_new: false
},
mutations: {
update_dialog_confirm(state, v) {
state.dialog_confirm = v
},
update_dialog_new(state, v) {
state.dialog_new = v
}
},
actions: {
}
});