step 39 : order page desktop, mb result desktop
This commit is contained in:
199
v1/js/order.js
199
v1/js/order.js
@@ -25,6 +25,12 @@ document.addEventListener('alpine:init', () => {
|
||||
this.datepickerValueOD = this.formatDate(today);
|
||||
this.getNoOfDaysOD();
|
||||
|
||||
this.e_selectedDayOD = today.getDate();
|
||||
this.e_monthOD = today.getMonth();
|
||||
this.e_yearOD = today.getFullYear();
|
||||
this.e_datepickerValueOD = this.formatDate(today);
|
||||
this.e_getNoOfDaysOD();
|
||||
|
||||
// DOB
|
||||
this.selectedDayDOB = today.getDate();
|
||||
this.monthDOB = today.getMonth();
|
||||
@@ -32,6 +38,12 @@ document.addEventListener('alpine:init', () => {
|
||||
this.datepickerValueDOB = this.formatDate(today);
|
||||
this.getNoOfDaysDOB();
|
||||
|
||||
this.e_selectedDayDOB = today.getDate();
|
||||
this.e_monthDOB = today.getMonth();
|
||||
this.e_yearDOB = today.getFullYear();
|
||||
this.e_datepickerValueDOB = this.formatDate(today);
|
||||
this.e_getNoOfDaysDOB();
|
||||
|
||||
// multiple pemeriksaan add
|
||||
this.filteredPemeriksaan = [...this.dataPemeriksaan];
|
||||
|
||||
@@ -63,6 +75,14 @@ document.addEventListener('alpine:init', () => {
|
||||
no_of_daysOD: [],
|
||||
blankdaysOD: [],
|
||||
|
||||
e_showDatepickerOD: false,
|
||||
e_selectedDayOD: null,
|
||||
e_datepickerValueOD: '',
|
||||
e_monthOD: 0,
|
||||
e_yearOD: 0,
|
||||
e_no_of_daysOD: [],
|
||||
e_blankdaysOD: [],
|
||||
|
||||
// DOB Variabless
|
||||
showDatepickerDOB: false,
|
||||
selectedDayDOB: null,
|
||||
@@ -72,6 +92,14 @@ document.addEventListener('alpine:init', () => {
|
||||
no_of_daysDOB: [],
|
||||
blankdaysDOB: [],
|
||||
|
||||
e_showDatepickerDOB: false,
|
||||
e_selectedDayDOB: null,
|
||||
e_datepickerValueDOB: '',
|
||||
e_monthDOB: 0,
|
||||
e_yearDOB: 0,
|
||||
e_no_of_daysDOB: [],
|
||||
e_blankdaysDOB: [],
|
||||
|
||||
MONTH_NAMES: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
||||
DAYS: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
||||
|
||||
@@ -211,6 +239,45 @@ document.addEventListener('alpine:init', () => {
|
||||
this.no_of_daysOD = Array.from({ length: daysInMonth }, (_, i) => i + 1);
|
||||
},
|
||||
|
||||
// edit order date
|
||||
e_prevMonthOD() {
|
||||
if (this.e_monthOD === 0) {
|
||||
this.e_yearOD--;
|
||||
this.e_monthOD = 11;
|
||||
} else {
|
||||
this.e_monthOD--;
|
||||
}
|
||||
this.e_getNoOfDaysOD();
|
||||
},
|
||||
|
||||
e_nextMonthOD() {
|
||||
if (this.e_monthOD === 11) {
|
||||
this.e_yearOD++;
|
||||
this.e_monthOD = 0;
|
||||
} else {
|
||||
this.e_monthOD++;
|
||||
}
|
||||
this.e_getNoOfDaysOD();
|
||||
},
|
||||
|
||||
e_setDateOD(date) {
|
||||
let selectedDate = new Date(this.e_yearOD, this.e_monthOD, date);
|
||||
this.e_selectedDayOD = date;
|
||||
this.e_datepickerValueOD = this.formatDate(selectedDate);
|
||||
this.e_showDatepickerOD = false;
|
||||
},
|
||||
|
||||
e_isSelectedOD(date) {
|
||||
return this.e_selectedDayOD === date;
|
||||
},
|
||||
|
||||
e_getNoOfDaysOD() {
|
||||
let daysInMonth = new Date(this.e_yearOD, this.e_monthOD + 1, 0).getDate();
|
||||
let dayOfWeek = new Date(this.e_yearOD, this.e_monthOD, 1).getDay();
|
||||
this.e_blankdaysOD = Array.from({ length: dayOfWeek }, (_, i) => i);
|
||||
this.e_no_of_daysOD = Array.from({ length: daysInMonth }, (_, i) => i + 1);
|
||||
},
|
||||
|
||||
// Dob Functions
|
||||
prevMonthDOB() {
|
||||
if (this.monthDOB === 0) {
|
||||
@@ -250,6 +317,45 @@ document.addEventListener('alpine:init', () => {
|
||||
this.no_of_daysDOB = Array.from({ length: daysInMonth }, (_, i) => i + 1);
|
||||
},
|
||||
|
||||
// edit dob
|
||||
e_prevMonthDOB() {
|
||||
if (this.e_monthDOB === 0) {
|
||||
this.e_yearDOB--;
|
||||
this.e_monthDOB = 11;
|
||||
} else {
|
||||
this.e_monthDOB--;
|
||||
}
|
||||
this.e_getNoOfDaysDOB();
|
||||
},
|
||||
|
||||
e_nextMonthDOB() {
|
||||
if (this.e_monthDOB === 11) {
|
||||
this.e_yearDOB++;
|
||||
this.e_monthDOB = 0;
|
||||
} else {
|
||||
this.e_monthDOB++;
|
||||
}
|
||||
this.e_getNoOfDaysDOB();
|
||||
},
|
||||
|
||||
e_setDateDOB(date) {
|
||||
let selectedDate = new Date(this.e_yearDOB, this.e_monthDOB, date);
|
||||
this.e_selectedDayDOB = date;
|
||||
this.e_datepickerValueDOB = this.formatDate(selectedDate);
|
||||
this.e_showDatepickerDOB = false;
|
||||
},
|
||||
|
||||
e_isSelectedDOB(date) {
|
||||
return this.e_selectedDayDOB === date;
|
||||
},
|
||||
|
||||
e_getNoOfDaysDOB() {
|
||||
let daysInMonth = new Date(this.e_yearDOB, this.e_monthDOB + 1, 0).getDate();
|
||||
let dayOfWeek = new Date(this.e_yearDOB, this.e_monthDOB, 1).getDay();
|
||||
this.e_blankdaysDOB = Array.from({ length: dayOfWeek }, (_, i) => i);
|
||||
this.e_no_of_daysDOB = Array.from({ length: daysInMonth }, (_, i) => i + 1);
|
||||
},
|
||||
|
||||
// datepicker
|
||||
|
||||
// multiple select
|
||||
@@ -298,7 +404,36 @@ document.addEventListener('alpine:init', () => {
|
||||
this.selectedPemeriksaan.splice(index, 1);
|
||||
},
|
||||
|
||||
// edit multiple
|
||||
openPemeriksaanEdit: false,
|
||||
e_searchPemeriksaan: "",
|
||||
e_selectedPemeriksaan: [],
|
||||
e_filteredItemPemeriksaan: [],
|
||||
e_filterItemPemeriksaan() {
|
||||
if (this.e_searchPemeriksaan.trim() === '') {
|
||||
this.e_filteredPemeriksaan = [...this.dataPemeriksaan];
|
||||
} else {
|
||||
this.e_filteredPemeriksaan = this.dataPemeriksaan.filter((item) =>
|
||||
item.namaPemeriksaan.toLowerCase().includes(this.e_searchPemeriksaan.toLowerCase())
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
e_ItemPemeriksaan(item) {
|
||||
if (!this.e_selectedPemeriksaan.some(p => p.idPemeriksaan === item.idPemeriksaan)) {
|
||||
this.e_selectedPemeriksaan.push(item);
|
||||
this.objFormEdit.pemeriksaan.push(item);
|
||||
}
|
||||
this.e_searchPemeriksaan = "";
|
||||
this.e_filterItemPemeriksaan();
|
||||
},
|
||||
|
||||
e_removeItemPemeriksaan(index) {
|
||||
this.e_selectedPemeriksaan.splice(index, 1);
|
||||
},
|
||||
|
||||
// multiple select
|
||||
|
||||
showDialogAdd: false,
|
||||
showDialogEdit: false,
|
||||
loadingVerifikasi: false,
|
||||
@@ -307,11 +442,11 @@ document.addEventListener('alpine:init', () => {
|
||||
dataOrder: [
|
||||
{
|
||||
idOrder: 1,
|
||||
date: '02/03/2025',
|
||||
date: '01/03/2025',
|
||||
mrn: 'P.2024.205.1',
|
||||
sid: 'SRK1234SK',
|
||||
name: 'Joko Santoso',
|
||||
dob: '01/03/2000',
|
||||
dob: '09/05/2008',
|
||||
pemeriksaanStr: 'SGOT, SGPT, GLOB, TBIL',
|
||||
dataPemeriksaan: [
|
||||
{
|
||||
@@ -414,9 +549,12 @@ document.addEventListener('alpine:init', () => {
|
||||
],
|
||||
|
||||
mrnAdd: '',
|
||||
e_mrn: '',
|
||||
datePickerValueAdd: '',
|
||||
sidAdd: '',
|
||||
e_sid: '',
|
||||
nameAdd: '',
|
||||
e_name: '',
|
||||
dobAdd: '',
|
||||
pemeriksaanAdd: [],
|
||||
objForm: {
|
||||
@@ -427,6 +565,14 @@ document.addEventListener('alpine:init', () => {
|
||||
dob: '',
|
||||
pemeriksaan: [],
|
||||
},
|
||||
objFormEdit: {
|
||||
date: '',
|
||||
mrn: '',
|
||||
sid: '',
|
||||
name: '',
|
||||
dob: '',
|
||||
pemeriksaan: [],
|
||||
},
|
||||
// 1. Inisialisasi End
|
||||
// 2. Fungsi Start
|
||||
closeDialog() {
|
||||
@@ -461,36 +607,61 @@ document.addEventListener('alpine:init', () => {
|
||||
this.selectedInstrumentEdit = item;
|
||||
},
|
||||
onChangeMrnAdd() {
|
||||
this.objForm.assayCode = this.mrnAdd;
|
||||
this.objForm.mrn = this.mrnAdd;
|
||||
},
|
||||
onChangeMrnEdit() {
|
||||
this.objFormEdit.mrn = this.e_mrn;
|
||||
},
|
||||
onChangeSidAdd() {
|
||||
this.objForm.sid = this.sidAdd;
|
||||
},
|
||||
onChangeSidEdit() {
|
||||
this.objFormEdit.sid = this.e_sid;
|
||||
},
|
||||
onChangeNameAdd() {
|
||||
this.objForm.name = this.nameAdd;
|
||||
},
|
||||
onChangeNameEdit() {
|
||||
this.objFormEdit.name = this.e_name;
|
||||
},
|
||||
onChangeInstrumentMobile(item) {
|
||||
this.openInstrumentSearchMobile = false;
|
||||
// this.selectedInstrument = item;
|
||||
this.selectedInstrument = { ...item };
|
||||
},
|
||||
openModalEdit(item) {
|
||||
this.selectedInstrumentEdit = {
|
||||
idInstrument: item.idInstrument,
|
||||
namaInstrument: item.namaInstrument
|
||||
}
|
||||
// Order date edit
|
||||
let selectedDate = new Date(item.date.split('/').reverse().join('-'));
|
||||
this.e_selectedDayOD = selectedDate.getDate();
|
||||
this.e_monthOD = selectedDate.getMonth();
|
||||
this.e_yearOD = selectedDate.getFullYear();
|
||||
this.e_datepickerValueOD = this.formatDate(selectedDate);
|
||||
this.e_getNoOfDaysOD();
|
||||
|
||||
this.assayCodeEdit = item.assayCode
|
||||
this.decimalFontEdit = item.decimalFont
|
||||
this.formulaEdit = item.formula
|
||||
// mrn
|
||||
this.e_mrn = item.mrn
|
||||
|
||||
// sid
|
||||
this.e_sid = item.sid
|
||||
|
||||
// name
|
||||
this.e_name = item.name
|
||||
|
||||
// DOB edit
|
||||
let selectedDateDOB = new Date(item.dob.split('/').reverse().join('-'));
|
||||
this.e_selectedDayDOB = selectedDateDOB.getDate();
|
||||
this.e_monthDOB = selectedDateDOB.getMonth();
|
||||
this.e_yearDOB = selectedDateDOB.getFullYear();
|
||||
this.e_datepickerValueDOB = this.formatDate(selectedDateDOB);
|
||||
this.e_getNoOfDaysDOB();
|
||||
|
||||
// multiple pemeriksaan
|
||||
this.e_selectedPemeriksaan = [...item.dataPemeriksaan];
|
||||
this.e_filteredPemeriksaan = [...this.dataPemeriksaan];
|
||||
|
||||
this.showDialogEdit = !this.showDialogEdit;
|
||||
},
|
||||
closeDialogEdit() {
|
||||
this.loadingVerifikasi = false;
|
||||
this.isErrorVerifikasi = false;
|
||||
this.isVerifikasiDone = false;
|
||||
this.hasilVerifikasi = ''
|
||||
this.showDialogEdit = !this.showDialogEdit;
|
||||
},
|
||||
editMobilePage(item) {
|
||||
|
||||
Reference in New Issue
Block a user