32 lines
1.8 KiB
Smarty
32 lines
1.8 KiB
Smarty
{if $dbcfg.smartform == "Y"}
|
|
<script type="text/javascript" src="https://client.smartform.cz/v2/smartform.js" async></script>
|
|
<script type="text/javascript">
|
|
var smartform = smartform || { };
|
|
smartform.beforeInit = function () {
|
|
smartform.setClientId('v9QX920R74');
|
|
}
|
|
|
|
var invoice_country = $('[name=\'data[invoice_country]\'], [name=\'data[country]\']').val();
|
|
var delivery_country = $('[name=\'data[delivery_country]\']').val();
|
|
|
|
smartform.afterInit = function () {
|
|
smartform.getInstance('smartform-instance-invoice').addressControl.setAllSuggestionsEnabled((invoice_country === 'CZ' || invoice_country === 'SK'));
|
|
smartform.getInstance('smartform-instance-invoice').companyControl.setAllSuggestionsEnabled((invoice_country === 'CZ'));
|
|
smartform.getInstance('smartform-instance-invoice').addressControl.setCountry(invoice_country);
|
|
|
|
smartform.getInstance('smartform-instance-delivery').addressControl.setAllSuggestionsEnabled((delivery_country === 'CZ' || delivery_country === 'SK'));
|
|
smartform.getInstance('smartform-instance-delivery').companyControl.setAllSuggestionsEnabled((delivery_country === 'CZ'));
|
|
smartform.getInstance('smartform-instance-delivery').addressControl.setCountry(delivery_country);
|
|
}
|
|
|
|
$('[name*=\'country\']').on('change', function () {
|
|
var instance = $(this).data('smartform-instance'),
|
|
country = $(this).val();
|
|
|
|
smartform.getInstance('smartform-instance-' + instance).addressControl.setAllSuggestionsEnabled((country === 'CZ' || country === 'SK'));
|
|
smartform.getInstance('smartform-instance-' + instance).companyControl.setAllSuggestionsEnabled((country === 'CZ'));
|
|
smartform.getInstance('smartform-instance-' + instance).addressControl.setCountry(country);
|
|
});
|
|
</script>
|
|
{/if}
|