mirror of https://github.com/itflow-org/itflow
commit
c3b7f28057
|
|
@ -99,6 +99,9 @@ if(isset($_GET['client_id'])){
|
|||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('ticket_id') AS num FROM tickets WHERE ticket_archived_at IS NULL AND ticket_status = 'Open' AND ticket_client_id = $client_id"));
|
||||
$num_open_tickets = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('service_id') AS num FROM services WHERE service_client_id = $client_id"));
|
||||
$num_services = $row['num'];
|
||||
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT('vendor_id') AS num FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id"));
|
||||
$num_vendors = $row['num'];
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ if(isset($_GET['tab'])){
|
|||
elseif($_GET['tab'] == "documents"){
|
||||
include("client_documents.php");
|
||||
}
|
||||
elseif($_GET['tab'] == "services"){
|
||||
include("client_services.php");
|
||||
}
|
||||
}
|
||||
else{
|
||||
include("client_overview.php");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,160 @@
|
|||
<?php
|
||||
|
||||
// Search query
|
||||
if(isset($_GET['q'])){
|
||||
$q = mysqli_real_escape_string($mysqli,$_GET['q']);
|
||||
}else{
|
||||
$q = "";
|
||||
}
|
||||
|
||||
// Current tab
|
||||
$tab = htmlentities($_GET['tab']);
|
||||
|
||||
// Overview SQL query
|
||||
$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM services WHERE service_client_id = '$client_id' AND (service_name LIKE '%$q%' OR service_description LIKE '%$q%')");
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
||||
|
||||
?>
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-stream"></i> Services</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addServiceModal"><i class="fas fa-fw fa-plus"></i> New Service</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<form autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||
<input type="hidden" name="tab" value="<?php echo $tab; ?>">
|
||||
<div class="input-group">
|
||||
<input type="search" class="form-control " name="q" value="<?php if(isset($q)){echo stripslashes($q);} ?>" placeholder="Search <?php echo ucwords($tab); ?>">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-borderless table-hover">
|
||||
<thead class="<?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
|
||||
<tr>
|
||||
<th><a class="text-dark">Name</a></th>
|
||||
<th><a class="text-dark">Category</a></th>
|
||||
<th><a class="text-dark">Updated</a></th>
|
||||
<th><a class="text-dark">Importance</a></th>
|
||||
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$service_id = $row['service_id'];
|
||||
$service_name = $row['service_name'];
|
||||
$service_description = $row['service_description'];
|
||||
$service_category = $row['service_category'];
|
||||
$service_importance = $row['service_importance'];
|
||||
$service_notes = $row['service_notes'];
|
||||
$service_updated_at = $row['service_updated_at'];
|
||||
$service_review_due = $row['service_review_due'];
|
||||
|
||||
// Service Importance
|
||||
if($service_importance == "High"){
|
||||
$service_importance_display = "<span class='p-2 badge badge-danger'>$service_importance</span>";
|
||||
}elseif($service_importance == "Medium"){
|
||||
$service_importance_display = "<span class='p-2 badge badge-warning'>$service_importance</span>";
|
||||
}elseif($service_importance == "Low"){
|
||||
$service_importance_display = "<span class='p-2 badge badge-info'>$service_importance</span>";
|
||||
}else{
|
||||
$service_importance_display = "-";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<!-- Name/Category/Updated/Importance from DB -->
|
||||
<td><a href="#" data-toggle="modal" data-target="#viewServiceModal<?php echo $service_id; ?>"> <?php echo $service_name ?></a></td>
|
||||
<td><a> <?php echo $service_category ?></a></td>
|
||||
<td><a> <?php echo $service_updated_at ?></a></td>
|
||||
<td><a> <?php echo $service_importance ?></a></td>
|
||||
|
||||
<!-- Action -->
|
||||
<td>
|
||||
<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">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editServiceModal<?php echo $service_id; ?>">Edit</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?delete_service=<?php echo $service_id; ?>">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
// Associated Assets (and their logins/networks/locations)
|
||||
$sql_assets = mysqli_query($mysqli, "SELECT * FROM service_assets
|
||||
LEFT JOIN assets
|
||||
ON service_assets.asset_id = assets.asset_id
|
||||
LEFT JOIN logins
|
||||
ON service_assets.asset_id = logins.login_asset_id
|
||||
LEFT JOIN networks
|
||||
ON assets.asset_network_id = networks.network_id
|
||||
LEFT JOIN locations
|
||||
ON assets.asset_location_id = locations.location_id
|
||||
WHERE service_id = '$service_id'");
|
||||
|
||||
// Associated logins
|
||||
$sql_logins = mysqli_query($mysqli, "SELECT * FROM service_logins
|
||||
LEFT JOIN logins
|
||||
ON service_logins.login_id = logins.login_id
|
||||
WHERE service_id = '$service_id'");
|
||||
|
||||
// Associated Domains
|
||||
$sql_domains = mysqli_query($mysqli, "SELECT * FROM service_domains
|
||||
LEFT JOIN domains
|
||||
ON service_domains.domain_id = domains.domain_id
|
||||
WHERE service_id = '$service_id'");
|
||||
|
||||
// Associated URLs
|
||||
$sql_urls = mysqli_query($mysqli, "SELECT * FROM service_urls
|
||||
WHERE service_id = '$service_id'");
|
||||
|
||||
// Associated Vendors
|
||||
$sql_vendors = mysqli_query($mysqli, "SELECT * FROM service_vendors
|
||||
LEFT JOIN vendors
|
||||
ON service_vendors.vendor_id = vendors.vendor_id
|
||||
WHERE service_id = '$service_id'");
|
||||
|
||||
// Associated Contacts
|
||||
$sql_contacts = mysqli_query($mysqli, "SELECT * FROM service_contacts
|
||||
LEFT JOIN contacts
|
||||
ON service_contacts.contact_id = contacts.contact_id
|
||||
WHERE service_id = '$service_id'");
|
||||
|
||||
// Associated Documents
|
||||
$sql_docs = mysqli_query($mysqli, "SELECT * FROM service_documents
|
||||
LEFT JOIN documents
|
||||
ON service_documents.document_id = documents.document_id
|
||||
WHERE service_id = '$service_id'");
|
||||
|
||||
include("service_edit_modal.php");
|
||||
include("service_view_modal.php");
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include("service_add_modal.php"); ?>
|
||||
|
|
@ -141,6 +141,19 @@
|
|||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="?client_id=<?php echo $client_id; ?>&tab=services" class="nav-link <?php if($_GET['tab'] == "services") { echo "active"; } ?>">
|
||||
<i class="nav-icon fas fa-stream"></i>
|
||||
<p>
|
||||
Services
|
||||
<?php
|
||||
if($num_services > 0){ ?>
|
||||
<span class="right badge badge-light"><?php echo $num_services; ?></span>
|
||||
<?php } ?>
|
||||
</p>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="?client_id=<?php echo $client_id; ?>&tab=vendors" class="nav-link <?php if($_GET['tab'] == "vendors") { echo "active"; } ?>">
|
||||
<i class="nav-icon fas fa-building"></i>
|
||||
|
|
|
|||
83
db.sql
83
db.sql
|
|
@ -927,6 +927,89 @@ CREATE TABLE `scheduled_tickets` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `services`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `services`;
|
||||
CREATE TABLE IF NOT EXISTS `services` (
|
||||
`service_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`service_name` varchar(200) CHARACTER SET latin1 NOT NULL,
|
||||
`service_description` varchar(200) CHARACTER SET latin1 NOT NULL,
|
||||
`service_category` varchar(20) CHARACTER SET latin1 NOT NULL,
|
||||
`service_importance` varchar(10) CHARACTER SET latin1 NOT NULL,
|
||||
`service_notes` text CHARACTER SET latin1 NOT NULL,
|
||||
`service_created_at` datetime NOT NULL,
|
||||
`service_updated_at` datetime DEFAULT NULL,
|
||||
`service_review_due` date DEFAULT NULL,
|
||||
`service_client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`service_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Table structure for table `service_assets`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `service_assets`;
|
||||
CREATE TABLE IF NOT EXISTS `service_assets` (
|
||||
`service_id` int(11) NOT NULL,
|
||||
`asset_id` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `service_contacts`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `service_contacts`;
|
||||
CREATE TABLE IF NOT EXISTS `service_contacts` (
|
||||
`service_id` int(11) NOT NULL,
|
||||
`contact_id` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `service_documents`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `service_documents`;
|
||||
CREATE TABLE IF NOT EXISTS `service_documents` (
|
||||
`service_id` int(11) NOT NULL,
|
||||
`document_id` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Table structure for table `service_domains`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `service_domains`;
|
||||
CREATE TABLE IF NOT EXISTS `service_domains` (
|
||||
`service_id` int(11) NOT NULL,
|
||||
`domain_id` int(11) NOT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Table structure for table `service_logins`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `service_logins`;
|
||||
CREATE TABLE IF NOT EXISTS `service_logins` (
|
||||
`service_id` int(11) NOT NULL,
|
||||
`login_id` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Table structure for table `service_vendors`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `service_vendors`;
|
||||
CREATE TABLE IF NOT EXISTS `service_vendors` (
|
||||
`service_id` int(11) NOT NULL,
|
||||
`vendor_id` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `settings`
|
||||
--
|
||||
|
|
|
|||
195
post.php
195
post.php
|
|
@ -5524,6 +5524,201 @@ if(isset($_GET['export_client_tickets_csv'])){
|
|||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_service'])){
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$service_name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||
$service_description = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['description'])));
|
||||
$service_category = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['category']))); //TODO: Needs integration with company categories
|
||||
$service_importance = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['importance'])));
|
||||
$service_notes = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['note'])));
|
||||
|
||||
// Create Service
|
||||
$service_sql = mysqli_query($mysqli, "INSERT INTO services SET service_name = '$service_name', service_description = '$service_description', service_category = '$service_category', service_importance = '$service_importance', service_notes = '$service_notes', service_created_at = NOW(), service_client_id = '$client_id', company_id = '$session_company_id'");
|
||||
|
||||
// TODO: Support for URLs
|
||||
|
||||
// Create links to assets
|
||||
if($service_sql){
|
||||
$service_id = $mysqli->insert_id;
|
||||
|
||||
if(!empty($_POST['contacts'])){
|
||||
$service_contact_ids = $_POST['contacts'];
|
||||
foreach($service_contact_ids as $contact_id){
|
||||
if(intval($contact_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_contacts SET service_id = '$service_id', contact_id = '$contact_id'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_POST['vendors'])){
|
||||
$service_vendor_ids = $_POST['vendors'];
|
||||
foreach($service_vendor_ids as $vendor_id){
|
||||
if(intval($vendor_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_vendors SET service_id = '$service_id', vendor_id = '$vendor_id'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_POST['documents'])){
|
||||
$service_document_ids = $_POST['documents'];
|
||||
foreach($service_document_ids as $document_id){
|
||||
if(intval($document_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_documents SET service_id = '$service_id', document_id = '$document_id'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_POST['assets'])){
|
||||
$service_asset_ids = $_POST['assets'];
|
||||
foreach($service_asset_ids as $asset_id){
|
||||
if(intval($asset_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_assets SET service_id = '$service_id', asset_id = '$asset_id'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_POST['logins'])){
|
||||
$service_login_ids = $_POST['logins'];
|
||||
foreach($service_login_ids as $login_id){
|
||||
if(intval($login_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_logins SET service_id = '$service_id', login_id = '$login_id'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_POST['logins'])){
|
||||
$service_domain_ids = $_POST['domains'];
|
||||
foreach($service_domain_ids as $domain_id){
|
||||
if(intval($domain_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_domains SET service_id = '$service_id', domain_id = '$domain_id'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Service', log_action = 'Create', log_description = '$session_name created service $service_name', log_created_at = NOW(), log_client_id = $client_id, company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Service added";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
else{
|
||||
$_SESSION['alert_message'] = "Something went wrong (SQL)";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST['edit_service'])){
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$service_id = intval($_POST['service_id']);
|
||||
$service_name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])));
|
||||
$service_description = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['description'])));
|
||||
$service_category = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['category']))); //TODO: Needs integration with company categories
|
||||
$service_importance = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['importance'])));
|
||||
$service_notes = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['note'])));
|
||||
|
||||
// Update main service details
|
||||
mysqli_query($mysqli, "UPDATE services SET service_name = '$service_name', service_description = '$service_description', service_category = '$service_category', service_importance = '$service_importance', service_notes = '$service_notes', service_updated_at = NOW() WHERE service_id = '$service_id' AND company_id = '$session_company_id'");
|
||||
|
||||
// Unlink existing relations/assets
|
||||
mysqli_query($mysqli, "DELETE FROM service_contacts WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_vendors WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_documents WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_assets WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_logins WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_domains WHERE service_id = '$service_id'");
|
||||
|
||||
// Relink
|
||||
if(!empty($_POST['contacts'])){
|
||||
$service_contact_ids = $_POST['contacts'];
|
||||
foreach($service_contact_ids as $contact_id){
|
||||
if(intval($contact_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_contacts SET service_id = '$service_id', contact_id = '$contact_id'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_POST['vendors'])){
|
||||
$service_vendor_ids = $_POST['vendors'];
|
||||
foreach($service_vendor_ids as $vendor_id){
|
||||
if(intval($vendor_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_vendors SET service_id = '$service_id', vendor_id = '$vendor_id'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_POST['documents'])){
|
||||
$service_document_ids = $_POST['documents'];
|
||||
foreach($service_document_ids as $document_id){
|
||||
if(intval($document_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_documents SET service_id = '$service_id', document_id = '$document_id'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_POST['assets'])){
|
||||
$service_asset_ids = $_POST['assets'];
|
||||
foreach($service_asset_ids as $asset_id){
|
||||
if(intval($asset_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_assets SET service_id = '$service_id', asset_id = '$asset_id'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_POST['logins'])){
|
||||
$service_login_ids = $_POST['logins'];
|
||||
foreach($service_login_ids as $login_id){
|
||||
if(intval($login_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_logins SET service_id = '$service_id', login_id = '$login_id'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_POST['logins'])){
|
||||
$service_domain_ids = $_POST['domains'];
|
||||
foreach($service_domain_ids as $domain_id){
|
||||
if(intval($domain_id)){
|
||||
mysqli_query($mysqli, "INSERT INTO service_domains SET service_id = '$service_id', domain_id = '$domain_id'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Service', log_action = 'Modified', log_description = '$session_name modified service $service_name', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Service updated";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if(isset($_GET['delete_service'])){
|
||||
$service_id = intval($_GET['delete_service']);
|
||||
|
||||
// Delete service
|
||||
$delete_sql = mysqli_query($mysqli, "DELETE FROM services WHERE service_id = '$service_id' AND company_id = '$session_company_id'");
|
||||
|
||||
// Delete relations
|
||||
// TODO: Convert this to a join delete
|
||||
if($delete_sql){
|
||||
mysqli_query($mysqli, "DELETE FROM service_contacts WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_vendors WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_documents WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_assets WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_logins WHERE service_id = '$service_id'");
|
||||
mysqli_query($mysqli, "DELETE FROM service_domains WHERE service_id = '$service_id'");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Service', log_action = 'Deleted', log_description = '$session_name deleted service $service_id', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Service deleted";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
else{
|
||||
$_SESSION['alert_message'] = "Something went wrong (SQL)";
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST['add_file'])){
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$new_name = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['new_name'])));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,211 @@
|
|||
<div class="modal" id="addServiceModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-md">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-stream mr-2"></i></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-overview">Overview</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-general">General</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-assets">Assets</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<!-- //TODO: The multiple selects won't play nicely with the icons or just general formatting. I've just added blank <p> tags to format it better for now -->
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-overview">
|
||||
|
||||
<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-stream"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name of Service" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description <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-info-circle"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="description" placeholder="Description of Service" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- //TODO: Integrate with company wide categories: /categories.php -->
|
||||
<div class="form-group">
|
||||
<label>Category</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-info"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="category" placeholder="Category" autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Importance</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="importance" required>
|
||||
<option>Low</option>
|
||||
<option>Medium</option>
|
||||
<option>High</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TODO: We need a way of adding multiple (optional) URLs? Ideas? -->
|
||||
<!-- <div class="form-group">
|
||||
<label>URL</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-link"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="url" placeholder="URL" autofocus>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group">
|
||||
<label>Notes</label>
|
||||
<textarea class="form-control" rows="3" placeholder="Enter some notes" name="note"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-general">
|
||||
<div class="form-group">
|
||||
<label for="contacts">Contacts</label>
|
||||
<p></p>
|
||||
<select class="form-select" id="contacts" name="contacts[]" multiple="multiple">
|
||||
<option value="">- Contacts -</option>
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = '$client_id'");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$contact_id = $row['contact_id'];
|
||||
$contact_name = $row['contact_name'];
|
||||
echo "<option value=\"$contact_id\">$contact_name</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="vendors">Vendors</label>
|
||||
<p></p>
|
||||
<select class="form-select" id="vendors" name="vendors[]" multiple="multiple">
|
||||
<option value="">- Vendors -</option>
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_client_id = '$client_id'");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$vendor_name = $row['vendor_name'];
|
||||
echo "<option value=\"$vendor_id\">$vendor_name</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="documents">Documents</label>
|
||||
<p></p>
|
||||
<select class="form-select" id="documents" name="documents[]" multiple="multiple">
|
||||
<option value="">- Documents -</option>
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_client_id = '$client_id'");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$document_id = $row['document_id'];
|
||||
$document_name = $row['document_name'];
|
||||
echo "<option value=\"$document_id\">$document_name</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- TODO: Services related to other services & certificates -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade" id="pills-assets">
|
||||
<div class="form-group">
|
||||
<label for="assets">Assets</label>
|
||||
<p></p>
|
||||
<select class="form-select" id="assets" name="assets[]" multiple="multiple">
|
||||
<option value="">- Assets -</option>
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_client_id = '$client_id'");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$asset_id = $row['asset_id'];
|
||||
$asset_name = $row['asset_name'];
|
||||
echo "<option value=\"$asset_id\">$asset_name</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="logins">Logins</label>
|
||||
<p class="text-muted">Logins associated to related assets will show as related automatically</p>
|
||||
<select class="form-select" id="logins" name="logins[]" multiple="multiple">
|
||||
<option value="">- Logins -</option>
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM logins WHERE login_client_id = '$client_id'");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$login_id = $row['login_id'];
|
||||
$login_name = $row['login_name'];
|
||||
echo "<option value=\"$login_id\">$login_name</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="domains">Domains</label>
|
||||
<p></p>
|
||||
<select class="form-select" id="domains" name="domains[]" multiple="multiple">
|
||||
<option value="">- Domains -</option>
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_client_id = '$client_id'");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$domain_id = $row['domain_id'];
|
||||
$domain_name = $row['domain_name'];
|
||||
echo "<option value=\"$domain_id\">$domain_name</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</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="add_service" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,266 @@
|
|||
<div class="modal" id="editServiceModal<?php echo $service_id ?>" tabindex="-1">
|
||||
<div class="modal-dialog modal-md">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-stream mr-2"></i><?php echo "Edit $service_name"; ?> </h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id ?>">
|
||||
<input type="hidden" name="service_id" value="<?php echo $service_id ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="pill" href="#pills-overview<?php echo $service_id ?>">Overview</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-general<?php echo $service_id ?>">General</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-assets<?php echo $service_id ?>">Assets</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<!-- //TODO: The multiple selects won't play nicely with the icons or just general formatting. I've just added blank <p> tags to format it better for now -->
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-overview<?php echo $service_id ?>">
|
||||
|
||||
<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-stream"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name of Service" value="<?php echo $service_name ?>" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description <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-info-circle"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="description" placeholder="Description of Service" value="<?php echo $service_description ?>" required autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- //TODO: Integrate with company wide categories: /categories.php -->
|
||||
<div class="form-group">
|
||||
<label>Category</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-info"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="category" placeholder="Category" value="<?php echo $service_category ?>" autofocus>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Importance</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="importance" required>
|
||||
<option <?php if($service_importance == 'Low'){ echo "selected"; } ?> >Low</option>
|
||||
<option <?php if($service_importance == 'Medium'){ echo "selected"; } ?> >Medium</option>
|
||||
<option <?php if($service_importance == 'High'){ echo "selected"; } ?> >High</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TODO: We need a way of adding multiple (optional) URLs? Ideas? -->
|
||||
<!-- <div class="form-group">
|
||||
<label>URL</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-link"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="url" placeholder="URL" autofocus>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group">
|
||||
<label>Notes</label>
|
||||
<textarea class="form-control" rows="3" placeholder="Enter some notes" name="note"><?php echo $service_notes ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-general<?php echo $service_id ?>">
|
||||
<div class="form-group">
|
||||
<label for="contacts">Contacts</label>
|
||||
<p></p>
|
||||
<select class="form-select" id="contacts" name="contacts[]" multiple="multiple">
|
||||
<option value="">- Contacts -</option>
|
||||
<?php
|
||||
// Get just the currently selected contact IDs
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_contacts,MYSQLI_ASSOC), "contact_id");
|
||||
|
||||
// Get all contacts
|
||||
// NOTE: These are called $sql_all and $row_all for a reason - anything overwriting $sql or $row will break the current while loop we are in from client_services.php
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = '$client_id'");
|
||||
|
||||
while($row_all = mysqli_fetch_array($sql_all)){
|
||||
$contact_id = $row_all['contact_id'];
|
||||
$contact_name = $row_all['contact_name'];
|
||||
|
||||
if(in_array($contact_id, $selected_ids)){
|
||||
echo "<option value=\"$contact_id\" selected>$contact_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$contact_id\">$contact_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="vendors">Vendors</label>
|
||||
<p></p>
|
||||
<select class="form-select" id="vendors" name="vendors[]" multiple="multiple">
|
||||
<option value="">- Vendors -</option>
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_vendors,MYSQLI_ASSOC), "vendor_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_client_id = '$client_id'");
|
||||
while($row_all = mysqli_fetch_array($sql_all)){
|
||||
$vendor_id = $row_all['vendor_id'];
|
||||
$vendor_name = $row_all['vendor_name'];
|
||||
|
||||
if(in_array($vendor_id, $selected_ids)){
|
||||
echo "<option value=\"$vendor_id\" selected>$vendor_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$vendor_id\">$vendor_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="documents">Documents</label>
|
||||
<p></p>
|
||||
<select class="form-select" id="documents" name="documents[]" multiple="multiple">
|
||||
<option value="">- Documents -</option>
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_docs,MYSQLI_ASSOC), "document_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_client_id = '$client_id'");
|
||||
while($row_all = mysqli_fetch_array($sql_all)){
|
||||
$document_id = $row_all['document_id'];
|
||||
$document_name = $row_all['document_name'];
|
||||
|
||||
if(in_array($document_id, $selected_ids)){
|
||||
echo "<option value=\"$document_id\" selected>$document_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$document_id\">$document_name</option>";
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- TODO: Services related to other services & certificates -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade" id="pills-assets<?php echo $service_id ?>">
|
||||
<div class="form-group">
|
||||
<label for="assets">Assets</label>
|
||||
<p></p>
|
||||
<select class="form-select" id="assets" name="assets[]" multiple="multiple">
|
||||
<option value="">- Assets -</option>
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_assets,MYSQLI_ASSOC), "asset_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_client_id = '$client_id'");
|
||||
while($row_all = mysqli_fetch_array($sql_all)){
|
||||
$asset_id = $row_all['asset_id'];
|
||||
$asset_name = $row_all['asset_name'];
|
||||
|
||||
if(in_array($asset_id, $selected_ids)){
|
||||
echo "<option value=\"$asset_id\" selected>$asset_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$asset_id\">$asset_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="logins">Logins</label>
|
||||
<p class="text-muted">Logins associated to related assets will show as related automatically</p>
|
||||
<select class="form-select" id="logins" name="logins[]" multiple="multiple">
|
||||
<option value="">- Logins -</option>
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_logins,MYSQLI_ASSOC), "login_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM logins WHERE login_client_id = '$client_id'");
|
||||
while($row_all = mysqli_fetch_array($sql_all)){
|
||||
$login_id = $row_all['login_id'];
|
||||
$login_name = $row_all['login_name'];
|
||||
|
||||
if(in_array($login_id, $selected_ids)){
|
||||
echo "<option value=\"$login_id\" selected>$login_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$login_id\">$login_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="domains">Domains</label>
|
||||
<p></p>
|
||||
<select class="form-select" id="domains" name="domains[]" multiple="multiple">
|
||||
<option value="">- Domains -</option>
|
||||
<?php
|
||||
$selected_ids = array_column(mysqli_fetch_all($sql_domains,MYSQLI_ASSOC), "domain_id");
|
||||
|
||||
$sql_all = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_client_id = '$client_id'");
|
||||
while($row_all = mysqli_fetch_array($sql_all)){
|
||||
$domain_id = $row_all['domain_id'];
|
||||
$domain_name = $row_all['domain_name'];
|
||||
|
||||
if(in_array($domain_id, $selected_ids)){
|
||||
echo "<option value=\"$domain_id\" selected>$domain_name</option>";
|
||||
}
|
||||
else{
|
||||
echo "<option value=\"$domain_id\">$domain_name</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</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="edit_service" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,278 @@
|
|||
<div class="modal" id="viewServiceModal<?php echo $service_id ?>" tabindex="-1">
|
||||
<div class="modal-dialog modal-xl">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-stream mr-2"></i><?php echo $service_name; ?> </h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body bg-white">
|
||||
<div class="row">
|
||||
|
||||
<!-- Main/Left side -->
|
||||
<div class="col-8 border-right">
|
||||
<div class="col-12">
|
||||
<h4>Service Overview: <?php echo $service_name; ?></h4>
|
||||
<p>Service Importance: <?php echo $service_importance_display; ?>
|
||||
<p><?php echo $service_description; ?></p>
|
||||
|
||||
<h5><i class="nav-icon fas fa-sticky-note"></i> Notes</h5>
|
||||
<p><?php echo $service_notes; ?></p>
|
||||
<hr>
|
||||
|
||||
<!-- Assets -->
|
||||
<?php
|
||||
if(mysqli_num_rows($sql_assets) > 0){ ?>
|
||||
<h5><i class="nav-icon fas fa-desktop"></i> Assets</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_assets pointer to the start - as we've already cycled through once
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
|
||||
while($row = mysqli_fetch_array($sql_assets)){
|
||||
echo "<li><a href=\"client.php?client_id=$client_id&tab=assets&q=$row[asset_name]\">$row[asset_name]</a></li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Networks -->
|
||||
<?php
|
||||
if($sql_assets){
|
||||
|
||||
$networks = [];
|
||||
|
||||
// Reset the $sql_assets pointer to the start
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
|
||||
// Get networks linked to assets - push name to array
|
||||
while($row = mysqli_fetch_array($sql_assets)){
|
||||
if(!empty($row['network_name'])){
|
||||
$network_data = "$row[network_name]:$row[network_vlan]";
|
||||
array_push($networks, $network_data);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove duplicates
|
||||
$networks = array_unique($networks);
|
||||
|
||||
// Display
|
||||
if(!empty($networks)){ ?>
|
||||
<h5><i class="nav-icon fas fa-network-wired"></i> Networks</h5>
|
||||
<ul>
|
||||
<?php
|
||||
}
|
||||
foreach($networks as $network){
|
||||
$network = explode(":", $network);
|
||||
echo "<li><a href=\"client.php?client_id=$client_id&tab=networks&q=$network[0]\">$network[0] (VLAN $network[1])</a></li>";
|
||||
}
|
||||
|
||||
// Not showing/haven't added explicitly linked networks - can't see a need for a network that doesn't have an asset on it?
|
||||
// Can add at a later date if there is a use case for this
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Locations -->
|
||||
<?php
|
||||
if($sql_assets){
|
||||
|
||||
$location_names = [];
|
||||
|
||||
// Reset the $sql_assets pointer to the start - as we've already cycled through once
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
|
||||
// Get locations linked to assets - push their name and vlan to arrays
|
||||
while($row = mysqli_fetch_array($sql_assets)){
|
||||
if(!empty($row['location_name'])){
|
||||
array_push($location_names, $row['location_name']);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove duplicates
|
||||
$location_names = array_unique($location_names);
|
||||
|
||||
// Display
|
||||
if(!empty($location_names)){ ?>
|
||||
<h5><i class="nav-icon fas fa-map-marker-alt"></i> Locations</h5>
|
||||
<ul>
|
||||
<?php
|
||||
}
|
||||
foreach($location_names as $location){
|
||||
echo "<li><a href=\"client.php?client_id=$client_id&tab=locations&q=$location\">$location</a></li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Domains -->
|
||||
<?php
|
||||
if(mysqli_num_rows($sql_domains) > 0){ ?>
|
||||
<h5><i class="nav-icon fas fa-globe"></i> Domains</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_domains pointer to the start
|
||||
mysqli_data_seek($sql_domains, 0);
|
||||
|
||||
// Showing linked domains
|
||||
while($row = mysqli_fetch_array($sql_domains)){
|
||||
if(!empty($row['domain_name'])){
|
||||
echo "<li><a href=\"client.php?client_id=$client_id&tab=domains&q=$row[domain_name]\">$row[domain_name]</a></li>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Right side -->
|
||||
<div class="col-4">
|
||||
<div class="col-12">
|
||||
<h4>Additional Related Items</h4>
|
||||
<br>
|
||||
|
||||
<!-- Vendors -->
|
||||
<?php
|
||||
// Reset the $sql_vendors pointer to the start
|
||||
mysqli_data_seek($sql_vendors, 0);
|
||||
|
||||
if(mysqli_num_rows($sql_vendors) > 0){ ?>
|
||||
<h5><i class="nav-icon fas fa-users"></i> Vendors</h5>
|
||||
<ul>
|
||||
<?php
|
||||
while($row = mysqli_fetch_array($sql_vendors)){
|
||||
echo "<li><a href=\"client.php?client_id=$client_id&tab=vendors&q=$row[vendor_name]\">$row[vendor_name]</a></li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Contacts -->
|
||||
<?php
|
||||
if(mysqli_num_rows($sql_contacts) > 0){ ?>
|
||||
<h5><i class="nav-icon fas fa-building"></i> Contacts</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_contacts pointer to the start
|
||||
mysqli_data_seek($sql_contacts, 0);
|
||||
|
||||
while($row = mysqli_fetch_array($sql_contacts)){
|
||||
echo "<li><a href=\"client.php?client_id=$client_id&tab=contacts&q=$row[contact_name]\">$row[contact_name]</a></li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Logins -->
|
||||
<?php
|
||||
if(mysqli_num_rows($sql_assets) > 0 OR mysqli_num_rows($sql_logins) > 0){ ?>
|
||||
<h5><i class="nav-icon fas fa-key"></i> Logins</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_assets/logins pointer to the start
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
mysqli_data_seek($sql_logins, 0);
|
||||
|
||||
// Showing logins linked to assets
|
||||
while($row = mysqli_fetch_array($sql_assets)){
|
||||
if(!empty($row['login_name'])){
|
||||
echo "<li><a href=\"client.php?client_id=$client_id&tab=logins&q=$row[login_name]\">$row[login_name]</a></li>";
|
||||
}
|
||||
}
|
||||
|
||||
// Showing explicitly linked logins
|
||||
while($row = mysqli_fetch_array($sql_logins)){
|
||||
if(!empty($row['login_name'])){
|
||||
echo "<li><a href=\"client.php?client_id=$client_id&tab=logins&q=$row[login_name]\">$row[login_name]</a></li>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- URLs -->
|
||||
<!-- --><?php
|
||||
// if($sql_logins OR $sql_urls){ ?>
|
||||
<!-- <h5><i class="nav-icon fas fa-link"></i> URLs</h5>-->
|
||||
<!-- <ul>-->
|
||||
<!-- --><?php
|
||||
// // Reset the $sql_assets pointer to the start
|
||||
// mysqli_data_seek($sql_assets, 0);
|
||||
//
|
||||
// // Showing URLs linked to logins
|
||||
// while($row = mysqli_fetch_array($sql_assets)){
|
||||
// if(!empty($row['login_uri'])){
|
||||
// echo "<li><a href=\"$row[login_uri]\">$row[login_uri]</a></li>";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Showing explicitly linked URLs
|
||||
// while($row = mysqli_fetch_array($sql_urls)){
|
||||
// if(!empty($row['service_uri'])){
|
||||
// echo "<li><a href=\"$row[service_uri]\">$row[service_uri]</a></li>";
|
||||
// }
|
||||
// }
|
||||
// ?>
|
||||
<!-- </ul>-->
|
||||
<!-- --><?php
|
||||
// }
|
||||
// ?>
|
||||
|
||||
<!-- <h5><i class="nav-icon fas fa-lock"></i> Certificates</h5>-->
|
||||
<!-- <ul>-->
|
||||
<!-- <li>SSLs related to a domain - Coming soon!</li>-->
|
||||
<!-- </ul>-->
|
||||
<!---->
|
||||
<!-- <h5><i class="nav-icon fas fa-hdd"></i> Backed up by</h5>-->
|
||||
<!-- <ul>-->
|
||||
<!-- <li>Asset - Coming soon!</li>-->
|
||||
<!-- </ul>-->
|
||||
|
||||
|
||||
<!-- Documents -->
|
||||
<?php
|
||||
if(mysqli_num_rows($sql_docs) > 0){ ?>
|
||||
<h5><i class="nav-icon fas fa-file-alt"></i> Documents</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_docs pointer to the start
|
||||
mysqli_data_seek($sql_docs, 0);
|
||||
|
||||
while($row = mysqli_fetch_array($sql_docs)){
|
||||
echo "<li><a href=\"client.php?client_id=$client_id&tab=documents&q=$row[document_name]\">$row[document_name]</a></li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- <h5><i class="nav-icon fas fa-file-alt"></i> Services</h5>-->
|
||||
<!-- <ul>-->
|
||||
<!-- <li>Related Service - Coming soon!</li>-->
|
||||
<!-- </ul>-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue