diff --git a/assets/js/http/admins_http_client.js b/assets/js/http/admins_http_client.js index 730af35b..3009b171 100644 --- a/assets/js/http/admins_http_client.js +++ b/assets/js/http/admins_http_client.js @@ -10,5 +10,107 @@ * ---------------------------------------------------------------------------- */ window.App.Http.Admins = (function () { - return {}; + /** + * Create an admin. + * + * @param {Object} admin + * + * @return {jQuery.Deferred} + */ + function create(admin) { + const url = App.Utils.Url.siteUrl('admins/create'); + + const data = { + csrf_token: App.Config.csrf_token, + admin: admin + }; + + return $.post(url, data); + } + + /** + * Update an admin. + * + * @param {Object} admin + * + * @return {jQuery.Deferred} + */ + function update(admin) { + const url = App.Utils.Url.siteUrl('admins/update'); + + const data = { + csrf_token: App.Config.csrf_token, + admin: admin + }; + + return $.post(url, data); + } + + /** + * Delete an admin. + * + * @param {Number} adminId + * + * @return {jQuery.Deferred} + */ + function destroy(adminId) { + const url = App.Utils.Url.siteUrl('admins/destroy'); + + const data = { + csrf_token: App.Config.csrf_token, + admin_id: adminId + }; + + return $.post(url, data); + } + + /** + * Search admins by keyword. + * + * @param {String} keyword + * @param {Number} limit + * @param {Number} offset + * @param {String} orderBy + * + * @return {jQuery.Deferred} + */ + function search(keyword, limit, offset, orderBy) { + const url = App.Utils.Url.siteUrl('admins/search'); + + const data = { + csrf_token: App.Config.csrf_token, + keyword, + limit, + offset, + order_by: orderBy + }; + + return $.post(url, data); + } + + /** + * Find an admin. + * + * @param {Number} adminId + * + * @return {jQuery.Deferred} + */ + function find(adminId) { + const url = App.Utils.Url.siteUrl('admins/find'); + + const data = { + csrf_token: App.Config.csrf_token, + admin_id: adminId + }; + + return $.post(url, data); + } + + return { + create, + update, + destroy, + search, + find + }; })(); diff --git a/assets/js/http/appointments_http_client.js b/assets/js/http/appointments_http_client.js index 0187d4e4..0a650447 100644 --- a/assets/js/http/appointments_http_client.js +++ b/assets/js/http/appointments_http_client.js @@ -10,5 +10,107 @@ * ---------------------------------------------------------------------------- */ window.App.Http.Appointments = (function () { - return {}; + /** + * Create an appointment. + * + * @param {Object} appointment + * + * @return {jQuery.Deferred} + */ + function create(appointment) { + const url = App.Utils.Url.siteUrl('appointments/create'); + + const data = { + csrf_token: App.Config.csrf_token, + appointment: appointment + }; + + return $.post(url, data); + } + + /** + * Update an appointment. + * + * @param {Object} appointment + * + * @return {jQuery.Deferred} + */ + function update(appointment) { + const url = App.Utils.Url.siteUrl('appointments/update'); + + const data = { + csrf_token: App.Config.csrf_token, + appointment: appointment + }; + + return $.post(url, data); + } + + /** + * Delete an appointment. + * + * @param {Number} appointmentId + * + * @return {jQuery.Deferred} + */ + function destroy(appointmentId) { + const url = App.Utils.Url.siteUrl('appointments/destroy'); + + const data = { + csrf_token: App.Config.csrf_token, + appointment_id: appointmentId + }; + + return $.post(url, data); + } + + /** + * Search appointments by keyword. + * + * @param {String} keyword + * @param {Number} limit + * @param {Number} offset + * @param {String} orderBy + * + * @return {jQuery.Deferred} + */ + function search(keyword, limit, offset, orderBy) { + const url = App.Utils.Url.siteUrl('appointments/search'); + + const data = { + csrf_token: App.Config.csrf_token, + keyword, + limit, + offset, + order_by: orderBy + }; + + return $.post(url, data); + } + + /** + * Find an appointment. + * + * @param {Number} appointmentId + * + * @return {jQuery.Deferred} + */ + function find(appointmentId) { + const url = App.Utils.Url.siteUrl('appointments/find'); + + const data = { + csrf_token: App.Config.csrf_token, + appointment_id: appointmentId + }; + + return $.post(url, data); + } + + return { + create, + update, + destroy, + search, + find + }; })(); diff --git a/assets/js/http/categories_http_client.js b/assets/js/http/categories_http_client.js index 85f41d03..db3f4b9e 100644 --- a/assets/js/http/categories_http_client.js +++ b/assets/js/http/categories_http_client.js @@ -10,5 +10,107 @@ * ---------------------------------------------------------------------------- */ window.App.Http.Categories = (function () { - return {}; + /** + * Create an category. + * + * @param {Object} category + * + * @return {jQuery.Deferred} + */ + function create(category) { + const url = App.Utils.Url.siteUrl('categories/create'); + + const data = { + csrf_token: App.Config.csrf_token, + category: category + }; + + return $.post(url, data); + } + + /** + * Update an category. + * + * @param {Object} category + * + * @return {jQuery.Deferred} + */ + function update(category) { + const url = App.Utils.Url.siteUrl('categories/update'); + + const data = { + csrf_token: App.Config.csrf_token, + category: category + }; + + return $.post(url, data); + } + + /** + * Delete an category. + * + * @param {Number} categoryId + * + * @return {jQuery.Deferred} + */ + function destroy(categoryId) { + const url = App.Utils.Url.siteUrl('categories/destroy'); + + const data = { + csrf_token: App.Config.csrf_token, + category_id: categoryId + }; + + return $.post(url, data); + } + + /** + * Search categories by keyword. + * + * @param {String} keyword + * @param {Number} limit + * @param {Number} offset + * @param {String} orderBy + * + * @return {jQuery.Deferred} + */ + function search(keyword, limit, offset, orderBy) { + const url = App.Utils.Url.siteUrl('categories/search'); + + const data = { + csrf_token: App.Config.csrf_token, + keyword, + limit, + offset, + order_by: orderBy + }; + + return $.post(url, data); + } + + /** + * Find an category. + * + * @param {Number} categoryId + * + * @return {jQuery.Deferred} + */ + function find(categoryId) { + const url = App.Utils.Url.siteUrl('categories/find'); + + const data = { + csrf_token: App.Config.csrf_token, + category_id: categoryId + }; + + return $.post(url, data); + } + + return { + create, + update, + destroy, + search, + find + }; })(); diff --git a/assets/js/http/customers_http_client.js b/assets/js/http/customers_http_client.js index c7e194ca..3feeeb1b 100644 --- a/assets/js/http/customers_http_client.js +++ b/assets/js/http/customers_http_client.js @@ -10,5 +10,107 @@ * ---------------------------------------------------------------------------- */ window.App.Http.Customers = (function () { - return {}; + /** + * Create an customer. + * + * @param {Object} customer + * + * @return {jQuery.Deferred} + */ + function create(customer) { + const url = App.Utils.Url.siteUrl('customers/create'); + + const data = { + csrf_token: App.Config.csrf_token, + customer: customer + }; + + return $.post(url, data); + } + + /** + * Update an customer. + * + * @param {Object} customer + * + * @return {jQuery.Deferred} + */ + function update(customer) { + const url = App.Utils.Url.siteUrl('customers/update'); + + const data = { + csrf_token: App.Config.csrf_token, + customer: customer + }; + + return $.post(url, data); + } + + /** + * Delete an customer. + * + * @param {Number} customerId + * + * @return {jQuery.Deferred} + */ + function destroy(customerId) { + const url = App.Utils.Url.siteUrl('customers/destroy'); + + const data = { + csrf_token: App.Config.csrf_token, + customer_id: customerId + }; + + return $.post(url, data); + } + + /** + * Search customers by keyword. + * + * @param {String} keyword + * @param {Number} limit + * @param {Number} offset + * @param {String} orderBy + * + * @return {jQuery.Deferred} + */ + function search(keyword, limit, offset, orderBy) { + const url = App.Utils.Url.siteUrl('customers/search'); + + const data = { + csrf_token: App.Config.csrf_token, + keyword, + limit, + offset, + order_by: orderBy + }; + + return $.post(url, data); + } + + /** + * Find an customer. + * + * @param {Number} customerId + * + * @return {jQuery.Deferred} + */ + function find(customerId) { + const url = App.Utils.Url.siteUrl('customers/find'); + + const data = { + csrf_token: App.Config.csrf_token, + customer_id: customerId + }; + + return $.post(url, data); + } + + return { + create, + update, + destroy, + search, + find + }; })(); diff --git a/assets/js/http/providers_http_client.js b/assets/js/http/providers_http_client.js index a73a0887..4e93ba5e 100644 --- a/assets/js/http/providers_http_client.js +++ b/assets/js/http/providers_http_client.js @@ -10,5 +10,107 @@ * ---------------------------------------------------------------------------- */ window.App.Http.Providers = (function () { - return {}; + /** + * Create an provider. + * + * @param {Object} provider + * + * @return {jQuery.Deferred} + */ + function create(provider) { + const url = App.Utils.Url.siteUrl('providers/create'); + + const data = { + csrf_token: App.Config.csrf_token, + provider: provider + }; + + return $.post(url, data); + } + + /** + * Update an provider. + * + * @param {Object} provider + * + * @return {jQuery.Deferred} + */ + function update(provider) { + const url = App.Utils.Url.siteUrl('providers/update'); + + const data = { + csrf_token: App.Config.csrf_token, + provider: provider + }; + + return $.post(url, data); + } + + /** + * Delete an provider. + * + * @param {Number} providerId + * + * @return {jQuery.Deferred} + */ + function destroy(providerId) { + const url = App.Utils.Url.siteUrl('providers/destroy'); + + const data = { + csrf_token: App.Config.csrf_token, + provider_id: providerId + }; + + return $.post(url, data); + } + + /** + * Search providers by keyword. + * + * @param {String} keyword + * @param {Number} limit + * @param {Number} offset + * @param {String} orderBy + * + * @return {jQuery.Deferred} + */ + function search(keyword, limit, offset, orderBy) { + const url = App.Utils.Url.siteUrl('providers/search'); + + const data = { + csrf_token: App.Config.csrf_token, + keyword, + limit, + offset, + order_by: orderBy + }; + + return $.post(url, data); + } + + /** + * Find an provider. + * + * @param {Number} providerId + * + * @return {jQuery.Deferred} + */ + function find(providerId) { + const url = App.Utils.Url.siteUrl('providers/find'); + + const data = { + csrf_token: App.Config.csrf_token, + provider_id: providerId + }; + + return $.post(url, data); + } + + return { + create, + update, + destroy, + search, + find + }; })(); diff --git a/assets/js/http/secretaries_http_client.js b/assets/js/http/secretaries_http_client.js index 4071f4fe..500b7d80 100644 --- a/assets/js/http/secretaries_http_client.js +++ b/assets/js/http/secretaries_http_client.js @@ -10,5 +10,107 @@ * ---------------------------------------------------------------------------- */ window.App.Http.Secretaries = (function () { - return {}; + /** + * Create an secretary. + * + * @param {Object} secretary + * + * @return {jQuery.Deferred} + */ + function create(secretary) { + const url = App.Utils.Url.siteUrl('secretaries/create'); + + const data = { + csrf_token: App.Config.csrf_token, + secretary: secretary + }; + + return $.post(url, data); + } + + /** + * Update an secretary. + * + * @param {Object} secretary + * + * @return {jQuery.Deferred} + */ + function update(secretary) { + const url = App.Utils.Url.siteUrl('secretaries/update'); + + const data = { + csrf_token: App.Config.csrf_token, + secretary: secretary + }; + + return $.post(url, data); + } + + /** + * Delete an secretary. + * + * @param {Number} secretaryId + * + * @return {jQuery.Deferred} + */ + function destroy(secretaryId) { + const url = App.Utils.Url.siteUrl('secretaries/destroy'); + + const data = { + csrf_token: App.Config.csrf_token, + secretary_id: secretaryId + }; + + return $.post(url, data); + } + + /** + * Search secretaries by keyword. + * + * @param {String} keyword + * @param {Number} limit + * @param {Number} offset + * @param {String} orderBy + * + * @return {jQuery.Deferred} + */ + function search(keyword, limit, offset, orderBy) { + const url = App.Utils.Url.siteUrl('secretaries/search'); + + const data = { + csrf_token: App.Config.csrf_token, + keyword, + limit, + offset, + order_by: orderBy + }; + + return $.post(url, data); + } + + /** + * Find an secretary. + * + * @param {Number} secretaryId + * + * @return {jQuery.Deferred} + */ + function find(secretaryId) { + const url = App.Utils.Url.siteUrl('secretaries/find'); + + const data = { + csrf_token: App.Config.csrf_token, + secretary_id: secretaryId + }; + + return $.post(url, data); + } + + return { + create, + update, + destroy, + search, + find + }; })(); diff --git a/assets/js/http/services_http_client.js b/assets/js/http/services_http_client.js index a5d1dca6..084becf6 100644 --- a/assets/js/http/services_http_client.js +++ b/assets/js/http/services_http_client.js @@ -10,5 +10,107 @@ * ---------------------------------------------------------------------------- */ window.App.Http.Services = (function () { - return {}; + /** + * Create an service. + * + * @param {Object} service + * + * @return {jQuery.Deferred} + */ + function create(service) { + const url = App.Utils.Url.siteUrl('services/create'); + + const data = { + csrf_token: App.Config.csrf_token, + service: service + }; + + return $.post(url, data); + } + + /** + * Update an service. + * + * @param {Object} service + * + * @return {jQuery.Deferred} + */ + function update(service) { + const url = App.Utils.Url.siteUrl('services/update'); + + const data = { + csrf_token: App.Config.csrf_token, + service: service + }; + + return $.post(url, data); + } + + /** + * Delete an service. + * + * @param {Number} serviceId + * + * @return {jQuery.Deferred} + */ + function destroy(serviceId) { + const url = App.Utils.Url.siteUrl('services/destroy'); + + const data = { + csrf_token: App.Config.csrf_token, + service_id: serviceId + }; + + return $.post(url, data); + } + + /** + * Search services by keyword. + * + * @param {String} keyword + * @param {Number} limit + * @param {Number} offset + * @param {String} orderBy + * + * @return {jQuery.Deferred} + */ + function search(keyword, limit, offset, orderBy) { + const url = App.Utils.Url.siteUrl('services/search'); + + const data = { + csrf_token: App.Config.csrf_token, + keyword, + limit, + offset, + order_by: orderBy + }; + + return $.post(url, data); + } + + /** + * Find an service. + * + * @param {Number} serviceId + * + * @return {jQuery.Deferred} + */ + function find(serviceId) { + const url = App.Utils.Url.siteUrl('services/find'); + + const data = { + csrf_token: App.Config.csrf_token, + service_id: serviceId + }; + + return $.post(url, data); + } + + return { + create, + update, + destroy, + search, + find + }; })(); diff --git a/assets/js/http/settings_http_client.js b/assets/js/http/settings_http_client.js index 09f60604..d67b8b8b 100644 --- a/assets/js/http/settings_http_client.js +++ b/assets/js/http/settings_http_client.js @@ -10,5 +10,107 @@ * ---------------------------------------------------------------------------- */ window.App.Http.Settings = (function () { - return {}; + /** + * Create an setting. + * + * @param {Object} setting + * + * @return {jQuery.Deferred} + */ + function create(setting) { + const url = App.Utils.Url.siteUrl('settings/create'); + + const data = { + csrf_token: App.Config.csrf_token, + setting: setting + }; + + return $.post(url, data); + } + + /** + * Update an setting. + * + * @param {Object} setting + * + * @return {jQuery.Deferred} + */ + function update(setting) { + const url = App.Utils.Url.siteUrl('settings/update'); + + const data = { + csrf_token: App.Config.csrf_token, + setting: setting + }; + + return $.post(url, data); + } + + /** + * Delete an setting. + * + * @param {Number} settingId + * + * @return {jQuery.Deferred} + */ + function destroy(settingId) { + const url = App.Utils.Url.siteUrl('settings/destroy'); + + const data = { + csrf_token: App.Config.csrf_token, + setting_id: settingId + }; + + return $.post(url, data); + } + + /** + * Search settings by keyword. + * + * @param {String} keyword + * @param {Number} limit + * @param {Number} offset + * @param {String} orderBy + * + * @return {jQuery.Deferred} + */ + function search(keyword, limit, offset, orderBy) { + const url = App.Utils.Url.siteUrl('settings/search'); + + const data = { + csrf_token: App.Config.csrf_token, + keyword, + limit, + offset, + order_by: orderBy + }; + + return $.post(url, data); + } + + /** + * Find an setting. + * + * @param {Number} settingId + * + * @return {jQuery.Deferred} + */ + function find(settingId) { + const url = App.Utils.Url.siteUrl('settings/find'); + + const data = { + csrf_token: App.Config.csrf_token, + setting_id: settingId + }; + + return $.post(url, data); + } + + return { + create, + update, + destroy, + search, + find + }; })(); diff --git a/assets/js/http/unavailabilities_http_client.js b/assets/js/http/unavailabilities_http_client.js index 657200e2..ff8f3b7a 100644 --- a/assets/js/http/unavailabilities_http_client.js +++ b/assets/js/http/unavailabilities_http_client.js @@ -10,5 +10,107 @@ * ---------------------------------------------------------------------------- */ window.App.Http.Unavailabilities = (function () { - return {}; + /** + * Create an unavailability. + * + * @param {Object} unavailability + * + * @return {jQuery.Deferred} + */ + function create(unavailability) { + const url = App.Utils.Url.siteUrl('unavailabilities/create'); + + const data = { + csrf_token: App.Config.csrf_token, + unavailability: unavailability + }; + + return $.post(url, data); + } + + /** + * Update an unavailability. + * + * @param {Object} unavailability + * + * @return {jQuery.Deferred} + */ + function update(unavailability) { + const url = App.Utils.Url.siteUrl('unavailabilities/update'); + + const data = { + csrf_token: App.Config.csrf_token, + unavailability: unavailability + }; + + return $.post(url, data); + } + + /** + * Delete an unavailability. + * + * @param {Number} unavailabilityId + * + * @return {jQuery.Deferred} + */ + function destroy(unavailabilityId) { + const url = App.Utils.Url.siteUrl('unavailabilities/destroy'); + + const data = { + csrf_token: App.Config.csrf_token, + unavailability_id: unavailabilityId + }; + + return $.post(url, data); + } + + /** + * Search unavailabilities by keyword. + * + * @param {String} keyword + * @param {Number} limit + * @param {Number} offset + * @param {String} orderBy + * + * @return {jQuery.Deferred} + */ + function search(keyword, limit, offset, orderBy) { + const url = App.Utils.Url.siteUrl('unavailabilities/search'); + + const data = { + csrf_token: App.Config.csrf_token, + keyword, + limit, + offset, + order_by: orderBy + }; + + return $.post(url, data); + } + + /** + * Find an unavailability. + * + * @param {Number} unavailabilityId + * + * @return {jQuery.Deferred} + */ + function find(unavailabilityId) { + const url = App.Utils.Url.siteUrl('unavailabilities/find'); + + const data = { + csrf_token: App.Config.csrf_token, + unavailability_id: unavailabilityId + }; + + return $.post(url, data); + } + + return { + create, + update, + destroy, + search, + find + }; })();