{# DON'T ADD MODAL TEMPLATE IN THIS FILE #}
{% set id_step = 0 %}
<div id="scrollbox" class="workflow col-12 pt-12 pb-8 {% if mission.state == 'archived' or mission.state == 'validated' or mission.state == 'provisional' %}overlay overlay-block{% endif%}">
{% if mission.workflow is not empty %}
{% set number_of_all_steps = mission.workflow.steps|length - 1 %}
{% for step in mission.workflow.steps |sort((a, b) => a.position - b.position) %}
<div class="step-workflow position-relative">
{% if step.active and id_step != 0 %}
<svg width="32" class="mb-5" height="32" viewbox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_2236_2734)">
<path class="check" d="M11.1666 17L14.1666 20L21.1666 13" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M16.1666 28C22.794 28 28.1666 22.6274 28.1666 16C28.1666 9.37258 22.794 4 16.1666 4C9.53921 4 4.16663 9.37258 4.16663 16C4.16663 22.6274 9.53921 28 16.1666 28Z" stroke="#667085" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_2236_2734">
<rect width="32" height="32" fill="white" transform="translate(0.166626)"/>
</clipPath>
</defs>
</svg>
{% endif %}
<div class=" step-{{ id_step }}" {% if step.active %} id="activescrollto" {% endif %}>
<div class="cadre-step-workflow d-flex align-items-center {% if step.active %}active{% endif %} " style="padding: 5px 8px;{% if step.active %}box-shadow:none;{% endif %}">
{% if not step.active and (is_granted('ROLE_ADMIN')) %}
<a style="display: flex;align-items: center;
" class="text-white admin" href="{{ path('workflow_jump_step', {'step': step.id, 'workflow': step.workflow.id}) }}" onclick="return confirm('Êtes-vous sûr de vouloir effectuer cette mise à jour ?');">
{% endif %}
<div class="planning-name-step" style="color: #344054;font-size: 14px;{% if step.active %}color: #fff !important;{% endif %}">
{{ step.name }}
{% if step.active %}
{# time_remaining_step is in App\Twig\StepTwig.php #}
{% set time_remaining = step|time_remaining_step %}
{% set label = time_remaining > 1 ? " jours ouvrés" : " jour ouvré" %}
{# <p style="margin: 0;font-size: 12px;font-weight: initial;">(Echéance pour cette étape : {{ time_remaining != "date-start-missed" ? time_remaining ~ label : "Information indisponible"}} )</p> #}
{% endif %}
</div>
{% set users_responsable = users_responsable_current_step(mission,step) %}
{% if users_responsable|length > 0 %}
{% set first_users_responsable = users_responsable[0] %}
<div class="content-step-description position-relative">
{% if users_responsable|length > 1 %}
<span class="number-user-responsable">
+{{users_responsable|length - 1}}
</span>
{% endif %}
{% set url = vich_uploader_asset(users_responsable[0], 'picture') %}
<div class="content-step-responsable d-flex justify-content-center align-items-center" style="background-image : url({{url}});background-color: white;color: #1668cc;border-radius: 50%;">
{% if not url %}
{{ first_users_responsable.firstname|slice(0,1)|upper }}{{ first_users_responsable.lastname|slice(0,1)|upper }}
{% endif %}
</div>
</div>
{% endif %}
{% if not step.active and is_granted('ROLE_ADMIN') %}
</a>
{# à mettre en dynamique #}
{# {% if not step.active %}
<div class="content-step-responsable d-flex justify-content-center align-items-center" style="background-image : url();background-color: white;color: #1668cc;border-radius: 50%;">
yu
</div>
{% endif %} #}
{% endif %}
</div>
<div class="zone-btn-workflow-{{ loop.index }}" style="margin-left: 0;">
{% if step.active %}
{# is_responsable(step,missionParticipant) or #}
{% if (is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT_ADMIN') or ( step.manager == constant('\\App\\Enum\\Manager::CLIENT')) and user_get_mission_role(app.user, mission) == constant('\\App\\Enum\\Role::ROLE_VALIDATOR'))
or ( step.manager == constant('\\App\\Enum\\Manager::CLIENT_EXTERNAL')) and user_can_validate_step(step,app.user)
or (step.manager == constant('\\App\\Enum\\Manager::JOB') and is_granted('ROLE_SUBCONTRACTOR') and user_get_mission_job(app.user, mission) == step.job) %}
{% set displayReturnBtn = false %}
{% for action in step.actions %}
{% for trigger in action.triggers %}
{% if trigger.triggerType == constant('\\App\\Enum\\Trigger::REFUSAL') %}
{% set displayReturnBtn = true %}
{% endif %}
{% endfor %}
{% endfor %}
<div>
<button type="button" class="btn btn-primary-custom btn-validate-step " data-type="validation" data-stepid="{{step.id}}" data-mission={{mission.id}} {{stimulus_action('planning--index','validateStep')}} style=" width: 100%;background-color:var(--my-flow-pink) !important; padding: 0 10px;text-align: center; font-weight:600;letter-spacing: 1px;color: #fff !important;">
Terminer l’étape
{# <svg style="height: 18px; width: 18px; fill:white;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z"/></svg> #}
</button>
<div class="att">
<svg width="26" height="26" viewbox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_2236_4012)">
<path d="M13 22.75C18.3848 22.75 22.75 18.3848 22.75 13C22.75 7.61522 18.3848 3.25 13 3.25C7.61522 3.25 3.25 7.61522 3.25 13C3.25 18.3848 7.61522 22.75 13 22.75Z" stroke="#EA5D0C" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M13 13.8125V8.125" stroke="#EA5D0C" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M13 18.4844C13.5609 18.4844 14.0156 18.0297 14.0156 17.4688C14.0156 16.9078 13.5609 16.4531 13 16.4531C12.4391 16.4531 11.9844 16.9078 11.9844 17.4688C11.9844 18.0297 12.4391 18.4844 13 18.4844Z" fill="#EA5D0C"/>
</g>
<defs>
<clipPath id="clip0_2236_4012">
<rect width="26" height="26" fill="white"/>
</clipPath>
</defs>
</svg>
<span class="prent">
Veuillez valider l’étape en cours<br>lorsque vous aurez terminé.
</span>
</div>
{% if id_step != number_of_all_steps %}
<svg width="32" height="32" class="mb-5" viewbox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<g class="nexts" clip-path="url(#clip0_1_10344)">
<path d="M16 28C22.6274 28 28 22.6274 28 16C28 9.37258 22.6274 4 16 4C9.37258 4 4 9.37258 4 16C4 22.6274 9.37258 28 16 28Z" stroke="var(--my-flow-pink) " stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path class="nexts" d="M12 17L16 21L20 17" stroke="var(--my-flow-pink) " stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path class="nexts" d="M16 11V21" stroke="var(--my-flow-pink) " stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_1_10344">
<rect width="32" height="32" fill="white"/>
</clipPath>
</defs>
</svg>
{% endif %}
</div>
{% endif %}
{% set display = false %}
{% for action in step.actions %}
{% for trigger in action.triggers %}
{% if trigger.triggerType == constant('\\App\\Enum\\Trigger::RELAUNCH_CLIENT') %}
{% set display = true %}
{% endif %}
{% endfor %}
{% endfor %}
{% if
display and
(is_granted('ROLE_ADMIN')
or (
step.manager == constant('\\App\\Enum\\Manager::CLIENT')
and is_granted('ROLE_SUBCONTRACTOR')
))
%}
<br>
<button type="button" class="btn btn-red-custom-warning mt-3 " data-href="{{ path('workflow_relaunch_step', {'step': step.id, 'workflow': step.workflow.id}) }}" {{stimulus_action('planning--index','relaunchSubcontractor')}}>
<i class="fa fa-repeat text-white"></i>
Relancer
</button>
{% endif %}
{% endif %}
{# and step.endDate is not null #}
{% if loop.last and step.active == true and ( is_granted('ROLE_ADMIN') or is_granted('ROLE_VALIDATOR') ) and mission.state == 'in_progress' and step.isLast == true %}
<button type="button" class="btn btn-red-custom-warning mt-3" data-type="closed" data-stepid="{{step.id}}" data-mission={{mission.id}} {{stimulus_action('planning--index','closeStep')}}>
<i class="fa fa-archive text-white"></i>
Cloturer
</button>
{% endif %}
</div>
</div>
</div>
{% if loop.index < 10 %}
{% set id_step = loop.index %}
{% else %}
{% set id_step = id_step - 1 %}
{% endif %}
{% endfor %}
{% endif %}
</div>
{% if mission.state == 'in_progress' and mission.canStart['state'] == false %}
<div class="overlay-layer bg-dark bg-opacity-25 overlay-custom">
<div class="bg-white rounded pt-5 pb-5 btn-none" style="padding: 12px;margin:10px">
Cette mission ne peut pas démarrer avant que la/les mission(s)
<strong>{{ mission.canStart['ListOfMissions'] }}</strong>
ne soit/soient clôturée(s) ou finie(s).
</div>
</div>
{% endif %}
{% if campaign.state != "in_progress" or (mission.state == 'archived' or mission.state == 'validated' or mission.state == 'provisional' or mission.state == 'finalized') %}
<div class="overlay-wrapper">
<img src="assets/media/stock/600x400/img-1.jpg" alt="" class="w-100 rounded"/>
</div>
{% if mission.state == 'archived' or mission.state == "cancelled" and mission.state == "finalized" %}
<div class="overlay-layer bg-dark bg-opacity-25">
<a href="{{ path('mission_index') }}" class="btn btn-primary-custom btn-shadow">Retourner à la liste des missions</a>
</div>
{% else %}
<div class="overlay-layer bg-dark bg-opacity-25 overlay-custom">
<div class="bg-white rounded pt-5 pb-5 btn-none">
<a href="{{ path('mission_index') }}" class="btn btn-shadow">
{% if mission.state == "closed" %}
Mission cloturée
{% else %}
{% if mission.state == "finalized" %}
Mission archivée
{% elseif mission.state == "deleted" %}
Mission supprimée
{% else %}
La mission n'est pas encore validée, le planning sera disponible dès sa validation
{% endif %}
{% endif %}
{# order mission in traitement #}
</a>
</div>
</div>
{% endif %}
{% endif %}
{# archivé cloturé #}