{% extends 'layout.twig' %}
     
{% block body %}

<section class="contenu titre_div">
    <h1>{{ 'Suivi' | trad }}</h1>
    
    {{ ariane() }}
    
    <header class="bs-row">
        <h2>
            {{- strBuild(
                'Demande d\'achat N°@1@' | trad,
                [demande.NO_DA]
            ) -}}
        </h2>
        <div class="bs-col text-right">
        </div>
    </header>

    {% embed '@GlobalApplication/WorkflowEvent/docWorkflowChain.twig' with {
        listWorfowItem: listWorfowItem,
        demande: demande,
    } only %}
        {% block interaction %}
            onclick="updateWorkflowDetail({{ path(
                'DemandeAchat.Workflow.detail',
                {demandeId: demande.NO_DA, workflowId: item.id}
            ) | json | e('html_attr') }})"
        {% endblock %}
    {% endembed %}
    
    <article id="wf-list-event">
        {#- placeholder for updateWorkflowDetail() -#}
    </article>
    
</section>
<script>
function updateWorkflowDetail(path) {
    let el = document.getElementById('wf-list-event');
    ajaxHtmlUpdate(el, path, {}, function() {
        el.scrollIntoView({block: 'start'});
    });
}
</script>
{% endblock %}