{% extends 'base.html.twig' %}
{% block title %}
{% endblock %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('css/detail-formation.css') }}" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
{% endblock %}
{% block body %}
<div class="section-about" id="section-about">
<div class="section-gallery">
<div class="container position">
<div class="depo-formation position-relative">
<div class="alert note-position note-size">
<p class="card-text note-color text-center">
{% if averageStars[service.id][0]['averageStars'] is not null %}
<span class="size-rated">{{ averageStars[service.id][0]['averageStars']|number_format(1) }}</span>/5
{% else %}
<span>{% trans %}rating.not_rated{% endtrans %}</span>
{% endif %}
</p>
<p class="card-text note-color text-center {{ app.request.locale == 'ar_TN' ? 'form_direction_rtl' : 'form_direction_ltr' }}">
{% if averageStars[service.id][0]['demandeCount'] and averageStars[service.id][0]['demandeCount'] == 1 %}
{{ averageStars[service.id][0]['demandeCount'] }} {% trans %}rating.avissingle{% endtrans %}
{% elseif averageStars[service.id][0]['demandeCount'] and averageStars[service.id][0]['demandeCount'] != 1 %}
{{ averageStars[service.id][0]['demandeCount'] }} {% trans %}rating.avismultiple{% endtrans %}
{% endif %}
</p>
</div>
<div class="row pb-5">
<div class="col-md-12 text-center p-5">
<b><h5 class="card-title">{{ service.axe }}</h5></b>
</div>
</div>
<div class="box"></div>
<div class="card-body {{ app.request.locale == 'ar_TN' ? 'form_direction_rtl' : 'form_direction_ltr' }}">
<p class="card-text">{{ service.description|raw }}</p>
<p class="card-text">
{% for rubrique in service.rubriques %}
{% if rubrique.isShowable %}
<h4>
{{ rubrique.libelle }}
:
</h4>
{% endif %}
<ul>
<b id="offre">{% trans %}services.details.offre{% endtrans %}:</b>
{% for prestation in rubrique.prestations %}
<li id="base-formation">
{{ prestation.libelle }}
{% if prestation.modules %}
<ul id="formation">
{% for module in prestation.modules %}
{% if module.isShowable %}
<li>
<details onload>
<summary>
{{ module.label }}
{% if module.file %}
<p style="margin-top: -23px;">
<a href="/upload/modules/{{ module.file }}"><i class="fa-solid fa-file-arrow-down"></i></a>
</p>
{% endif %}
</summary>
{% if module.description %}
<div class="content">
<p>{{ (module.description ? ' ' ~ module.description : '')|raw }}</p>
</div>
{% endif %}
</details>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
{% endfor %}
</p>
</div>
{% if true == isAllowed %}
<div class="col-md-4 text-right">
<a href="{{ path('new_demande', { serviceId: service.id, demandeId: 0 }) }}"><button class="btn-slider-text">{% trans %}services.details.deposer{% endtrans %}</button></a>
</div>
{% elseif true == isShowable %}
<div class="col-md-4 text-right">
<a href="javascript:void(0)" id="btn-demande-service"><button class="btn-slider-text">{% trans %}services.details.deposer{% endtrans %}</button></a>
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block javascripts %}
<script>
$(document).ready(function () {
$.ajax({
url: "{{ path('count_command_article_by_user') }}",
type: 'GET',
dataType: 'json',
success: function (response) {
if (response.count > 0) {
$('#notifCartSpan').html(`<i id="notifCart" aria-hidden="true"
style=" padding-left: -70px !important; font-size: 12px;"><strong style="color:white !important">${response.count}</strong></i>`)
} else {
$('#notifCartSpan').html('')
}
}
})
})
$(document).ready(function () {
$.ajax({
url: "{{ path('count_notification_by_user') }}",
type: 'GET',
dataType: 'json',
success: function (response) {
if (response.count > 0) {
$('.notification_count').html(`<strong class="notification-dot" >${response.count}</strong>`)
} else {
$('.notification_count').html('')
}
}
})
})
window.onload = (event) => {
if (module.description) {
console.log('La page est complètement chargée');
}
};
</script>
<script>
{% if app.user %}
$('#btn-demande-service').click(function () {
Swal.fire({icon: 'warning', title: '{{ 'attention.title'|trans }}', text: '{{ isNotAllowedMessage }}'});
});
{% else %}
$('#btn-demande-service').click(function () {
Swal.fire( {
icon: 'warning',
title: '{{ 'attention.title'|trans }}...',
text: '{{ isNotAllowedMessage }}',
}).then((result) => {
if (result.isConfirmed) {
location.href = "{{ path( 'login', { 'prevRoute' : 'show_service_detail', 'id' : service.id } ) }}";
}
});
});
{% endif %}
</script>
{% endblock %}