1( function ( $ ) { 2 SS6 = window.SS6 || { }; 3 SS6.order = SS6.order || { }; 4 SS6.order.paymentTransportRelations = [ ]; 5 var isConfirmed = false; 6 SS6.order.init = function ( $container ) { 7 var $transportInputs = $container.filterAllNodes ( '.js-order-transport-input' ); 8 var $paymentInputs = $container.filterAllNodes ( '.js-order-payment-input' ); 9 $transportInputs.change ( SS6.order.onTransportChange ); 10 $paymentInputs.change ( SS6.order.onPaymentChange ); 11 SS6.order.updateTransports ( ); 12 SS6.order.updatePayments ( ); 13 $transportInputs.change ( SS6.order.updateContinueButton ); 14 $paymentInputs.change ( SS6.order.updateContinueButton ); 15 SS6.order.updateContinueButton ( ); 16 var $form = $container.filterAllNodes ( '#js-order-form' ); 17 SS6.order.initCountryValidationByCurrentCurrency ( $form ); 18 }; 19 SS6.order.addPaymentTransportRelation = function ( paymentId, transportId ) { 20 if ( SS6.order.paymentTransportRelations[paymentId] === undefined ) { 21 SS6.order.paymentTransportRelations[paymentId] = [ ]; 22 } 23 SS6.order.paymentTransportRelations[paymentId][transportId] = true; 24 }; 25 SS6.order.paymentTransportRelationExists = function ( paymentId, transportId ) { 26 if ( SS6.order.paymentTransportRelations[paymentId] !== undefined ) { 27 if ( SS6.order.paymentTransportRelations[paymentId][transportId] !== undefined ) { 28 return SS6.order.paymentTransportRelations[paymentId][transportId]; 29 } 30 } 31 return false; 32 }; 33 SS6.order.updateTransports = function ( ) { 34 var $checkedPayment = $ ( '.js-order-payment-input:checked' ); 35 if ( $checkedPayment.length > 0 ) { 36 var checkedPaymentId = $checkedPayment.data ( 'id' ); 37 $ ( '.js-order-transport-input' ) . each ( function ( i, checkbox ) { 38 var $checkbox = $ ( checkbox ); 39 var id = $checkbox.data ( 'id' ); 40 if ( SS6.order.paymentTransportRelationExists ( checkedPaymentId, id ) ) { 41 $checkbox.prop ( 'disabled', false ); 42 $checkbox.closest ( 'label.box-chooser__item' ) . removeClass ( 'box-chooser__item--inactive' ); 43 } 44 else { 45 $checkbox.prop ( 'disabled', true ); 46 $checkbox.prop ( 'checked', false ); 47 $checkbox.closest ( 'label.box-chooser__item' ) . addClass ( 'box-chooser__item--inactive' ); 48 } 49 } ); 50 } 51 else { 52 $ ( '.js-order-transport-input' ) . each ( function ( i, checkbox ) { 53 var $checkbox = $ ( checkbox ); 54 $checkbox.prop ( 'disabled', false ); 55 $checkbox.closest ( 'label.box-chooser__item' ) . removeClass ( 'box-chooser__item--active' ) . removeClass ( 'box-chooser__item--inactive' ); 56 } ); 57 } 58 var $checkedTransport = $ ( '.js-order-transport-input:checked' ); 59 if ( $checkedTransport.length > 0 ) { 60 $checkedTransport.closest ( 'label.box-chooser__item' ) . removeClass ( 'box-chooser__item--inactive' ) . addClass ( 'box-chooser__item--active' ); 61 } 62 }; 63 SS6.order.updatePayments = function ( ) { 64 var $checkedTransport = $ ( '.js-order-transport-input:checked' ); 65 if ( $checkedTransport.length > 0 ) { 66 var checkedTransportId = $checkedTransport.data ( 'id' ); 67 $ ( '.js-order-payment-input' ) . each ( function ( i, checkbox ) { 68 var $checkbox = $ ( checkbox ); 69 var id = $checkbox.data ( 'id' ); 70 if ( SS6.order.paymentTransportRelationExists ( id, checkedTransportId ) ) { 71 $checkbox.prop ( 'disabled', false ); 72 $checkbox.closest ( 'label.box-chooser__item' ) . removeClass ( 'box-chooser__item--inactive' ); 73 } 74 else { 75 $checkbox.prop ( 'disabled', true ); 76 $checkbox.prop ( 'checked', false ); 77 $checkbox.closest ( 'label.box-chooser__item' ) . addClass ( 'box-chooser__item--inactive' ); 78 } 79 } ); 80 } 81 else { 82 $ ( '.js-order-payment-input' ) . each ( function ( i, checkbox ) { 83 var $checkbox = $ ( checkbox ); 84 $checkbox.prop ( 'disabled', false ); 85 $checkbox.closest ( 'label.box-chooser__item' ) . removeClass ( 'box-chooser__item--active' ) . removeClass ( 'box-chooser__item--inactive' ); 86 } ); 87 } 88 var $checkedPayment = $ ( '.js-order-payment-input:checked' ); 89 if ( $checkedPayment.length > 0 ) { 90 $checkedPayment.closest ( 'label.box-chooser__item' ) . removeClass ( 'box-chooser__item--inactive' ) . addClass ( 'box-chooser__item--active' ); 91 } 92 }; 93 SS6.order.onTransportChange = function ( ) { 94 var $this = $ ( this ); 95 var checked = $this.prop ( 'checked' ); 96 var checkedId = $this.data ( 'id' ); 97 if ( checked ) { 98 $ ( '.js-order-transport-input:checked' ) . each ( function ( i, checkbox ) { 99 var $checkbox = $ ( checkbox ); 100 var id = $checkbox.data ( 'id' ); 101 if ( id !== checkedId ) { 102 $checkbox.prop ( 'checked', false ); 103 $ ( this ) . closest ( 'label.box-chooser__item' ) . removeClass ( 'box-chooser__item--active' ); 104 } 105 } ); 106 $this.closest ( 'label.box-chooser__item' ) . addClass ( 'box-chooser__item--active' ); 107 Shopsys.gtm.orderTransport ( $this ); 108 } 109 else { 110 $this.closest ( 'label.box-chooser__item' ) . removeClass ( 'box-chooser__item--active' ); 111 } 112 SS6.order.updatePayments ( ); 113 SS6.czechPostOfficeSelection.updateSummaryVisibility ( ); 114 }; 115 SS6.order.onPaymentChange = function ( ) { 116 var $this = $ ( this ); 117 var checked = $this.prop ( 'checked' ); 118 var checkedId = $this.data ( 'id' ); 119 if ( checked ) { 120 $ ( '.js-order-payment-input:checked' ) . each ( function ( i, checkbox ) { 121 var $checkbox = $ ( checkbox ); 122 var id = $checkbox.data ( 'id' ); 123 if ( id !== checkedId ) { 124 $checkbox.prop ( 'checked', false ); 125 $ ( this ) . closest ( 'label.box-chooser__item' ) . removeClass ( 'box-chooser__item--active' ); 126 } 127 } ); 128 $this.closest ( 'label.box-chooser__item' ) . addClass ( 'box-chooser__item--active' ); 129 Shopsys.gtm.orderPayment ( $this ); 130 } 131 else { 132 $this.closest ( 'label.box-chooser__item' ) . removeClass ( 'box-chooser__item--active' ); 133 } 134 SS6.order.updateTransports ( ); 135 }; 136 SS6.order.updateContinueButton = function ( ) { 137 var checkedTransport = $ ( '.js-order-transport-input:checked' ); 138 var checkedPayment = $ ( '.js-order-payment-input:checked' ); 139 if ( checkedTransport.length === 1 && checkedPayment.length === 1 ) { 140 $ ( '#transport_and_payment_form_save' ) . removeClass ( 'btn--disabled' ); 141 } 142 else { 143 $ ( '#transport_and_payment_form_save' ) . addClass ( 'btn--disabled' ); 144 } 145 }; 146 SS6.order.initCountryValidationByCurrentCurrency = function ( $form ) { 147 $form.submit ( function ( ) { 148 if ( $form.hasClass ( 'js-no-validate' ) ) { 149 return; 150 } 151 var $countryInput = $form.find ( '.js-billing-country select' ); 152 if ( ! isConfirmed && $countryInput.length > 0 ) { 153 var selectedCountry = parseInt ( $countryInput.val ( ) ); 154 var countryIdsWithCurrentCurrency = $form.data ( 'country-ids-with-current-currency' ); 155 var selectedCountryHasCurrentCurrency = $.inArray ( selectedCountry, countryIdsWithCurrentCurrency ) !== - 1; 156 if ( ! selectedCountryHasCurrentCurrency ) { 157 SS6.window ( { content : SS6.translator.trans ( "V\u0161imli jsme si, \u017ee m\u00e1te vybr\u00e1nu m\u011bnu, kter\u00e1 neodpov\u00edd\u00e1 va\u0161emu st\u00e1tu. M\u011bnu si m\u016f\u017eete zm\u
157011bnit v menu vpravo naho\u0159e. Chcete objedn\u00e1vku takto odeslat?" ), buttonCancel : true, buttonContinue : true, textContinue : SS6.translator.trans ( "Ano" ), textCancel : SS6.translator.trans ( "Ne, uprav\u00edm si m\u011bnu" ), eventContinue : function ( ) { 158 isConfirmed = true; 159 $form.submit ( ); 160 isConfirmed = false; 161 } } ); 162 return false; 163 } 164 } 165 } ); 166 }; 167 SS6.register.registerCallback ( SS6.order.init ); 168} ) ( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.