diff --git a/application/controllers/Backend.php b/application/controllers/Backend.php index 6084860e..63799292 100755 --- a/application/controllers/Backend.php +++ b/application/controllers/Backend.php @@ -32,7 +32,7 @@ class Backend extends EA_Controller { $this->load->model('providers_model'); $this->load->model('roles_model'); $this->load->model('secretaries_model'); - $this->load->model('service_categories_model'); + $this->load->model('categories_model'); $this->load->model('services_model'); $this->load->model('settings_model'); $this->load->model('users_model'); @@ -237,7 +237,7 @@ class Backend extends EA_Controller { $view['time_format'] = setting('time_format'); $view['first_weekday'] = setting('first_weekday'); $view['services'] = $this->services_model->get(); - $view['categories'] = $this->service_categories_model->get(); + $view['categories'] = $this->categories_model->get(); $view['timezones'] = $this->timezones->to_array(); $this->set_user_data($view); diff --git a/application/controllers/Backend_api.php b/application/controllers/Backend_api.php index 36039a44..2db11582 100755 --- a/application/controllers/Backend_api.php +++ b/application/controllers/Backend_api.php @@ -38,7 +38,7 @@ class Backend_api extends EA_Controller { $this->load->model('providers_model'); $this->load->model('roles_model'); $this->load->model('secretaries_model'); - $this->load->model('service_categories_model'); + $this->load->model('categories_model'); $this->load->model('services_model'); $this->load->model('settings_model'); $this->load->model('unavailabilities_model'); @@ -809,7 +809,7 @@ class Backend_api extends EA_Controller { throw new Exception('You do not have the required permissions for this task.'); } - $category_id = $this->service_categories_model->save($category); + $category_id = $this->categories_model->save($category); json_response([ 'success' => TRUE, @@ -836,7 +836,7 @@ class Backend_api extends EA_Controller { $service_category_id = request('category_id'); - $this->service_categories_model->delete($service_category_id); + $this->categories_model->delete($service_category_id); json_response([ 'success' => TRUE @@ -864,7 +864,7 @@ class Backend_api extends EA_Controller { $where = '(name LIKE "%' . $key . '%" OR description LIKE "%' . $key . '%")'; - $service_categories = $this->service_categories_model->get($where); + $service_categories = $this->categories_model->get($where); json_response($service_categories); } diff --git a/application/controllers/Booking.php b/application/controllers/Booking.php index 5c798698..ef237e3e 100755 --- a/application/controllers/Booking.php +++ b/application/controllers/Booking.php @@ -33,7 +33,7 @@ class Booking extends EA_Controller { $this->load->model('providers_model'); $this->load->model('admins_model'); $this->load->model('secretaries_model'); - $this->load->model('service_categories_model'); + $this->load->model('categories_model'); $this->load->model('services_model'); $this->load->model('customers_model'); $this->load->model('settings_model'); diff --git a/application/controllers/Service_categories.php b/application/controllers/Categories.php similarity index 64% rename from application/controllers/Service_categories.php rename to application/controllers/Categories.php index d85c5b0c..1d7d0ef0 100644 --- a/application/controllers/Service_categories.php +++ b/application/controllers/Categories.php @@ -12,21 +12,21 @@ * ---------------------------------------------------------------------------- */ /** - * Service categories controller. + * Categories controller. * - * Handles the service categories related operations. + * Handles the categories related operations. * * @package Controllers */ -class Service_categories extends EA_Controller { +class Categories extends EA_Controller { /** - * Service_categories constructor. + * Categories constructor. */ public function __construct() { parent::__construct(); - $this->load->model('service_categories_model'); + $this->load->model('categories_model'); $this->load->model('roles_model'); $this->load->library('accounts'); @@ -34,16 +34,16 @@ class Service_categories extends EA_Controller { } /** - * Render the backend services page. + * Render the backend categories page. * - * On this page admin users will be able to manage services, which are eventually selected by customers during the + * On this page admin users will be able to manage categories, which are eventually selected by customers during the * booking process. */ public function index() { - session(['dest_url' => site_url('service_categories')]); + session(['dest_url' => site_url('categories')]); - if (cannot('view', 'services')) + if (cannot('view', PRIV_SERVICES)) { show_error('Forbidden', 403); } @@ -52,8 +52,8 @@ class Service_categories extends EA_Controller { $role_slug = session('role_slug'); - $this->load->view('pages/service_categories', [ - 'page_title' => lang('services'), + $this->load->view('pages/categories', [ + 'page_title' => lang('categories'), 'active_menu' => PRIV_SERVICES, 'user_display_name' => $this->accounts->get_user_display_name($user_id), 'timezones' => $this->timezones->to_array(), @@ -62,13 +62,13 @@ class Service_categories extends EA_Controller { } /** - * Filter services by the provided keyword. + * Filter categories by the provided keyword. */ public function search() { try { - if (cannot('view', 'services')) + if (cannot('view', PRIV_SERVICES)) { show_error('Forbidden', 403); } @@ -81,9 +81,9 @@ class Service_categories extends EA_Controller { $offset = 0; - $service_categories = $this->service_categories_model->search($keyword, $limit, $offset, $order_by); + $categories = $this->categories_model->search($keyword, $limit, $offset, $order_by); - json_response($service_categories); + json_response($categories); } catch (Throwable $e) { @@ -92,24 +92,24 @@ class Service_categories extends EA_Controller { } /** - * Create a service. + * Create a category. */ public function create() { try { - $service_category = json_decode(request('service_category'), TRUE); + $category = json_decode(request('category'), TRUE); - if (cannot('add', 'services')) + if (cannot('add', PRIV_SERVICES)) { show_error('Forbidden', 403); } - $service_category_id = $this->service_categories_model->save($service_category); + $category_id = $this->categories_model->save($category); json_response([ 'success' => TRUE, - 'id' => $service_category_id + 'id' => $category_id ]); } catch (Throwable $e) @@ -119,24 +119,24 @@ class Service_categories extends EA_Controller { } /** - * Update a service. + * Update a category. */ public function update() { try { - $service_category = json_decode(request('service_category'), TRUE); + $category = json_decode(request('category'), TRUE); - if (cannot('edit', 'services')) + if (cannot('edit', PRIV_SERVICES)) { show_error('Forbidden', 403); } - $service_category_id = $this->service_categories_model->save($service_category); + $category_id = $this->categories_model->save($category); json_response([ 'success' => TRUE, - 'id' => $service_category_id + 'id' => $category_id ]); } catch (Throwable $e) @@ -146,20 +146,20 @@ class Service_categories extends EA_Controller { } /** - * Remove a service. + * Remove a category. */ public function destroy() { try { - if (cannot('delete', 'services')) + if (cannot('delete', PRIV_SERVICES)) { show_error('Forbidden', 403); } - $service_category_id = request('service_category_id'); + $category_id = request('category_id'); - $this->service_categories_model->delete($service_category_id); + $this->categories_model->delete($category_id); json_response([ 'success' => TRUE, @@ -172,7 +172,7 @@ class Service_categories extends EA_Controller { } /** - * Find a service category. + * Find a category. */ public function find() { @@ -185,7 +185,7 @@ class Service_categories extends EA_Controller { $category_id = request('category_id'); - $category = $this->service_categories_model->find($category_id); + $category = $this->categories_model->find($category_id); json_response($category); } diff --git a/application/controllers/api/v1/Categories_api_v1.php b/application/controllers/api/v1/Categories_api_v1.php index 7908a9bc..73fd7a7b 100644 --- a/application/controllers/api/v1/Categories_api_v1.php +++ b/application/controllers/api/v1/Categories_api_v1.php @@ -24,17 +24,17 @@ class Categories_api_v1 extends EA_Controller { { parent::__construct(); - $this->load->model('service_categories_model'); + $this->load->model('categories_model'); $this->load->library('api'); $this->api->auth(); - $this->api->model('service_categories_model'); + $this->api->model('categories_model'); } /** - * Get a service category collection. + * Get a category collection. */ public function index() { @@ -52,26 +52,26 @@ class Categories_api_v1 extends EA_Controller { $with = $this->api->request_with(); - $service_categories = empty($keyword) - ? $this->service_categories_model->get(NULL, $limit, $offset, $order_by) - : $this->service_categories_model->search($keyword, $limit, $offset, $order_by); + $categories = empty($keyword) + ? $this->categories_model->get(NULL, $limit, $offset, $order_by) + : $this->categories_model->search($keyword, $limit, $offset, $order_by); - foreach ($service_categories as &$service_category) + foreach ($categories as &$category) { - $this->service_categories_model->api_encode($service_category); + $this->categories_model->api_encode($category); if ( ! empty($fields)) { - $this->service_categories_model->only($service_category, $fields); + $this->categories_model->only($category, $fields); } if ( ! empty($with)) { - $this->service_categories_model->load($service_category, $with); + $this->categories_model->load($category, $with); } } - json_response($service_categories); + json_response($categories); } catch (Throwable $e) { @@ -80,9 +80,9 @@ class Categories_api_v1 extends EA_Controller { } /** - * Get a single service category. + * Get a single category. * - * @param int|null $id Service category ID. + * @param int|null $id Category ID. */ public function show(int $id = NULL) { @@ -92,28 +92,28 @@ class Categories_api_v1 extends EA_Controller { $with = $this->api->request_with(); - $service_category = $this->service_categories_model->find($id); + $category = $this->categories_model->find($id); - $this->service_categories_model->api_encode($service_category); + $this->categories_model->api_encode($category); if ( ! empty($fields)) { - $this->service_categories_model->only($service_category, $fields); + $this->categories_model->only($category, $fields); } if ( ! empty($with)) { - $this->service_categories_model->load($service_category, $with); + $this->categories_model->load($category, $with); } - if ( ! $service_category) + if ( ! $category) { response('', 404); return; } - json_response($service_category); + json_response($category); } catch (Throwable $e) { @@ -122,28 +122,28 @@ class Categories_api_v1 extends EA_Controller { } /** - * Create a service category. + * Create a category. */ public function store() { try { - $service_category = request(); + $category = request(); - $this->service_categories_model->api_decode($service_category); + $this->categories_model->api_decode($category); - if (array_key_exists('id', $service_category)) + if (array_key_exists('id', $category)) { - unset($service_category['id']); + unset($category['id']); } - $service_category_id = $this->service_categories_model->save($service_category); + $category_id = $this->categories_model->save($category); - $created_service_category = $this->service_categories_model->find($service_category_id); + $created_category = $this->categories_model->find($category_id); - $this->service_categories_model->api_encode($created_service_category); + $this->categories_model->api_encode($created_category); - json_response($created_service_category, 201); + json_response($created_category, 201); } catch (Throwable $e) { @@ -152,15 +152,15 @@ class Categories_api_v1 extends EA_Controller { } /** - * Update a service category. + * Update a category. * - * @param int $id Service category ID. + * @param int $id Category ID. */ public function update(int $id) { try { - $occurrences = $this->service_categories_model->get(['id' => $id]); + $occurrences = $this->categories_model->get(['id' => $id]); if (empty($occurrences)) { @@ -169,19 +169,19 @@ class Categories_api_v1 extends EA_Controller { return; } - $original_service_category = $occurrences[0]; + $original_category = $occurrences[0]; - $service_category = request(); + $category = request(); - $this->service_categories_model->api_decode($service_category, $original_service_category); + $this->categories_model->api_decode($category, $original_category); - $service_category_id = $this->service_categories_model->save($service_category); + $category_id = $this->categories_model->save($category); - $updated_service_category = $this->service_categories_model->find($service_category_id); + $updated_category = $this->categories_model->find($category_id); - $this->service_categories_model->api_encode($updated_service_category); + $this->categories_model->api_encode($updated_category); - json_response($updated_service_category); + json_response($updated_category); } catch (Throwable $e) { @@ -190,15 +190,15 @@ class Categories_api_v1 extends EA_Controller { } /** - * Delete a service category. + * Delete a category. * - * @param int $id Service category ID. + * @param int $id Category ID. */ public function destroy(int $id) { try { - $occurrences = $this->service_categories_model->get(['id' => $id]); + $occurrences = $this->categories_model->get(['id' => $id]); if (empty($occurrences)) { @@ -207,7 +207,7 @@ class Categories_api_v1 extends EA_Controller { return; } - $this->service_categories_model->delete($id); + $this->categories_model->delete($id); response('', 204); } diff --git a/application/core/EA_Controller.php b/application/core/EA_Controller.php index 7d49bcd5..05505f1e 100644 --- a/application/core/EA_Controller.php +++ b/application/core/EA_Controller.php @@ -41,12 +41,12 @@ * * @property Admins_model $admins_model * @property Appointments_model $appointments_model + * @property Categories_model $categories_model * @property Consents_model $consents_model * @property Customers_model $customers_model * @property Providers_model $providers_model * @property Roles_model $roles_model * @property Secretaries_model $secretaries_model - * @property Service_categories_model $service_categories_model * @property Services_model $services_model * @property Settings_model $settings_model * @property Unavailabilities_model $unavailabilities_model diff --git a/application/language/arabic/translations_lang.php b/application/language/arabic/translations_lang.php index 487cd10e..d50d566b 100755 --- a/application/language/arabic/translations_lang.php +++ b/application/language/arabic/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'تم حذف المسؤول بنجاح'; $lang['provider_deleted'] = 'تم حذف المزود بنجاح'; $lang['secretary_deleted'] = 'تم حذف السيكرتير بنجاح'; $lang['service_saved'] = 'تم حفظ الخدمة بنجاح'; -$lang['service_category_saved'] = 'تم حفظ فئة الخدمة بنجاح'; +$lang['category_saved'] = 'تم حفظ فئة الخدمة بنجاح'; $lang['service_deleted'] = 'تم حذف الخدمة بنجاح'; -$lang['service_category_deleted'] = 'تم حذف فئة الخدمة بنجاح'; +$lang['category_deleted'] = 'تم حذف فئة الخدمة بنجاح'; $lang['customer_saved'] = 'تم حفظ الزبون بنجاح'; $lang['customer_deleted'] = 'تم حذف الزبون بنجاح'; $lang['current_view'] = 'الرعض الحالي'; diff --git a/application/language/bulgarian/translations_lang.php b/application/language/bulgarian/translations_lang.php index 1000cf2a..a3cb1676 100755 --- a/application/language/bulgarian/translations_lang.php +++ b/application/language/bulgarian/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Администратор заличен успешн $lang['provider_deleted'] = 'Изпълнител заличен успешно.'; $lang['secretary_deleted'] = 'Секретар заличен успешно.'; $lang['service_saved'] = 'Услуга записана успешно.'; -$lang['service_category_saved'] = 'Категория на услуги записана успешно.'; +$lang['category_saved'] = 'Категория на услуги записана успешно.'; $lang['service_deleted'] = 'Услугата заличена успешно.'; -$lang['service_category_deleted'] = 'Категория на услуги заличена успешно.'; +$lang['category_deleted'] = 'Категория на услуги заличена успешно.'; $lang['customer_saved'] = 'Клиент записан успешно.'; $lang['customer_deleted'] = 'Клиент заличен успешно.'; $lang['current_view'] = 'Текущ изглед'; diff --git a/application/language/catalan/translations_lang.php b/application/language/catalan/translations_lang.php index d386f875..77f23c85 100644 --- a/application/language/catalan/translations_lang.php +++ b/application/language/catalan/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Admin eliminat correctament.'; $lang['provider_deleted'] = 'Proveïdor eliminat correctament.'; $lang['secretary_deleted'] = 'Secretari eliminat correctament.'; $lang['service_saved'] = 'Servei desat correctament.'; -$lang['service_category_saved'] = 'Categoria de servei desada correctament.'; +$lang['category_saved'] = 'Categoria de servei desada correctament.'; $lang['service_deleted'] = 'Servei eliminat correctament.'; -$lang['service_category_deleted'] = 'Categoria de servei eliminada correctament.'; +$lang['category_deleted'] = 'Categoria de servei eliminada correctament.'; $lang['customer_saved'] = 'Client desat correctament.'; $lang['customer_deleted'] = 'Client eliminat correctament.'; $lang['current_view'] = 'Vista actual'; diff --git a/application/language/chinese/translations_lang.php b/application/language/chinese/translations_lang.php index 773130c1..ea8a2f60 100755 --- a/application/language/chinese/translations_lang.php +++ b/application/language/chinese/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = '管理员Admin成功删除'; $lang['provider_deleted'] = '服务人员成功删除.'; $lang['secretary_deleted'] = '秘书成功删除.'; $lang['service_saved'] = '服务项目成功保存.'; -$lang['service_category_saved'] = '服务类别成功保存.'; +$lang['category_saved'] = '服务类别成功保存.'; $lang['service_deleted'] = '服务项目成功删除.'; -$lang['service_category_deleted'] = '服务类别成功删除.'; +$lang['category_deleted'] = '服务类别成功删除.'; $lang['customer_saved'] = '客户成功保存.'; $lang['customer_deleted'] = '客户成功删除.'; $lang['current_view'] = '现在的视图'; diff --git a/application/language/czech/translations_lang.php b/application/language/czech/translations_lang.php index ed76c408..cf5b6090 100644 --- a/application/language/czech/translations_lang.php +++ b/application/language/czech/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Administrátor úspěšně odstraněn.'; $lang['provider_deleted'] = 'Poskytovatel úspěšně odstraněn.'; $lang['secretary_deleted'] = 'Sekretářka úspěšně odstraněna.'; $lang['service_saved'] = 'Služba úspěšně uložena.'; -$lang['service_category_saved'] = 'Kategorie služeb úspěšně uložena.'; +$lang['category_saved'] = 'Kategorie služeb úspěšně uložena.'; $lang['service_deleted'] = 'Služba úspěšně odstraněna.'; -$lang['service_category_deleted'] = 'Kategorie služeb úspěšně odstraněna.'; +$lang['category_deleted'] = 'Kategorie služeb úspěšně odstraněna.'; $lang['customer_saved'] = 'Zákazník úspěšně uložen.'; $lang['customer_deleted'] = 'Zákazník úspěšně odstraněn.'; $lang['current_view'] = 'Aktuální zobrazení'; diff --git a/application/language/danish/translations_lang.php b/application/language/danish/translations_lang.php index 31e04ace..6babb7a7 100755 --- a/application/language/danish/translations_lang.php +++ b/application/language/danish/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Administration slettet'; $lang['provider_deleted'] = 'Leverandør slettet'; $lang['secretary_deleted'] = 'Sekræter slettet'; $lang['service_saved'] = 'Tjenesten er gemt'; -$lang['service_category_saved'] = 'Tjeneste kategori gemt'; +$lang['category_saved'] = 'Tjeneste kategori gemt'; $lang['service_deleted'] = 'Tjeneste slettet'; -$lang['service_category_deleted'] = 'Tjeneste kategori slettet'; +$lang['category_deleted'] = 'Tjeneste kategori slettet'; $lang['customer_saved'] = 'Kunde gemt'; $lang['customer_deleted'] = 'Kunde slettet'; $lang['current_view'] = 'Nu vises'; diff --git a/application/language/dutch/translations_lang.php b/application/language/dutch/translations_lang.php index ca07e272..b2df06d4 100755 --- a/application/language/dutch/translations_lang.php +++ b/application/language/dutch/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Beheerder succesvol verwijderd.'; $lang['provider_deleted'] = 'Medewerker succesvol verwijderd.'; $lang['secretary_deleted'] = 'Secretaris succesvol verwijderd.'; $lang['service_saved'] = 'Dienst succesvol opgeslagen.'; -$lang['service_category_saved'] = 'Dienstencategorie succesvol opgeslagen.'; +$lang['category_saved'] = 'Dienstencategorie succesvol opgeslagen.'; $lang['service_deleted'] = 'Dienst succesvol verwijderd.'; -$lang['service_category_deleted'] = 'Dienstencategorie succesvol verwijderd.'; +$lang['category_deleted'] = 'Dienstencategorie succesvol verwijderd.'; $lang['customer_saved'] = 'Klant succesvol opgeslagen.'; $lang['customer_deleted'] = 'Klant succesvol verwijderd.'; $lang['current_view'] = 'Huidige weergave'; diff --git a/application/language/english/translations_lang.php b/application/language/english/translations_lang.php index 741b9743..568ab03c 100755 --- a/application/language/english/translations_lang.php +++ b/application/language/english/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Admin deleted successfully.'; $lang['provider_deleted'] = 'Provider deleted successfully.'; $lang['secretary_deleted'] = 'Secretary deleted successfully.'; $lang['service_saved'] = 'Service saved successfully.'; -$lang['service_category_saved'] = 'Service category saved successfully.'; +$lang['category_saved'] = 'Category saved successfully.'; $lang['service_deleted'] = 'Service deleted successfully.'; -$lang['service_category_deleted'] = 'Service category deleted successfully.'; +$lang['category_deleted'] = 'Category deleted successfully.'; $lang['customer_saved'] = 'Customer saved successfully.'; $lang['customer_deleted'] = 'Customer deleted successfully.'; $lang['current_view'] = 'Current View'; @@ -211,7 +211,7 @@ $lang['delete_record_prompt'] = 'Are you sure that you want to delete this recor $lang['delete_admin'] = 'Delete Admin'; $lang['delete_customer'] = 'Delete Customer'; $lang['delete_service'] = 'Delete Service'; -$lang['delete_category'] = 'Delete Service Category'; +$lang['delete_category'] = 'Delete Category'; $lang['delete_provider'] = 'Delete Provider'; $lang['delete_secretary'] = 'Delete Secretary'; $lang['delete_appointment'] = 'Delete Appointment'; diff --git a/application/language/finnish/translations_lang.php b/application/language/finnish/translations_lang.php index bc408c36..d3ed8a78 100755 --- a/application/language/finnish/translations_lang.php +++ b/application/language/finnish/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Järjestelmänvalvoja poistettiin onnistuneesti.'; $lang['provider_deleted'] = 'Palveluntuottaja poistettiin onnistuneesti.'; $lang['secretary_deleted'] = 'Sihteeri poistettiin onnistuneesti.'; $lang['service_saved'] = 'Palvelu tallennettiin onnistuneesti.'; -$lang['service_category_saved'] = 'Palveluluokka tallennettiin onnistuneesti.'; +$lang['category_saved'] = 'Palveluluokka tallennettiin onnistuneesti.'; $lang['service_deleted'] = 'Palvelu poistettiin onnistuneesti.'; -$lang['service_category_deleted'] = 'Palveluluokka poistettiin onnistuneesti.'; +$lang['category_deleted'] = 'Palveluluokka poistettiin onnistuneesti.'; $lang['customer_saved'] = 'Asiakas tallennettiin onnistuneesti.'; $lang['customer_deleted'] = 'Asiakas poistettiin onnistuneesti.'; $lang['current_view'] = 'Nykyinen näkymä'; diff --git a/application/language/french/translations_lang.php b/application/language/french/translations_lang.php index 970d5cd1..9bbcff6c 100755 --- a/application/language/french/translations_lang.php +++ b/application/language/french/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Administrateur supprimé avec succès.'; $lang['provider_deleted'] = 'Exécutant supprimé avec succès.'; $lang['secretary_deleted'] = 'Secrétaire supprimé·e avec succès.'; $lang['service_saved'] = 'Prestation enregistrée avec succès.'; -$lang['service_category_saved'] = 'Catégorie de prestation enregistrée avec succès.'; +$lang['category_saved'] = 'Catégorie de prestation enregistrée avec succès.'; $lang['service_deleted'] = 'Prestation supprimée avec succès.'; -$lang['service_category_deleted'] = 'Catégorie de prestation supprimée avec succès.'; +$lang['category_deleted'] = 'Catégorie de prestation supprimée avec succès.'; $lang['customer_saved'] = 'Client enregistré avec succès.'; $lang['customer_deleted'] = 'Client supprimé avec succès.'; $lang['current_view'] = 'Vue normale'; diff --git a/application/language/german/translations_lang.php b/application/language/german/translations_lang.php index e4764461..d590542b 100755 --- a/application/language/german/translations_lang.php +++ b/application/language/german/translations_lang.php @@ -136,9 +136,9 @@ $lang['admin_deleted'] = 'Administrator erfolgreich gelöscht.'; $lang['provider_deleted'] = 'Anbieter erfolgreich gelöscht.'; $lang['secretary_deleted'] = 'Bearbeiter erfolgreich gelöscht.'; $lang['service_saved'] = 'Dienstleistung erfolgreich gesichert.'; -$lang['service_category_saved'] = 'Dienstleistungskategorie erfolgreich gesichert.'; +$lang['category_saved'] = 'Kategorie erfolgreich gesichert.'; $lang['service_deleted'] = 'Dienstleistung erfolgreich gelöscht.'; -$lang['service_category_deleted'] = 'Dienstleistungskategorie erfolgreich gelöscht.'; +$lang['category_deleted'] = 'Kategorie erfolgreich gelöscht.'; $lang['customer_saved'] = 'Kunden erfolgreich gesichert.'; $lang['customer_deleted'] = 'Kunden erfolgreich gelöscht.'; $lang['current_view'] = 'Laufende Ansicht'; @@ -207,7 +207,7 @@ $lang['delete_record_prompt'] = 'Sind Sie sicher, dass Sie diesen Eintrag lösch $lang['delete_admin'] = 'Administrator löschen'; $lang['delete_customer'] = 'Kunden löschen'; $lang['delete_service'] = 'Dienstleistung löschen'; -$lang['delete_category'] = 'Service-Kategorie löschen'; +$lang['delete_category'] = 'Kategorie löschen'; $lang['delete_provider'] = 'Zeitraum löschen'; $lang['delete_secretary'] = 'Bearbeiter löschen'; $lang['delete_appointment'] = 'Termin löschen'; diff --git a/application/language/greek/translations_lang.php b/application/language/greek/translations_lang.php index 8d6858ff..3ff1fe03 100755 --- a/application/language/greek/translations_lang.php +++ b/application/language/greek/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Ο διαχειριστής διαγράφηκε επ $lang['provider_deleted'] = 'Ο πάροχος διαγράφηκε επιτυχώς.'; $lang['secretary_deleted'] = 'Ο γραμματέας διαγράφηκε επιτυχώς.'; $lang['service_saved'] = 'Η υπηρεσία αποθηκεύτηκε επιτυχώς.'; -$lang['service_category_saved'] = 'Η κατηγορία υπηρεσιών αποθηκεύτηκε επιτυχώς.'; +$lang['category_saved'] = 'Η κατηγορία αποθηκεύτηκε επιτυχώς.'; $lang['service_deleted'] = 'Η υπηρεσία διαγράφηκε επιτυχώς.'; -$lang['service_category_deleted'] = 'Η κατηγορία υπηρεσιών διαγράφηκε επιτυχώς.'; +$lang['category_deleted'] = 'Η κατηγορία διαγράφηκε επιτυχώς.'; $lang['customer_saved'] = 'Ο πελάτης αποθηκεύτηκε επιτυχώς.'; $lang['customer_deleted'] = 'Ο πελάτης διαγράφηκε επιτυχώς.'; $lang['current_view'] = 'Τρέχουσα Προβολή'; @@ -211,7 +211,7 @@ $lang['delete_record_prompt'] = 'Είστε σίγουρος ότι θέλετε $lang['delete_admin'] = 'Διαγραφή Διαχειριστή'; $lang['delete_customer'] = 'Διαγραφή Πελάτη'; $lang['delete_service'] = 'Διαγραφή Υπηρεσίας'; -$lang['delete_category'] = 'Διαγραφή Κατηγορίας Υπηρεσιών'; +$lang['delete_category'] = 'Διαγραφή Κατηγορίας'; $lang['delete_provider'] = 'Διαγραφή Παρόχου'; $lang['delete_secretary'] = 'Διαγραφή Γραμματέα'; $lang['delete_appointment'] = 'Διαγραφή Ραντεβού'; diff --git a/application/language/hebrew/translations_lang.php b/application/language/hebrew/translations_lang.php index 9a469322..e70e3892 100644 --- a/application/language/hebrew/translations_lang.php +++ b/application/language/hebrew/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'מנהל המערכת נמחק בהצלחה!'; $lang['provider_deleted'] = 'הספק נמחק בהצלחה!'; $lang['secretary_deleted'] = 'המזכיר/ה נמחק בהצלחה!'; $lang['service_saved'] = 'השירות נשמר בהצלחה!'; -$lang['service_category_saved'] = 'קטגוריית השירות נשמרה בהצלחה!'; +$lang['category_saved'] = 'קטגוריית השירות נשמרה בהצלחה!'; $lang['service_deleted'] = 'השירות נמחק בהצלחה!'; -$lang['service_category_deleted'] = 'קטגוריית השירות נמחקה בהצלחה!'; +$lang['category_deleted'] = 'קטגוריית השירות נמחקה בהצלחה!'; $lang['customer_saved'] = 'הלקוח נשמר בהצלחה!'; $lang['customer_deleted'] = 'הלקוח נמחק בהצלחה!'; $lang['current_view'] = 'תצוגה נוכחית'; diff --git a/application/language/hindi/translations_lang.php b/application/language/hindi/translations_lang.php index e9b8ec7f..4d4feda1 100755 --- a/application/language/hindi/translations_lang.php +++ b/application/language/hindi/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'व्यवस्थापक सफलतापू $lang['provider_deleted'] = 'प्रदाता सफलतापूर्वक नष्ट कर दिया.'; $lang['secretary_deleted'] = 'सचिव सफलतापूर्वक नष्ट कर दिया.'; $lang['service_saved'] = 'सेवा सफलतापूर्वक सेव.'; -$lang['service_category_saved'] = 'सेवा श्रेणी सफलतापूर्वक सेव.'; +$lang['category_saved'] = 'सेवा श्रेणी सफलतापूर्वक सेव.'; $lang['service_deleted'] = 'सेवा सफलतापूर्वक नष्ट कर दिया.'; -$lang['service_category_deleted'] = 'सेवा श्रेणी सफलतापूर्वक नष्ट कर दिया.'; +$lang['category_deleted'] = 'सेवा श्रेणी सफलतापूर्वक नष्ट कर दिया.'; $lang['customer_saved'] = 'ग्राहक सफलतापूर्वक सेव.'; $lang['customer_deleted'] = 'ग्राहक को सफलतापूर्वक नष्ट कर दिया.'; $lang['current_view'] = 'वर्तमान दृश्य'; diff --git a/application/language/hungarian/translations_lang.php b/application/language/hungarian/translations_lang.php index c27c7f21..c5b524db 100755 --- a/application/language/hungarian/translations_lang.php +++ b/application/language/hungarian/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Admin törölve.'; $lang['provider_deleted'] = 'Szolgáltató törölve.'; $lang['secretary_deleted'] = 'Titkár törölve.'; $lang['service_saved'] = 'Szolgáltatás sikeresen mentve.'; -$lang['service_category_saved'] = 'Kategória sikeresen mentve.'; +$lang['category_saved'] = 'Kategória sikeresen mentve.'; $lang['service_deleted'] = 'Szolgáltatás törölve.'; -$lang['service_category_deleted'] = 'Kategória törölve.'; +$lang['category_deleted'] = 'Kategória törölve.'; $lang['customer_saved'] = 'Vendég sikeresen mentve.'; $lang['customer_deleted'] = 'Vendég törölve.'; $lang['current_view'] = 'Jelenlegi nézet'; diff --git a/application/language/italian/translations_lang.php b/application/language/italian/translations_lang.php index 56347290..0d7f1bdf 100755 --- a/application/language/italian/translations_lang.php +++ b/application/language/italian/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Amministratore cancellato con successo.'; $lang['provider_deleted'] = 'Fornitore cancellato con successo.'; $lang['secretary_deleted'] = 'Segretaria cancellata con successo.'; $lang['service_saved'] = 'Servizio salvato con successo.'; -$lang['service_category_saved'] = 'Categoria servizio salvata con successo.'; +$lang['category_saved'] = 'Categoria servizio salvata con successo.'; $lang['service_deleted'] = 'Servizio cancellato con successo.'; -$lang['service_category_deleted'] = 'Categoria servizio cancellata con successo.'; +$lang['category_deleted'] = 'Categoria servizio cancellata con successo.'; $lang['customer_saved'] = 'Cliente salvato con successo.'; $lang['customer_deleted'] = 'Cliente cancellato con successo.'; $lang['current_view'] = 'Vista corrente'; diff --git a/application/language/japanese/translations_lang.php b/application/language/japanese/translations_lang.php index b0f8d7af..32e0db76 100755 --- a/application/language/japanese/translations_lang.php +++ b/application/language/japanese/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = '管理者情報が削除されました。'; $lang['provider_deleted'] = '担当者情報が削除されました。'; $lang['secretary_deleted'] = '予約管理者情報が削除されました。'; $lang['service_saved'] = 'サービスメニューが保存されました。'; -$lang['service_category_saved'] = 'サービスカテゴリーが保存されました。'; +$lang['category_saved'] = 'サービスカテゴリーが保存されました。'; $lang['service_deleted'] = 'サービスメニューが削除されました'; -$lang['service_category_deleted'] = 'サービスカテゴリーが削除されました。'; +$lang['category_deleted'] = 'サービスカテゴリーが削除されました。'; $lang['customer_saved'] = 'お客様情報が保存されました。'; $lang['customer_deleted'] = 'お客様情報が削除されました。'; $lang['current_view'] = '現在の表示'; diff --git a/application/language/luxembourgish/translations_lang.php b/application/language/luxembourgish/translations_lang.php index 3fa503f0..14948bd2 100755 --- a/application/language/luxembourgish/translations_lang.php +++ b/application/language/luxembourgish/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Administrator erfollegräich geläscht.'; $lang['provider_deleted'] = 'Mataarbechter erfollegräich geläscht.'; $lang['secretary_deleted'] = 'Büropersonal erfollegräich geläscht.'; $lang['service_saved'] = 'Dingschtleeschtung erfollegräich gespäichert.'; -$lang['service_category_saved'] = 'Dingschtleeschtungskategorie erfollegräich gespäichert.'; +$lang['category_saved'] = 'Dingschtleeschtungskategorie erfollegräich gespäichert.'; $lang['service_deleted'] = 'Dingschtleeschtung erfollegräich geläscht.'; -$lang['service_category_deleted'] = 'Dingschtleeschtungskategorie erfollegräich geläscht.'; +$lang['category_deleted'] = 'Dingschtleeschtungskategorie erfollegräich geläscht.'; $lang['customer_saved'] = 'Client erfollegräich gespäichert.'; $lang['customer_deleted'] = 'Client erfollegräich geläscht.'; $lang['current_view'] = 'Aktuell Usicht'; diff --git a/application/language/marathi/translations_lang.php b/application/language/marathi/translations_lang.php index 0b50c111..ca92112d 100644 --- a/application/language/marathi/translations_lang.php +++ b/application/language/marathi/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'प्रशासन यशस्वीरित् $lang['provider_deleted'] = 'प्रदाता यशस्वीरित्या हटविला.'; $lang['secretary_deleted'] = 'सचिव यशस्वीरित्या नष्ट.'; $lang['service_saved'] = 'सेवा यशस्वीरित्या जतन केली.'; -$lang['service_category_saved'] = 'सेवा श्रेणी यशस्वीरित्या जतन करा.'; +$lang['category_saved'] = 'सेवा श्रेणी यशस्वीरित्या जतन करा.'; $lang['service_deleted'] = 'सेवा यशस्वीरित्या हटविली.'; -$lang['service_category_deleted'] = 'सेवा श्रेणी यशस्वीरित्या हटविली.'; +$lang['category_deleted'] = 'सेवा श्रेणी यशस्वीरित्या हटविली.'; $lang['customer_saved'] = 'ग्राहक यशस्वीरित्या जतन.'; $lang['customer_deleted'] = 'यशस्वीरित्या ग्राहक हटविला.'; $lang['current_view'] = 'वर्तमान दृश्य'; diff --git a/application/language/persian/translations_lang.php b/application/language/persian/translations_lang.php index a1477f2d..21e25b95 100644 --- a/application/language/persian/translations_lang.php +++ b/application/language/persian/translations_lang.php @@ -139,9 +139,9 @@ $lang['admin_deleted'] = 'مدیر با موفقیت حذف شد'; $lang['provider_deleted'] = 'ارائه دهنده با موفقیت حذف شد'; $lang['secretary_deleted'] = 'منشی با موفقیت حذف شد'; $lang['service_saved'] = 'خدمت با موفقیت ذخیره شد.'; -$lang['service_category_saved'] = 'دستنه بندی خدمت با موفقیت ذخیره شد'; +$lang['category_saved'] = 'دستنه بندی خدمت با موفقیت ذخیره شد'; $lang['service_deleted'] = 'خدمت با موفقیت حذف شد'; -$lang['service_category_deleted'] = 'دسته بندی خدمت با موفقیت حذف شد'; +$lang['category_deleted'] = 'دسته بندی خدمت با موفقیت حذف شد'; $lang['customer_saved'] = 'مشتری با موفقیت ذخیره شد'; $lang['customer_deleted'] = 'مشتری با موفقیت حذف شد'; $lang['current_view'] = 'نمای جاری'; diff --git a/application/language/polish/translations_lang.php b/application/language/polish/translations_lang.php index c73e58b0..ee5e21c8 100755 --- a/application/language/polish/translations_lang.php +++ b/application/language/polish/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Usunięto administratora pomyślnie'; $lang['provider_deleted'] = 'Personel usunięty pomyślnie'; $lang['secretary_deleted'] = 'Sekretarka usunięta pomyślnie'; $lang['service_saved'] = 'Zabieg zapisany pomyślnie.'; -$lang['service_category_saved'] = 'Kategoria zabiegu zapisana pomyślnie'; +$lang['category_saved'] = 'Kategoria zabiegu zapisana pomyślnie'; $lang['service_deleted'] = 'Zabieg usunięty pomyślnie'; -$lang['service_category_deleted'] = 'Kategoria zabiegu usunięta.'; +$lang['category_deleted'] = 'Kategoria zabiegu usunięta.'; $lang['customer_saved'] = 'Klient został zapisany'; $lang['customer_deleted'] = 'Klient usunięty pomyślnie'; $lang['current_view'] = 'Obecny Widok'; diff --git a/application/language/portuguese-br/translations_lang.php b/application/language/portuguese-br/translations_lang.php index a7a6ccd0..64fd5422 100755 --- a/application/language/portuguese-br/translations_lang.php +++ b/application/language/portuguese-br/translations_lang.php @@ -139,9 +139,9 @@ $lang['admin_deleted'] = 'Administrador excluído com sucesso.'; $lang['provider_deleted'] = 'Atendente excluído com sucesso.'; $lang['secretary_deleted'] = 'Assistente excluído com sucesso.'; $lang['service_saved'] = 'Serviço salvo com sucesso.'; -$lang['service_category_saved'] = 'Categoria de serviço salvo com sucesso.'; +$lang['category_saved'] = 'Categoria de serviço salvo com sucesso.'; $lang['service_deleted'] = 'Serviço excluído com sucesso.'; -$lang['service_category_deleted'] = 'Categoria de serviço excluída com sucesso.'; +$lang['category_deleted'] = 'Categoria de serviço excluída com sucesso.'; $lang['customer_saved'] = 'Cliente salvo com sucesso.'; $lang['customer_deleted'] = 'Cliente excluído com sucesso.'; $lang['current_view'] = 'Vista atual'; diff --git a/application/language/portuguese/translations_lang.php b/application/language/portuguese/translations_lang.php index 62b066f3..6804cc9a 100755 --- a/application/language/portuguese/translations_lang.php +++ b/application/language/portuguese/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Administrador apagado com sucesso.'; $lang['provider_deleted'] = 'Fornecedor apagado com sucesso.'; $lang['secretary_deleted'] = 'Secretário apagado com sucesso.'; $lang['service_saved'] = 'Serviço guardado com sucesso.'; -$lang['service_category_saved'] = 'Categoria de serviço guardada com sucesso.'; +$lang['category_saved'] = 'Categoria de serviço guardada com sucesso.'; $lang['service_deleted'] = 'Serviço apagado com sucesso.'; -$lang['service_category_deleted'] = 'Categoria de serviço apagada com sucesso.'; +$lang['category_deleted'] = 'Categoria de serviço apagada com sucesso.'; $lang['customer_saved'] = 'Cliente guardado com sucesso.'; $lang['customer_deleted'] = 'Cliente apagado com sucesso.'; $lang['current_view'] = 'Vista atual'; diff --git a/application/language/romanian/translations_lang.php b/application/language/romanian/translations_lang.php index 385c0a5d..4be4d4c7 100755 --- a/application/language/romanian/translations_lang.php +++ b/application/language/romanian/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Administrator sters.'; $lang['provider_deleted'] = 'Furnizor sters.'; $lang['secretary_deleted'] = 'Secretar sters.'; $lang['service_saved'] = 'Serviciu salvat.'; -$lang['service_category_saved'] = 'Categorie de servicii salvata.'; +$lang['category_saved'] = 'Categorie de servicii salvata.'; $lang['service_deleted'] = 'Serviciu sters.'; -$lang['service_category_deleted'] = 'Categorie de servicii stearsa.'; +$lang['category_deleted'] = 'Categorie de servicii stearsa.'; $lang['customer_saved'] = 'Client salvat.'; $lang['customer_deleted'] = 'Client sters.'; $lang['current_view'] = 'Fereastra curenta'; diff --git a/application/language/russian/translations_lang.php b/application/language/russian/translations_lang.php index 7a3c293e..4b43aada 100755 --- a/application/language/russian/translations_lang.php +++ b/application/language/russian/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Администратор успешно удалён $lang['provider_deleted'] = 'Исполнитель успешно удалён.'; $lang['secretary_deleted'] = 'Секретарь успешно удален.'; $lang['service_saved'] = 'Услуга успешно сохранена.'; -$lang['service_category_saved'] = 'Категория услуги успешно сохранена.'; +$lang['category_saved'] = 'Категория услуги успешно сохранена.'; $lang['service_deleted'] = 'Услуга успешно удалена.'; -$lang['service_category_deleted'] = 'Категория услуги успешно удалена.'; +$lang['category_deleted'] = 'Категория услуги успешно удалена.'; $lang['customer_saved'] = 'Заказчик успешно сохранён.'; $lang['customer_deleted'] = 'Заказчик успешно удалён.'; $lang['current_view'] = 'Текущий вид'; diff --git a/application/language/slovak/translations_lang.php b/application/language/slovak/translations_lang.php index ae40c21f..a1e9874e 100755 --- a/application/language/slovak/translations_lang.php +++ b/application/language/slovak/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Admin úspešne vymazaný.'; $lang['provider_deleted'] = 'Pracovník úspešne vymazaný.'; $lang['secretary_deleted'] = 'Sekretárka úspešne vymazaná.'; $lang['service_saved'] = 'Služba úspešne uložená.'; -$lang['service_category_saved'] = 'Kategórie služieb úspešne uložené.'; +$lang['category_saved'] = 'Kategórie služieb úspešne uložené.'; $lang['service_deleted'] = 'Služba úspešne vymazaná.'; -$lang['service_category_deleted'] = 'Kategória služieb úspešne vymazaná.'; +$lang['category_deleted'] = 'Kategória služieb úspešne vymazaná.'; $lang['customer_saved'] = 'Zákazník úspešne uložený.'; $lang['customer_deleted'] = 'Zákazník úspešne vymazaná.'; $lang['current_view'] = 'Aktuálny náhľad'; diff --git a/application/language/spanish/translations_lang.php b/application/language/spanish/translations_lang.php index 31636b20..f03f0adc 100755 --- a/application/language/spanish/translations_lang.php +++ b/application/language/spanish/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Administador eliminado exitosamente'; $lang['provider_deleted'] = 'Proveedor eliminado exitosamente'; $lang['secretary_deleted'] = 'Asistente eliminado exitosamente'; $lang['service_saved'] = 'Servicio guardado exitosamente'; -$lang['service_category_saved'] = 'Categoría de servicio guardada exitosamente'; +$lang['category_saved'] = 'Categoría de servicio guardada exitosamente'; $lang['service_deleted'] = 'Servicio eliminado exitosamente'; -$lang['service_category_deleted'] = 'Categoría de servicio eliminada exitosamente'; +$lang['category_deleted'] = 'Categoría de servicio eliminada exitosamente'; $lang['customer_saved'] = 'Cliente guardado exitosamente'; $lang['customer_deleted'] = 'Cliente eliminado exitosamente'; $lang['current_view'] = 'Vista actual'; diff --git a/application/language/swedish/translations_lang.php b/application/language/swedish/translations_lang.php index f0511beb..0b5a0ac8 100644 --- a/application/language/swedish/translations_lang.php +++ b/application/language/swedish/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Administratören är borttagen.'; $lang['provider_deleted'] = 'Leverantören är borttagen.'; $lang['secretary_deleted'] = 'Assistenten är borttagen.'; $lang['service_saved'] = 'Tjänsten är sparad.'; -$lang['service_category_saved'] = 'Tjänstekategorin är sparad.'; +$lang['category_saved'] = 'Tjänstekategorin är sparad.'; $lang['service_deleted'] = 'Tjänsten är borttagen'; -$lang['service_category_deleted'] = 'Tjänstekategorin är borttagen.'; +$lang['category_deleted'] = 'Tjänstekategorin är borttagen.'; $lang['customer_saved'] = 'Kunden är sparad.'; $lang['customer_deleted'] = 'Kunden är borttagen.'; $lang['current_view'] = 'Nu visas'; diff --git a/application/language/turkish/translations_lang.php b/application/language/turkish/translations_lang.php index 0027a55c..be59d0a0 100755 --- a/application/language/turkish/translations_lang.php +++ b/application/language/turkish/translations_lang.php @@ -140,9 +140,9 @@ $lang['admin_deleted'] = 'Yönetici başarıyla silindi.'; $lang['provider_deleted'] = 'Hizmet sağlayıcı başarıyla silindi.'; $lang['secretary_deleted'] = 'Sekreter başarıyla silindi.'; $lang['service_saved'] = 'Hizmet başarıyla kaydedildi.'; -$lang['service_category_saved'] = 'Hizmet kategorisi başarıyla kaydedildi.'; +$lang['category_saved'] = 'Hizmet kategorisi başarıyla kaydedildi.'; $lang['service_deleted'] = 'Hizmet başarıyla silindi.'; -$lang['service_category_deleted'] = 'Hizmet kategorisi başarıyla silindi.'; +$lang['category_deleted'] = 'Hizmet kategorisi başarıyla silindi.'; $lang['customer_saved'] = 'Müşteri başarıyla kaydedildi.'; $lang['customer_deleted'] = 'Müşteri başarıyla silindi.'; $lang['current_view'] = 'Mevcut Görünüm'; diff --git a/application/models/Categories_model.php b/application/models/Categories_model.php new file mode 100644 index 00000000..98d4bd80 --- /dev/null +++ b/application/models/Categories_model.php @@ -0,0 +1,339 @@ + + * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis + * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link http://easyappointments.org + * @since v1.0.0 + * ---------------------------------------------------------------------------- */ + +/** + * Categories model. + * + * Handles all the database operations of the category resource. + * + * @package Models + */ +class Categories_model extends EA_Model { + /** + * @var array + */ + protected $casts = [ + 'id' => 'integer', + ]; + + /** + * @var array + */ + protected $api_resource = [ + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + ]; + + /** + * Save (insert or update) a category. + * + * @param array $category Associative array with the category data. + * + * @return int Returns the category ID. + * + * @throws InvalidArgumentException + */ + public function save(array $category): int + { + $this->validate($category); + + if (empty($category['id'])) + { + return $this->insert($category); + } + else + { + return $this->update($category); + } + } + + /** + * Validate the category data. + * + * @param array $category Associative array with the category data. + * + * @throws InvalidArgumentException + */ + public function validate(array $category) + { + // If a category ID is provided then check whether the record really exists in the database. + if ( ! empty($category['id'])) + { + $count = $this->db->get_where('categories', ['id' => $category['id']])->num_rows(); + + if ( ! $count) + { + throw new InvalidArgumentException('The provided category ID does not exist in the database: ' . $category['id']); + } + } + + // Make sure all required fields are provided. + if ( + empty($category['name']) + ) + { + throw new InvalidArgumentException('Not all required fields are provided: ' . print_r($category, TRUE)); + } + } + + /** + * Insert a new category into the database. + * + * @param array $category Associative array with the category data. + * + * @return int Returns the category ID. + * + * @throws RuntimeException + */ + protected function insert(array $category): int + { + if ( ! $this->db->insert('categories', $category)) + { + throw new RuntimeException('Could not insert category.'); + } + + return $this->db->insert_id(); + } + + /** + * Update an existing category. + * + * @param array $category Associative array with the category data. + * + * @return int Returns the category ID. + * + * @throws RuntimeException + */ + protected function update(array $category): int + { + if ( ! $this->db->update('categories', $category, ['id' => $category['id']])) + { + throw new RuntimeException('Could not update service categories.'); + } + + return $category['id']; + } + + /** + * Remove an existing category from the database. + * + * @param int $category_id Category ID. + * + * @throws RuntimeException + */ + public function delete(int $category_id) + { + if ( ! $this->db->delete('categories', ['id' => $category_id])) + { + throw new RuntimeException('Could not delete service categories.'); + } + } + + /** + * Get a specific category from the database. + * + * @param int $category_id The ID of the record to be returned. + * + * @return array Returns an array with the category data. + * + * @throws InvalidArgumentException + */ + public function find(int $category_id): array + { + if ( ! $this->db->get_where('categories', ['id' => $category_id])->num_rows()) + { + throw new InvalidArgumentException('The provided category ID was not found in the database: ' . $category_id); + } + + $category = $this->db->get_where('categories', ['id' => $category_id])->row_array(); + + $this->cast($category); + + return $category; + } + + /** + * Get a specific field value from the database. + * + * @param int $category_id Category ID. + * @param string $field Name of the value to be returned. + * + * @return string Returns the selected category value from the database. + * + * @throws InvalidArgumentException + */ + public function value(int $category_id, string $field): string + { + if (empty($field)) + { + throw new InvalidArgumentException('The field argument is cannot be empty.'); + } + + if (empty($category_id)) + { + throw new InvalidArgumentException('The category ID argument cannot be empty.'); + } + + // Check whether the service exists. + $query = $this->db->get_where('categories', ['id' => $category_id]); + + if ( ! $query->num_rows()) + { + throw new InvalidArgumentException('The provided category ID was not found in the database: ' . $category_id); + } + + // Check if the required field is part of the category data. + $category = $query->row_array(); + + $this->cast($category); + + if ( ! array_key_exists($field, $category)) + { + throw new InvalidArgumentException('The requested field was not found in the category data: ' . $field); + } + + return $category[$field]; + } + + /** + * Get all services that match the provided criteria. + * + * @param array|string $where Where conditions + * @param int|null $limit Record limit. + * @param int|null $offset Record offset. + * @param string|null $order_by Order by. + * + * @return array Returns an array of service categories. + */ + public function get($where = NULL, int $limit = NULL, int $offset = NULL, string $order_by = NULL): array + { + if ($where !== NULL) + { + $this->db->where($where); + } + + if ($order_by !== NULL) + { + $this->db->order_by($order_by); + } + + $categories = $this->db->get('categories', $limit, $offset)->result_array(); + + foreach ($categories as $category) + { + $this->cast($category); + } + + return $categories; + } + + /** + * Get the query builder interface, configured for use with the service categories table. + * + * @return CI_DB_query_builder + */ + public function query(): CI_DB_query_builder + { + return $this->db->from('categories'); + } + + /** + * Search service categories by the provided keyword. + * + * @param string $keyword Search keyword. + * @param int|null $limit Record limit. + * @param int|null $offset Record offset. + * @param string|null $order_by Order by. + * + * @return array Returns an array of service categories. + */ + public function search(string $keyword, int $limit = NULL, int $offset = NULL, string $order_by = NULL): array + { + $categories = $this + ->db + ->select() + ->from('categories') + ->like('name', $keyword) + ->or_like('description', $keyword) + ->limit($limit) + ->offset($offset) + ->order_by($order_by) + ->get() + ->result_array(); + + foreach ($categories as &$category) + { + $this->cast($category); + } + + return $categories; + } + + /** + * Load related resources to a category. + * + * @param array $category Associative array with the category data. + * @param array $resources Resource names to be attached. + * + * @throws InvalidArgumentException + */ + public function load(array &$category, array $resources) + { + // Service categories do not currently have any related resources. + } + + /** + * Convert the database category record to the equivalent API resource. + * + * @param array $category Category data. + */ + public function api_encode(array &$category) + { + $encoded_resource = [ + 'id' => array_key_exists('id', $category) ? (int)$category['id'] : NULL, + 'name' => $category['name'], + 'description' => array_key_exists('description', $category) ? $category['description'] : NULL + ]; + + $category = $encoded_resource; + } + + /** + * Convert the API resource to the equivalent database category record. + * + * @param array $category API resource. + * @param array|null $base Base category data to be overwritten with the provided values (useful for updates). + */ + public function api_decode(array &$category, array $base = NULL) + { + $decoded_resource = $base ?: []; + + if (array_key_exists('id', $category)) + { + $decoded_resource['id'] = $category['id']; + } + + if (array_key_exists('name', $category)) + { + $decoded_resource['name'] = $category['name']; + } + + if (array_key_exists('description', $category)) + { + $decoded_resource['description'] = $category['description']; + } + + $category = $decoded_resource; + } +} diff --git a/application/models/Service_categories_model.php b/application/models/Service_categories_model.php deleted file mode 100644 index 3b04bd40..00000000 --- a/application/models/Service_categories_model.php +++ /dev/null @@ -1,339 +0,0 @@ - - * @copyright Copyright (c) 2013 - 2020, Alex Tselegidis - * @license http://opensource.org/licenses/GPL-3.0 - GPLv3 - * @link http://easyappointments.org - * @since v1.0.0 - * ---------------------------------------------------------------------------- */ - -/** - * Services categories model. - * - * Handles all the database operations of the service category resource. - * - * @package Models - */ -class Service_categories_model extends EA_Model { - /** - * @var array - */ - protected $casts = [ - 'id' => 'integer', - ]; - - /** - * @var array - */ - protected $api_resource = [ - 'id' => 'id', - 'name' => 'name', - 'description' => 'description', - ]; - - /** - * Save (insert or update) a service category. - * - * @param array $service_category Associative array with the service category data. - * - * @return int Returns the service category ID. - * - * @throws InvalidArgumentException - */ - public function save(array $service_category): int - { - $this->validate($service_category); - - if (empty($service_category['id'])) - { - return $this->insert($service_category); - } - else - { - return $this->update($service_category); - } - } - - /** - * Validate the service category data. - * - * @param array $service_category Associative array with the service category data. - * - * @throws InvalidArgumentException - */ - public function validate(array $service_category) - { - // If a service category ID is provided then check whether the record really exists in the database. - if ( ! empty($service_category['id'])) - { - $count = $this->db->get_where('service_categories', ['id' => $service_category['id']])->num_rows(); - - if ( ! $count) - { - throw new InvalidArgumentException('The provided service category ID does not exist in the database: ' . $service_category['id']); - } - } - - // Make sure all required fields are provided. - if ( - empty($service_category['name']) - ) - { - throw new InvalidArgumentException('Not all required fields are provided: ' . print_r($service_category, TRUE)); - } - } - - /** - * Insert a new service category into the database. - * - * @param array $service_category Associative array with the service category data. - * - * @return int Returns the service category ID. - * - * @throws RuntimeException - */ - protected function insert(array $service_category): int - { - if ( ! $this->db->insert('service_categories', $service_category)) - { - throw new RuntimeException('Could not insert service category.'); - } - - return $this->db->insert_id(); - } - - /** - * Update an existing service category. - * - * @param array $service_category Associative array with the service category data. - * - * @return int Returns the service category ID. - * - * @throws RuntimeException - */ - protected function update(array $service_category): int - { - if ( ! $this->db->update('service_categories', $service_category, ['id' => $service_category['id']])) - { - throw new RuntimeException('Could not update service categories.'); - } - - return $service_category['id']; - } - - /** - * Remove an existing service category from the database. - * - * @param int $service_category_id Service category ID. - * - * @throws RuntimeException - */ - public function delete(int $service_category_id) - { - if ( ! $this->db->delete('service_categories', ['id' => $service_category_id])) - { - throw new RuntimeException('Could not delete service categories.'); - } - } - - /** - * Get a specific service category from the database. - * - * @param int $service_category_id The ID of the record to be returned. - * - * @return array Returns an array with the service category data. - * - * @throws InvalidArgumentException - */ - public function find(int $service_category_id): array - { - if ( ! $this->db->get_where('service_categories', ['id' => $service_category_id])->num_rows()) - { - throw new InvalidArgumentException('The provided service category ID was not found in the database: ' . $service_category_id); - } - - $service_category = $this->db->get_where('service_categories', ['id' => $service_category_id])->row_array(); - - $this->cast($service_category); - - return $service_category; - } - - /** - * Get a specific field value from the database. - * - * @param int $service_category_id Service category ID. - * @param string $field Name of the value to be returned. - * - * @return string Returns the selected service category value from the database. - * - * @throws InvalidArgumentException - */ - public function value(int $service_category_id, string $field): string - { - if (empty($field)) - { - throw new InvalidArgumentException('The field argument is cannot be empty.'); - } - - if (empty($service_category_id)) - { - throw new InvalidArgumentException('The service category ID argument cannot be empty.'); - } - - // Check whether the service exists. - $query = $this->db->get_where('service_categories', ['id' => $service_category_id]); - - if ( ! $query->num_rows()) - { - throw new InvalidArgumentException('The provided service category ID was not found in the database: ' . $service_category_id); - } - - // Check if the required field is part of the service category data. - $service_category = $query->row_array(); - - $this->cast($service_category); - - if ( ! array_key_exists($field, $service_category)) - { - throw new InvalidArgumentException('The requested field was not found in the service category data: ' . $field); - } - - return $service_category[$field]; - } - - /** - * Get all services that match the provided criteria. - * - * @param array|string $where Where conditions - * @param int|null $limit Record limit. - * @param int|null $offset Record offset. - * @param string|null $order_by Order by. - * - * @return array Returns an array of service categories. - */ - public function get($where = NULL, int $limit = NULL, int $offset = NULL, string $order_by = NULL): array - { - if ($where !== NULL) - { - $this->db->where($where); - } - - if ($order_by !== NULL) - { - $this->db->order_by($order_by); - } - - $service_categories = $this->db->get('service_categories', $limit, $offset)->result_array(); - - foreach ($service_categories as $service_category) - { - $this->cast($service_category); - } - - return $service_categories; - } - - /** - * Get the query builder interface, configured for use with the service categories table. - * - * @return CI_DB_query_builder - */ - public function query(): CI_DB_query_builder - { - return $this->db->from('service_categories'); - } - - /** - * Search service categories by the provided keyword. - * - * @param string $keyword Search keyword. - * @param int|null $limit Record limit. - * @param int|null $offset Record offset. - * @param string|null $order_by Order by. - * - * @return array Returns an array of service categories. - */ - public function search(string $keyword, int $limit = NULL, int $offset = NULL, string $order_by = NULL): array - { - $service_categories = $this - ->db - ->select() - ->from('service_categories') - ->like('name', $keyword) - ->or_like('description', $keyword) - ->limit($limit) - ->offset($offset) - ->order_by($order_by) - ->get() - ->result_array(); - - foreach ($service_categories as &$service_category) - { - $this->cast($service_category); - } - - return $service_categories; - } - - /** - * Load related resources to a service category. - * - * @param array $service_category Associative array with the service category data. - * @param array $resources Resource names to be attached. - * - * @throws InvalidArgumentException - */ - public function load(array &$service_category, array $resources) - { - // Service categories do not currently have any related resources. - } - - /** - * Convert the database service category record to the equivalent API resource. - * - * @param array $service_category Service category data. - */ - public function api_encode(array &$service_category) - { - $encoded_resource = [ - 'id' => array_key_exists('id', $service_category) ? (int)$service_category['id'] : NULL, - 'name' => $service_category['name'], - 'description' => array_key_exists('description', $service_category) ? $service_category['description'] : NULL - ]; - - $service_category = $encoded_resource; - } - - /** - * Convert the API resource to the equivalent database service category record. - * - * @param array $service_category API resource. - * @param array|null $base Base service category data to be overwritten with the provided values (useful for updates). - */ - public function api_decode(array &$service_category, array $base = NULL) - { - $decoded_resource = $base ?: []; - - if (array_key_exists('id', $service_category)) - { - $decoded_resource['id'] = $service_category['id']; - } - - if (array_key_exists('name', $service_category)) - { - $decoded_resource['name'] = $service_category['name']; - } - - if (array_key_exists('description', $service_category)) - { - $decoded_resource['description'] = $service_category['description']; - } - - $service_category = $decoded_resource; - } -} diff --git a/application/models/Services_model.php b/application/models/Services_model.php index 55049a01..b986508f 100644 --- a/application/models/Services_model.php +++ b/application/models/Services_model.php @@ -26,7 +26,7 @@ class Services_model extends EA_Model { 'id' => 'integer', 'price' => 'float', 'attendants_number' => 'integer', - 'id_service_categories' => 'boolean', + 'id_categories' => 'integer', ]; /** @@ -42,7 +42,7 @@ class Services_model extends EA_Model { 'location' => 'location', 'availabilitiesType' => 'availabilities_type', 'attendantsNumber' => 'attendants_number', - 'categoryId' => 'id_service_categories', + 'categoryId' => 'id_categories', ]; /** @@ -97,13 +97,13 @@ class Services_model extends EA_Model { } // If a category was provided then make sure it really exists in the database. - if ( ! empty($service['id_service_categories'])) + if ( ! empty($service['id_categories'])) { - $count = $this->db->get_where('service_categories', ['id' => $service['id_service_categories']])->num_rows(); + $count = $this->db->get_where('categories', ['id' => $service['id_categories']])->num_rows(); if ( ! $count) { - throw new InvalidArgumentException('The provided category ID was not found in the database: ' . $service['id_service_categories']); + throw new InvalidArgumentException('The provided category ID was not found in the database: ' . $service['id_categories']); } } @@ -301,10 +301,10 @@ class Services_model extends EA_Model { $services = $this ->db ->distinct() - ->select('services.*, service_categories.name AS category_name, service_categories.id AS category_id') + ->select('services.*, categories.name AS category_name, categories.id AS category_id') ->from('services') ->join('services_providers', 'services_providers.id_services = services.id', 'inner') - ->join('service_categories', 'service_categories.id = services.id_service_categories', 'left') + ->join('categories', 'categories.id = services.id_categories', 'left') ->order_by('name ASC') ->get() ->result_array(); @@ -363,7 +363,7 @@ class Services_model extends EA_Model { * Load related resources to a service. * * @param array $service Associative array with the service data. - * @param array $resources Resource names to be attached ("service_category" supported). + * @param array $resources Resource names to be attached ("category" supported). * * @throws InvalidArgumentException */ @@ -378,11 +378,11 @@ class Services_model extends EA_Model { { switch ($resource) { - case 'service_category': - $service['service_category'] = $this + case 'category': + $service['category'] = $this ->db - ->get_where('service_categories', [ - 'id' => $service['id_service_categories'] ?? $service['categoryId'] ?? NULL + ->get_where('categories', [ + 'id' => $service['id_categories'] ?? $service['categoryId'] ?? NULL ]) ->row_array(); break; @@ -410,7 +410,7 @@ class Services_model extends EA_Model { 'location' => $service['location'], 'availabilitiesType' => $service['availabilities_type'], 'attendantsNumber' => (int)$service['attendants_number'], - 'categoryId' => $service['id_service_categories'] !== NULL ? (int)$service['id_service_categories'] : NULL + 'categoryId' => $service['id_categories'] !== NULL ? (int)$service['id_categories'] : NULL ]; $service = $encoded_resource; @@ -473,7 +473,7 @@ class Services_model extends EA_Model { if (array_key_exists('categoryId', $service)) { - $decoded_resource['id_service_categories'] = $service['categoryId']; + $decoded_resource['id_categories'] = $service['categoryId']; } $service = $decoded_resource; diff --git a/application/views/components/backend_header.php b/application/views/components/backend_header.php index 92812888..58061336 100755 --- a/application/views/components/backend_header.php +++ b/application/views/components/backend_header.php @@ -51,7 +51,7 @@ - + diff --git a/application/views/pages/service_categories.php b/application/views/pages/categories.php similarity index 98% rename from application/views/pages/service_categories.php rename to application/views/pages/categories.php index 4d6e15bf..5f9e44c8 100755 --- a/application/views/pages/service_categories.php +++ b/application/views/pages/categories.php @@ -9,29 +9,6 @@ - - - -
@@ -115,3 +92,30 @@
+ + + + + + + + diff --git a/assets/js/pages/backend_categories_helper.js b/assets/js/pages/backend_categories_helper.js index 1e3cce77..8c813171 100644 --- a/assets/js/pages/backend_categories_helper.js +++ b/assets/js/pages/backend_categories_helper.js @@ -180,7 +180,7 @@ * @param {Boolean} display Optional (false), if true then the selected record will be displayed on the form. */ CategoriesHelper.prototype.filter = function (keyword, selectId, display) { - var url = GlobalVariables.baseUrl + '/index.php/service_categories/search'; + var url = GlobalVariables.baseUrl + '/index.php/categories/search'; var data = { csrf_token: GlobalVariables.csrfToken, @@ -231,16 +231,16 @@ * @param {Object} category Contains the category data. */ CategoriesHelper.prototype.save = function (category) { - var url = GlobalVariables.baseUrl + '/index.php/service_categories/' + (category.id ? 'update' : 'create'); + var url = GlobalVariables.baseUrl + '/index.php/categories/' + (category.id ? 'update' : 'create'); var data = { csrf_token: GlobalVariables.csrfToken, - service_category: JSON.stringify(category) + category: JSON.stringify(category) }; $.post(url, data).done( function (response) { - Backend.displayNotification(App.Lang.service_category_saved); + Backend.displayNotification(App.Lang.category_saved); this.resetForm(); $('#filter-categories .key').val(''); this.filter('', response.id, true); @@ -254,16 +254,16 @@ * @param {Number} id Record ID to be deleted. */ CategoriesHelper.prototype.delete = function (id) { - var url = GlobalVariables.baseUrl + '/index.php/service_categories/destroy'; + var url = GlobalVariables.baseUrl + '/index.php/categories/destroy'; var data = { csrf_token: GlobalVariables.csrfToken, - service_category_id: id + category_id: id }; $.post(url, data).done( function () { - Backend.displayNotification(App.Lang.service_category_deleted); + Backend.displayNotification(App.Lang.category_deleted); this.resetForm(); this.filter($('#filter-categories .key').val()); diff --git a/assets/js/pages/backend_services.js b/assets/js/pages/backend_services.js index 753ec57e..6f6a8743 100644 --- a/assets/js/pages/backend_services.js +++ b/assets/js/pages/backend_services.js @@ -68,7 +68,7 @@ window.BackendServices = window.BackendServices || {}; * Use this method every time a change is made to the service categories db table. */ exports.updateAvailableCategories = function () { - var url = GlobalVariables.baseUrl + '/index.php/service_categories/search'; + var url = GlobalVariables.baseUrl + '/index.php/categories/search'; var data = { csrf_token: GlobalVariables.csrfToken, diff --git a/assets/js/pages/backend_services_helper.js b/assets/js/pages/backend_services_helper.js index e1a8a63d..1490e64a 100644 --- a/assets/js/pages/backend_services_helper.js +++ b/assets/js/pages/backend_services_helper.js @@ -135,9 +135,9 @@ }; if ($('#service-category').val() !== 'null') { - service.id_service_categories = $('#service-category').val(); + service.id_categories = $('#service-category').val(); } else { - service.id_service_categories = null; + service.id_categories = null; } if ($('#service-id').val() !== '') { @@ -321,7 +321,7 @@ $('#service-availabilities-type').val(service.availabilities_type); $('#service-attendants-number').val(service.attendants_number); - var categoryId = service.id_service_categories !== null ? service.id_service_categories : 'null'; + var categoryId = service.id_categories !== null ? service.id_categories : 'null'; $('#service-category').val(categoryId); };