Files
kupshop/web/templates/koza/ordering.user.tpl
2025-08-02 16:30:27 +02:00

390 lines
17 KiB
Smarty

{extends "ordering.tpl"}
{block "order-content"}
{* omezeni delky inputu kvuli Swisspost *}
{if $cfg.Order.Countries['CH']}{$isSwiss = true}{/if}
{if $ctrl.logged}
<p>{t}Jste přihlášený jako uživatel {/t}{$ctrl.name} {$ctrl.surname} ({$ctrl.login}).</p>
<input type="hidden" name="invoice[email]" value="{$ctrl.login}">
{else}
<h3>{t}Zadejte e-mail{/t}</h3>
<div class="row signinrow open">
{block "order-user-email"}
<div class="col-lg-3 col-md-6">
<div class="form-group required">
<label for="iemail">{t}E-mail{/t}</label>
<input type="email" name="invoice[email]" id="iemail" value="{$body.invoice.email}"
class="form-control"
data-bv-notempty="true" data-bv-emailaddress="true"
data-bv-emailaddress-message="{t}Zadejte platnou e-mailovou adresu{/t}">
</div>
</div>
{/block}
<div class="col-lg-6 col-md-12 {if !$body->register}hidden-xs-up{/if}">
<div class="row">
<div id="passwords">
<div class="col-sm-5 pass">
<div class="form-group required">
<label for="password">{t}Heslo{/t}</label>
{block "password"}
<input type="password" name="password" value="{$body->register}"
{if !$body->register}disabled{/if} id="password" class="form-control"
data-bv-notempty="true"
data-bv-stringlength="true" data-bv-stringlength-min="6">
{/block}
</div>
</div>
<div class="col-sm-5 pass">
<div class="form-group required">
<label for="passwordAgain">{t}Heslo znovu{/t}</label>
<input type="password" name="passwordAgain" id="passwordAgain" class="form-control"
{if !$body->register}disabled{/if} value="{$body->register}"
data-bv-notempty="true" data-bv-stringlength="true" data-bv-identical="true"
data-bv-identical-message="{t}Hesla se neshodují{/t}"
data-bv-identical-field="password">
</div>
</div>
<div class="col-sm-2 text-center">
<a href="#" class="email-unregister"><i class="fc fc-remove"></i><span
class="hidden-sm-up">{t}Zrušit registraci{/t}</span></a>
</div>
</div>
</div>
</div>
<div class="col-lg-6 col-md-12 {if $body->register}hidden-xs-up{/if}">
<div class="row">
<div id="email-text">
<div class="col-sm-12">
<p>{t}Zadejte prosím pečlivě svůj e-mail.{/t}</p>
</div>
</div>
</div>
</div>
</div>
{/if}
<hr>
<h3>{t}Kontaktní údaje{/t}</h3>
<div class="row">
{block "user-data"}
<div class="col-xl-3 col-md-4 col-sm-6">
<div class="form-group required">
<label for="iname">{t}Jméno{/t}</label>
<input type="text" name="invoice[name]" id="iname" class="form-control" value="{$body.invoice.name}"
data-bv-notempty="true" data-bv-stringlength="true" data-bv-stringlength-min="2"
{if $isSwiss}data-bv-stringlength-max="14"{/if}>
</div>
</div>
<div class="col-xl-3 col-md-4 col-sm-6">
<div class="form-group required">
<label for="isurname">{t}Příjmení{/t}</label>
<input type="text" name="invoice[surname]" id="isurname" class="form-control"
value="{$body.invoice.surname}"
data-bv-notempty="true" data-bv-stringlength="true" data-bv-stringlength-min="2"
{if $isSwiss}data-bv-stringlength-max="20"{/if}>
</div>
</div>
<div class="col-xl-3 col-lg-4 col-sm-6">
<div class="form-group">
<label for="icustom_address">{t}Název firmy (do zaměstnání...){/t}</label>
<input type="text" name="invoice[custom_address]" id="icustom_address" class="form-control" value="{$body.invoice.custom_address}"
{if $isSwiss}data-bv-stringlength="true" data-bv-stringlength-max="35"{/if}
{if !empty($body.invoice.firm) and getAdminUser()}disabled="disabled"{/if}>
</div>
</div>
<div class="col-xl-3 col-md-4 col-sm-6">
<div class="form-group required">
<label for="iphone">{t}Telefon{/t}</label>
<input type="tel" name="invoice[phone]" id="iphone" class="form-control" value="{$body.invoice.phone}"
data-bv-notempty="true" data-bv-phone="true" data-bv-phone-country="invoice[country]"
data-bv-phone-message="{t}Zadejte platné telefoní číslo{/t}">
</div>
</div>
{/block}
</div>
{$deliveryType = $body->getDeliveryType()}
{if $deliveryType && $deliveryType->getPayment() && $deliveryType->getPayment()->class === 'Intrum'}
<hr>
<div class="row">
<div class="col-xl-3 col-md-4 col-sm-6">
<div class="form-group required">
<label for="igender">{t}Pohlaví{/t}</label>
<select class="form-control custom-select" id="igender" name="invoice[gender]">
<option value="male"{if $body.invoice.gender !== 'female'} selected="selected"{/if}>{t}muž{/t}</option>
<option value="female"{if $body.invoice.gender === 'female'} selected="selected"{/if}>{t}žena{/t}</option>
</select>
</div>
</div>
<div class="col-xl-3 col-md-4 col-sm-6">
<div class="form-group required">
<label for="ibirthdate">{t}Datum narození{/t}</label>
<input type="text" name="invoice[birthdate]" id="ibirthdate" class="form-control"
value="{$body.invoice.birthdate}"
data-bv-notempty="true" data-bv-regexp="true" data-bv-regexp-message="YYYY-MM-DD"
data-bv-regexp-regexp="^\d{ldelim}4{rdelim}-([0]\d|1[0-2])-([0-2]\d|3[01])$">
</div>
</div>
</div>
{/if}
<hr>
{* <h3 class="m-t-0">Fakturační adresa</h3>*}
{block "order-user-invoice_address"}
<div class="row">
{block "order-user-street"}
<div class="col-lg-3 col-sm-6">
<div class="form-group required">
<label for="istreet">{t}Ulice a č.p.{/t}</label>
<input type="text" name="invoice[street]" id="istreet" class="form-control smartform-instance-invoice smartform-address-street-and-number"
value="{$body.invoice.street}"
data-bv-notempty="true" {if $isSwiss}data-bv-stringlength="true"
data-bv-stringlength-max="35"{/if}>
</div>
</div>
{/block}
{block "order-user-city"}
<div class="col-lg-3 col-sm-6">
<div class="form-group required">
<label for="icity">{t}Město{/t}</label>
<input type="text" name="invoice[city]" id="icity" class="form-control smartform-instance-invoice smartform-address-city" value="{$body.invoice.city}"
data-bv-notempty="true" data-bv-stringlength="true" data-bv-stringlength-min="2"
{if $isSwiss}data-bv-stringlength="true" data-bv-stringlength-max="35"{/if}>
</div>
</div>
{/block}
<div class="col-xl-2 col-lg-3 col-sm-6">
<div class="form-group required">
<label for="izip">{t}PSČ{/t}</label>
<input type="text" name="invoice[zip]" id="izip" class="form-control smartform-instance-invoice smartform-address-zip" value="{$body.invoice.zip}"
data-bv-notempty="true" data-bv-zipcode="true" data-bv-zipcode-country="invoice[country]"
data-bv-zipcode-message="{t}Zadejte platné PSČ{/t}">
</div>
</div>
{block "order-user-country"}
<div class="col-lg-3 col-sm-6">
<div class="form-group required">
<label for="icountry">{t}Stát{/t}</label>
{get_contexts country=1 assign='country_context'}
{if $body.invoice.country}
{$active = $body.invoice.country}
{else}
{$active = $country_context.country->getActive()->getId()}
{/if}
<select class="form-control custom-select" id="icountry" name="invoice[country]"
{if $cfg.Order.Countries|count == 1}readonly{/if}>
{html_options options=$cfg.Order.Countries selected=$active}
</select>
</div>
</div>
{/block}
</div>
{/block}
{* nákup na firmu *}
{if $ctrl.active_country == "CZ"}
<div class="form-group">
<label for="firm-address" class="custom-control custom-checkbox" data-cart-noreload>
<input type="hidden" name="firm_address" value="0">
<input type="checkbox" name="firm_address" id="firm-address" class="custom-control-input"
data-opener="[data-firm-address]" {$body.invoice.firm|checked}>
<span class="custom-control-indicator"></span>
{t}Nakupuji na firmu (IČ, DIČ){/t}
<span class="clear-alt-address" style="display: none;">{t}smazat{/t}</span>
</label>
</div>
<div class="opener-content" {if !$body.invoice.firm}style="display: none;"{/if} data-firm-address>
<div class="row">
<div class="col-lg-3 col-sm-6">
<div class="form-group required">
<label for="ifirm">{t}Název firmy{/t}</label>
<input type="text" name="invoice[firm]" id="ifirm" class="form-control smartform-company-name" value="{$body.invoice.firm}"
autocomplete="off" data-bv-notempty="true" data-bv-stringlength="true" data-bv-stringlength-min="3">
</div>
</div>
{if $showCopyEmail}
<div class="col-lg-3 col-sm-6">
<div class="form-group">
<label for="icopy_email">{t}E-mail pro fakturaci{/t}</label>
<input type="email" name="invoice[copy_email]" id="icopy_email"
class="form-control smartform-instance-invoice smartform-email" value="{$body.invoice.copy_email}"
autocomplete="off">
</div>
</div>
{/if}
<div class="col-lg-3 col-sm-6">
<div class="form-group required">
<label for="iico">{t}IČO{/t}</label>
<input type="number" name="invoice[ico]" id="iico" class="form-control disable-spinner smartform-company-registration-number" value="{$body.invoice.ico}"
autocomplete="off" data-bv-notempty="true" data-bv-stringlength="true" data-bv-stringlength-min="8"
data-bv-stringlength-max="10">
</div>
</div>
<div class="col-lg-3 col-sm-6">
<div class="form-group required">
<label for="idic">{t}DIČ{/t}</label>
<input type="text" name="invoice[dic]" id="idic" class="form-control smartform-company-vat-number" value="{$body.invoice.dic}"
autocomplete="off" data-bv-notempty="true" data-bv-vat="true" data-bv-vat-country="invoice[country]">
</div>
</div>
</div>
</div>
{/if}
{* Hidden inputy "vyresetuji" pripadne automaticky ulozene delivery udaje, viz bug 6073 *}
<input type="hidden" name="delivery[name]" value="">
<input type="hidden" name="delivery[surname]" value="">
<input type="hidden" name="delivery[custom_address]" value="">
<input type="hidden" name="delivery[firm]" value="">
<input type="hidden" name="delivery[street]" value="">
<input type="hidden" name="delivery[city]" value="">
<input type="hidden" name="delivery[zip]" value="">
<input type="hidden" name="delivery[zip]" value="">
<input type="hidden" name="delivery[country]" value="">
<input type="hidden" name="delivery[gender]" value="">
<hr>
<div class="row">
{block "order-note"}
<div class="col-md-6 col-xs-12">
<div class="form-group">
<label for="noteUser">{t}Poznámka k objednávce{/t}</label>
<input type="text" name="noteUser" id="noteUser" class="form-control" value="{$body.note}">
</div>
</div>
{/block}
<div class="col-md-6 col-xs-12 step-user">
{showPriceBox transport=1}
</div>
</div>
<div class="alert alert-danger" role="alert" data-alert="wrong-country" style="display: none;">
Vybraná země doručení není obsluhována vybraným způsobem dopravy. Prosím upravte zemi doručení nebo <a
href="/kosik/doprava-platba/">způsob dopravy</a>.
</div>
{* tlačítka + informační text *}
{block 'cart-buttons'}
{cartBtns submitName='OrderNext' valueNext='summary'}
{/block}
{/block}
<script>
{block onready append}
{block "doCheckEmail"}
function doCheckEmail() {
var email = $('#iemail').val(),
message = '',
regexp = {literal}/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i{/literal};
if (!regexp.test(email)) {
message += '{t escape=js}Jste si jistí správností e-mailové adresy?{/t}';
showMessage(message);
} else {
var data = {
'email': email,
};
$.post('/launch.php?s=ajax&type=email', data, function(data) {
if (data.found) {
message = '{t escape=js}Již u nás máte účet{/t}. <a href="{url s=login}" class="cart-signin">{t}Přihlaste se{/t}</a>';
} else {
message = '{t escape=js}Registrace má své výhody{/t}. <a href="{url s=user act=new}" class="email-register">{t}Vytvořit účet{/t}</a>?';
}
showMessage(message);
}, 'json');
}
}
function checkEmail() {
wpj.domUtils.resetTimer('iemail', 500, doCheckEmail);
}
var $message = $('#email-text'),
$passwords = $('#passwords'),
c = $('form[role=form]');
function showMessage(message) {
$message.html('<div class="col-sm-12"><p>' + message + '</p></div>');
}
{/block}
var $email = $('#iemail');
$email.on('keydown input change validate', checkEmail);
if ($email.val())
$email.trigger('validate');
{if !$ctrl.logged}
$form.on('click', '.email-register, .email-unregister', function() {
var $fields = $('#password, #passwordAgain'),
register = $(this).is('.email-register');
$fields.val('').prop('disabled', false);
$form.data('bootstrapValidator').resetForm();
wpj.domUtils.crossFade($message, $passwords);
enablePasswordValidation(register);
return false;
}).on('click', '.cart-signin', function() {
$('#login').login('setEmail', $('#iemail').val());
});
function enablePasswordValidation(enable) {
$form.bootstrapValidator('enableFieldValidators', 'password', enable);
$form.bootstrapValidator('enableFieldValidators', 'passwordAgain', enable);
}
enablePasswordValidation({if $body->register}true{else}false{/if});
{/if}
{* Revalidace po změně země jen pokud mam na vyber vic zemi *}
{if $cfg.Order.Countries|count > 1}
var reCheckField = function(fieldName) {
$.each(fieldName, function(i, field) {
{* preskoc otravnou validaci prazdnych poli *}
if (!$form.find('[name="' + field + '"]').val())
return true;
$form.data('bootstrapValidator').updateStatus(field, 'NOT_VALIDATED').validateField(field);
});
};
$('#icountry').on('change', function() {
reCheckField(['invoice[phone]', 'invoice[zip]']);
});
{/if}
{* nákup na firmu *}
{if $ctrl.active_country == "CZ"}
$('#firm-address').on('keydown input change click', function() {
{* abra accepts only single value as adName/amName, so ignore custom_address in case company (firm) address is enabled *}
$('#icustom_address').prop('disabled', $(this).is(':checked'));
});
{/if}
$form.on('submit', function() {
var currency = '{$ctrl.currency|default:$dbcfg.currency}',
country = $('#icountry').val();
if ((country == 'SK' && currency == 'CZK') || (country == 'CZ' && currency == 'EUR')) {
$('[data-alert="wrong-country"]').show();
return false;
}
});
{/block}
</script>
{block analytics append}
{include "components/block.smartForm.tpl"}
{/block}