From 1c4ab83d32796e2f4e07aafc936e2bb85bb6c1d3 Mon Sep 17 00:00:00 2001 From: h3ct0r Date: Thu, 10 Mar 2016 12:55:00 -0300 Subject: [PATCH 1/5] Fixed css bug; Added support for case insensitive search for clients and search by notes too! --- src/application/controllers/backend_api.php | 16 +++++++++------- src/application/views/backend/calendar.php | 17 ++++++++--------- src/assets/css/backend.css | 4 ++-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/application/controllers/backend_api.php b/src/application/controllers/backend_api.php index f793d9ea..304745b9 100644 --- a/src/application/controllers/backend_api.php +++ b/src/application/controllers/backend_api.php @@ -410,15 +410,17 @@ class Backend_api extends CI_Controller { $this->load->model('customers_model'); $key = $this->db->escape_str($_POST['key']); + $key = strtoupper($key); $where_clause = - '(first_name LIKE "%' . $key . '%" OR ' . - 'last_name LIKE "%' . $key . '%" OR ' . - 'email LIKE "%' . $key . '%" OR ' . - 'phone_number LIKE "%' . $key . '%" OR ' . - 'address LIKE "%' . $key . '%" OR ' . - 'city LIKE "%' . $key . '%" OR ' . - 'zip_code LIKE "%' . $key . '%")'; + '(first_name LIKE upper("%' . $key . '%") OR ' . + 'last_name LIKE upper("%' . $key . '%") OR ' . + 'email LIKE upper("%' . $key . '%") OR ' . + 'phone_number LIKE upper("%' . $key . '%") OR ' . + 'address LIKE upper("%' . $key . '%") OR ' . + 'city LIKE upper("%' . $key . '%") OR ' . + 'zip_code LIKE upper("%' . $key . '%") OR ' . + 'notes LIKE upper("%' . $key . '%"))'; $customers = $this->customers_model->get_batch($where_clause); diff --git a/src/application/views/backend/calendar.php b/src/application/views/backend/calendar.php index 3c816b20..9cf6634e 100644 --- a/src/application/views/backend/calendar.php +++ b/src/application/views/backend/calendar.php @@ -294,15 +294,14 @@ - - - diff --git a/src/assets/css/backend.css b/src/assets/css/backend.css index 67cde975..3387f5e8 100644 --- a/src/assets/css/backend.css +++ b/src/assets/css/backend.css @@ -168,12 +168,12 @@ body .modal.full-screen .modal-content { body .modal.full-screen .wrapper { min-height: 100%; - margin-bottom: -67px; /* modal-footer height */ + /*margin-bottom: -67px;*/ /* modal-footer height */ } body .modal.full-screen .modal-footer { background-color: #f5f5f5; - position: absolute; + /*position: absolute;*/ bottom: 0; width: 100%; height: 67px; From 2eb63a21d1cb7d0ce5bb82ab566c5abe27f9f687 Mon Sep 17 00:00:00 2001 From: h3ct0r Date: Thu, 10 Mar 2016 15:45:17 -0300 Subject: [PATCH 2/5] Appointment modal in backend now search clients using the ajax filter. This allow using the most recent clients without refreshing the main page. --- src/assets/js/backend_calendar.js | 97 +++++++++++++++++++++++++++---- 1 file changed, 86 insertions(+), 11 deletions(-) diff --git a/src/assets/js/backend_calendar.js b/src/assets/js/backend_calendar.js index a042c97d..72491fd8 100644 --- a/src/assets/js/backend_calendar.js +++ b/src/assets/js/backend_calendar.js @@ -842,6 +842,8 @@ var BackendCalendar = { // Display modal form. $dialog.find('.modal-header h3').text(EALang['new_appointment_title']); $dialog.modal('show'); + + }); /** @@ -926,17 +928,90 @@ var BackendCalendar = { $('#filter-existing-customers').keyup(function() { var key = $(this).val().toLowerCase(); var $list = $('#existing-customers-list'); - $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) { - $list.append('
' - + c.first_name + ' ' + c.last_name + '
'); + + var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_customers'; + var postData = { + 'csrfToken': GlobalVariables.csrfToken, + 'key': key + }; + + // $.post(postUrl, postData, function(response) { + // /////////////////////////////////////////////////////// + // console.log('Filter Customers Response:', response); + // /////////////////////////////////////////////////////// + + // if (!GeneralFunctions.handleAjaxExceptions(response)) return; + + // BackendCustomers.helper.filterResults = response; + + // $('#filter-customers .results').data('jsp').destroy(); + // $('#filter-customers .results').html(''); + // $.each(response, function(index, customer) { + // var html = BackendCustomers.helper.getFilterHtml(customer); + // $('#filter-customers .results').append(html); + // }); + // $('#filter-customers .results').jScrollPane({ mouseWheelSpeed: 70 }); + + // if (response.length == 0) { + // $('#filter-customers .results').html('' + EALang['no_records_found'] + ''); + // } + + // if (selectId != undefined) { + // BackendCustomers.helper.select(selectId, display); + // } + + // }, 'json').fail(GeneralFunctions.ajaxFailureHandler); + + // Try to get the updated customer list + $.ajax({ + 'type': 'POST', + 'url': postUrl, + '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('
' + + c.first_name + ' ' + c.last_name + '
'); + + // 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('
' + + c.first_name + ' ' + c.last_name + '
'); + } + }); } }); }); From d6c4e4cf755636ac3e656b8a65de758d70c7228f Mon Sep 17 00:00:00 2001 From: h3ct0r Date: Thu, 10 Mar 2016 15:47:22 -0300 Subject: [PATCH 3/5] Removed comments on js file --- src/assets/js/backend_calendar.js | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/src/assets/js/backend_calendar.js b/src/assets/js/backend_calendar.js index 72491fd8..b411898a 100644 --- a/src/assets/js/backend_calendar.js +++ b/src/assets/js/backend_calendar.js @@ -935,33 +935,6 @@ var BackendCalendar = { 'key': key }; - // $.post(postUrl, postData, function(response) { - // /////////////////////////////////////////////////////// - // console.log('Filter Customers Response:', response); - // /////////////////////////////////////////////////////// - - // if (!GeneralFunctions.handleAjaxExceptions(response)) return; - - // BackendCustomers.helper.filterResults = response; - - // $('#filter-customers .results').data('jsp').destroy(); - // $('#filter-customers .results').html(''); - // $.each(response, function(index, customer) { - // var html = BackendCustomers.helper.getFilterHtml(customer); - // $('#filter-customers .results').append(html); - // }); - // $('#filter-customers .results').jScrollPane({ mouseWheelSpeed: 70 }); - - // if (response.length == 0) { - // $('#filter-customers .results').html('' + EALang['no_records_found'] + ''); - // } - - // if (selectId != undefined) { - // BackendCustomers.helper.select(selectId, display); - // } - - // }, 'json').fail(GeneralFunctions.ajaxFailureHandler); - // Try to get the updated customer list $.ajax({ 'type': 'POST', From 5161a8b4bbdc0c08707d421ededb253c53f3fcf5 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Tue, 22 Mar 2016 22:36:48 +0100 Subject: [PATCH 4/5] Corrected the sticky footer issue. --- src/application/views/backend/calendar.php | 21 ++++++++++++--------- src/assets/css/backend.css | 8 +++++--- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/application/views/backend/calendar.php b/src/application/views/backend/calendar.php index 9cf6634e..9b80e0b1 100644 --- a/src/application/views/backend/calendar.php +++ b/src/application/views/backend/calendar.php @@ -101,6 +101,7 @@ diff --git a/src/assets/css/backend.css b/src/assets/css/backend.css index 3387f5e8..472f5225 100644 --- a/src/assets/css/backend.css +++ b/src/assets/css/backend.css @@ -168,17 +168,19 @@ body .modal.full-screen .modal-content { body .modal.full-screen .wrapper { min-height: 100%; - /*margin-bottom: -67px;*/ /* modal-footer height */ + margin-bottom: -67px; /* modal-footer height */ } body .modal.full-screen .modal-footer { background-color: #f5f5f5; - /*position: absolute;*/ - bottom: 0; width: 100%; height: 67px; } +body .modal.full-screen .modal-push { + height: 67px; +} + body .jspDrag { background: #D3D3D3; } From 3495295211d8e05c6927878bd9a1d8194e080484 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Tue, 22 Mar 2016 22:45:02 +0100 Subject: [PATCH 5/5] Minor modifications to the pull request changes of backend_calendar.js --- src/assets/js/backend_calendar.js | 53 ++++++++++++++----------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/src/assets/js/backend_calendar.js b/src/assets/js/backend_calendar.js index b411898a..77637477 100644 --- a/src/assets/js/backend_calendar.js +++ b/src/assets/js/backend_calendar.js @@ -842,8 +842,6 @@ var BackendCalendar = { // Display modal form. $dialog.find('.modal-header h3').text(EALang['new_appointment_title']); $dialog.modal('show'); - - }); /** @@ -926,51 +924,48 @@ var BackendCalendar = { * Event: Filter Existing Customers "Change" */ $('#filter-existing-customers').keyup(function() { - var key = $(this).val().toLowerCase(); - var $list = $('#existing-customers-list'); + var key = $(this).val().toLowerCase(), + $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'; - var postData = { - 'csrfToken': GlobalVariables.csrfToken, - 'key': key - }; - - // Try to get the updated customer list + // Try to get the updated customer list. $.ajax({ - 'type': 'POST', - 'url': postUrl, - 'data': postData, - 'dataType': 'json', - 'timeout': 1000, - 'global': false, - 'success': function(response) { + type: 'POST', + url: postUrl, + data: postData, + dataType: 'json', + timeout: 1000, + global: false, + success: function(response) { ///////////////////////////////////////////////////////////// - console.log('Filter Customers Appointment Response:', response); + // console.log('Filter Customers Appointment Response:', response); ///////////////////////////////////////////////////////////// $list.empty(); $.each(response, function(index, c) { $list.append('
' - + c.first_name + ' ' + c.last_name + '
'); + + c.first_name + ' ' + c.last_name + ''); - // Verify if this customer is on the old customer list - var result = $.grep(GlobalVariables.customers, - function(e){ return e.id == c.id; }); + // 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 + // Add it to the customer list. if(result.length == 0){ GlobalVariables.customers.push(c); } }); }, - 'error': function(jqXHR, textStatus, errorThrown) { + error: function(jqXHR, textStatus, errorThrown) { ////////////////////////////////////////////////////////////////// - console.log('Filter Customers Appointment Error:', 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 + // 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