Added Rename and Delete folder capabilities to documents and some minor UI cleanup

This commit is contained in:
johnnyq 2022-04-27 22:31:15 -04:00
parent c02edf5ca7
commit 6310ef5aae
3 changed files with 67 additions and 15 deletions

View File

@ -0,0 +1,32 @@
<div class="modal" id="renameFolderModal<?php echo $folder_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-edit"></i> Rename <?php echo $folder_name; ?></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="folder_id" value="<?php echo $folder_id; ?>">
<div class="modal-body bg-white">
<div class="form-group">
<label>Name <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-folder"></i></span>
</div>
<input type="text" class="form-control" name="folder_name" placeholder="Folder Name" value="<?php echo $folder_name; ?>" required>
</div>
</div>
</div>
<div class="modal-footer bg-white">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="submit" name="rename_folder" class="btn btn-primary">Rename</button>
</div>
</form>
</div>
</div>
</div>

View File

@ -72,22 +72,42 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$num_documents = $row['num'];
?>
<li class="nav-item ml-2">
<a class="nav-link <?php if($_GET['folder_id'] == $folder_id){ echo "active"; } ?> " href="?client_id=<?php echo $client_id; ?>&tab=documents&folder_id=<?php echo $folder_id; ?>">
<?php
if($_GET['folder_id'] == $folder_id){ ?>
<i class="fas fa-fw fa-folder-open"></i>
<?php
}else{
?>
<i class="fas fa-fw fa-folder"></i>
<?php } ?>
<li class="nav-item">
<div class="row">
<div class="col-10">
<a class="nav-link <?php if($_GET['folder_id'] == $folder_id){ echo "active"; } ?> " href="?client_id=<?php echo $client_id; ?>&tab=documents&folder_id=<?php echo $folder_id; ?>">
<?php
if($_GET['folder_id'] == $folder_id){ ?>
<i class="fas fa-fw fa-folder-open"></i>
<?php
}else{
?>
<i class="fas fa-fw fa-folder"></i>
<?php } ?>
<?php echo $folder_name; ?> <?php if($num_documents > 0){ echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>"; } ?>
</a>
<?php echo $folder_name; ?> <?php if($num_documents > 0){ echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>"; } ?>
</a>
</div>
<div class="col-2">
<div class="dropdown">
<button class="btn btn-sm" type="button" data-toggle="dropdown">
<i class="fas fa-ellipsis-v"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#renameFolderModal<?php echo $folder_id; ?>">Rename</a>
<?php if($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_folder=<?php echo $folder_id; ?>">Delete</a>
<?php } ?>
</div>
</div>
</div>
</div>
</li>
<?php
include("client_document_folder_rename_modal.php");
}
?>
@ -110,7 +130,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<table class="table table-striped table-sm table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<tr>
<th>

View File

@ -7010,7 +7010,7 @@ if(isset($_POST['add_folder'])){
}
if(isset($_POST['edit_folder'])){
if(isset($_POST['rename_folder'])){
if($session_user_role == 1){
$_SESSION['alert_type'] = "danger";