add parse filed tanggal_mcu ke template preregister
This commit is contained in:
@@ -89,7 +89,7 @@
|
||||
<v-layout pa-1 row>
|
||||
<v-flex class="text-xs-center" xs12>
|
||||
<p class="mb-0 caption">silahkan download template di <span @click="downloadcsv()" style="cursor:pointer" class="info--text lighten-3--text">sini</span></p>
|
||||
|
||||
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider></v-divider>
|
||||
@@ -100,7 +100,7 @@
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
|
||||
|
||||
<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="opendialoginfo = false"></one-dialog-info>
|
||||
</v-layout>
|
||||
@@ -124,7 +124,7 @@
|
||||
mounted() {
|
||||
//this.setNewSetup()
|
||||
this.$store.dispatch("patient/getmgmmcu")
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
downloadxapp(){
|
||||
@@ -152,7 +152,7 @@
|
||||
this.$store.commit("patient/update_mou", {})
|
||||
this.$store.commit("patient/update_selected_mous", row.mous)
|
||||
this.$store.commit("patient/update_selected_doctors", row.doctors)
|
||||
|
||||
|
||||
this.$store.commit("patient/update_start_date", moment(row.McuOfflinePrepareStartDate).format('YYYY-MM-DD'))
|
||||
this.$store.commit("patient/update_end_date", moment(row.McuOfflinePrepareEndDate).format('YYYY-MM-DD'))
|
||||
},
|
||||
@@ -227,27 +227,27 @@
|
||||
var lines = csv.split("\n")
|
||||
var result = []
|
||||
var headers = lines[0].split(",")
|
||||
vm.parse_header = lines[0].split(",")
|
||||
vm.parse_header = lines[0].split(",")
|
||||
lines[0].split(",").forEach(function (key) {
|
||||
vm.sortOrders[key] = 1
|
||||
})
|
||||
|
||||
|
||||
lines.map(function(line, indexLine){
|
||||
if (indexLine < 1) return // Jump header line
|
||||
|
||||
|
||||
var obj = {}
|
||||
var currentline = line.split(",")
|
||||
|
||||
|
||||
headers.map(function(header, indexHeader){
|
||||
var header = header.trim();
|
||||
obj[header] = currentline[indexHeader]
|
||||
})
|
||||
|
||||
|
||||
result.push(obj)
|
||||
})
|
||||
|
||||
|
||||
result.pop() // remove the last item because undefined values
|
||||
|
||||
|
||||
return result // JavaScript object
|
||||
},
|
||||
loadCSV_old(e) {
|
||||
@@ -280,23 +280,23 @@
|
||||
// var d = substr(nik, 6, 2);
|
||||
// var m = substr(nik, 8, 2);
|
||||
// var y = substr(nik, 10, 2);
|
||||
|
||||
|
||||
// //jika tahun full, ambil 2 digit terakhir
|
||||
// if(strlen(tahun==4)){
|
||||
// tahun = substr(tahun,2,2);
|
||||
// }
|
||||
// if (intval(d) > 40) {
|
||||
// //Wanita
|
||||
// d = intval(d) - 40;
|
||||
// d = intval(d) - 40;
|
||||
// }
|
||||
// if(tanggal/d != 1){
|
||||
// return false;
|
||||
// }
|
||||
|
||||
|
||||
// if(bulan/m != 1){
|
||||
// return false;
|
||||
// }
|
||||
|
||||
|
||||
// if(tahun/y != 1){
|
||||
// return false;
|
||||
// }
|
||||
@@ -361,7 +361,7 @@
|
||||
if(iidx > 0){
|
||||
//entry.TANGGAL_LAHIR = moment(entry.TANGGAL_LAHIR).format('DD-MM-YYYY')
|
||||
// console.log("DD", moment(entry.TANGGAL_LAHIR, 'DD-MM-YYYY').format('DD'));
|
||||
|
||||
|
||||
// const date = new Date(entry.TANGGAL_LAHIR);
|
||||
// console.log("date",date)
|
||||
var day = moment(entry.TANGGAL_LAHIR, 'DD-MM-YYYY').format('DD');
|
||||
@@ -508,7 +508,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
files: [],
|
||||
files: [],
|
||||
dialog_identifier: false,
|
||||
channel_name: '',
|
||||
channel_fields: [],
|
||||
@@ -551,4 +551,4 @@
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
366
test/vuex/cpone-mcu-offline-preregister-v3/api/patient.js
Normal file
366
test/vuex/cpone-mcu-offline-preregister-v3/api/patient.js
Normal file
@@ -0,0 +1,366 @@
|
||||
const URL = "/one-api/cpone/mcuoffline/";
|
||||
|
||||
export async function getmgmmcu(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/getmgmmcu', 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 + 'preregisterv3/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 generatesetup(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/generatesetup', 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 getsexreg(token) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/getsexreg',{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 savecsv(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/savecsv',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 newpatient(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/newpatient',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 xdelete(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/deletepatient',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 getaddress(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/getaddress',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 searchcity(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/searchcity',{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 getdistrict(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/getdistrict',{id:prm.M_CityID,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 getkelurahan(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/getkelurahan',{token:token,id:prm.M_DistrictID});
|
||||
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 savenewaddress(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/savenewaddress',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 saveeditaddress(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/saveeditaddress',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 deleteaddress(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/deleteaddress',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 searchdoctor(prm) {
|
||||
try {
|
||||
console.log('aye')
|
||||
console.log(prm)
|
||||
var resp = await axios.post(URL + 'preregisterv3/searchdoctor',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 searchcompany(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/searchcompany',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 getmou(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/getmou',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 savepreregisterv2(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/savepreregisterv2',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 gotoreg(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'preregisterv3/gotoreg',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
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,293 @@
|
||||
<template>
|
||||
<div class="vue-csv-uploader">
|
||||
<div class="form">
|
||||
<div class="vue-csv-uploader-part-one">
|
||||
<div class="form-check form-group csv-import-checkbox" v-if="headers === null">
|
||||
<slot name="hasHeaders" :headers="hasHeaders" :toggle="toggleHasHeaders">
|
||||
<input :class="checkboxClass" type="checkbox" :id="makeId('hasHeaders')" :value="hasHeaders" @change="toggleHasHeaders">
|
||||
<label class="form-check-label" :for="makeId('hasHeaders')">
|
||||
File Has Headers
|
||||
</label>
|
||||
</slot>
|
||||
</div>
|
||||
<div class="form-group csv-import-file">
|
||||
<input ref="csv" type="file" @change.prevent="validFileMimeType" :class="inputClass" name="csv">
|
||||
<slot name="error" v-if="showErrorMessage">
|
||||
<div class="invalid-feedback d-block">
|
||||
File type is invalid
|
||||
</div>
|
||||
</slot>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<slot name="next" :load="load">
|
||||
<button type="submit" :disabled="disabledNextButton" :class="buttonClass" @click.prevent="load">
|
||||
{{ loadBtnText }}
|
||||
</button>
|
||||
</slot>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vue-csv-uploader-part-two">
|
||||
<div class="vue-csv-mapping" v-if="sample">
|
||||
<table :class="tableClass">
|
||||
<slot name="thead">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Field</th>
|
||||
<th>CSV Column</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</slot>
|
||||
<tbody>
|
||||
<tr v-for="(field, key) in fieldsToMap" :key="key">
|
||||
<td>{{ field.label }}</td>
|
||||
<td>
|
||||
<select :class="tableSelectClass" :name="`csv_uploader_map_${key}`" v-model="map[field.key]">
|
||||
<option :value="null" v-if="canIgnore">Ignore</option>
|
||||
<option v-for="(column, key) in firstRow" :key="key" :value="key">{{ column }}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="form-group" v-if="url">
|
||||
<slot name="submit" :submit="submit">
|
||||
<input type="submit" :class="buttonClass" @click.prevent="submit" :value="submitBtnText">
|
||||
</slot>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { drop, every, forEach, get, isArray, map, set } from 'lodash';
|
||||
import axios from 'axios';
|
||||
import Papa from 'papaparse';
|
||||
import mimeTypes from "mime-types";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
value: Array,
|
||||
url: {
|
||||
type: String
|
||||
},
|
||||
mapFields: {
|
||||
required: true
|
||||
},
|
||||
callback: {
|
||||
type: Function,
|
||||
default: () => ({})
|
||||
},
|
||||
catch: {
|
||||
type: Function,
|
||||
default: () => ({})
|
||||
},
|
||||
finally: {
|
||||
type: Function,
|
||||
default: () => ({})
|
||||
},
|
||||
parseConfig: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
headers: {
|
||||
default: null
|
||||
},
|
||||
loadBtnText: {
|
||||
type: String,
|
||||
default: "Next"
|
||||
},
|
||||
submitBtnText: {
|
||||
type: String,
|
||||
default: "Submit"
|
||||
},
|
||||
tableClass: {
|
||||
type: String,
|
||||
default: "table"
|
||||
},
|
||||
checkboxClass: {
|
||||
type: String,
|
||||
default: "form-check-input"
|
||||
},
|
||||
buttonClass: {
|
||||
type: String,
|
||||
default: "btn btn-primary"
|
||||
},
|
||||
inputClass: {
|
||||
type: String,
|
||||
default: "form-control-file"
|
||||
},
|
||||
validation: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
fileMimeTypes: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return ["text/csv", "text/x-csv", "application/vnd.ms-excel", "text/plain"];
|
||||
}
|
||||
},
|
||||
tableSelectClass: {
|
||||
type: String,
|
||||
default: 'form-control'
|
||||
},
|
||||
canIgnore: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}
|
||||
},
|
||||
|
||||
data: () => ({
|
||||
form: {
|
||||
csv: null,
|
||||
},
|
||||
fieldsToMap: [],
|
||||
map: {},
|
||||
hasHeaders: true,
|
||||
csv: null,
|
||||
sample: null,
|
||||
isValidFileMimeType: false,
|
||||
fileSelected: false
|
||||
}),
|
||||
|
||||
created() {
|
||||
this.hasHeaders = this.headers;
|
||||
|
||||
if (isArray(this.mapFields)) {
|
||||
this.fieldsToMap = map(this.mapFields, (item) => {
|
||||
return {
|
||||
key: item,
|
||||
label: item
|
||||
};
|
||||
});
|
||||
} else {
|
||||
this.fieldsToMap = map(this.mapFields, (label, key) => {
|
||||
return {
|
||||
key: key,
|
||||
label: label
|
||||
};
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
submit() {
|
||||
const _this = this;
|
||||
this.form.csv = this.buildMappedCsv();
|
||||
this.$emit('input', this.form.csv);
|
||||
|
||||
if (this.url) {
|
||||
axios.post(this.url, this.form).then(response => {
|
||||
_this.callback(response);
|
||||
}).catch(response => {
|
||||
_this.catch(response);
|
||||
}).finally(response => {
|
||||
_this.finally(response);
|
||||
});
|
||||
} else {
|
||||
_this.callback(this.form.csv);
|
||||
}
|
||||
},
|
||||
buildMappedCsv() {
|
||||
const _this = this;
|
||||
|
||||
let csv = this.hasHeaders ? drop(this.csv) : this.csv;
|
||||
|
||||
return map(csv, (row) => {
|
||||
let newRow = {};
|
||||
|
||||
forEach(_this.map, (column, field) => {
|
||||
set(newRow, field, get(row, column));
|
||||
});
|
||||
|
||||
return newRow;
|
||||
});
|
||||
},
|
||||
validFileMimeType() {
|
||||
let file = this.$refs.csv.files[0];
|
||||
const mimeType = file.type === "" ? mimeTypes.lookup(file.name) : file.type;
|
||||
|
||||
if (file) {
|
||||
this.fileSelected = true;
|
||||
this.isValidFileMimeType = this.validation ? this.validateMimeType(mimeType) : true;
|
||||
} else {
|
||||
this.isValidFileMimeType = !this.validation;
|
||||
this.fileSelected = false;
|
||||
}
|
||||
},
|
||||
validateMimeType(type) {
|
||||
return this.fileMimeTypes.indexOf(type) > -1;
|
||||
},
|
||||
load() {
|
||||
const _this = this;
|
||||
|
||||
this.readFile((output) => {
|
||||
_this.sample = get(Papa.parse(output, { preview: 2, skipEmptyLines: true }), "data");
|
||||
_this.csv = get(Papa.parse(output, { skipEmptyLines: true }), "data");
|
||||
});
|
||||
},
|
||||
readFile(callback) {
|
||||
let file = this.$refs.csv.files[0];
|
||||
|
||||
if (file) {
|
||||
let reader = new FileReader();
|
||||
reader.readAsText(file, "UTF-8");
|
||||
reader.onload = function (evt) {
|
||||
callback(evt.target.result);
|
||||
};
|
||||
reader.onerror = function () {
|
||||
};
|
||||
}
|
||||
},
|
||||
toggleHasHeaders() {
|
||||
this.hasHeaders = !this.hasHeaders;
|
||||
},
|
||||
makeId(id) {
|
||||
return `${id}${this._uid}`;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
map: {
|
||||
deep: true,
|
||||
handler: function (newVal) {
|
||||
if (!this.url) {
|
||||
let hasAllKeys = Array.isArray(this.mapFields) ? every(this.mapFields, function (item) {
|
||||
return newVal.hasOwnProperty(item);
|
||||
}) : every(this.mapFields, function (item, key) {
|
||||
return newVal.hasOwnProperty(key);
|
||||
});
|
||||
|
||||
if (hasAllKeys) {
|
||||
this.submit();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
sample(newVal, oldVal) {
|
||||
if(newVal !== null){
|
||||
this.fieldsToMap.forEach(field => {
|
||||
newVal[0].forEach((columnName, index) => {
|
||||
if(field.key === columnName){
|
||||
this.map[field.key] = index;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
firstRow() {
|
||||
return get(this, "sample.0");
|
||||
},
|
||||
showErrorMessage() {
|
||||
return this.fileSelected && !this.isValidFileMimeType;
|
||||
},
|
||||
disabledNextButton() {
|
||||
return !this.isValidFileMimeType;
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,397 @@
|
||||
<template>
|
||||
<v-layout v-if="xact !== 'new'" column >
|
||||
<v-dialog v-model="dialogconfirmationdeleteaddr" persistent max-width="290">
|
||||
<v-card>
|
||||
<v-card-title
|
||||
dark
|
||||
class="headline error pt-2 pb-2"
|
||||
primary-title
|
||||
style="color:white"
|
||||
>
|
||||
<h4 dark>Konfirmasi</h4>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
{{msgconfirmationdeleteaddr}}
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn small v-if="!checkError('deleteutama')" color="error darken-1 text-sm-left" flat @click="doDeleteAddr()">Hapus</v-btn>
|
||||
<v-btn small color="primary darken-1 text-sm-right" flat @click="dialogconfirmationdeleteaddr = false">Batal</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogformaddress" persistent max-width="650">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="headline">Form Alamat Pasien</span>
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-0 pb-0">
|
||||
<v-layout wrap>
|
||||
<v-flex xs12>
|
||||
<v-text-field v-model="labeladdress" label="Label"></v-text-field>
|
||||
<p v-if="checkError('requiredlabel')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
|
||||
<p v-if="checkError('readonlyutama')" class="error pl-2 pr-2" style="color:#fff">Biarkan jadi yang utama</p>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-layout row>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-autocomplete
|
||||
label="Kota"
|
||||
v-model="cityaddress"
|
||||
:items="xcities"
|
||||
:search-input.sync="search_city"
|
||||
auto-select-first
|
||||
no-filter
|
||||
item-text="M_CityName"
|
||||
return-object
|
||||
:loading="isLoading"
|
||||
no-data-text="Pilih Kota"
|
||||
>
|
||||
<template
|
||||
slot="item"
|
||||
slot-scope="{ item }"
|
||||
>
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title v-text="item.M_CityName"></v-list-tile-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
<p v-if="checkError('requiredcity')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
|
||||
</v-flex>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-select
|
||||
item-text="M_DistrictName"
|
||||
return-object
|
||||
:items="xdistricts"
|
||||
v-model="districtaddress"
|
||||
label="Kecamatan*"
|
||||
></v-select>
|
||||
<p v-if="checkError('requireddistrict')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
|
||||
</v-flex>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-select
|
||||
item-text="M_KelurahanName"
|
||||
return-object
|
||||
:items="xkelurahans"
|
||||
v-model="kelurahanaddress"
|
||||
label="Kelurahan / Desa*"
|
||||
></v-select>
|
||||
<p v-if="checkError('requiredkelurahan')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-textarea
|
||||
box
|
||||
label="Alamat Lengkap"
|
||||
v-model="descriptionaddress"
|
||||
></v-textarea>
|
||||
<p v-if="checkError('requireddescription')" class="error pl-2 pr-2" style="color:#fff">Jangan kosong dong</p>
|
||||
</v-flex>
|
||||
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="blue darken-1" flat @click="dialogformaddress = false">Tutup</v-btn>
|
||||
<v-btn v-if="xactaddr === 'new'" color="blue darken-1" flat @click="saveNewAddress()">Simpan</v-btn>
|
||||
<v-btn v-if="xactaddr === 'edit'" color="blue darken-1" flat @click="saveEditAddress()">Simpan</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-card>
|
||||
<v-layout row>
|
||||
<v-flex xs12>
|
||||
<v-subheader red--text text--lighten-1> ALAMAT PASIEN
|
||||
<v-flex text-md-right>
|
||||
<v-btn @click="createNewAddress()" small color="info">Baru</v-btn>
|
||||
</v-flex>
|
||||
</v-subheader>
|
||||
<v-divider></v-divider>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12 pa-2>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="xaddresses"
|
||||
:loading="isLoading"
|
||||
hide-actions class="elevation-1">
|
||||
<template slot="items" slot-scope="props">
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-icon color="error" @click="deleteAddress(props.item)">delete</v-icon>
|
||||
<v-icon class="ml-3" color="primary" @click="editAddress(props.item)">edit</v-icon>
|
||||
</td>
|
||||
<td class="text-xs-left pa-2">{{ props.item.M_PatientAddressNote}}</td>
|
||||
<td class="text-xs-left pa-2">{{ props.item.M_PatientAddressDescription}}</td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-flex>
|
||||
</v-card>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data: () => ({
|
||||
search_city:'',
|
||||
oldlabel:'',
|
||||
headers: [
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "action",
|
||||
width: "10%",
|
||||
class: "pa-1 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "LABEL",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "20%",
|
||||
class: "pa-1 blue lighten-3 white--text"
|
||||
},
|
||||
{
|
||||
text: "ALAMAT",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "40%",
|
||||
class: "pa-1 blue lighten-3 white--text"
|
||||
}
|
||||
]
|
||||
}),
|
||||
computed: {
|
||||
dialogconfirmationdeleteaddr:{
|
||||
get() {
|
||||
return this.$store.state.patient.dialog_confirmation_delete_addr
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_dialog_confirmation_delete_addr",val)
|
||||
}
|
||||
},
|
||||
msgconfirmationdeleteaddr(){
|
||||
return this.$store.state.patient.msg_confirmation_delete_addr
|
||||
},
|
||||
xact() {
|
||||
return this.$store.state.patient.act
|
||||
},
|
||||
xactaddr() {
|
||||
return this.$store.state.patient.act_addr
|
||||
},
|
||||
dialogformaddress:{
|
||||
get() {
|
||||
return this.$store.state.patient.dialog_form_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_dialog_form_address",val)
|
||||
}
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.patient.search_status == 1
|
||||
},
|
||||
xaddresses(p) {
|
||||
return this.$store.state.patient.addresses
|
||||
},
|
||||
xcities(){
|
||||
return this.$store.state.patient.cities
|
||||
},
|
||||
labeladdress:{
|
||||
get() {
|
||||
return this.$store.state.patient.label_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_label_address",val)
|
||||
}
|
||||
},
|
||||
cityaddress:{
|
||||
get() {
|
||||
return this.$store.state.patient.city_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_city_address",val)
|
||||
this.$store.dispatch("patient/getdistrict",this.$store.state.patient.city_address)
|
||||
}
|
||||
},
|
||||
xdistricts(){
|
||||
return this.$store.state.patient.districts
|
||||
},
|
||||
districtaddress:{
|
||||
get() {
|
||||
return this.$store.state.patient.district_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_district_address",val)
|
||||
this.$store.dispatch("patient/getkelurahan",this.$store.state.patient.district_address)
|
||||
}
|
||||
},
|
||||
xkelurahans(){
|
||||
return this.$store.state.patient.kelurahans
|
||||
},
|
||||
kelurahanaddress:{
|
||||
get() {
|
||||
return this.$store.state.patient.kelurahan_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_kelurahan_address",val)
|
||||
}
|
||||
},
|
||||
descriptionaddress:{
|
||||
get() {
|
||||
return this.$store.state.patient.description_address
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_description_address",val)
|
||||
}
|
||||
},
|
||||
},
|
||||
methods : {
|
||||
createNewAddress(){
|
||||
this.$store.commit("patient/update_act_addr",'new')
|
||||
this.search_city = ''
|
||||
this.labeladdress = ''
|
||||
this.$store.commit("patient/update_cities",[])
|
||||
this.cityaddress = {}
|
||||
this.$store.commit("patient/update_districts",[])
|
||||
this.districtaddress = {}
|
||||
this.$store.commit("patient/update_kelurahans",[])
|
||||
this.kelurahanaddress = {}
|
||||
this.descriptionaddress = ''
|
||||
this.$store.commit("patient/update_dialog_form_address",true)
|
||||
},
|
||||
thr_search_city: _.debounce( function () {
|
||||
this.$store.dispatch("patient/searchcity",this.search_city)
|
||||
},2000),
|
||||
checkError(value){
|
||||
var errors = this.$store.state.patient.errors
|
||||
if(errors.includes(value)){
|
||||
return true
|
||||
}
|
||||
else{
|
||||
return false
|
||||
}
|
||||
},
|
||||
saveNewAddress(){
|
||||
this.$store.commit("patient/update_errors",[])
|
||||
var errors = this.$store.state.patient.errors
|
||||
if(this.labeladdress === ''){
|
||||
errors.push("requiredlabel")
|
||||
}
|
||||
if(_.isEmpty(this.cityaddress)){
|
||||
errors.push("requiredcity")
|
||||
}
|
||||
if(_.isEmpty(this.districtaddress)){
|
||||
errors.push("requireddistrict")
|
||||
}
|
||||
if(_.isEmpty(this.kelurahanaddress)){
|
||||
errors.push("requiredkelurahan")
|
||||
}
|
||||
if(_.isEmpty(this.descriptionaddress)){
|
||||
errors.push("requireddescription")
|
||||
}
|
||||
|
||||
if(errors.length === 0){
|
||||
var prm = {}
|
||||
prm.M_PatientAddressM_PatientID = this.$store.state.patient.selected_patient.M_PatientID
|
||||
prm.M_PatientName = this.$store.state.patient.selected_patient.M_PatientName
|
||||
prm.M_PatientAddressNote = this.labeladdress
|
||||
prm.M_PatientAddressDescription = this.descriptionaddress
|
||||
prm.M_PatientAddressM_KelurahanID = this.kelurahanaddress.M_KelurahanID
|
||||
this.$store.dispatch("patient/savenewaddress",prm)
|
||||
}
|
||||
},
|
||||
editAddress(value){
|
||||
this.$store.commit("patient/update_act_addr",'edit')
|
||||
this.$store.commit("patient/update_x_addr_id",value.M_PatientAddressID)
|
||||
this.labeladdress = value.M_PatientAddressNote
|
||||
this.oldlabel = value.M_PatientAddressNote
|
||||
this.$store.commit("patient/update_cities",[{M_CityID:value.M_CityID,M_CityName:value.M_CityName}])
|
||||
this.cityaddress = {M_CityID:value.M_CityID,M_CityName:value.M_CityName}
|
||||
this.$store.commit("patient/update_districts",[{M_DistrictID:value.M_DistrictID,M_DistrictName:value.M_DistrictName}])
|
||||
this.districtaddress = {M_DistrictID:value.M_DistrictID,M_DistrictName:value.M_DistrictName}
|
||||
this.$store.commit("patient/update_kelurahans",[{M_KelurahanID:value.M_PatientAddressM_KelurahanID,M_KelurahanName:value.M_KelurahanName}])
|
||||
this.kelurahanaddress = {M_KelurahanID:value.M_PatientAddressM_KelurahanID,M_KelurahanName:value.M_KelurahanName}
|
||||
this.descriptionaddress = value.M_PatientAddressDescription
|
||||
this.$store.commit("patient/update_dialog_form_address",true)
|
||||
},
|
||||
saveEditAddress(){
|
||||
this.$store.commit("patient/update_errors",[])
|
||||
var errors = this.$store.state.patient.errors
|
||||
if(this.labeladdress === ''){
|
||||
errors.push("requiredlabel")
|
||||
}
|
||||
if(this.oldlabel.toLowerCase() === 'utama' && this.labeladdress.toLowerCase() !== 'utama'){
|
||||
errors.push("readonlyutama")
|
||||
}
|
||||
if(_.isEmpty(this.cityaddress)){
|
||||
errors.push("requiredcity")
|
||||
}
|
||||
if(_.isEmpty(this.districtaddress)){
|
||||
errors.push("requireddistrict")
|
||||
}
|
||||
if(_.isEmpty(this.kelurahanaddress)){
|
||||
errors.push("requiredkelurahan")
|
||||
}
|
||||
if(_.isEmpty(this.descriptionaddress)){
|
||||
errors.push("requireddescription")
|
||||
}
|
||||
|
||||
if(errors.length === 0){
|
||||
var prm = {}
|
||||
prm.M_PatientAddressID = this.$store.state.patient.x_addr_id
|
||||
prm.M_PatientAddressM_PatientID = this.$store.state.patient.selected_patient.M_PatientID
|
||||
prm.M_PatientName = this.$store.state.patient.selected_patient.M_PatientName
|
||||
prm.M_PatientAddressNote = this.labeladdress
|
||||
prm.M_PatientAddressDescription = this.descriptionaddress
|
||||
prm.M_PatientAddressM_KelurahanID = this.kelurahanaddress.M_KelurahanID
|
||||
this.$store.dispatch("patient/saveeditaddress",prm)
|
||||
}
|
||||
},
|
||||
deleteAddress(value){
|
||||
this.$store.commit("patient/update_act_addr",'delete')
|
||||
this.$store.commit("patient/update_x_addr_id",value.M_PatientAddressID)
|
||||
this.$store.commit("patient/update_errors",[])
|
||||
this.oldlabel = value.M_PatientAddressNote
|
||||
var errors = this.$store.state.patient.errors
|
||||
if(value.M_PatientAddressNote.toLowerCase() === 'utama'){
|
||||
errors.push("deleteutama")
|
||||
}
|
||||
var msg = ''
|
||||
if(errors.includes("deleteutama")){
|
||||
msg = "Biarkan yang utama tetap ada"
|
||||
}
|
||||
else{
|
||||
msg = "Yakin, akan menghapus data alamat pasien "+value.M_PatientAddressNote+" ?"
|
||||
}
|
||||
|
||||
this.$store.commit("patient/update_msg_confirmation_delete_addr",msg)
|
||||
this.$store.commit("patient/update_dialog_confirmation_delete_addr",true)
|
||||
},
|
||||
doDeleteAddr(){
|
||||
var prm = {}
|
||||
prm.M_PatientAddressID = this.$store.state.patient.x_addr_id
|
||||
prm.M_PatientAddressM_PatientID = this.$store.state.patient.selected_patient.M_PatientID
|
||||
prm.M_PatientName = this.$store.state.patient.selected_patient.M_PatientName
|
||||
prm.M_PatientAddressNote = this.oldlabel
|
||||
this.$store.dispatch("patient/deleteaddress",prm)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
search_city(val,old) {
|
||||
if (val == old ) return
|
||||
if (! val) return
|
||||
if (val.length < 1 ) return
|
||||
if (this.$store.state.patient.update_autocomplete_status == 1 ) return
|
||||
this.thr_search_city()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,183 @@
|
||||
<template>
|
||||
<v-layout class="mb-2" column>
|
||||
<v-card >
|
||||
<v-card-title style="background:#57c492">
|
||||
<v-layout row>
|
||||
<v-flex xs12>
|
||||
<v-text-field
|
||||
color="teal"
|
||||
label="Cari pasien"
|
||||
v-model="xsearch"
|
||||
@keyup.enter="searchPatientTable()"
|
||||
outline
|
||||
hide-details
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="patients"
|
||||
hide-actions
|
||||
class="elevation-1"
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<td class="text-xs-left">{{ props.item.Mcu_PreregisterPatientsPatientName }}</td>
|
||||
<td class="text-xs-center">{{ props.item.dob }}</td>
|
||||
<td class="text-xs-center">{{ props.item.Mcu_PreregisterPatientsGender }}</td>
|
||||
<td class="text-xs-center">{{ props.item.Mcu_PreregisterPatientsNIP }}</td>
|
||||
<td class="text-xs-left">{{ props.item.Mcu_PreregisterPatientsPosisi }}</td>
|
||||
<td class="text-xs-center">
|
||||
<!-- <v-btn small dark v-if="props.item.Mcu_PreregisterPatientsFlagAction === 'N'" @click="goToRegister(props.item)" color="#03989e">DAFTARKAN</v-btn> -->
|
||||
<v-btn small dark v-if="props.item.Mcu_PreregisterPatientsFlagAction === 'R'" color="#57c492">SEDANG DIPROSES</v-btn>
|
||||
<v-btn small disabled v-if="props.item.Mcu_PreregisterPatientsFlagAction === 'S'" color="grey">TELAH SELESAI</v-btn>
|
||||
</td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-pagination style="margin-top:10px;margin-bottom:10px"
|
||||
color="#57c492"
|
||||
:total-visible="15"
|
||||
v-model="curr_page"
|
||||
:length="xtotal_page">
|
||||
</v-pagination>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
table,
|
||||
td,
|
||||
th {
|
||||
border: 0px solid #ddd;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 8px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.mini-input .v-input {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
.mini-input .v-input,
|
||||
.mini-input .v-input--selection-controls,
|
||||
.mini-input .v-input__slot {
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.mini-input .v-messages {
|
||||
min-height: 0px;
|
||||
}
|
||||
|
||||
input.fhm-input {
|
||||
border: 1px solid black;
|
||||
border-radius: 2px;
|
||||
-webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1),
|
||||
0 0 4px rgba(0, 0, 0, 0.1);
|
||||
-moz-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1),
|
||||
0 0 4px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1),
|
||||
0 0 4px rgba(0, 0, 0, 0.1);
|
||||
padding: 2px 4px;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
margin: 0 0 1px 0;
|
||||
width: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data () {
|
||||
return {
|
||||
search: '',
|
||||
pagination: {},
|
||||
selected: [],
|
||||
headers: [
|
||||
{ text: 'NAMA',width:'20%',align:'center',sortable: false},
|
||||
{ text: 'TANGGAL LAHIR',width:'10%',align:'center',sortable: false},
|
||||
{ text: 'JENIS KEL.',width:'10%',align:'center',sortable: false},
|
||||
{ text: 'NIP',width:'10%',align:'center',sortable: false},
|
||||
{ text: 'POSISI',width:'18%',align:'center',sortable: false},
|
||||
{ text: 'STATUS',width:'10%',align:'center',sortable: false}
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
patients() {
|
||||
return this.$store.state.patient.patients
|
||||
},
|
||||
totalpatient() {
|
||||
return this.$store.state.patient.total_patient
|
||||
},
|
||||
curr_page: {
|
||||
get() {
|
||||
return this.$store.state.patient.current_page
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_current_page", val)
|
||||
this.$store.dispatch("patient/search", {
|
||||
search:this.$store.state.patient.search,
|
||||
xid:this.$store.state.patient.data_setup.McuOfflinePrepareID,
|
||||
current_page: val,
|
||||
lastid: -1
|
||||
})
|
||||
}
|
||||
},
|
||||
xtotal_page: {
|
||||
get() {
|
||||
return this.$store.state.patient.total_patient
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_total_patient", val)
|
||||
}
|
||||
},
|
||||
xsearch: {
|
||||
get() {
|
||||
return this.$store.state.patient.search
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_search", val)
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
gotoReg(row) {
|
||||
this.$store.dispatch("patient/gotoreg", row)
|
||||
},
|
||||
goToRegister(row){
|
||||
var prm = this.$store.state.patient.selected_patient_listing
|
||||
var setup = this.$store.state.patient.data_setup
|
||||
var pre_id = row.Mcu_PreregisterPatientsID
|
||||
// var code = setup.McuOfflinePrepareCode
|
||||
location.replace("/one-ui/test/vuex/one-fo-registration-v8/" + "?pre_id=" +pre_id)
|
||||
},
|
||||
searchPatientTable(){
|
||||
this.curr_page = 1
|
||||
this.$store.dispatch("patient/search", {
|
||||
search: this.xsearch,
|
||||
current_page: this.curr_page,
|
||||
xid:this.$store.state.patient.data_setup.McuOfflinePrepareID,
|
||||
lastid: -1
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,559 @@
|
||||
<template>
|
||||
<v-layout class="fill-height" column>
|
||||
<v-dialog
|
||||
v-model="dialog_identifier"
|
||||
width="800"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title
|
||||
class="headline grey lighten-2 pt-2 pb-2"
|
||||
primary-title
|
||||
>
|
||||
GAGAL, KTP DAN TANGGAL LAHIR HARUS BENAR!!!
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-layout align-center row>
|
||||
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
||||
<v-data-table :headers="headers" :items="xidentifer" hide-actions
|
||||
class="elevation-1">
|
||||
<template slot="items" slot-scope="props">
|
||||
<td class="text-xs-left pa-2" v-html="props.item.NAMA"></td>
|
||||
<td class="text-xs-left pa-2" v-html="props.item.KTP"></td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
color="primary"
|
||||
flat
|
||||
@click="dialog_identifier = false"
|
||||
>
|
||||
Tutup
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<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-card color="orange accent-1" class="mb-2 pa-2 searchbox">
|
||||
<v-layout row>
|
||||
<v-flex xs12>
|
||||
<v-card>
|
||||
<v-layout pa-2 row>
|
||||
<v-flex xs12>
|
||||
<v-autocomplete :items="xmgmmcu" v-model="selected_mgmmcu" item-text="mcuName" outline
|
||||
item-value="Mgm_McuID" return-object label="MCU">
|
||||
</v-autocomplete>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider></v-divider>
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-2>
|
||||
<v-card color="orange" dark>
|
||||
<v-card-text>
|
||||
<v-layout align-center row>
|
||||
<v-flex pb-2 xs12>
|
||||
SETUP : {{selected_mgmmcu.Mgm_McuLabel}}
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider dark></v-divider>
|
||||
<v-layout row>
|
||||
<v-flex xs12>
|
||||
<p class="mb-0 caption"> Periode : {{selected_mgmmcu.Mgm_McuStartDate}} - {{selected_mgmmcu.Mgm_McuEndDate}}</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<v-card color="orange accent-1" class="mb-2 pa-2 searchbox">
|
||||
<v-layout pa-1 row>
|
||||
<v-flex class="text-xs-center" xs12>
|
||||
<p class="mb-0 caption">silahkan download template di <span @click="downloadcsv()" style="cursor:pointer" class="info--text lighten-3--text">sini</span></p>
|
||||
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider></v-divider>
|
||||
<v-layout pt-2 pb-1 row>
|
||||
<v-flex class="text-xs-left" xs12>
|
||||
<input accept=".xlsx" type="file" id="csv_file" name="csv_file" class="form-control" @change="loadCSV($event)">
|
||||
<v-progress-circular v-if="loading_save" :indeterminate="true" color="primary"></v-progress-circular>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
|
||||
<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="opendialoginfo = false"></one-dialog-info>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
table.v-table tbody td,table.v-table tbody th {
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
table.v-table thead tr {
|
||||
height: 35px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {
|
||||
'one-dialog-info' : httpVueLoader('../../common/oneDialogInfo.vue'),
|
||||
'one-dialog-alert': httpVueLoader('../../common/oneDialogAlert.vue')
|
||||
},
|
||||
mounted() {
|
||||
//this.setNewSetup()
|
||||
this.$store.dispatch("patient/getmgmmcu")
|
||||
|
||||
},
|
||||
methods: {
|
||||
downloadxapp(){
|
||||
var start = Date.now()
|
||||
location.replace("/install-mcu.zip?tm="+start)
|
||||
},
|
||||
generateSetup(){
|
||||
this.$store.commit("patient/update_patients", [])
|
||||
this.$store.commit("patient/update_total_patients", 0)
|
||||
this.$store.dispatch("patient/generatesetup", {
|
||||
setupcode : this.setupcode
|
||||
})
|
||||
},
|
||||
downloadcsv(){
|
||||
// window.open("./mcu_template.xlsx")
|
||||
window.open("./mcu_template_west.xlsx")
|
||||
},
|
||||
editRow(row){
|
||||
console.log(row)
|
||||
this.$store.commit("patient/update_act", 'edit')
|
||||
this.$store.commit("patient/update_xid", row.McuOfflinePrepareID)
|
||||
this.$store.commit("patient/update_companies", [{id:row.McuOfflinePrepareM_CompanyID,name:row.M_CompanyName}])
|
||||
this.$store.commit("patient/update_company", {id:row.McuOfflinePrepareM_CompanyID,name:row.M_CompanyName})
|
||||
this.$store.commit("patient/update_mous", row.allmous)
|
||||
this.$store.commit("patient/update_mou", {})
|
||||
this.$store.commit("patient/update_selected_mous", row.mous)
|
||||
this.$store.commit("patient/update_selected_doctors", row.doctors)
|
||||
|
||||
this.$store.commit("patient/update_start_date", moment(row.McuOfflinePrepareStartDate).format('YYYY-MM-DD'))
|
||||
this.$store.commit("patient/update_end_date", moment(row.McuOfflinePrepareEndDate).format('YYYY-MM-DD'))
|
||||
},
|
||||
isSelected(p) {
|
||||
return p.M_PatientID == this.$store.state.patient.selected_patient.M_PatientID
|
||||
},
|
||||
searchPatient() {
|
||||
this.$store.dispatch("patient/search", {
|
||||
status: this.status,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
this.$store.commit("patient/update_current_page", 1)
|
||||
},
|
||||
selectMe(pat) {
|
||||
if (this.$store.state.patient.no_save == 0) {
|
||||
this.$store.commit("patient/update_selected_patient", pat)
|
||||
} else {
|
||||
this.$store.commit("patient/update_open_alert_confirmation", true)
|
||||
}
|
||||
},
|
||||
closeAlertConfirmation() {
|
||||
this.$store.commit("patient/update_open_alert_confirmation", false)
|
||||
},
|
||||
forgetAlertConfirmation() {
|
||||
this.$store.commit("patient/update_no_save", 0)
|
||||
this.$store.commit("patient/update_open_alert_confirmation", false)
|
||||
},
|
||||
updateAlert_success(val) {
|
||||
this.$store.commit("patient/update_alert_success", val)
|
||||
},
|
||||
closeDialogSuccess() {
|
||||
let arrpatient = this.$store.state.patient.patients
|
||||
var idx = _.findIndex(arrpatient, item => item.M_PatientID === this.$store.state.patient.last_id)
|
||||
console.log(idx)
|
||||
this.$store.dispatch("patient/search", {
|
||||
status: this.status,
|
||||
current_page: this.curr_page,
|
||||
lastid: idx
|
||||
})
|
||||
this.$store.commit("patient/update_dialog_success", false)
|
||||
},
|
||||
setNewSetup(){
|
||||
this.$store.commit("patient/update_act", 'new')
|
||||
this.$store.commit("patient/update_xid", -1)
|
||||
this.$store.commit("patient/update_company", {})
|
||||
this.$store.commit("patient/update_mous", [])
|
||||
this.$store.commit("patient/update_mou", {})
|
||||
this.$store.commit("patient/update_default_mou", {})
|
||||
this.$store.commit("patient/update_default_doctor", {})
|
||||
this.$store.commit("patient/update_selected_mous", [])
|
||||
this.$store.commit("patient/update_selected_doctors", [])
|
||||
this.$store.commit("patient/update_start_date", moment(new Date()).format('YYYY-MM-DD'))
|
||||
this.$store.commit("patient/update_end_date", moment(new Date()).format('YYYY-MM-DD'))
|
||||
},
|
||||
deleteData(row) {
|
||||
this.$store.commit("patient/update_selected_patient", row)
|
||||
console.log(this.$store.state.patient.selected_patient)
|
||||
let msg = "Yakin, akan menghapus data setup " + this.$store.state.patient.selected_patient.McuOfflinePrepareCode + " ?"
|
||||
this.$store.commit("patient/update_msg_confirmation_delete", msg)
|
||||
this.$store.commit("patient/update_dialog_confirmation_delete", true)
|
||||
},
|
||||
doDeleteData() {
|
||||
var prm = {}
|
||||
prm.id = this.$store.state.patient.selected_patient.McuOfflinePrepareID
|
||||
prm.code = this.$store.state.patient.selected_patient.McuOfflinePrepareCode
|
||||
console.log(prm)
|
||||
this.$store.dispatch("patient/delete", prm)
|
||||
},
|
||||
csvJSON(csv){
|
||||
var vm = this
|
||||
var lines = csv.split("\n")
|
||||
var result = []
|
||||
var headers = lines[0].split(",")
|
||||
vm.parse_header = lines[0].split(",")
|
||||
lines[0].split(",").forEach(function (key) {
|
||||
vm.sortOrders[key] = 1
|
||||
})
|
||||
|
||||
lines.map(function(line, indexLine){
|
||||
if (indexLine < 1) return // Jump header line
|
||||
|
||||
var obj = {}
|
||||
var currentline = line.split(",")
|
||||
|
||||
headers.map(function(header, indexHeader){
|
||||
var header = header.trim();
|
||||
obj[header] = currentline[indexHeader]
|
||||
})
|
||||
|
||||
result.push(obj)
|
||||
})
|
||||
|
||||
result.pop() // remove the last item because undefined values
|
||||
|
||||
return result // JavaScript object
|
||||
},
|
||||
loadCSV_old(e) {
|
||||
var vm = this
|
||||
if (window.FileReader) {
|
||||
var reader = new FileReader();
|
||||
reader.readAsText(e.target.files[0]);
|
||||
// Handle errors load
|
||||
reader.onload = function(event) {
|
||||
var csv = event.target.result;
|
||||
vm.parse_csv = vm.csvJSON(csv)
|
||||
var prm = {xid:vm.$store.state.patient.data_setup.McuOfflinePrepareID,data:vm.parse_csv}
|
||||
console.log(prm)
|
||||
vm.$store.dispatch("patient/savecsv", prm)
|
||||
};
|
||||
reader.onerror = function(evt) {
|
||||
if(evt.target.error.name == "NotReadableError") {
|
||||
alert("Canno't read file !");
|
||||
}
|
||||
};
|
||||
} else {
|
||||
alert('FileReader are not supported in this browser.');
|
||||
}
|
||||
},
|
||||
// Validasi KTP sederhana
|
||||
// cekKTP(nik,tanggal,bulan,tahun) {
|
||||
// if(strlen(nik) != 16){
|
||||
// return false;
|
||||
// }
|
||||
// var d = substr(nik, 6, 2);
|
||||
// var m = substr(nik, 8, 2);
|
||||
// var y = substr(nik, 10, 2);
|
||||
|
||||
// //jika tahun full, ambil 2 digit terakhir
|
||||
// if(strlen(tahun==4)){
|
||||
// tahun = substr(tahun,2,2);
|
||||
// }
|
||||
// if (intval(d) > 40) {
|
||||
// //Wanita
|
||||
// d = intval(d) - 40;
|
||||
// }
|
||||
// if(tanggal/d != 1){
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if(bulan/m != 1){
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if(tahun/y != 1){
|
||||
// return false;
|
||||
// }
|
||||
// //setelah berhasil melewati rintangan, berarti nomornya valid (tidak 100% valid)
|
||||
// return true;
|
||||
// },
|
||||
cekKTP(nik,tanggal,bulan,tahun) {
|
||||
return true;
|
||||
if (nik.length !== 16) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let d = parseInt(nik.substr(6, 2));
|
||||
let m = parseInt(nik.substr(8, 2));
|
||||
let y = parseInt(nik.substr(10, 2));
|
||||
|
||||
// Jika tahun full, ambil 2 digit terakhir
|
||||
if (tahun.toString().length === 4) {
|
||||
tahun = tahun.toString().substr(2, 2);
|
||||
}
|
||||
|
||||
if (d > 40) {
|
||||
// Wanita
|
||||
d = d + 40;
|
||||
}
|
||||
|
||||
if (parseInt(tanggal) !== d) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parseInt(bulan) !== m) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parseInt(tahun) !== y) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Setelah berhasil melewati rintangan, berarti nomornya valid (tidak 100% valid)
|
||||
return true;
|
||||
},
|
||||
loadCSV(e) {
|
||||
var vm = this
|
||||
var files = e.target.files, f = files[0];
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
var data = new Uint8Array(e.target.result);
|
||||
var workbook = XLSX.read(data, {type: 'array',cellText:true,cellDates: true});
|
||||
let sheetName = workbook.SheetNames[0]
|
||||
/* DO SOMETHING WITH workbook HERE */
|
||||
console.log(workbook);
|
||||
let worksheet = workbook.Sheets[sheetName];
|
||||
// console.log(XLSX.utils.sheet_to_json(worksheet));
|
||||
//var xdata = XLSX.utils.sheet_to_json(worksheet,{ raw:false, dateNF: 'FMT 22'})
|
||||
var data_json = []
|
||||
// console.log(xdata)
|
||||
var date_data = XLSX.utils.sheet_to_json(worksheet, {raw:false,dateNF:'22'});
|
||||
var ktp_data = XLSX.utils.sheet_to_json(worksheet, {cellText:true});
|
||||
var error = []
|
||||
// console.log("ktp_data", ktp_data)
|
||||
date_data.forEach(function(entry,iidx) {
|
||||
if(iidx > 0){
|
||||
//entry.TANGGAL_LAHIR = moment(entry.TANGGAL_LAHIR).format('DD-MM-YYYY')
|
||||
// console.log("DD", moment(entry.TANGGAL_LAHIR, 'DD-MM-YYYY').format('DD'));
|
||||
|
||||
// const date = new Date(entry.TANGGAL_LAHIR);
|
||||
// console.log("date",date)
|
||||
var day = moment(entry.TANGGAL_LAHIR, 'DD-MM-YYYY').format('DD');
|
||||
var month = moment(entry.TANGGAL_LAHIR, 'DD-MM-YYYY').format('MM');
|
||||
var year = moment(entry.TANGGAL_LAHIR, 'DD-MM-YYYY').format('YYYY');
|
||||
entry.KTP = ktp_data[iidx].KTP
|
||||
|
||||
// tanggal MCU
|
||||
if (entry.TANGGAL_MCU) {
|
||||
entry.TANGGAL_MCU = moment(entry.TANGGAL_MCU, 'DD-MM-YYYY');
|
||||
}
|
||||
|
||||
if (vm.cekKTP(entry.KTP, day, month, year)) {
|
||||
data_json.push(entry)
|
||||
} else {
|
||||
error.push(entry)
|
||||
}
|
||||
}
|
||||
})
|
||||
var prm = {
|
||||
xid:vm.selected_mgmmcu.Mgm_McuID,
|
||||
corporateID:vm.selected_mgmmcu.Mgm_McuCorporateID,
|
||||
data:data_json}
|
||||
// console.log("data json",data_json)
|
||||
// console.log("data prm",prm)
|
||||
//XLSX.utils.sheet_to_json(ws, {dateNF:"YYYY-MM-DD"})
|
||||
if (error.length != 0) {
|
||||
// console.log("error", error)
|
||||
vm.$store.commit("patient/update_error_identifier", error)
|
||||
vm.dialog_identifier = true
|
||||
} else {
|
||||
// console.log("prm",prm)
|
||||
vm.$store.dispatch("patient/savecsv", prm)
|
||||
}
|
||||
};
|
||||
reader.readAsArrayBuffer(f);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
opendialoginfo: {
|
||||
get() {
|
||||
return this.$store.state.patient.open_dialog_info
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_open_dialog_info",false)
|
||||
}
|
||||
},
|
||||
msginfo: {
|
||||
get() {
|
||||
return this.$store.state.patient.msg_info
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_msg_info",false)
|
||||
}
|
||||
},
|
||||
xidentifer() {
|
||||
return this.$store.state.patient.error_identifier
|
||||
},
|
||||
xmgmmcu() {
|
||||
return this.$store.state.patient.mgmmcu
|
||||
},
|
||||
selected_mgmmcu: {
|
||||
get() {
|
||||
return this.$store.state.patient.selected_mgmmcu
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_selected_mgmmcu", val)
|
||||
}
|
||||
},
|
||||
setupcode: {
|
||||
get() {
|
||||
return this.$store.state.patient.setupcode
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_setupcode", val)
|
||||
}
|
||||
},
|
||||
xsetup() {
|
||||
return this.$store.state.patient.data_setup
|
||||
},
|
||||
dialogconfirmationdelete: {
|
||||
get() {
|
||||
return this.$store.state.patient.dialog_confirmation_delete
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_dialog_confirmation_delete", val)
|
||||
}
|
||||
},
|
||||
msgconfirmationdelete() {
|
||||
return this.$store.state.patient.msg_confirmation_delete
|
||||
},
|
||||
status: {
|
||||
get() {
|
||||
return this.$store.state.patient.status
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_status", val)
|
||||
this.$store.dispatch("patient/search", {
|
||||
status: val,
|
||||
current_page: this.curr_page,
|
||||
lastid: -1
|
||||
})
|
||||
}
|
||||
},
|
||||
dialogsuccess: {
|
||||
get() {
|
||||
return this.$store.state.patient.dialog_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_dialog_success", val)
|
||||
}
|
||||
},
|
||||
msgsuccess() {
|
||||
return this.$store.state.patient.msg_success
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.patient.alert_success
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_alert_success", val)
|
||||
}
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.patient.search_status == 1
|
||||
},
|
||||
openalertconfirmation: {
|
||||
get() {
|
||||
return this.$store.state.patient.open_alert_confirmation
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_open_alert_confirmation", val)
|
||||
}
|
||||
},
|
||||
loading_save: {
|
||||
get() {
|
||||
return this.$store.state.patient.loading_save
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_loading_save", val)
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
filters: {
|
||||
capitalize: function (str) {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1)
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
files: [],
|
||||
dialog_identifier: false,
|
||||
channel_name: '',
|
||||
channel_fields: [],
|
||||
channel_entries: [],
|
||||
parse_header: [],
|
||||
parse_csv: [],
|
||||
sortOrders:{},
|
||||
sortKey: '',
|
||||
statuses:[{id:"N",name:"Belum di download"},{id:"Y",name:"Sudah di download"}],
|
||||
msgalertconfirmation: "Perubahan yang telah dilakukan belum disimpan dong !",
|
||||
items: [],
|
||||
name: '',
|
||||
snorm: '',
|
||||
page: 1,
|
||||
headers: [
|
||||
{
|
||||
text: "NAMA",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "50%",
|
||||
class: "pa-2 deep-orange accent-1 white--text"
|
||||
},
|
||||
{
|
||||
text: "KTP",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "50%",
|
||||
class: "pa-2 deep-orange accent-1 white--text"
|
||||
}
|
||||
],
|
||||
pagination: {
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 5,
|
||||
sortBy: 'M_PatientName',
|
||||
totalItems: this.$store.state.patient.total_patients
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
3
test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.csv
Normal file
3
test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
PID,NAMA,TANGGAL_LAHIR,JENIS_KELAMIN,NIK,JABATAN,EMAIL,HP,LOKASI,JOB,KEDUDUKAN
|
||||
,AA,12-09-2001,P,,GURU,,,,,
|
||||
,BB,14-01-1994,L,12.14.44.55,DIRKEU,,,,,
|
||||
|
BIN
test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.xls
Normal file
BIN
test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.xls
Normal file
Binary file not shown.
BIN
test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.xlsx
Normal file
BIN
test/vuex/cpone-mcu-offline-preregister-v3/csv-mcu.xlsx
Normal file
Binary file not shown.
118
test/vuex/cpone-mcu-offline-preregister-v3/index.php
Normal file
118
test/vuex/cpone-mcu-offline-preregister-v3/index.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<!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 xs3 class="left" fill-height pa-1>
|
||||
<one-md-patient-list></one-md-patient-list>
|
||||
</v-flex>
|
||||
<v-flex xs9 class="right" fill-height pa-1>
|
||||
<one-md-patient-detail></one-md-patient-detail>
|
||||
|
||||
</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>
|
||||
<script src="../../../libs/vendor/sheetjs-master/xlsx.full.min.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;
|
||||
var ts = "?ts=" + Date.now();
|
||||
|
||||
new Vue({
|
||||
store,
|
||||
el: '#app',
|
||||
methods: {
|
||||
tab_selected : function(tab) {
|
||||
return this.$store.state.tab_selected == tab
|
||||
}
|
||||
},
|
||||
|
||||
mounted: function() {
|
||||
|
||||
|
||||
var url_string = window.location.href
|
||||
var url = new URL(url_string);
|
||||
var code = url.searchParams.get("code");
|
||||
|
||||
if (code != null) {
|
||||
this.$store.commit('order/update_setupcode', code)
|
||||
this.$store.commit("patient/update_patients", [])
|
||||
this.$store.commit("patient/update_total_patients", 0)
|
||||
this.$store.commit("patient/update_current_page", 1)
|
||||
this.$store.dispatch("patient/generatesetup", {
|
||||
setupcode : code
|
||||
})
|
||||
}
|
||||
if (!one_token())
|
||||
location.replace('/one-ui/test/vuex/one-login')
|
||||
},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-md-patient-list': httpVueLoader('./components/oneMdPatientList.vue' + ts),
|
||||
'one-md-patient-detail': httpVueLoader('./components/oneMdPatientDetail.vue'),
|
||||
'one-md-patient-address': httpVueLoader('./components/oneMdPatientAddress.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
.left {
|
||||
}
|
||||
.right {
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
BIN
test/vuex/cpone-mcu-offline-preregister-v3/mcu_template.xlsx
Normal file
BIN
test/vuex/cpone-mcu-offline-preregister-v3/mcu_template.xlsx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
796
test/vuex/cpone-mcu-offline-preregister-v3/modules/patient.js
Normal file
796
test/vuex/cpone-mcu-offline-preregister-v3/modules/patient.js
Normal file
@@ -0,0 +1,796 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/patient.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
lookup_status: 0,
|
||||
mgmmcu: [],
|
||||
selected_mgmmcu: {},
|
||||
error_identifier: [],
|
||||
// cpone
|
||||
last_id: -1,
|
||||
last_saved_id: -1,
|
||||
x_addr_id: 0,
|
||||
act: 'edit',
|
||||
act_addr: 'new',
|
||||
get_data_status: 0,
|
||||
search_patient: 0,
|
||||
search_status: 0,
|
||||
search_error_message: '',
|
||||
norm: '',
|
||||
patient_prefix: '',
|
||||
patient_name: '',
|
||||
patient_suffix: '',
|
||||
titles: [],
|
||||
selected_title: {},
|
||||
dob: '',
|
||||
patients: [],
|
||||
total_patients: 0,
|
||||
patient_address: [],
|
||||
sexes: [],
|
||||
selected_sex: {},
|
||||
religions: [],
|
||||
selected_religion: {},
|
||||
phone: '',
|
||||
hp: '',
|
||||
email: '',
|
||||
pob: '',
|
||||
kartuidentitass: [],
|
||||
selected_kartuidentitas: {},
|
||||
noidentitas: '',
|
||||
note: '',
|
||||
nik: '',
|
||||
jabatan: '',
|
||||
kedudukan: '',
|
||||
pj: '',
|
||||
location: '',
|
||||
job: '',
|
||||
total_patient: 0,
|
||||
selected_patient: {},
|
||||
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: "",
|
||||
dialog_confirmation_delete_addr: false,
|
||||
msg_confirmation_delete_addr: "",
|
||||
autocomplete_status: 0,
|
||||
dialog_form_address: false,
|
||||
label_address: '',
|
||||
addresses: [],
|
||||
cities: [],
|
||||
city_address: {},
|
||||
companies:[],
|
||||
company:{},
|
||||
mous:[],
|
||||
mou:{},
|
||||
doctors:[],
|
||||
doctor:{},
|
||||
districts: [],
|
||||
district_address: {},
|
||||
kelurahans: [],
|
||||
kelurahan_address: {},
|
||||
description_address: '',
|
||||
errors: [],
|
||||
current_page:1,
|
||||
autocomplete_status:0,
|
||||
status:{id:"N",name:"Belum di download"},
|
||||
start_date:moment(new Date()).format('YYYY-MM-DD'),
|
||||
end_date:moment(new Date()).format('YYYY-MM-DD'),
|
||||
selected_mous:[],
|
||||
selected_doctors:[],
|
||||
xid:-1,
|
||||
csv_json:[],
|
||||
data_setup:{},
|
||||
default_mu :{},
|
||||
default_doctor:{},
|
||||
setupcode:'',
|
||||
search:'',
|
||||
loading_save:false,
|
||||
open_dialog_info: false,
|
||||
msg_info: ''
|
||||
},
|
||||
mutations: {
|
||||
update_open_dialog_info(state, val) {
|
||||
state.open_dialog_info = val
|
||||
},
|
||||
update_msg_info(state, val) {
|
||||
state.msg_info = val
|
||||
},
|
||||
update_lookup_status(state, val) {
|
||||
state.lookup_status = val
|
||||
},
|
||||
update_mgmmcu(state, val) {
|
||||
state.mgmmcu = val
|
||||
},
|
||||
update_selected_mgmmcu(state, val) {
|
||||
state.selected_mgmmcu = val
|
||||
},
|
||||
update_error_identifier(state, val) {
|
||||
state.error_identifier = val
|
||||
},
|
||||
// cpone
|
||||
update_search(state,val){
|
||||
state.search = val
|
||||
},
|
||||
update_setupcode(state,val){
|
||||
state.setupcode = val
|
||||
},
|
||||
update_default_mu(state,val){
|
||||
state.default_mu = val
|
||||
},
|
||||
update_default_doctor(state,val){
|
||||
state.default_doctor = val
|
||||
},
|
||||
update_data_setup(state,val){
|
||||
state.data_setup = val
|
||||
},
|
||||
update_csv_json(state,val){
|
||||
state.csv_json = val
|
||||
},
|
||||
update_xid(state,val){
|
||||
state.xid = val
|
||||
},
|
||||
update_selected_doctors(state,val){
|
||||
state.selected_doctors = val
|
||||
},
|
||||
update_selected_mous(state,val){
|
||||
state.selected_mous = val
|
||||
},
|
||||
update_companies(state,val){
|
||||
state.companies = val
|
||||
},
|
||||
update_company(state,val){
|
||||
state.company = val
|
||||
},
|
||||
update_mous(state,val){
|
||||
state.mous = val
|
||||
},
|
||||
update_mou(state,val){
|
||||
state.mou = val
|
||||
},
|
||||
update_doctors(state,val){
|
||||
state.doctors = val
|
||||
},
|
||||
update_doctor(state,val){
|
||||
state.doctor = val
|
||||
},
|
||||
update_autocomplete_status(state,val){
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_start_date(state, val) {
|
||||
state.start_date = val
|
||||
},
|
||||
update_end_date(state, val) {
|
||||
state.end_date = val
|
||||
},
|
||||
update_status(state, val) {
|
||||
state.status = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_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_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_patient(state, patient) {
|
||||
state.search_patient = patient
|
||||
},
|
||||
update_dob(state, val) {
|
||||
state.dob = val
|
||||
},
|
||||
update_patient_prefix(state, val) {
|
||||
state.patient_prefix= val
|
||||
},
|
||||
update_patient_name(state, val) {
|
||||
state.patient_name = val
|
||||
},
|
||||
update_patient_suffix(state, val) {
|
||||
state.patient_suffix = val
|
||||
},
|
||||
update_norm(state, val) {
|
||||
state.norm = val
|
||||
},
|
||||
update_titles(state, val) {
|
||||
state.titles = val
|
||||
},
|
||||
update_selected_title(state, val) {
|
||||
state.selected_title = val
|
||||
},
|
||||
update_patients(state, data) {
|
||||
state.patients = data
|
||||
},
|
||||
update_selected_patient(state, val) {
|
||||
state.selected_patient = val
|
||||
},
|
||||
update_sexes(state, val) {
|
||||
state.sexes = val
|
||||
},
|
||||
update_selected_sex(state, val) {
|
||||
state.selected_sex = val
|
||||
},
|
||||
update_religions(state, val) {
|
||||
state.religions = val
|
||||
},
|
||||
update_selected_religion(state, val) {
|
||||
state.selected_religion = val
|
||||
},
|
||||
update_phone(state, val) {
|
||||
state.phone = val
|
||||
},
|
||||
update_email(state, val) {
|
||||
state.email = val
|
||||
},
|
||||
update_pob(state, val) {
|
||||
state.pob = val
|
||||
},
|
||||
update_hp(state, val) {
|
||||
state.hp = val
|
||||
},
|
||||
update_kartuidentitass(state, val) {
|
||||
state.kartuidentitass = val
|
||||
},
|
||||
update_selected_kartuidentitas(state, val) {
|
||||
state.selected_kartuidentitas = val
|
||||
},
|
||||
update_noidentitas(state, val) {
|
||||
state.noidentitas = val
|
||||
},
|
||||
update_note(state, val) {
|
||||
state.note = val
|
||||
},
|
||||
update_nik(state, val) {
|
||||
state.nik = val
|
||||
},
|
||||
update_jabatan(state, val) {
|
||||
state.jabatan = val
|
||||
},
|
||||
update_kedudukan(state, val) {
|
||||
state.kedudukan = val
|
||||
},
|
||||
update_pj(state, val) {
|
||||
state.pj = val
|
||||
},
|
||||
update_location(state, val) {
|
||||
state.location = val
|
||||
},
|
||||
update_job(state, val) {
|
||||
state.job = 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_confirmation_delete(state, val) {
|
||||
state.dialog_confirmation_delete = val
|
||||
},
|
||||
update_msg_confirmation_delete(state, val) {
|
||||
state.msg_confirmation_delete = val
|
||||
},
|
||||
update_dialog_confirmation_delete_addr(state, val) {
|
||||
state.dialog_confirmation_delete_addr = val
|
||||
},
|
||||
update_msg_confirmation_delete_addr(state, val) {
|
||||
state.msg_confirmation_delete_addr = val
|
||||
},
|
||||
update_addresses(state, val) {
|
||||
state.addresses = val
|
||||
},
|
||||
update_autocomplete_status(state, val) {
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_dialog_form_address(state, val) {
|
||||
state.dialog_form_address = val
|
||||
},
|
||||
update_label_address(state, val) {
|
||||
state.label_address = val
|
||||
},
|
||||
update_cities(state, val) {
|
||||
state.cities = val
|
||||
},
|
||||
update_city_address(state, val) {
|
||||
state.city_address = val
|
||||
},
|
||||
update_districts(state, val) {
|
||||
state.districts = val
|
||||
},
|
||||
update_district_address(state, val) {
|
||||
state.district_address = val
|
||||
},
|
||||
update_kelurahans(state, val) {
|
||||
state.kelurahans = val
|
||||
},
|
||||
update_kelurahan_address(state, val) {
|
||||
state.kelurahan_address = val
|
||||
},
|
||||
update_description_address(state, val) {
|
||||
state.description_address = val
|
||||
},
|
||||
update_search_status(state, val) {
|
||||
state.search_status = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_total_patients(state, val) {
|
||||
state.total_patients = val
|
||||
},
|
||||
update_total_patient(state, val) {
|
||||
state.total_patient = val
|
||||
},
|
||||
update_loading_save(state, val) {
|
||||
state.loading_save = val
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async getmgmmcu(context) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
try {
|
||||
var prm = {token: one_token()}
|
||||
let resp = await api.getmgmmcu(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
}
|
||||
context.commit("update_mgmmcu", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_status", 3)
|
||||
}
|
||||
},
|
||||
// cpone
|
||||
|
||||
async generatesetup(context,prm) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.generatesetup(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
|
||||
}
|
||||
console.log(resp.data.records)
|
||||
context.commit("update_data_setup", resp.data.records)
|
||||
context.commit("update_setupcode", '')
|
||||
context.commit("update_current_page", 1)
|
||||
//context.commit("update_patients", data.records['patients'])
|
||||
context.dispatch("search", {
|
||||
search:'',
|
||||
xid:context.state.data_setup.McuOfflinePrepareID,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
}
|
||||
},
|
||||
async search(context, prm) {
|
||||
context.commit("update_search_patient", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
prm.mgm_mcuid = context.state.selected_mgmmcu.Mgm_McuID
|
||||
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.records)
|
||||
context.commit("update_total_patient", data.total)
|
||||
context.commit("update_no_save", 0)
|
||||
|
||||
//context.commit("update_data_setup", resp.data.setup)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getsexreg(context) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
let resp = await api.getsexreg(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_sexes", data.records.sexes)
|
||||
context.commit("update_religions", data.records.religions)
|
||||
context.commit("update_titles", data.records.titles)
|
||||
context.commit("update_kartuidentitass", data.records.kartuidentitass)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
}
|
||||
},
|
||||
async savecsv(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
context.commit("update_loading_save", true)
|
||||
prm.token = one_token()
|
||||
let resp = await api.savecsv(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_open_dialog_info", true)
|
||||
context.commit("update_msg_info", resp.message)
|
||||
} else {
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_save_status", 2)
|
||||
//location.reload()
|
||||
context.dispatch("search", {
|
||||
search:'',
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading_save", false)
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async gotoreg(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.gotoreg(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
var pre_id = prm.Mcu_PreregisterDetailsID
|
||||
location.replace("/one-ui/test/vuex/one-fo-registration-v8/" + "?pre_id=" +pre_id)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async newpatient(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.newpatient(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
console.log(resp.data.id)
|
||||
context.commit("update_last_id", resp.data.id)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Data pasien " + prm.M_PatientName + " sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async delete(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.xdelete(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_last_id", 0)
|
||||
context.commit("update_dialog_confirmation_delete", false)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Data setup " + prm.code + " sudah dihapus dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_company", {})
|
||||
context.commit("update_selected_mous", [])
|
||||
context.commit("update_mou", {})
|
||||
context.commit("update_selected_doctors", [])
|
||||
context.commit("update_start_date", moment(new Date()).format('YYYY-MM-DD'))
|
||||
context.commit("update_end_date", moment(new Date()).format('YYYY-MM-DD'))
|
||||
context.commit("update_default_mou", {})
|
||||
context.commit("update_default_doctor", {})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async getaddress(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.getaddress(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_addresses", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async savesetup(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.savesetup(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_company", {})
|
||||
context.commit("update_selected_mous", [])
|
||||
context.commit("update_mou", {})
|
||||
context.commit("update_selected_doctors", [])
|
||||
context.commit("update_start_date", moment(new Date()).format('YYYY-MM-DD'))
|
||||
context.commit("update_end_date", moment(new Date()).format('YYYY-MM-DD'))
|
||||
context.commit("update_default_mou", {})
|
||||
context.commit("update_default_doctor", {})
|
||||
context.commit("update_dialog_success", true)
|
||||
if(context.state.act === 'new')
|
||||
var msg = "Pembuatan setup nomor " + resp.data.records.xnumber + " sudah berhasil dong ..."
|
||||
else
|
||||
var msg = "Perubahan setup nomor " + resp.data.records.xnumber + " sudah berhasil dong ..."
|
||||
|
||||
context.commit("update_msg_success", msg)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async searchcity(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchcity(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_cities", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchdoctor(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
var xpar = {}
|
||||
xpar.search = prm
|
||||
xpar.token = one_token()
|
||||
let resp= await api.searchdoctor(xpar)
|
||||
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
|
||||
}
|
||||
var arr = resp.data.records
|
||||
var xsel = context.state.selected_doctors
|
||||
var filtered = arr.filter(o1 => xsel.filter(o2 => o2.id === o1.id).length === 0)
|
||||
context.commit("update_doctors",filtered)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
}
|
||||
},
|
||||
async searchcompany(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
|
||||
let resp= await api.searchcompany(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_companies",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
}
|
||||
},
|
||||
async getdistrict(context, prm) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
let resp = await api.getdistrict(one_token(), 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_districts", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
}
|
||||
},
|
||||
async getkelurahan(context, prm) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
let resp = await api.getkelurahan(one_token(), 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_kelurahans", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
}
|
||||
},
|
||||
async savenewaddress(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.savenewaddress(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_dialog_form_address", false)
|
||||
context.commit("update_last_id", prm.M_PatientAddressM_PatientID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Penambahan data alamat pasien " + prm.M_PatientName + " sudah berhasil dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async saveeditaddress(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.saveeditaddress(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_dialog_form_address", false)
|
||||
context.commit("update_last_id", prm.M_PatientAddressM_PatientID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Perubahan data alamat pasien " + prm.M_PatientName + " sudah berhasil dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async deleteaddress(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.deleteaddress(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_dialog_confirmation_delete_addr", false)
|
||||
context.commit("update_last_id", prm.M_PatientAddressM_PatientID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Penghapusan data alamat " + prm.M_PatientAddressNote + " dari pasien " + prm.M_PatientName + " sudah berhasil dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async getmou(context,prm) {
|
||||
context.commit("update_lookup_order",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.getmou(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_order",3)
|
||||
} else {
|
||||
context.commit("update_lookup_order",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_mous",resp.data.records)
|
||||
context.commit("update_mou",{})
|
||||
context.commit("update_selected_mous",[])
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_order",3)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
27
test/vuex/cpone-mcu-offline-preregister-v3/store.js
Normal file
27
test/vuex/cpone-mcu-offline-preregister-v3/store.js
Normal file
@@ -0,0 +1,27 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import patient from "./modules/patient.js";
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
patient: patient,
|
||||
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)
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user