{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{% set parentEntity = entity.fqcn %}
{% set tab = 'orderregels' %}
{% set maxTextLength = 25 %}
{% set hasBatchActions = 0 %}
{% set countOne = 0 %}
{% if field.value|length == 1%}
{% set countOne = 1 %}
{% endif %}
{% set urlBatchBestellen = ea_url()
.setController('App\\Controller\\Admin\\OrderonderdeelSubController')
.setAction('actionBatchBestellen')
.unset('entityId')
.set('parentControllerFqcn', ea.getCrud().controllerFqcn)
.set('parentEntity', ea.getCrud().entityFqcn)
.set('parentId', entity.instance.id)
.set('tab', tab)
.removeReferrer()
%}
{% set urlPost = ea_url()
.setController('App\\Controller\\Admin\\Orderregel\\Sub\\OrderregelSubController')
.unset('entityId')
.removeReferrer()
%}
{% if ea.crud.currentAction == 'detail' %}
<table class="table datagrid"> <thead>
<tr>
{% if hasBatchActions %}
<th>
<div class="form-check">
<span><input type="checkbox" class="form-check-input form-batch-checkbox-all" id="form-batch-checkbox-all"></span>
</div>
</th>
{% endif %}
<th>
<div class="col-10"></div>
</th>
<th class="text-right">Bedrag</th>
<th></th>
</tr>
</thead>
<tbody>
{% for value in field.value|sort((a, b)=> a.volgorde <=> b.volgorde) %}
<tr data_id="{{ value.id}}">
{% if hasBatchActions %}
<td
class="batch-actions-selector">
{# filter op geen bestelling#}
{% if value.opslaglocatie %}
{% if not value.bestelling and value.opslaglocatie.id == opslaglocatieId %}
<div class="form-check">
<input type="checkbox" class="form-check-input form-batch-checkbox" id="form-batch-checkbox-0" value="{{ value.id }}" data-row-index="0">
</div>
{% endif %}
{% endif %}
</td>
{% endif %}
{% set bedrag = value.bedrag/100|number_format %}
<td>{{ value.tekst|nl2br }}</td>
<td class="align-bottom text-right">{{ bedrag|format_currency('EUR') }}</td>
<td class="actions actions-as-dropdown">
<div class="dropdown dropdown-actions">
<a class="dropdown" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<svg xmlns="http://www.w3.org/2000/svg" height="21" width="21" fill="none" viewbox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z"></path>
</svg>
</a>
<div class="dropdown-menu dropdown-menu-right">
{% set urldetail = ea_url()
.setController('App\\Controller\\Admin\\Orderregel\\Sub\\OrderregelSubController')
.setAction('detail')
.set('entityId' , value.id )
.set('parentControllerFqcn', ea.getCrud().controllerFqcn)
.set('parentEntity', ea.getCrud().entityFqcn)
.set('parentId', entity.instance.id)
.set('tab', tab)
%}
<a class="dropdown-item action-detail" href="{{ urldetail }}" data-action-name="detail">
<span class="action-label">Bekijk</span>
{% set bedrag = value.bedrag/100|number_format %}
</a>
{% set urledit = ea_url()
.setController('App\\Controller\\Admin\\Orderregel\\Sub\\OrderregelSubController')
.setAction('edit')
.set('entityId' , value.id )
.set('parentControllerFqcn', ea.getCrud().controllerFqcn)
.set('parentEntity', ea.getCrud().entityFqcn)
.set('parentId', entity.instance.id)
.set('tab', tab)
.removeReferrer()
%}
<a class="dropdown-item action-edit" href="{{ urledit }}" data-action-name="edit">
<span class="action-label">Bewerken</span>
</a>
{% if (countOne != 1) %}
{% set urlMoveDown = ea_url()
.setController('App\\Controller\\Admin\\Orderregel\\Sub\\OrderregelSubController')
.setAction('moveDown')
.set('entityId' , value.id )
.set('parentControllerFqcn', ea.getCrud().controllerFqcn)
.set('parentEntity', ea.getCrud().entityFqcn)
.set('parentId', entity.instance.id)
.set('tab', tab)
.removeReferrer()
%}
<a class="dropdown-item action-edit" href="{{ urlMoveDown }}" data-action-name="moveDown">
{% if loop.last %}
<span class="action-label">Verplaats
<i class="fa-solid fa-sort-amount-up"></i>
</span>
{% else %}
<span class="action-label">Verplaats
<i class="fa-solid fa-long-arrow-alt-down"></i>
</span>
{% endif %}
</a>
{% endif %}
</div>
</div>
</td>
</tr>
{# <tr><td colspan="13" ></td></tr> #}
{% endfor %}
<tr>
{% set totaalBerekend = entity.instance.prijsBerekend / 100 %}
{% set totaal = entity.instance.prijs / 100 %}
{% if (totaal == totaalBerekend) %}
<td> </td>
<td class="align-bottom text-right"></td>
<td></td>
{% else %}
<td class="text-danger">De berekende prijs is niet gelijk aan de ingevoerde prijs
{{ totaal|format_currency('EUR') }}</td>
<td class="align-bottom text-right text-danger">{{ totaalBerekend|format_currency('EUR') }}</td>
<td></td>
{% endif %}
</tr>
<tr>
{#% set leges = value.leges/100|number_format %#}
{% set leges = entity.instance.leges / 100 %}
<td class="text-end font-weight-bold">Leges</td>
<td class="align-bottom text-right">{{ leges|format_currency('EUR') }}</td>
<td class="actions actions-as-dropdown">
<div class="dropdown dropdown-actions">
<a class="dropdown" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<svg xmlns="http://www.w3.org/2000/svg" height="21" width="21" fill="none" viewbox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z"></path>
</svg>
</a>
<div class="dropdown-menu dropdown-menu-right">
{% set urledit = ea_url()
.setController('App\\Controller\\Admin\\Order\\Partial\\OrderPartialControllerLeges')
.setAction('edit')
.set('entityId' , entity.instance.id )
.set('parentControllerFqcn', ea.getCrud().controllerFqcn)
.set('parentEntity', ea.getCrud().entityFqcn)
.set('parentId', entity.instance.id)
.set('tab', tab)
.removeReferrer()
%}
<a class="dropdown-item action-edit" href="{{ urledit }}" data-action-name="edit">
<span class="action-label">Bewerken</span>
</a>
</div>
</div>
</td>
</tr>
<tr>
{% set eindTotaalBerekend = (entity.instance.prijsBerekend + entity.instance.leges) / 100 %}
<td class="text-end">Totaal</td>
<td class="align-bottom text-right">{{ eindTotaalBerekend|format_currency('EUR') }}</td>
<td></td>
</tr>
</tbody>
</table>
{% set url1 = ea_url()
.setController('App\\Controller\\Admin\\Orderregel\\Sub\\OrderregelSubController')
.setAction('new')
.unset('entityId')
.set('parentControllerFqcn', ea.getCrud().controllerFqcn)
.set('parentEntity', ea.getCrud().entityFqcn)
.set('parentId', entity.instance.id)
.set('tab', tab)
.removeReferrer()
.generateUrl()
%}{% set url2 = ea_url()
.setController('App\\Controller\\Admin\\Orderregel\\Partial\\OrderregelPartialControllerCopyRegel')
.setAction('new')
.unset('entityId')
.set('parentControllerFqcn', ea.getCrud().controllerFqcn)
.set('parentEntity', ea.getCrud().entityFqcn)
.set('parentId', entity.instance.id)
.set('tab', tab)
.removeReferrer()
.generateUrl()
%}<br><div class="container p-0">
<div class="d-flex flex-row-reverse ">
<div>
<a class="action-new btn btn-primary d-inline-block " href="{{ url1 }}&menuIndex=2&submenuIndex=0">
<span class="action-label">Maak nieuwe orderregel</span>
</a>
</div>
<div class="me-2">
<a class="action-new btn btn-primary d-inline-block " href="{{ url2 }}&menuIndex=2&submenuIndex=0">
<span class="action-label">Kopieer standaardregel</span>
</a>
</div>
</div>
</div>
{% else %}
<span class="badge badge-secondary">{{ field.formattedValue }}</span>
{% endif %}