From b1e3a5150c87cb02189567333a5b1c4c8ac79fed Mon Sep 17 00:00:00 2001 From: Sarahshr <51380592+Sarahshr@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:05:46 +0100 Subject: [PATCH] Feat/disable services 662 (#671) * disable button for services * add button to disable services * fix account services links * fixup! fix account services links --------- Co-authored-by: Sarahshr --- fixtures/prod-boot/configuration.yaml | 2 + src/Entity/Configuration.php | 2 +- templates/pages/account/index.html.twig | 206 ++++++++++++------------ 3 files changed, 108 insertions(+), 102 deletions(-) diff --git a/fixtures/prod-boot/configuration.yaml b/fixtures/prod-boot/configuration.yaml index 5f79014..4866531 100644 --- a/fixtures/prod-boot/configuration.yaml +++ b/fixtures/prod-boot/configuration.yaml @@ -4,6 +4,8 @@ App\Entity\Configuration: features (extends configuration_template): configuration: + services: + servicesEnabled: true notificationsSender: notificationsSenderEmail: info@example.com notificationsSenderName: Contact diff --git a/src/Entity/Configuration.php b/src/Entity/Configuration.php index 86984f6..e60559c 100644 --- a/src/Entity/Configuration.php +++ b/src/Entity/Configuration.php @@ -80,7 +80,7 @@ class Configuration */ public function getServices(): array { - /** @var array $services */ + /** @var array $services */ $services = $this->configuration['services'] ?? []; return $services; diff --git a/templates/pages/account/index.html.twig b/templates/pages/account/index.html.twig index acd5446..442dd0f 100644 --- a/templates/pages/account/index.html.twig +++ b/templates/pages/account/index.html.twig @@ -18,24 +18,26 @@ {% set my_account_links = [ { section: 'Messagerie', + enable: true, links: [ - { - name: 'Mes emprunts', - link: 'app_user_my_loans', - icon: null, - notification: userHasNewLoanMessage - }, - { - name: 'Mes prêts', - link: 'app_user_my_lendings', - icon: null, - notification: userHasNewLendingMessage - }, - ], + { + name: 'Mes emprunts', + link: 'app_user_my_loans', + icon: null, + notification: userHasNewLoanMessage + }, + { + name: 'Mes prêts', + link: 'app_user_my_lendings', + icon: null, + notification: userHasNewLendingMessage + }, + ], icon: 'bi bi-chat-left-text' }, { section: 'Mes objets', + enable: true, links: [ { name: 'Voir mes objets', @@ -53,74 +55,76 @@ }, { section: 'Mes services', - disable: servicesConfig, + enable: servicesConfig, links: [ - { - name: 'Voir mes services', - link: 'app_user_services', - icon: null - }, - { - name: 'Créer un service', - link: 'app_service_new', - icon: null, - needAddress: app.user.address is null ? true : false - }, - ], + { + name: 'Voir mes services', + link: 'app_user_services', + icon: null + }, + { + name: 'Créer un service', + link: 'app_service_new', + icon: null, + needAddress: app.user.address is null ? true : false + }, + ], icon: 'fa-solid fa-shop' }, { section: 'Mes groupes', + enable: true, links: [ - { - name: 'Voir mes groupes', - link: 'app_user_groups', - icon: null - }, - { - name: 'Administrer mes groupes', - link: 'admin', - show: show_my_groups, - icon: 'bi bi-box-arrow-up-right' - }, - { - name: create_group_label, - link: 'app_group_create', - icon: create_group_icon, - canCreateGroup: canCreateGroup, - }, - ], + { + name: 'Voir mes groupes', + link: 'app_user_groups', + icon: null + }, + { + name: 'Administrer mes groupes', + link: 'admin', + show: show_my_groups, + icon: 'bi bi-box-arrow-up-right' + }, + { + name: create_group_label, + link: 'app_group_create', + icon: create_group_icon, + canCreateGroup: canCreateGroup, + }, + ], icon: 'fa-solid fa-user-group' }, { section: 'Compte', + enable: true, links: [ - { - name: 'Mon adresse', - link: 'user_address_step1', - icon: null - }, - { - name: 'Modifier mon profil', - link: 'app_user_edit_profile', - icon: null - }, - { - name: 'Changer mon adresse e-mail', - link: 'app_user_change_login', - icon: null - }, - { - name: 'Changer mon mot de passe', - link: 'app_user_change_password', - icon: null - }, - { - name: vacation_mode_link, - link: 'user_toggle_vacation_mode', - icon: vacation_mode_icon - }, - ], + { + name: 'Mon adresse', + link: 'user_address_step1', + icon: null + }, + { + name: 'Modifier mon profil', + link: 'app_user_edit_profile', + icon: null + }, + { + name: 'Changer mon adresse e-mail', + link: 'app_user_change_login', + icon: null + }, + { + name: 'Changer mon mot de passe', + link: 'app_user_change_password', + icon: null + }, + { + name: vacation_mode_link, + link: 'user_toggle_vacation_mode', + icon: vacation_mode_icon + }, + ], icon: 'fa-solid fa-user fa-xl text-white' }, ] %} @@ -134,7 +138,7 @@ } %}
{% for my_account_link in my_account_links %} - {% if my_account_link.disable is not defined %} + {% if my_account_link.enable %}