276 lines
9.8 KiB
Smarty
276 lines
9.8 KiB
Smarty
{**
|
|
* 2010-2020 Webkul.
|
|
*
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* All right is reserved,
|
|
* Please go through this link for complete license : https://store.webkul.com/license.html
|
|
*
|
|
* DISCLAIMER
|
|
*
|
|
* Do not edit or add to this file if you wish to upgrade this module to newer
|
|
* versions in the future. If you wish to customize this module for your
|
|
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
|
|
*
|
|
* @author Webkul IN <support@webkul.com>
|
|
* @copyright 2010-2020 Webkul IN
|
|
* @license https://store.webkul.com/license.html
|
|
*}
|
|
|
|
<article class="box wkrelativeposition">
|
|
<!-- Customer details if login -->
|
|
<div class="wk-login-container">
|
|
<div class="wk-heading-img">
|
|
<div class="wk-user-icon wk-sprit wk-left"></div>
|
|
<h4 class="wk-left">{l s='Your Details' mod='wkonepagecheckout'}</h4>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<div class="row">
|
|
{if $customer.is_logged && !$customer.is_guest}
|
|
<div class="col-md-7 col-sm-6 col-xs-6">
|
|
<a href="{$myaccount}"><span>{$customer.firstname} {$customer.lastname}</span></a>
|
|
<p>{$customer.email}</p>
|
|
</div>
|
|
<div class="col-md-5 col-sm-6 col-xs-6 wk-log-btn">
|
|
<a href="{$logout}" class="btn btn-primary logout">{l s='Logout' mod='wkonepagecheckout'}</a>
|
|
</div>
|
|
{else}
|
|
<div class="col-md-7 col-sm-6 col-xs-6" style="padding-top:8px;">
|
|
{l s='Already Registered?' mod='wkonepagecheckout'}
|
|
</div>
|
|
<div class="col-md-5 col-sm-6 col-xs-6 wk-log-btn">
|
|
<button class="btn btn-primary wkbtn-login">{l s='Login' mod='wkonepagecheckout'}</button>
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{if $customer.is_logged && !$customer.is_guest}
|
|
<!-- If customer is login -->
|
|
{block name='wk-customer-address'}
|
|
{include file='module:wkonepagecheckout/views/templates/front/content/_partials/wk-myaccount.tpl'}
|
|
{/block}
|
|
|
|
{else}
|
|
{if Configuration::get('WK_CHECKOUT_SOCIAL_LOGIN')}
|
|
{if Configuration::get('WK_CHECKOUT_FACEBOOK_LOGIN') || Configuration::get('WK_CHECKOUT_GOOGLE_LOGIN')}
|
|
<!-- If customer is not login -->
|
|
<div class="wk-social-login">
|
|
<p class="wk-separator">{l s='Or' mod='wkonepagecheckout'}</p>
|
|
<h5>{l s='Sign in with' mod='wkonepagecheckout'}</h5>
|
|
<div id="status" class="wkerrorcolor"></div>
|
|
{if Configuration::get('WK_CHECKOUT_FACEBOOK_LOGIN')}
|
|
<a class="btn btn-primary wkbtn-fb" href="javascript:void(0);" onclick="fbLogin()" id="fbLink">
|
|
<span>{l s='Facebook' mod='wkonepagecheckout'}</span>
|
|
</a>
|
|
{/if}
|
|
{if Configuration::get('WK_CHECKOUT_GOOGLE_LOGIN')}
|
|
<a class="btn btn-primary wkbtn-google" href="javascript:void(0);" id="customGmailBtn">
|
|
<span>{l s='Google' mod='wkonepagecheckout'}</span>
|
|
</a>
|
|
{/if}
|
|
</div>
|
|
{/if}
|
|
{/if}
|
|
<p class="wk-separator">{l s='Or' mod='wkonepagecheckout'}</p>
|
|
<div class="wk-guest-checkout">
|
|
{if Configuration::get('WK_CHECKOUT_GUEST_ALLOW')}
|
|
<h5>{l s='Guest Checkout' mod='wkonepagecheckout'}</h5>
|
|
{else}
|
|
<h5>{l s='Create Account' mod='wkonepagecheckout'}</h5>
|
|
{/if}
|
|
</div>
|
|
|
|
<div class="wk-form-group">
|
|
{if Configuration::get('WK_CHECKOUT_SOCIAL_TITLE')}
|
|
<div class="form-group">
|
|
<label class="label-control">{l s='Social title' mod='wkonepagecheckout'}</label>
|
|
{if isset($genders)}
|
|
{foreach from=$genders item="label" key="value"}
|
|
<div class="wk-gender">
|
|
<input type="radio" name="id_gender" value="{$value}">
|
|
<label for="id_gender">{$label}</label>
|
|
</div>
|
|
{/foreach}
|
|
{/if}
|
|
</div>
|
|
{/if}
|
|
<div class="form-group">
|
|
<label class="label-control">{l s='Email' mod='wkonepagecheckout'}</label>
|
|
<input
|
|
value="{if isset($wkguest)}{$wkguest->email}{/if}"
|
|
maxlength="128"
|
|
type="text"
|
|
name="wk-email"
|
|
id="wk-email"
|
|
{if isset($wkguest)}
|
|
readonly="readonly" disabled="disabled"
|
|
{/if}
|
|
class="form-control">
|
|
<i class="material-icons wk-check-icon wkhide icon_wk_email"></i>
|
|
<i class="material-icons wk-error-icon wkhide error_wk_email"></i>
|
|
<span id="wk-email-error" class="wkerrorcolor"></span>
|
|
</div>
|
|
{if Configuration::get('WK_CHECKOUT_GUEST_ALLOW') && !isset($wkguest)}
|
|
<div class="form-group">
|
|
<span class="custom-checkbox">
|
|
<label>
|
|
<input type="checkbox" value="1" name="wk-create-account" id="wk-create-account">
|
|
<span><i class="material-icons rtl-no-flip checkbox-checked"></i></span>
|
|
<span>{l s='I also want to create account' mod='wkonepagecheckout'}</span>
|
|
</label>
|
|
</span>
|
|
</div>
|
|
{/if}
|
|
<div class="form-group wkpassword_div {if Configuration::get('WK_CHECKOUT_GUEST_ALLOW')}wkhide{/if}">
|
|
<label class="label-control">{l s='Password' mod='wkonepagecheckout'}</label>
|
|
<input maxlength="60" type="password" name="wk-password" id="wk-password" class="form-control">
|
|
<i class="material-icons wk-check-icon wkhide icon_wk_password"></i>
|
|
<i class="material-icons wk-error-icon wkhide error_wk_password"></i>
|
|
<span id="wk-password-error" class="wkerrorcolor"></span>
|
|
</div>
|
|
|
|
{if Configuration::get('WK_CHECKOUT_DOB')}
|
|
<div class="form-group">
|
|
<label class="label-control">{l s='Date of birth' mod='wkonepagecheckout'}</label>
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
<select name="wk_day" id="wk_day" class="form-control">
|
|
<option value="0">{l s='Day' mod='wkonepagecheckout'}</option>
|
|
{for $day=1 to 31}
|
|
<option value="{$day}">{$day}</option>
|
|
{/for}
|
|
</select>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<select name="wk_month" id="wk_month" class="form-control">
|
|
<option value="0">{l s='Month' mod='wkonepagecheckout'}</option>
|
|
{for $month=1 to 12}
|
|
<option value="{$month}">{$month}</option>
|
|
{/for}
|
|
</select>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<select name="wk_year" id="wk_year" class="form-control">
|
|
<option value="0">{l s='Year' mod='wkonepagecheckout'}</option>
|
|
{for $year=date(Y)-100 to date(Y)}
|
|
<option value="{$year}">{$year}</option>
|
|
{/for}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
|
|
{if Configuration::get('WK_CHECKOUT_OPTIN')}
|
|
<div class="form-group">
|
|
<span class="custom-checkbox">
|
|
<label>
|
|
<input type="checkbox" value="1" name="wk-optin" id="wk-optin" class="form-control">
|
|
<span><i class="material-icons checkbox-checked"></i></span>
|
|
<span>{l s='Receive offers from our partners' mod='wkonepagecheckout'}</span>
|
|
</label>
|
|
</span>
|
|
</div>
|
|
{/if}
|
|
|
|
{if Configuration::get('WK_CHECKOUT_NEWSLATTER')}
|
|
<div class="form-group">
|
|
<span class="custom-checkbox">
|
|
<label>
|
|
<input type="checkbox" value="1" name="wk-newsletter" id="wk-newsletter" class="form-control">
|
|
<span><i class="material-icons checkbox-checked"></i></span>
|
|
<span>{l s='Sign up for our newsletter' mod='wkonepagecheckout'}</span>
|
|
</label>
|
|
</span>
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
|
|
{block name='wk-customer-address'}
|
|
{include file='module:wkonepagecheckout/views/templates/front/content/_partials/wk-myaccount.tpl'}
|
|
{/block}
|
|
|
|
<!-- Login pop up tpl in case customer is not login -->
|
|
{block name='wk-login'}
|
|
{include file='module:wkonepagecheckout/views/templates/front/content/_partials/wk_login.tpl'}
|
|
{/block}
|
|
|
|
{*{block name='wk-social-login'}
|
|
{include file='module:wkonepagecheckout/views/templates/front/content/_partials/wk-social-login.tpl'}
|
|
{/block}*}
|
|
{/if}
|
|
<div id="wkcustomer_info"></div>
|
|
</article>
|
|
<script src="https://code.jquery.com/jquery-3.6.0.slim.min.js" integrity="sha256-u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI=" crossorigin="anonymous"></script>
|
|
<script src="https://apis.google.com/js/api:client.js"></script>
|
|
{if $customer.is_logged == 1}
|
|
{literal}
|
|
<script type='text/javascript'>
|
|
$( function()
|
|
{
|
|
$.ajax(
|
|
{
|
|
type: 'POST',
|
|
cache: false,
|
|
url: '/ajax.php',
|
|
data:
|
|
{
|
|
a: 'load-customer-b2b-data',
|
|
customer_id: {/literal}{$customer.id}{literal}
|
|
},
|
|
beforeSend: function() {},
|
|
success: function( response )
|
|
{
|
|
data = jQuery.parseJSON( response );
|
|
if ( data.fvat == 'Yes' )
|
|
{
|
|
$( '#shipping_form select[name="fields[1]"]' ).val( "Yes" ).trigger( 'change' );
|
|
$( '#shipping_form input[name="fields[2]"]' ).val( data.firm );
|
|
$( '#shipping_form input[name="fields[3]"]' ).val( data.nip );
|
|
$( '#shipping_form input[name="fields[4]"]' ).val( data.street );
|
|
$( '#shipping_form input[name="fields[5]"]' ).val( data.city );
|
|
$( '#shipping_form input[name="fields[6]"]' ).val( data.postal_code );
|
|
}
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{/literal}
|
|
{/if}
|
|
<script>
|
|
if (typeof wk_google_app_key !== 'undefined' && wk_google_app_key) {
|
|
// do not write this code on js file because there is facebook library issue on js file
|
|
// signin with google start
|
|
// Load the google SDK asynchronously
|
|
var googleUser = {};
|
|
var startApp = function() {
|
|
gapi.load('auth2', function(){
|
|
// Retrieve the singleton for the GoogleAuth library and set up the client.
|
|
auth2 = gapi.auth2.init({
|
|
client_id: wk_google_app_key,
|
|
cookiepolicy: 'single_host_origin',
|
|
// Request scopes in addition to 'profile' and 'email'
|
|
});
|
|
attachSignin(document.getElementById('customGmailBtn'));
|
|
});
|
|
};
|
|
|
|
// this function called when user will allow access their info
|
|
function attachSignin(element) {
|
|
if (element) {
|
|
auth2.attachClickHandler(element, {},
|
|
function(googleUser) {
|
|
proceedLogin(googleUser.getBasicProfile().getGivenName(), googleUser.getBasicProfile().getFamilyName(), googleUser.getBasicProfile().getEmail());
|
|
}, function(error) {
|
|
alert(user_cancel);
|
|
}
|
|
);
|
|
}
|
|
}
|
|
startApp();
|
|
// signin with google end here
|
|
}
|
|
</script>
|