Skip to content

Commit

Permalink
Merge pull request #935 from wrongecho/client-show-archived
Browse files Browse the repository at this point in the history
Client archiving
  • Loading branch information
johnnyq authored Apr 7, 2024
2 parents acc7a7b + abf0138 commit 3191ef1
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 17 deletions.
8 changes: 4 additions & 4 deletions client_assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@
} ?>
</div>
<div class="btn-group mr-2">
<?php if($archived == 1){ ?>
<a href="?client_id=<?php echo $client_id; ?>&archived=0" class="btn btn-primary"><i class="fa fa-fw fa-archive mr-2"></i>Archived</a>
<?php if($archived == 1) { ?>
<a href="?client_id=<?php echo $client_id; ?>&archived=0" class="btn btn-primary"><i class="fa fa-fw fa-archive mr-2"></i>Archived</a>
<?php } else { ?>
<a href="?client_id=<?php echo $client_id; ?>&archived=1" class="btn btn-default"><i class="fa fa-fw fa-archive mr-2"></i>Archived</a>
<a href="?client_id=<?php echo $client_id; ?>&archived=1" class="btn btn-default"><i class="fa fa-fw fa-archive mr-2"></i>Archived</a>
<?php } ?>
<div class="dropdown ml-2" id="bulkActionButton" hidden>
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
Expand Down Expand Up @@ -416,7 +416,7 @@
<?php if (!empty($asset_uri)) { ?>
<a class="btn btn-default btn-sm" href="<?php echo $asset_uri; ?>" target="_blank"><i class="fas fa-fw fa-external-link-alt"></i></a>
<?php } ?>

<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown"><i class="fas fa-ellipsis-h"></i></button>
<div class="dropdown-menu">
Expand Down
26 changes: 19 additions & 7 deletions clients.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
OR contacts.contact_mobile LIKE '%$phone_query%' OR locations.location_address LIKE '%$q%'
OR locations.location_city LIKE '%$q%' OR locations.location_state LIKE '%$q%' OR locations.location_zip LIKE '%$q%'
OR tags.tag_name LIKE '%$q%' OR clients.client_tax_id_number LIKE '%$q%')
AND clients.client_archived_at IS NULL
AND clients.client_$archive_query
AND DATE(clients.client_created_at) BETWEEN '$dtf' AND '$dtt'
AND clients.client_lead = $leads
GROUP BY clients.client_id
Expand Down Expand Up @@ -73,6 +73,7 @@
<div class="card-body p-2 p-md-3">
<form class="mb-4" autocomplete="off">
<input type="hidden" name="leads" value="<?php echo $leads; ?>">
<input type="hidden" name="archived" value="<?php echo $archived; ?>">
<div class="row">
<div class="col-md-4">
<div class="input-group">
Expand All @@ -89,7 +90,14 @@
<a href="?leads=0" class="btn btn-<?php if($leads == 0){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-user-friends mr-2"></i>Clients</a>
<a href="?leads=1" class="btn btn-<?php if($leads == 1){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-bullhorn mr-2"></i>Leads</a>
</div>


<div class="btn-group mr-2">
<?php if($archived == 1) { ?>
<a href="?<?php echo $url_query_strings_sort ?>&archived=0" class="btn btn-primary"><i class="fa fa-fw fa-archive mr-2"></i>Archived</a>
<?php } else { ?>
<a href="?<?php echo $url_query_strings_sort ?>&archived=1" class="btn btn-default"><i class="fa fa-fw fa-archive mr-2"></i>Archived</a>
<?php } ?>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -172,7 +180,7 @@
$client_notes = nullable_htmlentities($row['client_notes']);
$client_created_at = date('Y-m-d', strtotime($row['client_created_at']));
$client_updated_at = nullable_htmlentities($row['client_updated_at']);
$client_archive_at = nullable_htmlentities($row['client_archived_at']);
$client_archived_at = nullable_htmlentities($row['client_archived_at']);
$client_is_lead = intval($row['client_lead']);

// Client Tags
Expand Down Expand Up @@ -317,10 +325,14 @@
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editClientModal<?php echo $client_id; ?>">
<i class="fas fa-fw fa-edit mr-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_client=<?php echo $client_id; ?>">
<i class="fas fa-fw fa-archive mr-2"></i>Archive
</a>

<?php if (empty($client_archived_at)) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_client=<?php echo $client_id; ?>">
<i class="fas fa-fw fa-archive mr-2"></i>Archive
</a>
<?php } ?>

</div>
</div>
</td>
Expand Down
1 change: 1 addition & 0 deletions inc_all_client.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
$client_rate = floatval($row['client_rate']);
$client_notes = nullable_htmlentities($row['client_notes']);
$client_created_at = nullable_htmlentities($row['client_created_at']);
$client_archived_at = nullable_htmlentities($row['client_archived_at']);
$contact_id = intval($row['contact_id']);
$contact_name = nullable_htmlentities($row['contact_name']);
$contact_title = nullable_htmlentities($row['contact_title']);
Expand Down
22 changes: 16 additions & 6 deletions inc_client_top_head.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="card-body py-2">
<div class="row">
<div class="col">
<a href="#" data-toggle="collapse" data-target="#clientHeader"><h4 class="text-secondary"><strong><?php echo $client_name; ?></strong></h4></a>
<a href="#" data-toggle="collapse" data-target="#clientHeader"><h4 class="text-secondary"><strong><?php echo $client_name; ?></strong> <?php if ($client_archived_at) { echo "(archived)"; } ?></h4></a>
</div>
<div class="col">
<?php if ($session_user_role == 3) { ?>
Expand All @@ -18,16 +18,26 @@
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#exportClientPDFModal">
<i class="fas fa-fw fa-file-pdf mr-2"></i>Export Data
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_client=<?php echo $client_id; ?>">
<i class="fas fa-fw fa-archive mr-2"></i>Archive Client
</a>
<?php if ($session_user_role == 3) { ?>

<?php if (empty($client_archived_at)) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_client=<?php echo $client_id; ?>">
<i class="fas fa-fw fa-archive mr-2"></i>Archive Client
</a>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-primary confirm-link" href="post.php?undo_archive_client=<?php echo $client_id; ?>">
<i class="fas fa-fw fa-archive mr-2"></i>Unarchive Client
</a>
<?php } ?>

<?php if ($session_user_role == 3 && $client_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold" href="#" data-toggle="modal" data-target="#deleteClientModal<?php echo $client_id; ?>">
<i class="fas fa-fw fa-trash mr-2"></i>Delete Client
</a>
<?php } ?>

</div>
</div>
<?php } ?>
Expand Down

0 comments on commit 3191ef1

Please sign in to comment.