mirror of https://github.com/itflow-org/itflow
Initial work for services module
This commit is contained in:
parent
fed9789dee
commit
d85b11fae8
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
|
||||
// Overview SQL query
|
||||
$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM services WHERE service_client_id = '$client_id'");
|
||||
$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">
|
||||
<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)
|
||||
$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
|
||||
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'");
|
||||
|
||||
|
||||
include("service_view_modal.php");
|
||||
//include("service_edit_modal.php");
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -140,6 +140,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_assets > 0){ ?>
|
||||
<span class="right badge badge-light">3<?php //echo $num_assets; ?></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>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,192 @@
|
|||
<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($sql_assets){ ?>
|
||||
<h5><i class="nav-icon fas fa-desktop"></i> Assets</h5>
|
||||
<ul>
|
||||
<?php
|
||||
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){ ?>
|
||||
<h5><i class="nav-icon fas fa-network-wired"></i> Networks</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_assets pointer to the start - as we've already cycled this once
|
||||
mysqli_data_seek($sql_assets, 0);
|
||||
|
||||
// Showing networks linked to assets
|
||||
while($row = mysqli_fetch_array($sql_assets)){
|
||||
if(!empty($row['network_name'])){
|
||||
echo "<li><a href=\"client.php?client_id=$client_id&tab=networks&q=$row[network_name]\">$row[network_name] (VLAN: $row[network_vlan])</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
|
||||
}
|
||||
?>
|
||||
|
||||
<h5><i class="nav-icon fas fa-map-marker-alt"></i> Locations</h5>
|
||||
<ul>
|
||||
<li>Location XYZ</li>
|
||||
<li>Location DEF</li>
|
||||
</ul>
|
||||
|
||||
<!-- Domains -->
|
||||
<?php
|
||||
if($sql_domains){ ?>
|
||||
<h5><i class="nav-icon fas fa-globe"></i> Domains</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// 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>
|
||||
|
||||
<h5><i class="nav-icon fas fa-users"></i> Vendors</h5>
|
||||
<ul>
|
||||
<li>Contoso Developer</li>
|
||||
</ul>
|
||||
|
||||
<h5><i class="nav-icon fas fa-building"></i> Contacts</h5>
|
||||
<ul>
|
||||
<li>Client Contact</li>
|
||||
<li>Developer Contact</li>
|
||||
</ul>
|
||||
|
||||
<!-- Logins -->
|
||||
<?php
|
||||
if($sql_assets OR $sql_logins){ ?>
|
||||
<h5><i class="nav-icon fas fa-key"></i> Logins</h5>
|
||||
<ul>
|
||||
<?php
|
||||
// Reset the $sql_assets pointer to the start - as we've already cycled this once
|
||||
mysqli_data_seek($sql_assets, 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</li>
|
||||
</ul>
|
||||
|
||||
<h5><i class="nav-icon fas fa-hdd"></i> Backed up by</h5>
|
||||
<ul>
|
||||
<li>Asset</li>
|
||||
</ul>
|
||||
|
||||
<h5><i class="nav-icon fas fa-file-alt"></i> Documents</h5>
|
||||
<ul>
|
||||
<li>SOP: New user for client finance app</li>
|
||||
</ul>
|
||||
|
||||
<h5><i class="nav-icon fas fa-file-alt"></i> Services</h5>
|
||||
<ul>
|
||||
<li>Related Service</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue