Commit d30ccaea by Yvon Kerdoncuff

Merge branch '5647-show-prestataire-info' into 'ssa-gironde'

show presta extra data (products and conventionnement) if param activated

See merge request cooperatic/kohinos-tav!59
parents 95e2b8dd d05f4c3d
...@@ -13,3 +13,4 @@ twig: ...@@ -13,3 +13,4 @@ twig:
globals: globals:
tav_env: '%env(TAV_ENV)%' tav_env: '%env(TAV_ENV)%'
presta_self_init_and_eval: '%env(PRESTA_SELF_INIT_AND_EVAL)%' presta_self_init_and_eval: '%env(PRESTA_SELF_INIT_AND_EVAL)%'
presta_extra_data: '%env(PRESTA_EXTRA_DATA)%'
\ No newline at end of file
...@@ -43,15 +43,19 @@ class PrestatairesController extends FrontController ...@@ -43,15 +43,19 @@ class PrestatairesController extends FrontController
return new RedirectResponse($this->router->generate('index')); return new RedirectResponse($this->router->generate('index'));
} }
$templateData = ['presta' => $prestataire];
// If feature activated, display self evaluation form
if ($this->getParameter('presta_self_init_and_eval') == true) {
$quiz = $prestataire->getSelfEvalPrestaQuiz(); $quiz = $prestataire->getSelfEvalPrestaQuiz();
$formClass = Prestataire::DISTRIBUTOR === $prestataire->getMarketChannelFunction() ? $formClass = Prestataire::DISTRIBUTOR === $prestataire->getMarketChannelFunction() ?
DistributorSelfEvalPrestaQuizType::class : ProducerSelfEvalPrestaQuizType::class; DistributorSelfEvalPrestaQuizType::class : ProducerSelfEvalPrestaQuizType::class;
$form = $this->createForm($formClass, $quiz, ["mode" => SelfEvalPrestaQuizType::READONLY]); $form = $this->createForm($formClass, $quiz, ["mode" => SelfEvalPrestaQuizType::READONLY]);
return $this->render('@kohinos/presta/show.html.twig', [ $templateData['form'] = $form->createView();
'presta' => $prestataire, }
'form' => $form->createView()
]); return $this->render('@kohinos/presta/show.html.twig', $templateData);
} }
/** /**
......
...@@ -50,6 +50,9 @@ ...@@ -50,6 +50,9 @@
{% if presta.web != null %} {% if presta.web != null %}
<h6 class="card-subtitle mb-3">{{'Site web'|trans}} : <a href='{{ presta.web }}' target='_blank' rel='noopener noreferrer'>{{ presta.web }}</a></h6> <h6 class="card-subtitle mb-3">{{'Site web'|trans}} : <a href='{{ presta.web }}' target='_blank' rel='noopener noreferrer'>{{ presta.web }}</a></h6>
{% endif %} {% endif %}
{% if presta_extra_data and presta.conventionnement != null and presta.conventionnement > 0 %}
<h6 class="card-subtitle mb-3">{{'Pourcentage de conventionnement'|trans}} : {{ presta.conventionnement * 100 }}%</h6>
{% endif %}
{# {% if presta.responsable != null and presta.metier != null %} {# {% if presta.responsable != null and presta.metier != null %}
<h6 class="card-title my-3">Responsable : {{ presta.responsable }} ({{ presta.metier }})</h6> <h6 class="card-title my-3">Responsable : {{ presta.responsable }} ({{ presta.metier }})</h6>
{% endif %} #} {% endif %} #}
...@@ -77,9 +80,21 @@ ...@@ -77,9 +80,21 @@
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}
{% if presta_extra_data and presta.prestataireProductFamilies|length > 0%}
<div class="card-header"><h2>{{ 'Produits vendus'|trans }}</h2></div>
<ul class="list-group list-group-flush">
{% for prestataireProductFamily in presta.prestataireProductFamilies %}
{% if prestataireProductFamily.products|length > 0%}
<li class="list-group-item">
{{ prestataireProductFamily.productFamily.name }}
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% if app.user and presta_self_init_and_eval and presta.selfEvalPrestaQuiz %} {% if app.user and presta_self_init_and_eval and presta.selfEvalPrestaQuiz %}
{% set prestataire = presta %} {% set prestataire = presta %}
<div class="card-header"><h2>Questionnaire</h2></div> <div class="card-header"><h2>{{ 'Questionnaire'|trans }}</h2></div>
<div class="card-body"> <div class="card-body">
{% if presta.marketChannelFunction == 'distributor' %} {% if presta.marketChannelFunction == 'distributor' %}
{% include '@kohinos/tav/prestaquiz/distributor_core.html.twig' %} {% include '@kohinos/tav/prestaquiz/distributor_core.html.twig' %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment