mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-22 07:52:29 +03:00
Minor modifications to the pull request changes of backend_calendar.js
This commit is contained in:
parent
5161a8b4bb
commit
3495295211
1 changed files with 24 additions and 29 deletions
|
@ -842,8 +842,6 @@ var BackendCalendar = {
|
||||||
// Display modal form.
|
// Display modal form.
|
||||||
$dialog.find('.modal-header h3').text(EALang['new_appointment_title']);
|
$dialog.find('.modal-header h3').text(EALang['new_appointment_title']);
|
||||||
$dialog.modal('show');
|
$dialog.modal('show');
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -926,51 +924,48 @@ 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'),
|
||||||
|
postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_customers',
|
||||||
|
postData = {
|
||||||
|
'csrfToken': GlobalVariables.csrfToken,
|
||||||
|
'key': key
|
||||||
|
};
|
||||||
|
|
||||||
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_customers';
|
// Try to get the updated customer list.
|
||||||
var postData = {
|
|
||||||
'csrfToken': GlobalVariables.csrfToken,
|
|
||||||
'key': key
|
|
||||||
};
|
|
||||||
|
|
||||||
// Try to get the updated customer list
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
'type': 'POST',
|
type: 'POST',
|
||||||
'url': postUrl,
|
url: postUrl,
|
||||||
'data': postData,
|
data: postData,
|
||||||
'dataType': 'json',
|
dataType: 'json',
|
||||||
'timeout': 1000,
|
timeout: 1000,
|
||||||
'global': false,
|
global: false,
|
||||||
'success': function(response) {
|
success: function(response) {
|
||||||
/////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////
|
||||||
console.log('Filter Customers Appointment Response:', response);
|
// console.log('Filter Customers Appointment Response:', response);
|
||||||
/////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
$list.empty();
|
$list.empty();
|
||||||
$.each(response, function(index, c) {
|
$.each(response, function(index, c) {
|
||||||
$list.append('<div data-id="' + c.id + '">'
|
$list.append('<div data-id="' + c.id + '">'
|
||||||
+ c.first_name + ' ' + c.last_name + '</div>');
|
+ c.first_name + ' ' + c.last_name + '</div>');
|
||||||
|
|
||||||
// Verify if this customer is on the old customer list
|
// Verify if this customer is on the old customer list.
|
||||||
var result = $.grep(GlobalVariables.customers,
|
var result = $.grep(GlobalVariables.customers,
|
||||||
function(e){ return e.id == c.id; });
|
function(e){ return e.id == c.id; });
|
||||||
|
|
||||||
// Add it to the customer list
|
// Add it to the customer list.
|
||||||
if(result.length == 0){
|
if(result.length == 0){
|
||||||
GlobalVariables.customers.push(c);
|
GlobalVariables.customers.push(c);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
'error': function(jqXHR, textStatus, errorThrown) {
|
error: function(jqXHR, textStatus, errorThrown) {
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
console.log('Filter Customers Appointment Error:', jqXHR, textStatus,
|
// console.log('Filter Customers Appointment Error:', jqXHR, textStatus, errorThrown);
|
||||||
errorThrown);
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// If there is any error on the request, search by the local
|
// If there is any error on the request, search by the local client database.
|
||||||
// client database
|
|
||||||
$list.empty();
|
$list.empty();
|
||||||
$.each(GlobalVariables.customers, function(index, c) {
|
$.each(GlobalVariables.customers, function(index, c) {
|
||||||
if (c.first_name.toLowerCase().indexOf(key) != -1
|
if (c.first_name.toLowerCase().indexOf(key) != -1
|
||||||
|
|
Loading…
Reference in a new issue