From 21be3e7b50a49174c9ae1224dc3095d0e6a32b97 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Tue, 11 Jan 2022 10:54:46 +0100 Subject: [PATCH] Refactor the providers helper JS file so that it becomes a standalone module. --- application/controllers/Providers.php | 27 +- application/views/pages/providers.php | 42 +- assets/js/http/providers_http_client.js | 20 +- assets/js/pages/backend_providers.js | 143 ----- assets/js/pages/backend_providers_helper.js | 664 -------------------- assets/js/pages/providers.js | 551 ++++++++++++++++ 6 files changed, 603 insertions(+), 844 deletions(-) delete mode 100644 assets/js/pages/backend_providers.js delete mode 100755 assets/js/pages/backend_providers_helper.js create mode 100755 assets/js/pages/providers.js diff --git a/application/controllers/Providers.php b/application/controllers/Providers.php index a770a65e..81967acd 100644 --- a/application/controllers/Providers.php +++ b/application/controllers/Providers.php @@ -37,7 +37,7 @@ class Providers extends EA_Controller { /** * Render the backend providers page. * - * On this page admin users will be able to manage providers, which are eventually selected by customers during the + * On this page admin users will be able to manage providers, which are eventually selected by customers during the * booking process. */ public function index() @@ -53,6 +53,25 @@ class Providers extends EA_Controller { $role_slug = session('role_slug'); + $services = $this->services_model->get(); + + foreach($services as &$service) + { + $this->services_model->only($service, ['id', 'name']); + } + + script_vars([ + 'user_id' => $user_id, + 'role_slug' => $role_slug, + 'company_working_plan' => setting('company_working_plan'), + 'date_format' => setting('date_format'), + 'time_format' => setting('time_format'), + 'first_weekday' => setting('first_weekday'), + 'min_password_length' => MIN_PASSWORD_LENGTH, + 'timezones' => $this->timezones->to_array(), + 'services' => $services, + ]); + html_vars([ 'page_title' => lang('providers'), 'active_menu' => PRIV_USERS, @@ -82,7 +101,7 @@ class Providers extends EA_Controller { $order_by = 'first_name ASC, last_name ASC, email ASC'; $limit = request('limit', 1000); - + $offset = 0; $providers = $this->providers_model->search($keyword, $limit, $offset, $order_by); @@ -102,7 +121,7 @@ class Providers extends EA_Controller { { try { - $provider = json_decode(request('provider'), TRUE); + $provider = request('provider'); if (cannot('add', PRIV_USERS)) { @@ -129,7 +148,7 @@ class Providers extends EA_Controller { { try { - $provider = json_decode(request('provider'), TRUE); + $provider = request('provider'); if (cannot('edit', PRIV_USERS)) { diff --git a/application/views/pages/providers.php b/application/views/pages/providers.php index 2567b51b..6ed16bd9 100755 --- a/application/views/pages/providers.php +++ b/application/views/pages/providers.php @@ -211,9 +211,9 @@
-
- -