Flatten nested repos
This commit is contained in:
20
test/vuex/one-fo-supevisor/api/patient.js
Normal file
20
test/vuex/one-fo-supevisor/api/patient.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const URL = "/one-api/mockup/fo/supervisor/";
|
||||
|
||||
export async function search(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'patient/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
|
||||
};
|
||||
}
|
||||
}
|
||||
292
test/vuex/one-fo-supevisor/components/oneFoSupervisorList.vue
Normal file
292
test/vuex/one-fo-supevisor/components/oneFoSupervisorList.vue
Normal file
@@ -0,0 +1,292 @@
|
||||
<template>
|
||||
<v-layout class="fill-height" column>
|
||||
<v-card style="height:85px" class="mb-2 pa-2 searchbox">
|
||||
<v-layout >
|
||||
<v-menu
|
||||
ref="menustartdate"
|
||||
v-model="menustartdate"
|
||||
:close-on-content-click="false"
|
||||
:nudge-right="0"
|
||||
lazy
|
||||
transition="scale-transition"
|
||||
offset-y
|
||||
full-width
|
||||
max-width="290px"
|
||||
min-width="290px"
|
||||
>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field
|
||||
v-model="startDateFormatted"
|
||||
label="Tanggal Awal"
|
||||
readonly
|
||||
class="xs3 ma-1"
|
||||
outline
|
||||
v-on="on"
|
||||
@blur="deFormatedDate(startDateFormatted)"
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker v-model="xstartdate" no-title @input="menustartdate = false"></v-date-picker>
|
||||
</v-menu>
|
||||
|
||||
<v-menu
|
||||
ref="menuenddate"
|
||||
v-model="menuenddate"
|
||||
:close-on-content-click="false"
|
||||
:nudge-right="0"
|
||||
lazy
|
||||
transition="scale-transition"
|
||||
offset-y
|
||||
full-width
|
||||
max-width="290px"
|
||||
min-width="290px"
|
||||
>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field
|
||||
v-model="endDateFormatted"
|
||||
label="Tanggal Akhir"
|
||||
outline
|
||||
class="xs3 ma-1"
|
||||
readonly
|
||||
v-on="on"
|
||||
@blur="deFormatedDate(endDateFormatted)"
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker v-model="xenddate" no-title @input="menuenddate = false"></v-date-picker>
|
||||
</v-menu>
|
||||
|
||||
<v-text-field class="xs3 ma-1"
|
||||
label=""
|
||||
placeholder="Nama / No lab"
|
||||
single-line
|
||||
outline
|
||||
v-model="searchnamelab"
|
||||
hide-details
|
||||
></v-text-field>
|
||||
|
||||
<v-select class="xs3 ma-1" :items="statuses"
|
||||
item-text="name"
|
||||
return-object
|
||||
v-model="status"
|
||||
label="Status" outline hide-details></v-select>
|
||||
<v-btn class="xs3 ma-1" color="success" @click="searchPatient" >Search</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="patients"
|
||||
: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.M_PatientNoReg }}</td>
|
||||
<td class="pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.T_OrderHeaderLabNumber}}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.M_PatientName}}</td>
|
||||
<td class="text-xs-left pa-2" v-bind:class="{'amber lighten-4':isSelected(props.item)}" @click="selectMe(props.item)">{{ props.item.M_CompanyName}} : {{ props.item.M_MouName}}</td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<one-dialog-alert :status="openalertnopay" :msg="msgalertnopay" @forget-dialog-alert="forgetAlertNoPay()" @close-dialog-alert="closeAlertNoPay()"></one-dialog-alert>
|
||||
</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;
|
||||
}
|
||||
|
||||
.v-messages{
|
||||
min-height:0px!important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components : {
|
||||
'one-dialog-info':httpVueLoader('../../common/oneDialogInfo.vue'),
|
||||
'one-dialog-alert':httpVueLoader('../../common/oneDialogAlert.vue')
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("patient/search",{
|
||||
startdate:this.xstartdate,
|
||||
enddate:this.xenddate,
|
||||
search: this.searchnamelab,
|
||||
status: this.status.value,
|
||||
lastidx:0
|
||||
})
|
||||
},
|
||||
methods : {
|
||||
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.T_OrderHeaderID == this.$store.state.patient.selected_patient.T_OrderHeaderID
|
||||
},
|
||||
searchPatient() {
|
||||
this.$store.dispatch("patient/search",{
|
||||
startdate:this.xstartdate,
|
||||
enddate:this.xenddate,
|
||||
search:this.searchnamelab,
|
||||
status: this.status.value,
|
||||
lastidx:0
|
||||
})
|
||||
},
|
||||
selectMe(pat) {
|
||||
let totpay = this.$store.state.payment.total_payment
|
||||
if(totpay === 0){
|
||||
let xobj = this.$store.state.payment.types
|
||||
xobj.forEach(function(obj){
|
||||
obj.leftvalue = 0
|
||||
obj.rightvalue = 0
|
||||
})
|
||||
this.$store.commit("payment/update_types",{records :xobj,total:xobj.length })
|
||||
this.$store.commit("patient/update_selected_patient",pat)
|
||||
this.$store.commit("payment/update_total_payment",0)
|
||||
this.$store.commit("payment/update_notes",pat.notes)
|
||||
}
|
||||
else{
|
||||
this.$store.commit("patient/update_open_alert_no_pay",true)
|
||||
}
|
||||
|
||||
},
|
||||
closeAlertNoPay(){
|
||||
this.$store.commit("patient/update_open_alert_no_pay",false)
|
||||
},
|
||||
forgetAlertNoPay(){
|
||||
var xval = this.$store.state.payment.types
|
||||
var valpay = 0
|
||||
xval.forEach(function(obj){
|
||||
obj.leftvalue = 0
|
||||
obj.rightvalue = 0
|
||||
})
|
||||
this.$store.commit("payment/update_total_payment",0)
|
||||
this.$store.commit("patient/update_open_alert_no_pay",false)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
xstartdate:{
|
||||
get() {
|
||||
return this.$store.state.patient.start_date
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_start_date",val)
|
||||
}
|
||||
},
|
||||
xenddate:{
|
||||
get() {
|
||||
return this.$store.state.patient.end_date
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_end_date",val)
|
||||
}
|
||||
},
|
||||
searchnamelab:{
|
||||
get() {
|
||||
return this.$store.state.patient.search
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_search",val)
|
||||
}
|
||||
},
|
||||
statuses(){
|
||||
return this.$store.state.patient.statuses
|
||||
},
|
||||
status:{
|
||||
get() {
|
||||
return this.$store.state.patient.selected_status
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_selected_status",val)
|
||||
}
|
||||
},
|
||||
startDateFormatted () {
|
||||
return this.formatDate(this.xstartdate)
|
||||
},
|
||||
endDateFormatted () {
|
||||
return this.formatDate(this.xenddate)
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.patient.search_status == 1
|
||||
},
|
||||
patients() {
|
||||
return this.$store.state.patient.patients
|
||||
},
|
||||
openalertnopay:{
|
||||
get() {
|
||||
return this.$store.state.patient.open_alert_no_pay
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_open_alert_no_pay",false)
|
||||
}
|
||||
},
|
||||
msgalertnopay(){
|
||||
return this.$store.state.patient.msg_alert_no_pay
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
menustartdate:false,
|
||||
menuenddate:false,
|
||||
headers: [
|
||||
{
|
||||
text: "NO REG",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NO LAB",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "NAMA",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "name",
|
||||
width: "20%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
},
|
||||
|
||||
{
|
||||
text: "COMPANY MOU",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "status",
|
||||
width: "20%",
|
||||
class: "pa-2 blue lighten-3 white--text"
|
||||
}
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
92
test/vuex/one-fo-supevisor/index.php
Normal file
92
test/vuex/one-fo-supevisor/index.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>One</title>
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/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 xs6 class="left" fill-height pa-1>
|
||||
<one-fo-cashier-list></one-fo-cashier-list>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="right" fill-height pa-1>
|
||||
<!-- komponen kanan -->
|
||||
<!--<one-fo-cashier-payment></one-fo-cashier-payment>-->
|
||||
</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',
|
||||
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-fo-supervisor-list': httpVueLoader('./components/oneFoSupervisorList.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
.left {
|
||||
}
|
||||
.right {
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
89
test/vuex/one-fo-supevisor/modules/patient.js
Normal file
89
test/vuex/one-fo-supevisor/modules/patient.js
Normal file
@@ -0,0 +1,89 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/patient.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
search_patient: 0,
|
||||
search_error_message: '',
|
||||
start_date:moment(new Date()).format('YYYY-MM-DD'),
|
||||
end_date:moment(new Date()).format('YYYY-MM-DD'),
|
||||
search:'',
|
||||
patients: [],
|
||||
total_patient: 0,
|
||||
selected_patient: {totalbill:0},
|
||||
save_error_message: '',
|
||||
statuses:[{name:'Belum Lunas',value:'N'},{name:'Lunas',value:'Y'}],
|
||||
selected_status:{name:'Belum Lunas',value:'N'},
|
||||
open_alert_no_pay: false,
|
||||
msg_alert_no_pay: "Loh ... Gak jadi bayar ?"
|
||||
},
|
||||
mutations: {
|
||||
update_search_error_message(state, patient) {
|
||||
state.search_error_message = patient
|
||||
},
|
||||
update_search_patient(state, patient) {
|
||||
state.search_patient = patient
|
||||
},
|
||||
update_patients(state, data) {
|
||||
state.patients = data.records
|
||||
state.total_patient = data.total
|
||||
},
|
||||
update_selected_patient(state, val) {
|
||||
state.selected_patient = val
|
||||
},
|
||||
update_start_date(state, val) {
|
||||
state.start_date = val
|
||||
},
|
||||
update_end_date(state, val) {
|
||||
state.end_date = val
|
||||
},
|
||||
update_search(state, val) {
|
||||
state.search = val
|
||||
},
|
||||
update_selected_status(state, val) {
|
||||
state.selected_status = val
|
||||
},
|
||||
update_open_alert_no_pay(state, val) {
|
||||
state.open_alert_no_pay = val
|
||||
},
|
||||
update_msg_alert_no_pay(state, val) {
|
||||
state.msg_alert_no_pay = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context, prm) {
|
||||
context.commit("update_search_patient", 1)
|
||||
try {
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_patient", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_patients", data)
|
||||
if(prm.lastidx === 0){
|
||||
context.commit("update_selected_patient", data.records[0])
|
||||
context.commit("payment/update_notes",data.records[0].notes,{root:true})
|
||||
}
|
||||
else{
|
||||
context.commit("update_selected_patient", data.records[prm.lastidx])
|
||||
context.commit("payment/update_notes",data.records[prm.lastidx].notes,{root:true})
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
test/vuex/one-fo-supevisor/store.js
Normal file
27
test/vuex/one-fo-supevisor/store.js
Normal file
@@ -0,0 +1,27 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import patient from "./modules/patient.js";
|
||||
import payment from "./modules/payment.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
patient: patient,
|
||||
payment: payment
|
||||
},
|
||||
state: {
|
||||
tab_selected: 'pasien-dokter'
|
||||
},
|
||||
mutations: {
|
||||
change_tab(state, ntab) {
|
||||
state.tab_selected = ntab
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
change_tab(context, ntab) {
|
||||
context.commit('change_tab', ntab)
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user