templates/AtechNetCoreBundle/Customer/claimsNew.html.twig line 1

Open in your IDE?
  1. {% extends 'AtechNetCoreBundle/base.html.twig' %}
  2. {% import "AtechNetCoreBundle/macros.html.twig" as macros %}
  3. {% import "AtechNetCoreBundle/input-macros.html.twig" as inputMacros %}
  4. {% block content %}
  5.     {% set defaultLocale = app.request.session.get('defaultLocale') %}
  6.     <div class="main-content">
  7.         <div class="container">
  8.             <ul class="breadcrumb">
  9.                 {% for breadcrumb in breadcrumbs %}
  10.                     <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
  11.                 {% endfor %}
  12.             </ul>
  13.             <div class="account-page mb-5">
  14.                 <div class="row mb-5">
  15.                     {% if isLoggedIn %}
  16.                         <div class="col-md-3">
  17.                             {{ macros.printAccountMenu('claims', commissionCount) }}
  18.                         </div>
  19.                     {% endif %}
  20.                     <div class="col-md-9 ps-md-3">
  21.                         <h1>{{ heading_title }}</h1>
  22.                         {% if not isLoggedIn %}
  23.                             <p>{{ 'If you have an account, please login first in order to process yout claim successfully.' | trans }}</p>
  24.                         {% elseif (orderItemId == 0) %}
  25.                             <p>{{ 'You can easily select what product you want to claim by selecting the order from your {link_start}Orders list{link_end}, opening the order and clicking on claim on the specific order item.' | trans({'link_start':'<a href="' ~ path('customer_orders') ~ '">','link_end':'</a>'}) | raw }}</p>
  26.                         {% endif %}
  27.                         {{ form_start(form, {'attr':{'enctype':'multipart/form-data'}}) }}
  28.                         {% if isLoggedIn %}
  29.                             <div class="alert alert-warning" role="alert">
  30.                                 {{ 'Please check that your address is filled out correctly.' | trans }}
  31.                             </div>
  32.                         {% endif %}
  33.                         <div class="row">
  34.                             <div class="col-sm-12 mt-4 mb-2">
  35.                                 <h2>{{ 'Customer info' | trans }}</h2>
  36.                             </div>
  37.                         </div>
  38.                         <div class="row required">
  39.                             {{- inputMacros.inputGroup(form.firstName, {'cols': "col-12"}) -}}
  40.                         </div>
  41.                         <div class="row required">
  42.                             {{- inputMacros.inputGroup(form.lastName, {'cols': "col-12"}) -}}
  43.                         </div>
  44.                         <div class="row">
  45.                             {{- inputMacros.inputGroup(form.businessName, {'cols': "col-12"}) -}}
  46.                         </div>
  47.                         {% if app.request.locale == 'en' %}
  48.                             <div class="row">
  49.                                 {{- inputMacros.inputGroup(form.country, {'cols': "col-12"}) -}}
  50.                             </div>
  51.                         {% endif %}
  52.                         <div class="row required">
  53.                             {{- inputMacros.inputGroup(form.street, {'cols': "col-12"}) -}}
  54.                         </div>
  55.                         <div class="row required">
  56.                             {{- inputMacros.inputGroup(form.city, {'cols': "col-12"}) -}}
  57.                         </div>
  58.                         <div class="row required">
  59.                             {{- inputMacros.inputGroup(form.zip, {'cols': "col-12"}) -}}
  60.                         </div>
  61.                         <div class="row required">
  62.                             {{- inputMacros.inputGroup(form.phone, {
  63.                                 'cols': "col-12",
  64.                                 'isGroup': true,
  65.                                 'groupLeftContent': defaultLocale != 'en' ? callingCountryCode : false
  66.                             }) -}}
  67.                         </div>
  68.                         <div class="row required">
  69.                             {{- inputMacros.inputGroup(form.email, {'cols': "col-12"}) -}}
  70.                         </div>
  71.                         <div class="row ">
  72.                             <div class="col-sm-12 mt-4">
  73.                                 <h2>{{ 'Address (place of item pickup)' | trans }}</h2>
  74.                             </div>
  75.                         </div>
  76.                         {% if defaultLocale != 'en' %}
  77.                             <div class="radio-buttons">
  78.                                 <div class="radio-wrapper">
  79.                                     <input class="form-check-input" type="radio" name="delivery_type" value="packeta" id="delivery-packeta" checked>
  80.                                     <label for="delivery-packeta">
  81.                                         <div class="radio-circle"></div>
  82.                                         <div class="method-label-text">
  83.                                             <span>{{ 'Claim packeta label'|trans }}{{ deliveryPrice ? ' ('~ 'Free'|trans|lower ~')' : '' }}</span>
  84.                                         </div>
  85.                                     </label>
  86.                                 </div>
  87.                                 <div class="row">
  88.                                     {{- inputMacros.inputGroup(form.incomingPacketaBranchLabel, {
  89.                                         'cols': "col-12",
  90.                                         'isGroup': true,
  91.                                         'hintText': 'Packeta plus info'|trans
  92.                                     }) -}}
  93.                                     {{- form_widget(form.incomingPacketaBranchId) -}}
  94.                                 </div>
  95.                                 <div class="radio-wrapper">
  96.                                     <input class="form-check-input" type="radio" name="delivery_type" value="gls" id="delivery-courier">
  97.                                     <label for="delivery-courier">
  98.                                         <div class="radio-circle"></div>
  99.                                         <div class="method-label-text">
  100.                                             <span>{{ 'Claim courier label'|trans }}{% if deliveryPrice %}, {{ deliveryPrice[domainId] }} {{ currency }}{% endif %}</span>
  101.                                         </div>
  102.                                     </label>
  103.                                     <small id="gls-return-address" class="hint-text mt-1 ms-2">
  104.                                         {{ 'Return address'|trans }}: furbify s.r.o. Osada Reviczkého 38, Kolárovo 946 03, {{ 'Slovakia' | trans }}
  105.                                     </small>
  106.                                 </div>
  107.                             </div>
  108.                         {% endif %}
  109.                         <div class="row">
  110.                             <div class="col-sm-12 mt-4 mb-2">
  111.                                 <h2>{{ 'Order info' | trans }}</h2>
  112.                             </div>
  113.                         </div>
  114.                         <div class="row required">
  115.                             <div class="has-validation mb-3">
  116.                                 <div class="form-floating w-100">
  117.                                     <input type="text" id="customer_claim_order_id" name="customer_claim[order_id]" required="required" class="form-control valid" placeholder="..."  aria-required="true" aria-invalid="false" value="{{ orderNumber is defined and orderNumber ? orderNumber : '' }}">
  118.                                     <label class="form-label" for="customer_claim_order_id">{{'Order ID' | trans}}: 202XXXXXX</label>
  119.                                 </div>
  120.                             </div>
  121.                         </div>
  122.                        
  123.                         <div class="row required">
  124.                             {{- inputMacros.inputGroup(form.boughtDate, {'cols': "col-12"}) -}}
  125.                         </div>
  126.                         <div class="row required">
  127.                             {{- inputMacros.inputGroup(form.invoiceCode, {'cols': "col-12"}) -}}
  128.                         </div>
  129.                         <div class="row">
  130.                             {{- inputMacros.inputGroup(form.productType, {'cols': "col-12"}) -}}
  131.                         </div>
  132.                         <div class="row required">
  133.                             {{- inputMacros.inputGroup(form.productTitle, {'cols': "col-12"}) -}}
  134.                         </div>
  135.                         <div class="row">
  136.                             {{- inputMacros.inputGroup(form.serialNumber, {'cols': "col-12", 'hintText': '('~'not required'|trans ~ ')'}) -}}
  137.                         </div>
  138.                         <div class="row">
  139.                             <div class="col-sm-12 mt-4 mb-2">
  140.                                 <h2>{{ 'Other' | trans }}</h2>
  141.                             </div>
  142.                         </div>
  143.                         <div class="row">
  144.                             <div class="col-sm-12 mb-3">
  145.                                 <label for="claim-medias">{{ 'Photo upload' | trans }} <span>({{ 'not required' | trans }}, {{ 'maximum {count} images' | trans ({'count':3}) }})</span></label>
  146.                                 <input type="file" id="claim-medias" name="claimMedias[]" class="form-control" accept="image/png, image/jpeg, image/jpg" multiple>
  147.                             </div>
  148.                         </div>
  149.                         <div class="row required">
  150.                             {{- inputMacros.inputGroup(form.customerNote, {'cols': "col-12"}) -}}
  151.                         </div>
  152.                         <div class="mt-2 google-recaptcha">
  153.                             <div class="g-recaptcha" data-callback="recaptchaCallback" data-sitekey="{{ app.request.server.get('APP_ENV') == 'dev' ? '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI' : '6LcgtrsUAAAAAKfbqtsyv3O06NjYslER3UcqCwJS'}}"></div>
  154.                         </div>
  155.                         <div class="buttons clearfix mt-4 mb-3 add-claim-button">
  156.                             <p class="red-text">{{ 'Please check field "Im not a robot"' | trans }}</p>
  157.                             <button type="submit" class="btn btn-primary" disabled="disabled">{{ 'Save' | trans }}</button> {% if isLoggedIn %}<a href="{{ path('customer_claims') }}" class="btn btn-link" style="color:#007bff">{{ 'Back' | trans }}</a>{% endif %}
  158.                         </div>
  159.                         {{ form_end(form) }}
  160.                     </div>
  161.                 </div>
  162.             </div>
  163.             {{ include(template_from_string(contentBottom)) }}
  164.         </div>
  165.     </div>
  166. {% endblock %}
  167. {% block stylesheets %}
  168.     {{ parent() }}
  169.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css">
  170.     <style>
  171.         .required label::after {
  172.             content: " *";
  173.             color: red;
  174.         }
  175.         #customer_claim_customerNote {
  176.             height: unset;
  177.         }
  178.         .form-check {
  179.             display: flex;
  180.             flex-direction: row;
  181.             align-items: center;
  182.             justify-content: flex-start;
  183.             margin-bottom: 8px;
  184.             padding-left: 0;
  185.         }
  186.         .form-check:hover {
  187.             cursor: pointer;
  188.         }
  189.         .form-check-label {
  190.             margin-left: 10px;
  191.         }
  192.         .input-group-text.packeta-icon:hover {
  193.             cursor: pointer;
  194.         }
  195.     </style>
  196. {% endblock %}
  197. {% block javascripts %}
  198.     {{ parent() }}
  199.     {% set locale = app.request.locale %}
  200.     {% set defaultLocale = app.request.session.get('defaultLocale') %}
  201.     <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js"></script>
  202.     {% if locale != 'en' %}
  203.         <script src="{{ asset('https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/locales/bootstrap-datepicker.' ~ ( locale == 'cz' ? 'cs' : locale ) ~ '.min.js') }}"></script>
  204.     {% endif %}
  205.     <script src="https://www.google.com/recaptcha/api.js?hl={{ locale == 'cz' ? 'cs' : locale }}" async defer></script>
  206.     {% if defaultLocale != 'en' %}
  207.         <script src="https://widget.packeta.com/v6/www/js/library.js"></script>
  208.     {% endif %}
  209.     <script src="{{ asset('theme/js/jquery.validate.js') }}"></script>
  210.     <script>
  211.         {% if defaultLocale != 'en' %}
  212.             const packetaApiKey = '{{ packetaApiKey }}';
  213.             function packetaModalDialog(div) {
  214.                 Packeta.Widget.pick(packetaApiKey, showSelectedCarrierPickupPoint.bind(div), {
  215.                     country: '{{ shippingCountry }}',
  216.                     language: "{{ locale == 'cz' ? 'cs' : locale }}",
  217.                     livePickupPoint: true
  218.                 });
  219.             }
  220.             function showSelectedCarrierPickupPoint(point) {
  221.                 hidePacketaErrorMessage();
  222.                 if (point) {
  223.                     let pointId = point.id;
  224.                     let pickupPointAddress = point ?  point.city + " - " + point.zip + ", " + point.street : "";
  225.                     $('#customer_claim_incomingPacketaBranchId').val(pointId);
  226.                     $('#customer_claim_incomingPacketaBranchLabel').val(pickupPointAddress);
  227.                     document.getElementById('customer_claim_incomingPacketaBranchLabel').classList.remove('error');
  228.                 }
  229.             };
  230.             function showPacketaErrorMessage(message)
  231.             {
  232.                 $('#packeta-error-message').html(message).removeClass('hide');
  233.             }
  234.             function hidePacketaErrorMessage()
  235.             {
  236.                 $('#packeta-error-message').addClass('hide');
  237.             }
  238.             $('#customer_claim_incomingPacketaBranchLabel').click(function(){
  239.                 packetaModalDialog(document.getElementById('packeta-modal'));
  240.             }); 
  241.             document.getElementById('delivery-courier').addEventListener('click', () => {
  242.                 document.getElementById('customer_claim_incomingPacketaBranchLabel').value = '';
  243.                 document.getElementById('customer_claim_incomingPacketaBranchId').value = '';
  244.                 document.getElementById('customer_claim_incomingPacketaBranchLabel').classList.remove('error');
  245.                 document.getElementById('customer_claim_incomingPacketaBranchLabel').disabled = true;
  246.             });
  247.             document.getElementById('delivery-packeta').addEventListener('click', () => {
  248.                 document.getElementById('customer_claim_incomingPacketaBranchLabel').disabled = false;
  249.             });
  250.             $('form[name="customer_claim"').on('submit', (e) => {
  251.                 if ($('#delivery-packeta').prop('checked')) {
  252.                     if (document.getElementById('customer_claim_incomingPacketaBranchLabel').value == '' || document.getElementById('customer_claim_incomingPacketaBranchId').value == '') {
  253.                         e.preventDefault();
  254.                         document.getElementById('customer_claim_incomingPacketaBranchLabel').classList.add('error');
  255.                         scrollToElementWithId('customer_claim_email');
  256.                     }
  257.                 } else if ($('#delivery-courier').prop('checked') == false) {
  258.                     e.preventDefault();
  259.                 }
  260.             });
  261.             document.querySelector('.input-group-text.packeta-icon').addEventListener('click', () => {
  262.                 if (!document.getElementById('customer_claim_incomingPacketaBranchLabel').disabled) {
  263.                     $('#customer_claim_incomingPacketaBranchLabel').click();
  264.                 }
  265.             })
  266.             // show/hide return address info if GLS was selected
  267.             const glsReturnAddress = document.getElementById('gls-return-address')
  268.             const showGlsReturnAddress = show => glsReturnAddress.hidden = !show;
  269.             const handleDeliveryTypeChange = e => showGlsReturnAddress(e.target.value === 'gls')
  270.             document.getElementsByName('delivery_type').forEach(dt => dt.addEventListener('change', handleDeliveryTypeChange));
  271.             showGlsReturnAddress(document.getElementById('delivery-courier').checked); // on page load
  272.         {% endif %}
  273.         let isValidOrderNumber = {{ orderNumber is defined and orderNumber ? 'true' : 'false' }};
  274.         let recaptchaIsValid = false;
  275.         $('#customer_claim_boughtDate').datepicker({
  276.             format: 'yyyy-mm-dd',
  277.             language: "{{ locale == 'cz' ? 'cs' : locale }}"
  278.         });
  279.         function recaptchaCallback() {
  280.             recaptchaIsValid = true;
  281.             if(isValidOrderNumber){
  282.                 $('.add-claim-button button').removeAttr('disabled');
  283.             }
  284.         }
  285.         let inputPhone = document.getElementById('customer_claim_phone');
  286.         if ( inputPhone != null ) {
  287.             inputPhone.addEventListener('keyup', () => {
  288.                 inputPhone.classList.remove('is-invalid');
  289.                 let feedback = inputPhone.parentElement.querySelector('.invalid-feedback');
  290.                 if ( !checkPhoneNumber(inputPhone.value, '{{ defaultLocale }}') ) {
  291.                     if ( feedback == null ) {
  292.                         feedback = document.createElement('div');
  293.                         feedback.classList.add('invalid-feedback');
  294.                         feedback.innerHTML = '{{ 'Invalid phone number' | trans | raw }}';
  295.                         inputPhone.parentElement.appendChild(feedback);
  296.                     }
  297.                     inputPhone.classList.add('is-invalid');
  298.                 }
  299.             });
  300.         }
  301.         $.validator.addMethod("phoneFormat", function(value, element) {
  302.             return checkPhoneNumber(value, '{{ defaultLocale }}');
  303.         }, "{{ 'Invalid phone number' | trans | raw }}");
  304.         let checkoutForm = $('form[name="customer_claim"]').validate({
  305.             errorPlacement: function(error, element) {
  306.                 $('.invalid-feedback > label', element.parent().parent()).remove();
  307.                 $('.invalid-feedback', element.parent().parent()).append(error);
  308.                 $('.invalid-feedback', element.parent().parent()).css('display', 'block');
  309.             },
  310.             rules: {
  311.                 "customer_claim[firstName]": {
  312.                     required: true,
  313.                     minlength: 2,
  314.                     maxlength: 64
  315.                 },
  316.                 "customer_claim[lastName]": {
  317.                     required: true,
  318.                     minlength: 2,
  319.                     maxlength: 64
  320.                 },
  321.                 "customer_claim[zip]": {
  322.                     required: true,
  323.                     minlength: 2,
  324.                     maxlength: 8
  325.                 },
  326.                 "customer_claim[city]": {
  327.                     required: true,
  328.                     minlength: 2,
  329.                     maxlength: 64
  330.                 },
  331.                 "customer_claim[street]": {
  332.                     required: true,
  333.                     minlength: 2,
  334.                     maxlength: 128
  335.                 },
  336.                 "customer_claim[phone]": {
  337.                     required: true,
  338.                     minlength: 2,
  339.                     maxlength: 18
  340.                 },
  341.                 "customer_claim[email]": {
  342.                     required: true,
  343.                     minlength: 2,
  344.                     maxlength: 64
  345.                 },
  346.                 "customer_claim[businessName]": {
  347.                     maxlength: 64
  348.                 },
  349.                 "customer_claim[productTitle]": {
  350.                     required: true,
  351.                     maxlength: 128
  352.                 },
  353.                 "customer_claim[serialNumber]": {
  354.                     maxlength: 64
  355.                 },
  356.                 "customer_claim[invoiceCode]": {
  357.                     maxlength: 32
  358.                 }
  359.             }
  360.         });
  361.         const orderNumberCheck = '{{ path("ajax_check_order_number") }}';
  362.         $('#customer_claim_order_id').on('change', function (){
  363.            $.post(orderNumberCheck, {
  364.                orderNumber: this.value
  365.            }).done(function (response){
  366.                if (response.success === false){
  367.                    alert(response.message);
  368.                }else{
  369.                    isValidOrderNumber = true;
  370.                    if(recaptchaIsValid){
  371.                        $('.add-claim-button button').removeAttr('disabled');
  372.                    }
  373.                }
  374.            });
  375.         });
  376.     </script>
  377. {% endblock %}
  378. {% block title %}{{ heading_title }} | {{ parent() }}{% endblock %}
  379. {% block robots %}
  380.     {% if 
  381.         ( domainId in [ const('Domain::DOMAIN_ID_RT_SK'), const('Domain::DOMAIN_ID_WS_SK') ] and app.request.locale != 'sk' ) or 
  382.         ( domainId in [ const('Domain::DOMAIN_ID_RT_HU'), const('Domain::DOMAIN_ID_WS_HU') ] and app.request.locale != 'hu' ) or 
  383.         ( domainId in [ const('Domain::DOMAIN_ID_RT_CZ'), const('Domain::DOMAIN_ID_WS_CZ') ] and app.request.locale != 'cz' ) or 
  384.         ( domainId in [ const('Domain::DOMAIN_ID_RT_EU'), const('Domain::DOMAIN_ID_WS_EU') ] and app.request.locale != 'en' ) 
  385.     %}
  386.         <meta name="robots" content="noindex, nofollow, noarchive">
  387.     {% else %}
  388.         <meta name="robots" content="noindex">
  389.     {% endif %}
  390. {% endblock %}
  391. {% block header %}
  392.     {{ include(template_from_string(header)) }}
  393. {% endblock %}
  394. {% block footer %}
  395.     {{ include(template_from_string(footer)) }}
  396. {% endblock %}