Add notes to client overview

This commit is contained in:
Marcus Hill 2022-03-13 11:27:23 +00:00
parent 81e67f4ed3
commit bdef68ddf5
2 changed files with 156 additions and 113 deletions

View File

@ -142,3 +142,15 @@ if(isset($_GET['network_get_json_details'])){
echo json_encode($response); echo json_encode($response);
} }
if(isset($_POST['client_set_notes'])){
$client_id = intval($_POST['client_id']);
$notes = trim(strip_tags(mysqli_real_escape_string($mysqli, $_POST['notes'])));
// Update notes
mysqli_query($mysqli, "UPDATE clients SET client_notes = '$notes' WHERE client_id = '$client_id'");
// Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Client', log_action = 'Modify', log_description = '$session_name modified client notes', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_created_at = NOW(), log_client_id = $client_id, log_user_id = $session_user_id, company_id = $session_company_id");
}

View File

@ -40,161 +40,192 @@ $sql_tickets_stale = mysqli_query($mysqli,"SELECT * FROM tickets
<hr> <hr>
<div class="row"> <div class="row">
<?php if(mysqli_num_rows($sql_contacts) > 0){ ?> <?php if(mysqli_num_rows($sql_contacts) > 0){ ?>
<!-- Notes -->
<div class="col-2">
<div class="card card-outline card-danger mb-3">
<div class="card-body">
<h5 class="card-title mb-2"><i class="fa fa-sticky-note"></i> Client Notes</h5>
<textarea class="form-control" id="clientNotes" onblur="updateClientNotes(<?php echo $client_id ?>)"><?php echo $client_notes ?></textarea>
</div>
</div>
</div>
<!-- Contacts--> <!-- Contacts-->
<div class="col-6"> <div class="col-4">
<div class="card card-outline card-primary mb-3"> <div class="card card-outline card-primary mb-3">
<div class="card-body"> <div class="card-body">
<h5 class="card-title mb-2"><i class="fa fa-users"></i> Recent Contacts</h5> <h5 class="card-title mb-2"><i class="fa fa-users"></i> Recent Contacts</h5>
<table class="table table-borderless table-sm"> <table class="table table-borderless table-sm">
<tbody> <tbody>
<?php <?php
while($row = mysqli_fetch_array($sql_contacts)){ while($row = mysqli_fetch_array($sql_contacts)){
$contact_id = $row['contact_id']; $contact_id = $row['contact_id'];
$contact_name = $row['contact_name']; $contact_name = $row['contact_name'];
$contact_title = $row['contact_title']; $contact_title = $row['contact_title'];
$contact_phone = formatPhoneNumber($row['contact_phone']); $contact_phone = formatPhoneNumber($row['contact_phone']);
$contact_extension = $row['contact_extension']; $contact_extension = $row['contact_extension'];
$contact_mobile = formatPhoneNumber($row['contact_mobile']); $contact_mobile = formatPhoneNumber($row['contact_mobile']);
$contact_email = $row['contact_email']; $contact_email = $row['contact_email'];
//$client_id = $row['client_id']; //$client_id = $row['client_id'];
//$client_name = $row['client_name']; //$client_name = $row['client_name'];
$department_name = $row['department_name']; $department_name = $row['department_name'];
?> ?>
<tr> <tr>
<td><a href="client.php?client_id=<?php echo $client_id; ?>&tab=contacts"><?php echo $contact_name; ?></a> <td><a href="client.php?client_id=<?php echo $client_id; ?>&tab=contacts"><?php echo $contact_name; ?></a>
<br><small class="text-secondary"><?php echo $contact_title; ?></small> <br><small class="text-secondary"><?php echo $contact_title; ?></small>
</td> </td>
<td><?php echo $contact_email; ?></td> <td><?php echo $contact_email; ?></td>
<td><?php echo "$contact_phone $contact_extension"; ?><br><?php echo $contact_mobile; ?></td> <td><?php echo "$contact_phone $contact_extension"; ?><br><?php echo $contact_mobile; ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</div>
</div> </div>
<?php } ?> <?php } ?>
<?php if(mysqli_num_rows($sql_contacts) > 0){ ?> <?php if(mysqli_num_rows($sql_contacts) > 0){ ?>
<!-- Domains Expiring--> <!-- Domains Expiring -->
<div class="col-3"> <div class="col-3">
<div class="card card-outline card-danger mb-3"> <div class="card card-outline card-danger mb-3">
<div class="card-body"> <div class="card-body">
<h5 class="card-title mb-2"><i class="fa fa-globe"></i> Domains Expiring Soon <small class="text-secondary">(30d)</small></h5> <h5 class="card-title mb-2"><i class="fa fa-globe"></i> Domains Expiring Soon <small class="text-secondary">(30d)</small></h5>
<table class="table table-borderless table-sm"> <table class="table table-borderless table-sm">
<tbody> <tbody>
<?php <?php
while($row = mysqli_fetch_array($sql_domains_expiring)){ while($row = mysqli_fetch_array($sql_domains_expiring)){
$domain_id = $row['domain_id']; $domain_id = $row['domain_id'];
$domain_name = $row['domain_name']; $domain_name = $row['domain_name'];
$domain_expire = $row['domain_expire']; $domain_expire = $row['domain_expire'];
?> ?>
<tr> <tr>
<td><?php echo $domain_name; ?></td> <td><?php echo $domain_name; ?></td>
<td class="text-danger"><?php echo $domain_expire; ?></td> <td class="text-danger"><?php echo $domain_expire; ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</div>
</div> </div>
<?php } ?> <?php } ?>
<?php if(mysqli_num_rows($sql_asset_warranties_expiring) > 0){ ?> <?php if(mysqli_num_rows($sql_asset_warranties_expiring) > 0){ ?>
<!-- Asset Warrenties Expiring--> <!-- Asset Warrenties Expiring-->
<div class="col-3"> <div class="col-3">
<div class="card card-outline card-danger mb-3"> <div class="card card-outline card-danger mb-3">
<div class="card-body"> <div class="card-body">
<h5 class="card-title mb-2"><i class="fa fa-laptop"></i> Asset Warranties Expiring Soon <small class="text-secondary">(90d)</small></h5> <h5 class="card-title mb-2"><i class="fa fa-laptop"></i> Asset Warranties Expiring Soon <small class="text-secondary">(90d)</small></h5>
<table class="table table-borderless table-sm"> <table class="table table-borderless table-sm">
<tbody> <tbody>
<?php <?php
while($row = mysqli_fetch_array($sql_asset_warranties_expiring)){ while($row = mysqli_fetch_array($sql_asset_warranties_expiring)){
$asset_id = $row['asset_id']; $asset_id = $row['asset_id'];
$asset_name = $row['asset_name']; $asset_name = $row['asset_name'];
$asset_warranty_expire = $row['asset_warranty_expire']; $asset_warranty_expire = $row['asset_warranty_expire'];
?> ?>
<tr> <tr>
<td><?php echo $asset_name; ?></td> <td><?php echo $asset_name; ?></td>
<td class="text-danger"><?php echo $asset_warranty_expire; ?></td> <td class="text-danger"><?php echo $asset_warranty_expire; ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</div>
</div> </div>
<?php } ?> <?php } ?>
<?php if(mysqli_num_rows($sql_tickets_stale) > 0){ ?> <?php if(mysqli_num_rows($sql_tickets_stale) > 0){ ?>
<!-- Stale Tickets --> <!-- Stale Tickets -->
<div class="col-5"> <div class="col-5">
<div class="card card-outline card-danger mb-3"> <div class="card card-outline card-danger mb-3">
<div class="card-body"> <div class="card-body">
<h5 class="card-title mb-2"><i class="fa fa-ticket-alt"></i> Stale Tickets <small class="text-secondary">(14d)</small></h5> <h5 class="card-title mb-2"><i class="fa fa-ticket-alt"></i> Stale Tickets <small class="text-secondary">(14d)</small></h5>
<table class="table table-borderless table-sm"> <table class="table table-borderless table-sm">
<tbody> <tbody>
<?php <?php
while($row = mysqli_fetch_array($sql_tickets_stale)){ while($row = mysqli_fetch_array($sql_tickets_stale)){
$ticket_id = $row['ticket_id']; $ticket_id = $row['ticket_id'];
$ticket_prefix = $row['ticket_prefix']; $ticket_prefix = $row['ticket_prefix'];
$ticket_number = $row['ticket_number']; $ticket_number = $row['ticket_number'];
$ticket_subject = $row['ticket_subject']; $ticket_subject = $row['ticket_subject'];
$ticket_created_at = $row['ticket_created_at']; $ticket_created_at = $row['ticket_created_at'];
?> ?>
<tr> <tr>
<td><?php echo "$ticket_prefix$ticket_number"; ?></td> <td><?php echo "$ticket_prefix$ticket_number"; ?></td>
<td><?php echo $ticket_subject; ?></td> <td><?php echo $ticket_subject; ?></td>
<td class="text-danger"><?php echo $ticket_created_at; ?></td> <td class="text-danger"><?php echo $ticket_created_at; ?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
</tbody> </tbody>
</table> </table>
</div>
</div> </div>
</div>
</div> </div>
<?php } ?> <?php } ?>
</div> </div>
<script>
function updateClientNotes(client_id) {
var notes = document.getElementById("clientNotes").value;
// Send a POST request to ajax.php as ajax.php with data client_set_notes=true, client_id=NUM, notes=NOTES
jQuery.post(
"ajax.php",
{
client_set_notes: 'TRUE',
client_id: client_id,
notes: notes
}
)
}
</script>