mirror of https://github.com/itflow-org/itflow
DB Update added contact_id to files, documents and logins Added Related Items Modal to Client Contacts still more work to do
This commit is contained in:
parent
ecb628cad8
commit
165bd572a9
|
|
@ -1,150 +1,102 @@
|
|||
<?php
|
||||
|
||||
$sql_assets = mysqli_query($mysqli,"SELECT * FROM assets WHERE contact_id = $contact_id");
|
||||
$sql_logins = mysqli_query($mysqli,"SELECT * FROM logins WHERE contact_id = $contact_id");
|
||||
$sql_software = mysqli_query($mysqli,"SELECT * FROM software WHERE contact_id = $contact_id");
|
||||
|
||||
?>
|
||||
|
||||
<div class="modal" id="contactDetailsModal<?php echo $contact_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-user-edit mr-2"></i><?php echo $contact_name; ?></h5>
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-user mr-2"></i><?php echo $contact_name; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<ul class="nav nav-pills nav-justified mb-3" id="pills-tab">
|
||||
<ul class="nav nav-pills nav-justified mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" id="pills-assets-tab<?php echo $contact_id; ?>" data-toggle="pill" href="#pills-assets<?php echo $contact_id; ?>">Assets</a>
|
||||
<a class="nav-link active" data-toggle="pill" href="#pillsRelatedAssets<?php echo $contact_id; ?>">Assets</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="pills-logins-tab<?php echo $contact_id; ?>" data-toggle="pill" href="#pills-logins<?php echo $contact_id; ?>">Logins</a>
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsRelatedLogins<?php echo $contact_id; ?>">Logins</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="pills-software-tab<?php echo $contact_id; ?>" data-toggle="pill" href="#pills-software<?php echo $contact_id; ?>">Software</a>
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsRelatedSoftware<?php echo $contact_id; ?>">Software</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pillsRelatedTickets<?php echo $contact_id; ?>">Tickets</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content" id="pills-tabContent<?php echo $contact_id; ?>">
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade show active" id="pillsRelatedAssets<?php echo $contact_id; ?>">
|
||||
<ul>
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-assets<?php echo $contact_id; ?>">
|
||||
<table class="table border table-hover">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Name</th>
|
||||
<th>Make<</th>
|
||||
<th>Model</th>
|
||||
<th>Serial</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
<?php
|
||||
while($row = mysqli_fetch_array($sql_related_assets)){
|
||||
$asset_id = $row['asset_id'];
|
||||
$asset_type = $row['asset_type'];
|
||||
$asset_name = $row['asset_name'];
|
||||
$asset_make = $row['asset_make'];
|
||||
$asset_model = $row['asset_model'];
|
||||
$asset_serial = $row['asset_serial'];
|
||||
|
||||
while($row = mysqli_fetch_array($sql_assets)){
|
||||
$asset_id = $row['asset_id'];
|
||||
$asset_type = $row['asset_type'];
|
||||
$asset_name = $row['asset_name'];
|
||||
$asset_make = $row['asset_make'];
|
||||
$asset_model = $row['asset_model'];
|
||||
$asset_serial = $row['asset_serial'];
|
||||
?>
|
||||
|
||||
<li><?php echo $asset_name; ?></li>
|
||||
|
||||
?>
|
||||
|
||||
<td><?php echo $asset_type; ?></td>
|
||||
<td><?php echo $asset_name; ?></td>
|
||||
<td><?php echo $asset_make; ?></td>
|
||||
<td><?php echo $asset_model; ?></td>
|
||||
<td><?php echo $asset_serial; ?></td>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-logins<?php echo $contact_id; ?>">
|
||||
<div class="tab-pane fade" id="pillsRelatedLogins<?php echo $contact_id; ?>">
|
||||
<ul>
|
||||
<?php
|
||||
|
||||
<table class="table border table-hover">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Username</th>
|
||||
<th>Password</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
while($row = mysqli_fetch_array($sql_related_logins)){
|
||||
$login_id = $row['login_id'];
|
||||
$login_name = $row['login_name'];
|
||||
$login_uri = $row['login_uri'];
|
||||
$login_username = $row['login_username'];
|
||||
$login_password = $row['login_password'];
|
||||
$login_note = $row['login_note'];
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$asset_id = $row['asset_id'];
|
||||
$software_id = $row['software_id'];
|
||||
|
||||
<?php
|
||||
?>
|
||||
|
||||
<li><?php echo "$login_name - $login_username"; ?></li>
|
||||
|
||||
while($row = mysqli_fetch_array($sql_logins)){
|
||||
$login_id = $row['login_id'];
|
||||
$login_name = $row['login_name'];
|
||||
$login_uri = $row['login_uri'];
|
||||
$login_username = $row['login_username'];
|
||||
$login_password = $row['login_password'];
|
||||
$login_note = $row['login_note'];
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$asset_id = $row['asset_id'];
|
||||
$software_id = $row['software_id'];
|
||||
|
||||
?>
|
||||
|
||||
<td><?php echo $login_name; ?></td>
|
||||
<td><?php echo $login_username; ?></td>
|
||||
<td><?php echo $login_password; ?></td>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="pills-software<?php echo $contact_id; ?>">
|
||||
<table class="table border table-hover">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Software</th>
|
||||
<th>Type</th>
|
||||
<th>License</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<div class="tab-pane fade" id="pillsRelatedSoftware<?php echo $contact_id; ?>">
|
||||
<ul>
|
||||
<?php
|
||||
|
||||
<?php
|
||||
while($row = mysqli_fetch_array($sql_related_software)){
|
||||
$software_id = $row['software_id'];
|
||||
$software_name = $row['software_name'];
|
||||
$software_type = $row['software_type'];
|
||||
$software_license = $row['software_license'];
|
||||
$software_notes = $row['software_notes'];
|
||||
|
||||
while($row = mysqli_fetch_array($sql_software)){
|
||||
$software_id = $row['software_id'];
|
||||
$software_name = $row['software_name'];
|
||||
$software_type = $row['software_type'];
|
||||
$software_license = $row['software_license'];
|
||||
$software_notes = $row['software_notes'];
|
||||
|
||||
?>
|
||||
|
||||
<td><?php echo $software_name; ?></td>
|
||||
<td><?php echo $software_type; ?></td>
|
||||
<td><?php echo $software_license; ?></td>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<li><?php echo "$software_name - $software_type"; ?></li>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -159,16 +159,28 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$department_id = $row['department_id'];
|
||||
|
||||
// Related Assets Query
|
||||
//$sql_related_assets = mysqli_query($mysqli,"SELECT * FROM contact_assets LEFT JOIN assets ON assets.asset_id = contact_assets.asset_id WHERE contact_assets.contact_id = $contact_id ORDER BY assets.asset_id DESC");
|
||||
//$asset_count = mysqli_num_rows($sql_related_assets);
|
||||
$sql_related_assets = mysqli_query($mysqli,"SELECT * FROM assets WHERE asset_contact_id = $contact_id AND company_id = $session_company_id ORDER BY asset_id DESC");
|
||||
$asset_count = mysqli_num_rows($sql_related_assets);
|
||||
|
||||
// Related Logins Query
|
||||
//$sql_related_logins = mysqli_query($mysqli,"SELECT * FROM logins WHERE login_contact_id = $contact_id AND company_id = $session_company_id ORDER BY login_id DESC");
|
||||
//$login_count = mysqli_num_rows($sql_related_logins);
|
||||
$sql_related_logins = mysqli_query($mysqli,"SELECT * FROM logins WHERE login_contact_id = $contact_id AND company_id = $session_company_id ORDER BY login_id DESC");
|
||||
$login_count = mysqli_num_rows($sql_related_logins);
|
||||
|
||||
// Related Software Query
|
||||
//$sql_related_software = mysqli_query($mysqli,"SELECT * FROM software WHERE software_contact_id = $contact_id AND company_id = $session_company_id ORDER BY software_id DESC");
|
||||
//$software_count = mysqli_num_rows($sql_related_software);
|
||||
$sql_related_software = mysqli_query($mysqli,"SELECT * FROM software, software_contacts WHERE software.software_id = software_contacts.software_id AND software_contacts.contact_id = $contact_id AND software.company_id = $session_company_id ORDER BY software.software_id DESC");
|
||||
$software_count = mysqli_num_rows($sql_related_software);
|
||||
|
||||
// Related Tickets Query
|
||||
$sql_related_tickets = mysqli_query($mysqli,"SELECT * FROM tickets WHERE ticket_contact_id = $contact_id AND company_id = $session_company_id ORDER BY ticket_id DESC");
|
||||
$ticket_count = mysqli_num_rows($sql_related_tickets);
|
||||
|
||||
// Related Documents Query
|
||||
$sql_related_documents = mysqli_query($mysqli,"SELECT * FROM documents WHERE document_contact_id = $contact_id AND company_id = $session_company_id ORDER BY document_id DESC");
|
||||
$document_count = mysqli_num_rows($sql_related_documents);
|
||||
|
||||
// Related Files Query
|
||||
$sql_related_files = mysqli_query($mysqli,"SELECT * FROM files WHERE file_contact_id = $contact_id AND company_id = $session_company_id ORDER BY file_id DESC");
|
||||
$file_count = mysqli_num_rows($sql_related_documents);
|
||||
|
||||
?>
|
||||
<tr>
|
||||
|
|
@ -204,6 +216,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#contactDetailsModal<?php echo $contact_id; ?>">View Details</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editContactModal<?php echo $contact_id; ?>">Edit</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger" href="post.php?archive_contact=<?php echo $contact_id; ?>">Archive</a>
|
||||
|
|
@ -212,12 +225,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
include("client_contact_edit_modal.php");
|
||||
include("client_contact_details_modal.php");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,30 @@
|
|||
|
||||
<div class="tab-pane fade" id="pills-relation">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Contact</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" name="contact">
|
||||
<option value="">- Contact -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$contact_id = $row['contact_id'];
|
||||
$contact_name = $row['contact_name'];
|
||||
?>
|
||||
<option value="<?php echo $contact_id; ?>"><?php echo $contact_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Vendor</label>
|
||||
<div class="input-group">
|
||||
|
|
|
|||
|
|
@ -98,6 +98,30 @@
|
|||
|
||||
<div class="tab-pane fade" id="pills-relation<?php echo $login_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Contact</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" name="contact">
|
||||
<option value="">- Contact -</option>
|
||||
<?php
|
||||
|
||||
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
while($row = mysqli_fetch_array($sql_contacts)){
|
||||
$contact_id_select = $row['contact_id'];
|
||||
$contact_name_select = $row['contact_name'];
|
||||
?>
|
||||
<option <?php if($login_contact_id == $contact_id_select){ echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo $contact_name_select; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Vendor</label>
|
||||
<div class="input-group">
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$otp_display = "<i class='far fa-clock text-secondary'></i> $otp<button class='btn btn-sm clipboardjs' data-clipboard-text='$otp'><i class='far fa-copy text-secondary'></i></button>";
|
||||
}
|
||||
$login_note = $row['login_note'];
|
||||
$login_contact_id = $row['login_contact_id'];
|
||||
$login_vendor_id = $row['login_vendor_id'];
|
||||
$login_asset_id = $row['login_asset_id'];
|
||||
$login_software_id = $row['login_software_id'];
|
||||
|
|
|
|||
7
db.sql
7
db.sql
|
|
@ -84,7 +84,7 @@ CREATE TABLE `assets` (
|
|||
`asset_login_id` int(11) DEFAULT NULL,
|
||||
`asset_vendor_id` int(11) DEFAULT NULL,
|
||||
`asset_location_id` int(11) DEFAULT NULL,
|
||||
`asset_contact_id` int(11) DEFAULT NULL,
|
||||
`asset_contact_id` int(11) NOT NULL DEFAULT 0,
|
||||
`asset_network_id` int(11) DEFAULT NULL,
|
||||
`asset_client_id` int(11) DEFAULT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
|
|
@ -399,6 +399,7 @@ CREATE TABLE `documents` (
|
|||
`document_archived_at` datetime DEFAULT NULL,
|
||||
`document_template` tinyint(1) NOT NULL,
|
||||
`document_folder_id` int(11) DEFAULT NULL,
|
||||
`document_contact_id` int(11) NOT NULL DEFAULT 0,
|
||||
`document_client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`document_id`)
|
||||
|
|
@ -510,6 +511,7 @@ CREATE TABLE `files` (
|
|||
`file_created_at` datetime NOT NULL,
|
||||
`file_updated_at` datetime DEFAULT NULL,
|
||||
`file_archived_at` datetime DEFAULT NULL,
|
||||
`file_contact_id` int(11) NOT NULL DEFAULT 0,
|
||||
`file_client_id` int(11) NOT NULL,
|
||||
`company_id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`file_id`)
|
||||
|
|
@ -660,6 +662,7 @@ CREATE TABLE `logins` (
|
|||
`login_created_at` datetime NOT NULL,
|
||||
`login_updated_at` datetime DEFAULT NULL,
|
||||
`login_archived_at` datetime DEFAULT NULL,
|
||||
`login_contact_id` int(11) NOT NULL DEFAULT 0,
|
||||
`login_vendor_id` int(11) DEFAULT NULL,
|
||||
`login_asset_id` int(11) DEFAULT NULL,
|
||||
`login_software_id` int(11) DEFAULT NULL,
|
||||
|
|
@ -1456,4 +1459,4 @@ CREATE TABLE `vendors` (
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2022-02-27 16:53:14
|
||||
-- Dump completed on 2022-03-04 0:23:29
|
||||
|
|
|
|||
6
post.php
6
post.php
|
|
@ -4948,11 +4948,12 @@ if(isset($_POST['add_login'])){
|
|||
$password = trim(mysqli_real_escape_string($mysqli,encryptLoginEntry($_POST['password'])));
|
||||
$otp_secret = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['otp_secret'])));
|
||||
$note = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['note'])));
|
||||
$contact_id = intval($_POST['contact']);
|
||||
$vendor_id = intval($_POST['vendor']);
|
||||
$asset_id = intval($_POST['asset']);
|
||||
$software_id = intval($_POST['software']);
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO logins SET login_name = '$name', login_uri = '$uri', login_username = '$username', login_password = '$password', login_otp_secret = '$otp_secret', login_note = '$note', login_created_at = NOW(), login_vendor_id = $vendor_id, login_asset_id = $asset_id, login_software_id = $software_id, login_client_id = $client_id, company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"INSERT INTO logins SET login_name = '$name', login_uri = '$uri', login_username = '$username', login_password = '$password', login_otp_secret = '$otp_secret', login_note = '$note', login_created_at = NOW(), login_contact_id = $contact_id, login_vendor_id = $vendor_id, login_asset_id = $asset_id, login_software_id = $software_id, login_client_id = $client_id, company_id = $session_company_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Login', log_action = 'Created', log_description = '$name', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
|
|
@ -4972,11 +4973,12 @@ if(isset($_POST['edit_login'])){
|
|||
$password = trim(mysqli_real_escape_string($mysqli,encryptLoginEntry($_POST['password'])));
|
||||
$otp_secret = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['otp_secret'])));
|
||||
$note = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['note'])));
|
||||
$contact_id = intval($_POST['contact']);
|
||||
$vendor_id = intval($_POST['vendor']);
|
||||
$asset_id = intval($_POST['asset']);
|
||||
$software_id = intval($_POST['software']);
|
||||
|
||||
mysqli_query($mysqli,"UPDATE logins SET login_name = '$name', login_uri = '$uri', login_username = '$username', login_password = '$password', login_otp_secret = '$otp_secret', login_note = '$note', login_updated_at = NOW(), login_vendor_id = $vendor_id, login_asset_id = $asset_id, login_software_id = $software_id WHERE login_id = $login_id AND company_id = $session_company_id");
|
||||
mysqli_query($mysqli,"UPDATE logins SET login_name = '$name', login_uri = '$uri', login_username = '$username', login_password = '$password', login_otp_secret = '$otp_secret', login_note = '$note', login_updated_at = NOW(), login_contact_id = $contact_id, login_vendor_id = $vendor_id, login_asset_id = $asset_id, login_software_id = $software_id WHERE login_id = $login_id AND company_id = $session_company_id");
|
||||
|
||||
//Logging
|
||||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Login', log_action = 'Modified', log_description = '$name', log_created_at = NOW(), company_id = $session_company_id, log_user_id = $session_user_id");
|
||||
|
|
|
|||
Loading…
Reference in New Issue