[{assign var="invadr" value=$oView->getInvoiceAddress()}] [{assign var="blBirthdayRequired" value=$oView->isFieldRequired(oxuser__oxbirthdate)}] [{if !isset($oConfig)}] [{assign var="oConfig" value=$oViewConf->getConfig()}] [{/if}] [{capture assign="sValidationJS"}] [{*strip*}] const refreshSubmitUserBilling = function() { const invalidCount = $('form[name=order] .is-invalid').length; if (invalidCount == 0) { $('form[name=order] button[disabled=disabled]').removeAttr('disabled').attr('type','submit'); } }; $('#invadr_oxuser__oxsal').on('change', function(event) { const value = event.target.value; $('.address-only-company').hide(); $('.address-only-other').hide(); [{if $oConfig->getConfigParam('blShowUstIdForB2C')}] $('#ustIdFields').show(); if (value === 'COMPANY') { $('#ustIdLabel').text('[{oxmultilang ident="VAT_ID_NUMBER"}]'); $('#ustIdLabelHint').text('[{oxmultilang ident="VAT_ID_NUMBER_HINT_TEXT"}]'); } if (value !== 'COMPANY') { $('#ustIdLabel').text('[{oxmultilang ident="VAT_ID_NUMBER_B2C"}]'); $('#ustIdLabelHint').text('[{oxmultilang ident="VAT_ID_NUMBER_B2C_HINT_TEXT"}]'); } [{/if}] /* add all empty values one - */ const delFname = $('input[name="invadr[oxuser__oxfname]"]'); const delLname = $('input[name="invadr[oxuser__oxlname]"]'); const delCompany = $('input[name="invadr[oxuser__oxcompany]"]'); if (value === 'COMPANY') { if (delCompany.val() === '-') { delCompany.val(''); } delFname.val('-'); delLname.val('-'); $('.address-only-company').show(); } else { delCompany.val('-'); if (delFname.val() === '-') { delFname.val(''); } if (delLname.val() === '-') { delLname.val(''); } $('.address-only-other').show(); } }); [{if $oViewConf->isModuleActive('alko_imanconnector')}] $('input[name="invadr[oxuser__oxzip]"]').off('change').on('change', function(event){ event.preventDefault(); const sPostalCode = $(this).val(); const ele = $(this); const loc = window.location; $.ajax({ type: 'GET', url: loc.protocol + "//" + loc.hostname + "/index.php?cl=imanajaxcontroller&fnc=isPostalCodeValid&sPostalCode=" + sPostalCode, dataType: 'json', success: function(data) { if (!data.success) { let errorString = '[{oxmultilang ident="INVALID_ZIP_CODE"}]'; if (data.errors) { errorString = data.errors[0]; } ele.addClass("is-invalid").attr('aria-invalid', true); ele.parent().find('.invalid-feedback').text(errorString); ele.parents('form').find('button[type=submit]').attr('disabled','disabled').attr('type','button'); } else { ele.removeClass("is-invalid").attr('aria-invalid', false); } refreshSubmitUserBilling(); }, error: function() { ele.addClass("is-invalid").attr('aria-invalid', true); ele.parents('form').find('button[type=submit]').attr('disabled','disabled').attr('type','button'); refreshSubmitUserBilling(); } }); }); [{/if}] [{*/strip*}] [{/capture}] [{oxscript add=$sValidationJS}] [{if isset( $invadr.oxuser__oxbirthdate.month )}] [{assign var="iBirthdayMonth" value=$invadr.oxuser__oxbirthdate.month}] [{elseif $oxcmp_user->oxuser__oxbirthdate->value && $oxcmp_user->oxuser__oxbirthdate->value != "0000-00-00"}] [{assign var="iBirthdayMonth" value=$oxcmp_user->oxuser__oxbirthdate->value|regex_replace:"/^([0-9]{4})[-]/":""|regex_replace:"/[-]([0-9]{1,2})$/":""}] [{else}] [{assign var="iBirthdayMonth" value=0}] [{/if}] [{if isset( $invadr.oxuser__oxbirthdate.day )}] [{assign var="iBirthdayDay" value=$invadr.oxuser__oxbirthdate.day}] [{elseif $oxcmp_user->oxuser__oxbirthdate->value && $oxcmp_user->oxuser__oxbirthdate->value != "0000-00-00"}] [{assign var="iBirthdayDay" value=$oxcmp_user->oxuser__oxbirthdate->value|regex_replace:"/^([0-9]{4})[-]([0-9]{1,2})[-]/":""}] [{else}] [{assign var="iBirthdayDay" value=0}] [{/if}] [{if isset( $invadr.oxuser__oxbirthdate.year )}] [{assign var="iBirthdayYear" value=$invadr.oxuser__oxbirthdate.year}] [{elseif $oxcmp_user->oxuser__oxbirthdate->value && $oxcmp_user->oxuser__oxbirthdate->value != "0000-00-00"}] [{assign var="iBirthdayYear" value=$oxcmp_user->oxuser__oxbirthdate->value|regex_replace:"/[-]([0-9]{1,2})[-]([0-9]{1,2})$/":""}] [{else}] [{assign var="iBirthdayYear" value=0}] [{/if}] [{if isset( $invadr.oxuser__oxsal ) && !empty($invadr.oxuser__oxsal)}] [{assign var="oxuser__oxsal" value=$invadr.oxuser__oxsal}] [{else}] [{assign var="oxuser__oxsal" value=$oxcmp_user->oxuser__oxsal->value}] [{/if}]
[{oxmultilang ident="COMPLETE_MARKED_FIELDS"}]