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,164 @@
const URL = "/one-api/mockup/masterdata/accounting/Beginingbalance";
export async function getPeriode(prm) {
try {
var resp = await axios.post(URL + '/getPeriode', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function save(prm) {
try {
var resp = await axios.post(URL + '/save', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function addData(prm) {
try {
var resp = await axios.post(URL + '/addData', 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 + '/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 cek(prm) {
try {
var resp = await axios.post(URL + '/cek', 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 updateData(prm) {
try {
var resp = await axios.post(URL + '/updateData', 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 deleteData(prm) {
try {
var resp = await axios.post(URL + '/delete', 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 searchCoa(prm) {
try {
var resp = await axios.post(URL + '/searchCoa', 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 postData(prm) {
try {
var resp = await axios.post(URL + '/postData', 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
};
}
}

View File

@@ -0,0 +1,347 @@
const URL = "/one-api/mockup/mcuoffline/";
export async function search(prm) {
try {
var resp = await axios.post(URL + 'preregister/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 + 'preregister/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 + 'preregister/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 save(prm) {
try {
var resp = await axios.post(URL + 'preregister/save',prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function newpatient(prm) {
try {
var resp = await axios.post(URL + 'preregister/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 + 'preregister/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 + 'preregister/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 + 'preregister/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 + 'preregister/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 + 'preregister/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 + 'preregister/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 + 'preregister/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 + 'preregister/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 + 'preregister/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 + 'preregister/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 + 'preregister/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 savepreregister(prm) {
try {
var resp = await axios.post(URL + 'preregister/savepreregister',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 + 'preregister/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
};
}
}

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>

View 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,,,,,
1 PID NAMA TANGGAL_LAHIR JENIS_KELAMIN NIK JABATAN EMAIL HP LOKASI JOB KEDUDUKAN
2 AA 12-09-2001 P GURU
3 BB 14-01-1994 L 12.14.44.55 DIRKEU

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,119 @@
<!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> -->
<one-balance></one-balance>
</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-balance': httpVueLoader('./components/oneBalance.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {}
.right {}
</style>
</body>
</html>

View File

@@ -0,0 +1,411 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/balance.js"
export default {
namespaced: true,
state: {
last_id: -1,
loading: false,
cek: false,
dataUpload: [],
status: 'N',
snackbar: {
state: false,
color: 'success',
msg: ''
},
periodeList: [
{
"id": '1', "name": "periode Januari", "periode": '01-01-2024 - 31-01-2024'
},
{
"id": '2', "name": "periode Februari", "periode": '01-02-2024 - 31-02-2024'
}
],
selectedPeriode: {},
data: [
{
"number": '101101001',
"keterangan": 'Bank BCA 742-599-268899',
"value": '1500000',
"type": 'DB',
"input": 1
},
{
"number": '101101002',
"keterangan": 'Bank',
"value": '1500000',
"type": 'CR',
"input": 1
},
],
summary: { debit: "1500000", credit: "1500000", balance: "1500000" },
dialogEdit: false,
dialogImport: false,
dialogAdd: false,
loadingAutocomplete: false,
coaList: [],
selectedCoa: {},
searchCoa: ''
},
mutations: {
update_periodeList(state, val) {
state.periodeList = val
},
update_selectedPeriode(state, val) {
state.selectedPeriode = val
},
update_data(state, val) {
state.data = val
},
update_dialogEdit(state, val) {
state.dialogEdit = val
},
update_dialogImport(state, val) {
state.dialogImport = val
},
update_summary(state, val) {
state.summary = val
},
update_loading(state, val) {
state.loading = val
},
update_cek(state, val) {
state.cek = val
},
update_dataUpload(state, val) {
state.dataUpload = val
},
update_loadingAutocomplete(state, val) {
state.loadingAutocomplete = val
},
update_coaList(state, val) {
state.coaList = val
},
update_selectedCoa(state, val) {
state.selectedCoa = val
},
update_searchCoa(state, val) {
state.searchCoa = val
},
update_dialogAdd(state, val) {
state.dialogAdd = val
},
update_status(state, val) {
state.status = val
},
update_snackbar(state, val) {
state.snackbar = val
},
},
actions: {
async getPeriode(context) {
context.commit("update_loading", true)
try {
let prm = {}
prm.token = one_token()
let resp = await api.getPeriode(prm)
if (resp.status != "OK") {
context.commit("update_loading", false)
} else {
context.commit("update_loading", false)
context.commit("update_periodeList", resp.data)
console.log(resp.data);
}
} catch (e) {
context.commit("update_loading", false)
console.log(e)
}
},
async addData(context, prm) {
context.commit("update_loading", true)
try {
prm.periode = context.state.selectedPeriode;
prm.token = one_token()
let resp = await api.addData(prm)
if (resp.status != "OK") {
context.commit("update_loading", false)
let snackbar = {
state: true,
color: 'error',
msg: resp.message
}
context.commit("update_snackbar", snackbar)
console.log(resp)
} else {
context.commit("update_loading", false)
context.dispatch("search");
context.commit("update_dialogAdd", false)
let snackbar = {
state: true,
color: 'success',
msg: 'Berhasil tambah data'
}
context.commit("update_snackbar", snackbar)
console.log(resp.data);
}
} catch (e) {
context.commit("update_loading", false)
let snackbar = {
state: true,
color: 'error',
msg: 'Error add data'
}
context.commit("update_snackbar", snackbar)
console.log('error add data')
}
},
async save(context, prm) {
context.commit("update_loading", true)
try {
prm.periode = context.state.selectedPeriode;
prm.token = one_token()
let resp = await api.save(prm)
if (resp.status != "OK") {
context.commit("update_loading", false)
let snackbar = {
state: true,
color: 'error',
msg: resp.message
}
context.commit("update_snackbar", snackbar)
console.log(resp)
} else {
context.commit("update_loading", false)
context.dispatch("search");
context.commit("update_dialogImport", false)
let snackbar = {
state: true,
color: 'success',
msg: 'Berhasil simpan data'
}
context.commit("update_snackbar", snackbar)
console.log(resp.data);
}
} catch (e) {
context.commit("update_loading", false)
let snackbar = {
state: true,
color: 'error',
msg: "Error save"
}
context.commit("update_snackbar", snackbar)
console.log(e)
}
},
async postData(context) {
context.commit("update_loading", true)
try {
let prm = {}
prm.token = one_token()
let resp = await api.postData(prm)
if (resp.status != "OK") {
context.commit("update_loading", false)
console.log(resp)
let snackbar = {
state: true,
color: 'error',
msg: resp.message
}
context.commit("update_snackbar", snackbar)
} else {
context.commit("update_loading", false)
context.dispatch("search");
let snackbar = {
state: true,
color: 'success',
msg: 'Berhasil post data'
}
context.commit("update_snackbar", snackbar)
console.log(resp.data);
}
} catch (e) {
context.commit("update_loading", false)
let snackbar = {
state: true,
color: 'error',
msg: "Error post data"
}
context.commit("update_snackbar", snackbar)
console.log(e)
}
},
async search(context) {
context.commit("update_loading", true)
try {
let prm = {}
prm.token = one_token()
let resp = await api.search(prm)
if (resp.status != "OK") {
context.commit("update_loading", false)
console.log(resp)
let snackbar = {
state: true,
color: 'error',
msg: resp.message
}
context.commit("update_snackbar", snackbar)
} else {
console.log(resp);
context.commit("update_loading", false)
context.commit("update_data", resp.data.data)
context.commit("update_summary", resp.data.total)
context.commit("update_selectedPeriode", resp.data.periode)
context.commit("update_status", resp.data.status)
}
} catch (e) {
context.commit("update_loading", false)
let snackbar = {
state: true,
color: 'error',
msg: "Error Search"
}
context.commit("update_snackbar", snackbar)
console.log(e)
}
},
async cek(context) {
context.commit("update_loading", true)
try {
let prm = {}
prm.token = one_token()
let resp = await api.cek(prm)
if (resp.status != "OK") {
context.commit("update_loading", false)
console.log(resp)
} else {
console.log(resp);
context.commit("update_loading", false)
let cek = 0;
if (parseInt(resp.data) > 0) {
cek = true
}
context.commit("update_cek", cek)
}
} catch (e) {
context.commit("update_loading", false)
console.log(e)
}
},
async updateData(context, prm) {
context.commit("update_loading", true)
try {
prm.token = one_token()
let resp = await api.updateData(prm)
if (resp.status != "OK") {
context.commit("update_loading", false)
console.log(resp)
let snackbar = {
state: true,
color: 'error',
msg: resp.message
}
context.commit("update_snackbar", snackbar)
} else {
console.log(resp);
// context.commit("update_loading", false)
// let cek = 0;
// if (parseInt(resp.data) > 0) {
// cek = true
// }
context.dispatch("search")
context.commit("update_dialogEdit", false)
let snackbar = {
state: true,
color: 'success',
msg: 'Berhasil update data'
}
context.commit("update_snackbar", snackbar)
}
} catch (e) {
context.commit("update_loading", false)
let snackbar = {
state: true,
color: 'error',
msg: "Error update data"
}
context.commit("update_snackbar", snackbar)
console.log(e)
}
},
async deleteData(context, prm) {
context.commit("update_loading", true)
try {
prm.token = one_token()
let resp = await api.deleteData(prm)
if (resp.status != "OK") {
context.commit("update_loading", false)
console.log(resp)
let snackbar = {
state: true,
color: 'error',
msg: resp.message
}
context.commit("update_snackbar", snackbar)
} else {
console.log(resp);
// context.commit("update_loading", false)
// let cek = 0;
// if (parseInt(resp.data) > 0) {
// cek = true
// }
let snackbar = {
state: true,
color: 'success',
msg: 'Berhasil hapus data'
}
context.commit("update_snackbar", snackbar)
context.dispatch("search")
// context.commit("update_dialogEdit", false)
}
} catch (e) {
context.commit("update_loading", false)
let snackbar = {
state: true,
color: 'error',
msg: "Error delete data"
}
context.commit("update_snackbar", snackbar)
console.log(e)
}
},
async searchCoa(context) {
context.commit("update_loadingAutocomplete", true)
try {
let prm = {};
prm.search = context.state.searchCoa;
prm.token = one_token()
let resp = await api.searchCoa(prm)
if (resp.status != "OK") {
context.commit("update_loadingAutocomplete", false)
console.log(resp);
} else {
console.log(resp);
context.commit("update_loadingAutocomplete", false)
// let cek = 0;
// if (parseInt(resp.data) > 0) {
// cek = true
// }
context.commit("update_coaList", resp.data)
}
} catch (e) {
context.commit("update_loadingAutocomplete", false)
console.log(e)
}
},
}
}

View File

@@ -0,0 +1,740 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/patient.js"
export default {
namespaced: true,
state: {
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:''
},
mutations: {
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
}
},
actions: {
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()
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 {
prm.token = one_token()
let resp = await api.save(prm)
if (resp.status != "OK") {
context.commit("update_save_status", 3)
} else {
context.commit("update_save_status", 2)
//location.reload()
context.dispatch("search", {
search:'',
xid:context.state.data_setup.McuOfflinePrepareID,
current_page: 1,
lastid: -1
})
}
} catch (e) {
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)
}
},
}
}

View File

@@ -0,0 +1,29 @@
// State
// data ...
// Mutations
//
//
// Actions
import patient from "./modules/patient.js";
import system from "../../../apps/modules/system/system.js";
import balance from "./modules/balance.js";
export const store = new Vuex.Store({
modules: {
// patient: patient,
balance: balance,
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)
}
}
});