153 lines
4.4 KiB
Smarty
153 lines
4.4 KiB
Smarty
{extends "index.tpl"}
|
|
|
|
{block "css" append}
|
|
{encore_entry_link_tags entry='cart'}
|
|
{/block}
|
|
|
|
{block "meta-robots"}
|
|
<meta name="robots" content="noindex, nofollow">
|
|
{/block}
|
|
|
|
{block newsletter}
|
|
{/block}
|
|
|
|
{block "google_tag_manager"}
|
|
{include 'block.analytics.gtm.tpl' pageType='cart'}
|
|
{/block}
|
|
|
|
{function cartBtns}
|
|
{block 'cart-buttons'}
|
|
{include "ordering/cart-btns.tpl"}
|
|
{/block}
|
|
{/function}
|
|
|
|
{block "body-container"}
|
|
|
|
{block "tpl-vars"}
|
|
{$tpl_vars.gdpr_checkbox = ($dbcfg.consent.enable == 'Y')}
|
|
{/block}
|
|
|
|
{function showPriceBox}
|
|
{include "ordering/pricebox.tpl"}
|
|
{/function}
|
|
|
|
{block 'cart-vars'}
|
|
{$cartVars=['butttonPrev'=>'btn-prevstep btn-outlined m-b-1','butttonNext'=>'btn-nextstep m-b-1','text'=>"{t}Pokračovat na další krok{/t}"]}
|
|
{/block}
|
|
|
|
<div class="container order-container">
|
|
{block "order-process"}
|
|
{include "ordering/order-process.tpl"}
|
|
{/block}
|
|
|
|
<div class="row">
|
|
<div class="col-xs-12">
|
|
|
|
<form name="login" method="post" action="" role="form" id="cart" class="cart-form cart-{$body.stepName}">
|
|
|
|
{block 'cart-messages'}
|
|
{include "ordering/cart-messages.tpl"}
|
|
{/block}
|
|
|
|
<div {if $body.stepName == 'cart'}data-reload="cart-error"{/if}>
|
|
{if $body.error}
|
|
<div class="alert {if $body.error_id == 4}alert-success{else}alert-danger{/if}" role="alert">
|
|
{$body.error nofilter}
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
|
|
{block "order-content"}
|
|
{/block}
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{/block}
|
|
|
|
{block "js-entry" append}
|
|
{encore_entry_script_tags entry='cart'}
|
|
{/block}
|
|
|
|
{block "js-dynamic-load" append}
|
|
{asset_compile}
|
|
<script src="/common/static/bootstrapvalidator/js/bootstrapValidator.js"></script>
|
|
<script src="/common/static/bootstrapvalidator/js/language/{$ctrl.active_language_code}.js"></script>
|
|
{/asset_compile}
|
|
{/block}
|
|
|
|
<script>
|
|
{block onready append}
|
|
|
|
var $form = $('form[role=form]');
|
|
|
|
$form.bootstrapValidator({
|
|
feedbackIcons: {
|
|
valid: 'fc fc-check',
|
|
invalid: 'fc fc-remove',
|
|
validating: 'fc fc-refresh',
|
|
},
|
|
{if $body.stepName == 'summary'}excluded: [':disabled'],{/if} {* kvuli checkboxu na poslednim kroku na profumicitte *}
|
|
}).on('change', '[data-bv-notempty]', function(event) {
|
|
var $this = $(event.target),
|
|
elementName = $this.attr('name');
|
|
|
|
$(event.target.form)
|
|
// Get the bootstrapValidator instance
|
|
.data('bootstrapValidator')
|
|
// Mark the field as not validated, so it'll be re-validated when the user change date
|
|
.updateStatus(elementName, 'NOT_VALIDATED', null)
|
|
// Validate the field
|
|
.validateField(elementName);
|
|
}).on('validationError.validator.bv', function(e, data) {
|
|
// Disable multiple error messages for one field
|
|
data.element.data('bv.messages')
|
|
// Hide all the messages
|
|
.find('.help-block[data-bv-for="' + data.field + '"]').hide()
|
|
// Show only message associated with current validator
|
|
.filter('[data-bv-validator="' + data.validator + '"]').show();
|
|
});
|
|
|
|
// Openers
|
|
wpj.domUtils.initOpeners();
|
|
|
|
var delivery_types = {
|
|
{foreach $body.delivery_types as $id => $delivery}
|
|
"{$delivery.id}": [{$delivery.id_delivery}, {$delivery.id_payment}]{if !$delivery@last},{/if}
|
|
{/foreach}
|
|
};
|
|
|
|
var formValidation = $form.data('bootstrapValidator');
|
|
|
|
$('#cart').cart({
|
|
delivery_types: delivery_types,
|
|
deliverychange: function() {
|
|
formValidation.disableSubmitButtons(false);
|
|
},
|
|
paymentchange: function() {
|
|
formValidation.disableSubmitButtons(false);
|
|
},
|
|
select_first: false,
|
|
});
|
|
|
|
{if $body.error_id}
|
|
var $alert = $('.alert').first();
|
|
if ($alert.length && !wpj.domUtils.isInView($alert)) {
|
|
wpj.domUtils.scrollTo($alert);
|
|
}
|
|
{/if}
|
|
|
|
$form.on('submit', function() {
|
|
var err = $('.has-error').first();
|
|
|
|
if (err.length && !wpj.domUtils.isInView(err)) {
|
|
wpj.domUtils.scrollTo(err);
|
|
}
|
|
|
|
return true;
|
|
});
|
|
|
|
{include "block.gtm.tpl" gtm_type="cartOnReady"}
|
|
{/block}
|
|
</script>
|