Skip to content

Commit

Permalink
Refactoring : séparer Dashboard & Siaes (#892)
Browse files Browse the repository at this point in the history
* Refactoring: split Dashboard & DashboardSiaes
  • Loading branch information
raphodn authored Sep 4, 2023
1 parent 5406f22 commit f4f6147
Show file tree
Hide file tree
Showing 25 changed files with 889 additions and 867 deletions.
1 change: 1 addition & 0 deletions config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
path("besoins/", include("lemarche.www.tenders.urls")),
path("prestataires/", include("lemarche.www.siaes.urls")),
path("profil/", include("lemarche.www.dashboard.urls")),
path("profil/prestataires/", include("lemarche.www.dashboard_siaes.urls")),
path("profil/reseaux/", include("lemarche.www.dashboard_networks.urls")),
path("profil/listes-dachats/", include("lemarche.www.dashboard_favorites.urls")),
path("select2/", include("django_select2.urls")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.utils import timezone

from lemarche.siaes.models import SiaeUserRequest
from lemarche.www.dashboard.tasks import (
from lemarche.www.dashboard_siaes.tasks import (
send_siae_user_request_reminder_3_days_emails,
send_siae_user_request_reminder_8_days_emails,
)
Expand Down
2 changes: 1 addition & 1 deletion lemarche/siaes/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def send_completion_reminder_email_to_siae(siae):
"SIAE_USER_FIRST_NAME": siae_user.first_name,
"SIAE_NAME": siae.name_display,
"SIAE_URL": get_share_url_object(siae),
"SIAE_EDIT_URL": f"https://{get_domain_url()}{reverse_lazy('dashboard:siae_edit_contact', args=[siae.slug])}", # noqa
"SIAE_EDIT_URL": f"https://{get_domain_url()}{reverse_lazy('dashboard_siaes:siae_edit_contact', args=[siae.slug])}", # noqa
}

api_mailjet.send_transactional_email_with_template(
Expand Down
2 changes: 1 addition & 1 deletion lemarche/templates/dashboard/_add_siae_card.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Ajoutez votre première structure afin d'être visible auprès des acheteurs qui consultent le marché.
Complétez au maximum les informations vous permettra de remonter dans les résultats de recherche.
</p>
<a href="{% url 'dashboard:siae_search_by_siret' %}" id="add-siae-first-btn" class="btn btn-primary btn-ico width-100 width-md-auto">
<a href="{% url 'dashboard_siaes:siae_search_by_siret' %}" id="add-siae-first-btn" class="btn btn-primary btn-ico width-100 width-md-auto">
<i class="ri-add-fill ri-lg"></i>
<span>Ajouter une structure</span>
</a>
Expand Down
4 changes: 2 additions & 2 deletions lemarche/templates/dashboard/_siae_tab_content.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ <h2 class="mb-0">{{ siae.name_display }}</h2>
{% include "includes/_completion_progress_bar.html" with completion_percent=siae.completion_percent %}
</div>
<div class="col-12 col-md-auto ml-auto d-flex flex-column">
<a href="{% url 'dashboard:siae_edit' siae.slug %}" id="dashboard-siae-edit-btn" class="btn btn-important btn-sm btn-ico mb-2">
<a href="{% url 'dashboard_siaes:siae_edit' siae.slug %}" id="dashboard-siae-edit-btn" class="btn btn-important btn-sm btn-ico mb-2">
<i class="ri-pencil-fill ri-lg"></i>
<span>Compléter votre fiche</span>
</a>
<a href="{% url 'siae:detail' siae.slug %}" target="_blank" id="dashboard-siae-view-btn" class="btn btn-outline-primary btn-sm btn-ico mb-2">
<i class="ri-eye-line ri-lg"></i>
<span>Voir votre fiche</span>
</a>
<a href="{% url 'dashboard:siae_users' siae.slug %}" id="dashboard-siae-edit-btn" class="btn btn-outline-primary btn-sm btn-ico">
<a href="{% url 'dashboard_siaes:siae_users' siae.slug %}" id="dashboard-siae-edit-btn" class="btn btn-outline-primary btn-sm btn-ico">
<i class="ri-group-line ri-lg"></i>
<span>Collaborateurs ({{ siae.user_count }})</span>
</a>
Expand Down
2 changes: 1 addition & 1 deletion lemarche/templates/dashboard/home_siae.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h1 class="s-title-01__title h1"><strong>Tableau de bord</strong></h1>
</li>
{% endfor %}
<li class="nav-item" role="presentation">
<a class="nav-link" id="add-siae-btn" href="{% url 'dashboard:siae_search_by_siret' %}" aria-selected="false">
<a class="nav-link" id="add-siae-btn" href="{% url 'dashboard_siaes:siae_search_by_siret' %}" aria-selected="false">
<i class="ri-add-line"></i>
<span>Ajouter une structure</span>
</a>
Expand Down
18 changes: 9 additions & 9 deletions lemarche/templates/dashboard/siae_edit_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@
</p>
<ol class="mb-0">
{% if not siae.sector_count %}
<li><a href="{% url 'dashboard:siae_edit_search' siae.slug %}">Ajoutez un ou plusieurs secteurs d'activité</a></li>
<li><a href="{% url 'dashboard_siaes:siae_edit_search' siae.slug %}">Ajoutez un ou plusieurs secteurs d'activité</a></li>
{% endif %}
{% if not siae.description and not siae.logo_url %}
<li><a href="{% url 'dashboard:siae_edit_info' siae.slug %}">Ajoutez une description & votre logo</a></li>
<li><a href="{% url 'dashboard_siaes:siae_edit_info' siae.slug %}">Ajoutez une description & votre logo</a></li>
{% endif %}
{% if not siae.offer_count and not siae.client_reference_count %}
<li><a href="{% url 'dashboard:siae_edit_offer' siae.slug %}">Détaillez vos offres & vos références clients</a></li>
<li><a href="{% url 'dashboard_siaes:siae_edit_offer' siae.slug %}">Détaillez vos offres & vos références clients</a></li>
{% endif %}
{% if siae.is_missing_contact %}
<li><a href="{% url 'dashboard:siae_edit_contact' siae.slug %}">Complétez vos informations de contact</a></li>
<li><a href="{% url 'dashboard_siaes:siae_edit_contact' siae.slug %}">Complétez vos informations de contact</a></li>
{% endif %}
</ol>
</div>
Expand All @@ -70,27 +70,27 @@
<div class="s-tabs-01__col col-12">
<ul class="s-tabs-01__nav nav nav-tabs" role="tablist">
<li class="nav-item" role="presentation">
<a href="{% url 'dashboard:siae_edit_contact' siae.slug %}#editTabs" id="siae-edit-contact-tab" class="nav-link {% if 'siae_edit_contact' in request.resolver_match.url_name %}active{% endif %}" aria-selected="{% if 'siae_edit_contact' in request.resolver_match.url_name %}true{% else %}false{% endif %}">
<a href="{% url 'dashboard_siaes:siae_edit_contact' siae.slug %}#editTabs" id="siae-edit-contact-tab" class="nav-link {% if 'siae_edit_contact' in request.resolver_match.url_name %}active{% endif %}" aria-selected="{% if 'siae_edit_contact' in request.resolver_match.url_name %}true{% else %}false{% endif %}">
Votre contact commercial
</a>
</li>
<li class="nav-item" role="presentation">
<a href="{% url 'dashboard:siae_edit_search' siae.slug %}#editTabs" id="siae-edit-search-tab" class="nav-link {% if 'siae_edit_search' in request.resolver_match.url_name %}active{% endif %}" aria-selected="{% if 'siae_edit_search' in request.resolver_match.url_name %}true{% else %}false{% endif %}">
<a href="{% url 'dashboard_siaes:siae_edit_search' siae.slug %}#editTabs" id="siae-edit-search-tab" class="nav-link {% if 'siae_edit_search' in request.resolver_match.url_name %}active{% endif %}" aria-selected="{% if 'siae_edit_search' in request.resolver_match.url_name %}true{% else %}false{% endif %}">
Votre référencement
</a>
</li>
<li class="nav-item" role="presentation">
<a href="{% url 'dashboard:siae_edit_info' siae.slug %}#editTabs" id="siae-edit-info-tab" class="nav-link {% if 'siae_edit_info' in request.resolver_match.url_name %}active{% endif %}" aria-selected="{% if 'siae_edit_info' in request.resolver_match.url_name %}true{% else %}false{% endif %}">
<a href="{% url 'dashboard_siaes:siae_edit_info' siae.slug %}#editTabs" id="siae-edit-info-tab" class="nav-link {% if 'siae_edit_info' in request.resolver_match.url_name %}active{% endif %}" aria-selected="{% if 'siae_edit_info' in request.resolver_match.url_name %}true{% else %}false{% endif %}">
Votre structure
</a>
</li>
<li class="nav-item" role="presentation">
<a href="{% url 'dashboard:siae_edit_offer' siae.slug %}#editTabs" id="siae-edit-offer-tab" class="nav-link {% if 'siae_edit_offer' in request.resolver_match.url_name %}active{% endif %}" aria-selected="{% if 'siae_edit_offer' in request.resolver_match.url_name %}true{% else %}false{% endif %}">
<a href="{% url 'dashboard_siaes:siae_edit_offer' siae.slug %}#editTabs" id="siae-edit-offer-tab" class="nav-link {% if 'siae_edit_offer' in request.resolver_match.url_name %}active{% endif %}" aria-selected="{% if 'siae_edit_offer' in request.resolver_match.url_name %}true{% else %}false{% endif %}">
Vos offres commerciales
</a>
</li>
<li class="nav-item" role="presentation">
<a href="{% url 'dashboard:siae_edit_links' siae.slug %}#editTabs" id="siae-edit-links-tab" class="nav-link {% if 'siae_edit_links' in request.resolver_match.url_name %}active{% endif %}" aria-selected="{% if 'siae_edit_links' in request.resolver_match.url_name %}true{% else %}false{% endif %}">
<a href="{% url 'dashboard_siaes:siae_edit_links' siae.slug %}#editTabs" id="siae-edit-links-tab" class="nav-link {% if 'siae_edit_links' in request.resolver_match.url_name %}active{% endif %}" aria-selected="{% if 'siae_edit_links' in request.resolver_match.url_name %}true{% else %}false{% endif %}">
Groupements
</a>
</li>
Expand Down
4 changes: 2 additions & 2 deletions lemarche/templates/dashboard/siae_search_adopt_confirm.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'wagtail_serve' '' %}">Accueil</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:home' %}">Tableau de bord</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard:siae_search_by_siret' %}">Rechercher ma structure</a></li>
<li class="breadcrumb-item"><a href="{% url 'dashboard_siaes:siae_search_by_siret' %}">Rechercher ma structure</a></li>
<li class="breadcrumb-item active" aria-current="page">Vérifier ma structure</li>
</ol>
</nav>
Expand Down Expand Up @@ -92,7 +92,7 @@ <h2 class="h1 mb-3 mb-lg-5"><strong>Dernière vérification</strong></h2>
{% csrf_token %}
<div class="row justify-content-end">
<div class="col-12 col-md-auto pr-lg-2">
<a href="{% url 'dashboard:siae_search_by_siret' %}" class="btn btn-outline-primary btn-block">
<a href="{% url 'dashboard_siaes:siae_search_by_siret' %}" class="btn btn-outline-primary btn-block">
Non, refaire une recherche
</a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions lemarche/templates/dashboard/siae_search_by_siret.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h1><strong>Ma structure</strong></h1>
<p class="lead mb-0">Recherchez la structure à laquelle vous êtes attaché.</p>
<p class="mb-3 mb-lg-5">Si vous en avez plusieurs, vous aurez la possibilité de spécifier d'autres structures par la suite.</p>

<form method="GET" action="{% url 'dashboard:siae_search_by_siret' %}">
<form method="GET" action="{% url 'dashboard_siaes:siae_search_by_siret' %}">
{% bootstrap_form_errors form type="all" %}
<label class="mb-2 d-inline-block font-weight-bold required" for="id_siret">Entrez le numéro SIRET ou SIREN de votre structure</label>
<div class="form-row">
Expand Down Expand Up @@ -71,7 +71,7 @@ <h2>{{ siaes.count }} structure{% if siaes.count > 1 %}s{% endif %} trouvée{% i
</div>
<div class="col text-right">
<br />
<a href="{% url 'dashboard:siae_search_adopt_confirm' siae.slug %}" class="btn btn-outline-primary">
<a href="{% url 'dashboard_siaes:siae_search_adopt_confirm' siae.slug %}" class="btn btn-outline-primary">
<span>Sélectionner</span>
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion lemarche/templates/siaes/_siae_user_delete_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h3 class="modal-title" id="modalTitle">Supprimer le collaborateur</h3>
<i class="ri-close-line"></i>
</button>
</div>
<form method="POST" action="{% url 'dashboard:siae_user_delete' 'siae-slug-to-replace' 'siae-user-id-to-replace' %}">
<form method="POST" action="{% url 'dashboard_siaes:siae_user_delete' 'siae-slug-to-replace' 'siae-user-id-to-replace' %}">
{% csrf_token %}
<div class="modal-body home-content-body">
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h3 class="modal-title" id="modalTitle">Refuser la demande</h3>
<i class="ri-close-line"></i>
</button>
</div>
<form method="POST" action="{% url 'dashboard:siae_user_request_cancel' 'siae-slug-to-replace' 'siae-user-request-id-to-replace' %}">
<form method="POST" action="{% url 'dashboard_siaes:siae_user_request_cancel' 'siae-slug-to-replace' 'siae-user-request-id-to-replace' %}">
{% csrf_token %}
<div class="modal-body home-content-body">
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h3 class="modal-title" id="modalTitle">Accepter la demande</h3>
<i class="ri-close-line"></i>
</button>
</div>
<form method="POST" action="{% url 'dashboard:siae_user_request_confirm' 'siae-slug-to-replace' 'siae-user-request-id-to-replace' %}">
<form method="POST" action="{% url 'dashboard_siaes:siae_user_request_confirm' 'siae-slug-to-replace' 'siae-user-request-id-to-replace' %}">
{% csrf_token %}
<div class="modal-body home-content-body">
<p>
Expand Down
2 changes: 1 addition & 1 deletion lemarche/templates/tenders/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
<strong>Comment contacter le client ?</strong>
</p>
<p class="mb-0">
Pour accéder aux coordonnées du client, veuillez d'abord vous <a id="add-siae-btn" href="{% url 'dashboard:siae_search_by_siret' %}">rattacher à votre structure</a>.
Pour accéder aux coordonnées du client, veuillez d'abord vous <a id="add-siae-btn" href="{% url 'dashboard_siaes:siae_search_by_siret' %}">rattacher à votre structure</a>.
</p>
<p>
Besoin d'aide ? contacter le support via le chat en ligne qui se trouve en bas à droite.
Expand Down
4 changes: 2 additions & 2 deletions lemarche/utils/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def track(page: str = "", action: str = "load", meta: dict = {}): # noqa B006
user_kind = meta.get("user_type") if meta.get("user_type", "") else ""
siae_id = meta.get("siae_id", None)
if siae_id:
siae_id = int(siae_id[0]) if (type(siae_id) == list) else int(siae_id)
siae_id = int(siae_id[0]) if (type(siae_id) is list) else int(siae_id)
siae_kind = meta.get("siae_kind") if meta.get("siae_kind", "") else ""
siae_contact_email = meta.get("siae_contact_email") if meta.get("siae_contact_email", "") else ""

Expand Down Expand Up @@ -131,7 +131,7 @@ def track_page(self, page, request: HttpRequest, response: HttpResponse):
else None
)

elif page == reverse("dashboard:siae_search_by_siret"): # adopted search action
elif page == reverse("dashboard_siaes:siae_search_by_siret"): # adopted search action
action = "adopt_search"

elif page in (reverse("pages:impact_calculator"),):
Expand Down
2 changes: 1 addition & 1 deletion lemarche/www/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def get_success_message(self, cleaned_data):
if cleaned_data["kind"] == User.KIND_SIAE:
success_message += mark_safe(
"<br />Vous pouvez maintenant ajouter votre structure en cliquant sur "
f"<a href=\"{reverse_lazy('dashboard:siae_search_by_siret')}\">Ajouter une structure</a>."
f"<a href=\"{reverse_lazy('dashboard_siaes:siae_search_by_siret')}\">Ajouter une structure</a>."
)
return success_message

Expand Down
Loading

0 comments on commit f4f6147

Please sign in to comment.