Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Affichage des Siaes] Ajout du badge visuel des super esi #1068

Merged
merged 9 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions lemarche/static/itou_marche/sections/_siae.scss
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,29 @@
}
}


$super-badge-color: #ffbe18;

.super-badge-card {
border: 1px solid $super-badge-color;
}
.super-badge-badge {
padding: 2px 6px;
background: linear-gradient(0deg, #fff7e0, #fff7e0), linear-gradient(0deg, $super-badge-color, $super-badge-color);
border: 1px solid $super-badge-color;
gap: 4px;
//styleName: Mentions/fs-xs + bold;
font-size: 12px;
font-weight: 700;
line-height: 20px;
letter-spacing: 0px;
text-align: left;
}

.super-badge-tab {
border-color: $super-badge-color !important;
}

// TODO: integrate to the theme
$purple-marche: #6C38D9;

Expand Down
14 changes: 13 additions & 1 deletion lemarche/static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,19 @@ window.addEventListener('DOMContentLoaded', function () {
location.href = "mailto:?" + rot13(this.dataset['nextUrl']);
});

initModalMessages()
initModalMessages();

$('.s-tabs-01__nav .nav-item').on('click', function (event) {
event.preventDefault()
let tabContent = $($(this).parents()[1]).find(".tab-content")[0];

if ($(this).children()[0].classList.contains("super-badge-tab")) {
tabContent.classList.add("super-badge-tab");
} else {
tabContent.classList.remove("super-badge-tab");
}
$(this).tab('show')
})
});

let toggleRequiredClasses = (toggle, element) => {
Expand Down
16 changes: 12 additions & 4 deletions lemarche/templates/dashboard/_siae_tab_content.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@

<div class="row">
<div class="col-12 col-md-7">
<div class="d-flex align-items-center mb-3">
<span class="mr-3">
<div class="row mb-3">
<div class="col-auto">
{% if siae.logo_url %}
<img class="img-fluid" style="width:50px" src="{{ siae.logo_url }}" alt="Logo de la structure {{ siae.name }}" loading="lazy" />
{% else %}
<img class="img-fluid" style="width:50px" src="{% static 'img/default-listing.png' %}" alt="{{ siae.name }}" loading="lazy" />
{% endif %}
</span>
<h2 class="mb-0">{{ siae.name_display }}</h2>
</div>
<div class="col">
<h2 class="mb-0">{{ siae.name_display }}</h2>
{% if siae.super_badge %}
<span class="badge badge-base rounded-pill super-badge-badge text-primary mt-2 font-weight-bold">
<i class="ri-award-fill mr-1"></i>
Super prestataire
</span>
{% endif %}
</div>
</div>
{% include "includes/_completion_progress_bar.html" with completion_percent=siae.completion_rate_calculated %}
</div>
Expand Down
18 changes: 11 additions & 7 deletions lemarche/templates/dashboard/home_siae.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h1 class="s-title-01__title h1"><strong>Tableau de bord</strong></h1>
<ul class="s-tabs-01__nav nav nav-tabs" role="tablist">
{% for siaeuser in user.siaeuser_set.all %}
<li class="nav-item" role="presentation">
<a class="nav-link {% if forloop.first %}active{% endif %}" id="{{ siaeuser.siae.slug }}-tab" data-toggle="tab" href="#{{ siaeuser.siae.slug }}" role="tab" aria-controls="{{ siaeuser.siae.slug }}" aria-selected="{% if forloop.first %}true{% else %}false{% endif %}">
<a class="nav-link {% if forloop.first %}active{% endif %} {% if siaeuser.siae.super_badge %}super-badge-tab{% endif %}" id="{{ siaeuser.siae.slug }}-tab" data-toggle="tab" href="#{{ siaeuser.siae.slug }}" role="tab" aria-controls="{{ siaeuser.siae.slug }}" aria-selected="{% if forloop.first %}true{% else %}false{% endif %}">
<span class="mr-2">
{% if siaeuser.siae.logo_url %}
<img class="img-fluid" style="width:20px" src="{{ siaeuser.siae.logo_url }}" alt="Logo de la structure {{ siaeuser.siae.name }}" loading="lazy" />
Expand All @@ -64,13 +64,17 @@ <h1 class="s-title-01__title h1"><strong>Tableau de bord</strong></h1>
</li>
</ul>
{% if user.siaeuser_set.count %}
<div class="tab-content">
{% for siaeuser in user.siaeuser_set.all %}
<div class="tab-pane fade {% if forloop.first %}show active{% endif %}" id="{{ siaeuser.siae.slug }}" role="tabpanel" aria-labelledby="{{ siaeuser.siae.slug }}-tab">
{% include "dashboard/_siae_tab_content.html" with siae=siaeuser.siae %}
{% for siaeuser in user.siaeuser_set.all %}
{% if forloop.first %}
<div class="tab-content {% if siaeuser.siae.super_badge %}super-badge-tab{% endif %}">
{% endif %}
<div class="tab-pane fade {% if forloop.first %}show active{% endif %}" id="{{ siaeuser.siae.slug }}" role="tabpanel" aria-labelledby="{{ siaeuser.siae.slug }}-tab">
{% include "dashboard/_siae_tab_content.html" with siae=siaeuser.siae %}
</div>
{% if forloop.last %}
</div>
{% endfor %}
</div>
{% endif %}
{% endfor %}
{% endif %}
</div>
</div>
Expand Down
13 changes: 9 additions & 4 deletions lemarche/templates/siaes/_card_detail.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load static %}

<div class="card c-card c-card--hovershadow siae-card">
<div class="card c-card c-card--hovershadow siae-card {% if siae.super_badge %}super-badge-card{% endif %}">
<div class="card-header">
<div class="row">
<div class="col-auto">
Expand All @@ -13,11 +13,16 @@
<div class="col">
<div class="row">
<div class="col-sm-12">
<h1 class="h2 mb-2">
<h1 class="h2 mb-1">
{{ siae.name_display }}
<br />
<small>(Dernière activité il y a {{ siae.latest_activity_at|timesince }})</small>
</h1>
{% if siae.super_badge %}
<span class="badge badge-base rounded-pill super-badge-badge text-primary mt-2 font-weight-bold">
<i class="ri-award-fill mr-1"></i>
Super prestataire
</span>
{% endif %}
<p class="mt-3 mb-1 font-italic">(Dernière activité il y a {{ siae.latest_activity_at|timesince }})</p>
{% if user.is_authenticated %}
{% if siae.in_user_favorite_list_count_annotated %}
<a href="#" id="favorite-remove-modal-btn" class="btn btn-favorite" data-toggle="modal" data-target="#favorite_item_remove_modal" title="Dans votre liste d'achat">
Expand Down
8 changes: 7 additions & 1 deletion lemarche/templates/siaes/_card_search_result.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load static siae_sectors_display %}
{% load theme_inclusion %}

<div class="card c-card c-card--hovershadow siae-card">
<div class="card c-card c-card--hovershadow siae-card {% if siae.super_badge %}super-badge-card{% endif %}">
<div class="card-header">
<div class="row">
<div class="col-auto">
Expand All @@ -18,6 +18,12 @@ <h2 class="h4 mb-0">
<span class="fs-sm font-weight-normal">(bientôt inscrite sur le marché)</span>
{% endif %}
</h2>
{% if siae.super_badge %}
<span class="badge badge-base rounded-pill super-badge-badge text-primary mt-2 font-weight-bold">
<i class="ri-award-fill mr-1"></i>
Super prestataire
</span>
{% endif %}
</div>
</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion lemarche/templates/siaes/_card_tender.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load static %}

<div class="card c-card c-card--marche siae-card">
<div class="card c-card siae-card super-esi-card {% if siae.super_badge %}super-badge-card{% endif %}">
<div class="card-header">
<div class="row">
<div class="col-auto">
Expand All @@ -12,6 +12,12 @@
</div>
<div class="col">
<h2 class="h4 mb-0">{{ siae.name_display }}</h2>
{% if siae.super_badge %}
madjid-asa marked this conversation as resolved.
Show resolved Hide resolved
<span class="badge badge-base rounded-pill super-badge-badge text-primary mt-2 font-weight-bold">
<i class="ri-award-fill mr-1"></i>
Super prestataire
</span>
{% endif %}
</div>
</div>
</div>
Expand Down
Loading