easyappointments/assets/js/http/business_settings_http_client.js

54 lines
1.4 KiB
JavaScript
Raw Normal View History

/* ----------------------------------------------------------------------------
* Easy!Appointments - Open Source Web 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
* ---------------------------------------------------------------------------- */
App.Http.BusinessSettings = (function () {
/**
* Save business settings.
*
* @param {Object} businessSettings
*
* @return {Object}
*/
function save(businessSettings) {
const url = App.Utils.Url.siteUrl('business_settings/save');
const data = {
csrf_token: App.Vars.csrf_token,
business_settings: businessSettings
};
return $.post(url, data);
}
/**
* Apply global working plan.
*
* @param {Object} workingPlan
*
* @return {Object}
*/
function applyGlobalWorkingPlan(workingPlan) {
const url = App.Utils.Url.siteUrl('business_settings/apply_global_working_plan');
const data = {
csrf_token: App.Vars.csrf_token,
working_plan: JSON.stringify(workingPlan)
};
return $.post(url, data);
}
return {
save,
applyGlobalWorkingPlan
};
})();