Add Missing clientEnforcement in various modals, already handled on POST also add client selection in edit trip and enforce client permissions on trips

This commit is contained in:
johnnyq
2026-07-09 16:07:54 -04:00
parent 68f705b135
commit 317fe91359
50 changed files with 188 additions and 37 deletions

View File

@@ -18,8 +18,12 @@ $trip_archived_at = nullable_htmlentities($row['trip_archived_at']);
$round_trip = nullable_htmlentities($row['round_trip']);
$client_id = intval($row['trip_client_id']);
// Generate the HTML form content using output buffering.
if ($client_id) {
enforceClientAccess();
}
ob_start();
?>
<div class="modal-header bg-dark">
@@ -131,6 +135,34 @@ ob_start();
</div>
</div>
<?php if (isset($_GET['client_id'])) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } else { ?>
<div class="form-group">
<label>Client</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
</div>
<select class="form-control select2" name="client_id">
<option value="">- Client (Optional) -</option>
<?php
$sql_clients = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
while ($row = mysqli_fetch_assoc($sql_clients)) {
$client_id_select = intval($row['client_id']);
$client_name_select = nullable_htmlentities($row['client_name']);
?>
<option <?php if ($client_id == $client_id_select) { echo "selected"; } ?> value="<?php echo $client_id_select; ?>"><?php echo $client_name_select; ?></option>
<?php } ?>
</select>
</div>
</div>
<?php } ?>
</div>
<div class="modal-footer">