Initial import

This commit is contained in:
sas.fajri
2026-05-25 20:01:37 +07:00
commit 710d7c1b97
10371 changed files with 2381698 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
// http://devkedungdororaya.aplikasi.web.id/one-api/v1/courier/mdcourier/search
const URL = "/one-api/v1/courier/mdcourier/";
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 add(prm) {
try {
var resp = await axios.post(URL + 'add', 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
};
}
}

View File

@@ -0,0 +1,93 @@
const URL = "/one-api/v1/masterdata/publicholiday/";
// https://devbandungraya.aplikasi.web.id/one-api/v1/masterdata/publicholiday/gettype
export async function gettype(prm) {
try {
var resp = await axios.post(URL + 'gettype', 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 add(prm) {
try {
var resp = await axios.post(URL + 'add', 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 edit(prm) {
try {
var resp = await axios.post(URL + 'edit', 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 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
};
}
}

View File

@@ -0,0 +1,74 @@
// http://devbandungraya.aplikasi.web.id/one-api/mockup/injectprice/injectprice/getCompany/
const URL = "/one-api/mockup/injectprice/injectprice/";
export async function getCompany(prm) {
try {
var resp = await axios.post(URL + 'getCompany', 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 + '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 getTest(prm) {
try {
var resp = await axios.post(URL + 'getTest', prm);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
return resp.data;
} catch (e) {
return {
status: "ERR",
message: e.message
};
}
}
export async function inject(prm) {
try {
var resp = await axios.post(URL + 'inject', 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,292 @@
<template>
<v-layout class="fill-height" column>
<!-- Alert dialog -->
<v-dialog v-model="dialog_delete" persistent max-width="290">
<v-card>
<!-- <v-card-title class="headline">Peringatan</v-card-title> -->
<v-card-text>
Apakah yakin anda akan membatalkan staff "{{ selected.staffName }}"
sebagai kurir ?</v-card-text
>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="green darken-1" flat @click="dialog_delete = false"
>tidak</v-btn
>
<v-btn color="red darken-1" flat @click="delete_kurir">Ya</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- End alert dialog -->
<!-- Snackbar -->
<v-snackbar
v-model="snackbar"
:timeout="5000"
:multi-line="false"
:vertical="false"
:top="true"
color="success"
:value="snackbar"
>
{{ snackbar_msg }}
<v-btn flat @click="snackbar = false"> Tutup </v-btn>
</v-snackbar>
<!-- End Snackbar -->
<!-- ERROR DIALOG -->
<v-dialog v-model="error_dialog" max-width="500px">
<v-card>
<v-card-title>
<span>ERROR !</span>
<v-spacer></v-spacer>
</v-card-title>
<v-divider></v-divider>
<div class="ma-3 red--text">{{ error_msg }}</div>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" flat @click="error_dialog = false"
>Close</v-btn
>
</v-card-actions>
</v-card>
</v-dialog>
<!-- END ERROR DIALOG -->
<v-card class="mb-2 pa-2 searchbox">
<v-layout>
<v-flex xs6>
<v-text-field
class="xs3 ma-1 mini-select"
v-model="name"
style="font-size: 14px;"
label="Cari"
placeholder="Masukkan nama atau username"
outline
hide-details
></v-text-field>
</v-flex>
</v-layout>
</v-card>
<v-card>
<v-layout align-center row>
<v-flex
xs12
pl-2
style="max-height: 600px; overflow: auto;"
pr-2
pt-2
pb-2
>
<v-data-table
:headers="headers"
:items="couriers"
:loading="isLoading"
hide-actions
class="elevation-1"
>
<template v-slot:items="props">
<td class="text-xs-left pa-2">{{ props.item.staffName }}</td>
<td class="text-xs-left pa-2">{{ props.item.username }}</td>
<td class="text-xs-center pa-2 d-flex justify-content-center">
<v-flex justify-center>
<v-checkbox
v-model="isCourier"
:disabled="isLoading"
@click="changeCourir(props.item.userID, props.item.staffID, props.item.courierID ?? 'new', props.item)"
:value="props.item.userID ?? 'new'"
></v-checkbox>
</v-flex>
</td>
</template>
</v-data-table>
<v-divider></v-divider>
<v-layout>
<v-flex>
<v-pagination
style="margin-top: 10px; margin-bottom: 10px;"
v-model="curr_page"
:length="total_page"
>
</v-pagination>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-card>
</v-layout>
</template>
<style scoped>
.searchbox .v-input.v-text-field .v-input__slot {
min-height: 60px;
}
.searchbox .v-btn {
min-height: 60px;
}
table.v-table tbody td,
table.v-table tbody th {
height: 40px;
}
table.v-table thead tr {
height: 40px;
}
</style>
<script>
module.exports = {
data() {
return {
//dropdown courier
dialog_delete: false,
selected: {},
headers: [
{
text: "NAMA",
align: "left",
sortable: false,
value: "mr",
width: "50%",
class: "text-xs-left pa-2 blue-grey white--text",
},
{
text: "USERNAME",
align: "left",
sortable: false,
value: "mr",
width: "45%",
class: "text-xs-left pa-2 blue-grey white--text",
},
{
text: "AKSI",
align: "center",
sortable: false,
value: "lab",
width: "5%",
class: "text-xs-center pa-2 blue-grey white--text",
},
],
};
},
mounted() {
this.$store.dispatch("courier/search");
},
computed: {
name: {
get() {
return this.$store.state.courier.name;
},
set(val) {
this.$store.commit("courier/update_name", val);
},
},
curr_page: {
get() {
return this.$store.state.courier.curr_page;
},
set(val) {
this.$store.commit("courier/update_curr_page", val);
this.$store.dispatch("courier/search");
},
},
isCourier: {
get() {
return this.$store.state.courier.is_courier;
},
// set(val) {
// console.log("valllll :" + val)
// // this.$store.commit("courier/update_is_courier", val)
// }
},
couriers() {
return this.$store.state.courier.couriers;
},
isLoading() {
return this.$store.state.courier.loading;
},
total_page: {
get() {
return this.$store.state.courier.total;
},
set(val) {
this.$store.commit("courier/update_total", val);
},
},
snackbar: {
get() {
return this.$store.state.courier.snackbar;
},
set(val) {
this.$store.commit("courier/update_snackbar", val);
},
},
error_dialog: {
get() {
return this.$store.state.courier.error_dialog;
},
set(val) {
this.$store.commit("courier/update_error_dialog", val);
},
},
snackbar_msg() {
return this.$store.state.courier.snackbar_msg;
},
error_msg() {
return this.$store.state.courier.error_message;
},
},
methods: {
changeCourir(userID, staffID, type, data) {
this.selected = data;
console.log("change courier" + userID + " " + staffID);
var tempCourrier = JSON.stringify(this.isCourier);
var arrCourier = JSON.parse(tempCourrier);
console.log(type);
if (type !== "new") {
this.dialog_delete = true;
// console.log("hapus kurir");
// this.$store.dispatch("courier/deleteData", {
// "courierID": type
// });
// arrCourier.filter((e) => e === type);
} else {
var validation = arrCourier.includes(userID);
if (!validation) {
this.$store.dispatch("courier/add", {
staffID: staffID,
userID: userID,
});
console.log("add kurir");
arrCourier.push(userID);
}
}
console.log(arrCourier);
this.$store.commit("courier/update_is_courier", arrCourier);
this.$store.dispatch("courier/search");
},
delete_kurir() {
console.log("hapus kurir");
this.$store.dispatch("courier/deleteData", {
courierID: this.selected.courierID,
});
this.dialog_delete = false;
},
thr_search: _.debounce(function () {
this.$store.dispatch("courier/search");
}, 1000),
},
watch: {
name(val, old) {
this.name = val;
this.thr_search();
},
},
};
</script>

View File

@@ -0,0 +1,992 @@
<template>
<v-layout class="fill-height" column>
<!-- Alert dialog -->
<v-dialog v-model="dialogForm" persistent max-width="500">
<v-card>
<v-card-title class="headline">FORM</v-card-title>
<v-card-text>
<v-text-field
class="xs3 mb-3 mini-select"
v-model="name"
:disabled="isLoading"
style="font-size: 14px;"
label="Nama"
placeholder="Masukkan nama"
outline
hide-details
></v-text-field>
<v-menu
v-model="menuFormDateStart"
:close-on-content-click="false"
:nudge-right="40"
:disabled="isLoading"
lazy
transition="scale-transition"
offset-y
full-width
max-width="290px"
min-width="290px"
>
<template v-slot:activator="{ on }">
<v-text-field
class=""
v-model="formatedStartDate"
label="Tanggal Awal"
outline
hide-details
readonly
v-on="on"
@blur="deFormatedDate(formatedStartDate)"
></v-text-field>
</template>
<v-date-picker
v-model="date"
no-title
@input="menuFormDateStart = false"
></v-date-picker>
</v-menu>
<v-select
:disabled="isLoading"
:items="yearList"
v-model="year"
class="mini-select mt-3"
label="Tahun"
hide-details
outline
></v-select>
<v-text-field
:disabled="isLoading"
class="xs3 mt-3 mini-select"
v-model="desc"
style="font-size: 14px;"
label="Deskripsi"
outline
hide-details
></v-text-field>
<v-select
:disabled="isLoading"
:items="type"
v-model="selectedType"
class="mini-select mt-3"
label="Tipe"
hide-details
outline
></v-select>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color=" red darken-1"
:disabled="isLoading"
flat
@click="dialogForm = false"
>Batal</v-btn
>
<v-btn
color="green darken-1"
:disabled="isLoading"
flat
:loading="isLoading"
@click="saveHoliday()"
>Simpan</v-btn
>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog v-model="dialog_delete" persistent max-width="290">
<v-card>
<!-- <v-card-title class="headline">Peringatan</v-card-title> -->
<v-card-text>
Apakah yakin menghapus libur
{{ selectedHoliday.holiday_name }} ?</v-card-text
>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
:disabled="isLoading"
color="green darken-1"
flat
@click="dialog_delete = false"
>tidak</v-btn
>
<v-btn
:loading="isLoading"
color="red darken-1"
flat
@click="deleteHoliday()"
>Ya</v-btn
>
</v-card-actions>
</v-card>
</v-dialog>
<!-- End alert dialog -->
<!-- Snackbar -->
<v-snackbar
v-model="snackbar"
:timeout="5000"
:multi-line="false"
:vertical="false"
:top="true"
color="success"
:value="snackbar"
>
{{ snackbar_msg }}
<v-btn flat @click="snackbar = false"> Tutup </v-btn>
</v-snackbar>
<!-- End Snackbar -->
<!-- ERROR DIALOG -->
<v-dialog v-model="error_dialog" max-width="500px">
<v-card>
<v-card-title>
<span>ERROR !</span>
<v-spacer></v-spacer>
</v-card-title>
<v-divider></v-divider>
<div class="ma-3 red--text" v-html="error_message"></div>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" flat @click="error_dialog = false"
>Close</v-btn
>
</v-card-actions>
</v-card>
</v-dialog>
<!-- END ERROR DIALOG -->
<v-toolbar dark color="primary">
<v-toolbar-title class="white--text">INJECT HARGA AGREEMENT</v-toolbar-title>
<v-spacer></v-spacer>
<!-- <v-btn icon @click="openAdd()">
<v-icon>add_box</v-icon>
</v-btn> -->
<v-btn
color="warning"
v-if="data_csv.length > 0"
:disabled="isLoading"
@click="inject()"
>Simpan</v-btn
>
</v-toolbar>
<v-card class="mb-2 pa-2 searchbox">
<v-layout>
<v-flex xs4 pa-2>
<v-autocomplete
v-model="selectedCompany"
:items="companyList"
:loading="isLoading"
:search-input.sync="searchCompany"
hide-no-data
hide-details
outline
item-text="M_CompanyName"
label="Pilih Company"
placeholder="Start typing to Search"
return-object
></v-autocomplete>
</v-flex>
<v-flex xs4 pa-2>
<v-autocomplete
v-model="selectedMou"
:items="mouList"
:loading="isLoading"
:search-input.sync="searchMou"
hide-no-data
hide-details
outline
item-text="M_MouName"
label="Pilih Agreement"
placeholder="Start typing to Search"
return-object
></v-autocomplete>
</v-flex>
</v-layout>
<v-layout>
<v-flex xs4 pa-2>
<p class="mb-0 mt-3 subheading">
silahkan download template di
<span
@click="downloadcsv()"
style="cursor: pointer;"
class="info--text lighten-3--text"
>sini</span
>
</p>
</v-flex>
<v-flex xs4 pa-2>
<v-divider class="my-2"></v-divider>
<input
accept=".xlsx"
type="file"
id="csv_file"
:disabled="isLoading"
name="csv_file"
class="form-control"
@change="loadCSV($event)"
/>
<v-btn @click="resetInputFile()" :disabled="isLoading" icon>
<v-icon color="red">cancel</v-icon>
</v-btn>
<v-progress-circular
v-if="isLoading"
:indeterminate="true"
color="primary"
></v-progress-circular>
</v-flex>
</v-layout>
</v-card>
<v-card>
<v-layout align-center row>
<v-flex
xs12
pl-2
style="max-height: 70vh; overflow: auto;"
pr-2
pt-2
pb-2
>
<!-- hide-actions -->
<v-data-table
:headers="headers"
:items="data_csv"
:loading="isLoading"
class="elevation-1"
>
<template v-slot:items="props">
<td class="text-xs-left pa-2">{{ props.item.TEST_CODE }}</td>
<td class="text-xs-left pa-2">{{ props.item.TEST_NAME }}</td>
<td class="text-xs-left pa-2">{{ props.item.HARGA }}</td>
<td class="text-xs-left pa-2">{{ props.item.DISKON_PERSEN }}</td>
<td class="text-xs-left pa-2">{{ props.item.DISKON_RUPIAH }}</td>
<td class="text-xs-left pa-2">{{ props.item.TOTAL }}</td>
</template>
</v-data-table>
<v-divider></v-divider>
<!-- <v-layout>
<v-flex>
<v-pagination
style="margin-top: 10px; margin-bottom: 10px;"
v-model="curr_page"
:length="total_page"
>
</v-pagination>
</v-flex>
</v-layout> -->
</v-flex>
</v-layout>
</v-card>
</v-layout>
</template>
<style scoped>
.searchbox .v-input.v-text-field .v-input__slot {
min-height: 60px;
}
.searchbox .v-btn {
min-height: 60px;
}
table.v-table tbody td,
table.v-table tbody th {
height: 40px;
}
table.v-table thead tr {
height: 40px;
}
</style>
<script>
module.exports = {
data() {
return {
//dropdown holiday
action: "add",
yearList: [],
menu: false,
yearTEST_NAME: new Date().getFullYear().toString(), // Set the initial year to current year
activePicker: "YEAR", // Display year picker directly
minYear: "1900", // Minimum selectable year
maxYear: new Date().getFullYear().toString(),
menuFormDateStart: false,
menuFormDateFilter: false,
menuFormDate: false,
selected: {},
headers: [
{
text: "TEST CODE",
align: "left",
sortable: false,
value: "mr",
width: "20%",
class: "text-xs-left pa-2 blue-grey white--text",
},
{
text: "TEST NAME",
align: "left",
sortable: false,
value: "mr",
width: "30%",
class: "text-xs-left pa-2 blue-grey white--text",
},
{
text: "HARGA",
align: "left",
sortable: false,
value: "lab",
width: "10%",
class: "text-xs-left pa-2 blue-grey white--text",
},
{
text: "DISKON PERSEN",
align: "left",
sortable: false,
value: "lab",
width: "10%",
class: "text-xs-left pa-2 blue-grey white--text",
},
{
text: "DISKON RUPIAH",
align: "left",
sortable: false,
value: "lab",
width: "10%",
class: "text-xs-left pa-2 blue-grey white--text",
},
{
text: "TOTAL",
align: "left",
sortable: false,
value: "lab",
width: "10%",
class: "text-xs-left pa-2 blue-grey white--text",
}
],
};
},
mounted() {
// this.generateYear();
// console.log(this.yearList);
// this.$store.dispatch("patient/gettype");
// this.$store.dispatch("patient/search");
},
computed: {
formatedStartDate() {
return this.formatDate(this.date);
},
formatedEndDate() {
return this.formatDate(this.date);
},
data_csv: {
get() {
return this.$store.state.patient.data_csv;
},
set(val) {
this.$store.commit("patient/update_data_csv", val);
},
},
companyList: {
get() {
return this.$store.state.patient.companyList;
},
set(val) {
this.$store.commit("patient/update_companyList", val);
},
},
selectedCompany: {
get() {
return this.$store.state.patient.selectedCompany;
},
set(val) {
this.$store.commit("patient/update_selectedCompany", val);
},
},
searchCompany: {
get() {
return this.$store.state.patient.searchCompany;
},
set(val) {
this.$store.commit("patient/update_searchCompany", val);
},
},
mouList: {
get() {
return this.$store.state.patient.mouList;
},
set(val) {
this.$store.commit("patient/update_mouList", val);
},
},
selectedMou: {
get() {
return this.$store.state.patient.selectedMou;
},
set(val) {
this.$store.commit("patient/update_selectedMou", val);
},
},
searchMou: {
get() {
return this.$store.state.patient.searchMou;
},
set(val) {
this.$store.commit("patient/update_searchMou", val);
},
},
isLoading: {
get() {
return this.$store.state.patient.isLoading;
},
set(val) {
this.$store.commit("patient/update_isLoading", val);
},
},
dialogForm: {
get() {
return this.$store.state.patient.dialogForm;
},
set(val) {
this.$store.commit("patient/update_dialogForm", val);
},
},
dialog_delete: {
get() {
return this.$store.state.patient.dialog_delete;
},
set(val) {
this.$store.commit("patient/update_dialog_delete", val);
},
},
year: {
get() {
return this.$store.state.patient.year;
},
set(val) {
this.$store.commit("patient/update_year", val);
},
},
yearFilter: {
get() {
return this.$store.state.patient.yearFilter;
},
set(val) {
this.$store.commit("patient/update_yearFilter", val);
this.$store.dispatch("patient/search");
},
},
date: {
get() {
return this.$store.state.patient.date;
},
set(val) {
this.$store.commit("patient/update_date", val);
},
},
type: {
get() {
return this.$store.state.patient.type;
},
set(val) {
this.$store.commit("patient/update_type", val);
},
},
selectedType: {
get() {
return this.$store.state.patient.selectedType;
},
set(val) {
this.$store.commit("patient/update_selectedType", val);
},
},
name: {
get() {
return this.$store.state.patient.name;
},
set(val) {
this.$store.commit("patient/update_name", val);
},
},
curr_page: {
get() {
return this.$store.state.patient.curr_page;
},
set(val) {
this.$store.commit("patient/update_curr_page", val);
this.$store.dispatch("patient/search");
},
},
isholiday: {
get() {
return this.$store.state.patient.is_holiday;
},
// set(val) {
// console.log("valllll :" + val)
// // this.$store.commit("patient/update_is_holiday", val)
// }
},
holidays() {
return this.$store.state.patient.holidays;
},
total_page: {
get() {
return this.$store.state.patient.TOTAL;
},
set(val) {
this.$store.commit("patient/update_total", val);
},
},
snackbar: {
get() {
return this.$store.state.patient.snackbar;
},
set(val) {
this.$store.commit("patient/update_snackbar", val);
},
},
error_dialog: {
get() {
return this.$store.state.patient.error_dialog;
},
set(val) {
this.$store.commit("patient/update_error_dialog", val);
},
},
name: {
get() {
return this.$store.state.patient.name;
},
set(val) {
this.$store.commit("patient/update_name", val);
},
},
desc: {
get() {
return this.$store.state.patient.desc;
},
set(val) {
this.$store.commit("patient/update_desc", val);
},
},
selectedHoliday: {
get() {
return this.$store.state.patient.selectedHoliday;
},
set(val) {
this.$store.commit("patient/update_selectedHoliday", val);
},
},
error_message: {
get() {
return this.$store.state.patient.error_message;
},
set(val) {
this.$store.commit("patient/update_error_message", val);
},
},
snackbar_msg() {
return this.$store.state.patient.snackbar_msg;
},
formatedYearFilter() {
return this.formatDate(this.yearFilter);
},
},
methods: {
inject() {
this.$store.dispatch("patient/inject");
},
downloadcsvold() {
let url = "./Template_user_mitra.xlsx";
fetch(url)
.then((response) => response.blob())
.then((blob) => {
const url = window.URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "Template_user_mitra.xlsx");
document.body.appendChild(link);
link.click();
link.parentNode.removeChild(link);
window.URL.revokeObjectURL(url);
});
},
downloadcsv() {
this.$store.dispatch("patient/downloadcsv")
},
resetInputFile() {
this.data_csv = [];
document.getElementById("csv_file").value = null;
},
cekKTP(nik, tanggal, bulan, tahun) {
console.log("nik", nik);
console.log("tanggal", tanggal);
console.log("bulan", bulan);
console.log("tahun", tahun);
return true;
if (nik.length !== 16) {
console.log("nik length tidak valid");
return false;
}
let d = parseInt(nik.substr(6, 2));
let m = parseInt(nik.substr(8, 2));
let y = parseInt(nik.substr(10, 2));
console.log("d", d);
console.log("m", m);
console.log("y", y);
// Jika tahun full, ambil 2 digit terakhir
if (tahun.toString().length === 4) {
tahun = tahun.toString().substr(2, 2);
}
if (d > 40) {
// Wanita
d = d + 40;
}
if (parseInt(tanggal) !== d) {
console.log("tanggal tidak valid");
return false;
}
if (parseInt(bulan) !== m) {
console.log("bulan tidak valid");
return false;
}
if (parseInt(tahun) !== y) {
console.log("tahun tidak valid");
return false;
}
// Setelah berhasil melewati rintangan, berarti nomornya valid (tidak 100% valid)
return true;
},
cekDataJSON(data) {
console.log("data cek json", data);
let message = "";
// console.log("data json");
// console.log(data);
// NAMA
//TANGGAL_LAHIR
//KTP
// JENIS_KELAMIN
// JABATAN
//KEDUDUKAN
//LOKASI
// PEKERJAAN
var day = moment(data.TANGGAL_LAHIR, "DD-MM-YYYY").format("DD");
var month = moment(data.TANGGAL_LAHIR, "DD-MM-YYYY").format("MM");
var year = moment(data.TANGGAL_LAHIR, "DD-MM-YYYY").format("YYYY");
console.log("tanggal lahir", data.TANGGAL_LAHIR);
console.log("day", day);
console.log("month", month);
console.log("year", year);
// entry.KTP = .KTP;
if (data.NAMA === "" || data.NAMA === null || data.NAMA === undefined) {
console.log("NAMA Tidak boleh kosong " + data.NAMA);
message += "NAMA Tidak boleh kosong <br>";
}
if (
data.TANGGAL_LAHIR === "" ||
data.TANGGAL_LAHIR === null ||
data.TANGGAL_LAHIR === undefined
) {
console.log("TANGGAL LAHIR Tidak boleh kosong " + data.TANGGAL_LAHIR);
message += "TANGGAL LAHIR Tidak boleh kosong <br>";
}
if (data.NIK !== "" && data.NIK !== null && data.NIK !== undefined) {
if (!this.cekKTP(data.NIK, day, month, year)) {
console.log("NIK '" + data.NIK + "'' Tidak Valid");
message += "NIK '" + data.NIK + "'' Tidak Valid <br>";
}
}
if (
data.JENIS_KELAMIN === "" ||
data.JENIS_KELAMIN === null ||
data.JENIS_KELAMIN === undefined
) {
console.log("JENIS KELAMIN Tidak boleh kosong " + data.JENIS_KELAMIN);
message += "JENIS KELAMIN Tidak boleh kosong <br>";
} else {
const validGender = ["L", "P"];
if (!validGender.includes(data.JENIS_KELAMIN)) {
console.log("JENIS KELAMIN Tidak Valid " + data.JENIS_KELAMIN);
message += "JENIS KELAMIN Tidak Valid <br>";
}
}
if (
data.JABATAN === "" ||
data.JABATAN === null ||
data.JABATAN === undefined
) {
console.log("JABATAN Tidak boleh kosong " + data.JABATAN);
message += "JABATAN Tidak boleh kosong <br>";
}
if (
data.KEDUDUKAN === "" ||
data.KEDUDUKAN === null ||
data.KEDUDUKAN === undefined
) {
console.log("KEDUDUKAN Tidak boleh kosong " + data.KEDUDUKAN);
message += "KEDUDUKAN Tidak boleh kosong <br>";
}
if (
data.LOKASI === "" ||
data.LOKASI === null ||
data.LOKASI === undefined
) {
console.log("LOKASI Tidak boleh kosong " + data.LOKASI);
message += "LOKASI Tidak boleh kosong <br>";
}
if (
data.PEKERJAAN === "" ||
data.PEKERJAAN === null ||
data.PEKERJAAN === undefined
) {
console.log("PEKERJAAN Tidak boleh kosong " + data.PEKERJAAN);
message += "PEKERJAAN Tidak boleh kosong <br>";
}
if (message === "") {
return [true, message];
} else {
message += "Nama : " + data.NAMA + "<br>";
message += "Tanggal Lahir : " + data.TANGGAL_LAHIR + "<br>";
message += "NIK : " + data.NIK + "<br>";
message += "Jenis Kelamin : " + data.JENIS_KELAMIN + "<br>";
message += "Jabatan : " + data.JABATAN + "<br>";
message += "Kedudukan : " + data.KEDUDUKAN + "<br>";
message += "Lokasi : " + data.LOKASI + "<br>";
message += "Pekerjaan : " + data.PEKERJAAN + "<br>";
message += "NIP : " + data.NIP + "<br>";
message += "HP : " + data.HP + "<br>";
message += "Alamat : " + data.ALAMAT + "<br>";
message += "No RM : " + data.NO_RM + "<br>";
return [false, message];
}
},
loadCSV(e) {
var vm = this;
this.isLoading = true;
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];
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 data_harga = XLSX.utils.sheet_to_json(worksheet, {
cellText: true,
});
var error = [];
// console.log("data_harga", data_harga)
date_data.forEach(function (entry, iidx) {
if (iidx > 0) {
console.log("entry", entry);
entry.TEST_CODE = data_harga[iidx].TEST_CODE ?? "";
entry.TEST_NAME = data_harga[iidx].TEST_NAME ?? "";
entry.HARGA = data_harga[iidx].HARGA ?? "";
entry.DISKON_PERSEN = data_harga[iidx].DISKON_PERSEN ?? "";
entry.DISKON_RUPIAH = data_harga[iidx].DISKON_RUPIAH ?? "";
entry.TOTAL = data_harga[iidx].TOTAL ?? "";
if (entry.HARGA !== "" && entry.HARGA !== null && entry.HARGA !== undefined) {
data_json.push(entry);
}
}
});
// var prm = {
// xid: vm.selected_mgmmcu.Mgm_McuID,
// corporateID: vm.selected_mgmmcu.Mgm_McuCorporateID,
// data: data_json,
// };
console.log("data json");
console.log(data_json);
// console.log("data prm",prm)
//XLSX.utils.sheet_to_json(ws, {dateNF:"YYYY-MM-DD"})
// if (error.length != 0) {
// // console.log("error", error)
// vm.$store.commit("patient/update_error_identifier", error);
// vm.dialog_identifier = true;
// } else {
// // console.log("prm",prm)
// vm.$store.dispatch("patient/savecsv", prm);
// }
vm.data_csv = data_json;
};
this.isLoading = false;
reader.readAsArrayBuffer(f);
},
checkSelectedCompany() {
console.log(
"cek selected company",
Object.keys(this.selectedCompany || {}).length
);
if (Object.keys(this.selectedCompany || {}).length === 0) {
console.log("false");
return false;
}
if (!this.selectedCompany || this.selectedCompany === null) {
console.log("false");
return false;
}
console.log("true");
return true;
},
openAdd() {
this.action = "add";
this.name = "";
this.date = moment(new Date()).format("YYYY-MM-DD");
this.year = moment(new Date()).format("YYYY");
this.desc = "";
this.selectedType = "";
this.dialogForm = true;
},
openEdit(data) {
this.action = "edit";
this.name = data.holiday_name;
this.date = data.holiday_date;
this.year = data.holiday_year;
this.desc = data.description;
this.selectedType = data.holiday_type;
this.selectedHoliday = data;
this.dialogForm = true;
},
openDelete(data) {
this.action = "delete";
this.selectedHoliday = data;
this.dialog_delete = true;
},
saveHoliday() {
if (this.action == "add") {
this.$store.dispatch("patient/add");
}
if (this.action == "edit") {
this.$store.dispatch("patient/edit");
}
},
deleteHoliday() {
this.$store.dispatch("patient/deleteData");
},
generateYear() {
const currentYear = new Date().getFullYear();
const startYear = currentYear - 5; // 5 tahun sebelum tahun ini
const endYear = currentYear + 10; // 10 tahun setelah tahun ini
let years = [];
for (let year = startYear; year <= endYear; year++) {
years.push(year.toString());
}
this.yearList = years;
},
save(selectedYear) {
this.menu = false;
this.yearTEST_NAME = selectedYear;
},
formatDate(date) {
if (!date) return null;
const [year, month, day] = date.split("-");
return `${day}-${month}-${year}`;
},
deFormatedDate(date) {
if (!date) return null;
const [day, month, year] = date.split("-");
return `${year}-${month.padStart(2, "0")}-${day.padStart(2, "0")}`;
},
changeCourir(userID, staffID, type, data) {
this.selected = data;
console.log("change holiday" + userID + " " + staffID);
var tempCourrier = JSON.stringify(this.isholiday);
var arrholiday = JSON.parse(tempCourrier);
console.log(type);
if (type !== "new") {
this.dialog_delete = true;
// console.log("hapus kurir");
// this.$store.dispatch("patient/deleteData", {
// "holidayID": type
// });
// arrholiday.filter((e) => e === type);
} else {
var validation = arrholiday.includes(userID);
if (!validation) {
this.$store.dispatch("patient/add", {
staffID: staffID,
userID: userID,
});
console.log("add kurir");
arrholiday.push(userID);
}
}
console.log(arrholiday);
this.$store.commit("patient/update_is_holiday", arrholiday);
this.$store.dispatch("patient/search");
},
delete_kurir() {
console.log("hapus kurir");
this.$store.dispatch("patient/deleteData", {
holidayID: this.selected.holidayID,
});
this.dialog_delete = false;
},
thr_search: _.debounce(function () {
this.$store.dispatch("patient/search");
}, 1000),
},
watch: {
// menuFormDateStart(val) {
// val && setTimeout(() => (this.$refs.picker.activePicker = "YEAR"));
// },
searchCompany(val, old) {
if (val === "") return;
if (val === null) return;
if (val === old) return;
if (val.length < 2) return;
this.$store.dispatch("patient/getCompany", val);
},
searchMou(val, old) {
if (val === "") return;
if (val === null) return;
if (val === old) return;
if (val.length < 2) return;
this.$store.dispatch("patient/getMou", {search : val, companyid : this.selectedCompany.M_CompanyID});
},
name(val, old) {
this.name = val;
this.thr_search();
},
},
};
</script>

View File

@@ -0,0 +1,100 @@
<!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 v-on:key="doSomething">
<div v-cloak id="app">
<v-app id="smartApp">
<one-navbar></one-navbar>
<v-content style="background:#F5E8DF!important">
<v-container fluid class="pl-1 pr-1 pt-1 pb-1">
<v-layout wrap>
<v-flex xs12 class="left" pa-1>
<one-public-holiday></one-public-holiday>
</v-flex>
</v-layout>
</v-container>
</v-content>
<one-footer> </one-footer>
</v-app>
</div>
<!-- Vendor -->
<script src="../../libs/vendor/moment.min.js"></script>
<script src="../../libs/vendor/numeral.min.js"></script>
<script src="../../libs/vendor/moment-locale-id.js"></script>
<script src="../../libs/vendor/lodash.js"></script>
<script src="../../libs/vendor/axios.min.js"></script>
<script src="../../libs/vendor/vue.js"></script>
<script src="../../libs/vendor/vuex.js"></script>
<script src="../../libs/vendor/vuetify.js"></script>
<script src="../../libs/vendor/httpVueLoader.js"></script>
<script src="../../libs/one_global.js"></script>
<script src="../../libs/vendor/socket.io.js"></script>
<script src="../../libs/vendor/sheetjs-master/xlsx.full.min.js"></script>
<!--<script src="../../libs/one_print_barcode.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`
}
var socketIoUrl = "http://" + window.location.host + ":9090/";
import {
store
} from './store.js<?php echo $ts ?>';
//for testing
window.store = store;
new Vue({
store,
el: '#app',
doctornted() {},
methods: {
tab_selected: function(tab) {
return this.$store.state.tab_selected == tab
}
},
computed: {
showtests() {
return this.$store.state.samplecall.showtests
}
},
components: {
'one-navbar': httpVueLoader('../../apps/components/oneNavbarComponentNoMenu.vue'),
'one-footer': httpVueLoader('../../apps/components/oneFooter.vue'),
'one-public-holiday': httpVueLoader('./components/onePublicHoliday.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {}
.right {}
</style>
</body>
</html>

View File

@@ -0,0 +1,165 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/courier.js"
export default {
namespaced: true,
state: {
couriers: [],
loading: false,
name: "",
curr_page: 1,
total: 0,
error_dialog: false,
error_message: "",
is_courier: [],
snackbar: false,
snackbar_msg: ""
// selected_courier: {},
// current_page: 1,
// last_id: -1,
// x_search: "",
// search_status: 0,
// // dropdown courier
// namecouriers: [],
// namecourier: {},
// autocomplete_status: 0,
// save_status: 0,
// error_message: "",
// dialog_error: false,
// alert_error: false,
// msg_success: "",
// alert_success: false,
// get_data_status:0,
// filter_branch: [],
// selected_filter_branch: {},
// filter_kurir: [],
// selected_filter_kurir: {},
// filter_status: [],
// selected_filter_status: {},
},
mutations: {
update_couriers(state, val) {
state.couriers = val
},
update_total(state, val) {
state.total = val;
},
update_loading(state, val) {
state.loading = val;
},
update_error_message(state, val) {
state.error_message = val;
},
update_name(state, val) {
state.name = val;
},
update_curr_page(state, val) {
state.curr_page = val;
},
update_is_courier(state, val) {
state.is_courier = val;
},
update_snackbar(state, val) {
state.snackbar = val;
},
update_snackbar_msg(state, val) {
state.snackbar_msg = val;
},
update_error_dialog(state, val) {
state.error_dialog = val;
},
},
actions: {
async search(context) {
context.commit("update_loading", true)
try {
// prm.token = one_token();
var param = {
"name": context.state.name,
"page": context.state.curr_page,
"token": one_token(),
}
let resp = await api.search(param);
if (resp.status !== "OK") {
context.commit("update_loading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", resp);
} else {
context.commit("update_loading", false);
console.log(resp.data);
context.commit("update_couriers", resp.data.records)
context.commit("update_total", resp.data.total);
let isCourier = [];
for (let i = 0; i < resp.data.records.length; i++) {
if (resp.data.records[i].flag !== "N") {
isCourier.push(resp.data.records[i].userID)
}
}
context.commit("update_is_courier", isCourier);
}
} catch (error) {
context.commit("update_loading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", error);
}
},
async add(context, prm) {
context.commit("update_loading", true)
try {
prm.token = one_token();
// prm.userID = one_user();
let resp = await api.add(prm);
if (resp.status !== "OK") {
context.commit("update_loading", false);
context.commit("update_error_message", resp);
context.commit("update_error_dialog", true);
} else {
context.commit("update_loading", false);
context.commit("update_snackbar", true);
context.commit("update_snackbar_msg", "Berhasil Menambahkan Kurir");
console.log(resp.data);
// var tempCourrier = JSON.stringify(context.state.is_courier);
// var arrCourier = JSON.parse(tempCourrier);
// arrCourier.push(prm.userID);
// context.commit("update_is_courier", arrCourier);
context.dispatch("search");
}
} catch (error) {
context.commit("update_loading", false);
context.commit("update_error_message", error);
context.commit("update_error_dialog", true);
}
},
async deleteData(context, prm) {
context.commit("update_loading", true)
try {
prm.token = one_token();
// prm.userID = one_user();
let resp = await api.deleteData(prm);
if (resp.status !== "OK") {
context.commit("update_loading", false);
context.commit("update_error_message", resp);
context.commit("update_error_dialog", true);
} else {
context.commit("update_loading", false);
console.log(resp.data);
context.commit("update_snackbar", true);
context.commit("update_snackbar_msg", "Berhasil Menghapus Kurir");
// var tempCourrier = JSON.stringify(context.state.is_courier);
// var arrCourier = JSON.parse(tempCourrier);
// arrCourier.filter((e) => e === prm.courierID);
// context.commit("update_is_courier", arrCourier);
context.dispatch("search");
}
} catch (error) {
context.commit("update_loading", false);
context.commit("update_error_message", error);
context.commit("update_error_dialog", true);
}
}
}
}

View File

@@ -0,0 +1,272 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/holiday.js"
export default {
namespaced: true,
state: {
couriers: [],
type: [],
selectedType: '',
loading: false,
date: moment(new Date()).format('YYYY-MM-DD'),
yearFilter: moment(new Date()).format('YYYY'),
year: moment(new Date()).format('YYYY'),
name: "",
curr_page: 1,
total: 0,
error_dialog: false,
error_message: "",
is_courier: [],
snackbar: false,
snackbar_msg: "",
holidays: [],
dialogForm: false,
name: '',
desc: '',
selectedHoliday: {},
dialog_delete: false
// selected_courier: {},
// current_page: 1,
// last_id: -1,
// x_search: "",
// search_status: 0,
// // dropdown courier
// namecouriers: [],
// namecourier: {},
// autocomplete_status: 0,
// save_status: 0,
// error_message: "",
// dialog_error: false,
// alert_error: false,
// msg_success: "",
// alert_success: false,
// get_data_status:0,
// filter_branch: [],
// selected_filter_branch: {},
// filter_kurir: [],
// selected_filter_kurir: {},
// filter_status: [],
// selected_filter_status: {},
},
mutations: {
update_selectedHoliday(state, val) {
state.selectedHoliday = val
},
update_dialog_delete(state, val) {
state.dialog_delete = val
},
update_desc(state, val) {
state.desc = val
},
update_dialogForm(state, val) {
state.dialogForm = val
},
update_year(state, val) {
state.year = val
},
update_yearFilter(state, val) {
state.yearFilter = val
},
update_date(state, val) {
state.date = val
},
update_type(state, val) {
state.type = val
},
update_selectedType(state, val) {
state.selectedType = val
},
update_couriers(state, val) {
state.couriers = val
},
update_total(state, val) {
state.total = val;
},
update_loading(state, val) {
state.loading = val;
},
update_error_message(state, val) {
state.error_message = val;
},
update_name(state, val) {
state.name = val;
},
update_curr_page(state, val) {
state.curr_page = val;
},
update_is_courier(state, val) {
state.is_courier = val;
},
update_snackbar(state, val) {
state.snackbar = val;
},
update_snackbar_msg(state, val) {
state.snackbar_msg = val;
},
update_error_dialog(state, val) {
state.error_dialog = val;
},
update_holidays(state, val) {
state.holidays = val;
},
},
actions: {
async gettype(context) {
context.commit("update_loading", true)
try {
// prm.token = one_token();
var param = {
"token": one_token(),
}
let resp = await api.gettype(param);
if (resp.status !== "OK") {
context.commit("update_loading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", resp);
} else {
context.commit("update_loading", false);
console.log(resp.data);
context.commit("update_type", resp.data)
}
} catch (error) {
context.commit("update_loading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", error);
}
},
async search(context) {
context.commit("update_loading", true)
try {
// prm.token = one_token();
var param = {
"year": context.state.yearFilter,
"token": one_token(),
}
let resp = await api.search(param);
if (resp.status !== "OK") {
context.commit("update_loading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", resp);
} else {
context.commit("update_loading", false);
console.log(resp.data);
context.commit("update_holidays", resp.data)
}
} catch (error) {
context.commit("update_loading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", error);
}
},
async add(context) {
context.commit("update_loading", true)
try {
let prm = {};
prm.token = one_token();
prm.name = context.state.name;
prm.year = context.state.year;
prm.date = context.state.date;
prm.type = context.state.selectedType;
prm.description = context.state.desc;
// prm.userID = one_user();
let resp = await api.add(prm);
if (resp.status !== "OK") {
context.commit("update_loading", false);
context.commit("update_error_message", resp);
context.commit("update_error_dialog", true);
} else {
context.commit("update_loading", false);
context.commit("update_snackbar", true);
context.commit("update_dialogForm", false);
context.commit("update_snackbar_msg", "Berhasil Menambahkan hari libur");
console.log(resp.data);
// var tempCourrier = JSON.stringify(context.state.is_courier);
// var arrCourier = JSON.parse(tempCourrier);
// arrCourier.push(prm.userID);
// context.commit("update_is_courier", arrCourier);
context.dispatch("search");
}
} catch (error) {
context.commit("update_loading", false);
context.commit("update_error_message", error);
context.commit("update_error_dialog", true);
}
},
async edit(context) {
context.commit("update_loading", true)
try {
let prm = {};
prm.token = one_token();
prm.name = context.state.name;
prm.year = context.state.year;
prm.date = context.state.date;
prm.type = context.state.selectedType;
prm.description = context.state.desc;
prm.id = context.state.selectedHoliday.id;
// prm.userID = one_user();
let resp = await api.edit(prm);
if (resp.status !== "OK") {
context.commit("update_loading", false);
context.commit("update_error_message", resp);
context.commit("update_error_dialog", true);
} else {
context.commit("update_loading", false);
context.commit("update_snackbar", true);
context.commit("update_dialogForm", false);
context.commit("update_snackbar_msg", "Berhasil edit hari libur");
console.log(resp.data);
// var tempCourrier = JSON.stringify(context.state.is_courier);
// var arrCourier = JSON.parse(tempCourrier);
// arrCourier.push(prm.userID);
// context.commit("update_is_courier", arrCourier);
context.dispatch("search");
}
} catch (error) {
context.commit("update_loading", false);
context.commit("update_error_message", error);
context.commit("update_error_dialog", true);
}
},
async deleteData(context) {
context.commit("update_loading", true)
try {
let prm = {}
prm.token = one_token();
prm.id = context.state.selectedHoliday.id;
// prm.userID = one_user();
let resp = await api.deleteData(prm);
if (resp.status !== "OK") {
context.commit("update_loading", false);
context.commit("update_error_message", resp);
context.commit("update_error_dialog", true);
} else {
context.commit("update_loading", false);
console.log(resp.data);
context.commit("update_snackbar", true);
context.commit("update_dialog_delete", false);
context.commit("update_snackbar_msg", "Berhasil Menghapus libur");
// var tempCourrier = JSON.stringify(context.state.is_courier);
// var arrCourier = JSON.parse(tempCourrier);
// arrCourier.filter((e) => e === prm.courierID);
// context.commit("update_is_courier", arrCourier);
context.dispatch("search");
}
} catch (error) {
context.commit("update_loading", false);
context.commit("update_error_message", error);
context.commit("update_error_dialog", true);
}
}
}
}

View File

@@ -0,0 +1,449 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/patient.js"
export default {
namespaced: true,
state: {
couriers: [],
type: [],
selectedType: '',
loading: false,
date: moment(new Date()).format('YYYY-MM-DD'),
yearFilter: moment(new Date()).format('YYYY'),
year: moment(new Date()).format('YYYY'),
name: "",
curr_page: 1,
TOTAL: 0,
error_dialog: false,
error_message: "",
is_courier: [],
snackbar: false,
snackbar_msg: "",
holidays: [],
dialogForm: false,
name: '',
desc: '',
selectedHoliday: {},
dialog_delete: false,
companyList: [],
selectedCompany: null,
searchCompany: '',
mouList: [],
selectedMou: null,
searchMou: '',
isLoading: false,
data_csv: [],
// selected_courier: {},
// current_page: 1,
// last_id: -1,
// x_search: "",
// search_status: 0,
// // dropdown courier
// namecouriers: [],
// namecourier: {},
// autocomplete_status: 0,
// save_status: 0,
// error_message: "",
// dialog_error: false,
// alert_error: false,
// msg_success: "",
// alert_success: false,
// get_data_status:0,
// filter_branch: [],
// selected_filter_branch: {},
// filter_kurir: [],
// selected_filter_kurir: {},
// filter_status: [],
// selected_filter_status: {},
},
mutations: {
update_data_csv(state, val) {
state.data_csv = val
},
update_companyList(state, val) {
state.companyList = val
},
update_selectedCompany(state, val) {
state.selectedCompany = val
},
update_searchCompany(state, val) {
state.searchCompany = val
},
update_mouList(state, val) {
state.mouList = val
},
update_selectedMou(state, val) {
state.selectedMou = val
},
update_searchMou(state, val) {
state.searchMou = val
},
update_isLoading(state, val) {
state.isLoading = val
},
update_selectedHoliday(state, val) {
state.selectedHoliday = val
},
update_dialog_delete(state, val) {
state.dialog_delete = val
},
update_desc(state, val) {
state.desc = val
},
update_dialogForm(state, val) {
state.dialogForm = val
},
update_year(state, val) {
state.year = val
},
update_yearFilter(state, val) {
state.yearFilter = val
},
update_date(state, val) {
state.date = val
},
update_type(state, val) {
state.type = val
},
update_selectedType(state, val) {
state.selectedType = val
},
update_couriers(state, val) {
state.couriers = val
},
update_total(state, val) {
state.TOTAL = val;
},
update_loading(state, val) {
state.loading = val;
},
update_error_message(state, val) {
state.error_message = val;
},
update_name(state, val) {
state.name = val;
},
update_curr_page(state, val) {
state.curr_page = val;
},
update_is_courier(state, val) {
state.is_courier = val;
},
update_snackbar(state, val) {
state.snackbar = val;
},
update_snackbar_msg(state, val) {
state.snackbar_msg = val;
},
update_error_dialog(state, val) {
state.error_dialog = val;
},
update_holidays(state, val) {
state.holidays = val;
},
},
actions: {
async getCompany(context, search) {
context.commit("update_isLoading", true)
try {
// prm.token = one_token();
var param = {
"token": one_token(),
"search": search
}
let resp = await api.getCompany(param);
if (resp.status !== "OK") {
context.commit("update_isLoading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", resp);
} else {
context.commit("update_isLoading", false);
console.log(resp.data);
context.commit("update_companyList", resp.data)
}
} catch (error) {
context.commit("update_isLoading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", error);
}
},
async getMou(context, prm) {
context.commit("update_isLoading", true)
try {
prm.token = one_token();
let resp = await api.getMou(prm);
if (resp.status !== "OK") {
context.commit("update_isLoading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", resp);
} else {
context.commit("update_isLoading", false);
console.log(resp.data);
context.commit("update_mouList", resp.data)
}
} catch (error) {
context.commit("update_isLoading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", error);
}
},
async downloadcsv(context) {
context.commit("update_isLoading", true)
try {
// param sesuai standar kamu
const prm = {
token: one_token()
}
// call API
let resp = await api.getTest(prm)
if (resp.status !== "OK") {
context.commit("update_isLoading", false)
context.commit("update_error_dialog", true)
context.commit("update_error_message", resp)
return
}
const data = resp.data || []
// mapping ke format Excel
let rows = data.map(item => ({
"TEST_CODE": item.TEST_CODE || "",
"TEST_NAME": item.TEST_NAME || "",
"HARGA": item.HARGA || "",
"DISKON_PERSEN": item.DISKON_PERSEN || "",
"DISKON_RUPIAH": item.DISKON_RUPIAH || "",
"TOTAL": item.TOTAL || ""
}))
// jika kosong → tetap template
if (rows.length === 0) {
rows = [{
"TEST_CODE": "",
"TEST_NAME": "",
"HARGA": "",
"DISKON_PERSEN": "",
"DISKON_RUPIAH": "",
"TOTAL": ""
}]
}
// buat worksheet
const ws = XLSX.utils.json_to_sheet(rows)
// width kolom
ws["!cols"] = [
{ wch: 15 },
{ wch: 35 },
{ wch: 15 },
{ wch: 15 },
{ wch: 15 },
{ wch: 15 }
]
// freeze header
ws["!freeze"] = { ySplit: 1 }
// workbook
const wb = XLSX.utils.book_new()
XLSX.utils.book_append_sheet(wb, ws, "Template Harga")
// download
XLSX.writeFile(wb, "Template_Harga.xlsx")
context.commit("update_isLoading", false)
} catch (error) {
context.commit("update_isLoading", false)
context.commit("update_error_dialog", true)
context.commit("update_error_message", error)
}
},
async inject(context) {
context.commit("update_isLoading", true)
try {
// prm.token = one_token();
var param = {
"token": one_token(),
"company": context.state.selectedCompany,
"mou": context.state.selectedMou,
"data": context.state.data_csv
}
let resp = await api.inject(param);
if (resp.status !== "OK") {
context.commit("update_isLoading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", resp);
} else {
context.commit("update_isLoading", false);
context.commit("update_snackbar", true);
context.commit("update_snackbar_msg", "Berhasil Menambahkan data");
}
} catch (error) {
context.commit("update_isLoading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", error);
}
},
async gettype(context) {
context.commit("update_loading", true)
try {
// prm.token = one_token();
var param = {
"token": one_token(),
}
let resp = await api.gettype(param);
if (resp.status !== "OK") {
context.commit("update_loading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", resp);
} else {
context.commit("update_loading", false);
console.log(resp.data);
context.commit("update_type", resp.data)
}
} catch (error) {
context.commit("update_loading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", error);
}
},
async search(context) {
context.commit("update_loading", true)
try {
// prm.token = one_token();
var param = {
"year": context.state.yearFilter,
"token": one_token(),
}
let resp = await api.search(param);
if (resp.status !== "OK") {
context.commit("update_loading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", resp);
} else {
context.commit("update_loading", false);
console.log(resp.data);
context.commit("update_holidays", resp.data)
}
} catch (error) {
context.commit("update_loading", false);
context.commit("update_error_dialog", true);
context.commit("update_error_message", error);
}
},
async add(context) {
context.commit("update_loading", true)
try {
let prm = {};
prm.token = one_token();
prm.name = context.state.name;
prm.year = context.state.year;
prm.date = context.state.date;
prm.type = context.state.selectedType;
prm.description = context.state.desc;
// prm.userID = one_user();
let resp = await api.add(prm);
if (resp.status !== "OK") {
context.commit("update_loading", false);
context.commit("update_error_message", resp);
context.commit("update_error_dialog", true);
} else {
context.commit("update_loading", false);
context.commit("update_snackbar", true);
context.commit("update_dialogForm", false);
context.commit("update_snackbar_msg", "Berhasil Menambahkan hari libur");
console.log(resp.data);
// var tempCourrier = JSON.stringify(context.state.is_courier);
// var arrCourier = JSON.parse(tempCourrier);
// arrCourier.push(prm.userID);
// context.commit("update_is_courier", arrCourier);
context.dispatch("search");
}
} catch (error) {
context.commit("update_loading", false);
context.commit("update_error_message", error);
context.commit("update_error_dialog", true);
}
},
async edit(context) {
context.commit("update_loading", true)
try {
let prm = {};
prm.token = one_token();
prm.name = context.state.name;
prm.year = context.state.year;
prm.date = context.state.date;
prm.type = context.state.selectedType;
prm.description = context.state.desc;
prm.id = context.state.selectedHoliday.id;
// prm.userID = one_user();
let resp = await api.edit(prm);
if (resp.status !== "OK") {
context.commit("update_loading", false);
context.commit("update_error_message", resp);
context.commit("update_error_dialog", true);
} else {
context.commit("update_loading", false);
context.commit("update_snackbar", true);
context.commit("update_dialogForm", false);
context.commit("update_snackbar_msg", "Berhasil edit hari libur");
console.log(resp.data);
// var tempCourrier = JSON.stringify(context.state.is_courier);
// var arrCourier = JSON.parse(tempCourrier);
// arrCourier.push(prm.userID);
// context.commit("update_is_courier", arrCourier);
context.dispatch("search");
}
} catch (error) {
context.commit("update_loading", false);
context.commit("update_error_message", error);
context.commit("update_error_dialog", true);
}
},
async deleteData(context) {
context.commit("update_loading", true)
try {
let prm = {}
prm.token = one_token();
prm.id = context.state.selectedHoliday.id;
// prm.userID = one_user();
let resp = await api.deleteData(prm);
if (resp.status !== "OK") {
context.commit("update_loading", false);
context.commit("update_error_message", resp);
context.commit("update_error_dialog", true);
} else {
context.commit("update_loading", false);
console.log(resp.data);
context.commit("update_snackbar", true);
context.commit("update_dialog_delete", false);
context.commit("update_snackbar_msg", "Berhasil Menghapus libur");
// var tempCourrier = JSON.stringify(context.state.is_courier);
// var arrCourier = JSON.parse(tempCourrier);
// arrCourier.filter((e) => e === prm.courierID);
// context.commit("update_is_courier", arrCourier);
context.dispatch("search");
}
} catch (error) {
context.commit("update_loading", false);
context.commit("update_error_message", error);
context.commit("update_error_dialog", true);
}
}
}
}

View File

@@ -0,0 +1,30 @@
// State
// data ...
// Mutations
//
//
// Actions
import courier from "./modules/courier.js";
import holiday from "./modules/holiday.js";
import patient from "./modules/patient.js";
import system from "../../apps/modules/system/system.js";
export const store = new Vuex.Store({
modules: {
holiday: holiday,
system: system,
patient: patient,
},
state: {
tab_selected: 'admin-kurir'
},
mutations: {
change_tab(state, ntab) {
state.tab_selected = ntab
}
},
actions: {
change_tab(context, ntab) {
context.commit('change_tab', ntab)
}
}
});