parseKenhNdCd method
dynamic
parseKenhNdCd(
- dynamic field,
- Control control
)
Implementation
dynamic parseKenhNdCd(dynamic field, Control control) {
dynamic parsed = {};
control.required = false;
// control.enabled.value = true;
switch (field?['LOAI']) {
case "C": //C – Control input – nhập liệu
if (field?['KIEU'] == "B") {
// B – Bắt buộc nhập dữ liệu
control.required = true;
} else if (field?['KIEU'] == "D") {
control.enabled.value = false;
}
if (field?['KIEU_NH'] == "S") {
//K – Đươc phép nhập freetext S – Chỉ được nhập chữ N – Chỉ được nhập số
// parsed['key'] = { ...type, numberOnly: true };
} else if (field?['KIEU_NH'] == "C") {
// type = { ...type, textOnly: true };
}
if (field?['AN'] == "C") {
//K – Hiển thị cho phép thao tác.
control.setVisible(false);
control.setHideFromKenhNdCdLke(true);
} else if (field?['AN'] == "K") {
control.setHideFromKenhNdCdLke(false);
control.setVisible(true);
}
if (field?['TEN'] != null && field?['TEN'] != "") {
control.title.value = field['TEN'];
}
break;
case "G": //G – Control Lable thể hiện tên
control.setVisible(true);
if (field?['TEN'] != null && field?['TEN'] != "") {
control.title.value = field['TEN'];
}
if (field?['KIEU'] == "B") {
// B – Bắt buộc nhập dữ liệu
control.required = true;
}
if (field?['AN'] == "C") {
control.setVisible(false);
control.setHideFromKenhNdCdLke(true);
} else if (field?['AN'] == "K") {
control.setHideFromKenhNdCdLke(false);
control.setVisible(true);
}
break;
}
return parsed;
}