themes/webapicTheme/templates/bundles/SyliusShopBundle/Order/thankYou.html.twig line 1

Open in your IDE?
  1. {% extends '@SyliusShop/layout.html.twig' %}
  2. {% import "@SyliusShop/Common/Macro/money.html.twig" as money %}     
  3. {% block content %}
  4.     <div class="ui hidden divider"></div>
  5.     <div class="thankyou-ctn">
  6.         <div class="center aligned sixteen wide column">
  7.             {% set lastPayment = order.payments.last() %}
  8.             
  9.             <h1 class="ui icon header">
  10.                 <i class="circular rocket icon"></i>
  11.                 <div class="content waitingPayment" id="sylius-thank-you" {{ sylius_test_html_attribute('thank-you') }}>
  12.                     {{ 'sylius.ui.wait'|trans }}
  13.                 </div>
  14.                 <div class="content successPayment" id="sylius-thank-you" {{ sylius_test_html_attribute('thank-you') }}>
  15.                     {{ 'sylius.ui.thank_you'|trans }}
  16.                     <div class="sub header">{{ 'sylius.ui.placed_an_order'|trans }}</div>
  17.                 </div>
  18.             </h1>
  19.            
  20.             {{ sylius_template_event('sylius.shop.order.thank_you.after_message', {'order': order}) }}
  21.             {% if lastPayment != false and lastPayment.method.code == 'HIPAY_CARD' and lastPayment.state != 'completed' %}
  22.                 <div id="sylius-payment-steps" data-url="{{ path('app_order_payment_status', {'id': lastPayment.id}) }}" class="ui segment" {{ sylius_test_html_attribute('payment-method-instructions') }} >
  23.                     {%  if lastPayment.state != 'completed' %}
  24.                         <div class="lds-roller-ctn">
  25.                             <div class="lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
  26.                         </div>
  27.                         <span id="payment-processing">{{ 'app.hipay.payment_pending'|trans }}</span>
  28.                     {% else %}
  29.                         <span id="payment-processing" style="color: #2A439B;">{{ 'app.hipay.payment_success' | trans }}</span>
  30.                     {% endif %}
  31.                 </div>                
  32.             {% endif %}
  33.             {% if lastPayment != false %}
  34.                 {%  if lastPayment.method.instructions is not null %}
  35.                      <div id="sylius-payment-method-instructions" class="ui segment errorPayment" {{ sylius_test_html_attribute('payment-method-instructions') }}>
  36.                         {{ 'sylius.ui.payment_error'|trans }}
  37.                         <br/><br/><br/>
  38.                         <a href="{{ path('sylius_shop_order_again', {'tokenValue': order.tokenValue}) }}" id="sylius-show-order-in-account" class="ui large blue button" {{ sylius_test_html_attribute('show-order-in-account') }}>
  39.                             {{ 'app.front.commande.again'|trans }}
  40.                         </a>
  41.                     </div>    
  42.                     <div id="sylius-payment-method-instructions" class="ui segment successPayment" {{ sylius_test_html_attribute('payment-method-instructions') }}>
  43.                         {#%  if lastPayment.method.id == 4 or lastPayment.method.id == 3 %#}
  44.                             {# {{ 'app.front.commande.num'|trans }}  : {{ order.number }} #}
  45.                             {# <br/> #}
  46.                             Total:  {% set price = money.convertAndFormat(order.total) %}
  47.                             {{ price }}
  48.                         {#% endif %#}
  49.                         <br/><br/>
  50.                         {{ lastPayment.method.instructions|nl2br }}
  51.                         <br/>
  52.                       
  53.                     </div>
  54.                 {% endif %}
  55.                 <div class="ui hidden divider"></div>
  56.             {% endif %}
  57.              {# {{ form_start(form, {'action': path('sylius_shop_order_show', {'tokenValue': order.tokenValue}), 'attr': {'class': 'ui loadable form', 'novalidate': 'novalidate'}}) }}
  58.                  {{ form_widget(form) }}
  59.                 {{ form_row(form.orderComment) }}
  60.             {{ form_end(form, {'render_rest': false}) }} #}
  61.             {# {{ dump(form.vars) }} #}
  62.             {% if form.vars.submitted == false %}
  63.                 <div class="form_app_site_comment_order successPayment">
  64.                     {{ form_start(form, {'action': path('app_shop_order_thank_you', {'token_value': order.tokenValue}), 'attr': {'class': 'ui loadable form', 'novalidate': 'novalidate'}}) }}
  65.                     
  66.                         {{ form_widget(form) }}
  67.                         {# {{ form_row(form._token) }} #}
  68.                         <div class="ctn-liens">
  69.                             <button type="submit" class="lien-bleu" id="sylius-pay-link" {{ sylius_test_html_attribute('pay-link') }}>
  70.                                 <i class="check icon"></i> {{ 'app.front.global.valider'|trans }}
  71.                             </button>
  72.                         </div>
  73.                     {{ form_end(form, {'render_rest': false}) }}
  74.                 </div>
  75.             {% endif %}
  76.             <div class="ui hidden divider"></div>
  77.             {% if order.customer.user is not null %}
  78.                 {# <a href="{{ path('sylius_shop_account_order_show', {'number': order.number}) }}" id="sylius-show-order-in-account" class="ui large blue button" {{ sylius_test_html_attribute('show-order-in-account') }}>{{ 'sylius.ui.view_order'|trans }}</a> #}
  79.             
  80.                 <a href="/account/orders/" id="sylius-show-order-in-account" class="ui large blue button" {{ sylius_test_html_attribute('show-order-in-account') }}>
  81.                     {{ 'app.front.commande.all'|trans }}
  82.                 </a>{% else %}
  83.                 {% if lastPayment.state != 'completed' %}
  84.                     <a href="{{ path('sylius_shop_order_show', {'tokenValue': order.tokenValue}) }}" id="payment-method-page" class="ui large blue button" {{ sylius_test_html_attribute('payment-method-page') }}>{{ 'sylius.ui.change_payment_method'|trans }}</a>
  85.                 {% endif %}
  86.                 <a href="{{ path('sylius_shop_register_after_checkout', {'tokenValue': order.tokenValue}) }}" class="ui large green button" {{ sylius_test_html_attribute('create-an-account') }}>
  87.                     <i class="signup icon"></i>
  88.                     {{ 'sylius.ui.create_an_account'|trans }}
  89.                 </a>
  90.             {% endif %}
  91.         </div>
  92.     </div>
  93.     {# {{ dump(order) }} #}
  94.     <script type="text/javascript">
  95.         $(document).ready(function() {
  96.             $('.errorPayment').hide();
  97.             $('.waitingPayment').hide();
  98.             $('.successPayment').hide();
  99.             let paymentStatus = "{{ lastPayment.state }}";
  100.             const paymentMethod = "{{ lastPayment.method.code }}";
  101.             if(paymentStatus != 'completed' && paymentMethod == 'HIPAY_CARD') {
  102.                 $('.waitingPayment').show();
  103.                 let url = $('#sylius-payment-steps').data('url');
  104.                 let interval = setInterval(function() {
  105.                     $.ajax({
  106.                         url: url,
  107.                         type: 'GET',
  108.                         success: function(data) {
  109.                             paymentStatus = data.success;
  110.                             if(paymentStatus == 'completed') {
  111.                                 $('.successPayment').show();
  112.                                 $('.errorPayment').hide();
  113.                                 $('.waitingPayment').hide();
  114.                                 clearInterval(interval);
  115.                                 $('#payment-processing').html("{{ 'app.hipay.payment_success' | trans }}");
  116.                                 $('#payment-processing').css('color', '#2A439B');
  117.                                 $('.lds-roller-ctn').hide();
  118.                             }
  119.                             else if(paymentStatus != 'processing' && paymentStatus != 'authorized') {
  120.                                 $('.errorPayment').show();
  121.                                 clearInterval(interval);
  122.                                 $('#payment-processing').html("{{ 'app.hipay.payment_error' | trans }}");
  123.                                 $('#payment-processing').css('color', '#FF6254');
  124.                                 $('.lds-roller-ctn').hide();
  125.                             }
  126.                         }
  127.                     });
  128.                 }, 1000);
  129.             }
  130.             else {
  131.                 $('.successPayment').show();
  132.             }
  133.             // Google Tag Manager
  134.             if (typeof dataLayer === 'undefined') {
  135.                 dataLayer = [];
  136.             }
  137.             
  138.             dataLayer.push({ ecommerce: null });  // Clear the previous ecommerce object.
  139.             dataLayer.push({
  140.                 event: "purchase",
  141.                 ecommerce: {
  142.                     transaction_id: {{  order.number }},
  143.                     value: {{ order.total/100|replace({'€': '',',': '.'}) }},
  144.                     tax: 20.00,
  145.                     currency: "EUR",
  146.                     items: [
  147.                         {% for item in order.items %}                        
  148.                             {
  149.                                 item_id: {{ item.variant.id }},
  150.                                 item_name: "{{ item.variant.name }}",
  151.                                 index: {{ loop.index0 }},
  152.                                 item_brand: "PPMC",
  153.                                 price: {{ item.unitPrice/100|replace({'€': '',',': '.'}) }},
  154.                                 quantity: {{ item.quantity }}
  155.                             },                        
  156.                         {% endfor %}
  157.                     ]
  158.                 }
  159.             });
  160.         });
  161.     </script>
  162. {% endblock %}