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,138 @@
const URL = "/one-api/mockup/refout/";
export async function search(search, company, page) {
try {
var resp = await axios.post(URL + 'testref/search', {
company_id: company,
search: search,
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 search_company() {
try {
var resp = await axios.post(URL + 'testref/search_company', {});
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_company_all(search) {
try {
var resp = await axios.post(URL + 'testref/search_company_all', {search:search});
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_branch_all() {
try {
var resp = await axios.post(URL + 'testref/search_branch_all', {});
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(datax) {
try {
var resp = await axios.post(URL + 'testref/save', {data:JSON.stringify(datax)});
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 remove(token, testref_id) {
try {
var resp = await axios.post(URL + 'testref/remove', {token:token, testref_id:testref_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
};
}
}
export async function search_sampletype() {
try {
var resp = await axios.post(URL + 'testref/search_sampletype', {});
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,325 @@
<template>
<v-layout class="fill-height" column>
<v-card class="mb-2 pa-2 searchbox">
<v-layout >
<v-flex xs3>
<v-text-field class="ma-1"
label=""
placeholder="Pencarian"
single-line
outline
v-model="query"
hide-details
:height="height"
@keyup.native="searchUp"
></v-text-field>
</v-flex>
<v-btn class="xs3 ma-1 one-btn-icon" color="success" @click="search">
<span class="icon-search"></span>
</v-btn>
</v-layout>
</v-card>
<v-card >
<v-layout row>
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
<v-data-table
:headers="headers"
:items="pxs"
: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.Nat_TestCode }}</td>
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.Nat_TestName }}</td>
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.T_TestRefIsInternal == "Y" ? "CABANG" : (props.item.T_TestRefIsInternal == "N" ? "Lab Eksternal" : "") }}</td>
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.T_TestRefIsInternal == "Y" ? props.item.M_BranchName : props.item.M_CompanyName }}</td>
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.T_SampleTypeName }}</td>
<td class="text-xs-left pa-0" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">
<v-btn v-show="props.item.T_TestRefID != null" color="red" dark class="one-btn-icon ma-0" small @click="del_ref(props.item)"><span class="icon-del"></span></v-btn>
<v-btn v-show="props.item.T_TestRefID != null" color="blue" dark class="one-btn-icon ma-0" small @click="edit_ref(props.item)"><span class="icon-edit"></span></v-btn>
<v-btn v-show="props.item.T_TestRefID == null" color="green" dark class="one-btn-icon ma-0" small @click="new_ref(props.item)"><span class="icon-add"></span></v-btn>
</td>
<!-- <td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.status}}</td> -->
</template>
</v-data-table>
<v-pagination
v-model="curr_px_page"
:length="total_px_page"
:total-visible="5"
@input="change_page"
></v-pagination>
</v-flex>
</v-layout>
</v-card>
<one-dialog-confirm
@confirm="del_ref_confirm"
:data="selected_px.T_TestRefID"
v-if="dialog_confirm"></one-dialog-confirm>
</v-layout>
</template>
<style scoped>
/* .searchbox .v-input.v-text-field .v-input__slot{
min-height:50px;
} */
/* .v-autocomplete.v-text-field--enclosed:not(.v-text-field--solo):not(.v-text-field--single-line) .v-select__slot>input {
margin-top: 14px;
} */
.searchbox .v-btn {
min-height:50px;
}
table.v-table tbody td,table.v-table tbody th {
height: 40px;
}
table.v-table thead tr {
height: 40px;
}
.searchbox .one-btn-icon {
font-size: 1.5em
}
/* Overwrite */
.v-text-field--box>.v-input__control>.v-input__slot,
.v-text-field--full-width>.v-input__control>.v-input__slot,
.v-text-field--outline>.v-input__control>.v-input__slot {
align-items: stretch;
min-height: 50px
}
.v-text-field--box .v-label, .v-text-field--full-width .v-label, .v-text-field--outline .v-label {
top: 12px;
}
.v-text-field.v-text-field--enclosed .v-input__append-inner {
margin-top: 10px;
}
.v-text-field--outline.v-text-field--single-line input {
margin-top: 6px;
}
.v-select.v-text-field--enclosed:not(.v-text-field--single-line) .v-select__selections {
padding-top: 16px;
}
</style>
<script>
module.exports = {
components : {
'one-dialog-confirm': httpVueLoader('../../common/oneDialogConfirm.vue')
},
mounted() {
this.$store.dispatch('testref/search')
},
methods : {
isSelected(p) {
let x = this.$store.state.testref.selected_px
if (!x)
return false
if (x.Nat_TestID == p.Nat_TestID)
return true
return false
},
search() {
this.$store.dispatch("testref/search")
},
searchUp(e) {
if (e.which == 13) {
this.search()
}
},
selectMe(doc) {
this.$store.commit('testref/update_selected_px', doc)
},
// thr_search: _.debounce( function () {
// this.$store.dispatch("packet/search_company")
// }, 700),
edit_ref(x) {
this.selectMe(x)
this.$store.commit('testrefnew/update_edit', true)
this.$store.commit('testrefnew/update_dialog_new', true)
},
one_money (x) {
return window.one_money(x)
},
del_ref(x) {
this.selectMe(x)
this.$store.commit('update_dialog_confirm', true)
},
del_ref_confirm(x) {
this.$store.dispatch('testref/remove')
},
new_ref(x) {
this.selectMe(x)
this.$store.commit('testrefnew/update_edit', false)
this.$store.commit('testrefnew/update_dialog_new', true)
},
change_page(x) {
this.curr_px_page = x
this.$store.dispatch('testref/search')
}
},
computed: {
query_company : {
get () {
return this.$store.state.packet.query_company
},
set (v) {
this.$store.commit('packet/update_query_company', v)
}
},
query : {
get () {
return this.$store.state.testref.query
},
set (v) {
this.$store.commit('testref/update_query', v)
}
},
pxs : {
get () {
return this.$store.state.testref.pxs
},
set (v) {
this.$store.commit('testref/update_pxs', v)
}
},
selected_px() {
return this.$store.state.testref.selected_px
},
isLoading () {
return false
},
is_loading () {
return false
},
dialog_confirm () {
return this.$store.state.dialog_confirm
},
total_px_page () {
return this.$store.state.testref.total_px_page
},
curr_px_page : {
get () { return this.$store.state.testref.curr_px_page },
set (v) { this.$store.commit('testref/update_curr_px_page', v) }
}
},
data() {
return {
headers: [
{
text: "KODE PEMERIKSAAN",
align: "left",
sortable: false,
value: "mr",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "NAMA PEMERIKSAAN",
align: "left",
sortable: false,
value: "lab",
width: "30%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "TUJUAN RUJUKAN",
align: "left",
sortable: false,
value: "lab",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "CABANG / PERUSAHAAN",
align: "left",
sortable: false,
value: "lab",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "SPECIMEN",
align: "left",
sortable: false,
value: "lab",
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "ACTION",
align: "left",
sortable: false,
value: "name",
width: "10%",
class: "pa-2 blue lighten-3 white--text"
}
],
pagination:{
descending: false,
page: 1,
rowsPerPage: 5,
sortBy: 'Nat_TestName',
totalItems: this.$store.state.testref.total_px
},
height: 50
};
},
watch : {
// query_company(val, old) {
// if (val == null || typeof val == 'undefined') val = ""
// // console.log("1-val:"+val)
// if (val == old ) return
// // console.log("2-val:"+val)
// // if (! val) return
// // console.log("3-val:"+val)
// // if (val.length < 1 ) return
// // console.log("4-val:"+val)
// if (this.$store.state.packet.search_status == 1 ) return
// // console.log("5-val:"+val)
// this.$store.commit("packet/update_query_company", val)
// this.thr_search()
// }
}
}
</script>

View File

@@ -0,0 +1,231 @@
<template>
<v-dialog
v-model="dialog"
max-width="500px"
>
<v-card>
<v-card-text>
<v-layout row wrap>
<v-flex xs12>
<v-text-field
label="Pemeriksaan"
readonly
v-model="px_name"
></v-text-field>
</v-flex>
<v-flex xs12>
<v-select
:items="types"
item-value="val"
item-text="label"
v-model="selected_type"
label="Tipe Rujukan"
></v-select>
</v-flex>
<v-flex xs12 pb-4 v-show="selected_type == 'N'">
<v-autocomplete
label="Perusahaan"
v-model="selected_company"
:items="companies"
:search-input.sync="query_company"
auto-select-first
no-filter
return-object
clearable
item-text="M_CompanyName"
:loading="is_loading"
no-data-text="Pilih Perusahaan"
hide-details
>
<template
slot="item"
slot-scope="{ item }"
>
<v-list-tile-content>
<v-list-tile-title v-text="item.M_CompanyName"></v-list-tile-title>
</v-list-tile-content>
</template>
</v-autocomplete>
</v-flex>
<v-flex xs12 v-show="selected_type == 'Y'">
<v-select
:items="branches"
v-model="selected_branch"
return-object
item-text="M_BranchName"
item-value="M_BranchID"
label="Cabang"
></v-select>
</v-flex>
<v-flex xs12>
<v-select
:items="sample_types"
v-model="selected_sample_type"
return-object
item-text="T_SampleTypeName"
item-value="T_SampleTypeID"
label="Specimen"
></v-select>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-btn color="red" flat dark @click="dialog = false">Tutup</v-btn>
<v-spacer></v-spacer>
<v-btn color="primary" @click="save">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
data () {
return {
types : [
{val:"Y", label:"Rujuk Internal"},
{val:"N", label:"Rujuk Eksternal"}
]
}
},
computed : {
dialog : {
get () {
return this.$store.state.testrefnew.dialog_new
},
set (v) {
this.$store.commit('testrefnew/update_dialog_new', v)
}
},
companies () {
return this.$store.state.testrefnew.companies
},
selected_company : {
get () { return this.$store.state.testrefnew.selected_company },
set (v) { this.$store.commit('testrefnew/update_selected_company', v) }
},
query_company : {
get () {
return this.$store.state.testrefnew.query_company
},
set (v) {
this.$store.commit('testrefnew/update_query_company', v)
}
},
branches () {
return this.$store.state.testrefnew.branches
},
selected_branch : {
get () { return this.$store.state.testrefnew.selected_branch },
set (v) { this.$store.commit('testrefnew/update_selected_branch', v) }
},
sample_types () {
return this.$store.state.testrefnew.sample_types
},
selected_sample_type : {
get () { return this.$store.state.testrefnew.selected_sample_type },
set (v) { this.$store.commit('testrefnew/update_selected_sample_type', v) }
},
px_name() {
return this.$store.state.testref.selected_px.Nat_TestName
},
selected_type : {
get () { return this.$store.state.testrefnew.is_internal },
set (v) { this.$store.commit('testrefnew/update_is_internal', v) }
},
is_loading () { return false }
},
methods : {
save() {
this.$store.dispatch('testrefnew/save')
},
thr_search: _.debounce( function () {
this.$store.dispatch("testrefnew/search_company")
}, 200),
},
mounted () {
this.$store.dispatch('testrefnew/search_company')
this.$store.dispatch('testrefnew/search_branch')
this.$store.dispatch('testrefnew/search_sampletype')
},
watch : {
query_company(val, old) {
if (val == null || typeof val == 'undefined') val = ""
// console.log("1-val:"+val)
if (val == old ) return
// console.log("2-val:"+val)
// if (! val) return
// console.log("3-val:"+val)
// if (val.length < 1 ) return
// console.log("4-val:"+val)
if (this.$store.state.testrefnew.search_status == 1 ) return
// console.log("5-val:"+val)
this.$store.commit("testrefnew/update_query_company", val)
this.thr_search()
},
dialog(val, old) {
if (val && !old) {
let edit = this.$store.state.testrefnew.edit
if (edit) {
let ref = this.$store.state.testref.selected_px
console.log(ref)
if (ref.T_TestRefID != null) {
this.selected_type = ref.T_TestRefIsInternal
// SAMPLE TYPE
this.selected_sample_type = {
T_SampleTypeID: ref.T_SampleTypeID,
T_SampleTypeName: ref.T_SampleTypeName
}
if (ref.T_TestRefIsInternal == "Y") {
// BRANCH
this.selected_branch = {
M_BranchID: ref.M_BranchID,
M_BranchName: ref.M_BranchName
}
} else {
// COMPANY
this.query_company = ref.M_CompanyName
this.selected_company = {
M_CompanyID: ref.M_CompanyID,
M_CompanyName: ref.M_CompanyName
}
}
}
} else {
this.selected_branch = {}
this.selected_company = {}
}
}
}
}
}
</script>

View File

@@ -0,0 +1,78 @@
<!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 xs12 class="left" fill-height pa-1>
<one-md-test-ref-list></one-md-test-ref-list>
<one-md-test-ref-new></one-md-test-ref-new>
</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-md-test-ref-list': httpVueLoader('./components/oneMdTestRefList.vue'),
'one-md-test-ref-new': httpVueLoader('./components/oneMdTestRefNew.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {
}
.right {
}
</style>
</body>
</html>

View File

@@ -0,0 +1,133 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/testref.js"
export default {
namespaced: true,
state: {
search_status: 0,
search_error_message: '',
query: '',
pxs: [],
selected_px: {},
total_px: 0,
total_px_page: 0,
curr_px_page: 1,
// cOMPANY
companies: [],
selected_company: {},
dialog_new: 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_pxs(state, d) {
state.pxs = d.records
state.total_px = d.total
state.total_px_page = d.total_page
},
update_selected_px(state, d) {
state.selected_px = d
},
update_companies(state, d) {
state.companies = d.records
},
update_selected_company(state, d) {
state.selected_company = d
},
update_dialog_new(state, d) {
state.dialog_new = d
},
update_curr_px_page(state, d) {
state.curr_px_page = d
}
},
actions: {
async search(context) {
try {
let resp = await api.search(context.state.query, context.state.selected_company.M_CompanyID, context.state.curr_px_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_pxs", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async search_company(context) {
try {
let resp = await api.search_company()
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_companies", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async remove(context) {
try {
let resp = await api.remove(one_token(), context.state.selected_px.T_TestRefID)
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,185 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/testref.js"
export default {
namespaced: true,
state: {
search_status: 0,
search_error_message: '',
// cOMPANY
companies: [],
selected_company: {},
query_company: '',
// BRANCH
branches: [],
selected_branch: {},
// SAMPLE TYPE
sample_types: [],
selected_sample_type: {},
// DATA
is_internal: "N",
dialog_new: false,
edit: false
},
mutations: {
update_search_error_message(state, patient) {
state.search_error_message = patient
},
update_search_status(state, v) {
state.search_status = v
},
update_companies(state, d) {
state.companies = d.records
},
update_selected_company(state, d) {
state.selected_company = d
},
update_query_company(state, v) {
state.query_company = v
},
update_branches(state, d) {
state.branches = d.records
},
update_selected_branch(state, d) {
state.selected_branch = d
},
update_dialog_new(state, d) {
state.dialog_new = d
},
update_is_internal(state, d) {
state.is_internal = d
},
update_edit(state, d) {
state.edit = d
},
update_sample_types(state, d) {
state.sample_types = d.records
},
update_selected_sample_type(state, d) {
state.selected_sample_type = d
}
},
actions: {
async search_company(context) {
try {
let resp = await api.search_company_all(context.state.query_company)
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_companies", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async search_branch(context) {
try {
let resp = await api.search_branch_all()
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_branches", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async save(context) {
try {
let data = {
is_internal:context.state.is_internal,
nattest_id:context.rootState.testref.selected_px.Nat_TestID,
sampletype_id:context.state.selected_sample_type.T_SampleTypeID
}
if (data.is_internal == 'Y')
data.branch_id = context.state.selected_branch.M_BranchID
else
data.company_id = context.state.selected_company.M_CompanyID
// IF EDIT
if (context.state.edit) {
data.testref_id = context.rootState.testref.selected_px.T_TestRefID
}
let resp = await api.save(data)
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)
context.dispatch('testref/search', null, {root:true})
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
},
async search_sampletype(context) {
try {
let resp = await api.search_sampletype()
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_sample_types", data)
}
} catch (e) {
context.commit("update_search_status", 3)
context.commit("update_search_error_message", e.message)
}
}
}
}

View File

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