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,320 @@
const URL = "/one-api/mockup/mcuoffline/";
export async function search_staff(prm) {
try {
var resp = await axios.post(URL + 'screening/search_staff',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_barcode(prm) {
try {
var resp = await axios.post(URL + 'screening/search_barcode',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 + 'screening/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 getinitialdatas(prm) {
try {
var resp = await axios.post(URL + 'screening/getinitialdatas',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 dosampled(prm) {
try {
var resp = await axios.post(URL + 'screening/dosampled',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 scanbarcode(prm) {
try {
var resp = await axios.post(URL + 'screening/scanbarcode',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 getrackcontent(prm) {
try {
var resp = await axios.post(URL + 'screening/getrackcontent',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 save(prm) {
try {
var resp = await axios.post(URL + 'screening/save',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 deletetrx(prm) {
try {
var resp = await axios.post(URL + 'screening/deletetrx',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 checkbarcode(prm) {
try {
var resp = await axios.post(URL + 'screening/checkbarcode',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 lookupsamples(prm) {
try {
var resp = await axios.post(URL + 'screening/lookupsamples',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 lookupnonsamples(prm) {
try {
var resp = await axios.post(URL + 'screening/lookupnonsamples',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 savenewvendor(prm) {
try {
var resp = await axios.post(URL + 'screening/savenewvendor',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 searchstaff(token,prm) {
try {
var resp = await axios.post(URL + 'screening/searchstaff',{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 savenewitem(prm) {
try {
var resp = await axios.post(URL + 'screening/savenewitem',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 screening(prm) {
try {
var resp = await axios.post(URL + 'screening/screening',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
};
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,579 @@
<template>
<v-layout class="fill-height" column>
<v-dialog v-model="dialogsuccess" persistent max-width="290">
<v-card>
<v-card-title color="success" class="headline">Berhasil !</v-card-title>
<v-card-text>
{{msgsuccess}}
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="green darken-1" flat @click="closeDialogSuccess">OK</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="dialogauthorize" persistent max-width="450">
<v-card class="align-center justify-center">
<v-card-title primary-title dark color="warning" class="warning white--text">PERHATIAN !</v-card-title>
<v-card-text>
<p>Maaf ... yang bisa diupload hanya yang sudah disampling</p>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red darken-1" flat @click="dialogauthorize = false">Tutup</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-card class="mb-1 pa-1">
<v-layout row>
<v-flex xs7>
<v-layout>
<v-text-field class="flex xs4 ma-1"
label="Cari ..."
outline
hide-details
v-model="search"
></v-text-field>
<span @click="searchs" class="icon-medium-fill-base xs1 white--text success iconsearch-search"></span>
</v-layout>
</v-flex>
<v-flex xs5 class="text-xs-right">
<v-btn @click="printRekap()" dark color="grey">PRINT</v-btn>
<v-btn @click="downloaddataimage()" dark color="red">DOWNLOAD FOTO</v-btn>
<!-- <v-btn @click="downloaddata()" color="info">DOWNLOAD</v-btn> -->
<v-btn @click="downloaddata_v2()" color="info">DOWNLOAD V2</v-btn>
</v-flex>
</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="xtransactions"
:loading="isLoading"
hide-actions
class="elevation-1">
<template slot="items" slot-scope="props">
<td class="text-xs-center pa-2" >{{ props.item.labnumber}}</td>
<td class="text-xs-left pa-2" >{{ props.item.patient_fullname}}</td>
<td class="text-xs-left pa-2" >
<v-flex xs12>
<v-layout wrap>
<v-flex ma-1 v-for="sample in props.item.sampletypes" xs3>
<v-card style="cursor:pointer" @click="screening(sample)" dark :color="getcolor(sample.status)" class="pa-1">
<p class="mb-0">{{sample.samplename}}</p>
<p class="mb-0">{{sample.barcode}}</p>
</v-card>
</v-flex>
</v-layout>
</v-flex>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-card>
<v-snackbar
v-model="snackbar.value"
:timeout="snackbar.timeout"
>
{{ snackbar.text }}
<v-btn
color="blue"
text
@click="snackbar = false"
>
Tutup
</v-btn>
</v-snackbar>
<one-dialog-alert :status="openalertconfirmation" :msg="msgalertconfirmation" @forget-dialog-alert="forgetAlertConfirmation()" @close-dialog-alert="closeAlertConfirmation()"></one-dialog-alert>
<one-dialog-info :status="opendialoginfo" :msg="msginfo" @close-dialog-info="closeDialogInfo()"></one-dialog-info>
<one-dialog-print :title="printtitle" :width="printwidth" :height="700" :status="openprintout" :urlprint="urlprintnote" @close-dialog-print="openprintout = false"></one-dialog-print>
</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;
}
.iceland-number{
font-family: 'Iceland', cursive;
font-size:20px;
font-weight:400;
margin-left:3px;
margin-right:3px;
}
</style>
<script>
module.exports = {
components : {
'one-dialog-info':httpVueLoader('../../common/oneDialogInfo.vue'),
'one-dialog-alert':httpVueLoader('../../common/oneDialogAlert.vue'),
'one-dialog-print':httpVueLoader('../../common/oneDialogPrintX.vue')
},
mounted() {
var prm = {}
prm.search = this.search
prm.current_page = 1
this.$store.dispatch("samplestorage/search",{
search:this.search,
current_page:1,
mouid:this.xselectedfilterstatus.id,
lastid:-1
})
},
methods : {
downloaddataimage(){
location.replace("/one-api/tools/icopy/getimage")
},
downloaddata(){
location.replace("/one-api/tools/ucopy/db")
},
downloaddata_v2(){
location.replace("/one-api/tools/ucopy_v2/db")
},
screening(value){
if(value.status === 'Y'){
var prm = value
prm.search = this.search,
prm.current_page = 1
prm.mouid = this.xselectedfilterstatus.id,
prm.lastid = -1
this.$store.dispatch("samplestorage/screening",prm)
}
else{
if(value.status === 'X')
this.dialogauthorize = true
}
},
getcolor(status){
var rt = 'black'
if(status === 'Y'){
rt = 'teal'
}
if(status === 'V'){
rt = 'info'
}
return rt
},
searchs(){
this.curr_page = 1
this.$store.dispatch("samplestorage/search",{
search:this.search,
current_page:1,
mouid:this.xselectedfilterstatus.id,
lastid:-1
})
},
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')}`
},
isSelected(p) {
return p.uniqid == this.$store.state.samplestorage.selected_transaction.uniqid
},
searchTransaction() {
this.$store.dispatch("samplestorage/search",{
startdate:this.xdatestart,
enddate: this.xdateend,
lastid:-1
})
},
selectMe(trx) {
if(this.$store.state.samplestorage.no_save == 0 ){
console.log(trx)
this.$store.commit("samplestorage/update_selected_transaction",trx)
this.$store.commit("samplestorage/update_act",'edit')
this.$store.commit("form/update_transaction_number",trx.trx_number)
this.$store.commit("form/update_transaction_date",trx.xdate)
this.$store.commit("form/update_transaction_time",trx.xtime)
this.$store.commit("form/update_sample_weight",trx.trx_sampleweight)
this.$store.commit("form/update_staffs",[{M_StaffID:trx.trx_staffid,M_StaffName:trx.trx_staffname}])
this.$store.commit("form/update_selected_staff",{M_StaffID:trx.trx_staffid,M_StaffName:trx.trx_staffname})
this.$store.commit("form/update_transaction_note",trx.trx_note)
this.$store.commit("form/update_detailnonsamples",trx.detailnonsamples)
this.$store.commit("form/update_details",trx.details)
}else{
this.$store.commit("samplestorage/update_open_alert_confirmation",true)
}
},
closeAlertConfirmation(){
this.$store.commit("samplestorage/update_open_alert_confirmation",false)
},
forgetAlertConfirmation(){
this.$store.commit("samplestorage/update_no_save",0)
this.$store.commit("samplestorage/update_open_alert_confirmation",false)
},
updateAlert_success(val){
this.$store.commit("samplestorage/update_alert_success",val)
},
closeDialogSuccess(){
let arrtrx = this.$store.state.samplestorage.transactions
var idx = _.findIndex(arrtrx, item => item.T_SampleStorageID === this.$store.state.samplestorage.last_id)
console.log(idx)
this.$store.dispatch("samplestorage/search",{
startdate:this.xdatestart,
enddate: this.xdateend,
lastid: idx
})
this.$store.commit("samplestorage/update_dialog_success",false)
},
closeDialogInfo(){
this.$store.commit("samplestorage/update_open_dialog_info",false)
},
printOut(val){
this.printwidth = 800
this.printtitle = ""
let idx = val.id
let user = one_user()
this.urlprintnote = "/birt/run?__report=report/one/lab/rpt_s_001.rptdesign&__format=pdf&username="+user.M_UserUsername+"&PID="+idx
this.openprintout = true
},
printRekap(){
this.printwidth = 800
this.printtitle = ""
let idx = this.$store.state.samplestorage.transactions[0].prepare_id
let user = one_user()
//this.urlprintnote = "/birt/run?__report=report/one/lab/rpt_s_001.rptdesign&__format=pdf&username="+user.M_UserUsername+"&PID="+idx
this.urlprintnote = "/birt/run?__report=report/one/rekap/rpt_mcu_screening.rptdesign&__format=pdf&PID="+idx+"&username="+user.M_UserUsername+"&tm="+Date.now()
this.openprintout = true
},
btngroups(xgroups){
var btn = "";
for (var x = 0; x < xgroups.length; x++) {
btn += '<v-btn color="error" dark>'+xgroups[x].xgroup+'</v-btn>'
}
return btn
},
Authorization(row,btn){
this.now_row = row
this.now_btn = btn
if(btn.status_fo === 'Y'){
this.type_nonlab = btn.xgroup
if(btn.xgroup === ''){
this.type_nonlab = 'LAB'
}
this.$store.commit("samplestorage/update_selected_staff",{})
this.dialogauthorize = true
}
},
doAuthorization(){
var row = this.now_row
var btn = this.now_btn
var prm = {
groupid:row.group_id,
type:btn.xgroup,
orderid:row.orderid,
promiseid:row.promiseid,
filter_status:this.xselectedfilterstatus.value,
nolab:this.nolab,
name:this.search,
lastid:-1
}
this.$store.dispatch("samplestorage/doauthorization",prm)
},
xbtnclass(btn){
//console.log(btn)
if(parseInt(btn.print_count) === 0){
if(btn.received === 'Y'){
return 'teal'
}
else
return 'gray'
}
else if(parseInt(btn.print_count) > 0 && btn.status === 'N'){
return 'error'
}
else if(parseInt(btn.print_count) > 0 && btn.status === 'P'){
if(btn.status_fo === 'Y')
return 'primary'
else
return 'warning'
}
else{
if(btn.status_fo === 'Y')
return 'primary'
else{
if(btn.status_received = 'Y'){
return 'teal'
}
else{
return 'success'
}
}
}
},
changeEmail(value){
let arr = this.$store.state.samplestorage.transactions
var idx = _.findIndex(arr, item => item.uniqid === value.uniqid)
arr[idx].email_address = value.email_address
this.$store.commit("samplestorage/update_transactions",arr)
},
getColorChip(value){
if(value.status === 'N' && value.flag_ex === 'N')
return 'error'
else if(value.status === 'Y' && value.flag_ex === 'N')
return 'teal'
else
return 'brown'
},
doSampled(value){
value.search = this.search
value.mouid = this.xselectedfilterstatus.id
value.current_page = this.curr_page
value.lastid = -1
this.$store.dispatch("samplestorage/dosampled",value)
},
scanbarcode(){
console.log(this.barcode)
var prm = {}
prm.barcode = this.barcode
prm.search = this.search
prm.mouid = this.xselectedfilterstatus.id
prm.current_page = this.curr_page
prm.lastid = -1
this.$store.dispatch("samplestorage/scanbarcode",prm)
}
},
computed: {
search: {
get() {
return this.$store.state.samplestorage.search
},
set(val) {
this.$store.commit("samplestorage/update_search",val)
}
},
snackbar: {
get() {
return this.$store.state.samplestorage.snackbar
},
set(val) {
this.$store.commit("samplestorage/update_snackbar",val)
}
},
change_page(x) {
this.curr_patient_page = x
},
openprintout: {
get() {
return this.$store.state.samplestorage.open_print_out
},
set(val) {
this.$store.commit("samplestorage/update_open_print_out",val)
}
},
dialogsuccess: {
get() {
return this.$store.state.samplestorage.dialog_success
},
set(val) {
this.$store.commit("samplestorage/update_dialog_success",val)
}
},
msgsuccess(){
return this.$store.state.samplestorage.msg_success
},
totalinfo(){
return this.$store.state.samplestorage.info
},
isLoading() {
return this.$store.state.samplestorage.search_status == 1
},
xdatestart : {
get() {
return this.$store.state.samplestorage.start_date
},
set(val) {
this.$store.commit("samplestorage/update_start_date",val)
}
},
xdateend : {
get() {
return this.$store.state.samplestorage.end_date
},
set(val) {
this.$store.commit("samplestorage/update_end_date",val)
}
},
filterComputedDateFormattedStart () {
return this.formatDate(this.xdatestart)
},
filterComputedDateFormattedEnd () {
return this.formatDate(this.xdateend)
},
xfilterworks() {
return this.$store.state.samplestorage.filter_work
},
xselectedfilterwork: {
get() {
return this.$store.state.samplestorage.selected_filter_work
},
set(val) {
this.$store.commit("samplestorage/update_selected_filter_work",val)
}
},
xfilterstatuses() {
return this.$store.state.samplestorage.mous
},
xselectedfilterstatus: {
get() {
return this.$store.state.samplestorage.selected_mou
},
set(val) {
this.$store.commit("samplestorage/update_selected_mou",val)
}
},
xtransactions() {
console.log(this.$store.state.samplestorage.transactions)
return this.$store.state.samplestorage.transactions
},
openalertconfirmation: {
get() {
return this.$store.state.samplestorage.open_alert_confirmation
},
set(val) {
this.$store.commit("samplestorage/update_open_alert_confirmation",val)
}
},
opendialoginfo: {
get() {
return this.$store.state.samplestorage.open_dialog_info
},
set(val) {
this.$store.commit("samplestorage/update_open_dialog_info",val)
}
},
msginfo(){
return this.$store.state.samplestorage.msg_info
},
curr_page: {
get() {
return this.$store.state.samplestorage.current_page
},
set(val) {
this.$store.commit("samplestorage/update_current_page",val)
this.$store.dispatch("samplestorage/search",{
search:this.search,
current_page:val,
mouid:this.xselectedfilterstatus.id,
lastid:-1
})
}
},
xtotal_page: {
get() {
return this.$store.state.samplestorage.total_page
},
set(val) {
this.$store.commit("samplestorage/update_total_page",val)
}
},
dialogauthorize: {
get() {
return this.$store.state.samplestorage.dialog_authorize
},
set(val) {
this.$store.commit("samplestorage/update_dialog_authorize",val)
}
},
xstaffs() {
return this.$store.state.samplestorage.staffs
},
xselectedstaff: {
get() {
return this.$store.state.samplestorage.selected_staff
},
set(val) {
this.$store.commit("samplestorage/update_selected_staff",val)
}
},
barcode: {
get() {
return this.$store.state.samplestorage.barcode
},
set(val) {
this.$store.commit("samplestorage/update_barcode",val)
}
},
},
data() {
return {
msgalertconfirmation:"Perubahan yang telah dilakukan belum disimpan dong !",
menufilterdatestart:false,
menufilterdateend:false,
urlprintnote:'',
printtitle:'',
printwidth:600,
date: new Date().toISOString().substr(0, 10),
items: [],
type_nonlab:'',
name: '',
page:1,
requirestaff:false,
now_row:{},
now_btn:{},
headers: [
{
text: "NOMOR LAB",
align: "CENTER",
sortable: false,
width: "10%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "PASIEN",
align: "CENTER",
sortable: false,
width: "15%",
class: "pa-2 blue lighten-3 white--text"
},
{
text: "SPESIMEN",
align: "CENTER",
sortable: false,
width: "75%",
class: "pa-2 blue lighten-3 white--text"
}
]
};
}
}
</script>

View File

@@ -0,0 +1,113 @@
<!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 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-sample-storage-list></one-sample-storage-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">
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',
mounted(){
// /alert("alo")
document.addEventListener('keypress',logKeyboard)
window.key_enter = ''
async function logKeyboard(e) {
window.key_enter = (window.key_enter + e.key).toUpperCase()
if(e.key == 'Enter') {
if(window.key_enter.includes('STF')){
var prm = {search:window.key_enter.replace('ENTER','').trim()}
await store.dispatch("samplestorage/search_staff",prm)
}else{
console.log(window.key_enter)
var prm = {search:window.key_enter.replace('ENTER','').trim()}
store.dispatch("samplestorage/search_barcode",prm)
}
window.key_enter = ''
}
}
},
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-sample-storage-list': httpVueLoader('./components/oneSampleStorageList.vue'),
'one-sample-storage-form': httpVueLoader('./components/oneSampleStorageForm.vue'),
'one-sample-storage-rack': httpVueLoader('./components/oneSampleStorageRack.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {
}
.right {
}
</style>
</body>
</html>

View File

@@ -0,0 +1,375 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/samplestorage.js"
export default {
namespaced: true,
state: {
save_status: 0,
transaction_number:'',
transaction_date:moment(new Date()).format('DD-MM-YYYY'),
transaction_time:moment(new Date()).format("hh:mm"),
transaction_note:'',
picname:'',
details:[],
detailnonsamples:[],
samples:[],
nonsamples:[],
selected_detail:{},
selected_detail_nonsample:{},
almaries:[],
racks:[],
staffs:[],
selected_almari:{},
selected_rack:{},
selected_staff:{},
get_data_status:0,
open_almari:false,
open_rack:false,
rack_contents:[],
dialog_search_sample:false,
dialog_search_nonsample:false,
lookup_sample_status:0,
errors:[],
dialog_add_vendor:false,
success_add_vendor:false,
autocomplete_status:0,
porter:'',
success_add_item:false,
sample_weight:0
},
mutations: {
update_autocomplete_status(state, val) {
state.autocomplete_status = val
},
update_save_status(state, val) {
state.save_status = val
},
update_transaction_number(state, val) {
state.transaction_number = val
},
update_transaction_date(state, val) {
state.transaction_date = val
},
update_transaction_time(state, val) {
state.transaction_time = val
},
update_transaction_note(state, val) {
state.transaction_note = val
},
update_picname(state, val) {
state.picname = val
},
update_details(state, val) {
state.details = val
},
update_detailnonsamples(state, val) {
state.detailnonsamples = val
},
update_samples(state, val) {
state.samples = val
},
update_nonsamples(state, val) {
state.nonsamples = val
},
update_selected_detail(state, val) {
state.selected_detail = val
console.log(val)
},
update_selected_detail_nonsample(state, val) {
state.selected_detail_nonsample = val
console.log(val)
},
update_almaries(state, val) {
state.almaries = val
},
update_racks(state, val) {
state.racks = val
},
update_staffs(state, val) {
state.staffs = val
},
update_selected_staff(state, val) {
state.selected_staff = val
},
update_selected_almari(state, val) {
state.selected_almari = val
},
update_selected_rack(state, val) {
state.selected_rack = val
},
update_get_data_status(state, val) {
state.get_data_status = val
},
update_open_almari(state, val) {
state.open_almari = val
},
update_open_rack(state, val) {
state.open_rack = val
},
update_rack_contents(state, val) {
state.rack_contents = val
},
update_dialog_search_sample(state, val) {
state.dialog_search_sample = val
},
update_dialog_search_nonsample(state, val) {
state.dialog_search_nonsample = val
},
update_lookup_sample_status(state, val) {
state.lookup_sample_status = val
},
update_errors(state, val) {
state.errors = val
},
update_dialog_add_vendor(state, val) {
state.dialog_add_vendor = val
},
update_success_add_vendor(state, val) {
state.success_add_vendor = val
},
update_success_add_item(state, val) {
state.success_add_item = val
},
update_porter(state, val) {
state.porter= val
},
update_sample_weight(state, val) {
state.sample_weight = val
},
},
actions: {
async getalmaries(context) {
context.commit("update_get_data_status",1)
try {
let resp= await api.getalmaries(one_token())
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_almaries",data.records['almaries'])
}
} catch(e) {
context.commit("update_get_data_status",3)
}
},
async getrackcontent(context,prm) {
context.commit("update_get_data_status",1)
try {
prm.token = one_token()
let resp= await api.getrackcontent(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_rack_contents",data.records)
}
} catch(e) {
context.commit("update_get_data_status",3)
}
},
async save(context,prm) {
context.commit("update_save_status",1)
try {
prm.token = one_token()
let resp= await api.save(prm)
if (resp.status != "OK") {
context.commit("update_save_status",3)
} else {
context.commit("update_save_status",2)
context.commit("update_transaction_date",moment(new Date()).format('DD-MM-YYYY'))
context.commit("update_transaction_time",moment(new Date()).format("hh:mm"))
context.commit("update_selected_vendor",{})
context.commit("update_picname","")
context.commit("update_transaction_note","")
context.commit("update_selected_almari",{})
context.commit("update_racks",[])
context.commit("update_selected_rack",{})
context.commit("update_open_almari",false)
context.commit("update_open_rack",false)
context.commit("update_rack_contents",[])
context.commit("update_details",[])
context.commit("update_sample_weight",0)
context.commit("update_detailnonsamples",[])
context.commit("samplestorage/update_dialog_success", true,{root:true})
context.commit("samplestorage/update_last_id", resp.data.id,{root:true})
var msg = "Transaksi penyimpanan " + resp.data.numbering + " berhasil dong ..."
context.commit("samplestorage/update_msg_success", msg,{root:true})
}
} catch(e) {
context.commit("update_save_status",3)
}
},
async checkbarcode(context,prm) {
context.commit("update_get_data_status",1)
try {
prm.token = one_token()
let resp= await api.checkbarcode(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
}
if(data.records){
var arr = prm.details
let idx = _.findIndex(arr, { barcode : prm.barcode})
if(idx === -1 ){
var detail = {
xid:0,
barcode:prm.barcode,
almari:{},
rack:{},
rackid:0,
row:0,
col:0,
ordersampleid:data.records.T_OrderSampleID,
patientname:data.records.patientname
}
arr.push(detail)
context.commit("update_details",arr)
let idx = _.findIndex(arr, function(o) { return o.barcode == detail.barcode })
context.commit("update_selected_detail",arr[idx])
}else{
var msg = "Sudah ada di list dong"
context.commit("samplestorage/update_msg_info",msg,{root:true})
context.commit("samplestorage/update_open_dialog_info",true,{root:true})
}
}
else{
var msg = "Barcode <span style='font-weight:900'>"+prm.barcode+"</span> tidak valid dong"
context.commit("samplestorage/update_msg_info",msg,{root:true})
context.commit("samplestorage/update_open_dialog_info",true,{root:true})
}
}
} catch(e) {
context.commit("update_get_data_status",3)
}
},
async lookupsamples(context, prm) {
context.commit("update_lookup_sample_status", 1)
try {
prm.token = one_token()
let resp = await api.lookupsamples(prm)
if (resp.status != "OK") {
context.commit("update_lookup_sample_status", 3)
} else {
context.commit("update_lookup_sample_status", 2)
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_samples", data.records)
context.commit("update_dialog_search_sample",true)
}
} catch (e) {
context.commit("update_lookup_sample_status", 3)
console.log(e)
}
},
async lookupnonsamples(context, prm) {
context.commit("update_lookup_sample_status", 1)
try {
prm.token = one_token()
let resp = await api.lookupnonsamples(prm)
if (resp.status != "OK") {
context.commit("update_lookup_sample_status", 3)
} else {
context.commit("update_lookup_sample_status", 2)
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_nonsamples", data.records)
context.commit("update_dialog_search_nonsample",true)
}
} catch (e) {
context.commit("update_lookup_sample_status", 3)
console.log(e)
}
},
async savenewvendor(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.savenewvendor(prm)
if (resp.status != "OK") {
context.commit("update_save_status", 3)
} else {
context.commit("update_save_status", 2)
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_success_add_vendor", true)
context.commit("update_dialog_add_vendor", false)
setTimeout(function(){ context.commit("update_success_add_vendor", false) }, 3000);
}
} catch (e) {
context.commit("update_save_status", 3)
console.log(e)
}
},
async savenewitem(context, prm) {
context.commit("update_save_status", 1)
try {
prm.token = one_token()
let resp = await api.savenewitem(prm)
if (resp.status != "OK") {
context.commit("update_save_status", 3)
} else {
context.commit("update_save_status", 2)
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_nonsamples", data.records)
context.commit("update_success_add_item", true)
setTimeout(function(){ context.commit("update_success_add_item", false) }, 3000);
}
} catch (e) {
context.commit("update_save_status", 3)
console.log(e)
}
},
async searchstaff(context,prm) {
context.commit("update_autocomplete_status",1)
try {
let resp= await api.searchstaff(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
}
context.commit("update_staffs",resp.data.records)
}
} catch(e) {
context.commit("update_autocomplete_status",3)
}
},
}
}

View File

@@ -0,0 +1,452 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/samplestorage.js"
export default {
namespaced: true,
state: {
last_id:-1,
last_saved_id:-1,
x_addr_id:0,
act:'new',
act_addr:'new',
get_data_status:0,
search_trx: 0,
search_status: 0,
search_error_message: '',
filter_work:[{value:'manual',name:'Manual'},{value:'auto',name:'Otomatis'},{value:'all',name:'Semua'}],
selected_filter_work:{value:'manual',name:'Manual'},
filter_status:[{value:'ready',name:'Belum Selesai'},{value:'done',name:'Sudah Selesai'},{value:'readyhandover',name:'Siap Diserahkan'},{value:'receivedpatient',name:'Diterima Pasien'}],
selected_filter_status:{value:'ready',name:'Belum Dikirim'},
start_date:moment(new Date()).format('YYYY-MM-DD'),
end_date:moment(new Date()).format('YYYY-MM-DD'),
total_transaction: 0,
staffs:[],
selected_staff:{},
transactions:[],
selected_transaction: {},
save_status: 0,
btn_save_seen: true,
pgrs_save: false,
save_error_message: '',
no_save: 0,
open_alert_confirmation:false,
alert_success: false,
msg_success: "",
dialog_success: false,
dialog_confirmation_delete: false,
msg_confirmation_delete: "",
autocomplete_status:0,
dialog_form_address: false,
errors:[],
open_dialog_info:false,
msg_info:'',
open_print_out:false,
current_page:1,
total_page:1,
dialog_authorize:false,
mous:[],
selected_mou:{},
barcode:'',
snackbar:{value:false,timeout:4000,text:''},
info : {rest:0,total:0},
staff:{},
search:''
},
mutations: {
update_search(state, patient) {
state.search = patient
},
update_info(state, patient) {
state.info = patient
},
update_snackbar(state, patient) {
state.snackbar = patient
},
update_barcode(state, val) {
state.barcode = val
},
update_mous(state, val) {
state.mous = val
},
update_selected_mou(state, val) {
state.selected_mou = val
},
update_current_page(state, val) {
state.current_page = val
},
update_total_page(state, val) {
state.total_page = val
},
update_x_addr_id(state, val) {
state.x_addr_id = val
},
update_last_id(state, val) {
state.last_id = val
},
update_last_saved_id(state, val) {
state.last_saved_id = val
},
update_act(state, val) {
state.act = val
},
update_start_date(state, val) {
state.start_date = val
},
update_end_date(state, val) {
state.end_date = val
},
update_act_addr(state, val) {
state.act_addr = val
},
update_get_data_status(state, val) {
state.get_data_status = val
},
update_search_error_message(state, patient) {
state.search_error_message = patient
},
update_search_transaction(state, val) {
state.search_transaction = val
},
update_staffs(state, data) {
state.staffs = data
},
update_selected_staff(state, val) {
state.selected_staff = val
},
update_transactions(state, data) {
state.transactions = data
},
update_selected_filter_work(state, val) {
state.selected_filter_work = val
},
update_selected_filter_status(state, val) {
state.selected_filter_status = val
},
update_selected_transaction(state, val) {
state.selected_transaction = val
},
update_save_status(state, val) {
state.save_status = val
},
update_btn_save_seen(state, val) {
state.btn_save_seen = val
},
update_pgrs_save(state, val) {
state.pgrs_save = val
},
update_save_error_message(state, msg) {
state.save_error_message = ''
},
update_no_save(state, val) {
state.no_save = val
},
update_open_alert_confirmation(state, val) {
state.open_alert_confirmation = val
},
update_alert_success(state, val) {
state.alert_success = val
},
update_msg_success(state, val) {
state.msg_success = val
},
update_dialog_success(state, val) {
state.dialog_success = val
},
update_dialog_authorize(state,val){
state.dialog_authorize = val
},
update_dialog_confirmation_delete(state, val) {
state.dialog_confirmation_delete = val
},
update_msg_confirmation_delete(state, val) {
state.msg_confirmation_delete = val
},
update_search_status(state, val) {
state.search_status = val
},
update_errors(state, val) {
state.errors = val
},
update_total_transactions(state, val) {
state.total_transactions = val
},
update_open_dialog_info(state, val) {
state.open_dialog_info = val
},
update_msg_info(state, val) {
state.msg_info = val
},
update_open_print_out(state, val) {
state.open_print_out = val
},
},
actions: {
async getinitialdatas(context,prm) {
context.commit("update_get_data_status",1)
try {
prm.token = one_token()
let resp= await api.getinitialdatas(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_mous",data.records['mous'])
context.commit("update_selected_mou",data.records['mous'][0])
context.dispatch("search",{
search:prm.search,
current_page:prm.current_page,
mouid:data.records['mous'][0]['id'],
lastid:-1
})
}
} catch(e) {
context.commit("update_get_data_status",3)
}
},
async screening(context,prm) {
context.commit("update_get_data_status",1)
try {
prm.token = one_token()
let resp= await api.screening(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_msg_success","Sample "+prm.barcode+" disiapkan untuk upload")
context.commit("update_dialog_success",true)
setTimeout(function(){ context.commit("update_dialog_success",false) }, 1000)
context.dispatch("search",prm)
}
} catch(e) {
context.commit("update_get_data_status",3)
}
},
async dosampled(context,prm) {
context.commit("update_save_status",1)
try {
prm.token = one_token()
let resp= await api.dosampled(prm)
if (resp.status != "OK") {
context.commit("update_save_status",3)
} else {
context.commit("update_save_status",2)
let data = {
records : resp.data.records,
total: resp.data.total
}
let msg = data.records
var snackbar = {value:true,timeout:4000,text:msg}
context.commit("update_snackbar",snackbar)
context.dispatch("search",{
search:prm.search,
mouid:prm.mouid,
current_page:prm.current_page,
lastid:-1
})
}
} catch(e) {
context.commit("update_save_status",3)
}
},
async scanbarcode(context,prm) {
context.commit("update_save_status",1)
try {
prm.token = one_token()
let resp= await api.scanbarcode(prm)
if (resp.status != "OK") {
context.commit("update_save_status",3)
} else {
context.commit("update_save_status",2)
let data = {
records : resp.data.records,
total: resp.data.total
}
let msg = data.records
context.commit("update_barcode","")
var snackbar = {value:true,timeout:4000,text:msg}
context.commit("update_snackbar",snackbar)
console.log(snackbar)
context.dispatch("search",{
search:prm.search,
mouid:prm.mouid,
current_page:prm.current_page,
lastid:-1
})
}
} catch(e) {
context.commit("update_save_status",3)
}
},
async search_barcode(context,prm) {
context.commit("update_save_status",1)
try {
window.key_enter = ''
prm.token = one_token()
let resp= await api.search_barcode(prm)
if (resp.status != "OK") {
context.commit("update_save_status",3)
} else {
context.commit("update_save_status",2)
let data = {
records : resp.data.records,
total: resp.data.total
}
let msg = data.records
context.commit("update_barcode","")
var snackbar = {value:true,timeout:4000,text:msg}
context.commit("update_snackbar",snackbar)
console.log({
search:context.state.search,
mouid:context.state.selected_mou.id,
current_page:context.state.current_page,
lastid:-1
})
context.dispatch("search",{
search:context.state.search,
mouid:context.state.selected_mou.id,
current_page:context.state.current_page,
lastid:-1
})
}
} catch(e) {
context.commit("update_save_status",3)
}
},
async search(context, prm) {
context.commit("update_search_transaction", 1)
try {
prm.token = one_token()
let resp = await api.search(prm)
if (resp.status != "OK") {
context.commit("update_search_transaction", 3)
context.commit("update_search_error_message", resp.message)
} else {
context.commit("update_search_transaction", 2)
context.commit("update_search_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_transactions", data.records)
context.commit("update_info", {rest:data.records[0].xrest,total:data.records[0].xtotal})
context.commit("update_total_page", parseInt(data.total))
context.commit("update_no_save", 0)
/*if(prm.lastid === -1){
if(data.records.length > 0){
var trx = data.records[0]
console.log(trx)
context.commit("update_selected_transaction",trx)
context.commit("update_act",'edit')
context.commit("form/update_transaction_number",trx.trx_number,{root:true})
context.commit("form/update_transaction_date",trx.xdate,{root:true})
context.commit("form/update_transaction_time",trx.xtime,{root:true})
context.commit("form/update_staffs",[{M_StaffID:trx.trx_staffid,M_StaffName:trx.trx_staffname}],{root:true})
context.commit("form/update_selected_staff",{M_StaffID:trx.trx_staffid,M_StaffName:trx.trx_staffname},{root:true})
context.commit("form/update_porter",trx.trx_transporter,{root:true})
context.commit("form/update_transaction_note",trx.trx_note,{root:true})
context.commit("form/update_detailnonsamples",trx.detailnonsamples,{root:true})
context.commit("form/update_details",trx.details,{root:true})
}
else{
var trx = {}
console.log(trx)
context.commit("update_selected_transaction",trx)
context.commit("update_act",'new')
context.commit("form/update_transaction_number",'',{root:true})
context.commit("form/update_transaction_date",moment(new Date()).format('YYYY-MM-DD'),{root:true})
context.commit("form/update_transaction_time",moment(new Date()).format("hh:mm"),{root:true})
context.commit("form/update_staffs",[],{root:true})
context.commit("form/update_selected_staff",{},{root:true})
context.commit("form/update_porter",'',{root:true})
context.commit("form/update_transaction_note",'',{root:true})
context.commit("form/update_detailnonsamples",[],{root:true})
context.commit("form/update_details",[],{root:true})
}
}
else{
context.commit("update_selected_transaction", data.records[prm.lastid])
var doc = data.records[prm.lastid]
}*/
}
} catch (e) {
context.commit("update_search_transaction", 3)
context.commit("update_search_error_message", e.message)
console.log(e)
}
},
async deletetrx(context,prm) {
context.commit("update_save_status",1)
try {
prm.token = one_token()
let resp= await api.deletetrx(prm)
if (resp.status != "OK") {
context.commit("update_save_status",3)
} else {
context.commit("update_save_status",2)
context.commit("update_selected_transaction",{})
context.commit("form/update_transaction_number",'',{root:true})
context.commit("form/update_transaction_date",moment(new Date()).format('YYYY-MM-DD'),{root:true})
context.commit("form/update_transaction_time",moment(new Date()).format("hh:mm"),{root:true})
context.commit("form/update_staffs",[])
context.commit("form/update_selected_staff",{},{root:true})
context.commit("form/update_porter",'',{root:true})
context.commit("form/update_transaction_note",'',{root:true})
context.commit("form/update_detailnonsamples",[],{root:true})
context.commit("form/update_details",[],{root:true})
context.commit("update_act",'new')
context.commit("update_dialog_confirmation_delete",false)
context.commit("update_dialog_success", true)
var msg = "Transaksi pembatalan " + prm.trx_number + " berhasil dong ..."
context.commit("update_msg_success", msg)
}
} catch(e) {
context.commit("update_save_status",3)
}
},
async search_staff(context,prm) {
context.commit("update_get_data_status",1)
try {
prm.token = one_token()
let resp= await api.search_staff(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
}
if(data.records)
context.commit("update_staff",resp.data.records)
else{
context.commit("update_staff",{id:0,code:'',name:'STAF TIDAK DITEMUKAN',code:'',userid:''})
}
}
} catch(e) {
context.commit("update_get_data_status",3)
}
},
}
}

View File

@@ -0,0 +1,29 @@
// State
// data ...
// Mutations
//
//
// Actions
import samplestorage from "./modules/samplestorage.js";
import form from "./modules/form.js";
import system from "../../../apps/modules/system/system.js";
export const store = new Vuex.Store({
modules: {
samplestorage: samplestorage,
form:form,
system: system
},
state: {
tab_selected: 'pasien-dokter'
},
mutations: {
change_tab(state, ntab) {
state.tab_selected = ntab
}
},
actions: {
change_tab(context, ntab) {
context.commit('change_tab', ntab)
}
}
});