mirror of https://github.com/itflow-org/itflow
Feature: Contact Notes / Interactions - Create an Add Model and display cpontact notes under contact details
This commit is contained in:
parent
1766b95fc4
commit
724d4a347a
|
|
@ -0,0 +1,44 @@
|
|||
<div class="modal" id="createContactNoteModal<?php echo $contact_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-fw fa-sticky-note mr-2"></i>Creating note: <strong><?php echo $contact_name; ?></strong></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="contact_id" value="<?php echo $contact_id; ?>">
|
||||
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Type</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-comment"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="type">
|
||||
<option>Call</option>
|
||||
<option>Email</option>
|
||||
<option>Meeting</option>
|
||||
<option>In Person</option>
|
||||
<option>Note</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="6" name="note" placeholder="Notes, eg Personal tidbits to spark convo, temperment, etc"></textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_contact_note" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Create</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -94,6 +94,10 @@ if (isset($_GET['contact_id'])) {
|
|||
}
|
||||
$contact_tags_display = implode('', $contact_tag_name_display_array);
|
||||
|
||||
// Notes
|
||||
$sql_related_notes = mysqli_query($mysqli, "SELECT * FROM contact_notes LEFT JOIN users ON contact_note_created_by = user_id WHERE contact_note_contact_id = $contact_id ORDER BY contact_note_created_at DESC");
|
||||
$note_count = mysqli_num_rows($sql_related_notes);
|
||||
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
|
|
@ -614,6 +618,71 @@ if (isset($_GET['contact_id'])) {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card-dark <?php if ($note_count == 0) { echo "d-none"; } ?>">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title"><i class="fa fa-fw fa-sticky-note mr-2"></i>Notes</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover dataTables" style="width:100%">
|
||||
<thead class="text-dark">
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Note</th>
|
||||
<th>By</th>
|
||||
<th>Created</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_related_notes)) {
|
||||
$contact_note_id = intval($row['contact_note_id']);
|
||||
$contact_note_type = nullable_htmlentities($row['contact_note_type']);
|
||||
$contact_note = nullable_htmlentities($row['contact_note']);
|
||||
$note_by = nullable_htmlentities($row['user_name']);
|
||||
$contact_note_created_at = nullable_htmlentities($row['contact_note_created_at']);
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $contact_note_type; ?></td>
|
||||
<td><?php echo $contact_note; ?></td>
|
||||
<td><?php echo $note_by; ?></td>
|
||||
<td><?php echo $contact_note_created_at; ?></td>
|
||||
<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="#editContactNoteModal<?php echo $contact_note_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_contact_note=<?php echo $contact_note_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -382,6 +382,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<a class="dropdown-item" href="client_contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>">
|
||||
<i class="fas fa-fw fa-eye mr-2"></i>Details
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#createContactNoteModal<?php echo $contact_id; ?>">
|
||||
<i class="fas fa-fw fa-sticky-note mr-2"></i>Make Note
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editContactModal<?php echo $contact_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
|
|
@ -416,6 +419,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
|
||||
<?php
|
||||
|
||||
require "client_contact_create_note_modal.php";
|
||||
require "client_contact_edit_modal.php";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,6 +216,33 @@ if (isset($_POST['edit_contact'])) {
|
|||
|
||||
}
|
||||
|
||||
if (isset($_POST['add_contact_note'])) {
|
||||
|
||||
enforceUserPermission('module_client', 2);
|
||||
|
||||
$contact_id = intval($_POST['contact_id']);
|
||||
$type = sanitizeInput($_POST['type']);
|
||||
$note = sanitizeInput($_POST['note']);
|
||||
|
||||
// Get Contact details for logging and alerting
|
||||
$sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id FROM contacts WHERE contact_id = $contact_id");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$contact_name = sanitizeInput($row['contact_name']);
|
||||
$client_id = intval($row['contact_client_id']);
|
||||
|
||||
mysqli_query($mysqli, "INSERT INTO contact_notes SET contact_note_type = '$type', contact_note = '$note', contact_note_created_by = $session_user_id, contact_note_contact_id = $contact_id");
|
||||
|
||||
$contact_note_id = mysqli_insert_id($mysqli);
|
||||
|
||||
//Logging
|
||||
logAction("Contact", "Edit", "$session_name created a $type note for contact $contact_name", $client_id, $contact_id);
|
||||
|
||||
$_SESSION['alert_message'] = "Note <strong>$type</strong> created for <strong>$contact_name</strong>";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_POST['bulk_assign_contact_location'])) {
|
||||
|
||||
enforceUserPermission('module_client', 2);
|
||||
|
|
|
|||
Loading…
Reference in New Issue