mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 19:04:52 +00:00
Flag duplicate clients/leads when using the client_add modal
This commit is contained in:
@@ -55,13 +55,16 @@ ob_start();
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="name" placeholder="Name or Company" maxlength="200" required autofocus>
|
||||
<input type="text" class="form-control" name="name" id="client_name" placeholder="Name or Company" maxlength="200" onfocusout="client_duplicate_check()" required autofocus>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<input type="checkbox" name="lead" value="1" <?php if($leads_filter == 1){ echo "checked"; } ?>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<span class="text-info" id="client_duplicate_info"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -392,5 +395,22 @@ ob_start();
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// Checks for duplicate clients
|
||||
function client_duplicate_check() {
|
||||
var name = document.getElementById("client_name").value;
|
||||
//Send a GET request to ajax.php as ajax.php?client_duplicate_check=true&name=NAME
|
||||
jQuery.get(
|
||||
"ajax.php",
|
||||
{client_duplicate_check: 'true', name: name},
|
||||
function(data) {
|
||||
//If we get a response from ajax.php, parse it as JSON
|
||||
const client_duplicate_data = JSON.parse(data);
|
||||
document.getElementById("client_duplicate_info").innerHTML = client_duplicate_data.message;
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require_once '../../../includes/modal_footer.php';
|
||||
|
||||
Reference in New Issue
Block a user