-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathics-forms.php
More file actions
390 lines (355 loc) · 18.7 KB
/
Copy pathics-forms.php
File metadata and controls
390 lines (355 loc) · 18.7 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
<?php
/**
* NewUI v4.0 - ICS Forms Hub
*
* Unified ICS (Incident Command System) forms page.
* Browse available form types, create new forms, view/edit saved forms.
* Supports: ICS-213, ICS-214, ICS-202, ICS-205, ICS-205A, ICS-213RR
*/
require_once __DIR__ . '/config.php';
require_once __DIR__ . '/inc/i18n.php';
require_once __DIR__ . '/inc/rbac.php';
// 2026-07-04 (GH #13) — pick the session profile matching the
// client's cookie (TCADMOBILE vs PHPSESSID). Without this, a
// browser holding a mobile cookie opens an empty desktop session
// here and bounces to login -> redirect loop.
require_once __DIR__ . '/inc/session-bootstrap.php';
sess_bootstrap_auto();
session_start();
if (empty($_SESSION['user_id'])) {
header('Location: login.php');
exit;
}
require_once __DIR__ . '/inc/force-pw-change.php';
force_pw_change_redirect();
$user = e($_SESSION['user']);
$level = current_role_name();
$theme = $_SESSION['day_night'] ?? 'Day';
$bs_theme = ($theme === 'Night') ? 'dark' : 'light';
$csrf = csrf_token();
?>
<!DOCTYPE html>
<html lang="<?php echo e(i18n_lang()); ?>" data-bs-theme="<?php echo $bs_theme; ?>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="<?php echo e($csrf); ?>">
<title><?php echo e(t('page.ics_forms', 'ICS Forms')); ?> — <?php echo e(t('login.title', 'Tickets NewUI')); ?> <?php echo newui_version(); ?></title>
<!-- Vendor CSS -->
<link rel="stylesheet" href="assets/vendor/bootstrap/bootstrap.min.css">
<link rel="stylesheet" href="assets/vendor/bootstrap/bootstrap-icons.min.css">
<!-- App CSS -->
<link rel="stylesheet" href="assets/css/dashboard.css">
<link rel="stylesheet" href="assets/css/ics-forms.css">
</head>
<body>
<?php
$active_page = 'ics-forms';
include_once NEWUI_ROOT . '/inc/navbar.php';
?>
</header>
<input type="hidden" id="csrfToken" value="<?php echo e($csrf); ?>">
<!-- Page Content -->
<div class="container-fluid p-3">
<!-- Page title -->
<div class="d-flex align-items-center justify-content-between mb-3">
<h5 class="mb-0">
<i class="bi bi-file-earmark-text text-primary me-2"></i>ICS Forms
</h5>
</div>
<!-- Alert area -->
<div id="alertArea"></div>
<!-- ═══════════ HUB SECTION ═══════════ -->
<div id="hubSection">
<!-- Form Type Cards -->
<div class="row g-3 mb-4">
<!-- ICS-213: General Message -->
<div class="col-md-6 col-lg-4 col-xl-3">
<div class="card ics-type-card h-100">
<div class="card-body">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="form-number text-primary">ICS-213</span>
<span class="badge bg-primary">Message</span>
</div>
<h6 class="card-title mb-1">General Message</h6>
<p class="form-desc text-body-secondary mb-2">
Standard ICS general message form for sending/receiving communications.
Supports Winlink XML export for radio transmission.
</p>
<button class="btn btn-sm btn-primary" data-new-form="213">
<i class="bi bi-plus-lg me-1"></i>New
</button>
</div>
</div>
</div>
<!-- ICS-214: Activity Log -->
<div class="col-md-6 col-lg-4 col-xl-3">
<div class="card ics-type-card h-100">
<div class="card-body">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="form-number text-success">ICS-214</span>
<span class="badge bg-success">Log</span>
</div>
<h6 class="card-title mb-1">Activity Log</h6>
<p class="form-desc text-body-secondary mb-2">
Record significant activities, events, and decisions during an
operational period. Maintained by each unit leader.
</p>
<button class="btn btn-sm btn-success" data-new-form="214">
<i class="bi bi-plus-lg me-1"></i>New
</button>
</div>
</div>
</div>
<!-- ICS-202: Incident Objectives -->
<div class="col-md-6 col-lg-4 col-xl-3">
<div class="card ics-type-card h-100">
<div class="card-body">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="form-number text-info">ICS-202</span>
<span class="badge bg-info">Objectives</span>
</div>
<h6 class="card-title mb-1">Incident Objectives</h6>
<p class="form-desc text-body-secondary mb-2">
Document overall incident objectives and current actions summary
for the operational period. Part of the Incident Action Plan (IAP).
</p>
<button class="btn btn-sm btn-info" data-new-form="202">
<i class="bi bi-plus-lg me-1"></i>New
</button>
</div>
</div>
</div>
<!-- ICS-205: Radio Communications Plan -->
<div class="col-md-6 col-lg-4 col-xl-3">
<div class="card ics-type-card h-100">
<div class="card-body">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="form-number text-warning">ICS-205</span>
<span class="badge bg-warning text-dark">Radio</span>
</div>
<h6 class="card-title mb-1">Radio Communications Plan</h6>
<p class="form-desc text-body-secondary mb-2">
Assign radio frequencies, channels, and tones for incident
communications. Essential for amateur radio deployments.
</p>
<button class="btn btn-sm btn-warning" data-new-form="205">
<i class="bi bi-plus-lg me-1"></i>New
</button>
</div>
</div>
</div>
<!-- ICS-205A: Communications List -->
<div class="col-md-6 col-lg-4 col-xl-3">
<div class="card ics-type-card h-100">
<div class="card-body">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="form-number text-secondary">ICS-205A</span>
<span class="badge bg-secondary">Contacts</span>
</div>
<h6 class="card-title mb-1">Communications List</h6>
<p class="form-desc text-body-secondary mb-2">
Contact directory listing ICS positions, names, phone numbers,
radio frequencies, and email addresses.
</p>
<button class="btn btn-sm btn-secondary" data-new-form="205a">
<i class="bi bi-plus-lg me-1"></i>New
</button>
</div>
</div>
</div>
<!-- ICS-213RR: Resource Request Message -->
<div class="col-md-6 col-lg-4 col-xl-3">
<div class="card ics-type-card h-100">
<div class="card-body">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="form-number text-danger">ICS-213RR</span>
<span class="badge bg-danger">Resources</span>
</div>
<h6 class="card-title mb-1">Resource Request Message</h6>
<p class="form-desc text-body-secondary mb-2">
Request personnel, equipment, or supplies through the logistics
section. Tracks quantities, priorities, and estimated costs.
</p>
<button class="btn btn-sm btn-danger" data-new-form="213rr">
<i class="bi bi-plus-lg me-1"></i>New
</button>
</div>
</div>
</div>
<!-- ICS-206: Medical Plan -->
<div class="col-md-6 col-lg-4 col-xl-3">
<div class="card ics-type-card h-100">
<div class="card-body">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="form-number" style="color:var(--bs-teal)">ICS-206</span>
<span class="badge" style="background-color:var(--bs-teal)">Medical</span>
</div>
<h6 class="card-title mb-1">Medical Plan</h6>
<p class="form-desc text-body-secondary mb-2">
Document medical aid stations, ambulance services, hospitals,
and emergency medical procedures for the incident.
</p>
<button class="btn btn-sm" style="background-color:var(--bs-teal);color:#fff" data-new-form="206">
<i class="bi bi-plus-lg me-1"></i>New
</button>
</div>
</div>
</div>
<!-- ICS-214a: Individual Activity Log -->
<div class="col-md-6 col-lg-4 col-xl-3">
<div class="card ics-type-card h-100">
<div class="card-body">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="form-number" style="color:var(--bs-indigo)">ICS-214a</span>
<span class="badge" style="background-color:var(--bs-indigo)">Individual Log</span>
</div>
<h6 class="card-title mb-1">Individual Activity Log</h6>
<p class="form-desc text-body-secondary mb-2">
Record individual personnel activities and notable events
during an operational period. Similar to ICS-214 but for one person.
</p>
<button class="btn btn-sm" style="background-color:var(--bs-indigo);color:#fff" data-new-form="214a">
<i class="bi bi-plus-lg me-1"></i>New
</button>
</div>
</div>
</div>
<!-- ICS-221: Demobilization Check-Out -->
<div class="col-md-6 col-lg-4 col-xl-3">
<div class="card ics-type-card h-100">
<div class="card-body">
<div class="d-flex align-items-center justify-content-between mb-2">
<span class="form-number" style="color:var(--bs-orange)">ICS-221</span>
<span class="badge" style="background-color:var(--bs-orange)">Demob</span>
</div>
<h6 class="card-title mb-1">Demobilization Check-Out</h6>
<p class="form-desc text-body-secondary mb-2">
Track resource demobilization with section check-outs,
reassignment details, and travel information.
</p>
<button class="btn btn-sm" style="background-color:var(--bs-orange);color:#fff" data-new-form="221">
<i class="bi bi-plus-lg me-1"></i>New
</button>
</div>
</div>
</div>
</div><!-- /row -->
<!-- Saved Forms Table -->
<div class="card">
<div class="card-header d-flex align-items-center justify-content-between py-2">
<span class="fw-semibold"><i class="bi bi-clock-history me-2"></i>Saved Forms</span>
<div class="d-flex align-items-center gap-2">
<label class="form-label mb-0 small" for="hubFilterType">Filter:</label>
<select class="form-select form-select-sm" id="hubFilterType" style="width:140px">
<option value="">All Types</option>
<option value="213">ICS-213</option>
<option value="214">ICS-214</option>
<option value="202">ICS-202</option>
<option value="205">ICS-205</option>
<option value="205a">ICS-205A</option>
<option value="206">ICS-206</option>
<option value="213rr">ICS-213RR</option>
<option value="214a">ICS-214a</option>
<option value="221">ICS-221</option>
</select>
</div>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-sm table-hover mb-0">
<thead>
<tr>
<th style="width:90px">Type</th>
<th>Title</th>
<th style="width:80px">Incident</th>
<th style="width:70px">Status</th>
<th style="width:120px">Created By</th>
<th style="width:140px">Last Updated</th>
<th style="width:60px" class="text-end">Actions</th>
</tr>
</thead>
<tbody id="savedFormsBody">
<tr><td colspan="7" class="text-center text-body-secondary py-3">Loading...</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div><!-- /hubSection -->
<!-- ═══════════ EDITOR SECTION (hidden by default) ═══════════ -->
<div id="editorSection" style="display:none">
<!-- Editor toolbar -->
<div class="editor-toolbar d-flex align-items-center justify-content-between mb-3 no-print">
<div class="d-flex align-items-center gap-2">
<button class="btn btn-sm btn-outline-secondary" id="btnBackToHub">
<i class="bi bi-arrow-left me-1"></i>Back
</button>
<h6 class="mb-0" id="editorTitle">ICS Form</h6>
</div>
<div class="d-flex gap-2">
<button class="btn btn-sm btn-outline-info" id="btnExportXml" style="display:none">
<i class="bi bi-filetype-xml me-1"></i>Export XML
</button>
<button class="btn btn-sm btn-outline-secondary" id="btnPrint">
<i class="bi bi-printer me-1"></i>Print
</button>
<button class="btn btn-sm btn-outline-primary" id="btnSave">
<i class="bi bi-save me-1"></i>Save Draft
</button>
<button class="btn btn-sm btn-success" id="btnFinalize">
<i class="bi bi-check-lg me-1"></i>Finalize
</button>
<!-- Shown only for a saved form this user may delete; the server
decides (api/ics-forms.php emits can_delete) and re-checks
on the POST. Soft delete — it goes to the wastebasket. -->
<button type="button" class="btn btn-sm btn-outline-danger" id="btnDeleteForm" style="display:none">
<i class="bi bi-trash me-1"></i>Delete
</button>
</div>
</div>
<!-- Metadata row -->
<div class="row g-3 mb-3 no-print">
<div class="col-md-4">
<label class="form-label" for="formTitle">Form Title <span class="text-danger">*</span></label>
<input type="text" class="form-control form-control-sm" id="formTitle"
placeholder="e.g., Shelter Deployment Message" tabindex="0">
</div>
<div class="col-md-3">
<label class="form-label" for="formStatus">Status</label>
<select class="form-select form-select-sm" id="formStatus" disabled>
<option value="draft">Draft</option>
<option value="final">Final</option>
<option value="sent">Sent</option>
</select>
</div>
<div class="col-md-5">
<label class="form-label" for="linkIncidentSearch">Link to Incident (optional)</label>
<div class="position-relative">
<div class="input-group input-group-sm incident-link-bar">
<span class="input-group-text"><i class="bi bi-link-45deg"></i></span>
<input type="text" class="form-control form-control-sm" id="linkIncidentSearch"
placeholder="Search by #, address, type, or description..." autocomplete="off">
<input type="hidden" id="linkIncidentId" value="">
<button class="btn btn-outline-secondary" type="button" id="btnClearIncidentLink" title="Clear link" style="display:none">
<i class="bi bi-x-lg"></i>
</button>
</div>
<div class="incident-search-results d-none" id="incidentSearchResults"></div>
</div>
</div>
</div>
<!-- Dynamic form fields rendered here by JS -->
<div class="card">
<div class="card-body" id="formFieldsContainer">
<p class="text-body-secondary">Loading form fields...</p>
</div>
</div>
</div><!-- /editorSection -->
</div><!-- /container-fluid -->
<!-- Vendor JS -->
<script src="assets/vendor/bootstrap/bootstrap.bundle.min.js"></script>
<!-- App JS -->
<script src="assets/js/ics-forms.js?v=<?php echo asset_v('assets/js/ics-forms.js'); ?>"></script>
</body>
</html>