-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgdt.php
More file actions
2454 lines (2309 loc) · 149 KB
/
gdt.php
File metadata and controls
2454 lines (2309 loc) · 149 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
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
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
include("sessions/handler.php");
include("load/config.php");
include("load/i18n.php");
include("load/org_context.php");
$is_canoc = (get_org_code() === 'canoc');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php $page_title = __('gdt.page.title'); include("load/header.php"); ?>
<!-- Info Bar Shared Styles -->
<link rel="stylesheet" href="assets/css/info-bar.css<?= _v('assets/css/info-bar.css') ?>">
<style>
.tmi-label {
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.05em;
font-weight: 600;
color: #333;
}
.tmi-section-title {
font-weight: 600;
font-size: 0.9rem;
text-transform: uppercase;
}
/* Default dark text for section titles in light backgrounds */
.card-header .tmi-section-title {
color: #333;
}
/* White text for section titles in dark/colored backgrounds */
.card-header.bg-primary .tmi-section-title,
.card-header.bg-secondary .tmi-section-title,
.card-header.bg-info .tmi-section-title,
.card-header.bg-success .tmi-section-title,
.card-header.bg-dark .tmi-section-title,
.card-header.text-white .tmi-section-title {
color: #fff;
}
.tmi-advisory-preview {
white-space: pre;
font-family: "Inconsolata", monospace;
font-size: 0.8rem;
color: #333;
}
.tmi-flight-table {
font-size: 0.8rem;
}
.tmi-badge-status {
font-size: 0.7rem;
text-transform: uppercase;
}
.tmi-airport-badge {
display: inline-block;
padding: 2px 6px;
border-radius: 3px;
font-size: 0.7rem;
font-weight: 600;
margin-right: 4px;
margin-bottom: 2px;
color: #000;
}
.tmi-airports-input {
transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.tmi-scope-select {
height: 140px;
}
.tmi-scope-help {
font-size: 0.7rem;
}
/* Ensure proper text contrast for card headers */
.card-header {
color: #333;
}
.card-header.bg-light {
color: #333;
}
.card-header.bg-light .tmi-label {
color: #333;
}
.card-header.bg-warning {
color: #333;
}
.card-header.bg-warning .tmi-label,
.card-header.bg-warning .font-weight-bold,
.card-header.bg-warning small {
color: #333;
}
/* Ensure secondary headers keep white text */
.card-header.bg-secondary {
color: #fff;
}
.card-header.bg-secondary .tmi-label {
color: #fff;
}
/* Ensure info headers keep white text */
.card-header.bg-info {
color: #fff;
}
.card-header.bg-info .tmi-label {
color: #fff;
}
/* Ensure primary headers keep white text */
.card-header.bg-primary {
color: #fff;
}
.card-header.bg-primary .tmi-label {
color: #fff;
}
/* Ensure success headers keep white text */
.card-header.bg-success {
color: #fff;
}
/* Fix text-muted on dark table headers */
.thead-dark .text-muted {
color: rgba(255, 255, 255, 0.7) !important;
}
/* Ensure table header text is readable */
.tmi-flight-table thead th {
color: #333;
}
.tmi-flight-table .thead-dark th {
color: #fff;
}
.tmi-flight-table .thead-light th {
color: #333;
}
/* Badge text contrast fixes */
.badge-warning {
color: #333 !important;
}
/* Ensure text-warning is visible */
.tmi-flight-table .text-warning {
color: #c67c00 !important;
}
/* Ensure table text-muted is visible */
.tmi-flight-table .text-muted {
color: #6c757d !important;
}
/* Origin/Destination Analysis labels */
.text-uppercase.text-muted.font-weight-bold {
color: #555 !important;
}
/* Modal header text fixes */
.modal-header.bg-success .modal-title {
color: #fff;
}
.modal-header.bg-success .close {
color: #fff;
}
/* Summary stats table readability */
.table-borderless td {
color: #333;
}
/* Small text readability in cards */
.card-body .small,
.card-body small {
color: #333;
}
/* Pre/code readability */
pre {
color: #333;
}
/* ========== Active Programs Dashboard ========== */
.gdt-program-card {
min-width: 260px;
max-width: 340px;
flex: 1 1 260px;
border-radius: 6px;
border: 1px solid #dee2e6;
padding: 10px 14px;
background: #fff;
cursor: pointer;
transition: border-color 0.15s, box-shadow 0.15s;
position: relative;
}
.gdt-program-card:hover {
border-color: #007bff;
box-shadow: 0 0 0 2px rgba(0,123,255,0.15);
}
.gdt-program-card.selected {
border-color: #007bff;
box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}
.gdt-program-card .gdt-card-type {
display: inline-block;
padding: 1px 6px;
border-radius: 3px;
font-size: 0.65rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.03em;
color: #fff;
}
.gdt-card-type-gs { background: #dc3545; }
.gdt-card-type-gdp { background: #e67e22; }
.gdt-card-type-afp { background: #007bff; }
.gdt-program-card .gdt-card-status {
display: inline-block;
padding: 1px 5px;
border-radius: 3px;
font-size: 0.6rem;
font-weight: 600;
text-transform: uppercase;
}
.gdt-card-status-active { background: #d4edda; color: #155724; }
.gdt-card-status-modeling { background: #fff3cd; color: #856404; }
.gdt-card-status-proposed { background: #cce5ff; color: #004085; }
.gdt-card-status-transitioned { background: #e2e3e5; color: #383d41; }
.gdt-card-status-cancelled { background: #f8d7da; color: #721c24; }
.gdt-card-status-completed { background: #e2e3e5; color: #383d41; }
.gdt-program-card .gdt-card-element {
font-size: 1.1rem;
font-weight: 700;
color: #333;
}
.gdt-program-card .gdt-card-artcc {
font-size: 0.75rem;
color: #6c757d;
}
.gdt-program-card .gdt-card-time {
font-size: 0.75rem;
font-family: 'Inconsolata', monospace;
color: #555;
}
.gdt-program-card .gdt-card-progress {
height: 4px;
border-radius: 2px;
background: #e9ecef;
margin-top: 6px;
}
.gdt-program-card .gdt-card-progress-bar {
height: 100%;
border-radius: 2px;
background: #28a745;
transition: width 0.3s ease;
}
.gdt-program-card .gdt-card-metrics {
display: flex;
gap: 12px;
margin-top: 6px;
font-size: 0.7rem;
color: #555;
}
.gdt-program-card .gdt-card-metric-value {
font-weight: 700;
color: #333;
}
.gdt-program-card .gdt-card-actions {
display: flex;
flex-wrap: wrap;
gap: 4px;
margin-top: 8px;
}
.gdt-program-card .gdt-card-actions .btn {
font-size: 0.65rem;
padding: 1px 6px;
}
/* ========== Workflow Stepper ========== */
.gdt-step {
display: flex;
flex-direction: column;
align-items: center;
min-width: 80px;
}
.gdt-step-circle {
width: 32px;
height: 32px;
border-radius: 50%;
background: #e9ecef;
color: #6c757d;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 0.85rem;
border: 2px solid #dee2e6;
transition: all 0.2s ease;
}
.gdt-step.active .gdt-step-circle {
background: #007bff;
color: #fff;
border-color: #007bff;
}
.gdt-step.completed .gdt-step-circle {
background: #28a745;
color: #fff;
border-color: #28a745;
}
.gdt-step.completed .gdt-step-circle::after {
content: '\f00c';
font-family: 'Font Awesome 5 Free';
font-weight: 900;
}
.gdt-step-label {
font-size: 0.7rem;
font-weight: 600;
text-transform: uppercase;
color: #adb5bd;
margin-top: 4px;
letter-spacing: 0.03em;
}
.gdt-step.active .gdt-step-label {
color: #007bff;
}
.gdt-step.completed .gdt-step-label {
color: #28a745;
}
.gdt-step-line {
flex: 1;
height: 2px;
background: #dee2e6;
margin: 14px 8px 0;
min-width: 40px;
max-width: 120px;
transition: background 0.2s ease;
}
.gdt-step-line.completed {
background: #28a745;
}
/* Icon-only button sizing fix */
/* Ensures icon buttons in btn-group-sm have minimum width for visibility */
.btn-group-sm > .btn:has(> i.fas):not(:has(span)):not(:has(.sr-only)) {
min-width: 32px;
padding-left: 0.5rem;
padding-right: 0.5rem;
}
/* Fallback for browsers without :has() support */
#gs_view_flight_list_btn,
#gs_open_model_btn {
min-width: 36px;
padding: 0.25rem 0.5rem;
}
/* Ensure FontAwesome icons are visible */
#gs_view_flight_list_btn i,
#gs_open_model_btn i {
font-size: 0.875rem;
}
/* ========== Rate Table Styles (GDP + GS) ========== */
.gdt-rate-table {
table-layout: auto;
font-size: 0.75rem;
}
.gdt-rate-table thead th {
white-space: nowrap;
text-align: center;
font-size: 0.7rem;
padding: 0.2rem 0.3rem;
vertical-align: middle;
}
.gdt-rate-table tbody td {
white-space: nowrap;
padding: 0.15rem 0.25rem;
vertical-align: middle;
text-align: center;
}
.gdt-rate-table tbody td:first-child {
text-align: left;
min-width: 55px;
}
.gdt-rate-table input[type="number"] {
width: 50px;
padding: 0.15rem 0.25rem;
font-size: 0.75rem;
text-align: center;
-moz-appearance: textfield;
}
.gdt-rate-table input[type="number"]::-webkit-inner-spin-button,
.gdt-rate-table input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* GS rate editor toolbar */
.gdt-rate-toolbar {
display: flex;
align-items: center;
gap: 6px;
flex-wrap: wrap;
font-size: 0.75rem;
}
.gdt-rate-toolbar .btn {
font-size: 0.7rem;
padding: 0.15rem 0.5rem;
line-height: 1.4;
}
.gdt-rate-toolbar .gdt-fill-input {
width: 50px;
font-size: 0.75rem;
padding: 0.15rem 0.25rem;
text-align: center;
}
/* GDP fill row */
.gdp-fill-row {
display: flex;
align-items: center;
gap: 6px;
font-size: 0.75rem;
flex-wrap: wrap;
}
.gdp-fill-row label {
margin-bottom: 0;
font-size: 0.75rem;
}
.gdp-fill-row select {
width: auto;
min-width: 100px;
font-size: 0.75rem;
padding: 0.15rem 0.4rem;
}
.gdp-fill-row input[type="number"] {
width: 50px;
font-size: 0.75rem;
padding: 0.15rem 0.25rem;
text-align: center;
}
.gdp-fill-row .btn {
font-size: 0.7rem;
padding: 0.15rem 0.5rem;
line-height: 1.4;
}
</style>
</head>
<body>
<?php include("load/nav_public.php"); ?>
<section class="perti-hero perti-hero--dark-tool" data-jarallax data-speed="0.3">
<div class="container-fluid pt-2 pb-4 py-lg-5">
<img class="jarallax-img" src="assets/img/jumbotron/main.png" alt="" style="opacity: 50%;">
<center>
<h1><?= __('gdt.page.title') ?></h1>
<h4 class="text-white hvr-bob pl-1">
<a href="#gs_section" style="text-decoration: none; color: #fff;">
<i class="fas fa-chevron-down text-danger"></i>
<?= __('gdt.page.gsCoordination') ?>
</a>
</h4>
</center>
</div>
</section>
<div class="container-fluid mt-3 mb-5" id="gs_section">
<!-- Info Bar: UTC Clock, Local Times, Flight Stats -->
<div class="perti-info-bar mb-3">
<div class="row d-flex flex-wrap align-items-stretch" style="gap: 8px; margin: 0 -4px;">
<!-- Current Time (UTC) -->
<div class="col-auto px-1">
<div class="card shadow-sm perti-info-card perti-card-utc h-100">
<div class="card-body d-flex justify-content-between align-items-center">
<div>
<div class="perti-info-label"><?= __('gdt.page.currentUtc') ?></div>
<div id="tmi_utc_clock" class="perti-clock-display perti-clock-display-lg"></div>
</div>
<div class="ml-3">
<i class="far fa-clock fa-lg text-primary"></i>
</div>
</div>
</div>
</div>
<!-- Current Time (Local Time Zones) -->
<div class="col-auto px-1">
<div class="card shadow-sm perti-info-card perti-card-local h-100">
<div class="card-body">
<div class="perti-info-label mb-1"><?= __($is_canoc ? 'gdt.page.canadaLocalTimes' : 'gdt.page.usLocalTimes') ?></div>
<div class="perti-clock-grid">
<?php if ($is_canoc): ?>
<div class="perti-clock-item">
<div class="perti-clock-tz">PT</div>
<div id="tmi_clock_pac" class="perti-clock-display perti-clock-display-md"></div>
</div>
<div class="perti-clock-item">
<div class="perti-clock-tz">MT</div>
<div id="tmi_clock_mtn" class="perti-clock-display perti-clock-display-md"></div>
</div>
<div class="perti-clock-item">
<div class="perti-clock-tz">CT</div>
<div id="tmi_clock_cent" class="perti-clock-display perti-clock-display-md"></div>
</div>
<div class="perti-clock-item">
<div class="perti-clock-tz">ET</div>
<div id="tmi_clock_east" class="perti-clock-display perti-clock-display-md"></div>
</div>
<div class="perti-clock-item">
<div class="perti-clock-tz">AT</div>
<div id="tmi_clock_atl" class="perti-clock-display perti-clock-display-md"></div>
</div>
<div class="perti-clock-item">
<div class="perti-clock-tz">NL</div>
<div id="tmi_clock_nfl" class="perti-clock-display perti-clock-display-md"></div>
</div>
<?php else: ?>
<div class="perti-clock-item">
<div class="perti-clock-tz">GM</div>
<div id="tmi_clock_guam" class="perti-clock-display perti-clock-display-md"></div>
</div>
<div class="perti-clock-item">
<div class="perti-clock-tz">HI</div>
<div id="tmi_clock_hi" class="perti-clock-display perti-clock-display-md"></div>
</div>
<div class="perti-clock-item">
<div class="perti-clock-tz">AK</div>
<div id="tmi_clock_ak" class="perti-clock-display perti-clock-display-md"></div>
</div>
<div class="perti-clock-item">
<div class="perti-clock-tz">PT</div>
<div id="tmi_clock_pac" class="perti-clock-display perti-clock-display-md"></div>
</div>
<div class="perti-clock-item">
<div class="perti-clock-tz">MT</div>
<div id="tmi_clock_mtn" class="perti-clock-display perti-clock-display-md"></div>
</div>
<div class="perti-clock-item">
<div class="perti-clock-tz">CT</div>
<div id="tmi_clock_cent" class="perti-clock-display perti-clock-display-md"></div>
</div>
<div class="perti-clock-item">
<div class="perti-clock-tz">ET</div>
<div id="tmi_clock_east" class="perti-clock-display perti-clock-display-md"></div>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<!-- Global Flight Counts -->
<div class="col-auto px-1">
<div class="card shadow-sm perti-info-card perti-card-global h-100">
<div class="card-body">
<div class="perti-info-label mb-1">
<?= __('gdt.page.globalFlights') ?>
<span id="tmi_stats_global_total" class="badge badge-info badge-total ml-1">-</span>
</div>
<div class="perti-stat-grid">
<div class="perti-stat-item">
<div class="perti-stat-category">D→D</div>
<div id="tmi_stats_dd" class="perti-stat-value">-</div>
</div>
<div class="perti-stat-item">
<div class="perti-stat-category">D→I</div>
<div id="tmi_stats_di" class="perti-stat-value">-</div>
</div>
<div class="perti-stat-item">
<div class="perti-stat-category">I→D</div>
<div id="tmi_stats_id" class="perti-stat-value">-</div>
</div>
<div class="perti-stat-item">
<div class="perti-stat-category">I→I</div>
<div id="tmi_stats_ii" class="perti-stat-value">-</div>
</div>
</div>
</div>
</div>
</div>
<?php if (!$is_canoc): ?>
<!-- Domestic Flight Counts -->
<div class="col-auto px-1">
<div class="card shadow-sm perti-info-card perti-card-domestic h-100">
<div class="card-body">
<div class="perti-info-label mb-1">
<?= __('gdt.page.domesticArrivals') ?>
<span id="tmi_stats_domestic_total" class="badge badge-success badge-total ml-1">-</span>
</div>
<div class="d-flex">
<!-- By DCC Region -->
<div class="perti-stat-section">
<div class="perti-info-sublabel"><?= __('gdt.page.dccRegion') ?></div>
<div class="perti-badge-group">
<span class="badge badge-light" title="<?= __('gdt.page.northeastTooltip') ?>"><strong>NE</strong> <span id="tmi_stats_dcc_ne">-</span></span>
<span class="badge badge-light" title="<?= __('gdt.page.southeastTooltip') ?>"><strong>SE</strong> <span id="tmi_stats_dcc_se">-</span></span>
<span class="badge badge-light" title="<?= __('gdt.page.midwestTooltip') ?>"><strong>MW</strong> <span id="tmi_stats_dcc_mw">-</span></span>
<span class="badge badge-light" title="<?= __('gdt.page.southCentralTooltip') ?>"><strong>SC</strong> <span id="tmi_stats_dcc_sc">-</span></span>
<span class="badge badge-light" title="<?= __('gdt.page.westTooltip') ?>"><strong>W</strong> <span id="tmi_stats_dcc_w">-</span></span>
</div>
</div>
<!-- By Airport Tier -->
<div class="perti-stat-section">
<div class="perti-info-sublabel"><?= __('gdt.page.airportTier') ?></div>
<div class="perti-badge-group">
<span class="badge badge-warning text-dark" title="<?= __('gdt.page.aspm82Tooltip') ?>"><strong>ASPM82</strong> <span id="tmi_stats_aspm82">-</span></span>
<span class="badge badge-primary" title="<?= __('gdt.page.oep35Tooltip') ?>"><strong>OEP35</strong> <span id="tmi_stats_oep35">-</span></span>
<span class="badge badge-danger" title="<?= __('gdt.page.core30Tooltip') ?>"><strong>Core30</strong> <span id="tmi_stats_core30">-</span></span>
</div>
</div>
</div>
</div>
</div>
</div>
<?php endif; ?>
<!-- Spacer -->
<div class="col"></div>
<!-- Advisory Org Config -->
<div class="col-auto px-1">
<div class="card shadow-sm perti-info-card h-100">
<div class="card-body d-flex justify-content-between align-items-center py-2 px-3">
<button class="btn btn-sm btn-outline-secondary" onclick="AdvisoryConfig.showConfigModal();" data-toggle="tooltip" title="<?= __('gdt.page.advisoryFormatTooltip') ?>">
<i class="fas fa-globe mr-1"></i> <span id="advisoryOrgDisplay">DCC</span>
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Active Programs Dashboard -->
<div id="gdt_dashboard" class="mb-3" style="display: none;">
<div class="card shadow-sm">
<div class="card-header bg-dark text-white py-2 d-flex justify-content-between align-items-center"
style="cursor: pointer;" onclick="toggleDashboard();">
<span class="tmi-section-title">
<i class="fas fa-tachometer-alt mr-1"></i> <?= __('gdt.page.activePrograms') ?>
<span id="gdt_dashboard_count" class="badge badge-light ml-1" style="display: none;">0</span>
</span>
<div>
<button class="btn btn-sm btn-outline-light mr-1" id="gdt_new_program_btn"
onclick="event.stopPropagation(); resetAndNewProgram();"
data-toggle="tooltip" title="<?= __('gdt.page.createProgramTooltip') ?>">
<i class="fas fa-plus mr-1"></i> <?= __('gdt.page.newProgram') ?>
</button>
<i class="fas fa-chevron-down" id="gdt_dashboard_chevron"></i>
</div>
</div>
<div class="card-body py-2 px-3" id="gdt_dashboard_body">
<!-- No programs message -->
<div id="gdt_dashboard_empty" class="text-center text-muted py-2" style="display: none;">
<i class="fas fa-check-circle mr-1"></i> <?= __('gdt.page.noActivePrograms') ?>
</div>
<!-- Program cards container -->
<div id="gdt_dashboard_cards" class="d-flex flex-wrap" style="gap: 10px;">
</div>
<!-- Summary row -->
<div id="gdt_dashboard_summary" class="mt-2 pt-2 border-top small text-muted" style="display: none;">
<i class="fas fa-plane mr-1"></i>
<span id="gdt_dashboard_total_controlled">0</span> <?= __('gdt.page.controlledAcrossAll') ?>
<span class="mx-2">|</span>
<i class="fas fa-clock mr-1"></i> <?= __('gdt.page.lastRefreshed') ?> <span id="gdt_dashboard_refresh_time">-</span>
<span class="mx-2">|</span>
<a href="#" onclick="event.preventDefault(); toggleTimeline();" class="text-info">
<i class="fas fa-chart-bar mr-1"></i><span id="gdt_timeline_toggle_text"><?= __('gdt.page.showTimeline') ?></span>
</a>
</div>
<!-- Multi-Program Timeline -->
<div id="gdt_timeline_container" class="mt-2" style="display: none;">
<div style="position: relative; height: 120px; max-height: 200px;">
<canvas id="gdt_timeline_canvas"></canvas>
</div>
<div id="gdt_timeline_conflicts" class="mt-1 small"></div>
</div>
</div>
</div>
</div>
<!-- Workflow Stepper -->
<div id="gdt_stepper" class="mb-3">
<div class="d-flex align-items-center justify-content-center py-2">
<div class="gdt-step active" id="gdt_step_1" data-step="configure">
<div class="gdt-step-circle">1</div>
<div class="gdt-step-label"><?= __('gdt.page.stepConfigure') ?></div>
</div>
<div class="gdt-step-line" id="gdt_step_line_1"></div>
<div class="gdt-step" id="gdt_step_2" data-step="preview">
<div class="gdt-step-circle">2</div>
<div class="gdt-step-label"><?= __('gdt.page.stepPreview') ?></div>
</div>
<div class="gdt-step-line" id="gdt_step_line_2"></div>
<div class="gdt-step" id="gdt_step_3" data-step="model">
<div class="gdt-step-circle">3</div>
<div class="gdt-step-label"><?= __('gdt.page.stepModel') ?></div>
</div>
<div class="gdt-step-line" id="gdt_step_line_3"></div>
<div class="gdt-step" id="gdt_step_4" data-step="active">
<div class="gdt-step-circle">4</div>
<div class="gdt-step-label"><?= __('gdt.page.stepActive') ?></div>
</div>
<!-- What-If badge and discard button (hidden by default) -->
<span class="badge badge-warning ml-3 d-none" id="gdt_whatif_badge" style="font-size:0.75rem; vertical-align: middle;">WHAT-IF MODE</span>
<button class="btn btn-sm btn-outline-secondary ml-2 d-none" id="gdt_whatif_discard_btn" onclick="exitWhatIfMode();" style="vertical-align: middle;">
<i class="fas fa-undo mr-1"></i> <?= __('gdt.page.discardWhatIf') ?>
</button>
</div>
</div>
<div class="row">
<!-- Left: Ground Stop editor -->
<div class="col-lg-6 mb-4">
<div class="card shadow-sm">
<div class="card-header d-flex justify-content-between align-items-center">
<span class="tmi-section-title" id="gs_setup_header_label">
<i class="fas fa-clock mr-1 text-primary"></i> <?= __('gdt.page.programSetup') ?>
</span>
<span class="badge badge-secondary tmi-badge-status" id="gs_status_badge">Draft (local)</span>
</div>
<div class="card-body">
<!-- Program Type & Element -->
<div class="form-row">
<div class="form-group col-md-3">
<label class="tmi-label mb-0" for="gs_program_type"><?= __('gdt.page.programType') ?></label>
<select class="form-control form-control-sm" id="gs_program_type">
<option value="GS" selected>Ground Stop</option>
<option value="GDP-DAS">GDP (DAS)</option>
<option value="GDP-GAAP">GDP (GAAP)</option>
<option value="GDP-UDP">GDP (UDP)</option>
</select>
</div>
<div class="form-group col-md-3">
<label class="tmi-label mb-0" for="gs_ctl_element"><?= __('gdt.page.ctlElement') ?></label>
<input type="text" class="form-control form-control-sm" id="gs_ctl_element"
placeholder="<?= __('gdt.page.placeholderAirport') ?>">
</div>
<div class="form-group col-md-3">
<label class="tmi-label mb-0" for="gs_element_type"><?= __('gdt.page.elementType') ?></label>
<select class="form-control form-control-sm" id="gs_element_type">
<option value="APT" selected>APT</option>
<option value="CTR">CTR</option>
</select>
</div>
<div class="form-group col-md-3">
<label class="tmi-label mb-0" for="gs_adv_number"><?= __('gdt.page.advNumber') ?></label>
<input type="text" class="form-control form-control-sm" id="gs_adv_number"
placeholder="Auto-assigned" readonly>
</div>
</div>
<!-- GDP-specific rate/delay fields (hidden for GS) -->
<div class="form-row" id="gs_gdp_rate_row" style="display: none;">
<div class="form-group col-md-4">
<label class="tmi-label mb-0" for="gs_program_rate"><?= __('gdt.page.acceptanceRateAar') ?></label>
<input type="number" class="form-control form-control-sm" id="gs_program_rate"
placeholder="e.g., 30" min="1" max="120">
<small class="form-text text-muted"><?= __('gdt.page.arrivalsPerHour') ?></small>
</div>
<div class="form-group col-md-4">
<label class="tmi-label mb-0" for="gs_delay_limit"><?= __('gdt.page.maxDelayMin') ?></label>
<input type="number" class="form-control form-control-sm" id="gs_delay_limit"
placeholder="e.g., 180" min="0" max="600" value="180">
<small class="form-text text-muted"><?= __('gdt.page.delayCapInMinutes') ?></small>
</div>
<div class="form-group col-md-4">
<label class="tmi-label mb-0" for="gs_reserve_rate"><?= __('gdt.page.reserveRate') ?></label>
<input type="number" class="form-control form-control-sm" id="gs_reserve_rate"
placeholder="e.g., 5" min="0" max="30">
<small class="form-text text-muted"><?= __('gdt.page.reservedSlotsPerHour') ?></small>
</div>
</div>
<!-- Variable Rate Editor (GDP only) -->
<div id="gs_rate_editor_container" style="display: none;">
<!-- Hourly rate table (always visible when container shown) -->
<div class="mb-1" style="overflow-x: auto;">
<table class="table table-sm table-bordered mb-0 gdt-rate-table">
<thead class="thead-light">
<tr id="gs_hourly_header"><th><?= __('gdt.page.rateEditorHourlyLabel') ?></th></tr>
</thead>
<tbody>
<tr id="gs_hourly_inputs"><td class="font-weight-bold small">PR</td></tr>
</tbody>
</table>
</div>
<!-- Toolbar: Edit 15 toggle + Fill controls -->
<div class="gdt-rate-toolbar mb-1">
<button type="button" class="btn btn-outline-info" id="gs_edit15_toggle" title="Toggle per-15-minute rate editor">
<i class="fas fa-clock mr-1"></i><span id="gs_edit15_toggle_label"><?= __('gdt.page.rateEditorEdit15') ?></span>
</button>
<button type="button" class="btn btn-outline-secondary d-none" id="gs_edit15_clear" title="Clear per-15-min rates">
<i class="fas fa-times mr-1"></i><?= __('gdt.page.rateEditorClear') ?>
</button>
<input type="number" class="form-control form-control-sm gdt-fill-input" id="gs_rate_fill_value"
min="1" max="120" placeholder="<?= __('gdt.page.rateEditorFillPlaceholder') ?>">
<button type="button" class="btn btn-outline-secondary" id="gs_rate_fill_btn">
<?= __('gdt.page.rateEditorFillAll') ?>
</button>
</div>
<!-- Per-15-min rate table (hidden until Edit 15 toggled) -->
<div id="gs_quarter_grid" class="mb-2" style="display: none; overflow-x: auto;">
<table class="table table-sm table-bordered mb-0 gdt-rate-table">
<thead class="thead-light">
<tr id="gs_quarter_header"><th><?= __('gdt.page.rateEditorQuarterLabel') ?></th></tr>
</thead>
<tbody>
<tr id="gs_quarter_inputs"><td class="font-weight-bold small">Rate</td></tr>
</tbody>
</table>
</div>
</div>
<!-- Period (treated as UTC by JS) -->
<div class="form-row">
<div class="form-group col-md-6">
<label class="tmi-label mb-0" for="gs_start"><?= __('gdt.page.gsStartUtc') ?></label>
<input type="datetime-local" class="form-control form-control-sm" id="gs_start">
</div>
<div class="form-group col-md-6">
<label class="tmi-label mb-0" for="gs_end"><?= __('gdt.page.gsEndUtc') ?></label>
<input type="datetime-local" class="form-control form-control-sm" id="gs_end">
</div>
</div>
<!-- Airports & scope -->
<div class="form-group">
<label class="tmi-label mb-0" for="gs_airports"><?= __('gdt.page.arrivalAirports') ?></label>
<input type="text" class="form-control form-control-sm tmi-airports-input" id="gs_airports"
placeholder="<?= __('gdt.page.placeholderAirportsList') ?>">
<small class="form-text text-muted">
<?= __('gdt.page.arrivalAirportsHelp') ?>
</small>
<div id="gs_airports_legend" class="mt-1"></div>
</div>
<!-- Scope Type Toggle (Tier vs Distance) -->
<div class="form-row mb-1">
<div class="form-group col-md-6 mb-0">
<label class="tmi-label mb-0">Scope Type</label>
<div class="d-flex align-items-center" style="gap: 12px; margin-top: 2px;">
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" class="custom-control-input" id="gs_scope_type_tier" name="gs_scope_type_radio" value="TIER" checked>
<label class="custom-control-label" for="gs_scope_type_tier">Tier (ARTCC)</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" class="custom-control-input" id="gs_scope_type_distance" name="gs_scope_type_radio" value="DISTANCE">
<label class="custom-control-label" for="gs_scope_type_distance">Distance (nm)</label>
</div>
</div>
<input type="hidden" id="gs_scope_type" value="TIER">
</div>
<div class="form-group col-md-6 mb-0" id="gs_scope_distance_container" style="display: none;">
<label class="tmi-label mb-0" for="gs_scope_distance_nm">Distance from Airport (nm)</label>
<input type="number" class="form-control form-control-sm" id="gs_scope_distance_nm"
min="50" max="2000" step="50" value="200" placeholder="200">
</div>
</div>
<!-- Scope Group + Facility Checkboxes (visible when Tier selected) -->
<div class="form-row" id="gs_scope_tier_container">
<div class="form-group col-md-4">
<label class="tmi-label mb-0" for="gs_scope_group"><?= __('gdt.page.originCentersScope') ?></label>
<select class="form-control form-control-sm" id="gs_scope_group">
<option value="">-- Select Scope --</option>
<option value="1stTier">1st Tier</option>
<option value="2ndTier">2nd Tier</option>
<option value="ALL">ALL CONUS</option>
<option value="ALL+Canada">ALL + Canada</option>
<option value="6WEST">6 West</option>
<option value="10WEST">10 West</option>
<option value="12WEST">12 West</option>
<option value="EASTCOAST">East Coast</option>
<option value="WESTCOAST">West Coast</option>
<option value="GULF">Gulf</option>
<option value="Manual">Manual</option>
</select>
<input type="hidden" id="gs_origin_centers">
<!-- Legacy multi-select hidden for backward compat -->
<select multiple class="d-none" id="gs_scope_select"></select>
</div>
<div class="form-group col-md-4">
<label class="tmi-label mb-0" for="gs_origin_airports"><?= __('gdt.page.originAirports') ?></label>
<input type="text" class="form-control form-control-sm" id="gs_origin_airports"
placeholder="<?= __('gdt.page.placeholderOriginList') ?>">
</div>
<div class="form-group col-md-4">
<label class="tmi-label mb-0" for="gs_dep_facilities"><?= __('gdt.page.depFacilitiesIncluded') ?></label>
<input type="text" class="form-control form-control-sm" id="gs_dep_facilities"
placeholder="<?= __('gdt.page.placeholderFacilities') ?>" readonly>
</div>
</div>
<div class="form-group" id="gs_scope_checkboxes_container">
<div id="gs_scope_checkboxes" class="d-flex flex-wrap" style="gap: 2px 8px; font-size: 0.8rem;"></div>
</div>
<!-- Flight inclusion -->
<div class="form-row">
<div class="form-group col-md-6">
<label class="tmi-label mb-0" for="gs_flt_incl_carrier"><?= __('gdt.page.fltInclCarrier') ?></label>
<input type="text" class="form-control form-control-sm" id="gs_flt_incl_carrier"
placeholder="<?= __('gdt.page.placeholderCarriers') ?>">
</div>
<div class="form-group col-md-6">
<label class="tmi-label mb-0" for="gs_flt_incl_type"><?= __('gdt.page.aircraftType') ?></label>
<select class="form-control form-control-sm" id="gs_flt_incl_type">
<option value="ALL" selected>ALL</option>
<option value="JET">JET</option>
<option value="PROP">PROP</option>
</select>
</div>
</div>
<!-- Probability / Impacting Condition -->
<div class="form-row">
<div class="form-group col-md-4">
<label class="tmi-label mb-0" for="gs_prob_ext"><?= __('gdt.page.probabilityOfExtension') ?></label>
<input type="text" class="form-control form-control-sm" id="gs_prob_ext"
placeholder="<?= __('gdt.page.placeholderProbability') ?>">
</div>
<div class="form-group col-md-8">
<label class="tmi-label mb-0" for="gs_impacting_condition"><?= __('gdt.page.impactingCondition') ?></label>
<input type="text" class="form-control form-control-sm" id="gs_impacting_condition"
placeholder="<?= __('gdt.page.placeholderConstraint') ?>">
</div>
</div>
<!-- Flight Exemptions Section (Collapsible) -->
<div class="card border-warning mb-3">
<div class="card-header py-1 px-2 bg-warning text-dark d-flex justify-content-between align-items-center"
data-toggle="collapse" data-target="#gs_exemptions_body" style="cursor: pointer;">
<span class="tmi-label mb-0">
<i class="fas fa-shield-alt mr-1"></i> <?= __('gdt.page.flightExemptions') ?>
<span class="badge badge-dark ml-2" id="gs_exemption_count_badge">0 rules</span>
</span>
<i class="fas fa-chevron-down" id="gs_exemptions_toggle_icon"></i>
</div>
<div class="collapse" id="gs_exemptions_body">
<div class="card-body py-2">
<small class="text-muted d-block mb-2">
<i class="fas fa-info-circle"></i> <?= __('gdt.page.exemptionInfo') ?>
</small>
<!-- Origin Exemptions -->
<div class="border rounded p-2 mb-2 bg-light">
<div class="tmi-label text-primary mb-1"><i class="fas fa-plane-departure mr-1"></i> <?= __('gdt.page.originExemptions') ?></div>
<div class="form-row">
<div class="form-group col-md-4 mb-1">