-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnav_auto.js
More file actions
50 lines (46 loc) · 2.1 KB
/
nav_auto.js
File metadata and controls
50 lines (46 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var Navicon = Navicon || {};
Navicon = {
formTypeEnum: Object.freeze({
"Undefined": 0,
"Create": 1,
"Update": 2,
"Read Only": 3,
"Disabled": 4,
"Bulk Edit": 6
})
}
Navicon.nav_auto = (function () {
/* Поля на объекте Автомобиль new_auto: Пробег, Количество владельцев, был в ДТП отображаются только при значении в поле С пробегом(new_used)=true.*/
function UsedOnChange (context) {
let formContext = context.getFormContext();
try {
let isUsed = formContext.getAttribute('nav_used').getValue();
if (isUsed) {
formContext.getControl('nav_km').setVisible(true);
formContext.getControl('nav_ownerscount').setVisible(true);
formContext.getControl('nav_isdamaged').setVisible(true);
} else {
formContext.getControl('nav_km').setVisible(false);
formContext.getControl('nav_ownerscount').setVisible(false);
formContext.getControl('nav_isdamaged').setVisible(false);
}
} catch (e) {
formContext.ui.setFormNotification("Ошибка, возможно отсустствует поле. " + e.message, "ERROR", "ER-WRNG-AGRM-DAT");
}
}
return {
OnLoad: function (context) {
let formContext = context.getFormContext();
try {
if (formContext.ui.getFormType() === Navicon.formTypeEnum.Create) {
formContext.getControl('nav_km').setVisible(false);
formContext.getControl('nav_ownerscount').setVisible(false);
formContext.getControl('nav_isdamaged').setVisible(false);
}
formContext.getAttribute('nav_used').addOnChange(UsedOnChange);
} catch (e) {
formContext.ui.setFormNotification("Ошибка, возможно отсустствует поле. " + e.message, "ERROR", "ER-WRNG-AGRM-DAT");
}
}
}
})();