-
Notifications
You must be signed in to change notification settings - Fork 0
/
GrassCarpQAQC.html
948 lines (888 loc) · 41.2 KB
/
GrassCarpQAQC.html
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>
GCR Program Database Verification App
</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.29/esri/themes/light/main.css" />
<script src="https://js.arcgis.com/4.29/"></script>
<script type="module" src="https://js.arcgis.com/calcite-components/2.4.0/calcite.esm.js"></script>
<link rel="stylesheet" type="text/css" href="https://js.arcgis.com/calcite-components/2.4.0/calcite.css" />
<script>
require([
"esri/views/MapView",
"esri/WebMap",
"esri/portal/Portal",
"esri/identity/IdentityManager",
"esri/identity/OAuthInfo",
"esri/layers/FeatureLayer",
"esri/portal/PortalItem",
"esri/widgets/Home",
"esri/widgets/LayerList",
"esri/PopupTemplate",
"esri/support/actions/ActionButton",
"esri/core/reactiveUtils",
"esri/popup/content/FieldsContent",
"esri/popup/content/RelationshipContent",
"esri/popup/FieldInfo",
"esri/layers/Layer",
"esri/widgets/Features",
"esri/layers/support/LabelClass",
"esri/widgets/Expand",
"esri/widgets/Legend",
"esri/popup/content/AttachmentsContent",
"esri/widgets/Editor",
"esri/form/FormTemplate",
"esri/form/elements/FieldElement",
"esri/form/elements/RelationshipElement",
"esri/form/ExpressionInfo",
], (
MapView,
WebMap,
Portal,
IdentityManager,
OAuthInfo,
FeatureLayer,
PortalItem,
Home,
LayerList,
PopupTemplate,
ActionButton,
reactiveUtils,
FieldsContent,
RelationshipContent,
FieldInfo,
Layer,
Features,
LabelClass,
Expand,
Legend,
AttachmentsContent,
Editor,
FormTemplate,
FieldElement,
RelationshipElement,
ExpressionInfo,
) => {
// Authenticate to AGOL
const activePortal = new Portal({
authMode: "immediate",
});
const activeCreds = new OAuthInfo({
appId: "YJmzOVei1kPsElhn",
});
IdentityManager.registerOAuthInfos([activeCreds]);
void activePortal.load().then(async () => {
let userName = activePortal.user.username;
const testingUsers = ["[email protected]_fws", "[email protected]_fws"];
if (testingUsers.includes(userName)) {
const testUsername = prompt("What username are you impersonating?");
userName = testUsername.toLocaleLowerCase();
};
const configTable = new FeatureLayer({
portalItem: {
id: "237834693c4940379eb199e7755cbe94",
},
});
const configResults = await configTable.queryFeatures({ where: `Username = '${userName}'`, outFields: ["Verification_Item_ID"] });
const verificationLayer = new FeatureLayer({
portalItem: {
id: configResults.features[0].attributes["Verification_Item_ID"],
},
});
await verificationLayer.load();
const baseLayerServiceURL = verificationLayer.url;
const eventOperationsLayer = new FeatureLayer({
url: baseLayerServiceURL + "/0",
popupEnabled: true,
title: "GCR Survey Results (Form1)",
popupTemplate: new PopupTemplate({
title: "{other_location_collated}: {start_time} - {end_time}",
outFields: ["*"],
actions: [
new ActionButton({
title: "Verify",
id: "verify",
icon: "register",
}),
new ActionButton({
title: "Submit Edit Request",
id: "submit-edit-request",
icon: "submit",
})
],
fieldInfos: [
new FieldInfo({
fieldName: "great_lake_watershed",
label: "Which Great Lakes Watershed are you Sampling in?",
}),
new FieldInfo({
fieldName: "project_response",
label: "Project_Response",
}),
new FieldInfo({
fieldName: "experimental",
label: "Experimental Sampling?",
}),
new FieldInfo({
fieldName: "survey_date",
label: "Survey_Date",
format: {
dateFormat: "short-date",
}
}),
new FieldInfo({
fieldName: "survey_year",
label: "Year",
}),
new FieldInfo({
fieldName: "other_agency_collated",
label: "Agency_Name",
}),
new FieldInfo({
fieldName: "other_data_recorder_collated",
label: "Data_Recorder",
}),
new FieldInfo({
fieldName: "other_crew_member_collated",
label: "Crew Members",
}),
new FieldInfo({
fieldName: "other_vessel_collated",
label: "Vessel",
}),
new FieldInfo({
fieldName: "sampling_style",
label: "Sampling_Style",
}),
new FieldInfo({
fieldName: "other_sampling_partner_collated",
label: "Sampling Partner",
}),
new FieldInfo({
fieldName: "number_partners",
label: "Number_Tandem_Vessels",
}),
new FieldInfo({
fieldName: "tandem_unique",
label: "Tandem Unique ID",
}),
new FieldInfo({
fieldName: "habitat_recorder",
label: "Recording_Environmental_Data?",
}),
new FieldInfo({
fieldName: "sampling_method",
label: "Sampling_Protocol",
}),
new FieldInfo({
fieldName: "other_location_collated",
label: "Location",
}),
new FieldInfo({
fieldName: "water_body",
label: "Waterbody",
}),
new FieldInfo({
fieldName: "state_info",
label: "State",
}),
new FieldInfo({
fieldName: "run_number",
label: "Run Number",
}),
new FieldInfo({
fieldName: "gps_track",
label: "Did you Obtain a GPS Track?",
}),
new FieldInfo({
fieldName: "transect",
label: "Start_Transect",
}),
new FieldInfo({
fieldName: "end_transect",
label: "End_Transect",
}),
new FieldInfo({
fieldName: "VR100",
label: "Did you use a VR100?",
}),
new FieldInfo({
fieldName: "vr100_fish",
label: "Detect Fish on VR100?",
}),
new FieldInfo({
fieldName: "vr100_grass_carp",
label: "Was a Grass Carp, Non Grass Carp, or Both Detected?",
}),
new FieldInfo({
fieldName: "fish1",
label: "Fish_Tag1",
}),
new FieldInfo({
fieldName: "fish2",
label: "Fish_Tag2",
}),
new FieldInfo({
fieldName: "fish3",
label: "Fish_Tag3",
}),
new FieldInfo({
fieldName: "non_gc_tag1",
label: "Non_GC_Tag1",
}),
new FieldInfo({
fieldName: "non_gc_tag2",
label: "Non_GC_Tag2",
}),
new FieldInfo({
fieldName: "non_gc_tag3",
label: "Non_GC_Tag3",
}),
new FieldInfo({
fieldName: "start_time",
label: "Survey Start Date Time",
}),
new FieldInfo({
fieldName: "end_time",
label: "Survey End Date Time",
}),
new FieldInfo({
fieldName: "total_seconds",
label: "Total Seconds Shocked",
}),
new FieldInfo({
fieldName: "combination",
label: "Combination",
}),
new FieldInfo({
fieldName: "bycatch_count",
label: "Number_Bycatch",
}),
new FieldInfo({
fieldName: "site_comments",
label: "Site Comments",
}),
new FieldInfo({
fieldName: "total_gc",
label: "Total Grass Carp Captured",
}),
],
content: [
new FieldsContent(),
new RelationshipContent({
relationshipId: 0,
title: "grass_carp_capture Data",
displayCount: 3,
}),
new RelationshipContent({
relationshipId: 1,
title: "bycatch Data",
displayCount: 3,
}),
new RelationshipContent({
relationshipId: 2,
title: "effort Data",
displayCount: 2,
}),
new RelationshipContent({
relationshipId: 3,
title: "environment Data",
displayCount: 2,
}),
],
}),
formTemplate: new FormTemplate({
title: "Grass Carp Survey Record",
elements: [
new FieldElement({
fieldName: "event_verified",
label: "Verified",
}),
new RelationshipElement({
relationshipId: 0,
label: "grass_carp_capture Data",
displayCount: 3,
}),
new RelationshipElement({
relationshipId: 1,
label: "bycatch Data",
displayCount: 3,
}),
new RelationshipElement({
relationshipId: 2,
label: "effort Data",
displayCount: 2,
}),
new RelationshipElement({
relationshipId: 3,
label: "environment Data",
displayCount: 2,
}),
],
}),
});
const bycatchTable = new FeatureLayer({
url: baseLayerServiceURL + "/1",
listMode: "hide",
visible: false,
popupTemplate: new PopupTemplate({
title: "{Common_name}",
fieldInfos: [
new FieldInfo({
fieldName: "Common_name",
label: "Common Name",
}),
new FieldInfo({
fieldName: "count_bycatch",
label: "Count",
}),
new FieldInfo({
fieldName: "bycatch_method",
label: "Bycatch Capture Method",
}),
],
content: [new FieldsContent()],
}),
formTemplate: new FormTemplate({
title: "Bycatch Record",
elements: [
new FieldElement({
fieldName: "bycatch_verified",
label: "Verified",
}),
new RelationshipElement({
relationshipId: 1,
title: "event_operations Data",
displayCount: 1,
}),
],
}),
});
const effortTable = new FeatureLayer({
url: baseLayerServiceURL + "/2",
listMode: "hide",
visible: false,
popupTemplate: new PopupTemplate({
title: "{gear}",
fieldInfos: [
new FieldInfo({
fieldName: "gear",
label: "Gear",
}),
new FieldInfo({
fieldName: "EF_Brand",
label: "EF_Brand",
}),
new FieldInfo({
fieldName: "pulse_rate",
label: "Pulse_Rate",
}),
new FieldInfo({
fieldName: "duty_cycle",
label: "Duty_Cycle",
}),
new FieldInfo({
fieldName: "amps_min",
label: "Amps_Min",
}),
new FieldInfo({
fieldName: "amps_max",
label: "Amps_Max",
}),
new FieldInfo({
fieldName: "watts_min",
label: "Watts_Min",
}),
new FieldInfo({
fieldName: "watts_max",
label: "Watts_Max",
}),
new FieldInfo({
fieldName: "volts_min",
label: "Volts_Min",
}),
new FieldInfo({
fieldName: "volts_max",
label: "Volts_Max",
}),
new FieldInfo({
fieldName: "seconds_shocked",
label: "Total_Seconds_Shocked",
}),
new FieldInfo({
fieldName: "net_style",
label: "Net Set Style",
}),
new FieldInfo({
fieldName: "area_shocked",
label: "Area Shocked",
}),
new FieldInfo({
fieldName: "start_date_time",
label: "Start_Date_Time",
}),
new FieldInfo({
fieldName: "end_date_time",
label: "End_Date_Time",
}),
new FieldInfo({
fieldName: "effort_minutes",
label: "Effort (Minutes)",
}),
new FieldInfo({
fieldName: "start_latitude",
label: "Start_Latitude",
}),
new FieldInfo({
fieldName: "start_longitude",
label: "Start_Longitude",
}),
new FieldInfo({
fieldName: "end_latitude",
label: "End_Latitude",
}),
new FieldInfo({
fieldName: "end_longitude",
label: "End_Longitude",
}),
new FieldInfo({
fieldName: "number_grass_carp",
label: "Number of Grass Carp Captured",
}),
],
content: [new FieldsContent()],
}),
formTemplate: new FormTemplate({
title: "Effort Record",
elements: [
new FieldElement({
fieldName: "effort_verified",
label: "Verified",
}),
new RelationshipElement({
relationshipId: 2,
title: "event_operations Data",
displayCount: 1,
}),
],
}),
});
const environmentTable = new FeatureLayer({
url: baseLayerServiceURL + "/3",
listMode: "hide",
visible: false,
popupTemplate: new PopupTemplate({
title: "Environment Data",
fieldInfos: [
new FieldInfo({
fieldName: "water_temp",
label: "Water_Temp(C)",
}),
new FieldInfo({
fieldName: "specific_conductivity",
label: "Specific_Conductivity",
}),
new FieldInfo({
fieldName: "ambient_conductivity",
label: "Ambient_Conductivity",
}),
new FieldInfo({
fieldName: "percent_do",
label: "Percent_DO",
}),
new FieldInfo({
fieldName: "mgL_do",
label: "mg/L_DO",
}),
new FieldInfo({
fieldName: "turbidity",
label: "Turbidity",
}),
new FieldInfo({
fieldName: "ph",
label: "pH",
}),
new FieldInfo({
fieldName: "secchi_depth",
label: "Secchi_Depth",
}),
new FieldInfo({
fieldName: "aquatic_veg_cover",
label: "Aquatic Veg Cover",
}),
new FieldInfo({
fieldName: "vegetation_type",
label: "Vegetation Type",
}),
new FieldInfo({
fieldName: "other_veg_observed_collated",
label: "Vegetation Observed",
}),
new FieldInfo({
fieldName: "woody_debris",
label: "Woody Debris Cover",
}),
new FieldInfo({
fieldName: "woody_debris_type",
label: "Woody Debris Type",
}),
new FieldInfo({
fieldName: "substrate",
label: "Substrate",
}),
new FieldInfo({
fieldName: "shoreline",
label: "Shoreline",
}),
new FieldInfo({
fieldName: "depth_min",
label: "Depth_Min(m)",
}),
new FieldInfo({
fieldName: "depth_max",
label: "Depth_Max(m)",
}),
],
content: [new FieldsContent()],
}),
formTemplate: new FormTemplate({
title: "Environment Record",
elements: [
new FieldElement({
fieldName: "enviro_verified",
label: "Verified",
}),
new RelationshipElement({
relationshipId: 3,
title: "event_operations Data",
displayCount: 1,
}),
],
}),
});
const grass_carp_capture_table = new FeatureLayer({
url: baseLayerServiceURL + "/4",
listMode: "hide",
visible: false,
popupTemplate: new PopupTemplate({
title: "{fish_harvest_UID}",
fieldInfos: [
new FieldInfo({
fieldName: "previously_caught",
label: "Was this fish previously caught?",
}),
new FieldInfo({
fieldName: "grass_carp_harvest",
label: "Is this fish being harvested or released?",
}),
new FieldInfo({
fieldName: "grass_carp_surgery",
label: "Is this fish being tagged?",
}),
new FieldInfo({
fieldName: "transmitter_UID",
label: "Transmitter #",
}),
new FieldInfo({
fieldName: "floytag_UID",
label: "Floy Tag #",
}),
new FieldInfo({
fieldName: "capture_waterbody",
label: "Capture Waterbody",
}),
new FieldInfo({
fieldName: "capture_date_time",
label: "Capture Date and Time",
}),
new FieldInfo({
fieldName: "capture_latitude",
label: "Capture Latitude",
}),
new FieldInfo({
fieldName: "capture_longitude",
label: "Capture Longitude",
}),
new FieldInfo({
fieldName: "capture_method",
label: "Capture Method",
}),
new FieldInfo({
fieldName: "capture_agency",
label: "Capture Agency",
}),
new FieldInfo({
fieldName: "capture_vessel",
label: "Capture Vessel",
}),
new FieldInfo({
fieldName: "seconds_to_capture",
label: "Number of Seconds Shocked to Capture",
}),
new FieldInfo({
fieldName: "bait_platform",
label: "Captured Near Bait Platform?",
}),
new FieldInfo({
fieldName: "bait_name",
label: "Bait Platform Name",
}),
new FieldInfo({
fieldName: "fish_harvest_UID",
label: "Fish Unique ID",
}),
new FieldInfo({
fieldName: "total_length",
label: "Total Length (mm)",
}),
new FieldInfo({
fieldName: "fork_length",
label: "Fork Length (mm)",
}),
new FieldInfo({
fieldName: "girth",
label: "Girth (mm)",
}),
new FieldInfo({
fieldName: "weight",
label: "Weight (kg)",
}),
new FieldInfo({
fieldName: "pec_fin",
label: "Is the pectoral fin Smooth or Rough?",
}),
new FieldInfo({
fieldName: "blood_sample",
label: "blood_sample",
}),
new FieldInfo({
fieldName: "blood_sample_UID",
label: "Blood Barcode UID",
}),
new FieldInfo({
fieldName: "virology_sample",
label: "virology_sample",
}),
new FieldInfo({
fieldName: "virology_sample_UID",
label: "SVCV Barcode UID",
}),
new FieldInfo({
fieldName: "genetics_sample",
label: "genetics_sample",
}),
],
content: [
new FieldsContent(),
new AttachmentsContent({
displayType: "list",
title: "Attachments",
}),
],
}),
formTemplate: new FormTemplate({
title: "Grass Carp Capture Record",
expressionInfos: [
new ExpressionInfo({
name: "notYes",
expression: "$feature.capture_verified != 'Yes'",
}),
],
elements: [
new FieldElement({
fieldName: "capture_verified",
label: "Verified",
editableExpression: "notYes",
}),
new RelationshipElement({
relationshipId: 0,
title: "event_operations Data",
displayCount: 1,
}),
],
}),
});
// Load webmap from AGOL
const webmap = new WebMap({
portalItem: {
id: "5994ac947ba74732bbd06048fe647813"
}
});
// Wait until webmap loads to add layers and zoom to extent
webmap.when(() => {
webmap.tables.add(bycatchTable);
webmap.tables.add(effortTable);
webmap.tables.add(environmentTable);
webmap.tables.add(grass_carp_capture_table);
webmap.add(eventOperationsLayer);
eventOperationsLayer.queryExtent().then(function (results) {
view.goTo(results.extent);
});
});
const view = new MapView({
map: webmap,
container: "viewDiv",
zoom: 7,
center: [-82, 42],
popupEnabled: false,
});
const homeWidget = new Home({
view: view,
});
view.ui.add(homeWidget, "top-left");
const layerListWidget = new LayerList({
view: view,
});
const layerListExpand = new Expand({
view: view,
content: layerListWidget
});
view.ui.add(layerListExpand, "top-right");
const legendWidget = new Legend({
view: view,
});
const legendExpand = new Expand({
view: view,
content: legendWidget,
});
view.ui.add(legendExpand, "bottom-right");
const featuresWidget = new Features({
container: "features-widget",
view: view,
});
const editorWidget = new Editor({
view: view,
visibleElements: {
createFeaturesSection: false,
},
layerInfos: [{
layer: eventOperationsLayer,
geometryUpdatesEnabled: false,
}]
});
reactiveUtils.on(
() => view,
"click",
(event) => {
featuresWidget.open({
location: event.mapPoint,
fetchFeatures: true,
});
// Clear and remove the editor widget if a different point is selected on the map
if (view.ui.find(editorWidget.id)) {
editorWidget.cancelWorkflow();
view.ui.remove(editorWidget);
}
}
);
reactiveUtils.on(
() => featuresWidget,
"trigger-action",
async (event) => {
let currentObjectID;
switch (event.action.id) {
case "verify":
currentObjectID = featuresWidget.selectedFeature.attributes["OBJECTID"];
view.ui.add(editorWidget, "bottom-left");
editorWidget.startUpdateWorkflowAtFeatureEdit(featuresWidget.selectedFeature);
// view.closePopup();
// eventOperationsLayer.refresh();
// eventOperationsLayer.queryExtent().then(function (results) {
// view.goTo(results.extent);
// });
break;
case "submit-edit-request":
currentObjectID = featuresWidget.selectedFeature.attributes["OBJECTID"];
const modalReference = document.getElementById("modal-reference");
modalReference.innerHTML = "Form_1 ObjectID: " + currentObjectID + "<br />";
// Get related grass_carp_capture record ids
const gccRelQuery = {
relationshipId: 0,
outFields: ["OBJECTID", "fish_harvest_UID"],
objectIds: [currentObjectID]
};
const gccRelResults = await featuresWidget.selectedFeature.layer.queryRelatedFeatures(gccRelQuery);
if (gccRelResults[currentObjectID]) {
for (const gcc of gccRelResults[currentObjectID].features) {
modalReference.innerHTML += "Grass_Carp_Harvest_info " + gcc.attributes["fish_harvest_UID"] + " ObjectID: " + gcc.attributes["OBJECTID"] + "<br />"
}
}
// Get related bycatch record ids
const bycatchRelQuery = {
relationshipId: 1,
outFields: ["OBJECTID", "Common_name"],
objectIds: [currentObjectID]
};
const bycatchRelResults = await featuresWidget.selectedFeature.layer.queryRelatedFeatures(bycatchRelQuery);
if (bycatchRelResults[currentObjectID]) {
for (const bycatch of bycatchRelResults[currentObjectID].features) {
modalReference.innerHTML += "Bycatch " + bycatch.attributes["Common_name"] + " ObjectID: " + bycatch.attributes["OBJECTID"] + "<br />"
}
}
// Get related effort record ids
const effortRelQuery = {
relationshipId: 2,
outFields: ["OBJECTID", "gear"],
objectIds: [currentObjectID]
};
const effortRelResults = await featuresWidget.selectedFeature.layer.queryRelatedFeatures(effortRelQuery);
if (effortRelResults[currentObjectID]) {
for (const effort of effortRelResults[currentObjectID].features) {
modalReference.innerHTML += "Effort " + effort.attributes["gear"] + " ObjectID: " + effort.attributes["OBJECTID"] + "<br />"
}
}
// Get related environment record ids
const environmentRelQuery = {
relationshipId: 3,
outFields: ["OBJECTID"],
objectIds: [currentObjectID]
};
const environmentRelResults = await featuresWidget.selectedFeature.layer.queryRelatedFeatures(environmentRelQuery);
if (environmentRelResults[currentObjectID]) {
for (const environment of environmentRelResults[currentObjectID].features) {
modalReference.innerHTML += "Environment Data ObjectID: " + environment.attributes["OBJECTID"] + "<br />"
}
}
modal.open = true;
break;
}
}
);
const modal = document.getElementById("submit-edit-request-modal");
});
});
</script>
</head>
<body>
<calcite-shell>
<calcite-shell-panel slot="panel-start" position="start" width-scale="l">
<calcite-block heading="Select a Survey Response"></calcite-block>
<div id="features-widget" class="calcite-match-height"></div>
</calcite-shell-panel>
<div id="viewDiv"></div>
<calcite-modal aria-labelledby="modal-title" id="submit-edit-request-modal">
<div slot="header" id="modal-title">
GCR Program Database Edit Request
</div>
<div slot="content-top" id="modal-reference">
</div>
<div slot="content" id="modal-form">
<iframe width="100%" height="500px" id="edit-form"
src="https://forms.office.com/Pages/ResponsePage.aspx?id=urWTBhhLe02TQfMvQApUlBMTEF7xTIBBg2ecu-8zhehUOVRQMlRLM1JVTFdMV0FMMEpJWlVUWDBIOS4u"></iframe>
</div>
</calcite-modal>
</calcite-shell>
</body>
</html>