templates/koszyk.html.twig line 1

Open in your IDE?
  1. {% extends 'rama-full-width.html.twig' %}
  2. {% block TITLE %}InforPol NET: Koszyk #1/3{% endblock %}
  3. {% block WORK_AREA %}
  4.     {% if koszyk %}
  5.         <div class="container-fluid">
  6.             <div class='row'>
  7.                 <div class='col fs-4 fw-bold'>
  8.                     Zamówienie na następujące domeny:
  9.                 </div>
  10.             </div>
  11.         </div>
  12.         <div class="widget-content widget-content-area br-8">
  13.             <div class="table-responsive">
  14.                 <table class="table table-hover">
  15.                     <thead>
  16.                         <tr>
  17.                             <th scope="col" width="5%">lp</th>
  18.                             <th class="ps-0" scope="col">Nazwa</th>
  19.                             <th scope="col">Cena NETTO</th>
  20.                             <th class="text-center" scope="col">VAT</th>
  21.                             <th class="text-center" scope="col">Cena BRUTTO</th>
  22.                             <th>&nbsp;</th>
  23.                         </tr>
  24.                         <tr aria-hidden="true" class="mt-3 d-block table-row-hidden"></tr>
  25.                     </thead>
  26.                     <tbody>
  27.                         {% set LP = 1 %}
  28.                         {% for POZYCJA in koszyk.pozycja %}
  29.                             <tr class="domain-row" data-domain="{{ POZYCJA.nazwa }}">
  30.                                 <td>{{ LP }}</td>
  31.                                 <td>{{ POZYCJA.nazwa }}</td>
  32.                                 <td>{{ POZYCJA.cenanetto|number_format(2, ",", " ") }} PLN</td>
  33.                                 <td>{{ POZYCJA.cenavat|number_format(2, ",", " ") }} PLN</td>
  34.                                 <td>{{ POZYCJA.cenabrutto|number_format(2, ",", " ") }} PLN</td>
  35.                                 <td class='text-center'>
  36.                                     <button class="btn btn-danger" onclick="removeFromCart('{{ POZYCJA.nazwa }}')"><span class="bi-trash"></span> Usuń</button>
  37.                                 </td>
  38.                             </tr>
  39.                             {% set LP = LP + 1 %}
  40.                         {% endfor %}
  41.                     </tbody>
  42.                     <tfooter>
  43.                         <td colspan="2" class="fw-bold">
  44.                             RAZEM:
  45.                         </td>
  46.                         <td class='text-right' id='sum_netto'>{{ koszyk.netto|number_format(2, ",", " ") }} PLN</td>
  47.                         <td class='text-right' id='sum_vat'>{{ koszyk.vat|number_format(2, ",", " ") }} PLN</td>
  48.                         <td class='text-right' id='sum_brutto'>{{ koszyk.brutto|number_format(2, ",", " ") }} PLN</td>
  49.                         <td>&nbsp;</td>
  50.                     </tfooter>
  51.                 </table>
  52.             </div>
  53.         </div>
  54.         <div class="container">
  55.             <br/>
  56.             <label><input type="checkbox" id="chk-regulamin" onclick="if (this.checked) {
  57.                         $('.regreq').removeClass('disabled').removeAttr('disabled');
  58.                     } else {
  59.                         $('.regreq').addClass('disabled').attr('disabled', true);
  60.                     }"> Bla bla bla <a href="{{ asset("/pliki/regulamin_rejestracji_domen.pdf") }}" target="_new">regulamin</a>.</label><br/>
  61.             <br/>
  62.             {% if app.user %}
  63.                 <button class="btn btn-success regreq disabled" id="btn-next" onclick="document.location.href = '{{ path("cart2") }}';" disabled>Dalej</button>
  64.             {% else %}
  65.                 Aby móc zarejestrować domenę(y), musisz posiadać konto użytkownika w naszym systemie. Także bardzo prosimy byś się zalogował lub zarejestrował.<br/><br/>
  66.                 <button class="btn btn-success disabled regreq" id="btn-logon" disabled onclick="document.location.href = '{{ path("cart2") }}';">Zaloguj się</button> <button class="btn btn-warning regreq" id="btn-register disabled" disabled onclick="document.location.href = '{{ path("rejestracja") }}';">Zarejestruj się</button>
  67.             {% endif %}
  68.         </div>
  69.     {% else %}
  70.         <div class="widget-content widget-content-area br-8 p-5">
  71.             Twój koszyk jest pusty. Aby zarejestrować domenę, przejdź proszę do wyszukiwarki domen, znajdź odpowiednią dla siebie domenę i dodaj ją do koszyka.<br/><br/>
  72.             Wyszukiwarka domen dostępna jest <a href="{{ path("domain-search") }}">tutaj</a> oraz na stronie <a href="{{ path ("app_welcome") }}">głównej</a>.
  73.         </div>
  74.     {% endif %}
  75. {% endblock %}
  76. {% block SCRIPTS %}
  77.     <script>
  78.         function removeFromCart(domainName) {
  79.             $.ajax({
  80.                 type: "POST",
  81.                 url: "{{ path ("koszyk-remove-domain-2-registartion") }}",
  82.                 data: {
  83.                     domain: domainName
  84.                 },
  85.                 success: function (ans) {
  86.                     if (ans.status) {
  87.                         $(".domain-row[data-domain='" + domainName + "']").remove();
  88.                         $("#cart-small-counter").html(ans.count);
  89.                         $("#sum_netto").html(price(ans.netto));
  90.                         $("#sum_vat").html(price(ans.vat));
  91.                         $("#sum_brutto").html(price(ans.brutto));
  92.                         if (ans.count == 0) {
  93.                             document.location.href = "{{ path ("cart") }}";
  94.                         } else {
  95.                             $("#cart-button").on("click", function () {
  96.                                 document.location.href = "{{ path("cart") }}"
  97.                             }).css("cursor", "pointer");
  98.                         }
  99.                     } else {
  100.                         alert("Nie udalo się usunąć z koszyka :(");
  101.                     }
  102.                     console.log(ans);
  103.                 }
  104.             })
  105.         }
  106.         function price(F) {
  107.             if (F == 0)
  108.                 return "0,00";
  109.             F *= 100;
  110.             F = parseInt(F);
  111.             F += "";
  112.             return F.substr(0, F.length - 2) + "," + F.substr(F.length - 2);
  113.         }
  114.     </script>
  115. {% endblock %}