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 <sarah@les-tilleuls.coop>
This commit is contained in:
parent
9f661ebe0a
commit
b1e3a5150c
3 changed files with 108 additions and 102 deletions
|
|
@ -4,6 +4,8 @@ App\Entity\Configuration:
|
||||||
|
|
||||||
features (extends configuration_template):
|
features (extends configuration_template):
|
||||||
configuration:
|
configuration:
|
||||||
|
services:
|
||||||
|
servicesEnabled: true
|
||||||
notificationsSender:
|
notificationsSender:
|
||||||
notificationsSenderEmail: info@example.com
|
notificationsSenderEmail: info@example.com
|
||||||
notificationsSenderName: Contact
|
notificationsSenderName: Contact
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class Configuration
|
||||||
*/
|
*/
|
||||||
public function getServices(): array
|
public function getServices(): array
|
||||||
{
|
{
|
||||||
/** @var array<bool> $services */
|
/** @var array<string, bool> $services */
|
||||||
$services = $this->configuration['services'] ?? [];
|
$services = $this->configuration['services'] ?? [];
|
||||||
|
|
||||||
return $services;
|
return $services;
|
||||||
|
|
|
||||||
|
|
@ -18,24 +18,26 @@
|
||||||
{% set my_account_links = [
|
{% set my_account_links = [
|
||||||
{
|
{
|
||||||
section: 'Messagerie',
|
section: 'Messagerie',
|
||||||
|
enable: true,
|
||||||
links: [
|
links: [
|
||||||
{
|
{
|
||||||
name: 'Mes emprunts',
|
name: 'Mes emprunts',
|
||||||
link: 'app_user_my_loans',
|
link: 'app_user_my_loans',
|
||||||
icon: null,
|
icon: null,
|
||||||
notification: userHasNewLoanMessage
|
notification: userHasNewLoanMessage
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Mes prêts',
|
name: 'Mes prêts',
|
||||||
link: 'app_user_my_lendings',
|
link: 'app_user_my_lendings',
|
||||||
icon: null,
|
icon: null,
|
||||||
notification: userHasNewLendingMessage
|
notification: userHasNewLendingMessage
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
icon: 'bi bi-chat-left-text'
|
icon: 'bi bi-chat-left-text'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
section: 'Mes objets',
|
section: 'Mes objets',
|
||||||
|
enable: true,
|
||||||
links: [
|
links: [
|
||||||
{
|
{
|
||||||
name: 'Voir mes objets',
|
name: 'Voir mes objets',
|
||||||
|
|
@ -53,74 +55,76 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
section: 'Mes services',
|
section: 'Mes services',
|
||||||
disable: servicesConfig,
|
enable: servicesConfig,
|
||||||
links: [
|
links: [
|
||||||
{
|
{
|
||||||
name: 'Voir mes services',
|
name: 'Voir mes services',
|
||||||
link: 'app_user_services',
|
link: 'app_user_services',
|
||||||
icon: null
|
icon: null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Créer un service',
|
name: 'Créer un service',
|
||||||
link: 'app_service_new',
|
link: 'app_service_new',
|
||||||
icon: null,
|
icon: null,
|
||||||
needAddress: app.user.address is null ? true : false
|
needAddress: app.user.address is null ? true : false
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
icon: 'fa-solid fa-shop'
|
icon: 'fa-solid fa-shop'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
section: 'Mes groupes',
|
section: 'Mes groupes',
|
||||||
|
enable: true,
|
||||||
links: [
|
links: [
|
||||||
{
|
{
|
||||||
name: 'Voir mes groupes',
|
name: 'Voir mes groupes',
|
||||||
link: 'app_user_groups',
|
link: 'app_user_groups',
|
||||||
icon: null
|
icon: null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Administrer mes groupes',
|
name: 'Administrer mes groupes',
|
||||||
link: 'admin',
|
link: 'admin',
|
||||||
show: show_my_groups,
|
show: show_my_groups,
|
||||||
icon: 'bi bi-box-arrow-up-right'
|
icon: 'bi bi-box-arrow-up-right'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: create_group_label,
|
name: create_group_label,
|
||||||
link: 'app_group_create',
|
link: 'app_group_create',
|
||||||
icon: create_group_icon,
|
icon: create_group_icon,
|
||||||
canCreateGroup: canCreateGroup,
|
canCreateGroup: canCreateGroup,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
icon: 'fa-solid fa-user-group'
|
icon: 'fa-solid fa-user-group'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
section: 'Compte',
|
section: 'Compte',
|
||||||
|
enable: true,
|
||||||
links: [
|
links: [
|
||||||
{
|
{
|
||||||
name: 'Mon adresse',
|
name: 'Mon adresse',
|
||||||
link: 'user_address_step1',
|
link: 'user_address_step1',
|
||||||
icon: null
|
icon: null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Modifier mon profil',
|
name: 'Modifier mon profil',
|
||||||
link: 'app_user_edit_profile',
|
link: 'app_user_edit_profile',
|
||||||
icon: null
|
icon: null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Changer mon adresse e-mail',
|
name: 'Changer mon adresse e-mail',
|
||||||
link: 'app_user_change_login',
|
link: 'app_user_change_login',
|
||||||
icon: null
|
icon: null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Changer mon mot de passe',
|
name: 'Changer mon mot de passe',
|
||||||
link: 'app_user_change_password',
|
link: 'app_user_change_password',
|
||||||
icon: null
|
icon: null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: vacation_mode_link,
|
name: vacation_mode_link,
|
||||||
link: 'user_toggle_vacation_mode',
|
link: 'user_toggle_vacation_mode',
|
||||||
icon: vacation_mode_icon
|
icon: vacation_mode_icon
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
icon: 'fa-solid fa-user fa-xl text-white'
|
icon: 'fa-solid fa-user fa-xl text-white'
|
||||||
},
|
},
|
||||||
] %}
|
] %}
|
||||||
|
|
@ -134,7 +138,7 @@
|
||||||
} %}
|
} %}
|
||||||
<div class="row flex-wrap">
|
<div class="row flex-wrap">
|
||||||
{% for my_account_link in my_account_links %}
|
{% for my_account_link in my_account_links %}
|
||||||
{% if my_account_link.disable is not defined %}
|
{% if my_account_link.enable %}
|
||||||
<div class="col-12 col-md-4">
|
<div class="col-12 col-md-4">
|
||||||
<nav class="myAccount d-flex flex-column mt-3 mt-md-5">
|
<nav class="myAccount d-flex flex-column mt-3 mt-md-5">
|
||||||
<div class="myAccount-header w-100 rounded-2">
|
<div class="myAccount-header w-100 rounded-2">
|
||||||
|
|
@ -144,42 +148,42 @@
|
||||||
<div class="myAccount-body pb-4">
|
<div class="myAccount-body pb-4">
|
||||||
{% for link in my_account_link.links %}
|
{% for link in my_account_link.links %}
|
||||||
{% if link.show ?? true %}
|
{% if link.show ?? true %}
|
||||||
<div class="mt-3 d-flex align-items-center">
|
<div class="mt-3 d-flex align-items-center">
|
||||||
{% if link.canCreateGroup is defined and not link.canCreateGroup %}
|
{% if link.canCreateGroup is defined and not link.canCreateGroup %}
|
||||||
<a
|
<a
|
||||||
href="mailto:{{ contactEmail ~ "?Subject=" ~ (i18n_prefix ~ '.mail.subject')|trans ~ "&body=" ~ (i18n_prefix ~ '.mail.mail_adress')|trans ~ "%0A" ~ (i18n_prefix ~ '.mail.group')|trans ~ "%0A" ~ (i18n_prefix ~ '.mail.type')|trans ~ "%0A" ~ (i18n_prefix ~ '.mail.membership')|trans ~ "%0A" ~ (i18n_prefix ~ '.mail.info')|trans }}"
|
href="mailto:{{ contactEmail ~ "?Subject=" ~ (i18n_prefix ~ '.mail.subject')|trans ~ "&body=" ~ (i18n_prefix ~ '.mail.mail_adress')|trans ~ "%0A" ~ (i18n_prefix ~ '.mail.group')|trans ~ "%0A" ~ (i18n_prefix ~ '.mail.type')|trans ~ "%0A" ~ (i18n_prefix ~ '.mail.membership')|trans ~ "%0A" ~ (i18n_prefix ~ '.mail.info')|trans }}"
|
||||||
class="text-decoration-none text-primary ms-2">
|
class="text-decoration-none text-primary ms-2">
|
||||||
{% if link.icon is not empty %}
|
|
||||||
<i class="{{ link.icon }} ~ me-1"></i>
|
|
||||||
{% endif %}
|
|
||||||
{{ link.name }}
|
|
||||||
</a>
|
|
||||||
{% else %}
|
|
||||||
{% if link.needAddress is defined and link.needAddress == true %}
|
|
||||||
{% include 'components/product/_modal.html.twig' with {
|
|
||||||
menu_action: true,
|
|
||||||
button: link.name,
|
|
||||||
title: (i18n_prefix ~ '.no-address-title')|trans,
|
|
||||||
message: (i18n_prefix ~ '.no-address-message')|trans({
|
|
||||||
'%product%': link.link == 'app_object_new' ? 'objet' : 'service'
|
|
||||||
}),
|
|
||||||
action: (i18n_prefix ~ '.no-address-add')|trans
|
|
||||||
} %}
|
|
||||||
{% else %}
|
|
||||||
<a href="{{ path(link.link) }}"
|
|
||||||
class="text-decoration-none text-primary ms-2 position-relative pe-1">
|
|
||||||
{% if link.icon is not empty %}
|
{% if link.icon is not empty %}
|
||||||
<i class="{{ link.icon }} ~ me-1"></i>
|
<i class="{{ link.icon }} ~ me-1"></i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ link.name }}
|
{{ link.name }}
|
||||||
{% if link.notification is defined and link.notification %}
|
|
||||||
<span
|
|
||||||
class="position-absolute top-0 start-100 translate-middle p-1 rounded-circle bg-danger"></span>
|
|
||||||
{% endif %}
|
|
||||||
</a>
|
</a>
|
||||||
|
{% else %}
|
||||||
|
{% if link.needAddress is defined and link.needAddress == true %}
|
||||||
|
{% include 'components/product/_modal.html.twig' with {
|
||||||
|
menu_action: true,
|
||||||
|
button: link.name,
|
||||||
|
title: (i18n_prefix ~ '.no-address-title')|trans,
|
||||||
|
message: (i18n_prefix ~ '.no-address-message')|trans({
|
||||||
|
'%product%': link.link == 'app_object_new' ? 'objet' : 'service'
|
||||||
|
}),
|
||||||
|
action: (i18n_prefix ~ '.no-address-add')|trans
|
||||||
|
} %}
|
||||||
|
{% else %}
|
||||||
|
<a href="{{ path(link.link) }}"
|
||||||
|
class="text-decoration-none text-primary ms-2 position-relative pe-1">
|
||||||
|
{% if link.icon is not empty %}
|
||||||
|
<i class="{{ link.icon }} ~ me-1"></i>
|
||||||
|
{% endif %}
|
||||||
|
{{ link.name }}
|
||||||
|
{% if link.notification is defined and link.notification %}
|
||||||
|
<span
|
||||||
|
class="position-absolute top-0 start-100 translate-middle p-1 rounded-circle bg-danger"></span>
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
</div>
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue