Added pagination in backend pages for faster result loading (#496).

This commit is contained in:
Alex Tselegidis 2020-04-06 20:34:32 +02:00
parent 2d57022a63
commit 653007604f
39 changed files with 231 additions and 60 deletions

View file

@ -623,7 +623,7 @@ class Backend_api extends CI_Controller {
$key = $this->db->escape_str($this->input->post('key'));
$key = strtoupper($key);
$where_clause =
$where =
'(first_name LIKE upper("%' . $key . '%") OR ' .
'last_name LIKE upper("%' . $key . '%") OR ' .
'email LIKE upper("%' . $key . '%") OR ' .
@ -633,7 +633,16 @@ class Backend_api extends CI_Controller {
'zip_code LIKE upper("%' . $key . '%") OR ' .
'notes LIKE upper("%' . $key . '%"))';
$customers = $this->customers_model->get_batch($where_clause);
$order_by = 'first_name ASC, last_name ASC';
$limit = $this->input->post('limit');
if ($limit === NULL)
{
$limit = 1000;
}
$customers = $this->customers_model->get_batch($where, $order_by, $limit);
foreach ($customers as &$customer)
{

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,8 +313,10 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';
$lang['api_token_hint'] = 'Set a secret token in order to enable the token based authentication of the Easy!Appointments API.';
$lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -313,3 +313,4 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';

View file

@ -406,21 +406,28 @@ class Admins_Model extends CI_Model {
/**
* Get all, or specific admin records from database.
*
* @param string|array $where_clause (OPTIONAL) The WHERE clause of the query to be executed. Use this to get
* @param mixed|null $where (OPTIONAL) The WHERE clause of the query to be executed. Use this to get
* specific admin records.
*
* @param mixed|null $order_by
* @param int|null $limit
* @param int|null $offset
* @return array Returns an array with admin records.
*/
public function get_batch($where_clause = '')
public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL)
{
$role_id = $this->get_admin_role_id();
if ($where_clause != '')
if ($where !== NULL)
{
$this->db->where($where_clause);
$this->db->where($where);
}
$batch = $this->db->get_where('ea_users', ['id_roles' => $role_id])->result_array();
if ($order_by !== NULL)
{
$this->db->order_by($order_by);
}
$batch = $this->db->get_where('ea_users', ['id_roles' => $role_id], $limit, $offset)->result_array();
// Get every admin settings.
foreach ($batch as &$admin)

View file

@ -340,23 +340,32 @@ class Appointments_Model extends CI_Model {
/**
* Get all, or specific records from appointment's table.
*
* @example $this->Model->getBatch('id = ' . $recordId);
* Example:
*
* @param string $where_clause (OPTIONAL) The WHERE clause of the query to be executed. DO NOT INCLUDE 'WHERE'
* $this->Model->getBatch('id = ' . $recordId);
*
* @param mixed|null $where (OPTIONAL) The WHERE clause of the query to be executed. DO NOT INCLUDE 'WHERE'
* KEYWORD.
*
* @param mixed|null $order_by
* @param int|null $limit
* @param int|null $offset
* @param bool $aggregates (OPTIONAL) Defines whether to add aggregations or not.
*
* @return array Returns the rows from the database.
*/
public function get_batch($where_clause = '', $aggregates = FALSE)
public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL, $aggregates = FALSE)
{
if ($where_clause != '')
if ($where !== NULL)
{
$this->db->where($where_clause);
$this->db->where($where);
}
$appointments = $this->db->get('ea_appointments')->result_array();
if ($order_by)
{
$this->db->order_by($order_by);
}
$appointments = $this->db->get('ea_appointments', $limit, $offset)->result_array();
$this->load->model('timezones_model');

View file

@ -339,25 +339,33 @@ class Customers_Model extends CI_Model {
/**
* Get all, or specific records from appointment's table.
*
* @example $this->Model->getBatch('id = ' . $recordId);
* Example:
*
* @param string $whereClause (OPTIONAL) The WHERE clause of the query to be executed. DO NOT INCLUDE 'WHERE'
* KEYWORD.
* $this->Model->getBatch('id = ' . $recordId);
*
* @param mixed|null $where
* @param midex|null $order_by
* @param int|null $limit
* @param int|null $offset
* @return array Returns the rows from the database.
*/
public function get_batch($where_clause = '')
public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL)
{
$customers_role_id = $this->get_customers_role_id();
if ($where_clause != '')
if ($where !== NULL)
{
$this->db->where($where_clause);
$this->db->where($where);
}
if ($order_by !== NULL)
{
$this->db->order_by($order_by);
}
$this->db->where('id_roles', $customers_role_id);
return $this->db->get('ea_users')->result_array();
return $this->db->get('ea_users', $limit, $offset)->result_array();
}
/**

View file

@ -444,27 +444,34 @@ class Providers_Model extends CI_Model {
/**
* Get all, or specific records from provider's table.
*
* @example $this->Model->get_batch('id = ' . $recordId);
* Example:
*
* @param mixed $where_clause (OPTIONAL) The WHERE clause of the query to be executed.
* $this->Model->get_batch('id = ' . $recordId);
*
* NOTICE: DO NOT INCLUDE 'WHERE' KEYWORD.
*
* @param mixed|null $where (OPTIONAL) The WHERE clause of the query to be executed.
* @param mixed|null $order_by
* @param int|null $limit
* @param int|null $offset
* @return array Returns the rows from the database.
*/
public function get_batch($where_clause = '')
public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL)
{
// CI db class may confuse two where clauses made in the same time, so
// get the role id first and then apply the get_batch() where clause.
$role_id = $this->get_providers_role_id();
if ($where_clause != '')
if ($where !== NULL)
{
$this->db->where($where_clause);
$this->db->where($where);
}
$batch = $this->db->get_where('ea_users',
['id_roles' => $role_id])->result_array();
if ($order_by !== NULL)
{
$this->db->order_by($order_by);
}
$batch = $this->db->get('ea_users', ['id_roles' => $role_id], $limit, $offset)->result_array();
// Include each provider services and settings.
foreach ($batch as &$provider)

View file

@ -56,8 +56,7 @@ class Secretaries_Model extends CI_Model {
if ( ! isset($secretary['id']))
{
$secretary['id'] = $this->_insert($secretary);
}
else
} else
{
$secretary['id'] = $this->_update($secretary);
}
@ -261,7 +260,7 @@ class Secretaries_Model extends CI_Model {
}
}
// Validate calendar view mode.
// Validate calendar view mode.
if (isset($secretary['settings']['calendar_view']) && ($secretary['settings']['calendar_view'] !== CALENDAR_VIEW_DEFAULT
&& $secretary['settings']['calendar_view'] !== CALENDAR_VIEW_TABLE))
{
@ -403,22 +402,28 @@ class Secretaries_Model extends CI_Model {
/**
* Get all, or specific secretary records from database.
*
* @param string|array $where_clause (OPTIONAL) The WHERE clause of the query to be executed. Use this to get
* @param mixed|null $where (OPTIONAL) The WHERE clause of the query to be executed. Use this to get
* specific secretary records.
*
* @param mixed|null $order_by
* @param int|null $limit
* @param int|null $offset
* @return array Returns an array with secretary records.
*/
public function get_batch($where_clause = '')
public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL)
{
$role_id = $this->get_secretary_role_id();
if ($where_clause != '')
if ($where !== NULL)
{
$this->db->where($where_clause);
$this->db->where($where);
}
$this->db->where('id_roles', $role_id);
$batch = $this->db->get('ea_users')->result_array();
if ($order_by !== NULL)
{
$this->db->order_by($order_by);
}
$batch = $this->db->get_where('ea_users', ['id_roles' => $role_id], $limit, $offset)->result_array();
// Include every secretary providers.
foreach ($batch as &$secretary)

View file

@ -311,14 +311,19 @@ class Services_Model extends CI_Model {
*
* @return array Returns the rows from the database.
*/
public function get_batch($where_clause = NULL)
public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL)
{
if ($where_clause != NULL)
if ($where !== NULL)
{
$this->db->where($where_clause);
$this->db->where($where);
}
return $this->db->get('ea_services')->result_array();
if ($order_by !== NULL)
{
$this->db->order_by($order_by);
}
return $this->db->get('ea_services', $limit, $offset)->result_array();
}
/**
@ -430,13 +435,19 @@ class Services_Model extends CI_Model {
*
* @return array Returns an array that contains all the service category records.
*/
public function get_all_categories($where = '')
public function get_all_categories($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL)
{
if ($where !== '')
if ($where !== NULL)
{
$this->db->where($where);
}
return $this->db->get('ea_service_categories')->result_array();
if ($order_by !== NULL)
{
$this->db->order_by($order_by);
}
return $this->db->get('ea_service_categories', $limit, $offset)->result_array();
}
/**

View file

@ -40,7 +40,12 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
* When the user clicks the reload button an the calendar items need to be refreshed.
*/
$('#reload-appointments').click(function () {
$('#select-filter-item').trigger('change');
_refreshCalendarAppointments(
$calendar,
$selectFilterItem.val(),
$selectFilterItem.find('option:selected').attr('type'),
$calendar.fullCalendar('getView').start,
$calendar.fullCalendar('getView').end);
});
/**
@ -846,6 +851,9 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
filter_type: filterType
};
$loading.css('visibility', 'hidden');
return $.post(url, data, function (response) {
if (!GeneralFunctions.handleAjaxExceptions(response)) {
return;
@ -1184,7 +1192,11 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
}
});
}
}, 'json').fail(GeneralFunctions.ajaxFailureHandler);
}, 'json')
.fail(GeneralFunctions.ajaxFailureHandler)
.always(function() {
$loading.css('visibility', '')
});
}
@ -1465,16 +1477,12 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
var $selectFilterItem = $('#select-filter-item');
setInterval(function () {
$loading.css('visibility', 'hidden');
_refreshCalendarAppointments(
$calendar,
$selectFilterItem.val(),
$selectFilterItem.find('option:selected').attr('type'),
$calendar.fullCalendar('getView').start,
$calendar.fullCalendar('getView').end)
.always(function () {
$loading.css('visibility', '')
});
$calendar.fullCalendar('getView').end);
}, 10000);
};

View file

@ -23,6 +23,7 @@
*/
function CategoriesHelper() {
this.filterResults = {};
this.filterLimit = 20;
}
/**
@ -171,7 +172,8 @@
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_service_categories';
var postData = {
csrfToken: GlobalVariables.csrfToken,
key: key
key: key,
limit: this.filterLimit
};
$.post(postUrl, postData, function (response) {
@ -189,6 +191,17 @@
if (response.length === 0) {
$('#filter-categories .results').html('<em>' + EALang.no_records_found + '</em>');
} else if (response.length === this.filterLimit) {
$('<button/>', {
'type': 'button',
'class': 'well btn-block load-more text-center',
'text': EALang.load_more,
'click': function () {
this.filterLimit += 20;
this.filter(key, selectId, display);
}.bind(this)
})
.appendTo('#filter-categories .results');
}
if (selectId !== undefined) {

View file

@ -22,6 +22,7 @@
*/
function CustomersHelper() {
this.filterResults = {};
this.filterLimit = 20;
}
/**
@ -36,6 +37,7 @@
$('#filter-customers form').submit(function (event) {
var key = $('#filter-customers .key').val();
$('#filter-customers .selected').removeClass('selected');
instance.filterLimit = 20;
instance.resetForm();
instance.filter(key);
return false;
@ -46,6 +48,7 @@
*/
$('#filter-customers .clear').click(function () {
$('#filter-customers .key').val('');
instance.filterLimit = 20;
instance.filter('');
instance.resetForm();
});
@ -355,7 +358,8 @@
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_customers';
var postData = {
csrfToken: GlobalVariables.csrfToken,
key: key
key: key,
limit: this.filterLimit
};
$.post(postUrl, postData, function (response) {
@ -370,8 +374,20 @@
var html = this.getFilterHtml(customer);
$('#filter-customers .results').append(html);
}.bind(this));
if (response.length == 0) {
$('#filter-customers .results').html('<em>' + EALang.no_records_found + '</em>');
} else if (response.length === this.filterLimit) {
$('<button/>', {
'type': 'button',
'class': 'well btn-block load-more text-center',
'text': EALang.load_more,
'click': function () {
this.filterLimit += 20;
this.filter(key, selectId, display);
}.bind(this)
})
.appendTo('#filter-customers .results');
}
if (selectId != undefined) {

View file

@ -22,6 +22,7 @@
*/
function ServicesHelper() {
this.filterResults = {};
this.filterLimit = 20;
}
ServicesHelper.prototype.bindEventHandlers = function () {
@ -311,7 +312,8 @@
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_services';
var postData = {
csrfToken: GlobalVariables.csrfToken,
key: key
key: key,
limit: this.filterLimit
};
$.post(postUrl, postData, function (response) {
@ -329,6 +331,17 @@
if (response.length === 0) {
$('#filter-services .results').html('<em>' + EALang.no_records_found + '</em>');
} else if (response.length === this.filterLimit) {
$('<button/>', {
'type': 'button',
'class': 'well btn-block load-more text-center',
'text': EALang.load_more,
'click': function () {
this.filterLimit += 20;
this.filter(key, selectId, display);
}.bind(this)
})
.appendTo('#filter-services .results');
}
if (selectId !== undefined) {

View file

@ -22,6 +22,7 @@
*/
var AdminsHelper = function () {
this.filterResults = []; // Store the results for later use.
this.filterLimit = 20;
};
/**
@ -351,7 +352,8 @@
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_admins';
var postData = {
csrfToken: GlobalVariables.csrfToken,
key: key
key: key,
limit: this.filterLimit
};
$.post(postUrl, postData, function (response) {
@ -369,6 +371,17 @@
if (response.length == 0) {
$('#filter-admins .results').html('<em>' + EALang.no_records_found + '</em>')
} else if (response.length === this.filterLimit) {
$('<button/>', {
'type': 'button',
'class': 'well btn-block load-more text-center',
'text': EALang.load_more,
'click': function () {
this.filterLimit += 20;
this.filter(key, selectId, display);
}.bind(this)
})
.appendTo('#filter-admins .results');
}
if (selectId != undefined) {

View file

@ -24,6 +24,7 @@
*/
var ProvidersHelper = function () {
this.filterResults = {}; // Store the results for later use.
this.filterLimit = 20;
};
/**
@ -450,7 +451,8 @@
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_providers';
var postData = {
csrfToken: GlobalVariables.csrfToken,
key: key
key: key,
limit: this.filterLimit
};
$.post(postUrl, postData, function (response) {
@ -468,6 +470,17 @@
if (response.length == 0) {
$('#filter-providers .results').html('<em>' + EALang.no_records_found + '</em>')
} else if (response.length === this.filterLimit) {
$('<button/>', {
'type': 'button',
'class': 'well btn-block load-more text-center',
'text': EALang.load_more,
'click': function () {
this.filterLimit += 20;
this.filter(key, selectId, display);
}.bind(this)
})
.appendTo('#filter-providers .results');
}
if (selectId != undefined) {

View file

@ -24,6 +24,7 @@
*/
var SecretariesHelper = function () {
this.filterResults = {}; // Store the results for later use.
this.filterLimit = 20;
};
/**
@ -375,7 +376,8 @@
var postUrl = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_filter_secretaries';
var postData = {
csrfToken: GlobalVariables.csrfToken,
key: key
key: key,
limit: this.filterLimit
};
$.post(postUrl, postData, function (response) {
@ -393,6 +395,17 @@
if (response.length == 0) {
$('#filter-secretaries .results').html('<em>' + EALang.no_records_found + '</em>')
} else if (response.length === this.filterLimit) {
$('<button/>', {
'type': 'button',
'class': 'well btn-block load-more text-center',
'text': EALang.load_more,
'click': function () {
this.filterLimit += 20;
this.filter(key, selectId, display);
}.bind(this)
})
.appendTo('#filter-secretaries .results');
}
if (selectId != undefined) {