templates/admin/fields/WorkflowOrderField.html.twig line 1

Open in your IDE?
  1. {# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
  2. {# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
  3. {# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
  4.     {% set fieldName = field.property %}
  5.     {% set tab = field.value %}
  6.     {% if ea.crud.currentAction == 'detail' %}
  7.         <div>
  8.             {% for key, value in field.formattedValue.statusAll %}
  9.                 {% if value != field.formattedValue.statusEntity %}
  10.                     {% if loop.index != 1 %}<i class="fa fa-angle-right me-0 ms-0 mt-0 text-muted "> </i>
  11.                 {% endif %}
  12.                 <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">
  13.                     <span class="action-label">{{ value }}</span>
  14.                 </a>
  15.             {% else %}
  16.                 {% if loop.index != 1 %}
  17.                     <i class="fa fa-angle-right me-0 ms-0 mt-0 text-muted "></i>
  18.                 {% endif %}
  19.                 <button class="btn btn-primary btn-sm mt-0 px-2 pe-none">
  20.                     <div>{{ value|raw }}</div>
  21.                 </button>
  22.             {% endif %}
  23.         {% endfor %}
  24.     </div>
  25.     {# per status een modal maken, met eigen form.#}
  26.     {% for key, value in field.formattedValue.statusAll %}
  27.         <div id="modal-setStatus-{{ value|replace({' ':''}) }}-{{ fieldName }}" class="modal fade" tabindex="-1" style="display: none;" aria-hidden="true">
  28.             <div class="modal-dialog">
  29.                 <div class="modal-content">
  30.                     <div class="modal-body">
  31.                         <h4 id="batch-action-confirmation-title">Wil je de status wijzigen naar
  32.                                                         "{{ value }}"
  33.                                                         ?</h4>
  34.                     </div>
  35.                     <div class="modal-footer">
  36.                         <button type="button" data-bs-dismiss="modal" class="btn btn-secondary">
  37.                             <span class="btn-label">Annuleren</span>
  38.                         </button>
  39.                         {% set urlForm = ea_url()
  40.                 .setController('App\\Controller\\Admin\\OrderCrudController')
  41.                 .setAction('setStatus')
  42.                 .set('entityId',field.formattedValue.entityId)
  43.                 .set('status', value)
  44.                 .set('parentControllerFqcn', ea.getCrud().controllerFqcn)
  45.                 .set('parentEntity', ea.getCrud().entityFqcn)
  46.                 .set('parentId', entity.instance.id)
  47.                 .set('tab', tab)
  48.                 
  49.                 .generateUrl()
  50.                 %}
  51.                         {#<form action="http://localhost/admin?crudAction=setStatus&amp;crudControllerFqcn=App%5CController%5CAdmin%5CBestellingCrudController&amp;entityId={{ field.formattedValue.entityId }}&amp;status={{ value }}&amp;parentControllerFqcn=App%5CController%5CAdmin%5CBestellingCrudController&amp;parentEntity=App%5CEntity%5CBestelling&amp;parentId=29&amp;tab=onderdelen" method="POST">#}
  52.                         <form action="{{ urlForm }}" method="POST">
  53.                             <button type="submit" data-bs-dismiss="modal" class="btn btn-danger" id="modal-setStatus-button">
  54.                                 <i class="fa fa-fw fa-check"></i>
  55.                                 <span class="btn-label">Verdergaan</span>
  56.                             </button>
  57.                         </form>
  58.                     </div>
  59.                 </div>
  60.             </div>
  61.         </div>
  62.     {% endfor %}
  63. {% else %}
  64.     <span title="Message">"Use only on Detailpage"</span>
  65. {% endif %}