templates/admin/fields/orderonderdelen.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 parentEntity = entity.fqcn %}
  5. {% set tab = 'onderdelen' %}
  6. {# if ea.request.get('partialFields') is empty #}
  7. {# set partialFields = [] #}
  8.     {# else #}
  9.     {% set partialFields = ea.getRequest.get('partialFields') %}
  10. {# endif #}
  11. {% set maxTextLength = 25 %}
  12. {% set opslaglocatieBesteldId = 2 %}
  13.     {% if parentEntity == 'App\\Entity\\Order' %}
  14.     {% set tab = 'onderdelen' %}
  15.     {# als alle onderdelen besteld zijn, dan geen batchactions tonen #}
  16.     {% set hasBatchActions = 1 %}
  17.     {#
  18.                                 {% set hasBatchActions = 0 %}
  19.                                     {% for value in field.value %}
  20.                                         {% if value.opslaglocatie %}
  21.                                             {% if not value.bestelling and value.opslaglocatie.id == opslaglocatieId %}
  22.                                             {% set hasBatchActions = 1 %}
  23.                                             {% endif %}
  24.                                     {% endif %}
  25.                                 {% endfor %}
  26.                                 #}
  27.     {% set showOrdernr = 0 %}
  28.     {% set showBestelnr = 1 %}
  29. {% set hasAlwaysEditAction = 0 %}
  30. {% endif %}
  31.     {% if parentEntity == 'App\\Entity\\Bestelling' %}
  32.     {# set hasBatchActions = 0 #}
  33.     {% set showOrdernr = 1 %}
  34.     {% set hasAlwaysEditAction = 1 %}
  35. {% set showBestelnr = 0 %}
  36. {% endif %}
  37. {% set urlBatchBestellen = ea_url()
  38.                 .setController('App\\Controller\\Admin\\Orderonderdeel\\Sub\\OrderonderdeelSubController')
  39.                 .setAction('actionBatchBestellen')
  40.                 .unset('entityId')
  41.                 .set('parentControllerFqcn', ea.getCrud().controllerFqcn)
  42.                 .set('parentEntity', ea.getCrud().entityFqcn)
  43.                 .set('parentId', entity.instance.id)
  44.                 .set('tab', tab)
  45.                 .removeReferrer()
  46.                    %}
  47. {% set urlPost = ea_url()
  48.                 .setController('App\\Controller\\Admin\\Orderonderdeel\\Sub\\OrderonderdeelSubController')
  49.                 .unset('entityId')
  50.                 .removeReferrer()
  51.                    %}
  52.     {% if ea.crud.currentAction == 'detail' %}
  53.         <table class="table datagrid"> <tr>
  54.             {%  if hasBatchActions %}
  55.                 <th>
  56.                     <div class="form-check">
  57.                         <span><input type="checkbox" class="form-check-input form-batch-checkbox-all" id="form-batch-checkbox-all"></span>
  58.                     </div>
  59.                 </th>
  60.             {%  endif %}
  61.             <th>Aantal</th>
  62.             <th>Onderdeel</th>
  63.             <th>Materiaal</th>
  64.             <th>Bewerking</th>
  65.             <th>Lengte</th>
  66.             <th>Breedte</th>
  67.             <th>Dikte</th>
  68.             <th>Opmerkingen</th>
  69.             <th>Opslaglocatie</th>
  70.             {% if showBestelnr %}
  71.                 <th>Bestelnr</th>
  72.             {% endif %}
  73.             {% if showOrdernr %}
  74.                 <th>Ordernr</th>
  75.             {% endif %}
  76.             <th>Geleverd</th>
  77.             <th></th>
  78.         </tr>
  79.         {#</tr>#}
  80.         {% for value in field.value %}
  81.             {% set urlBestelling = '#' %}
  82.             {%if value.bestelling %}
  83.                 {% set urlBestelling = ea_url()
  84.                 .setController('App\\Controller\\Admin\\Bestelling\\BestellingCrudController')
  85.                 .setAction('detail')
  86.                 .set('entityId', value.bestelling.id)
  87.                 .set('tab', tab)
  88.                 %}
  89.             {% endif %}
  90.             {% set urlOrder = '#' %}
  91.             {%if value.orderid %}
  92.                 {% set urlOrder = ea_url()
  93.                 .setController('App\\Controller\\Admin\\OrderCrudController')
  94.                 .setAction('detail')
  95.                 .set('entityId', value.orderid.id)
  96.                 .set('tab', tab)
  97.                 %}
  98.             {% endif %}
  99.             <tr data_id="{{ value.id}}">
  100.                 {%  if hasBatchActions %}
  101.                     <td
  102.                         class="batch-actions-selector">
  103.                         {# filter op niet besteld #}
  104.                         {% if value.opslaglocatie %}
  105.                             {%  if  (not (value.bestelling or value.opslaglocatie.id == opslaglocatieBesteldId)) %}
  106.                                 <div class="form-check">
  107.                                     <input type="checkbox" class="form-check-input form-batch-checkbox" id="form-batch-checkbox-0" value="{{ value.id }}" data-row-index="0">
  108.                                 </div>
  109.                             {% endif %}
  110.                         {% endif %}
  111.                     </td>
  112.                 {% endif %}
  113.                 {% set lengte = value.lengte / 10 %}
  114.                 {% set breedte = value.breedte / 10 %}
  115.                 {% set dikte = value.dikte / 10 %}
  116.                 <td>{{ value.aantal }}</td>
  117.                 <td>{{ value.naam }}</td>
  118.                 <td>{{ value.materiaal }}</td>
  119.                 <td>{{ value.bewerking }}</td>
  120.                 <td>{{ lengte|number_format(1, ',', '.') }}</td>
  121.                 <td>{{ breedte|number_format(1, ',', '.') }}</td>
  122.                 <td>{{ dikte|number_format(1, ',', '.') }}</td>
  123.                 <td>{{ value.opmerkingen|length > maxTextLength ? value.opmerkingen|slice(0,maxTextLength) ~ '...' : value.opmerkingen }}</td>
  124.                 <td>{{ value.opslaglocatie }}</td>
  125.                 {% if showBestelnr %}
  126.                     <td>
  127.                         <a href="{{ urlBestelling }}">{{ value.bestelling|length > maxTextLength ? value.bestelling|slice(0,maxTextLength) ~'...' : value.bestelling }}</a>
  128.                     </td>
  129.                 {% endif %}
  130.                 {% if showOrdernr and value.orderid %}
  131.                     <td>
  132.                         <a href="{{ urlOrder }}">{{ value.orderid|length > maxTextLength ? value.orderid|slice(0,maxTextLength) ~'...': value.orderid }}</a>
  133.                     </td>
  134.                 {% endif %}
  135.                 {% if showOrdernr and not value.orderid %}
  136.                     <td>{{ 'nvt' }}</td>
  137.                 {% endif %}
  138.                 <td>{{ value.aantalGeleverd }}</td>
  139.                 <td class="actions actions-as-dropdown">
  140.                     <div class="dropdown dropdown-actions">
  141.                         <a class="dropdown" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  142.                             <svg xmlns="http://www.w3.org/2000/svg" height="21" width="21" fill="none" viewbox="0 0 24 24" stroke="currentColor">
  143.                                 <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>
  144.                             </svg>
  145.                         </a>
  146.                         <div class="dropdown-menu dropdown-menu-right">
  147.                             {% set urldetail = ea_url()
  148.                                 .setController('App\\Controller\\Admin\\Orderonderdeel\\Sub\\OrderonderdeelSubController')
  149.                                 .setAction('detail')
  150.                                 .set('entityId' , value.id )
  151.                                 .set('parentControllerFqcn', ea.getCrud().controllerFqcn)
  152.                                 .set('parentEntity', ea.getCrud().entityFqcn)
  153.                                 .set('parentId', entity.instance.id)
  154.                                 .set('tab', tab)
  155.                                 %}
  156.                             <a class="dropdown-item action-detail" href="{{ urldetail }}" data-action-name="detail">
  157.                                 <span class="action-label">Bekijk</span>
  158.                             </a>
  159.                             {% set urledit = ea_url()
  160.                                 .setController('App\\Controller\\Admin\\Orderonderdeel\\Sub\\OrderonderdeelSubController')
  161.                                 .setAction('edit')
  162.                                 .set('entityId' , value.id )
  163.                                 .set('parentControllerFqcn', ea.getCrud().controllerFqcn)
  164.                                 .set('parentEntity', ea.getCrud().entityFqcn)
  165.                                 .set('parentId', entity.instance.id)
  166.                                 .set('tab', tab)
  167.                                 .removeReferrer()
  168.                                 %}
  169.                             {% if not value.bestelling  or hasAlwaysEditAction %}
  170.                                 <a class="dropdown-item action-edit" href="{{ urledit }}" data-action-name="edit">
  171.                                     <span class="action-label">Bewerken</span>
  172.                                 </a>
  173.                             {% endif %}
  174.                         </div>
  175.                     </div>
  176.                 </td>
  177.             </tr>
  178.             {# <tr><td colspan="13" ></td></tr> #}
  179.         {% endfor %}
  180.     </table>
  181.     {% set url = ea_url()
  182.                 .setController('App\\Controller\\Admin\\Orderonderdeel\\Sub\\OrderonderdeelSubController')
  183.                 .setAction('new')
  184.                 .unset('entityId')
  185.                 .set('parentControllerFqcn', ea.getCrud().controllerFqcn)
  186.                 .set('parentEntity', ea.getCrud().entityFqcn)
  187.                 .set('parentId', entity.instance.id)
  188.                 .set('tab', tab)
  189.                 .removeReferrer()
  190.                 .generateUrl()
  191.               
  192.                 %}
  193.     {% set urlBestellen = ea_url()
  194.                 .setController('App\\Controller\\Admin\\Orderonderdeel\\Sub\\OrderonderdeelSubController')
  195.                 .setAction('bestellenOnderdelen')
  196.                 .unset('entityId')
  197.                 .set('parentControllerFqcn', ea.getCrud().controllerFqcn)
  198.                 .set('parentEntity', ea.getCrud().entityFqcn)
  199.                 .set('parentId', entity.instance.id)
  200.                 .set('tab', tab)
  201.                 .removeReferrer()
  202.                 .generateUrl()
  203.                 %}
  204.     {% set urlMateriaalWijzigen = ea_url()
  205.                 .setController('App\\Controller\\Admin\\Orderonderdeel\\Sub\\OrderonderdeelSubController')
  206.                 .setAction('materiaalWijzigen')
  207.                 .unset('entityId')
  208.                 .set('parentControllerFqcn', ea.getCrud().controllerFqcn)
  209.                 .set('parentEntity', ea.getCrud().entityFqcn)
  210.                 .set('parentId', entity.instance.id)
  211.                 .set('tab', tab)
  212.                 .removeReferrer()
  213.                 .generateUrl()
  214.                 %}
  215.     {% set urlBewerkingWijzigen = ea_url()
  216.                 .setController('App\\Controller\\Admin\\Orderonderdeel\\Sub\\OrderonderdeelSubController')
  217.                 .setAction('bewerkingWijzigen')
  218.                 .unset('entityId')
  219.                 .set('parentControllerFqcn', ea.getCrud().controllerFqcn)
  220.                 .set('parentEntity', ea.getCrud().entityFqcn)
  221.                 .set('parentId', entity.instance.id)
  222.                 .set('tab', tab)
  223.                 .removeReferrer()
  224.                 .generateUrl()
  225.                 %}
  226.     {% set urlStdModel = ea_url()
  227.                 .setController('App\\Controller\\Admin\\Order\\Partial\\OrderPartialControllerModel')
  228.                 .setAction('edit')
  229.                 
  230.                 .set('parentControllerFqcn', ea.getCrud().controllerFqcn)
  231.                 .set('parentEntity', ea.getCrud().entityFqcn)
  232.                 .set('parentId', entity.instance.id)
  233.                 .set('tab', tab)
  234.                 .removeReferrer()
  235.                 .generateUrl()
  236.                  %}
  237.     <br>
  238.     <div class="container p-0">
  239.         <div class="d-flex flex-row-reverse justify-content-between">
  240.             <div>
  241.                 <a class="action-new btn btn-primary d-inline-block me-1" href="{{ urlStdModel }}&menuIndex=2&submenuIndex=0">
  242.                     <span class="action-label ">Kopieer standaard model</span>
  243.                 </a>
  244.                 <a class="action-new btn btn-primary d-inline-block " href="{{ url }}&menuIndex=2&submenuIndex=0">
  245.                     <span class="action-label">Maak nieuw onderdeel</span>
  246.                 </a>
  247.             </div>
  248.             <div class="batch-actions d-none">
  249.                 <div class="dropdown dropdown-actions me-2">
  250.                     <a class="action-Kies actie btn btn-secundary dropdown-toggle show" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
  251.                         <i class="action-icon fa fa-check"></i>
  252.                         <span class="action-label">Kies actie</span>
  253.                     </a>
  254.                     <div class="dropdown-menu dropdown-menu-right" style="position: absolute; inset: 0px auto auto 0px; margin: 0px; transform: translate(0px, 61px);" data-popper-placement="bottom-start">
  255.                         {% if (field.value|length) %}
  256.                         {% if (field.value[0].orderid.recordtype != 'Offerte') %}
  257.                         <div>
  258.                             <a id="bestellen" onclick="setModalMelding('bestellen')" class="action-bestellenOnderdelen dropdown-item" href="#" data-action-name="bestellenOnderdelen" data-bs-toggle="modal" data-bs-target="#modal-batch-action" data-action-csrf-token="en een token" data-action-batch="true" data-entity-fqcn="App\Entity\Onderdeel" data-action-url=" {{ urlBestellen }} " disabled="disabled">
  259.                                 Bestel met nieuwe bestelling
  260.                             </a>
  261.                         </div>
  262.                         {% endif %}
  263.                         {% endif %}
  264.                         <div>
  265.                             <a id="materiaal" onclick="setModalMelding('materiaal')" class="action-materiaalWijzigen dropdown-item" href="#" data-action-name="materiaalWijzigen" data-bs-toggle="modal" data-bs-target="#modal-batch-action" data-action-csrf-token="en een token" data-action-batch="true" data-entity-fqcn="App\Entity\Onderdeel" data-action-url=" {{ urlMateriaalWijzigen }} " disabled="disabled">
  266.                                 Materiaal wijzigen
  267.                             </a>
  268.                         </div>
  269.                         <div>
  270.                             <a id="bewerking" onclick="setModalMelding('bewerking')" class="action-bewerkingWijzigen dropdown-item" href="#" data-action-name="bewerkingWijzigen" data-bs-toggle="modal" data-bs-target="#modal-batch-action" data-action-csrf-token="en een token" data-action-batch="true" data-entity-fqcn="App\Entity\Onderdeel" data-action-url=" {{ urlBewerkingWijzigen }} " disabled="disabled">
  271.                                 Bewerking wijzigen
  272.                             </a>
  273.                         </div>
  274.                     </div>
  275.                 </div>
  276.             </div>
  277.         </div>
  278.         {% if hasBatchActions %}
  279.             <div class="text-muted ms-2 mt-4">
  280.                 <i class="action-icon fa fa-arrow-up"></i>
  281.                 <i>&nbsp;Selecteer onderdelen voor actie</i>
  282.             </div>
  283.         {% endif %}
  284.         {%  if hasBatchActions %}
  285.             <div id="modal-batch-action" class="modal fade" tabindex="-1" style="display: none;" aria-hidden="true">
  286.                 <div class="modal-dialog">
  287.                     <div class="modal-content">
  288.                         <div id="confirmation-title" class="modal-body">
  289.                             <h4 id="batch-action-confirmation-title">Onbekende actie!!</h4>
  290.                         </div>
  291.                         <div class="modal-footer">
  292.                             <button type="button" data-bs-dismiss="modal" class="btn btn-secondary">
  293.                                 <span class="btn-label">Annuleren</span>
  294.                             </button>
  295.                             <button type="button" id="modal-batch-action-button" data-bs-dismiss="modal" class="btn btn-danger">
  296.                                 <i class="fa fa-fw fa-check"></i>
  297.                                 <span class="btn-label">Verdergaan</span>
  298.                             </button>
  299.                         </div>
  300.                     </div>
  301.                 </div>
  302.             </div>
  303.         </div>
  304.         {# <form method="POST" action="http://localhost/admin?crudAction=approveOnderdelen&amp;crudControllerFqcn=App\Controller\Admin\OrderonderdeelCrudController"> #}
  305.         <script>
  306.             function setModalMelding(actie) {
  307. var element = document.getElementById("confirmation-title");
  308. switch (actie) {
  309. case 'materiaal': element.innerHTML = '<h4 id="batch-action-confirmation-title">Wilt u het materiaal wijzigen van de geselecteerde onderdelen?</h4>';
  310. break;
  311. case 'bestellen': element.innerHTML = '<h4 id="batch-action-confirmation-title">Wilt u een nieuwe bestelling maken met de geselecteerde onderdelen?</h4>';
  312. break;
  313. case 'bewerking': element.innerHTML = '<h4 id="batch-action-confirmation-title">Wilt u de bewerking wijzigen van de geselecteerde onderdelen?</h4>';
  314. break;
  315. default: element.innerHTML = '<h4 id="batch-action-confirmation-title">Onbekende actie!!</h4>';
  316. }
  317. }
  318.         </script>
  319.     {% endif %}
  320. {% else %}
  321.     <span class="badge badge-secondary">{{ field.formattedValue }}</span>
  322. {% endif %}