add modules folder based on s_menu

This commit is contained in:
2026-06-30 10:16:11 +07:00
parent 315b657ee3
commit a1aab09ac9
625 changed files with 192283 additions and 794 deletions

View File

@@ -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>

View File

@@ -0,0 +1,856 @@
<template>
<div style="width: 100%;" class="">
<v-snackbar
:color="snackbar.color"
v-model="snackbar.state"
:timeout="5000"
top
>
{{ snackbar.msg }}
<v-btn flat @click="snackbar.state = false">
Close
</v-btn>
</v-snackbar>
<v-dialog v-model="dialogAdd" persistent width="500">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
ADD BEGINNING BALANCE
</v-card-title>
<v-card-text>
<v-autocomplete
:search-input.sync="searchCoa"
v-model="selectedCoa"
:items="coaList"
:loading="loadingAutocomplete"
hide-no-data
hide-selected
item-text="display"
label="COA"
placeholder="Start typing desc /number"
outline
return-object
></v-autocomplete>
<v-text-field
type="number"
v-model="debit"
label="Debit"
placeholder="Debit"
outline
></v-text-field>
<v-text-field
type="number"
v-model="credit"
label="Credit"
placeholder="Credit"
outline
></v-text-field>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="error"
:loading="loading"
:disabled="loading"
flat
@click="dialogAdd = false"
>
Cancel
</v-btn>
<v-btn
color="primary"
:loading="loading"
:disabled="loading"
flat
@click="addBegginingBalance()"
>
Simpan
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="dialogImport" persistent width="500">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
UPLOAD FILE BEGINNING BALANCE
</v-card-title>
<v-card-text>
<input
accept=".xlsx"
type="file"
id="csv_file"
name="csv_file"
class="form-control"
:disabled="loadingCsv || loading"
@input="loadCSV($event)"
/>
<div v-if="loadingCsv">
<v-progress-circular
indeterminate
v-if="loadingCsv"
color="primary"
></v-progress-circular>
load file
</div>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="error"
:loading="loading || loadingCsv"
:disabled="loading || loadingCsv"
flat
@click="resetInputFile()"
>
Cancel
</v-btn>
<v-btn
color="primary"
:loading="loading || loadingCsv"
:disabled="loading || loadingCsv"
flat
@click="upload()"
>
Upload
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="dialogEdit" persistent width="500">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
{{ selectedData.keterangan }}
</v-card-title>
<v-card-text>
<v-text-field
readonly
v-model="selectedData.number"
label="No. Account"
placeholder="No. Account"
outline
></v-text-field>
<v-text-field
type="number"
v-model="debit"
label="Debit"
placeholder="Debit"
outline
></v-text-field>
<v-text-field
type="number"
v-model="credit"
label="Credit"
placeholder="Credit"
outline
></v-text-field>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="error"
:loading="loading"
:disabled="loading"
flat
@click="dialogEdit = false"
>
Tutup
</v-btn>
<v-btn
color="primary"
:loading="loading"
:disabled="loading"
flat
@click="editData()"
>
Simpan
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-toolbar dark color="primary">
<v-toolbar-title class="white--text">BEGINNING BALANCE</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn
v-if="btnUpload && status==='N'"
@click="dialogImport = true"
flat
icon
color="white"
>
<v-icon v-if="btnUpload">
file_upload
</v-icon>
</v-btn>
<v-btn
v-if="btnUpload && status==='N'"
@click="openDialogAdd()"
flat
icon
color="white"
>
<v-icon>add_box</v-icon>
</v-btn>
<v-btn
@click="postData()"
v-if="btnUpload && status==='N' && data.length >0"
color="orange"
>POST DATA</v-btn
>
</v-toolbar>
<v-card class="pa-2">
<v-autocomplete
v-model="selectedPeriode"
:items="periodeList"
outline
hide-details
color="blue"
label="Periode"
item-text="name"
return-object
>
<template v-slot:item="data">
<template>
<v-list-tile-content>
<v-list-tile-title v-html="data.item.name"></v-list-tile-title>
<v-list-tile-sub-title
v-html="data.item.periode"
></v-list-tile-sub-title>
</v-list-tile-content>
</template>
</template>
</v-autocomplete>
</v-card>
<v-card class="pa-2 mt-2">
<v-layout align-center justify-space-between row fill-height class="mb-2">
<div style="width: 300px;">
<v-text-field
v-model="searchTable"
prepend-icon="search"
label="cari"
single-line
hide-details
></v-text-field>
</div>
<div class="pa-1">
Download template
<v-btn @click="download()" flat icon color="primary">
<v-icon class="">
file_download
</v-icon>
</v-btn>
<!-- <v-spacer></v-spacer> -->
</div>
</v-layout>
<div style="height: 54vh; overflow-y: scroll;">
<v-data-table
:headers="headers"
hide-actions
:loading="loading"
:items="data"
class="elevation-1"
:search="searchTable"
:custom-filter="filterItemsObj"
>
<!-- :filter="filterItems" -->
<template v-slot:items="props">
<tr>
<td>{{ props.item.number }}</td>
<td>{{ props.item.keterangan }}</td>
<td>
<div v-if="props.item.type ==='DB'">
{{ formatCurrency(props.item.value) }}
</div>
<div v-else>
Rp. 0,00
</div>
</td>
<td>
<div v-if="props.item.type ==='CR'">
{{ formatCurrency(props.item.value) }}
</div>
<div v-else>
Rp. 0,00
</div>
</td>
<td class="justify-center layout px-0">
<v-icon
v-if="status==='N'"
small
class="mr-2"
@click="openDialogEdit(props.item)"
>
edit
</v-icon>
<v-icon
v-if="status==='N'"
small
@click="deleteData(props.item)"
>
delete
</v-icon>
</td>
</tr>
</template>
<!-- <template v-slot:footer>
<tr>
<td colspan="2" class="font-weight-bold">Total</td>
<td class="font-weight-bold">
{{ formatCurrency(summary.debit) }}
</td>
<td class="font-weight-bold">
{{ formatCurrency(summary.credit) }}
</td>
</tr>
<tr>
<td colspan="3" class="font-weight-bold">Balance</td>
<td>
<div class="d-flex text-right font-weight-bold">
<v-spacer></v-spacer> {{ formatCurrency(summary.balance) }}
</div>
</td>
</tr>
</template> -->
</v-data-table>
</div>
<v-divider></v-divider>
<v-data-table
:headers="headers"
hide-actions
:loading="loading"
hide-headers
:items="data"
class="elevation-1"
>
<template v-slot:items="props">
<tr></tr>
</template>
<template v-slot:footer>
<tr>
<td width="50%" class="font-weight-bold">Total</td>
<td width="20%" class="font-weight-bold">
{{ formatCurrency(summary.debit) }}
</td>
<td width="20%" class="font-weight-bold">
{{ formatCurrency(summary.credit) }}
</td>
<td width="10%" class="font-weight-bold"></td>
</tr>
<tr>
<td width="70%" colspan="2" class="font-weight-bold">Balance</td>
<td width="20%">
<div class="d-flex text-right font-weight-bold">
<v-spacer></v-spacer> {{ formatCurrency(summary.balance) }}
</div>
</td>
<td width="10%" class="font-weight-bold"></td>
</tr>
</template>
</v-data-table>
</v-card>
</div>
</template>
<style scoped></style>
<script>
module.exports = {
mounted() {
// this.formatCurrency(10000);
this.$store.dispatch("balance/getPeriode");
this.$store.dispatch("balance/search");
},
data: () => ({
loadingCsv: false,
search_city: "",
oldlabel: "",
selectedData: {},
debit: 0,
credit: 0,
btnUpload: false,
searchTable: "",
headers: [
{
text: "NO. ACCOUNT",
align: "left",
sortable: false,
value: "action",
width: "10%",
class: "pa-2 pl-2 blue lighten-3 white--text",
},
{
text: "KETERANGAN",
align: "left",
sortable: false,
value: "mr",
width: "40%",
class: "pa-2 blue lighten-3 white--text",
},
{
text: "DEBIT",
align: "left",
sortable: false,
value: "lab",
width: "20%",
class: "pa-2 blue lighten-3 white--text",
},
{
text: "KREDIT",
align: "left",
sortable: false,
value: "lab",
width: "20%",
class: "pa-2 blue lighten-3 white--text",
},
{
text: "ACTION",
align: "left",
sortable: false,
value: "lab",
width: "10%",
class: "pa-2 blue lighten-3 white--text",
},
],
}),
computed: {
selectedPeriode: {
get() {
return this.$store.state.balance.selectedPeriode;
},
set(val) {
this.$store.commit("balance/update_selectedPeriode", val);
},
},
snackbar: {
get() {
return this.$store.state.balance.snackbar;
},
set(val) {
this.$store.commit("balance/update_snackbar", val);
},
},
status: {
get() {
return this.$store.state.balance.status;
},
set(val) {
this.$store.commit("balance/update_status", val);
},
},
data: {
get() {
return this.$store.state.balance.data;
},
set(val) {
this.$store.commit("balance/update_data", val);
},
},
dialogEdit: {
get() {
return this.$store.state.balance.dialogEdit;
},
set(val) {
this.$store.commit("balance/update_dialogEdit", val);
},
},
dialogImport: {
get() {
return this.$store.state.balance.dialogImport;
},
set(val) {
this.$store.commit("balance/update_dialogImport", val);
},
},
dataUpload: {
get() {
return this.$store.state.balance.dataUpload;
},
set(val) {
this.$store.commit("balance/update_dataUpload", val);
},
},
loading: {
get() {
return this.$store.state.balance.loading;
},
set(val) {
this.$store.commit("balance/update_loading", val);
},
},
loadingAutocomplete: {
get() {
return this.$store.state.balance.loadingAutocomplete;
},
set(val) {
this.$store.commit("balance/update_loadingAutocomplete", val);
},
},
selectedCoa: {
get() {
return this.$store.state.balance.selectedCoa;
},
set(val) {
this.$store.commit("balance/update_selectedCoa", val);
},
},
searchCoa: {
get() {
return this.$store.state.balance.searchCoa;
},
set(val) {
this.$store.commit("balance/update_searchCoa", val);
},
},
dialogAdd: {
get() {
return this.$store.state.balance.dialogAdd;
},
set(val) {
this.$store.commit("balance/update_dialogAdd", val);
},
},
periodeList() {
return this.$store.state.balance.periodeList;
},
summary() {
return this.$store.state.balance.summary;
},
coaList() {
return this.$store.state.balance.coaList;
},
},
methods: {
postData() {
if (parseInt(this.summary.balance) !== 0) {
alert("Balance tidak sama dengan 0, tidak bisa post data !!");
return;
}
let cek = confirm(
"Apakah anda yakin konfirmasi data beginning balance yang sudah ada ? \n\n *setelah post/konfirmasi data tidak bisa diedit lagi"
);
if (cek) {
this.$store.dispatch("balance/postData");
}
},
filterItems(val, search) {
return (
val.keterangan.includes(search.toLowerCase()) ||
val.number.includes(search.toLowerCase())
);
},
filterItemsObj(items, search, filterBawaan) {
const result = items.filter(
(e) =>
e.keterangan.toLowerCase().includes(search.toLowerCase()) ||
e.number.toLowerCase().includes(search.toLowerCase())
);
return result;
},
download() {
// window.open("/one-api/mockup/cpone-nonlab-upload-document/patient/downloadfile/" + name, '_self')
// window.location = "/one-api/mockup/cpone-nonlab-upload-document/patient/downloadfile/" + name;
// `/one-api/mockup/cpone-nonlab-upload-document/patient/downloadfile/${name}`
fetch(
"/birt/run?__report=report/one/acc/sp_rpt_acc_002.rptdesign&__format=xlsx&username=admin"
)
.then((response) => {
if (!response.ok) throw new Error("Network response was not ok");
return response.blob();
})
.then((blob) => {
const url = window.URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "Template_beginning_balance");
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
})
.catch((error) => {
console.error("Error downloading file:", error);
});
},
addBegginingBalance() {
this.loading = true;
let prm = {
data: [
{
Number: this.selectedCoa.number,
Keterangan: this.selectedCoa.keterangan,
Debit: this.debit,
Kredit: this.credit,
},
],
};
this.$store.dispatch("balance/addData", prm);
},
openDialogAdd() {
this.selectedCoa = {};
this.debit = 0;
this.credit = 0;
this.searchCoa = "";
this.dialogAdd = true;
},
isObjectEmpty(val) {
let obj = val;
return Object.keys(obj).length === 0 && obj.constructor === Object;
},
isPeriodeEmpty() {
return Object.keys(this.selectedPeriode).length === 0;
},
openDialogEdit(val) {
if (this.loading) {
return;
}
if (this.status == "P") {
return;
}
this.selectedData = val;
if (val.type == "DB") {
this.debit = val.value;
this.credit = 0;
}
if (val.type == "CR") {
this.credit = val.value;
this.debit = 0;
}
this.dialogEdit = true;
},
editData() {
// debugger;
if (this.loading) {
return;
}
if (this.status == "P") {
return;
}
let type = "DB";
let value = 0;
if (
this.debit.toString().trim() === "" &&
this.credit.toString().trim() === ""
) {
alert("Debit dan kredit tidak boleh kosong");
return;
}
if (parseFloat(this.debit) > 0 && parseFloat(this.credit) > 0) {
alert("Debit dan kredit tidak boleh lebih besar dari 0");
return;
}
if (parseFloat(this.debit) < 0 && parseFloat(this.credit) < 0) {
alert("Debit dan kredit tidak boleh kurang dari 0");
return;
}
if (parseFloat(this.debit) > 0 && parseFloat(this.credit) === 0) {
type = "DB";
}
if (parseFloat(this.debit) === 0 && parseFloat(this.credit) > 0) {
type = "CR";
}
if (type == "DB") {
value = this.debit;
}
if (type == "CR") {
value = this.credit;
}
let prm = {
data: {
id: this.selectedData.id,
type: type,
value: value,
},
};
this.$store.dispatch("balance/updateData", prm);
console.log(prm);
},
formatCurrency(val) {
// Format the price above to USD using the locale, style, and currency.
let price = parseFloat(val);
let USDollar = new Intl.NumberFormat("id-ID", {
style: "currency",
currency: "IDR",
});
// console.log(
// `The formated version of ${price} is ${USDollar.format(price)}`
// );
return `${USDollar.format(price)}`;
},
loadCSV(e) {
this.loadingCsv = true;
// debugger;
var vm = this;
var files = e.target.files,
f = files[0];
var reader = new FileReader();
let error = [];
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,
});
//console.log(zdata)
date_data.forEach(function (entry, iidx) {
if (entry.Number === undefined) {
error.push("Kolom Number tidak ditemukan ");
}
if (entry.Keterangan === undefined) {
error.push("Kolom Keterangan tidak ditemukan ");
}
if (entry.Debit === undefined) {
error.push("Debit tidak ditemukan / kosong");
}
if (entry.Kredit === undefined) {
error.push("Kredit tidak ditemukan /kosong");
}
if (entry.Number === "" || entry.Number === undefined) {
error.push("No. Account/Number tidak boleh kosong ");
}
if (entry.Keterangan === "" || entry.Keterangan === undefined) {
error.push("Keterangan tidak boleh kosong ");
}
if (entry.Debit === "") {
error.push("Debit tidak boleh kosong ");
}
if (entry.Kredit === "") {
error.push("Kredit tidak boleh kosong ");
}
if (parseFloat(entry.Debit) > 0 && parseFloat(entry.Kredit) > 0) {
error.push(
entry.Number + " Kredit dan debit jumlahnya lebih besar dari 0 "
);
}
data_json.push(entry);
});
// var prm = {
// xid: vm.$store.state.patient.data_setup.McuOfflinePrepareID,
// data: data_json,
// };
console.log(data_json);
console.log(error);
if (error.length > 0) {
let msg = error.join(",\n");
alert(msg);
vm.loadingCsv = false;
document.getElementById("csv_file").value = null;
return;
}
console.log(data_json);
let prm = {
data: data_json,
};
vm.dataUpload = data_json;
// setTimeout(() => {
// console.log("Bam! 5 seconds have passed.");
// }, 5000);
vm.loadingCsv = false;
// vm.$store.dispatch("balance/save", prm);
// console.log(data_json);
//XLSX.utils.sheet_to_json(ws, {dateNF:"YYYY-MM-DD"})
// vm.$store.dispatch("patient/savecsv", prm);
};
reader.readAsArrayBuffer(f);
},
resetInputFile() {
document.getElementById("csv_file").value = null;
this.dialogImport = false;
},
upload() {
// this.loading = true;
let prm = {
data: this.dataUpload,
};
if (this.data.length > 0) {
if (
confirm(
"Apakah anda yakin import document ? \n *import document akan menghapus data yang sudah ada"
)
) {
this.$store.dispatch("balance/save", prm);
}
} else {
this.$store.dispatch("balance/save", prm);
}
},
deleteData(val) {
console.log(val);
let cek = confirm(
"Apakah anda yakin untuk menghapus data berikut " +
val.number +
" " +
val.keterangan
);
if (cek) {
let prm = {
id: val.id,
};
this.$store.dispatch("balance/deleteData", prm);
}
},
},
watch: {
selectedPeriode(val, old) {
if (Object.keys(val).length === 0) {
this.btnUpload = false;
} else {
this.btnUpload = true;
}
},
searchCoa(val, old) {
if (val == old) return;
if (!val) return;
if (val.length < 1) return;
this.$store.dispatch("balance/searchCoa");
},
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>

View File

@@ -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>

View File

@@ -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_PreregisterDetailsPatientName }}</td>
<td class="text-xs-center">{{ props.item.dob }}</td>
<td class="text-xs-center">{{ props.item.Mcu_PreregisterDetailsM_SexCode }}</td>
<td class="text-xs-center">{{ props.item.Mcu_PreregisterDetailsNIK }}</td>
<td class="text-xs-left">{{ props.item.Mcu_PreregisterDetailsJabatan }}</td>
<td class="text-xs-center">
<v-btn small dark v-if="props.item.Mcu_PreregisterDetailsFlagAction === 'N'" @click="goToRegister(props.item)" color="#03989e">DAFTARKAN</v-btn>
<v-btn small dark v-if="props.item.Mcu_PreregisterDetailsFlagAction === 'R'" color="#57c492">SEDANG DIPROSES</v-btn>
<v-btn small disabled v-if="props.item.Mcu_PreregisterDetailsFlagAction === '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: 'NIK',width:'10%',align:'center',sortable: false},
{ text: 'JABATAN',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_PreregisterDetailsID
var code = setup.McuOfflinePrepareCode
location.replace("/one-ui/test/vuex/one-fo-registration-v8/" + "?pre_id=" +pre_id+"&code="+code)
},
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>

View File

@@ -0,0 +1,543 @@
<template>
<v-layout class="fill-height" column>
<v-dialog v-model="dialogsuccess" persistent max-width="290">
<v-card>
<v-card-title color="success" class="headline">Berhasil !</v-card-title>
<v-card-text>
{{ msgsuccess }}
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="green darken-1" flat @click="closeDialogSuccess"
>OK</v-btn
>
</v-card-actions>
</v-card>
</v-dialog>
<v-card color="orange accent-1" class="mb-2 pa-2 searchbox">
<v-layout row>
<v-flex xs12>
<v-card>
<v-layout pa-1 row>
<v-flex class="text-xs-center pa-2" xs9>
<v-text-field
color="orange"
label="KODE SETUP"
placeholder="Masukkan kode setup"
v-model="setupcode"
outline
hide-details
></v-text-field>
</v-flex>
<v-flex class="text-xs-left pa-2" xs3>
<v-btn
@click="generateSetup()"
title="generate"
style="min-width: 30px; min-height: 25px;"
color="orange"
dark
>
<v-icon>system_update_alt</v-icon>
</v-btn>
</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 : {{ xsetup.McuOfflinePrepareCode }}
</v-flex>
</v-layout>
<v-divider dark></v-divider>
<v-layout pt-2 align-center row>
<v-flex xs12>
{{ xsetup.M_CompanyName }}
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs12>
<p class="mb-0 caption">
Periode : {{ xsetup.start_date }} -
{{ xsetup.end_date }}
</p>
</v-flex>
</v-layout>
</v-card-text>
</v-card>
</v-flex>
</v-layout>
<v-divider></v-divider>
<v-layout row>
<v-flex xs12 pa-2>
<v-card>
<v-layout row>
<v-flex xs12>
<v-subheader
class="pl-3 white--text"
style="background: #ff9800;"
>AGREEMENT</v-subheader
>
</v-flex>
</v-layout>
<v-card-text>
<v-layout align-center wrap>
<v-flex pb-2 xs12>
<v-card
dark
class="mb-1"
v-if="xsetup && xsetup.agreements.length > 0"
v-for="agreement in xsetup.agreements"
color="orange"
>
<v-layout wrap>
<v-flex pa-2 xs12 text-xs-center
><p style="font-size: 12px;" class="mb-0">
{{ agreement.name }}
</p></v-flex
>
</v-layout>
</v-card>
</v-flex>
</v-layout>
</v-card-text>
</v-card>
</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 xs5>
JANJI HASIL
</v-flex>
<v-flex text-xs-right xs7>
<p class="mb-0">
{{ xsetup.promise_date }} {{ xsetup.promise_time }}
</p>
</v-flex>
</v-layout>
</v-card-text>
</v-card>
</v-flex>
</v-layout>
<v-layout row>
<v-flex pa-2 xs12>
<v-btn block @click="downloadxapp()" class="" color="info"
>download</v-btn
>
</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-flex>
</v-layout>
</v-card>
<one-dialog-alert
:status="openalertconfirmation"
:msg="msgalertconfirmation"
@forget-dialog-alert="forgetAlertConfirmation()"
@close-dialog-alert="closeAlertConfirmation()"
></one-dialog-alert>
</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()
},
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("./csv-mcu.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.");
}
},
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,
});
//console.log(zdata)
date_data.forEach(function (entry, iidx) {
if (iidx > 0) {
//entry.TANGGAL_LAHIR = moment(entry.TANGGAL_LAHIR).format('DD-MM-YYYY')
entry.KTP = ktp_data[iidx].KTP;
data_json.push(entry);
}
});
var prm = {
xid: vm.$store.state.patient.data_setup.McuOfflinePrepareID,
data: data_json,
};
console.log(data_json);
//XLSX.utils.sheet_to_json(ws, {dateNF:"YYYY-MM-DD"})
// vm.$store.dispatch("patient/savecsv", prm);
};
reader.readAsArrayBuffer(f);
},
},
computed: {
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);
},
},
},
filters: {
capitalize: function (str) {
return str.charAt(0).toUpperCase() + str.slice(1);
},
},
data() {
return {
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: "KODE",
align: "left",
sortable: false,
value: "mr",
width: "20%",
class: "pa-2 deep-orange accent-1 white--text",
},
{
text: "KEL. PELANGGAN",
align: "left",
sortable: false,
value: "lab",
width: "55%",
class: "pa-2 deep-orange accent-1 white--text",
},
{
text: "AKSI",
align: "left",
sortable: false,
value: "lab",
width: "15%",
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>