{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{% set fieldName = field.property %}
{% set tab = field.value %}
{% if ea.crud.currentAction == 'detail' %}
<div>
{% for key, value in field.formattedValue.statusAll %}
{% if value != field.formattedValue.statusEntity %}
{% if loop.index != 1 %}<i class="fa fa-angle-right me-0 ms-0 mt-0 text-muted "> </i>
{% endif %}
<a class=" btn btn-sm btn-outline-secondary text-muted" href="#" data-action-name="setStatus" data-bs-toggle="modal" data-bs-target="#modal-setStatus-{{ value|replace({' ':''}) }}-{{ fieldName }}" data-action-csrf-token="Doe maar wat" data-action-batch="true" data-entity-fqcn="App\Entity\Order">
<span class="action-label">{{ value }}</span>
</a>
{% else %}
{% if loop.index != 1 %}
<i class="fa fa-angle-right me-0 ms-0 mt-0 text-muted "></i>
{% endif %}
<button class="btn btn-primary btn-sm mt-0 px-2 pe-none">
<div>{{ value|raw }}</div>
</button>
{% endif %}
{% endfor %}
</div>
{# per status een modal maken, met eigen form.#}
{% for key, value in field.formattedValue.statusAll %}
<div id="modal-setStatus-{{ value|replace({' ':''}) }}-{{ fieldName }}" class="modal fade" tabindex="-1" style="display: none;" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<h4 id="batch-action-confirmation-title">Wil je de status wijzigen naar
"{{ value }}"
?</h4>
</div>
<div class="modal-footer">
<button type="button" data-bs-dismiss="modal" class="btn btn-secondary">
<span class="btn-label">Annuleren</span>
</button>
{% set urlForm = ea_url()
.setController('App\\Controller\\Admin\\OrderCrudController')
.setAction('setStatus')
.set('entityId',field.formattedValue.entityId)
.set('status', value)
.set('parentControllerFqcn', ea.getCrud().controllerFqcn)
.set('parentEntity', ea.getCrud().entityFqcn)
.set('parentId', entity.instance.id)
.set('tab', tab)
.generateUrl()
%}
{#<form action="http://localhost/admin?crudAction=setStatus&crudControllerFqcn=App%5CController%5CAdmin%5CBestellingCrudController&entityId={{ field.formattedValue.entityId }}&status={{ value }}&parentControllerFqcn=App%5CController%5CAdmin%5CBestellingCrudController&parentEntity=App%5CEntity%5CBestelling&parentId=29&tab=onderdelen" method="POST">#}
<form action="{{ urlForm }}" method="POST">
<button type="submit" data-bs-dismiss="modal" class="btn btn-danger" id="modal-setStatus-button">
<i class="fa fa-fw fa-check"></i>
<span class="btn-label">Verdergaan</span>
</button>
</form>
</div>
</div>
</div>
</div>
{% endfor %}
{% else %}
<span title="Message">"Use only on Detailpage"</span>
{% endif %}