Files
wticreatorstudio/Modules/Subscription/Resources/views/checkout.blade.php
T
2024-02-12 22:54:20 -05:00

1544 lines
94 KiB
PHP

@extends('frontend.amazy.layouts.app')
@push('styles')
<link href="{{ asset('Modules/Subscription/Resources/assets/dist/css/checkoutwc.css') }}" rel="stylesheet">
<link rel="stylesheet" href="{{ asset('Modules/Subscription/Resources/assets/easy_autocomplete/easy-autocomplete.css') }}">
<style>
.easy-autocomplete-container {
z-index: 1000000;
}
</style>
@endpush
@section('content')
<main id="cfw" class="container context-checkout checkoutwc admin-bar p-5" data-easytabs="true">
<div class="row">
<div class="col-12">
<div id="cfw-alert-placeholder">
<div class="cfw-alert">
<div class="message"></div>
</div>
</div>
<div id="cfw-alert-container" class="woocommerce-notices-wrapper"></div>
</div>
</div>
<form id="checkout" name="checkout" class="woocommerce-checkout checkout row cfw-customer-info-active" action="{{route('frontend.checkout')}}" method="POST" formnovalidate="" novalidate="" enctype="multipart/form-data" data-parsley-focus="first">
<input type="hidden" name="current_step" id="current_step" value="information">
<!-- Order Review -->
<div id="order_review" class="col-lg-7 cfw-rp" role="main">
<ul id="cfw-breadcrumb" class="etabs">
<li class="tab cfw-customer-info cfw-default-tab active">
<a href="#cfw-customer-info" class="cfw-small active">Information</a>
</li>
@if (false)
<li class="tab cfw-shipping-method">
<a href="#cfw-shipping-method" class="cfw-small">Shipping</a>
</li>
@endif
<li class="tab cfw-payment-method">
<a href="#cfw-payment-method" class="cfw-small">Payment</a>
</li>
</ul>
<div id="cfw-customer-info" class="cfw-panel active" style="display: block;">
<h3>Information </h3>
<div id="cfw-account-details" class="cfw-module">
<input type="hidden" name="billing_email" id="billing_email" value="{{auth()->user() ? auth()->user()->email : ''}}">
@if (auth()->user())
<div class="cfw-have-acc-text cfw-small">Welcome back, <strong>{{textLimit(auth()->user()->first_name.' '.auth()->user()->last_name,28)}}</strong> ({{auth()->user()->email}}). </div>
@endif
<div class="row cfw-input-wrap-row">
<p class="form-row col-lg-12 col-lg-12 cfw-text-input cfw-input-wrap validate-required cfw-label-is-floated" id="shipping_last_name_field" data-priority="">
<label for="shipping_email" class="cfw-floatable-label">Email&nbsp;<abbr class="required" title="required">*</abbr></label>
<span class="woocommerce-input-wrapper">
<input type="email" class="input-text parsley-success" name="shipping_email" id="shipping_email" placeholder="" value="{{ $email }}" data-parsley-trigger="change focusout" data-persist="false" data-parsley-required="true" data-parsley-group="cfw-customer-info" autocomplete="family-name" >
</span>
</p>
</div>
</div>
@if (false)
<h3>Delivery</h3>
<div id="cfw-delivery-method" class="cfw-module cfw-accordion">
<ul class="cfw-radio-reveal-group">
<li class="cfw-radio-reveal-li cfw-no-reveal cfw-active">
<div class="cfw-radio-reveal-title-wrap">
<input type="radio" name="cfw_delivery_method" id="cfw_delivery_method_ship_radio" value="ship" class="garlic-auto-save" checked="checked" data-parsley-multiple="cfw_delivery_method">
<label for="cfw_delivery_method_ship_radio" class="cfw-radio-reveal-label">
<div>
<span class="cfw-radio-reveal-title">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path d="M9 17a2 2 0 11-4 0 2 2 0 014 0zM19 17a2 2 0 11-4 0 2 2 0 014 0z"></path>
<path stroke-linecap="round" stroke-linejoin="round" d="M13 16V6a1 1 0 00-1-1H4a1 1 0 00-1 1v10a1 1 0 001 1h1m8-1a1 1 0 01-1 1H9m4-1V8a1 1 0 011-1h2.586a1 1 0 01.707.293l3.414 3.414a1 1 0 01.293.707V16a1 1 0 01-1 1h-1m-6-1a1 1 0 001 1h1M5 17a2 2 0 104 0m-4 0a2 2 0 114 0m6 0a2 2 0 104 0m-4 0a2 2 0 114 0"></path>
</svg> Ship </span>
</div>
</label>
</div>
</li>
</ul>
</div>
@endif
@if (true)
<div id="cfw-customer-info-address" class="cfw-module shipping">
<h3 id="shipping_title">Billing address</h3>
<div class="cfw-customer-info-address-container cfw-parsley-shipping-details woocommerce-shipping-fields woocommerce-shipping-fields__field-wrapper">
<div class="row cfw-input-wrap-row">
<input type="hidden" name="shipping_address" id="shipping_address" value="{{isset($shipping_address) ? $shipping_address->id : 0 }}">
@if (false)
<p class="form-row col-lg-12 col-lg-12 cfw-text-input cfw-input-wrap validate-required cfw-label-is-floated" id="shipping_first_name_field" data-priority="">
<label for="shipping_name" class="cfw-floatable-label">Name&nbsp;<abbr class="required" title="required">*</abbr></label>
<span class="woocommerce-input-wrapper">
<input type="text" class="input-text parsley-success" name="shipping_name" id="shipping_name" placeholder="" value="{{ $name }}" data-parsley-trigger="change focusout" data-persist="false" data-parsley-required="true" data-parsley-group="cfw-customer-info" autocomplete="given-name" >
</span>
</p>
@endif
<input type="hidden" name="shipping_name" id="shipping_name" value="{{ $name }}" />
<p class="form-row col-lg-6 col-lg-6 cfw-text-input cfw-input-wrap validate-required cfw-label-is-floated" id="shipping_last_name_field" data-priority="">
<label for="shipping_first_name" class="cfw-floatable-label">First Name&nbsp;<abbr class="required" title="required">*</abbr></label>
<span class="woocommerce-input-wrapper">
<input type="text" class="input-text parsley-success" name="first_name" id="first_name" placeholder="" value="{{ $first_name }}" data-parsley-trigger="change focusout" data-persist="false" data-parsley-required="true" data-parsley-group="cfw-customer-info" autocomplete="given-name" >
</span>
</p>
<p class="form-row col-lg-6 col-lg-6 cfw-text-input cfw-input-wrap validate-required cfw-label-is-floated" id="shipping_last_name_field" data-priority="">
<label for="shipping_last_name" class="cfw-floatable-label">Last Name&nbsp;<abbr class="required" title="required">*</abbr></label>
<span class="woocommerce-input-wrapper">
<input type="text" class="input-text parsley-success" name="last_name" id="last_name" placeholder="" value="{{ $last_name }}" data-parsley-trigger="change focusout" data-persist="false" data-parsley-required="true" data-parsley-group="cfw-customer-info" autocomplete="family-name" >
</span>
</p>
<p class="form-row col-lg-12 col-lg-12 cfw-tel-input cfw-input-wrap validate-required validate-phone cfw-label-is-floated" id="shipping_phone_field" data-priority="">
<label for="shipping_phone" class="cfw-floatable-label">Phone&nbsp;<abbr class="required" title="required">*</abbr></label>
<span class="woocommerce-input-wrapper">
<input type="tel" class="input-text garlic-auto-save parsley-success" name="shipping_phone" id="shipping_phone" placeholder="" value="{{ $phone }}" data-parsley-trigger="input change focusout" data-parsley-required="false" data-parsley-group="cfw-customer-info" autocomplete="tel">
</span>
<ul class="parsley-errors-list" aria-hidden="true"></ul>
</p>
<p class="form-row address-field col-lg-12 col-lg-12 cfw-text-input cfw-input-wrap validate-required cfw-label-is-floated" id="shipping_address_1_field" data-priority="" data-parsley-required="true">
<label for="address" class="cfw-floatable-label">Street address&nbsp;<abbr class="required" title="required">*</abbr></label>
<span class="woocommerce-input-wrapper">
<input type="text" class="input-text parsley-success" name="address" id="address" placeholder="" value="{{isset($billing_address) ? $billing_address->address : ''}}" data-parsley-trigger="change focusout" data-persist="false" data-saved-value="Sample St." data-parsley-required="true" data-parsley-group="cfw-customer-info" autocomplete="address-line1" data-placeholder="Street address">
</span>
</p>
@if (false)
<p class="form-row col-lg-6 col-lg-6 cfw-text-input cfw-input-wrap validate-required cfw-label-is-floated" id="shipping_last_name_field" data-priority="">
<label for="shipping_email" class="cfw-floatable-label">Email&nbsp;<abbr class="required" title="required">*</abbr></label>
<span class="woocommerce-input-wrapper">
<input type="email" class="input-text parsley-success" name="shipping_email" id="shipping_email" placeholder="" value="{{ $email }}" data-parsley-trigger="change focusout" data-persist="false" data-parsley-required="true" data-parsley-group="cfw-customer-info" autocomplete="family-name" >
</span>
</p>
@endif
<p class="form-row address-field col-lg-12 col-lg-12 cfw-text-input cfw-input-wrap validate-required cfw-label-is-floated" id="city_field" data-priority="" data-o_class="form-row address-field col-lg-4 col-lg-4 cfw-text-input cfw-input-wrap validate-required cfw-label-is-floated" data-parsley-required="true">
<label for="city" class="cfw-floatable-label">Town / City&nbsp;<abbr class="required" title="required">*</abbr></label>
<span class="woocommerce-input-wrapper">
<input type="text" class="input-text " name="city" id="city" placeholder="" value="{{isset($billing_address) ? $billing_address->getCity->name : ''}}" data-parsley-trigger="change focusout" data-parsley-debounce="200" data-persist="false" data-parsley-required="true" data-parsley-group="cfw-customer-info" autocomplete="city" data-placeholder="Town / City">
</span>
</p>
</div>
<div class="row cfw-input-wrap-row">
<p class="form-row country-field col-lg-4 col-lg-4 cfw-text-input cfw-input-wrap validate-required cfw-label-is-floated" id="shipping_address_1_field" data-priority="" data-parsley-required="true">
<label for="country" class="cfw-floatable-label">Country <abbr class="required" title="required">*</abbr></label>
<span class="woocommerce-input-wrapper">
<input type="text" class="input-text " name="country" id="country" placeholder="" value="{{isset($billing_address) ? $billing_address->getCountry->name : 'United States'}}" data-parsley-trigger="change focusout" data-persist="false" data-saved-value="Sample St." data-parsley-required="true" data-parsley-group="cfw-customer-info" autocomplete="address-line1" data-placeholder="Street address">
</span>
</p>
<p class="form-row address-field col-lg-4 col-lg-4 cfw-text-input cfw-input-wrap validate-required cfw-label-is-floated" id="state_field" data-priority="" data-o_class="form-row address-field col-lg-4 col-lg-4 cfw-text-input cfw-input-wrap validate-required cfw-label-is-floated" data-parsley-required="true">
<label for="state" class="cfw-floatable-label">State / Region&nbsp;<abbr class="required" title="required">*</abbr></label>
<span class="woocommerce-input-wrapper">
<input type="text" class="input-text " name="state" id="state" placeholder="" value="{{isset($billing_address) ? $billing_address->getState->name : 'California'}}" data-parsley-trigger="change focusout" data-parsley-debounce="200" data-persist="false" data-parsley-required="true" data-parsley-group="cfw-customer-info" autocomplete="state" data-placeholder="State / Region">
</span>
</p>
<p class="form-row address-field col-lg-4 col-lg-4 cfw-text-input cfw-input-wrap validate-required validate-postcode cfw-label-is-floated" id="shipping_postcode_field" data-priority="" data-o_class="form-row address-field col-lg-4 col-lg-4 cfw-text-input cfw-input-wrap validate-required validate-postcode cfw-label-is-floated" data-parsley-required="true">
<label for="zipcode" class="cfw-floatable-label">Postcode / ZIP&nbsp;<abbr class="required" title="required">*</abbr></label>
<span class="woocommerce-input-wrapper">
<input type="text" class="input-text " name="zipcode" id="zipcode" placeholder="" value="{{ isset($billing_address) ? $billing_address->postal_code : $zipcode }}" {{isset($primary_address->postal_code)?$primary_address->postal_code:''}}" data-parsley-length="[2,12]" data-parsley-trigger="change focusout" data-parsley-postcode="true" data-parsley-debounce="200" data-persist="false" data-parsley-required="true" data-parsley-group="cfw-customer-info" autocomplete="postal-code" data-placeholder="Postcode / ZIP">
</span>
</p>
</div>
</div>
</div>
@endif
@php
$delivery_info = null;
@endphp
@if(!isModuleActive('MultiVendor'))
@php
if(session()->has('delivery_info')){
$delivery_info = session()->get('delivery_info');
}
@endphp
@endif
<div id="cfw-customer-info-action" class="cfw-bottom-controls">
<div class="previous-button">
<a href="{{ url('/cart') }}" class="cfw-prev-tab">« {{__('Back')}}</a>
</div>
@if(!$delivery_info || $delivery_info && $delivery_info['delivery_type'] == 'home_delivery')
<input type="hidden" name="step" value="select_shipping">
@if(env('NOCAPTCHA_INVISIBLE') == "true")
<button type="button" data-tab="#cfw-payment-method" class="cfw-primary-btn cfw-next-tab cfw-continue-to-shipping-btn" data-sitekey="{{env('NOCAPTCHA_SITEKEY')}}" data-size="invisible" data-callback="onSubmit">{{__('defaultTheme.continue_to_payment')}}</button>
@else
<a href="javascript:" data-tab="#cfw-payment-method" class="cfw-primary-btn cfw-next-tab cfw-continue-to-shipping-btn">
<span class="cfw-button-text">{{__('defaultTheme.continue_to_payment')}}</span>
</a>
@endif
@else
<input type="hidden" name="step" value="select_payment">
<input type="hidden" name="shipping_method" value="{{encrypt($free_shipping_for_pickup_location->id)}}">
@if(env('NOCAPTCHA_INVISIBLE') == "true")
<button type="button" data-tab="#cfw-shipping-method" class="cfw-primary-btn cfw-next-tab cfw-continue-to-shipping-btn" data-sitekey="{{env('NOCAPTCHA_SITEKEY')}}" data-size="invisible" data-callback="onSubmit">{{__('defaultTheme.continue_to_payment')}}</button>
@else
<a href="javascript:" data-tab="#cfw-payment-method" data-action="select_payment" class="cfw-primary-btn cfw-next-tab cfw-continue-to-shipping-btn">
<span class="cfw-button-text">{{__('defaultTheme.continue_to_payment')}}</span>
</a>
@endif
@endif
<a href="javascript:" data-tab="#cfw-payment-method" class="cfw-primary-btn cfw-next-tab cfw-continue-to-payment-btn" style="display: inline;">
<span class="cfw-button-text">{{__('defaultTheme.continue_to_payment')}}</span>
</a>
</div>
</div>
<div id="cfw-shipping-method" class="cfw-panel" style="">
<ul class="cfw-review-pane cfw-module" style="position: static; zoom: 1;">
<li>
<div class="col-10 inner">
<div role="rowheader" class="cfw-review-pane-label">{{__('defaultTheme.contact')}}</div>
<div class="cfw-review-pane-content cfw-review-pane-contact-value"></div>
</div>
<!-- <div role="cell" class="col-2 cfw-review-pane-link">
<a href="javascript:" data-tab="#cfw-customer-info" class="cfw-tab-link cfw-small">{{__('common.change')}}</a>
</div> -->
</li>
<li>
<div class="col-10 inner">
<div role="rowheader" class="cfw-review-pane-shipping-address-label-value cfw-review-pane-label">{{__('defaultTheme.ship_to')}}</div>
<div class="cfw-review-pane-content cfw-review-pane-shipping-address-value"></div>
</div>
<div role="cell" class="col-2 cfw-review-pane-link">
<a href="javascript:" data-tab="#cfw-customer-info" class="cfw-tab-link cfw-small">{{__('common.change')}}</a>
</div>
</li>
</ul>
<h3 class="cfw-shipping-methods-heading">Shipping method</h3>
<div id="cfw-shipping-methods" class="cfw-module" style="position: static; zoom: 1;">
<ul id="shipping_method" class="cfw-shipping-methods-list"></ul>
</div>
<div id="cfw-shipping-action" class="cfw-bottom-controls">
<div class="previous-button">
<a href="javascript:" data-tab="#cfw-customer-info" class="cfw-prev-tab cfw-return-to-information-btn">« {{__('defaultTheme.return_to_information')}}</a>
</div>
@if (false && isModuleActive('ShippingZone'))
@include('shopifymycart::partials.payment_button')
@else
<a href="javascript:" data-tab="#cfw-payment-method" class="cfw-primary-btn cfw-next-tab cfw-continue-to-payment-btn"><span class="cfw-button-text">{{__('defaultTheme.continue_to_payment')}}</span></a>
@endif
</div>
</div>
<div id="cfw-payment-method" class="cfw-panel woocommerce-checkout-payment" style="">
<ul class="cfw-review-pane cfw-module" style="position: static; zoom: 1;">
<li>
<div class="inner col-10">
<div role="rowheader" class="cfw-review-pane-label">{{__('Name')}}</div>
<div class="cfw-review-pane-content cfw-review-pane-contact-value">{{ $name }}</div>
</div>
<div role="cell" class="col-2 cfw-review-pane-link">
<a href="javascript:" data-tab="#cfw-customer-info" class="cfw-tab-link cfw-small">{{__('common.change')}}</a>
</div>
</li>
<li>
<div class="inner col-10">
<div role="rowheader" class="cfw-review-pane-label">{{__('Email')}}</div>
<div class="cfw-review-pane-content cfw-review-pane-contact-value">{{ $email }}</div>
</div>
<div role="cell" class="col-2 cfw-review-pane-link">
<a href="javascript:" data-tab="#cfw-customer-info" class="cfw-tab-link cfw-small">{{__('common.change')}}</a>
</div>
</li>
</ul>
<div id="cfw-billing-methods" class="cfw-module cfw-accordion" style="position: static; zoom: 1;">
<h3>{{__('common.payment')}}</h3>
<div class="cfw-payment-method-information-wrap">
<h4 class="cfw-small secure-notice">{{__('defaultTheme.all_transactions_are_secure_and_encrypted')}}.</h4>
<div class="cfw-payment-methods-wrap">
<div id="payment" class="woocommerce-checkout-payment">
<ul class="wc_payment_methods payment_methods methods cfw-radio-reveal-group">
@if (false)
@include('subscription::components._payment_methods')
@endif
</ul>
</div>
</div>
</div>
</div>
<div id="cfw-payment-action" class="cfw-bottom-controls">
<div class="previous-button">
<a href="javascript:" data-tab="#cfw-customer-info" class="cfw-prev-tab cfw-return-to-information-btn">« {{__('defaultTheme.return_to_information')}}</a></a>
<a href="javascript:" data-tab="#cfw-customer-info" class="cfw-prev-tab cfw-return-to-shipping-btn">« {{__('defaultTheme.return_to_information')}}</a></a>
</div>
<div class="cfw-place-order-wrap">
<input type="hidden" value="{{encrypt(0)}}" id="off_payment_id">
<div class="place-order" id="cfw-place-order">
@php
$payment_id = encrypt(0);
$url = '';
if(count($gateway_activations) > 0 && $gateway_activations[0]->id == 1 || count($gateway_activations) > 0 && $gateway_activations[0]->id == 2){
$gateway_id = (count($gateway_activations) > 0)?encrypt($gateway_activations[0]->id):0;
if($gateway_activations[0]->id == 1){
$url = url('/checkout?').'gateway_id='.$gateway_id.'&payment_id='.$payment_id.'&step=complete_order';
$pay_now_btn = '<a href="javascript:void(0)" data-url="'.$url.'" data-type="CashOnDelivery" id="payment_btn_trigger" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>';
}elseif($gateway_activations[0]->id == 2){
$url = url('/checkout?').'gateway_id='.$gateway_id.'&payment_id='.$payment_id.'&step=complete_order';
$pay_now_btn = '<a href="javascript:void(0)" data-url="'.$url.'" data-type="Wallet" id="payment_btn_trigger" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>';
}
}else {
$method = '';
if(count($gateway_activations) > 0){
$method = $gateway_activations[0]->method;
}
$pay_now_btn = '<a href="javascript:void(0)" id="payment_btn_trigger" data-type="'.$method.'" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>';
}
@endphp
{!! $pay_now_btn !!}
<!-- <button type="button" class="cfw-primary-btn cfw-next-tab validate" id="place_order">Place Order</button> -->
</div>
</div>
</div>
</div>
</div>
<!-- Cart Summary -->
<div id="cfw-cart-summary" class="col-lg-5" role="complementary" style="position: static; zoom: 1;">
<div id="cfw-mobile-cart-header">
<div class="cfw-display-table cfw-w100">
<a id="cfw-expand-cart" class="cfw-display-table-row">
<span class="cfw-cart-icon cfw-display-table-cell">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shopping-cart"><circle cx="9" cy="21" r="1"></circle><circle cx="20" cy="21" r="1"></circle><path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"></path></svg>
</span>
<span class="cfw-cart-summary-label-show cfw-small cfw-display-table-cell">
<span>Show order summary</span>
<svg width="11" height="6" xmlns="http://www.w3.org/2000/svg" class="cfw-arrow" fill="#000"><path d="M.504 1.813l4.358 3.845.496.438.496-.438 4.642-4.096L9.504.438 4.862 4.534h.992L1.496.69.504 1.812z"></path></svg>
</span>
<span class="cfw-cart-summary-label-hide cfw-small cfw-display-table-cell">
<span>Hide order summary</span>
<svg width="11" height="6" xmlns="http://www.w3.org/2000/svg" class="cfw-arrow" fill="#000"><path d="M.504 1.813l4.358 3.845.496.438.496-.438 4.642-4.096L9.504.438 4.862 4.534h.992L1.496.69.504 1.812z"></path></svg>
</span>
<span id="cfw-mobile-total" class="total amount cfw-display-table-cell" style="position: static; zoom: 1;">
<span class="woocommerce-Price-amount amount">
<bdi id="cart_mobile_total"></bdi>
</span>
</span>
</a>
</div>
</div>
<div id="cfw-cart-summary-content">
<div id="cfw-checkout-before-order-review"></div>
<input id="plan_id" type="hidden" value="{{$seller_product->id}}" name="plan">
@if(!isModuleActive('MultiVendor'))
@php
$total = 0;
$subtotal = 0;
$actual_price = 0;
@endphp
@if (isset($cartData))
<table id="cfw-cart" class="cfw-module">
<tbody>
@foreach($cartData as $key => $cart)
@if($cart->product_type == 'product')
@php
$actual_price += $cart->total_price;
if (isModuleActive('WholeSale')){
$w_main_price = 0;
$wholeSalePrices = $cart->product->wholeSalePrices;
if($wholeSalePrices->count()){
foreach ($wholeSalePrices as $w_p){
if ( ($w_p->min_qty<=$cart->qty) && ($w_p->max_qty >=$cart->qty) ){
$w_main_price = $w_p->selling_price;
}
elseif($w_p->max_qty < $cart->qty){
$w_main_price = $w_p->selling_price;
}
}
}
if ($w_main_price!=0){
$subtotal += $w_main_price * $cart->qty;
}else{
$subtotal += $cart->product->sku->selling_price * $cart->qty;
}
}else{
$subtotal += $cart->product->sku->selling_price * $cart->qty;
}
@endphp
<tr class="cart-item-row cart-item-7cbbc409ec990f19c78c75bd1e06f215 cart_item">
<td class="cfw-cart-item-image">
<div class="cfw-cart-item-image-wrap">
<img width="60" height="60" src="@if($cart->product->product->product->product_type == 1)
{{showImage($cart->product->product->product->thumbnail_image_source)}}
@else
{{showImage(@$cart->product->sku->variant_image?@$cart->product->sku->variant_image:@$cart->product->product->product->thumbnail_image_source)}}
@endif" alt="" sizes="(max-width: 60px) 100vw, 60px">
</div>
</td>
<th class="cfw-cart-item-description px-3">
<div class="cfw-cart-item-title">
{{ textLimit(@$cart->product->product->product_name, 28) }}
@if (isModuleActive('ShippingZone'))
@include('shippingzone::components._undeliverable')
@endif
@if($cart->product->product->product->product_type == 2)
@php
$countCombinatiion = count(@$cart->product->product_variations);
@endphp
<p>
@foreach($cart->product->product_variations as $key => $combination)
@if($combination->attribute->name == 'Color')
{{$combination->attribute->name}}: {{$combination->attribute_value->color->name}}
@else
{{$combination->attribute->name}}: {{$combination->attribute_value->value}}
@endif
@if($countCombinatiion > $key +1)
,
@endif
@endforeach
</p>
@endif
</div>
<div class="cfw-edit-item-quantity-control-wrap">
<div class="cfw-quantity-stepper">
<input type="hidden" value="{{$cart->id}}" name="cart_id[]">
<input type="hidden" id="maximum_qty_{{$cart->id}}" value="{{@$cart->product->product->product->max_order_qty}}">
<input type="hidden" id="minimum_qty_{{$cart->id}}" value="{{@$cart->product->product->product->minimum_order_qty}}">
<button type="button" value="-" aria-label="Decrement" class="cfw-quantity-stepper-btn-minus change_qty" data-qty_id="#qty_{{$cart->id}}" data-sub_total="{{$subtotal}}" data-product_total_id="#product_total_{{$cart->id}}" data-product_price="{{$cart->price}}" data-change_amount="1" data-maximum_qty="#maximum_qty_{{$cart->id}}"
data-minimum_qty="#minimum_qty_{{$cart->id}}" data-product_stock="{{@$cart->product->product_stock}}" data-stock_manage="{{@$cart->product->product->stock_manage}}" data-wholesale="#getWholesalePrice_{{$cart->id}}" data-cart_id="{{$cart->id}}">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 384 512"><path d="M376 232H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h368c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"></path></svg>
</button>
<input class="cfw-quantity-stepper-value-label cfw-quantity-bulk-edit" style="border: none;max-width: 30px;" name="qty[]" id="qty_{{$cart->id}}" maxlength="12" value="{{$cart->qty}}" readonly>
<button type="button" value="+" aria-label="Increment" class="cfw-quantity-stepper-btn-plus change_qty" data-qty_id="#qty_{{$cart->id}}" data-sub_total="{{$subtotal}}" data-product_total_id="#product_total_{{$cart->id}}" data-product_price="{{$cart->price}}" data-change_amount="1" data-maximum_qty="#maximum_qty_{{$cart->id}}"
data-minimum_qty="#minimum_qty_{{$cart->id}}" data-product_stock="{{@$cart->product->product_stock}}" data-stock_manage="{{@$cart->product->product->stock_manage}}" data-wholesale="#getWholesalePrice_{{$cart->id}}" data-cart_id="{{$cart->id}}" >
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 384 512"><path d="M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"></path></svg>
</button>
</div>
</div>
</th>
<td class="cfw-cart-item-quantity visually-hidden"> {{$cart->qty}} </td>
<td class="cfw-cart-item-subtotal">
<span class="woocommerce-Price-amount amount" >
<bdi id="product_total_{{$cart->id}}">
{{single_price($cart->total_price)}}
</bdi>
</span>
</td>
</tr>
@else
<tr class="cart-item-row cart-item-7cbbc409ec990f19c78c75bd1e06f215 cart_item">
<td class="cfw-cart-item-image">
<div class="cfw-cart-item-image-wrap">
<img width="60" height="60" src="{{showImage(@$cart->giftCard->thumbnail_image)}}" alt="" sizes="(max-width: 60px) 100vw, 60px">
</div>
</td>
<th class="cfw-cart-item-description px-3">
<div class="cfw-cart-item-title"> {{ textLimit(@$cart->giftCard->name, 28) }} </div>
<div class="cfw-edit-item-quantity-control-wrap">
<div class="cfw-quantity-stepper">
<input type="hidden" value="{{$cart->id}}" name="cart_id[]">
<input type="hidden" id="maximum_qty_{{$cart->id}}" value="{{@$cart->product->product->product->max_order_qty}}">
<input type="hidden" id="minimum_qty_{{$cart->id}}" value="{{@$cart->product->product->product->minimum_order_qty}}">
<button type="button" value="-" aria-label="Decrement" class="cfw-quantity-stepper-btn-minus change_qty" data-qty_id="#qty_{{$cart->id}}" data-sub_total="{{$subtotal}}" data-product_total_id="#product_total_{{$cart->id}}" data-product_price="{{$cart->price}}" data-change_amount="1" data-maximum_qty="#maximum_qty_{{$cart->id}}"
data-minimum_qty="#minimum_qty_{{$cart->id}}" data-product_stock="{{@$cart->product->product_stock}}" data-stock_manage="{{@$cart->product->product->stock_manage}}" data-wholesale="#getWholesalePrice_{{$cart->id}}" data-cart_id="{{$cart->id}}">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 384 512"><path d="M376 232H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h368c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"></path></svg>
</button>
<input class="cfw-quantity-stepper-value-label cfw-quantity-bulk-edit" style="border: none;max-width: 30px;" name="qty[]" id="qty_{{$cart->id}}" maxlength="12" value="{{$cart->qty}}" readonly>
<button type="button" value="+" aria-label="Increment" class="cfw-quantity-stepper-btn-plus change_qty" data-qty_id="#qty_{{$cart->id}}" data-sub_total="{{$subtotal}}" data-product_total_id="#product_total_{{$cart->id}}" data-product_price="{{$cart->price}}" data-change_amount="1" data-maximum_qty="#maximum_qty_{{$cart->id}}"
data-minimum_qty="#minimum_qty_{{$cart->id}}" data-product_stock="{{@$cart->product->product_stock}}" data-stock_manage="{{@$cart->product->product->stock_manage}}" data-wholesale="#getWholesalePrice_{{$cart->id}}" data-cart_id="{{$cart->id}}" >
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 384 512"><path d="M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"></path></svg>
</button>
</div>
</div>
</th>
<td class="cfw-cart-item-quantity visually-hidden"> {{$cart->qty}} </td>
<td class="cfw-cart-item-subtotal">
<span class="woocommerce-Price-amount amount">
<bdi>
{{single_price($cart->price)}}</bdi>
</span>
</td>
</tr>
@php
$actual_price += $cart->total_price;
$subtotal += $cart->giftCard->selling_price * $cart->qty;
@endphp
@endif
@endforeach
</tbody>
</table>
@endif
<table id="cfw-cart" class="cfw-module">
<tbody>
@php
$subtotal = $plan->price;
@endphp
<tr class="cart-item-row cart-item-7cbbc409ec990f19c78c75bd1e06f215 cart_item">
<td class="cfw-cart-item-image">
<div class="cfw-cart-item-image-wrap">
<img width="60" height="60" src="https://amazcart-subscription.local/public/frontend/default/img/default_img.jpg" alt="" sizes="(max-width: 60px) 100vw, 60px">
</div>
</td>
<th class="cfw-cart-item-description px-3">
<div class="cfw-cart-item-title">
{{ textLimit($seller_product->product->product_name, 28) }}
@if (false)
@if (isModuleActive('ShippingZone'))
@include('shippingzone::components._undeliverable')
@endif
@if($cart->product->product->product->product_type == 2)
@php
$countCombinatiion = count(@$cart->product->product_variations);
@endphp
<p>
@foreach($cart->product->product_variations as $key => $combination)
@if($combination->attribute->name == 'Color')
{{$combination->attribute->name}}: {{$combination->attribute_value->color->name}}
@else
{{$combination->attribute->name}}: {{$combination->attribute_value->value}}
@endif
@if($countCombinatiion > $key +1)
,
@endif
@endforeach
</p>
@endif
@endif
</div>
@if (false)
<div class="cfw-edit-item-quantity-control-wrap">
<div class="cfw-quantity-stepper">
<input type="hidden" value="{{$cart->id}}" name="cart_id[]">
<input type="hidden" id="maximum_qty_{{$cart->id}}" value="{{@$cart->product->product->product->max_order_qty}}">
<input type="hidden" id="minimum_qty_{{$cart->id}}" value="{{@$cart->product->product->product->minimum_order_qty}}">
<button type="button" value="-" aria-label="Decrement" class="cfw-quantity-stepper-btn-minus change_qty" data-qty_id="#qty_{{$cart->id}}" data-sub_total="{{$subtotal}}" data-product_total_id="#product_total_{{$cart->id}}" data-product_price="{{$cart->price}}" data-change_amount="1" data-maximum_qty="#maximum_qty_{{$cart->id}}"
data-minimum_qty="#minimum_qty_{{$cart->id}}" data-product_stock="{{@$cart->product->product_stock}}" data-stock_manage="{{@$cart->product->product->stock_manage}}" data-wholesale="#getWholesalePrice_{{$cart->id}}" data-cart_id="{{$cart->id}}">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 384 512"><path d="M376 232H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h368c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"></path></svg>
</button>
<input class="cfw-quantity-stepper-value-label cfw-quantity-bulk-edit" style="border: none;max-width: 30px;" name="qty[]" id="qty_{{$cart->id}}" maxlength="12" value="{{$cart->qty}}" readonly>
<button type="button" value="+" aria-label="Increment" class="cfw-quantity-stepper-btn-plus change_qty" data-qty_id="#qty_{{$cart->id}}" data-sub_total="{{$subtotal}}" data-product_total_id="#product_total_{{$cart->id}}" data-product_price="{{$cart->price}}" data-change_amount="1" data-maximum_qty="#maximum_qty_{{$cart->id}}"
data-minimum_qty="#minimum_qty_{{$cart->id}}" data-product_stock="{{@$cart->product->product_stock}}" data-stock_manage="{{@$cart->product->product->stock_manage}}" data-wholesale="#getWholesalePrice_{{$cart->id}}" data-cart_id="{{$cart->id}}" >
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" viewBox="0 0 384 512"><path d="M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"></path></svg>
</button>
</div>
</div>
@endif
</th>
<td class="cfw-cart-item-quantity visually-hidden"> 1 </td>
<td class="cfw-cart-item-subtotal">
<span class="woocommerce-Price-amount amount" >
<bdi id="product_total_{{$plan->id}}">
{{single_price($plan->price)}}
</bdi>
</span>
</td>
</tr>
</tbody>
</table>
@endif
@auth
<div id="cfw-coupons" class="cfw-module" >
<div class="cfw-promo-wrap ">
<div class="coupon_verify_information mb_20 d-flex align-items-center flex-wrap d-none">
<div class="icon">
<img src="http://dashdistroclub.test/public/frontend/amazy/img/cart/verified.svg" alt="">
</div>
<div class="coupon_content">
<h4 class="font_14 f_w_700 lh-1">Valid Coupon Code</h4>
<a class="remove_coupon text-uppercase text-decoration-underline cursor_pointer" id="coupon_delete">Remove Code</a>
</div>
</div>
@if (false)
<div class="row cfw-promo-row cfw-input-wrap-row " style="display:none!important">
<p class="form-row no-gutters cfw-text-input cfw-input-wrap col-lg-8" id="cfw-promo-code_field" data-priority="">
<label for="cfw-promo-code" class="cfw-input-label cfw-floatable-label">Promo Code&nbsp;<span class="optional"></span></label>
<span class="woocommerce-input-wrapper">
<input type="hidden" name="actual_total" id="actual_total">
<input type="hidden" name="coupon_discount" id="coupon_discount_value">
<input type="text" class="input-text garlic-auto-save" name="cfw-promo-code" id="cfw-promo-code" placeholder="Enter Promo Code " value="" data-saved-value="CFW_EMPTY">
</span>
</p>
<div class="cfw-input-wrap cfw-button-input col-lg-4 cfw-promo-code-button-wrap form-row">
<input type="button" name="cfw-promo-code-btn" id="cfw-promo-code-btn" class="cfw-secondary-btn coupon_apply_btn" value="Apply">
</div>
</div>
@endif
</div>
</div>
@endauth
<div id="cfw-checkout-after-order-review"></div>
<div id="cfw-totals-list" class="cfw-module">
<table class="cfw-module">
<tbody>
<tr class="cart-subtotal">
<th>{{ __('common.subtotal') }}</th>
<td>
<span class="woocommerce-Price-amount amount">
<input id="cart_subtotal_value" type="hidden" name="cart_subtotal" value="{{$subtotal}}">
<bdi id="cart_subtotal">{{single_price($subtotal)}}</bdi>
</span>
</td>
</tr>
@if (false)
<tr class="woocommerce-shipping-totals">
<th>
{{__('common.shipping_charge')}}<br>
@if(isModuleActive('MultiVendor'))
<p>{{ __('defaultTheme.package_wise_shipping_charge') }}</p>
@endif
</th>
<td>
<span class="woocommerce-Price-amount amount">
<input type="hidden" name="shipping_total" id="shipping_total_value">
<bdi id="shipping_total">
@if(isModuleActive('MultiVendor'))
+ {{single_price($total_shipping_charge)}}
@else
{{__('defaultTheme.calculated_at_next_step')}}
@endif
</bdi>
</span>
</td>
</tr>
@php
if(isModuleActive('MultiVendor')){
$total = $actual_price + $total_shipping_charge;
}else{
$total = $actual_price;
$discount = $subtotal - $actual_price;
}
@endphp
<tr class="cart-subtotal">
<th>{{__('common.discount')}}</th>
<td>
<span class="woocommerce-Price-amount amount">
<bdi>{{single_price($discount)}}</bdi>
</span>
</td>
</tr>
<tr class="cart-coupon-discount" style="display: none;">
<th>{{__('common.coupon')}} {{__('common.discount')}}</th>
<td>
<span class="woocommerce-Price-amount amount">
<bdi id="counpon_discount_total"></bdi>
</span>
</td>
</tr>
<tr class="cart-subtotal">
<th>{{__('common.vat/tax/gst')}}</th>
<td>
<span class="woocommerce-Price-amount amount">
<bdi id="tax_total">{{__('defaultTheme.calculated_at_next_step')}}</bdi>
</span>
</td>
</tr>
@endif
@php
$coupon = 0;
$coupon_id = null;
$total_for_coupon = $actual_price;
@endphp
<tr class="order-total">
<th>{{__('common.total')}}</th>
<td>
<strong>
<span class="woocommerce-Price-amount amount">
<input id="cart_total_value" type="hidden" name="cart_total" value="{{$total-$coupon}}">
<bdi id="cart_total">{{single_price($plan->price)}}</bdi>
</span>
</strong>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</form>
<div id="cfw_lost_password_form_wrap" style="display:none;">
<form method="post" target="_blank" id="cfw_lost_password_form" class="checkoutwc">
<div id="cfw-lp-alert-placeholder"></div>
<p style="margin-bottom: 1em">Lost your password? Please enter your username or email address. You will receive a link to create a new password via email.</p>
<p class="form-row cfw-email-input cfw-input-wrap col-lg-12 validate-required" id="user_login_field" data-priority="">
<label for="user_login" class="cfw-floatable-label">Email address&nbsp;<abbr class="required" title="required">*</abbr></label>
<span class="woocommerce-input-wrapper">
<input type="email" class="input-text " name="user_login" id="user_login" placeholder="Email address" value="" data-saved-value="CFW_EMPTY" data-parsley-required="true" data-parsley-group="cfw-payment-method" autocomplete="email">
</span>
</p>
<div class="clear"></div>
<p class="woocommerce-form-row form-row">
<input type="hidden" name="wc_reset_password" value="true">
<button type="submit" class="cfw-primary-btn" value="Reset password">Reset password</button>
</p>
<input type="hidden" id="woocommerce-lost-password-nonce" name="woocommerce-lost-password-nonce" value="45f2d0bdb2">
<input type="hidden" name="_wp_http_referer" value="/?page_id=9">
</form>
</div>
</main>
@endsection
@push('scripts')
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.70/jquery.blockUI.js"></script>
<script src="{{ asset('Modules/Subscription/Resources/assets/dist/js/checkoutwc-vendor.min.js') }}"></script>
<script src="{{ asset('Modules/Subscription/Resources/assets/easy_autocomplete/jquery.easy-autocomplete.js') }}"></script>
<script type="text/javascript">
$(document).ready(function() {
let countries = [];
let country = null;
$.get('https://countriesnow.space/api/v0.1/countries/states', function(response) {
countries = response.data;
console.log(countries);
country = countries.filter(function(item, index) {
return item.name == 'United States';
});
country = country[0];
console.log(country);
$.get('https://restcountries.com/v3.1/name/' + country.name + '?fullText=true', function(response) {
if (response.length > 0) {
country = response[0];
//initialized = false;
}
});
state = country.states.filter(function(item, index) {
return item.name == 'California';
});
state = state[0];
console.log(state);
$('#country').easyAutocomplete({
data: countries,
list: {
match: {
enabled: true
},
onClickEvent: function() {
country = $('#country').getSelectedItemData();
$('#country').val(country.name);
$('#address').val('');
$('#city').val('');
$('#state').val('');
$('#zipcode').val('');
$.get('https://restcountries.com/v3.1/name/' + country.name + '?fullText=true', function(response) {
if (response.length > 0) {
country = response[0];
//initialized = false;
}
});
$('#state').easyAutocomplete({
data: country.states,
list: {
match: {
enabled: true
}
},
getValue: 'name',
template: {
type: "custom",
method: function(value, item) {
return `<span>${item.name}</span>`;
}
}
});
}
},
getValue: 'name',
template: {
type: "custom",
method: function(value, item) {
return `<span>${item.name}</span>`;
}
}
});
$('.easy-autocomplete').css('width', '100%');
});
$('#addressx').easyAutocomplete({
url: function(phrase) {
var lat = country.latlng[0];
var long = country.latlng[1];
return 'https://keemfzoft.com/api/google/textsearch?query=' + phrase + '&location=' + lat + ',' + long + '&radius=10000&key=AIzaSyCu-gEfhthbqjZ3sZaWnVchOcETweUfoKc';
},
listLocation: 'results',
getValue: 'formatted_address',
list: {
onClickEvent: function() {
var address = $('#address').getSelectedItemData();
var lat = address.geometry.location.lat;
var long = address.geometry.location.lng;
$.get('https://maps.googleapis.com/maps/api/geocode/json?latlng=' + lat + ',' + long + '&sensor=false&key=AIzaSyCu-gEfhthbqjZ3sZaWnVchOcETweUfoKc', function(response) {
if (response.results.length > 0) {
var details = response.results[0];
var addressComponents = details.address_components;
console.log(addressComponents);
var city = null;
var state = null;
var zipcode = null;
for (var i = 0; i < addressComponents.length; i++) {
if (addressComponents[i].types[0] == 'locality') {
city = addressComponents[i].long_name;
} else if (addressComponents[i].types[0] == 'administrative_area_level_1') {
state = addressComponents[i].long_name;
} else if (addressComponents[i].types[0] == 'postal_code') {
zipcode = addressComponents[i].long_name;
}
}
$('#city').val(city);
$('#state').val(state);
$('#zipcode').val(zipcode);
}
})
}
},
template: {
type: "custom",
method: function(value, item) {
return `<span>${item.formatted_address}</span>`;
}
}
});
const currentTab = $('#order_review').find(".cfw-panel.active").first();
$("#order_review").easytabs({
updateHash: false
});
$('#order_review').bind("easytabs:before", (e, t, d) => {
return $('#checkout').parsley().validate({
group: currentTab.attr("id")
});
});
$('#order_review').bind("easytabs:midTransition", (e, t, d) => {
// const r = $('#'+d[0].id).find(".cfw-bottom-controls .cfw-primary-btn ");
// r.addClass("cfw-button-loading");
$('.cfw-promo-row').hide();
$('.cart-coupon-discount').hide();
$('#current_step').val('information');
blockUI();
});
$('#order_review').bind("easytabs:after", (e, t, d) => {
if (d[0].id === 'cfw-shipping-method') {
$('#current_step').val('shipping');
let data = {
'_token': "{{ csrf_token() }}",
'action': 'shipping',
'address_id': $('#shipping_address').val(),
'address': $('#address').val(),
'name': $('#shipping_name').val(),
'email': $('#shipping_email').val(),
'phone': $('#shipping_phone').val(),
'country': $('#country').val(),
'state': $('#state').val(),
'city': $('#city').val(),
'postal_code': $('#zipcode').val()
}
let base_url = $('#url').val();
let url = base_url + "/subscription/checkout";
$.post(url, data, function(data) {
$('#shipping_method').html(data.shipping_methods);
$('#shipping_address').val(data.address.id);
$('.cfw-review-pane-contact-value').html($('#shipping_email').val());
$('.cfw-review-pane-shipping-address-value').html($('#address').val());
unblockUI();
});
} else if (d[0].id === 'cfw-payment-method') {
$('#current_step').val('payment');
const delivery_type = $('[name="cfw_delivery_method"]:checked').val();
const pickup_location = $('[name="cfw_pickup_location"]').val();
const shipping_method = $('[name="cfw_shipping_method"]').val();
let data = {
'_token': "{{ csrf_token() }}",
'action': 'payment',
'delivery_type': delivery_type === 'ship' ? 'home_delivery' : 'pickup_location',
'shipping_method': shipping_method,
'pickup_location': pickup_location,
'address_id': $('#shipping_address').val(),
'address': $('#address').val(),
'name': $('#shipping_name').val(),
'email': $('#shipping_email').val(),
'phone': $('#shipping_phone').val(),
'country': $('#country').val(),
'state': $('#state').val(),
'city': $('#city').val(),
'postal_code': $('#zipcode').val(),
'plan': $('#plan_id').val()
}
let base_url = $('#url').val();
let url = base_url + "/subscription/checkout";
$.post(url, data, function(data) {
if (data.coupon && data.coupon.coupon_amount) {
$('.coupon_verify_information').removeClass('d-none');
$('.cart-coupon-discount').show();
$('.cfw-promo-row').hide();
$('#counpon_discount_total').html(data.coupon_discount);
$('#coupon_discount_value').val(data.coupon_discount_value);
} else {
$('.coupon_verify_information').addClass('d-none');
$('.cfw-promo-row').show();
$('.cart-coupon-discount').hide();
}
if ($('[name="cfw_delivery_method"]:checked').val() == 'ship') {
$('.cfw-review-pane-shipping-method-value').html(data.selected_shipping_method.method_name + " - " + data.shipping_cost);
}
$('ul.wc_payment_methods').html(data.gateway_activations);
//$('#shipping_address').val(data.address.id);
$('#actual_total').val(data.actual_total)
$('#shipping_total_value').val(data.shipping_cost_value)
$('#shipping_total').html(data.shipping_cost);
$('#tax_total').html(data.tax_total);
$('#cart_total_value').val(data.cart_total_value);
$('#cart_total').html(data.cart_total);
$('#cart_mobile_total').html(data.cart_total);
unblockUI();
});
} else {
unblockUI();
}
});
$(document).on("click", ".cfw-tab-link, .cfw-next-tab, .cfw-prev-tab", (e) => {
const t = jQuery(e.currentTarget).data("tab");
t && $('#order_review').easytabs("select", t);
});
$(document).on('click', '.change_qty', function(event) {
let type = $(this).val();
let change_qty = 1;
let qty_id = $(this).data("qty_id");
let product_total_id = $(this).data("product_total_id");
let product_price = $(this).data("product_price");
let maximum_qty = $(this).data("maximum_qty");
let minimum_qty = $(this).data("minimum_qty");
var stock_manage = $(this).attr("data-stock_manage");
var product_stock = $(this).attr("data-product_stock");
var old_qty = $(qty_id).val();
var id = $(this).data('cart_id');
let sub_total = $('#cart_subtotal_value').val();
let total = $('#cart_total_value').val();
let max_qty = $(maximum_qty).val();
let min_qty = $(minimum_qty).val();
if (stock_manage != '0') {
if (type === '+') {
var pre_qty = parseInt(change_qty) + parseInt(old_qty);
var pre_product_total = parseFloat(pre_qty * parseFloat(product_price)).toFixed(2);
var new_sub_total = parseFloat(parseFloat(sub_total) + parseFloat(product_price)).toFixed(2);
var new_total = parseFloat(parseFloat(total) + parseFloat(product_price)).toFixed(2);
if (max_qty != '') {
if (parseInt(pre_qty) <= parseInt(product_stock)) {
if (parseInt(pre_qty) <= parseInt(max_qty)) {
updateQty(id, pre_qty);
$(qty_id).val(pre_qty);
$(product_total_id).html("{{currencySymbol()}}" + pre_product_total);
$('#cart_subtotal_value').val(new_sub_total);
$('#cart_subtotal').html("{{currencySymbol()}}" + new_sub_total);
$('#cart_total_value').val(new_total);
$('#cart_total').html("{{currencySymbol()}}" + new_total);
$('#cart_mobile_total').html("{{currencySymbol()}}" + new_total);
} else {
toastr.warning("{{__('defaultTheme.maximum_quantity_limit_exceed')}}", "{{__('common.warning')}}");
}
} else {
toastr.warning("{{__('defaultTheme.no_more_stock_available')}}", "{{__('common.warning')}}");
}
} else {
if (parseInt(pre_qty) < parseInt(product_stock)) {
updateQty(id, pre_qty);
$(qty_id).val(pre_qty);
$(product_total_id).html("{{currencySymbol()}}" + pre_product_total);
$('#cart_subtotal_value').val(new_sub_total);
$('#cart_subtotal').html("{{currencySymbol()}}" + new_sub_total);
$('#cart_total_value').val(new_total);
$('#cart_total').html("{{currencySymbol()}}" + new_total);
$('#cart_mobile_total').html("{{currencySymbol()}}" + new_total);
} else {
toastr.warning("{{__('defaultTheme.no_more_stock_available')}}", "{{__('common.warning')}}");
}
}
} else if (type === '-') {
var pre_qty = parseInt(old_qty) - parseInt(change_qty);
var pre_product_total = parseFloat(pre_qty * parseFloat(product_price)).toFixed(2);
var new_sub_total = parseFloat(parseFloat(sub_total) - parseFloat(product_price)).toFixed(2);
var new_total = parseFloat(parseFloat(total) - parseFloat(product_price)).toFixed(2);
if (min_qty != '') {
if (parseInt(pre_qty) >= parseInt(min_qty)) {
updateQty(id, pre_qty);
$(qty_id).val(pre_qty);
$(product_total_id).html("{{currencySymbol()}}" + pre_product_total);
$('#cart_subtotal_value').val(new_sub_total);
$('#cart_subtotal').html("{{currencySymbol()}}" + new_sub_total);
$('#cart_total_value').val(new_total);
$('#cart_total').html("{{currencySymbol()}}" + new_total);
$('#cart_mobile_total').html("{{currencySymbol()}}" + new_total);
} else {
toastr.warning("{{__('defaultTheme.minimum_quantity_limit_exceed')}}", "{{__('common.warning')}}");
}
} else {
if (parseInt(pre_qty) > 1) {
updateQty(id, pre_qty);
$(qty_id).val(pre_qty);
$(product_total_id).html("{{currencySymbol()}}" + pre_product_total);
$('#cart_subtotal_value').val(new_sub_total);
$('#cart_subtotal').html("{{currencySymbol()}}" + new_sub_total);
$('#cart_total_value').val(new_total);
$('#cart_total').html("{{currencySymbol()}}" + new_total);
$('#cart_mobile_total').html("{{currencySymbol()}}" + new_total);
} else {
toastr.warning("{{__('defaultTheme.minimum_quantity_limit_exceed')}}", "{{__('common.warning')}}");
}
}
}
} else {
if (type === '+') {
var pre_qty = parseInt(change_qty) + parseInt(old_qty);
if (max_qty != '') {
if (parseInt(pre_qty) <= parseInt(max_qty)) {
$(qty_id).val(pre_qty);
updateQty(id, pre_qty);
} else {
toastr.warning("{{__('defaultTheme.maximum_quantity_limit_exceed')}}", "{{__('common.warning')}}");
}
} else {
$(qty_id).val(pre_qty);
updateQty(id, pre_qty);
}
} else if (type === '-') {
var pre_qty = parseInt(old_qty) - parseInt(change_qty);
if (min_qty != '') {
if (parseInt(pre_qty) >= parseInt(min_qty)) {
$(qty_id).val(pre_qty);
updateQty(id, pre_qty);
} else {
toastr.warning("{{__('defaultTheme.minimum_quantity_limit_exceed')}}", "{{__('common.warning')}}");
}
} else {
if (parseInt(pre_qty) > 1) {
$(qty_id).val(pre_qty);
updateQty(id, pre_qty);
} else {
toastr.warning("{{__('defaultTheme.minimum_quantity_limit_exceed')}}", "{{__('common.warning')}}");
}
}
}
}
//Wholesale price set
if ($('#isWholeSaleActive').val() == 1) {
var wholesale_price = $(this).data('wholesale');
var getWholesalePrice = $(wholesale_price).val();
var plusOrMinus = $(this).val();
var cart_id = $(this).data('cart_id');
var get_base_price = $('.get_base_price' + cart_id).val();
var max_qty_w = '',
min_qty_w = '',
selling_price_w = '',
t_qty = '';
getWholesalePrice = JSON.parse(getWholesalePrice);
if (getWholesalePrice) {
if (plusOrMinus === '+') {
t_qty = parseInt(change_qty) + parseInt(old_qty);
} else if (plusOrMinus === '-') {
t_qty = parseInt(change_qty) - parseInt(old_qty);
}
var set_main_price = null;
for (let i = 0; i < getWholesalePrice.length; ++i) {
max_qty_w = getWholesalePrice[i].max_qty;
min_qty_w = getWholesalePrice[i].min_qty;
selling_price_w = getWholesalePrice[i].selling_price;
if ((min_qty_w <= pre_qty) && (max_qty_w >= pre_qty)) {
set_main_price = currency_format(selling_price_w);
} else if (min_qty_w < pre_qty) {
set_main_price = currency_format(selling_price_w);
} else if (set_main_price == null) {
set_main_price = get_base_price;
}
}
$('.set_base_price' + cart_id).text(set_main_price);
}
}
});
function updateQty(id, pre_qty) {
blockUI();
let data = {
'_token': "{{ csrf_token() }}",
'action': 'update_quantity',
'id': id,
'qty': pre_qty,
'shipping_method': shipping_method
}
let base_url = $('#url').val();
let url = base_url + "/shopifymycart/checkout";
$.post(url, data, function(data) {
unblockUI();
if ($('#current_step').val() == 'payment') {
$('#counpon_discount_total').html(data.coupon_discount);
$('#coupon_discount_value').val(data.coupon_discount_value);
$('#shipping_total_value').val(data.shipping_cost_value)
$('#shipping_total').html(data.shipping_cost);
$('#tax_total').html(data.tax_total);
$('#tax_total').html(data.tax_total);
$('#cart_total_value').val(data.cart_total_value);
$('#cart_total').html(data.cart_total);
$('#cart_mobile_total').html(data.cart_total);
}
});
}
$(document).on('click', '.coupon_apply_btn', function(event) {
event.preventDefault();
let coupon_code = $('#cfw-promo-code').val();
if (coupon_code) {
blockUI();
let data = {
'_token': "{{ csrf_token() }}",
'action': 'apply_coupon',
'coupon_code': coupon_code,
'shopping_amount': $('#actual_total').val(),
'shippping_cost': $('#shipping_total_value').val(),
}
let base_url = $('#url').val();
let url = base_url + "/shopifymycart/checkout";
$.post(url, data, function(data) {
unblockUI();
if (data.coupon_discount) {
$('.coupon_verify_information').removeClass('d-none');
$('.cfw-promo-row').hide();
$('.cart-coupon-discount').show();
} else {
$('.coupon_verify_information').addClass('d-none');
$('.cfw-promo-row').show();
$('.cart-coupon-discount').show();
}
$('#counpon_discount_total').html(data.coupon_discount);
$('#coupon_discount_value').val(data.coupon_discount_value);
const new_total = parseFloat($('#cart_total_value').val() - data.coupon_discount_value).toFixed(2);
$('#cart_total_value').val(new_total);
$('#cart_total').html("{{currencySymbol()}}" + new_total);
$('#cart_mobile_total').html("{{currencySymbol()}}" + new_total);
}).fail(function(response) {
unblockUI();
alert('Error: ' + response.responseText);
});
} else {
toastr.error("{{__('defaultTheme.coupon_field_is_required')}}", "{{__('common.error')}}");
}
});
$(document).on('click', '#coupon_delete', function(event) {
event.preventDefault();
blockUI();
let data = {
'_token': "{{ csrf_token() }}",
'action': 'remove_coupon'
}
let base_url = $('#url').val();
let url = base_url + "/shopifymycart/checkout";
$.post(url, data, function(data) {
unblockUI();
$('.coupon_verify_information').addClass('d-none');
$('.cfw-promo-row').show();
$('.cart-coupon-discount').hide();
$('#cfw-promo-code').val('');
const cart_total_value = parseFloat($('#cart_total_value').val()),
coupon_discount_value = parseFloat($('#coupon_discount_value').val()),
new_total = parseFloat(cart_total_value + coupon_discount_value).toFixed(2);
$('#cart_total_value').val(new_total);
$('#cart_total').html("{{currencySymbol()}}" + new_total);
$('#cart_mobile_total').html("{{currencySymbol()}}" + new_total);
$('#counpon_discount_total').html('');
$('#coupon_discount_value').val(0);
}).fail(function(response) {
unblockUI();
alert('Error: ' + response.responseText);
});
});
jQuery(document.body).on("change", '[name="cfw_delivery_method"]', (e) => {
showContent(e.target);
}),
jQuery(window).on("load", () => {
jQuery('[name="cfw_delivery_method"]:checked').trigger("change");
});
function showContent(e) {
const t = jQuery(e);
if (
("pickup" === t.val() ? jQuery(document.body).addClass("cfw-hide-pickup-methods") : jQuery(document.body).removeClass("cfw-hide-pickup-methods"),
"pickup" === t.val())
) {
jQuery("body").addClass("cfw-hide-shipping"),
jQuery("#shipping_title").html('Billing Address'),
jQuery("#cfw-pickup-location-wrap").show().find(":input").prop("disabled", !1),
jQuery("#shipping_dif_from_billing_radio").prop("checked", !0),
jQuery("#billing_same_as_shipping_radio").prop("disabled", !0),
jQuery("#cfw-shipping-same-billing .cfw-radio-reveal-group").css("border", "none"),
jQuery("#cfw-shipping-same-billing .cfw-radio-reveal-group .cfw-radio-reveal-li").css("border", "none"),
jQuery("#cfw-shipping-same-billing .cfw-radio-reveal-title-wrap").hide(),
jQuery(".cfw-shipping-methods-heading").hide(),
jQuery("#cfw-billing-fields-container").css("padding", "0").css("border", "none").css("background", "none"),
jQuery('.cfw-review-pane-shipping-address-label-value').html("{{__('common.billing_address')}}"),
jQuery('.cfw-review-pane-shipping-address-value').html($('#address').val()),
jQuery('li.shipping-method').show(),
jQuery('.cfw-review-pane-shipping-method-value').html("Collect from pickup location - {{single_price(0)}}");
const e = jQuery("li.cfw-shipping-method > a"),
t = e.text();
e.text('Pickup');
} else {
jQuery("body").removeClass("cfw-hide-shipping"),
jQuery("#cfw-customer-info-address.shipping").show(),
jQuery("#shipping_title").html('Shipping Address'),
jQuery("#cfw-pickup-location-wrap").hide().find(":input").prop("disabled", !0),
jQuery("#billing_same_as_shipping_radio").prop("disabled", !1),
jQuery("#cfw-shipping-same-billing .cfw-radio-reveal-group").css("border", ""),
jQuery("#cfw-shipping-same-billing .cfw-radio-reveal-group .cfw-radio-reveal-li").css("border", ""),
jQuery("#cfw-shipping-same-billing .cfw-radio-reveal-title-wrap").show(),
jQuery(".cfw-shipping-methods-heading").show(),
jQuery("#cfw-billing-fields-container").css("padding", "").css("border", "").css("background", "")
jQuery('.cfw-review-pane-shipping-address-label-value').html("{{__('defaultTheme.ship_to')}}"),
jQuery('.cfw-review-pane-shipping-address-value').html($('#address').val());
//jQuery('li.shipping-method').hide();
const e = jQuery("li.cfw-shipping-method > a"),
t = e.data("old_label");
e.text('Shipping');
}
}
// $(document).on('click', '#place_order', function(e){
// event.preventDefault();
// const method_id = $('[name="cfw_payment_method"]:checked').val();
// if($('#checkout').parsley().validate({group: 'cfw-payment-'+method_id})){
// alert('okay');
// } else {
// alert('validation');
// }
// });
$(document).on('change', 'input[type=radio][name=cfw_payment_method]', function() {
let method = $(this).data('name');
//$('#order_payment_method').val($(this).val());
let payment_id = $('#off_payment_id').val();
let gateway_id = $(this).data('id');
let baseUrl = $('#url').val();
let id = $(this).val();
if (method === 'Cash On Delivery') {
var url = baseUrl + '/checkout?gateway_id=' + gateway_id + '&payment_id=' + payment_id + '&step=complete_order';
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="CashOnDelivery" data-url="` + url + `" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
$('#acc_' + id).addClass('d-none');
}
if (method === 'Wallet') {
var url = baseUrl + '/checkout?gateway_id=' + gateway_id + '&payment_id=' + payment_id + '&step=complete_order';
$('#cfw-place-order').html(`<a href="javascript:void(0)" data-url="` + url + `" id="payment_btn_trigger" data-type="Wallet" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
}
if (method === 'Stripe') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="Stripe" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
$('#acc_' + id).addClass('d-none');
} else if (method === 'Bkash') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="Bkash" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
$('#acc_' + id).addClass('d-none');
} else if (method === 'SslCommerz') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="SslCommerz" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
$('#acc_' + id).addClass('d-none');
} else if (method === 'Mercado Pago') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="Mercado Pago" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
} else if (method === 'PayPal') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="PayPal" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
$('#acc_' + id).addClass('d-none');
} else if (method === 'PayStack') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="PayStack" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
$('#acc_' + id).addClass('d-none');
} else if (method === 'RazorPay') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="RazorPay" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
$('#acc_' + id).addClass('d-none');
} else if (method === 'Instamojo') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="Instamojo" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
} else if (method === 'PayTM') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="PayTM" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
} else if (method === 'Midtrans') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="Midtrans" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
$('#acc_' + id).addClass('d-none');
} else if (method === 'PayUMoney') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="PayUMoney" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
} else if (method === 'JazzCash') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="JazzCash" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
$('#acc_' + id).addClass('d-none');
} else if (method === 'Google Pay') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="Google Pay" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
$('#acc_' + id).addClass('d-none');
} else if (method === 'FlutterWave') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="FlutterWave" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
} else if (method === 'Bank Payment') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="Bank Payment" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
} else if (method === 'Paytender') {
$('#cfw-place-order').html(`<a href="javascript:void(0)" id="payment_btn_trigger" data-type="Paytender" class="cfw-primary-btn cfw-next-tab validate">Place Order</a>`);
$('#acc_' + id).addClass('d-none');
}
});
$(document).on('click', '#payment_btn_trigger', function(event) {
let method = $(this).data('type');
if ("{{isModuleActive('GoldPrice')}}" == 1) {
$('#pre-loader').show();
$.post("{{route('frontend.checkout.check-cart-price-update')}}", {
_token: "{{csrf_token()}}"
}, function(response) {
if (response.count > 0) {
toastr.info('Cart Price Updated. Try again with updated price', 'Info');
location.reload();
} else {
paymentAction(method);
}
$('#pre-loader').hide();
});
} else {
paymentAction(method);
}
});
function paymentAction(method) {
if (method == 'CashOnDelivery' || method == 'Wallet') {
var dataUrl = $('#payment_btn_trigger').data('url');
location.href = dataUrl;
} else if (method == 'Stripe') {
$('#stribe_submit_btn').click();
$('#pre-loader').show();
} else if (method == 'PayPal') {
$('.paypal_btn').click();
} else if (method == 'PayStack') {
$('#paystack_btn').click();
} else if (method == 'RazorPay') {
$('#razorpay_btn').click();
} else if (method == 'Instamojo') {
$("#instamojo_btn").click();
} else if (method == 'PayTM') {
$("#paytm_btn").click();
} else if (method == 'Midtrans') {
$("#midtrans_btn").click();
} else if (method == 'PayUMoney') {
$("#payumoney_btn").click();
} else if (method == 'JazzCash') {
$("#jazzcash_btn").click();
} else if (method == 'Google Pay') {
$("#buyButton").click();
} else if (method == 'FlutterWave') {
if ($('#checkout').parsley().validate({
group: 'cfw-payment-' + method
})) {
$("#flutterwave_btn").click();
}
} else if (method == 'Bank Payment') {
$("#bank_btn").click();
} else if (method == 'Bkash') {
$("#bKash_button").click();
} else if (method == 'SslCommerz') {
$("#ssl_commerz_form").submit();
} else if (method == 'Mercado Pago') {
mercado_field_validate();
$("#form-checkout__submit").click();
} else if (method == 'Paytender') {
$('.paytender_btn').click();
}
}
function mercado_field_validate() {
let cardholderName = $('#form-checkout__cardholderName').val();
let cardholderEmail = $('#form-checkout__cardholderEmail').val();
let cardNumber = $('#form-checkout__cardNumber').val();
let cardExpirationDate = $('#form-checkout__cardExpirationDate').val();
let securityCode = $('#form-checkout__securityCode').val();
let installments = $('#form-checkout__installments').val();
let identificationType = $('#form-checkout__identificationType').val();
let identificationNumber = $('#form-checkout__identificationNumber').val();
let issuer = $('#form-checkout__issuer').val();
if (cardholderName == null) {
toastr.error('Cardholder name required');
return false;
}
if (cardholderEmail == null) {
toastr.error('Email required');
return false;
}
if (cardNumber == null) {
toastr.error('CardNumber required');
return false;
}
if (cardExpirationDate == null) {
toastr.error('Card Expiration Date required');
return false;
}
if (securityCode == null) {
toastr.error('Security Code required');
return false;
}
if (installments == null) {
toastr.error('Installments required');
return false;
}
if (identificationType == null) {
toastr.error('Identification Type required');
return false;
}
if (identificationNumber == null) {
toastr.error('Identification Number required');
return false;
}
if (issuer == null) {
toastr.error('issuer required');
return false;
}
}
const _targetSelector = ".cfw-radio-reveal-group";
jQuery(document.body).on("change", `${_targetSelector} .cfw-radio-reveal-title-wrap :radio`, (e) => {
showPaymentContent(e.target);
}),
jQuery("#cfw-mobile-cart-header").on("click", (e) => {
e.preventDefault(), jQuery("#cfw-cart-summary-content").slideToggle(300), jQuery("#cfw-expand-cart").toggleClass("active");
}),
jQuery(document.body).on("updated_checkout", () => {
jQuery(_targetSelector).each((e, t) => {
showPaymentContent(jQuery(t).find(" .cfw-radio-reveal-title-wrap :radio:checked").first());
});
});
function showPaymentContent(e) {
const t = jQuery(e),
d = t.parents(".cfw-radio-reveal-li").first();
t.is(":checked") ?
(d.siblings(".cfw-radio-reveal-li").removeClass("cfw-active"),
d.addClass("cfw-active"),
d.siblings(".cfw-radio-reveal-li").find(".cfw-radio-reveal-content:visible").slideUp(300),
d.find(".cfw-radio-reveal-content:hidden").slideDown(300)) :
d.removeClass("cfw-active");
}
const blockUISelector = ".cfw-review-pane, #cfw-cart-summary, #cfw-place-order, #cfw-mobile-total, .cfw-order-bumps, .coupon_verify_information"
function blockUI() {
jQuery(blockUISelector)
.not(".cfw-blocked")
.block({
message: null,
overlayCSS: {
background: "#fff",
opacity: 0
}
})
.addClass("cfw-blocked");
}
function unblockUI() {
jQuery(blockUISelector).unblock().removeClass("cfw-blocked");
}
});
</script>
@endpush