Moved Transfer Asset to Client to a Bulk Action and create Primary Interface when moving with MAC address

This commit is contained in:
johnnyq
2025-02-10 16:58:39 -05:00
parent 08ebedef03
commit fc24bcb24f
9 changed files with 136 additions and 121 deletions

View File

@@ -0,0 +1,48 @@
<div class="modal" id="bulkTransferAssetClientModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content bg-dark">
<div class="modal-header">
<h5 class="modal-title"><i class="fa fa-fw fa-exchange mr-2"></i>Transferring Asset(s)</h5>
<button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<div class="modal-body bg-white">
<div class="form-group">
<label>New Client <strong class="text-danger">*</strong></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-users"></i></span>
</div>
<select class="form-control select2" name="bulk_client_id">
<option value="">- Client -</option>
<?php
$clients_sql = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_id != $client_id AND client_archived_at IS NULL");
while ($row = mysqli_fetch_array($clients_sql)) {
$client_id_select = intval($row["client_id"]);
$client_name_select = nullable_htmlentities($row["client_name"]);
?>
<option value='<?php echo $client_id_select; ?>'><?php echo $client_name_select; ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="alert alert-dark" role="alert">
<i>The current asset will be archived and content copied to a new asset.</i>
</div>
</div>
<div class="modal-footer bg-white">
<button type="submit" name="bulk_transfer_client_asset" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Transfer</button>
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
</div>
</div>
</div>
</div>

View File

@@ -1,48 +0,0 @@
<div class="modal" id="transferAssetModal<?php echo $asset_id; ?>" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content bg-dark">
<div class="modal-header">
<h5 class="modal-title"><i class="fa fa-fw fa-<?php echo $device_icon; ?> mr-2"></i>Transfer asset: <strong><?php echo $asset_name; ?></strong> to a different client</h5>
<button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token'] ?>">
<input type="hidden" name="current_asset_id" value="<?php echo $asset_id; ?>">
<div class="modal-body bg-white">
<div class="form-group">
<label>New Client <strong class="text-danger">*</strong></label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-users"></i></span>
</div>
<?php $clients_sql = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_id != $client_id AND client_archived_at IS NULL"); ?>
<select class="form-control select2" name="new_client_id" required>
<?php
while ($row = mysqli_fetch_array($clients_sql)) {
$id = intval($row["client_id"]);
$name = nullable_htmlentities($row["client_name"]);
echo "<option value='$id'>$name</option>";
}
?>
</select>
</div>
</div>
<div class="alert alert-dark" role="alert">
<i>The current asset will be archived and content copied to a new asset.</i>
</div>
</div>
<div class="modal-footer bg-white">
<button type="submit" name="change_client_asset" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Transfer</button>
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
</div>
</form>
</div>
</div>
</div>

View File

@@ -22,7 +22,7 @@
$notification_type = nullable_htmlentities($row['notification_type']);
$notification_details = nullable_htmlentities($row['notification']);
$notification_action = nullable_htmlentities($row['notification_action']);
$notification_created_at_formated = date('M d g:ia',strtotime($row['notification_created_at']));
$notification_timestamp_formated = date('M d g:ia',strtotime($row['notification_timestamp']));
$notification_client_id = intval($row['notification_client_id']);
if(empty($notification_action)) { $notification_action = "#"; }
?>
@@ -34,7 +34,7 @@
<i class="fas fa-bullhorn mr-2"></i><?php echo $notification_type; ?>
</span>
<small class="text-muted float-right">
<?php echo $notification_created_at_formated; ?>
<?php echo $notification_timestamp_formated; ?>
</small>
</div>
<small class="text-secondary"><?php echo $notification_details; ?></small>