step 32 : perbaikan validasi form & verifikasi mobile add, desktop add
This commit is contained in:
@@ -5,9 +5,77 @@ document.addEventListener('alpine:init', () => {
|
||||
|
||||
},
|
||||
// 1. Inisialisasi Start
|
||||
dataSetting: [
|
||||
{
|
||||
idSetting: 1,
|
||||
idJenis: 1,
|
||||
namaJenis: 'TCP Server',
|
||||
info: 'Port 5001',
|
||||
port: '5001',
|
||||
idInterface: 1,
|
||||
namaInterface: 'XN550',
|
||||
idInstrument: 1,
|
||||
namaInstrument: 'Hema 01',
|
||||
server: '',
|
||||
idSerial: -1,
|
||||
namaSerial: '',
|
||||
speed: '',
|
||||
idParity: -1,
|
||||
namaParity: '',
|
||||
idDataBit: -1,
|
||||
namaDataBit: '',
|
||||
idStopBit: -1,
|
||||
namaStopBit: ''
|
||||
},
|
||||
{
|
||||
idSetting: 2,
|
||||
idJenis: 2,
|
||||
namaJenis: 'TCP Client',
|
||||
info: 'Server 192.168.0.1, Port 4000',
|
||||
port: '4000',
|
||||
idInterface: 2,
|
||||
namaInterface: 'Axsym',
|
||||
idInstrument: 2,
|
||||
namaInstrument: 'Axsym',
|
||||
server: '192.168.0.1',
|
||||
idSerial: 1,
|
||||
namaSerial: 'ttyS0',
|
||||
speed: '',
|
||||
idParity: -1,
|
||||
namaParity: '',
|
||||
idDataBit: -1,
|
||||
namaDataBit: '',
|
||||
idStopBit: -1,
|
||||
namaStopBit: ''
|
||||
},
|
||||
{
|
||||
idSetting: 3,
|
||||
idJenis: 3,
|
||||
namaJenis: 'RS232',
|
||||
info: 'ttyS01, 9600, N, 8, 1',
|
||||
port: '',
|
||||
idInterface: 3,
|
||||
namaInterface: 'C311',
|
||||
idInstrument: 3,
|
||||
namaInstrument: 'Cobas C311',
|
||||
server: '',
|
||||
idSerial: 1,
|
||||
namaSerial: 'ttyS0',
|
||||
speed: '19200',
|
||||
idParity: 1,
|
||||
namaParity: 'None',
|
||||
idDataBit: 2,
|
||||
namaDataBit: '6',
|
||||
idStopBit: 2,
|
||||
namaStopBit: '1'
|
||||
},
|
||||
],
|
||||
showDialogAdd: false,
|
||||
showDialogEdit: false,
|
||||
loadingVerifikasi: false,
|
||||
isVerifikasiDone: false,
|
||||
decimalFontEdit: '',
|
||||
assayCodeEdit: '',
|
||||
decimalFont: '',
|
||||
assayCode: '',
|
||||
formulaEdit: '',
|
||||
@@ -42,6 +110,10 @@ document.addEventListener('alpine:init', () => {
|
||||
idInstrument: -1,
|
||||
namaInstrument: 'Instrument'
|
||||
},
|
||||
selectedInstrumentAdd: {
|
||||
idInstrument: -1,
|
||||
namaInstrument: 'Instrument'
|
||||
},
|
||||
openInstrument: false,
|
||||
openInstrumentSearchMobile: false,
|
||||
openInstrumentSearch: false,
|
||||
@@ -61,6 +133,14 @@ document.addEventListener('alpine:init', () => {
|
||||
],
|
||||
hasilVerifikasi: '',
|
||||
isErrorVerifikasi: false,
|
||||
objForm: {
|
||||
isValidForm: false,
|
||||
idInstrument: -1,
|
||||
namaInstrument: 'Instrument',
|
||||
decimalFont: '',
|
||||
assayCode: '',
|
||||
formula: '',
|
||||
},
|
||||
// 1. Inisialisasi End
|
||||
// 2. Fungsi Start
|
||||
closeDialog(){
|
||||
@@ -77,19 +157,37 @@ document.addEventListener('alpine:init', () => {
|
||||
},
|
||||
onChangeInstrument(item){
|
||||
this.openInstrument = false;
|
||||
this.selectedInstrument = item;
|
||||
this.selectedInstrumentAdd = item;
|
||||
this.validateForm();
|
||||
},
|
||||
onChangeAssayCodeAdd() {
|
||||
this.objForm.assayCode = this.assayCode;
|
||||
this.validateForm();
|
||||
},
|
||||
onChangeDecimalFontAdd(){
|
||||
this.objForm.decimalFont = this.decimalFont;
|
||||
this.validateForm();
|
||||
},
|
||||
onChangeFormulaAdd(){
|
||||
this.objForm.formula = this.formulaAdd;
|
||||
this.validateForm();
|
||||
},
|
||||
onChangeInstrumentMobile(item){
|
||||
this.openInstrumentSearchMobile = false;
|
||||
// this.selectedInstrument = item;
|
||||
this.selectedInstrument = { ...item };
|
||||
},
|
||||
onProcessVerifiaksi(){
|
||||
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);
|
||||
},
|
||||
@@ -107,6 +205,14 @@ document.addEventListener('alpine:init', () => {
|
||||
closeDialogEdit(){
|
||||
this.showDialogEdit = !this.showDialogEdit;
|
||||
},
|
||||
validateForm() {
|
||||
this.objForm.isValidForm = (
|
||||
this.selectedInstrumentAdd.idInstrument != -1 &&
|
||||
this.decimalFont.trim() !== '' &&
|
||||
this.assayCode.trim() !== '' &&
|
||||
this.formulaAdd.trim() !== ''
|
||||
);
|
||||
},
|
||||
// 2. Fungsi End
|
||||
}))
|
||||
})
|
||||
94
v1/js/assay_format_mobile_add.js
Normal file
94
v1/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