step 53 : copy dan paste v1, untuk komponen reusable
This commit is contained in:
94
v1-test-cmp/js/assay_format_mobile_add.js
Normal file
94
v1-test-cmp/js/assay_format_mobile_add.js
Normal file
@@ -0,0 +1,94 @@
|
||||
document.addEventListener('alpine:init', () => {
|
||||
Alpine.data('assayFormatMobileAdd', () => ({
|
||||
// 0. Init dijalankan sebelum inisialisasi
|
||||
init() {
|
||||
|
||||
},
|
||||
// 1. Inisialisasi Start
|
||||
loadingVerifikasi: false,
|
||||
decimalFont: '',
|
||||
assayCode: '',
|
||||
formula: '',
|
||||
selectedInstrument: {
|
||||
idInstrument: -1,
|
||||
namaInstrument: 'Instrument'
|
||||
},
|
||||
openInstrument: false,
|
||||
dataInstrument: [
|
||||
{
|
||||
idInstrument: 1,
|
||||
namaInstrument: 'Hema 01',
|
||||
},
|
||||
{
|
||||
idInstrument: 2,
|
||||
namaInstrument: 'Axsym',
|
||||
},
|
||||
{
|
||||
idInstrument: 3,
|
||||
namaInstrument: 'Cobas C311',
|
||||
},
|
||||
],
|
||||
hasilVerifikasi: '',
|
||||
isErrorVerifikasi: false,
|
||||
isVerifikasiDone: false,
|
||||
objForm: {
|
||||
isValidForm: false,
|
||||
idInstrument: -1,
|
||||
namaInstrument: 'Instrument',
|
||||
decimalFont: '',
|
||||
assayCode: '',
|
||||
formula: '',
|
||||
},
|
||||
// 1. Inisialisasi End
|
||||
// 2. Fungsi Start
|
||||
onChangeFormula() {
|
||||
this.objForm.formula = this.formula;
|
||||
this.validateForm();
|
||||
},
|
||||
onChangeDecimalFont() {
|
||||
this.objForm.decimalFont = this.decimalFont;
|
||||
this.validateForm();
|
||||
},
|
||||
onChangeAssayCode() {
|
||||
this.objForm.assayCode = this.assayCode;
|
||||
this.validateForm();
|
||||
},
|
||||
onChangeInstrument(item) {
|
||||
this.selectedInstrument = item;
|
||||
this.objForm.idInstrument = item.idInstrument;
|
||||
this.objForm.namaInstrument = item.namaInstrument;
|
||||
this.validateForm();
|
||||
},
|
||||
onProcessVerifikasi() {
|
||||
if(this.isVerifikasiDone == true) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.loadingVerifikasi = true;
|
||||
|
||||
setTimeout(() => {
|
||||
this.loadingVerifikasi = false;
|
||||
this.isErrorVerifikasi = false;
|
||||
this.isVerifikasiDone = true;
|
||||
this.hasilVerifikasi = 'Formula is valid';
|
||||
}, 2000);
|
||||
},
|
||||
validateForm() {
|
||||
this.objForm.isValidForm = (
|
||||
this.selectedInstrument.idInstrument != -1 &&
|
||||
this.decimalFont.trim() !== '' &&
|
||||
this.assayCode.trim() !== '' &&
|
||||
this.formula.trim() !== ''
|
||||
);
|
||||
},
|
||||
save() {
|
||||
if (this.objForm.isValidForm === true) {
|
||||
alert('true')
|
||||
} else {
|
||||
alert('inputan harus diisi');
|
||||
}
|
||||
},
|
||||
// 2. Fungsi End
|
||||
})
|
||||
)
|
||||
})
|
||||
Reference in New Issue
Block a user