mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-10 10:02:33 +03:00
Merge branch 'h3ct0r-develop' into develop
This commit is contained in:
commit
8118e9fd9b
4 changed files with 72 additions and 23 deletions
|
@ -402,15 +402,17 @@ class Backend_api extends CI_Controller {
|
||||||
$this->load->model('customers_model');
|
$this->load->model('customers_model');
|
||||||
|
|
||||||
$key = $this->db->escape_str($_POST['key']);
|
$key = $this->db->escape_str($_POST['key']);
|
||||||
|
$key = strtoupper($key);
|
||||||
|
|
||||||
$where_clause =
|
$where_clause =
|
||||||
'(first_name LIKE "%' . $key . '%" OR ' .
|
'(first_name LIKE upper("%' . $key . '%") OR ' .
|
||||||
'last_name LIKE "%' . $key . '%" OR ' .
|
'last_name LIKE upper("%' . $key . '%") OR ' .
|
||||||
'email LIKE "%' . $key . '%" OR ' .
|
'email LIKE upper("%' . $key . '%") OR ' .
|
||||||
'phone_number LIKE "%' . $key . '%" OR ' .
|
'phone_number LIKE upper("%' . $key . '%") OR ' .
|
||||||
'address LIKE "%' . $key . '%" OR ' .
|
'address LIKE upper("%' . $key . '%") OR ' .
|
||||||
'city LIKE "%' . $key . '%" OR ' .
|
'city LIKE upper("%' . $key . '%") OR ' .
|
||||||
'zip_code LIKE "%' . $key . '%")';
|
'zip_code LIKE upper("%' . $key . '%") OR ' .
|
||||||
|
'notes LIKE upper("%' . $key . '%"))';
|
||||||
|
|
||||||
$customers = $this->customers_model->get_batch($where_clause);
|
$customers = $this->customers_model->get_batch($where_clause);
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,7 @@
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal"
|
<button type="button" class="close" data-dismiss="modal"
|
||||||
aria-hidden="true">×</button>
|
aria-hidden="true">×</button>
|
||||||
|
@ -295,7 +296,9 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-push"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer footer">
|
<div class="modal-footer footer">
|
||||||
<button id="save-appointment" class="btn btn-primary">
|
<button id="save-appointment" class="btn btn-primary">
|
||||||
<?php echo $this->lang->line('save'); ?>
|
<?php echo $this->lang->line('save'); ?>
|
||||||
|
@ -305,7 +308,6 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -173,12 +173,14 @@ body .modal.full-screen .wrapper {
|
||||||
|
|
||||||
body .modal.full-screen .modal-footer {
|
body .modal.full-screen .modal-footer {
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 67px;
|
height: 67px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body .modal.full-screen .modal-push {
|
||||||
|
height: 67px;
|
||||||
|
}
|
||||||
|
|
||||||
body .jspDrag {
|
body .jspDrag {
|
||||||
background: #D3D3D3;
|
background: #D3D3D3;
|
||||||
}
|
}
|
||||||
|
|
|
@ -924,19 +924,62 @@ var BackendCalendar = {
|
||||||
* Event: Filter Existing Customers "Change"
|
* Event: Filter Existing Customers "Change"
|
||||||
*/
|
*/
|
||||||
$('#filter-existing-customers').keyup(function() {
|
$('#filter-existing-customers').keyup(function() {
|
||||||
var key = $(this).val().toLowerCase();
|
var key = $(this).val().toLowerCase(),
|
||||||
var $list = $('#existing-customers-list');
|
$list = $('#existing-customers-list'),
|
||||||
$list.empty();
|
postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_customers',
|
||||||
$.each(GlobalVariables.customers, function(index, c) {
|
postData = {
|
||||||
if (c.first_name.toLowerCase().indexOf(key) != -1
|
'csrfToken': GlobalVariables.csrfToken,
|
||||||
|| c.last_name.toLowerCase().indexOf(key) != -1
|
'key': key
|
||||||
|| c.email.toLowerCase().indexOf(key) != -1
|
};
|
||||||
|| c.phone_number.toLowerCase().indexOf(key) != -1
|
|
||||||
|| c.address.toLowerCase().indexOf(key) != -1
|
// Try to get the updated customer list.
|
||||||
|| c.city.toLowerCase().indexOf(key) != -1
|
$.ajax({
|
||||||
|| c.zip_code.toLowerCase().indexOf(key) != -1) {
|
type: 'POST',
|
||||||
$list.append('<div data-id="' + c.id + '">'
|
url: postUrl,
|
||||||
+ c.first_name + ' ' + c.last_name + '</div>');
|
data: postData,
|
||||||
|
dataType: 'json',
|
||||||
|
timeout: 1000,
|
||||||
|
global: false,
|
||||||
|
success: function(response) {
|
||||||
|
/////////////////////////////////////////////////////////////
|
||||||
|
// console.log('Filter Customers Appointment Response:', response);
|
||||||
|
/////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
$list.empty();
|
||||||
|
$.each(response, function(index, c) {
|
||||||
|
$list.append('<div data-id="' + c.id + '">'
|
||||||
|
+ c.first_name + ' ' + c.last_name + '</div>');
|
||||||
|
|
||||||
|
// Verify if this customer is on the old customer list.
|
||||||
|
var result = $.grep(GlobalVariables.customers,
|
||||||
|
function(e){ return e.id == c.id; });
|
||||||
|
|
||||||
|
// Add it to the customer list.
|
||||||
|
if(result.length == 0){
|
||||||
|
GlobalVariables.customers.push(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function(jqXHR, textStatus, errorThrown) {
|
||||||
|
//////////////////////////////////////////////////////////////////
|
||||||
|
// console.log('Filter Customers Appointment Error:', jqXHR, textStatus, errorThrown);
|
||||||
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// If there is any error on the request, search by the local client database.
|
||||||
|
$list.empty();
|
||||||
|
$.each(GlobalVariables.customers, function(index, c) {
|
||||||
|
if (c.first_name.toLowerCase().indexOf(key) != -1
|
||||||
|
|| c.last_name.toLowerCase().indexOf(key) != -1
|
||||||
|
|| c.email.toLowerCase().indexOf(key) != -1
|
||||||
|
|| c.phone_number.toLowerCase().indexOf(key) != -1
|
||||||
|
|| c.address.toLowerCase().indexOf(key) != -1
|
||||||
|
|| c.city.toLowerCase().indexOf(key) != -1
|
||||||
|
|| c.zip_code.toLowerCase().indexOf(key) != -1
|
||||||
|
|| c.notes.toLowerCase().indexOf(key) != -1) {
|
||||||
|
$list.append('<div data-id="' + c.id + '">'
|
||||||
|
+ c.first_name + ' ' + c.last_name + '</div>');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue