mirror of https://github.com/itflow-org/itflow
Moved edit client, notification, and create contact note to the new ajax system, also updated the notificaiton count to be more efficient
This commit is contained in:
parent
615604661c
commit
36e1df93bb
|
|
@ -0,0 +1,249 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$client_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_id = $client_id LIMIT 1");
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$client_name = nullable_htmlentities($row['client_name']);
|
||||
$client_is_lead = intval($row['client_lead']);
|
||||
$client_type = nullable_htmlentities($row['client_type']);
|
||||
$client_website = nullable_htmlentities($row['client_website']);
|
||||
$client_referral = nullable_htmlentities($row['client_referral']);
|
||||
$client_currency_code = nullable_htmlentities($row['client_currency_code']);
|
||||
$client_net_terms = intval($row['client_net_terms']);
|
||||
$client_tax_id_number = nullable_htmlentities($row['client_tax_id_number']);
|
||||
$client_abbreviation = nullable_htmlentities($row['client_abbreviation']);
|
||||
$client_rate = floatval($row['client_rate']);
|
||||
$client_notes = nullable_htmlentities($row['client_notes']);
|
||||
$client_created_at = nullable_htmlentities($row['client_created_at']);
|
||||
$client_archived_at = nullable_htmlentities($row['client_archived_at']);
|
||||
|
||||
// Client Tags
|
||||
$client_tag_id_array = array();
|
||||
$sql_client_tags = mysqli_query($mysqli, "SELECT * FROM client_tags LEFT JOIN tags ON client_tags.tag_id = tags.tag_id WHERE client_id = $client_id ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_client_tags)) {
|
||||
$client_tag_id = intval($row['tag_id']);
|
||||
$client_tag_id_array[] = $client_tag_id;
|
||||
}
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fa fa-fw fa-user-edit mr-2'></i>Editing Client: <strong>$client_name</strong>";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<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-client-details<?php echo $client_id; ?>">Details</a>
|
||||
</li>
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-client-billing<?php echo $client_id; ?>">Billing</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="pill" href="#pills-client-notes<?php echo $client_id; ?>">Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade show active" id="pills-client-details<?php echo $client_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Name <strong class="text-danger">*</strong> / <span class="text-secondary">Is Lead</span></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name or Company" maxlength="200"
|
||||
value="<?php echo $client_name; ?>" required>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="lead" value="1" <?php if($client_is_lead == 1){ echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Shortened Name</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-id-badge"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="abbreviation" placeholder="Shortned name for client - Max chars 6" value="<?php echo $client_abbreviation; ?>" maxlength="6" oninput="this.value = this.value.toUpperCase()">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Industry</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-briefcase"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="type" placeholder="Industry"
|
||||
value="<?php echo $client_type; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Referral</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>
|
||||
<select class="form-control select2" data-tags="true" name="referral">
|
||||
<option value="">- Select Referral -</option>
|
||||
<?php
|
||||
|
||||
$referral_sql = mysqli_query($mysqli, "SELECT * FROM categories WHERE category_type = 'Referral' AND (category_archived_at > '$client_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC");
|
||||
while ($row = mysqli_fetch_array($referral_sql)) {
|
||||
$referral = nullable_htmlentities($row['category_name']);
|
||||
?>
|
||||
<option <?php if ($client_referral == $referral) {
|
||||
echo "selected";
|
||||
} ?>>
|
||||
<?php echo $referral; ?>
|
||||
</option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Website</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-globe"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="website" placeholder="ex. google.com" maxlength="200"
|
||||
value="<?php echo $client_website; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Tags</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-tags"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="tags[]" data-placeholder="Add some tags" multiple>
|
||||
<?php
|
||||
|
||||
$sql_tags_select = mysqli_query($mysqli, "SELECT * FROM tags WHERE tag_type = 1 ORDER BY tag_name ASC");
|
||||
while ($row = mysqli_fetch_array($sql_tags_select)) {
|
||||
$tag_id_select = intval($row['tag_id']);
|
||||
$tag_name_select = nullable_htmlentities($row['tag_name']);
|
||||
?>
|
||||
<option value="<?php echo $tag_id_select; ?>" <?php if (in_array($tag_id_select, $client_tag_id_array)) { echo "selected"; } ?>><?php echo $tag_name_select; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ($config_module_enable_accounting) { ?>
|
||||
|
||||
<div class="tab-pane fade" id="pills-client-billing<?php echo $client_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Hourly Rate</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" inputmode="numeric"
|
||||
pattern="[0-9]*\.?[0-9]{0,2}" name="rate" placeholder="0.00"
|
||||
value="<?php echo number_format($client_rate, 2, '.', ''); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Currency <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-money-bill"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="currency_code" required>
|
||||
<option value="">- Currency -</option>
|
||||
<?php foreach ($currencies_array as $currency_code => $currency_name) { ?>
|
||||
<option <?php if ($client_currency_code == $currency_code) {
|
||||
echo "selected";
|
||||
} ?> value="<?php echo $currency_code; ?>">
|
||||
<?php echo "$currency_code - $currency_name"; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Invoice Net Terms</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-calendar"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="net_terms">
|
||||
<option value="">- Net Terms -</option>
|
||||
<?php foreach ($net_terms_array as $net_term_value => $net_term_name) { ?>
|
||||
<option <?php if ($net_term_value == $client_net_terms) {
|
||||
echo "selected";
|
||||
} ?> value="<?php echo $net_term_value; ?>">
|
||||
<?php echo $net_term_name; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Tax ID</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-balance-scale"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="tax_id_number" maxlength="255"
|
||||
placeholder="Tax ID Number" value="<?php echo $client_tax_id_number; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<div class="tab-pane fade" id="pills-client-notes<?php echo $client_id; ?>">
|
||||
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" rows="10" placeholder="Enter some notes"
|
||||
name="notes"><?php echo $client_notes; ?>
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="edit_client" class="btn btn-primary text-bold"><i class="fa fa-check mr-2"></i>Save</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fa fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$contact_id = intval($_GET['id']);
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT contact_name FROM contacts WHERE contact_id = $contact_id LIMIT 1");
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$contact_name = nullable_htmlentities($row['contact_name']);
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fa fa-fw fa-sticky-note mr-2'></i>Creating note: <strong>$contact_name</strong>";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<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">
|
||||
<?php foreach ($note_types_array as $note_type => $note_type_icon) { ?>
|
||||
<option><?php echo nullable_htmlentities($note_type); ?></option>
|
||||
<?php } ?>
|
||||
</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>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
|
||||
require_once '../includes/ajax_header.php';
|
||||
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM notifications
|
||||
WHERE notification_user_id = $session_user_id
|
||||
AND notification_dismissed_at IS NULL
|
||||
ORDER BY notification_id DESC LIMIT 8"
|
||||
);
|
||||
|
||||
$num_notifications = mysqli_num_rows($sql);
|
||||
|
||||
// Build the dynamic modal title
|
||||
$title = "<i class='fas fa-bell mr-2'></i>Notifications<span class='badge badge-secondary badge-pill px-3 ml-3'>$num_notifications<span>";
|
||||
|
||||
// Generate the HTML form content using output buffering.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="modal-body bg-white">
|
||||
<?php if ($num_notifications) { ?>
|
||||
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$notification_id = intval($row['notification_id']);
|
||||
$notification_type = nullable_htmlentities($row['notification_type']);
|
||||
$notification_details = nullable_htmlentities($row['notification']);
|
||||
$notification_action = nullable_htmlentities($row['notification_action']);
|
||||
$notification_timestamp_formated = date('M d g:ia',strtotime($row['notification_timestamp']));
|
||||
$notification_client_id = intval($row['notification_client_id']);
|
||||
if(empty($notification_action)) { $notification_action = "#"; }
|
||||
?>
|
||||
|
||||
|
||||
<a class="text-dark dropdown-item px-1" href="<?php echo $notification_action; ?>">
|
||||
<div>
|
||||
<span class="text-bold">
|
||||
<i class="fas fa-bullhorn mr-2"></i><?php echo $notification_type; ?>
|
||||
</span>
|
||||
<small class="text-muted float-right">
|
||||
<?php echo $notification_timestamp_formated; ?>
|
||||
</small>
|
||||
</div>
|
||||
<small class="text-secondary"><?php echo $notification_details; ?></small>
|
||||
</a>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
} else {
|
||||
?>
|
||||
<div class="text-center text-secondary py-5">
|
||||
<i class='far fa-6x fa-bell-slash'></i>
|
||||
<h3 class="mt-3">No Notifications</h3>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="modal-footer bg-white justify-content-end">
|
||||
<?php if ($num_notifications) { ?>
|
||||
<a href="post.php?dismiss_all_notifications&csrf_token=<?php echo $_SESSION['csrf_token'] ?>" class="btn btn-primary">
|
||||
<span class="text-white text-bold"><i class="fas fa-check mr-2"></i>Dismiss all</span>
|
||||
</a>
|
||||
<?php } else { ?>
|
||||
<a href="notifications_dismissed.php" class="btn btn-dark">
|
||||
<span class="text-white text-bold">See Dismissed Notifications</span>
|
||||
</a>
|
||||
<?php } ?>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal">
|
||||
<i class="fas fa-times mr-2"></i>Close
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require_once "../includes/ajax_footer.php";
|
||||
|
|
@ -216,8 +216,6 @@ if (isset($_GET['contact_id'])) {
|
|||
<?php } ?>
|
||||
<div class="mt-2"><i class="fa fa-fw fa-clock text-secondary mr-2"></i><?php echo date('Y-m-d', strtotime($contact_created_at)); ?></div>
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -254,8 +252,11 @@ if (isset($_GET['contact_id'])) {
|
|||
<i class="fa fa-fw fa-recycle mr-2"></i>New Recurring Ticket
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-dark" href="#" data-toggle="modal" data-target="#createContactNoteModal<?php echo $contact_id; ?>">
|
||||
<i class="fa fa-fw fa-sticky-note mr-2"></i>New Note
|
||||
<a class="dropdown-item text-dark" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_contact_note_create.php"
|
||||
data-ajax-id="<?php echo $contact_id; ?>">
|
||||
<i class="fas fa-fw fa-sticky-note mr-2"></i>New Note
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -420,7 +421,6 @@ if (isset($_GET['contact_id'])) {
|
|||
<?php
|
||||
|
||||
require "modals/client_asset_edit_modal.php";
|
||||
|
||||
require "modals/client_asset_copy_modal.php";
|
||||
|
||||
|
||||
|
|
@ -997,7 +997,10 @@ if (isset($_GET['contact_id'])) {
|
|||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-sticky-note mr-2"></i>Notes</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#createContactNoteModal<?php echo $contact_id; ?>">
|
||||
<button type="button" class="btn btn-primary"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_contact_note_create.php"
|
||||
data-ajax-id="<?php echo $contact_id; ?>">
|
||||
<i class="fas fa-plus mr-2"></i>New Note
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -1136,7 +1139,6 @@ if (isset($_GET['contact_id'])) {
|
|||
|
||||
<?php
|
||||
|
||||
require_once "modals/client_contact_create_note_modal.php";
|
||||
require_once "modals/ticket_add_modal.php";
|
||||
require_once "modals/client_contact_link_asset_modal.php";
|
||||
require_once "modals/client_contact_link_software_modal.php";
|
||||
|
|
|
|||
|
|
@ -380,7 +380,10 @@ $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; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_contact_note_create.php"
|
||||
data-ajax-id="<?php echo $contact_id; ?>">
|
||||
<i class="fas fa-fw fa-sticky-note mr-2"></i>Make Note
|
||||
</a>
|
||||
<a class="dropdown-item" href="#"
|
||||
|
|
@ -419,9 +422,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
require "modals/client_contact_create_note_modal.php";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -449,7 +449,10 @@ $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="#editClientModal<?php echo $client_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_client_edit.php"
|
||||
data-ajax-id="<?php echo $client_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
|
||||
|
|
@ -467,10 +470,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
require "modals/client_edit_modal.php";
|
||||
|
||||
|
||||
} ?>
|
||||
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ require_once "../check_login.php";
|
|||
header('Content-Type: application/json');
|
||||
|
||||
// Check for the 'id' parameter
|
||||
if (!isset($_GET['id'])) {
|
||||
echo json_encode(['error' => 'ID missing.']);
|
||||
exit;
|
||||
}
|
||||
//if (!isset($_GET['id'])) {
|
||||
// echo json_encode(['error' => 'ID missing.']);
|
||||
// exit;
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
require_once "modals/notifications_modal.php";
|
||||
require_once "inc_confirm_modal.php";
|
||||
?>
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,10 @@
|
|||
<i class="fas fa-fw fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editClientModal<?php echo $client_id; ?>">
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_client_edit.php"
|
||||
data-ajax-id="<?php echo $client_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit Client
|
||||
</a>
|
||||
<?php if (lookupUserPermission("module_client") >= 3) { ?>
|
||||
|
|
@ -167,8 +170,5 @@
|
|||
|
||||
<?php
|
||||
|
||||
require_once "modals/client_edit_modal.php";
|
||||
|
||||
require_once "modals/client_delete_modal.php";
|
||||
|
||||
require_once "modals/client_download_pdf_modal.php";
|
||||
|
|
|
|||
|
|
@ -62,13 +62,16 @@
|
|||
|
||||
<!-- New Notifications Dropdown -->
|
||||
<?php
|
||||
$sql_notifications = mysqli_query($mysqli, "SELECT * FROM notifications WHERE notification_user_id = $session_user_id AND notification_dismissed_at IS NULL ORDER BY notification_id DESC LIMIT 8");
|
||||
$num_notifications = mysqli_num_rows($sql_notifications);
|
||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('notification_id') AS num FROM notifications WHERE notification_user_id = $session_user_id AND notification_dismissed_at IS NULL"));
|
||||
$num_notifications = $row['num'];
|
||||
|
||||
?>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#notificationsModal" data-toggle="modal">
|
||||
<a class="nav-link" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
data-ajax-url="ajax/ajax_notifications.php"
|
||||
>
|
||||
<i class="fas fa-bell"></i>
|
||||
<?php if ($num_notifications) { ?>
|
||||
<span class="badge badge-light badge-pill navbar-badge position-absolute" style="top: 1px; right: 3px;">
|
||||
|
|
|
|||
|
|
@ -1,70 +0,0 @@
|
|||
<!-- Notifications Modal -->
|
||||
<div class="modal" id="notificationsModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<?php if ($num_notifications) { ?>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">
|
||||
<i class='fas fa-bell mr-2'></i>Notifications<span class="badge badge-secondary badge-pill px-3 ml-3"><?php echo $num_notifications; ?><span>
|
||||
</h5>
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="modal-body">
|
||||
<?php if ($num_notifications) { ?>
|
||||
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_array($sql_notifications)) {
|
||||
$notification_id = intval($row['notification_id']);
|
||||
$notification_type = nullable_htmlentities($row['notification_type']);
|
||||
$notification_details = nullable_htmlentities($row['notification']);
|
||||
$notification_action = nullable_htmlentities($row['notification_action']);
|
||||
$notification_timestamp_formated = date('M d g:ia',strtotime($row['notification_timestamp']));
|
||||
$notification_client_id = intval($row['notification_client_id']);
|
||||
if(empty($notification_action)) { $notification_action = "#"; }
|
||||
?>
|
||||
|
||||
|
||||
<a class="text-dark dropdown-item px-1" href="<?php echo $notification_action; ?>">
|
||||
<div>
|
||||
<span class="text-bold">
|
||||
<i class="fas fa-bullhorn mr-2"></i><?php echo $notification_type; ?>
|
||||
</span>
|
||||
<small class="text-muted float-right">
|
||||
<?php echo $notification_timestamp_formated; ?>
|
||||
</small>
|
||||
</div>
|
||||
<small class="text-secondary"><?php echo $notification_details; ?></small>
|
||||
</a>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
} else {
|
||||
?>
|
||||
<div class="text-center text-secondary py-5">
|
||||
<i class='far fa-6x fa-bell-slash'></i>
|
||||
<h3 class="mt-3">No Notifications</h3>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="modal-footer justify-content-end">
|
||||
<?php if ($num_notifications) { ?>
|
||||
<a href="post.php?dismiss_all_notifications&csrf_token=<?php echo $_SESSION['csrf_token'] ?>" class="btn btn-dark">
|
||||
<i class="fas fa-check mr-2"></i>Dismiss all
|
||||
</a>
|
||||
<?php } else { ?>
|
||||
<a href="notifications_dismissed.php" class="btn btn-dark">
|
||||
See Dismissed Notifications
|
||||
</a>
|
||||
<?php } ?>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal">
|
||||
<i class="fas fa-times mr-2"></i>Close
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue