Skip to content

Commit

Permalink
Added Location to Global View, updated links and fixed password pop o…
Browse files Browse the repository at this point in the history
…ver moving you to the top of the page when clicked in asset and conact details
  • Loading branch information
johnnyq committed Feb 20, 2025
1 parent 2795b4e commit fc00b5e
Show file tree
Hide file tree
Showing 17 changed files with 106 additions and 56 deletions.
5 changes: 2 additions & 3 deletions asset_details.php
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@
<td><?php echo $login_description; ?></td>
<td><?php echo $login_username_display; ?></td>
<td>
<a tabindex="0" href="#" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?php echo $login_password; ?>"><i class="fas fa-2x fa-ellipsis-h text-secondary"></i><i class="fas fa-2x fa-ellipsis-h text-secondary"></i></a><button class="btn btn-sm clipboardjs" data-clipboard-text="<?php echo $login_password; ?>"><i class="far fa-copy text-secondary"></i></button>
<button class="btn p-0" type="button" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?php echo $login_password; ?>"><i class="fas fa-2x fa-ellipsis-h text-secondary"></i><i class="fas fa-2x fa-ellipsis-h text-secondary"></i></button><button class="btn btn-sm clipboardjs" data-clipboard-text="<?php echo $login_password; ?>"><i class="far fa-copy text-secondary"></i></button>
</td>
<td><?php echo $otp_display; ?></td>
<td><?php echo $login_uri_display; ?></td>
Expand Down Expand Up @@ -1080,9 +1080,8 @@ function updateAssetNotes(asset_id) {
});
</script>

<script src="js/recurring_tickets_edit_modal.js"></script>
<!-- Include script to get TOTP code via the login ID -->
<script src="js/logins_show_otp_via_id.js"></script>
<script src="js/credential_show_otp_via_id.js"></script>

<?php

Expand Down
25 changes: 11 additions & 14 deletions contact_details.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,9 @@
<tr>
<th>
<i class="fa fa-fw text-secondary fa-<?php echo $device_icon; ?> mr-2"></i>
<a class="text-secondary" href="#"
data-toggle="ajax-modal"
data-ajax-url="ajax/ajax_asset_edit.php"
data-ajax-id="<?php echo $asset_id; ?>"
>
<?php echo $asset_name; ?></a>
<a class="text-secondary" href="asset_details.php?<?php echo $client_url; ?>asset_id=<?php echo $asset_id; ?>">
<?php echo $asset_name; ?>
</a>
<div class="mt-0">
<small class="text-muted"><?php echo $asset_description; ?></small>
</div>
Expand Down Expand Up @@ -544,7 +541,7 @@ class="btn btn-secondary btn-sm" title="Unlink">
<td><?php echo $login_description; ?></td>
<td><?php echo $login_username_display; ?></td>
<td>
<a tabindex="0" href="#" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?php echo $login_password; ?>"><i class="fas fa-2x fa-ellipsis-h text-secondary"></i><i class="fas fa-2x fa-ellipsis-h text-secondary"></i></a><button class="btn btn-sm clipboardjs" data-clipboard-text="<?php echo $login_password; ?>"><i class="far fa-copy text-secondary"></i></button>
<button class="btn p-0" type="button" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="<?php echo $login_password; ?>"><i class="fas fa-2x fa-ellipsis-h text-secondary"></i><i class="fas fa-2x fa-ellipsis-h text-secondary"></i></button><button class="btn btn-sm clipboardjs" data-clipboard-text="<?php echo $login_password; ?>"><i class="far fa-copy text-secondary"></i></button>
</td>
<td><?php echo $otp_display; ?></td>
<td><?php echo $login_uri_display; ?></td>
Expand Down Expand Up @@ -1173,17 +1170,17 @@ function(data) {
</script>

<!-- Include script to get TOTP code via the login ID -->
<script src="js/logins_show_otp_via_id.js"></script>
<script src="js/credential_show_otp_via_id.js"></script>

<?php

require_once "modals/ticket_add_modal.php";
require_once "modals/client_contact_link_asset_modal.php";
require_once "modals/client_contact_link_software_modal.php";
require_once "modals/client_contact_link_credential_modal.php";
require_once "modals/client_contact_link_service_modal.php";
require_once "modals/client_contact_link_document_modal.php";
require_once "modals/client_contact_link_file_modal.php";
require_once "modals/contact_link_asset_modal.php";
require_once "modals/contact_link_software_modal.php";
require_once "modals/contact_link_credential_modal.php";
require_once "modals/contact_link_service_modal.php";
require_once "modals/contact_link_document_modal.php";
require_once "modals/contact_link_file_modal.php";

require_once "modals/recurring_ticket_add_modal.php";

Expand Down
3 changes: 2 additions & 1 deletion credentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"
}

$login_tag_id_array[] = $login_tag_id;
$login_tag_name_display_array[] = "<a href='client_logins.php?client_id=$client_id&tags[]=$login_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $login_tag_color;'><i class='fa fa-fw fa-$login_tag_icon mr-2'></i>$login_tag_name</span></a>";
$login_tag_name_display_array[] = "<a href='credentials.php?$client_url tags[]=$login_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $login_tag_color;'><i class='fa fa-fw fa-$login_tag_icon mr-2'></i>$login_tag_name</span></a>";
}
$login_tags_display = implode('', $login_tag_name_display_array);

Expand Down Expand Up @@ -457,6 +457,7 @@ class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"
<?php } ?>
</div>
</div>
</div>
</td>
</tr>

Expand Down
6 changes: 6 additions & 0 deletions includes/client_overview_side_nav.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
<p><strong>ALL</strong> Contacts</p>
</a>
</li>
<li class="nav-item">
<a href="locations.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "locations.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-map-marker-alt"></i>
<p><strong>ALL</strong> Locations</p>
</a>
</li>
<li class="nav-item">
<a href="assets.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "assets.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-desktop"></i>
Expand Down
2 changes: 1 addition & 1 deletion includes/client_side_nav.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</li>

<li class="nav-item">
<a href="client_locations.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_locations.php") { echo "active"; } ?>">
<a href="locations.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "locations.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-map-marker-alt"></i>
<p>
Locations
Expand Down
46 changes: 35 additions & 11 deletions client_locations.php → locations.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
$sort = "location_name";
$order = "ASC";

require_once "includes/inc_all_client.php";
// If client_id is in URI then show client Side Bar and client header
if (isset($_GET['client_id'])) {
require_once "includes/inc_all_client.php";
$client_query = "AND location_client_id = $client_id";
$client_url = "client_id=$client_id&";
} else {
require_once "includes/inc_client_overview_all.php";
$client_query = '';
$client_url = '';
}

// Tags Filter
if (isset($_GET['tags']) && is_array($_GET['tags']) && !empty($_GET['tags'])) {
Expand All @@ -27,13 +36,14 @@

$sql = mysqli_query(
$mysqli,
"SELECT SQL_CALC_FOUND_ROWS locations.*, GROUP_CONCAT(tag_name) FROM locations
"SELECT SQL_CALC_FOUND_ROWS locations.*, clients.*, GROUP_CONCAT(tag_name) FROM locations
LEFT JOIN clients ON client_id = location_client_id
LEFT JOIN location_tags ON location_tags.location_id = locations.location_id
LEFT JOIN tags ON tags.tag_id = location_tags.tag_id
WHERE location_client_id = $client_id
WHERE location_$archive_query
$tag_query
AND location_$archive_query
AND (location_name LIKE '%$q%' OR location_description LIKE '%$q%' OR location_address LIKE '%$q%' OR location_phone LIKE '%$phone_query%' OR tag_name LIKE '%$q%')
AND (location_name LIKE '%$q%' OR location_description LIKE '%$q%' OR location_address LIKE '%$q%' OR location_phone LIKE '%$phone_query%' OR tag_name LIKE '%$q%' OR client_name LIKE '%$q%')
$client_query
GROUP BY location_id
ORDER BY location_primary DESC, $sort $order LIMIT $record_from, $record_to"
);
Expand Down Expand Up @@ -67,7 +77,9 @@
</div>
<div class="card-body">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } ?>
<input type="hidden" name="archived" value="<?php echo $archived; ?>">
<div class="row">

Expand Down Expand Up @@ -97,7 +109,7 @@

<div class="col-md-5">
<div class="btn-group float-right">
<a href="?client_id=<?php echo $client_id; ?>&archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
<a href="?<?php echo $client_url; ?>archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive mr-2"></i>Archived
</a>
Expand Down Expand Up @@ -167,13 +179,22 @@ class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"
Hours <?php if ($sort == 'location_hours') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php

while ($row = mysqli_fetch_array($sql)) {
$client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']);
$location_id = intval($row['location_id']);
$location_name = nullable_htmlentities($row['location_name']);
$location_description = nullable_htmlentities($row['location_description']);
Expand Down Expand Up @@ -231,7 +252,7 @@ class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"
}

$location_tag_id_array[] = $location_tag_id;
$location_tag_name_display_array[] = "<a href='client_locations.php?client_id=$client_id&tags[]=$location_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $location_tag_color;'><i class='fa fa-fw fa-$location_tag_icon mr-2'></i>$location_tag_name</span></a>";
$location_tag_name_display_array[] = "<a href='locations.php?$client_url tags[]=$location_tag_id'><span class='badge text-light p-1 mr-1' style='background-color: $location_tag_color;'><i class='fa fa-fw fa-$location_tag_icon mr-2'></i>$location_tag_name</span></a>";
}
$location_tags_display = implode('', $location_tag_name_display_array);

Expand Down Expand Up @@ -270,6 +291,9 @@ class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"
<?php echo $location_fax_display; ?>
</td>
<td><?php echo $location_hours_display; ?></td>
<?php if (!$client_url) { ?>
<td><a href="locations.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
<?php } ?>
<td>
<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
Expand Down Expand Up @@ -313,7 +337,7 @@ class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"
</tbody>
</table>
</div>
<?php require_once "modals/client_location_bulk_assign_tags_modal.php"; ?>
<?php require_once "modals/location_bulk_assign_tags_modal.php"; ?>
</form>
<?php require_once "includes/filter_footer.php";
?>
Expand All @@ -324,7 +348,7 @@ class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"

<?php

require_once "modals/client_location_add_modal.php";
require_once "modals/client_location_import_modal.php";
require_once "modals/client_location_export_modal.php";
require_once "modals/location_add_modal.php";
require_once "modals/location_import_modal.php";
require_once "modals/location_export_modal.php";
require_once "includes/footer.php";
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
</button>
</div>
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">

<div class="modal-body bg-white">

Expand All @@ -33,6 +32,33 @@
<div class="tab-content">

<div class="tab-pane fade show active" id="pills-details">

<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } else { ?>

<div class="form-group">
<label>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-user"></i></span>
</div>
<select class="form-control select2" name="client_id" required>
<option value="">- Select Client -</option>
<?php

$sql = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
while ($row = mysqli_fetch_array($sql)) {
$client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']); ?>
<option value="<?php echo $client_id; ?>"><?php echo $client_name; ?></option>

<?php } ?>
</select>
</div>
</div>

<?php } ?>

<div class="form-group">
<label>Location Name <strong class="text-danger">*</strong> / <span class="text-secondary">Primary</span></label>
Expand Down Expand Up @@ -126,7 +152,7 @@
</div>

<div class="tab-pane fade" id="pills-contact">

<?php if ($client_url) { ?>
<div class="form-group">
<label>Contact</label>
<div class="input-group">
Expand All @@ -148,6 +174,7 @@
</select>
</div>
</div>
<?php } ?>

<div class="form-group">
<label>Phone</label>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
</button>
</div>
<form action="post.php" method="post" autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } ?>
<div class="modal-body bg-white">

</div>
<div class="modal-footer bg-white">
<button type="submit" name="export_client_locations_csv" class="btn btn-primary text-bold"><i class="fas fa-fw fa-download mr-2"></i>Download CSV</button>
<button type="submit" name="export_locations_csv" class="btn btn-primary text-bold"><i class="fas fa-fw fa-download mr-2"></i>Download CSV</button>
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
</div>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@
</button>
</div>
<form action="post.php" method="post" enctype="multipart/form-data" autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<?php } ?>
<div class="modal-body bg-white">
<p><strong>Format csv file with headings & data:</strong><br>Name, Description, Address, City, State, Postal Code, Phone, Hours</p>
<hr>
<div class="form-group my-4">
<input type="file" class="form-control-file" name="file" accept=".csv" required>
</div>
<hr>
<div>Download: <a class="text-bold" href="post.php?download_client_locations_csv_template=<?php echo $client_id; ?>">sample csv template</a></div>
<div>Download: <a class="text-bold" href="post.php?download_locations_csv_template=<?php echo $client_id; ?>">sample csv template</a></div>
</div>
<div class="modal-footer bg-white">
<button type="submit" name="import_client_locations_csv" class="btn btn-primary text-bold"><i class="fa fa-upload mr-2"></i>Import</button>
<button type="submit" name="import_locations_csv" class="btn btn-primary text-bold"><i class="fa fa-upload mr-2"></i>Import</button>
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
</div>
</form>
Expand Down
Loading

0 comments on commit fc00b5e

Please sign in to comment.