Skip to content

Commit

Permalink
Client files bugfix
Browse files Browse the repository at this point in the history
- Hide delete button for techs as they do not have this permission
- Remove unused exclude_condition var
  • Loading branch information
wrongecho committed Jul 31, 2024
1 parent cc0de31 commit cfb13a0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
3 changes: 1 addition & 2 deletions client_file_link_asset_modal.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
$sql_assets_select = mysqli_query($mysqli, "SELECT * FROM assets
WHERE asset_client_id = $client_id
AND asset_archived_at IS NULL
$exclude_condition
ORDER BY asset_name ASC"
);
while ($row = mysqli_fetch_array($sql_assets_select)) {
Expand Down Expand Up @@ -65,7 +64,7 @@
<?php
}
?>

</div>
<div class="modal-footer bg-white">
<button type="submit" name="link_asset_to_file" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Link</button>
Expand Down
31 changes: 18 additions & 13 deletions client_files.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@
?>

<div class="card card-dark">

<div class="card-header py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-paperclip mr-2"></i>Files</h3>

<div class="card-tools">
<div class="btn-group">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#uploadFilesModal">
Expand All @@ -88,7 +88,7 @@
</div>
</div>
</div>

<div class="card-body">
<div class="row">
<div class="col-md-3 border-right mb-3">
Expand Down Expand Up @@ -156,7 +156,7 @@
</div>

<div class="col-md-9">

<form autocomplete="off">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<input type="hidden" name="view" value="<?php echo $view; ?>">
Expand All @@ -174,7 +174,7 @@
<div class="btn-group float-right">
<a href="?<?php echo $url_query_strings_sort; ?>&view=0" class="btn <?php if($view == 0){ echo "btn-primary"; } else { echo "btn-outline-secondary"; } ?>"><i class="fas fa-list-ul"></i></a>
<a href="?<?php echo $url_query_strings_sort; ?>&view=1" class="btn <?php if($view == 1){ echo "btn-primary"; } else { echo "btn-outline-secondary"; } ?>"><i class="fas fa-th-large"></i></a>

<div class="dropdown ml-2" id="bulkActionButton" hidden>
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
<i class="fas fa-fw fa-layer-group mr-2"></i>Bulk Action (<span id="selectedCount">0</span>)
Expand All @@ -190,7 +190,7 @@
</div>
</div>
</form>

<hr>

<?php
Expand Down Expand Up @@ -225,7 +225,10 @@

<small><?php echo $file_name; ?></small>

<a href="#" data-toggle="modal" data-target="#deleteFileModal" onclick="populateFileDeleteModal(<?php echo "$file_id , '$file_name'" ?>)" class="text-white float-right mr-1"><i class="fa fa-times"></i></a>
<?php if ($session_user_role == 3) { ?>
<a href="#" data-toggle="modal" data-target="#deleteFileModal" onclick="populateFileDeleteModal(<?php echo "$file_id , '$file_name'" ?>)" class="text-white float-right mr-1"><i class="fa fa-times"></i></a>
<?php } ?>

</div>
</div>
</div>
Expand All @@ -243,7 +246,7 @@

<div class="table-responsive-sm">
<table class="table border">

<thead class="thead-light <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<td class="bg-light pr-0">
Expand All @@ -256,7 +259,7 @@
<th class="text-center">Action</th>
</tr>
</thead>

<tbody>

<?php
Expand Down Expand Up @@ -338,10 +341,12 @@
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_file=<?php echo $file_id; ?>">
<i class="fas fa-fw fa-archive mr-2"></i>Archive
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold" href="#" data-toggle="modal" data-target="#deleteFileModal" onclick="populateFileDeleteModal(<?php echo "$file_id , '$file_name'" ?>)">
<i class="fas fa-fw fa-trash mr-2"></i>Delete
</a>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold" href="#" data-toggle="modal" data-target="#deleteFileModal" onclick="populateFileDeleteModal(<?php echo "$file_id , '$file_name'" ?>)">
<i class="fas fa-fw fa-trash mr-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</td>
Expand Down

0 comments on commit cfb13a0

Please sign in to comment.