Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //checkout.js
- $(function () {
- window['_QuickCheckout'] = new Vue({
- data: window['_QuickCheckoutData'],
- el: '.quick-checkout',
- template: '#quick-checkout',
- mounted: function () {
- var self = this;
- self.payment();
- $(self.$el).find('.date').datetimepicker({
- pickTime: false
- });
- $(self.$el).find('.datetime').datetimepicker({
- pickDate: true,
- pickTime: true
- });
- $(self.$el).find('.time').datetimepicker({
- pickDate: false
- });
- $(self.$el).find('.date, .datetime, .time').on('dp.change', function (event) {
- $(event.target).find('input')[0].dispatchEvent(new Event('change'));
- });
- },
- updated: function () {
- var self = this;
- $(self.$el).find('.date').datetimepicker({
- pickTime: false
- });
- $(self.$el).find('.datetime').datetimepicker({
- pickDate: true,
- pickTime: true
- });
- $(self.$el).find('.time').datetimepicker({
- pickDate: false
- });
- $(self.$el).find('.date, .datetime, .time').on('dp.change', function (event) {
- $(event.target).find('input')[0].dispatchEvent(new Event('change'));
- });
- },
- beforeUpdate: function () {
- $(this.$el).find('.date, .datetime, .time').each(function () {
- $(this).datepicker('hide').datepicker('destroy');
- });
- },
- beforeDestroy: function () {
- $(this.$el).find('.date, .datetime, .time').each(function () {
- $(this).datepicker('hide').datepicker('destroy');
- });
- },
- methods: {
- saveDateTime: function (path, key, event) {
- this.order_data[path][key] = event.target.value;
- this.save();
- },
- ajax: function (obj) {
- return $.ajax($.extend({
- cache: false,
- type: 'post',
- dataType: 'json',
- beforeSend: function () {
- $('#quick-checkout-button-confirm, #button-login').button('loading');
- },
- error: function (xhr, ajaxOptions, thrownError) {
- $('#quick-checkout-button-confirm, #button-login').button('reset');
- if (xhr.statusText !== 'abort') {
- console.warn(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText);
- }
- }
- }, obj));
- },
- payment: function () {
- if (window['_QuickCheckoutAjaxPayment']) {
- window['_QuickCheckoutAjaxPayment'].abort();
- }
- window['_QuickCheckoutPaymentData'] = {};
- $('.quick-checkout-payment').find('input[type="text"], input[type="checkbox"], input[type="radio"], select').each(function () {
- window['_QuickCheckoutPaymentData'][$(this).attr('name')] = $(this).val();
- });
- $('.quick-checkout-payment').html('<div class="journal-loading-overlay"><div class="journal-loading"><i class="fa fa-spinner fa-spin"></i></div></div>');
- window['_QuickCheckoutAjaxPayment'] = this.ajax({
- type: 'get',
- dataType: 'html',
- url: 'index.php?route=journal3/checkout/payment',
- success: function (data) {
- $('.quick-checkout-payment').html($.parseHTML(data, true));
- $.each(window['_QuickCheckoutPaymentData'], function (k, v) {
- $('.quick-checkout-payment').find('[name="' + k + '"]').val(v);
- });
- window['_QuickCheckoutAjaxPayment'] = null;
- $('#quick-checkout-button-confirm, #button-login').button('reset');
- }
- })
- },
- updateCartItemQuantity: function (index, value) {
- this.$data.products[index].quantity = parseInt(this.$data.products[index].quantity) + parseInt(value);
- this.updateCartItem(this.$data.products[index]);
- },
- updateCartItem: function (product) {
- var self = this;
- this.ajax({
- url: 'index.php?route=journal3/checkout/cart_update',
- data: {
- key: product.cart_id,
- quantity: product.quantity,
- account: this.account,
- order_data: this.order_data,
- password: this.password,
- password2: this.password2,
- same_address: this.same_address,
- newsletter: this.newsletter,
- privacy: this.privacy,
- agree: this.agree,
- payment_address_type: this.payment_address_type,
- shipping_address_type: this.shipping_address_type,
- coupon: this.coupon,
- voucher: this.voucher,
- reward: this.reward
- },
- success: function (json) {
- self.update(json);
- }
- });
- },
- deleteCartItem: function (product) {
- var self = this;
- this.ajax({
- url: 'index.php?route=journal3/checkout/cart_delete',
- data: {
- key: product.cart_id,
- account: this.account,
- order_data: this.order_data,
- password: this.password,
- password2: this.password2,
- same_address: this.same_address,
- newsletter: this.newsletter,
- privacy: this.privacy,
- agree: this.agree,
- payment_address_type: this.payment_address_type,
- shipping_address_type: this.shipping_address_type,
- coupon: this.coupon,
- voucher: this.voucher,
- reward: this.reward
- },
- success: function (json) {
- self.update(json);
- }
- });
- },
- applyCoupon: function () {
- },
- deleteVoucher: function (voucher) {
- var self = this;
- this.ajax({
- url: 'index.php?route=journal3/checkout/cart_delete',
- data: {
- key: voucher.key,
- account: this.account,
- order_data: this.order_data,
- password: this.password,
- password2: this.password2,
- same_address: this.same_address,
- newsletter: this.newsletter,
- privacy: this.privacy,
- agree: this.agree,
- payment_address_type: this.payment_address_type,
- shipping_address_type: this.shipping_address_type,
- coupon: this.coupon,
- voucher: this.voucher,
- reward: this.reward
- },
- success: function (json) {
- self.update(json);
- }
- });
- },
- change: function () {
- this.$data.changed = true;
- },
- changeAddressType: function (type, value) {
- if (value === 'new') {
- this.$data.order_data[type + '_address_id'] = '';
- } else {
- this.$data.order_data[type + '_address_id'] = this.default_address_id;
- }
- },
- checkSave: function (confirm) {
- if (this.$data.changed === true) {
- this.$data.changed = false;
- this.save(confirm);
- }
- },
- save: function (confirm) {
- this.error = {};
- this.ajax({
- url: 'index.php?route=journal3/checkout/save' + (confirm ? '&confirm=true' : ''),
- data: {
- account: this.account,
- order_data: this.order_data,
- password: this.password,
- password2: this.password2,
- same_address: this.same_address,
- newsletter: this.newsletter,
- privacy: this.privacy,
- agree: this.agree,
- payment_address_type: this.payment_address_type,
- shipping_address_type: this.shipping_address_type,
- coupon: this.coupon,
- voucher: this.voucher,
- reward: this.reward
- },
- success: function (json) {
- this.update(json, confirm);
- }.bind(this)
- });
- },
- update: function (json, confirm) {
- if (json.response.redirect) {
- window.location = json.response.redirect;
- } else {
- this.custom_fields = json.response.custom_fields;
- this.shipping_methods = json.response.shipping_methods;
- this.payment_methods = json.response.payment_methods;
- this.shipping_zones = json.response.shipping_zones;
- this.payment_zones = json.response.payment_zones;
- this.order_data.shipping_code = json.response.order_data.shipping_code;
- this.order_data.payment_code = json.response.order_data.payment_code;
- this.order_data.shipping_country_id = json.response.order_data.shipping_country_id;
- this.order_data.payment_country_id = json.response.order_data.payment_country_id;
- this.order_data.shipping_zone_id = json.response.order_data.shipping_zone_id;
- this.order_data.payment_zone_id = json.response.order_data.payment_zone_id;
- this.totals = json.response.totals;
- this.products = json.response.products;
- this.stock_warning = json.response.stock_warning;
- this.vouchers = json.response.vouchers;
- this.$data.total = json.response.total;
- this.session = json.response.session;
- this.error = json.response.error;
- $('#cart-total').html(json.response.total);
- $('.cart-content > ul').html($(json.response.cart).find('.cart-content > ul').html());
- $('#cart-items.count-badge').html(json.response.total_items);
- if (json.response.error) {
- $('#quick-checkout-button-confirm').button('reset');
- try {
- console.error(JSON.stringify(json.response.error, null, 2));
- } catch (e) {
- }
- if (json.response.error.payment_code) {
- alert(json.response.error.payment_code);
- }
- if (json.response.error.shipping_code) {
- alert(json.response.error.shipping_code);
- }
- setTimeout(function () {
- try {
- $('html, body').animate({ scrollTop: $('.form-group .text-danger').closest('.form-group').offset().top - 50 }, 'slow');
- } catch (e) {
- }
- }, 300);
- } else {
- if (confirm) {
- var btns = ['input[type="button"]', 'input[type="submit"]', 'button[type="submit"]', '#button-confirm', '.buttons a'];
- var $btn = $('.quick-checkout-payment').find(btns.join(', ')).first();
- if ($btn.attr('href')) {
- window.location = $btn.attr('href');
- } else {
- $btn.trigger('click');
- }
- } else {
- this.payment();
- }
- }
- }
- },
- login: function () {
- var data = {
- email: this.login_email,
- password: this.login_password
- };
- this.ajax({
- url: 'index.php?route=account/login',
- data: data,
- success: function (json) {
- if (json.status === 'success') {
- parent.window.location.reload();
- } else {
- $('#quick-checkout-button-confirm, #button-login').button('reset');
- if (json.response.warning) {
- alert(json.response.warning);
- }
- }
- }
- });
- },
- srcSet: function (image, image2x) {
- return image + ' 1x, ' + image2x + ' 2x'
- },
- upload: function (path, key, event) {
- var node = this;
- $('#form-upload').remove();
- $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>');
- $('#form-upload input[name=\'file\']').trigger('click');
- if (typeof timer != 'undefined') {
- clearInterval(timer);
- }
- timer = setInterval(function() {
- if ($('#form-upload input[name=\'file\']').val() != '') {
- clearInterval(timer);
- $.ajax({
- url: 'index.php?route=tool/upload',
- type: 'post',
- dataType: 'json',
- data: new FormData($('#form-upload')[0]),
- cache: false,
- contentType: false,
- processData: false,
- beforeSend: function() {
- $('#quick-checkout-button-confirm, #button-login, .custom-field button').button('loading');
- },
- complete: function() {
- $('#quick-checkout-button-confirm, #button-login, .custom-field button').button('reset');
- },
- success: function(json) {
- $('.text-danger').remove();
- if (json['error']) {
- alert(json['error']);
- }
- if (json['success']) {
- node.order_data[path][key] = json['code'];
- node.save();
- alert(json['success']);
- }
- },
- error: function(xhr, ajaxOptions, thrownError) {
- alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
- }
- });
- }
- }, 500);
- }
- }
- });
- });
- $(document).ajaxSuccess(function (event, xhr, settings, data) {
- if (settings.dataType === 'json') {
- if (data.error) {
- $('#quick-checkout-button-confirm').button('reset');
- _QuickCheckout.payment();
- }
- }
- });
- function triggerLoadingOn() {
- $('#quick-checkout-button-confirm, #button-login').button('loading');
- }
- function triggerLoadingOff() {
- $('#quick-checkout-button-confirm, #button-login').button('reset');
- }
- //checkout.twig
- {{ header }}
- <ul class="breadcrumb">
- {% for breadcrumb in breadcrumbs %}
- <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
- {% endfor %}
- </ul>
- {% if j3.settings.get('pageTitlePosition') == 'top' %}
- <h1 class="title page-title"><span>{{ heading_title }}</span></h1>
- {% endif %}
- {{ j3.loadController('journal3/layout', 'top') }}
- <div class="container">
- {% if error_warning %}
- <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> {{ error_warning }}
- <button type="button" class="close" data-dismiss="alert">×</button>
- </div>
- {% endif %}
- <div class="row">{{ column_left }}
- <div id="content">
- {% if j3.settings.get('pageTitlePosition') == 'default' %}
- <h1 class="title page-title">{{ heading_title }}</h1>
- {% endif %}
- {{ content_top }}
- <div class="quick-checkout-wrapper">
- <div class="quick-checkout">
- <div class="journal-loading"><i class="fa fa-spinner fa-spin"></i></div>
- </div>
- </div>
- {{ content_bottom }}</div>
- {{ column_right }}</div>
- </div>
- <script type="text/html" id="quick-checkout">
- <div v-bind:class="[(account === '') && !customer_id ? 'login-active' : '']">
- <div class="left">
- <form>
- {{ login_block }}
- {{ register_block }}
- {{ payment_address_block }}
- {{ shipping_address_block }}
- </form>
- </div>
- <div class="right">
- <div class="checkout-section shipping-payment">
- {{ shipping_method_block }}
- {{ payment_method_block }}
- </div>
- {{ coupon_voucher_reward_block }}
- {{ cart_block }}
- <div class="checkout-section checkout-payment-details" v-bind:class="[order_data.payment_method ? 'payment-' + order_data.payment_code : '']">
- <div class="title section-title">{{ j3.settings.get('sectionTitlePaymentDetails') }}</div>
- <div class="quick-checkout-payment">
- <div class="journal-loading-overlay">
- <div class="journal-loading"><i class="fa fa-spinner fa-spin"></i></div>
- </div>
- </div>
- </div>
- {{ confirm_block }}
- </div>
- </div>
- </script>
- <script>window['_QuickCheckoutData'] = {{ checkout_data|json_encode }};</script>
- {{ footer }}
- </script>
- <style>
- .uppercase {
- text-transform: uppercase;
- }
- </style>
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.16/jquery.mask.min.js"></script>
- <script>
- $(document).ready(function(){
- $("#input-account-custom-field1").mask('999.999.999-99', {placeholder: '000.000.000-00'});
- $("#input-account-custom-field2").mask('99/99/9999', {placeholder: '01/12/1999'});
- $("#input-telephone").mask('(99)99999-9999', {placeholder: '(42)99999-9999'});
- $("#input-payment-postcode").mask('99999-999', {placeholder: '84500-000'});
- // Ordem dos tabindex
- $('#input-account-custom-field1').attr('tabIndex', 1);
- $('#input-account-custom-field2').attr('tabIndex', 5);
- $('#input-payment-custom-field3').attr('tabIndex', 11);
- $('#input-payment-custom-field4').attr('tabIndex', 12);
- $('#input-coupon').attr('tabIndex', 15);
- // Função buscar CEP
- $("#input-payment-postcode").focusout(function(){
- $.ajax({
- url: 'https://viacep.com.br/ws/'+$(this).val()+'/json/unicode/',
- dataType: 'json',
- success: function(response){
- $("#input-payment-address-1").val(response.logradouro);
- $("#input-payment-address-2").val(response.bairro);
- $("#input-payment-city").val(response.localidade);
- switch (response.uf) {
- case 'AC':
- $("#input-payment-zone").val(440);
- break;
- case 'AL':
- $("#input-payment-zone").val(441);
- break;
- case 'AP':
- $("#input-payment-zone").val(442);
- break;
- case 'AM':
- $("#input-payment-zone").val(443);
- break;
- case 'BA':
- $("#input-payment-zone").val(444);
- break;
- case 'CE':
- $("#input-payment-zone").val(445);
- break;
- case 'DF':
- $("#input-payment-zone").val(446);
- break;
- case 'ES':
- $("#input-payment-zone").val(447);
- break;
- case 'GO':
- $("#input-payment-zone").val(448);
- break;
- case 'MA':
- $("#input-payment-zone").val(449);
- break;
- case 'MT':
- $("#input-payment-zone").val(450);
- break;
- case 'MS':
- $("#input-payment-zone").val(451);
- break;
- case 'MG':
- $("#input-payment-zone").val(452);
- break;
- case 'PA':
- $("#input-payment-zone").val(453);
- break;
- case 'PB':
- $("#input-payment-zone").val(454);
- break;
- case 'PR':
- $("#input-payment-zone").val(455);
- break;
- case 'PE':
- $("#input-payment-zone").val(456);
- break;
- case 'PI':
- $("#input-payment-zone").val(457);
- break;
- case 'RR':
- $("#input-payment-zone").val(462);
- break;
- case 'RO':
- $("#input-payment-zone").val(461);
- break;
- case 'RJ':
- $("#input-payment-zone").val(458);
- break;
- case 'RN':
- $("#input-payment-zone").val(459);
- break;
- case 'RS':
- $("#input-payment-zone").val(460);
- break;
- case SC:
- $("#input-payment-zone").val(463);
- break;
- case 'SP':
- $("#input-payment-zone").val(464);
- break;
- case 'SE':
- $("#input-payment-zone").val(465);
- break;
- case 'TO':
- $("#input-payment-zone").val(466);
- break;
- default:
- }
- $("#input-payment-custom-field3").focus();
- }
- });
- });
- $("#input-account-custom-field1").focusout(function(){
- cpf = $(this).val().replace(/[^\d]+/g,'');
- if(cpf == ''){
- $('div').remove('.has-error');
- $("#account-custom-field1").append('<div class="has-error">Campo CPF não pode ser vazio!</div>');
- $("#input-account-custom-field1").focus();
- return 0;
- }
- if (cpf.length != 11 ||
- cpf == "00000000000" ||
- cpf == "11111111111" ||
- cpf == "22222222222" ||
- cpf == "33333333333" ||
- cpf == "44444444444" ||
- cpf == "55555555555" ||
- cpf == "66666666666" ||
- cpf == "77777777777" ||
- cpf == "88888888888" ||
- cpf == "99999999999"){
- $('div').remove('.has-error');
- $("#account-custom-field1").append('<div class="has-error">Tamanho do CPF incorreto!</div>');
- $("#input-account-custom-field1").focus();
- return 0;
- }
- add = 0;
- for (i=0; i < 9; i ++)
- add += parseInt(cpf.charAt(i)) * (10 - i);
- rev = 11 - (add % 11);
- if (rev == 10 || rev == 11)
- rev = 0;
- if (rev != parseInt(cpf.charAt(9))){
- $('div').remove('.has-error');
- $("#account-custom-field1").append('<div class="has-error">CPF inválido!</div>');
- $("#input-account-custom-field1").focus();
- return 0;
- }
- add = 0;
- for (i = 0; i < 10; i ++)
- add += parseInt(cpf.charAt(i)) * (11 - i);
- rev = 11 - (add % 11);
- if (rev == 10 || rev == 11)
- rev = 0;
- if (rev != parseInt(cpf.charAt(10))){
- $('div').remove('.has-error');
- $("#account-custom-field1").append('<div class="has-error">CPF inválido!</div>');
- $("#input-account-custom-field1").focus();
- return 0;
- }
- $('div').remove('.has-error');
- });
- });
- </script>
- // address.twig
- <div class="checkout-section {{ type }}-address" v-if="('{{ type }}' === 'payment') || (('{{ type }}' === 'shipping') && !same_address && shipping_required)">
- <div class="title section-title">{{ type == 'payment' ? j3.settings.get('sectionTitlePaymentAddress') : j3.settings.get('sectionTitleShippingAddress') }}</div>
- <div class="section-body">
- <div class="radio" v-if="customer_id && Object.keys(addresses).length">
- <label>
- <input type="radio" v-model="{{ type }}_address_type" v-on:change="save()" value="existing"/>
- {{ text_address_existing }}</label>
- </div>
- <div id="{{ type }}-existing" v-if="customer_id && ({{ type }}_address_type === 'existing')">
- <select v-model="order_data.{{ type }}_address_id" v-on:change="save()" id="input-{{ type }}-address" class="form-control">
- <option v-for="address in addresses" v-bind:value="address.address_id" v-html="address.firstname + ' ' + address.lastname + ' ' + address.address_1 + ' ' + address.city + ' ' + address.zone + ' ' + address.country"></option>
- </select>
- </div>
- <div class="radio" v-if="customer_id && Object.keys(addresses).length">
- <label>
- <input type="radio" v-model="{{ type }}_address_type" v-on:change="save()" value="new"/>
- {{ text_address_new }}</label>
- </div>
- <div v-if="!customer_id || (customer_id && ({{ type }}_address_type === 'new'))">
- <div class="form-group required address-firstname" v-if="customer_id || (!customer_id && '{{ type }}' === 'shipping')">
- <label class="control-label" for="input-{{ type }}-firstname">{{ entry_firstname }}</label>
- <input v-model="order_data.{{ type }}_firstname" v-on:blur="checkSave()" v-on:change="change()" type="text" name="firstname" value="" placeholder="{{ entry_firstname }}" id="input-{{ type }}-firstname" class="form-control"/>
- </div>
- <div class="form-group required address-lastname" v-if="customer_id || (!customer_id && '{{ type }}' === 'shipping')">
- <label class="control-label" for="input-{{ type }}-lastname">{{ entry_lastname }}</label>
- <input v-model="order_data.{{ type }}_lastname" v-on:blur="checkSave()" v-on:change="change()" type="text" name="lastname" value="" placeholder="{{ entry_lastname }}" id="input-{{ type }}-lastname" class="form-control"/>
- </div>
- <div class="form-group address-company">
- <label class="control-label" for="input-{{ type }}-company">{{ entry_company }}</label>
- <input v-model="order_data.{{ type }}_company" v-on:blur="checkSave()" v-on:change="change()" type="text" name="company" value="" placeholder="{{ entry_company }}" id="input-{{ type }}-company" class="form-control"/>
- </div>
- <div class="form-group required address-address-1">
- <label class="control-label" for="input-{{ type }}-address-1">{{ entry_address_1 }}</label>
- <input tabindex='10' v-model="order_data.{{ type }}_address_1" v-on:blur="checkSave()" v-on:change="change()" type="text" name="address_1" value="" placeholder="{{ entry_address_1 }}" id="input-{{ type }}-address-1" class="form-control uppercase"/>
- <span class="text-danger" v-if="error && error.{{ type }}_address_1" v-html="error.{{ type }}_address_1"></span>
- </div>
- <div class="form-group required address-address-2">
- <label class="control-label" for="input-{{ type }}-address-2">{{ entry_address_2 }}</label>
- <input tabindex='13' v-model="order_data.{{ type }}_address_2" v-on:blur="checkSave()" v-on:change="change()" type="text" name="address_2" value="" placeholder="{{ entry_address_2 }}" id="input-{{ type }}-address-2" class="form-control uppercase"/>
- <span class="text-danger" v-if="error && error.{{ type }}_address_2" v-html="error.{{ type }}_address_2"></span>
- </div>
- <div class="form-group required address-city">
- <label class="control-label" for="input-{{ type }}-city">{{ entry_city }}</label>
- <input tabindex='14' v-model="order_data.{{ type }}_city" v-on:blur="checkSave()" v-on:change="change()" type="text" name="city" value="" placeholder="{{ entry_city }}" id="input-{{ type }}-city" class="form-control uppercase"/>
- <span class="text-danger" v-if="error && error.{{ type }}_city" v-html="error.{{ type }}_city"></span>
- </div>
- <div class="form-group required address-postcode">
- <label class="control-label" for="input-{{ type }}-postcode">{{ entry_postcode }}</label>
- <input tabindex='9' v-model.lazy="order_data.{{ type }}_postcode" v-on:blur="checkSave()" v-on:change="change()" type="text" name="postcode" value="" placeholder="{{ entry_postcode }}" id="input-{{ type }}-postcode" class="form-control"/>
- <span class="text-danger" v-if="error && error.{{ type }}_postcode" v-html="error.{{ type }}_postcode"></span>
- </div>
- <div class="form-group required address-country">
- <label class="control-label" for="input-{{ type }}-country">{{ entry_country }}</label>
- <select v-model="order_data.{{ type }}_country_id" v-on:change="save()" name="country_id" id="input-{{ type }}-country" class="form-control">
- <option value="">{{ text_select }}</option>
- <option v-for="country in countries" v-bind:value="country.country_id" v-html="country.name"></option>
- </select>
- <span class="text-danger" v-if="error && error.{{ type }}_country" v-html="error.{{ type }}_country"></span>
- </div>
- <div class="form-group required address-zone">
- <label class="control-label" for="input-{{ type }}-zone">{{ entry_zone }}</label>
- <select v-model="order_data.{{ type }}_zone_id" v-on:change="save()" name="zone_id" id="input-{{ type }}-zone" class="form-control">
- <option v-if="{{ type }}_zones.length > 0" value="">{{ text_select }}</option>
- <option v-if="{{ type }}_zones.length == 0" value="">{{ text_none }}</option>
- <option v-for="zone in {{ type }}_zones" v-bind:value="zone.zone_id" v-html="zone.name"></option>
- </select>
- <span class="text-danger" v-if="error && error.{{ type }}_zone" v-html="error.{{ type }}_zone"></span>
- </div>
- {# custom fields - select #}
- <div v-for="custom_field in custom_fields.custom_fields.address" v-if="custom_field.type === 'select'" v-bind:id="'{{ type }}-custom-field' + custom_field.custom_field_id" v-bind:class="'form-group custom-field' + (custom_field.required ? ' required' : '')">
- <label class="control-label" v-bind:for="'input-{{ type }}-custom-field' + custom_field.custom_field_id" v-html="custom_field.name"></label>
- <select v-model="order_data.{{ type }}_custom_field[custom_field.custom_field_id]" v-on:change="save()" v-bind:id="'input-{{ type }}-custom-field' + custom_field.custom_field_id" class="form-control">
- <option value="">{{ text_select }}</option>
- <option v-for="custom_field_value in custom_field.custom_field_value" v-bind:value="custom_field_value.custom_field_value_id" v-html="custom_field_value.name"></option>
- </select>
- <span class="text-danger" v-if="error && error.{{ type }}_custom_field && error.{{ type }}_custom_field[custom_field.custom_field_id]" v-html="error.{{ type }}_custom_field[custom_field.custom_field_id]"></span>
- </div>
- {# custom fields - radio #}
- <div v-for="custom_field in custom_fields.custom_fields.address" v-if="custom_field.type === 'radio'" v-bind:id="'{{ type }}-custom-field' + custom_field.custom_field_id" v-bind:class="'form-group custom-field' + (custom_field.required ? ' required' : '')">
- <label class="control-label" v-html="custom_field.name"></label>
- <div v-bind:id="'input-{{ type }}-custom-field' + custom_field.custom_field_id">
- <div class="radio" v-for="custom_field_value in custom_field.custom_field_value">
- <label>
- <input type="radio" v-model="order_data.{{ type }}_custom_field[custom_field.custom_field_id]" v-on:change="save()" v-bind:value="custom_field_value.custom_field_value_id"/>
- <span v-html="custom_field_value.name"></span></label>
- </div>
- </div>
- <span class="text-danger" v-if="error && error.{{ type }}_custom_field && error.{{ type }}_custom_field[custom_field.custom_field_id]" v-html="error.{{ type }}_custom_field[custom_field.custom_field_id]"></span>
- </div>
- {# custom fields - checkbox #}
- <div v-for="custom_field in custom_fields.custom_fields.address" v-if="custom_field.type === 'checkbox'" v-bind:id="'{{ type }}-custom-field' + custom_field.custom_field_id" v-bind:class="'form-group custom-field' + (custom_field.required ? ' required' : '')">
- <label class="control-label" v-html="custom_field.name"></label>
- <div v-bind:id="'input-{{ type }}-custom-field' + custom_field.custom_field_id"> {% for custom_field_value in custom_field.custom_field_value %}
- <div class="checkbox">
- <label>
- <input type="checkbox" name="custom_field[{{ custom_field.location }}][{{ custom_field.custom_field_id }}][]" value="{{ custom_field_value.custom_field_value_id }}"/>
- {{ custom_field_value.name }}</label>
- </div>
- {% endfor %} </div>
- <span class="text-danger" v-if="error && error.{{ type }}_custom_field && error.{{ type }}_custom_field[custom_field.custom_field_id]" v-html="error.{{ type }}_custom_field[custom_field.custom_field_id]"></span>
- </div>
- {# custom fields - text #}
- <div v-for="custom_field in custom_fields.custom_fields.address" v-if="custom_field.type === 'text'" v-bind:id="'{{ type }}-custom-field' + custom_field.custom_field_id" v-bind:class="'form-group custom-field' + (custom_field.required ? ' required' : '')">
- <label class="control-label" v-bind:for="'input-{{ type }}-custom-field' + custom_field.custom_field_id" v-html="custom_field.name"></label>
- <input type="text" v-model.lazy="order_data.{{ type }}_custom_field[custom_field.custom_field_id]" v-on:blur="checkSave()" v-on:change="change()" value="{{ custom_field.value }}" v-bind:placeholder="custom_field.name" v-bind:id="'input-{{ type }}-custom-field' + custom_field.custom_field_id" class="form-control"/>
- <span class="text-danger" v-if="error && error.{{ type }}_custom_field && error.{{ type }}_custom_field[custom_field.custom_field_id]" v-html="error.{{ type }}_custom_field[custom_field.custom_field_id]"></span>
- </div>
- {# custom fields - textarea #}
- <div v-for="custom_field in custom_fields.custom_fields.address" v-if="custom_field.type === 'textarea'" v-bind:id="'{{ type }}-custom-field' + custom_field.custom_field_id" v-bind:class="'form-group custom-field' + (custom_field.required ? ' required' : '')">
- <label class="control-label" v-bind:for="'input-{{ type }}-custom-field' + custom_field.custom_field_id" v-html="custom_field.name"></label>
- <textarea v-model="order_data.{{ type }}_custom_field[custom_field.custom_field_id]" v-on:blur="checkSave()" v-on:change="change()" rows="5" v-bind:placeholder="custom_field.name" v-bind:id="'input-{{ type }}-custom-field' + custom_field.custom_field_id" class="form-control">{{ custom_field.value }}</textarea>
- <span class="text-danger" v-if="error && error.{{ type }}_custom_field && error.{{ type }}_custom_field[custom_field.custom_field_id]" v-html="error.{{ type }}_custom_field[custom_field.custom_field_id]"></span>
- </div>
- {# custom fields - file #}
- <div v-for="custom_field in custom_fields.custom_fields.address" v-if="custom_field.type === 'file'" v-bind:id="'{{ type }}-custom-field' + custom_field.custom_field_id" v-bind:class="'form-group custom-field' + (custom_field.required ? ' required' : '')">
- <label class="control-label" v-bind:for="'input-{{ type }}-custom-field' + custom_field.custom_field_id" v-html="custom_field.name"></label>
- <br/>
- <button type="button" v-on:click="upload('{{ type }}_custom_field', custom_field.custom_field_id, $event)" v-bind:id="'button-account-custom-field' + custom_field.custom_field_id" class="btn btn-default"><i class="fa fa-upload"></i> {{ button_upload }}</button>
- <input type="hidden" v-model="order_data.{{ type }}_custom_field[custom_field.custom_field_id]" value="" v-bind:placeholder="custom_field.name" v-bind:id="'input-{{ type }}-custom-field' + custom_field.custom_field_id" class="form-control"/>
- <span class="text-danger" v-if="error && error.{{ type }}_custom_field && error.{{ type }}_custom_field[custom_field.custom_field_id]" v-html="error.{{ type }}_custom_field[custom_field.custom_field_id]"></span>
- </div>
- {# custom fields - date #}
- <div v-for="custom_field in custom_fields.custom_fields.address" v-if="custom_field.type === 'date'" v-bind:id="'{{ type }}-custom-field' + custom_field.custom_field_id" v-bind:class="'form-group custom-field' + (custom_field.required ? ' required' : '')">
- <label class="control-label" v-bind:for="'input-{{ type }}-custom-field' + custom_field.custom_field_id" v-html="custom_field.name"></label>
- <div class="input-group date">
- <input type="text" v-model="order_data.{{ type }}_custom_field[custom_field.custom_field_id]" v-on:change="saveDateTime('{{ type }}_custom_field', custom_field.custom_field_id, $event)" value="{{ custom_field.value }}" v-bind:placeholder="custom_field.name" data-date-format="YYYY-MM-DD" v-bind:id="'input-{{ type }}-custom-field' + custom_field.custom_field_id" class="form-control"/>
- <span class="input-group-btn"><button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button></span>
- </div>
- <span class="text-danger" v-if="error && error.{{ type }}_custom_field && error.{{ type }}_custom_field[custom_field.custom_field_id]" v-html="error.{{ type }}_custom_field[custom_field.custom_field_id]"></span>
- </div>
- {# custom fields - time #}
- <div v-for="custom_field in custom_fields.custom_fields.address" v-if="custom_field.type === 'time'" v-bind:id="'{{ type }}-custom-field' + custom_field.custom_field_id" v-bind:class="'form-group custom-field' + (custom_field.required ? ' required' : '')">
- <label class="control-label" v-bind:for="'input-{{ type }}-custom-field' + custom_field.custom_field_id" v-html="custom_field.name"></label>
- <div class="input-group time">
- <input type="text" v-model="order_data.{{ type }}_custom_field[custom_field.custom_field_id]" v-on:change="saveDateTime('{{ type }}_custom_field', custom_field.custom_field_id, $event)" value="{{ custom_field.value }}" v-bind:placeholder="custom_field.name" data-date-format="HH:mm" v-bind:id="'input-{{ type }}-custom-field' + custom_field.custom_field_id" class="form-control"/>
- <span class="input-group-btn"><button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button></span>
- </div>
- <span class="text-danger" v-if="error && error.{{ type }}_custom_field && error.{{ type }}_custom_field[custom_field.custom_field_id]" v-html="error.{{ type }}_custom_field[custom_field.custom_field_id]"></span>
- </div>
- {# custom fields - datetime #}
- <div v-for="custom_field in custom_fields.custom_fields.address" v-if="custom_field.type === 'datetime'" v-bind:id="'{{ type }}-custom-field' + custom_field.custom_field_id" v-bind:class="'form-group custom-field' + (custom_field.required ? ' required' : '')">
- <label class="control-label" v-bind:for="'input-{{ type }}-custom-field' + custom_field.custom_field_id" v-html="custom_field.name"></label>
- <div class="input-group time">
- <input type="text" v-model="order_data.{{ type }}_custom_field[custom_field.custom_field_id]" v-on:change="saveDateTime('{{ type }}_custom_field', custom_field.custom_field_id, $event)" value="{{ custom_field.value }}" v-bind:placeholder="custom_field.name" data-date-format="YYYY-MM-DD HH:mm" v-bind:id="'input-{{ type }}-custom-field' + custom_field.custom_field_id" class="form-control"/>
- <span class="input-group-btn"><button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button></span>
- </div>
- <span class="text-danger" v-if="error && error.{{ type }}_custom_field && error.{{ type }}_custom_field[custom_field.custom_field_id]" v-html="error.{{ type }}_custom_field[custom_field.custom_field_id]"></span>
- </div>
- </div>
- <div v-if="('{{ type }}' === 'payment') && shipping_required" class="checkbox">
- <label>
- <input v-model="same_address" v-on:change="save()" type="checkbox"/>
- {{ entry_shipping }}</label>
- </div>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement