easyappointments/assets/js/http/customers_search_http_clien...

46 lines
1.2 KiB
JavaScript
Executable File

/* ----------------------------------------------------------------------------
* Easy!Appointments - Online Appointment Scheduler
*
* @package EasyAppointments
* @author A.Tselegidis <alextselegidis@gmail.com>
* @copyright Copyright (c) Alex Tselegidis
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
* @link https://easyappointments.org
* @since v1.5.0
* ---------------------------------------------------------------------------- */
/**
* Customers HTTP client.
*
* This module implements the customers related HTTP requests.
*/
App.Http.Customers = (function () {
/**
* Search customers by keyword.
*
* @param {String} keyword
* @param {Number} [limit]
* @param {Number} [offset]
* @param {String} [orderBy]
*
* @return {Object}
*/
function search(keyword, limit = null, offset = null, orderBy = null) {
const url = App.Utils.Url.siteUrl('customers/search');
const data = {
csrf_token: vars('csrf_token'),
keyword,
limit,
offset,
order_by: orderBy,
};
return $.post(url, data);
}
return {
search,
};
})();