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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const expressionInfos = [{
name: "field-resolution",
expression: "($feature:any.status == 'Completed') && (!(IsEmpty($feature:any.resolution)))"
}, {
name: "category-AnimalProbType",
expression: "$feature:any.category == 'Animal'"
}, {
name: "category-BlightProbType",
expression: "$feature:any.category == 'Blight'"
}, {
name: "group-update",
expression: "($feature:any.status == 'Submitted') || ($feature:any.status == 'Received')"
}];
// This snippet sets individual field elements within the form's template
// Individual field elements to display
const fieldStatus = new FieldElement({
fieldName: "status",
editable: false,
label: "Issue status",
description: "E.g. submitted, received, in progress, or completed.",
});
const fieldResolution = new FieldElement({
fieldName: "resolution",
label: "Resolution",
editable: false,
description: "Resolution if status is set to Completed",
visibilityExpression: "field-resolution",
});
// The following sets field elements and passes it into a group element
const fieldCat = new FieldElement({
fieldName: "category",
label: "Category"
});
const fieldAnimal = new FieldElement({
fieldName: "AnimalProbType",
label: "Animal problem type",
visibilityExpression: "category-AnimalProbType",
description: "E.g. barking dog, bite, etc."
});
const fieldBlight = new FieldElement({
fieldName: "BlightProbType",
label: "Blight problem type",
description: "E.g. graffiti, abandoned vehicle, etc.",
visibilityExpression: "category-BlightProbType"
});
//Create the group element and pass in the field elements from above
const groupUpdate = new GroupElement({
label: "Update issue",
description: "If work has not yet begun on issue, categorize and detail the problem",
visibilityExpression: "group-update",
elements: [fieldCat, fieldAnimal, fieldBlight]
});
// Create the feature form and pass in the elements from above into the form template
const form = new FeatureForm({
container: "form",
groupDisplay: "sequential",
formTemplate: {
title: "Report issues",
description: "Provide information to the questions below",
elements: [fieldStatus, fieldResolution, groupUpdate, groupPOC],
expressionInfos: expressionInfos
}
});