After merge

This commit is contained in:
prashant-webkul 2018-10-15 17:21:03 +05:30
commit 2f427d1550
57 changed files with 1010 additions and 249 deletions

View File

@ -122,23 +122,23 @@ class CustomerDataGrid
'type' => 'string',
'label' => 'Name',
],
[
'name' => 'email',
'alias' => 'customerEmail',
'type' => 'string',
'label' => 'Email',
],
[
'name' => 'phone',
'alias' => 'customerPhone',
'type' => 'number',
'label' => 'Phone',
],
[
'name' => 'email',
'alias' => 'customerEmail',
'type' => 'string',
'label' => 'Comment',
],
[
'name' => 'customer_group_id',
'alias' => 'customerGroupId',
'type' => 'number',
'label' => 'Status',
'type' => 'string',
'label' => 'Customer Group',
],
],

View File

@ -100,7 +100,7 @@ class CustomerReviewDataGrid
],
[
'name' => 'status',
'alias' => 'countryStatus',
'alias' => 'reviewStatus',
'type' => 'number',
'label' => 'Status',
'sortable' => true,
@ -113,7 +113,7 @@ class CustomerReviewDataGrid
'filterable' => [
[
'name' => 'id',
'alias' => 'countryId',
'alias' => 'reviewId',
'type' => 'number',
'label' => 'ID',
],
@ -137,9 +137,9 @@ class CustomerReviewDataGrid
],
[
'name' => 'status',
'alias' => 'countryStatus',
'type' => 'number',
'label' => 'Code',
'alias' => 'reviewStatus',
'type' => 'string',
'label' => 'Status',
],
],

View File

@ -67,4 +67,21 @@ class OrderController extends Controller
return view($this->_config['view'], compact('order'));
}
}
/**
* Cancel action for the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function cancel($id)
{
if($this->order->cancel($id)) {
session()->flash('success', trans('Order canceled successfully.'));
} else {
session()->flash('error', trans('Order can not be canceled.'));
}
return redirect()->back();
}
}

View File

@ -49,10 +49,6 @@ Route::group(['middleware' => ['web']], function () {
'view' => 'admin::customers.orders.index'
])->name('admin.customer.orders.index');
Route::get('customer/reviews', 'Webkul\Product\Http\Controllers\ReviewController@index')->defaults('_config',[
'view' => 'admin::customers.review.index'
])->name('admin.customer.review.index');
Route::get('customer/create', 'Webkul\Core\Http\Controllers\CustomerController@create')->defaults('_config',[
'view' => 'admin::customers.create'
])->name('admin.customer.create');
@ -61,14 +57,6 @@ Route::group(['middleware' => ['web']], function () {
'redirect' => 'admin.customer.index'
])->name('admin.customer.store');
Route::get('customer/reviews/edit/{id}', 'Webkul\Product\Http\Controllers\ReviewController@edit')->defaults('_config',[
'view' => 'admin::customers.review.edit'
])->name('admin.customer.review.edit');
Route::put('customer/reviews/edit/{id}', 'Webkul\Product\Http\Controllers\ReviewController@update')->defaults('_config', [
'redirect' => 'admin.customer.review.index'
])->name('admin.customer.review.update');
Route::get('customer/edit/{id}', 'Webkul\Core\Http\Controllers\CustomerController@edit')->defaults('_config',[
'view' => 'admin::customers.edit'
])->name('admin.customer.edit');
@ -77,6 +65,18 @@ Route::group(['middleware' => ['web']], function () {
'redirect' => 'admin.customer.index'
])->name('admin.customer.update');
Route::get('reviews', 'Webkul\Product\Http\Controllers\ReviewController@index')->defaults('_config',[
'view' => 'admin::customers.review.index'
])->name('admin.customer.review.index');
Route::get('reviews/edit/{id}', 'Webkul\Product\Http\Controllers\ReviewController@edit')->defaults('_config',[
'view' => 'admin::customers.review.edit'
])->name('admin.customer.review.edit');
Route::put('reviews/edit/{id}', 'Webkul\Product\Http\Controllers\ReviewController@update')->defaults('_config', [
'redirect' => 'admin.customer.review.index'
])->name('admin.customer.review.update');
// Sales Routes
Route::prefix('sales')->group(function () {
// Sales Order Routes
@ -88,6 +88,10 @@ Route::group(['middleware' => ['web']], function () {
'view' => 'admin::sales.orders.view'
])->name('admin.sales.orders.view');
Route::get('/orders/cancel/{order_id}', 'Webkul\Admin\Http\Controllers\Sales\OrderController@cancel')->defaults('_config', [
'view' => 'admin::sales.orders.cancel'
])->name('admin.sales.orders.cancel');
// Sales Invoices Routes
Route::get('/invoices', 'Webkul\Admin\Http\Controllers\Sales\InvoiceController@index')->defaults('_config', [

View File

@ -586,6 +586,17 @@ body {
}
}
.table {
.qty-row {
display: block;
margin-bottom: 5px;
&:last-child {
margin-bottom: 0;
}
}
}
.sale-summary {
margin-top: 2%;
height: 130px;
@ -594,11 +605,18 @@ body {
tr {
td {
padding: 3px 8px;
padding: 5px 8px;
}
&.bold {
font-weight: 600;
font-size: 15px;
}
&.border {
td {
border-bottom: 1px solid $border-color;
}
}
}
}

View File

@ -73,6 +73,7 @@ return [
'orders' => [
'title' => 'Orders',
'view-title' => 'Order #:order_id',
'cancel-btn-title' => 'Cancel',
'shipment-btn-title' => 'Ship',
'invoice-btn-title' => 'Invoice',
'info' => 'Information',
@ -102,6 +103,9 @@ return [
'product-name' => 'Product Name',
'qty' => 'Qty',
'item-status' => 'Item Status',
'item-invoice' => 'Invoiced (:qty_invoiced)',
'item-shipped' => 'shipped (:qty_shipped)',
'item-canceled' => 'Canceled (:qty_canceled)',
'price' => 'Price',
'total' => 'Total',
'subtotal' => 'Subtotal',
@ -110,7 +114,11 @@ return [
'tax-percent' => 'Tax Percent',
'tax-amount' => 'Tax Amount',
'discount-amount' => 'Discount Amount',
'grand-total' => 'Grand Total'
'grand-total' => 'Grand Total',
'total-paid' => 'Total Paid',
'total-refunded' => 'Total Refunded',
'total-due' => 'Total Due',
'cancel-confirm-msg' => 'Are you sure you want to cancel this order ?'
],
'invoices' => [
'id' => 'Id',
@ -397,7 +405,8 @@ return [
'email' => 'Email',
'date_of_birth' => 'Date of Birth',
'phone' => 'Phone',
'customer_group' => 'Customer Group'
'customer_group' => 'Customer Group',
'save-btn-title' => 'Save Customer'
],
'reviews' => [
'title' => 'Title',

View File

@ -2,10 +2,24 @@
<?php $selectedOption = old($attribute->code) ?: $product[$attribute->code] ?>
@foreach($attribute->options as $option)
<option value="{{ $option->id }}" {{ $option->id == $selectedOption ? 'selected' : ''}}>
{{ $option->admin_name }}
</option>
@endforeach
@if($attribute->code != 'tax_category_id')
@foreach($attribute->options as $option)
<option value="{{ $option->id }}" {{ $option->id == $selectedOption ? 'selected' : ''}}>
{{ $option->admin_name }}
</option>
@endforeach
@else
<option value=""></option>
@foreach(app('Webkul\Tax\Repositories\TaxCategoryRepository')->all() as $taxCategory)
<option value="{{ $taxCategory->id }}" {{ $taxCategory->id == $selectedOption ? 'selected' : ''}}>
{{ $taxCategory->name }}
</option>
@endforeach
@endif
</select>

View File

@ -15,7 +15,7 @@
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.account.save-btn-title') }}
{{ __('admin::app.customers.customers.save-btn-title') }}
</button>
</div>
</div>
@ -25,56 +25,52 @@
<div class="form-container">
@csrf()
<accordian :title="'{{ __('admin::app.account.general') }}'" :active="true">
<div slot="body">
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
<label for="first_name" class="required">{{ __('shop::app.customer.signup-form.firstname') }}</label>
<input type="text" class="control" name="first_name" v-validate="'required'" value="{{ old('first_name') }}">
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
</div>
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
<label for="first_name">{{ __('shop::app.customer.signup-form.firstname') }}</label>
<input type="text" class="control" name="first_name" v-validate="'required'" value="{{ old('first_name') }}">
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
</div>
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
<label for="last_name" class="required">{{ __('shop::app.customer.signup-form.lastname') }}</label>
<input type="text" class="control" name="last_name" v-validate="'required'" value="{{ old('last_name') }}">
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
</div>
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
<label for="last_name">{{ __('shop::app.customer.signup-form.lastname') }}</label>
<input type="text" class="control" name="last_name" v-validate="'required'" value="{{ old('last_name') }}">
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
</div>
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
<label for="email" class="required">{{ __('shop::app.customer.signup-form.email') }}</label>
<input type="email" class="control" name="email" v-validate="'required|email'" value="{{ old('email') }}">
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
<label for="email">{{ __('shop::app.customer.signup-form.email') }}</label>
<input type="email" class="control" name="email" v-validate="'required|email'" value="{{ old('email') }}">
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>
<div class="control-group" :class="[errors.has('gender') ? 'has-error' : '']">
<label for="gender" class="required">{{ __('admin::app.customers.customers.gender') }}</label>
<select name="gender" class="control" v-validate="'gender'">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
<span class="control-error" v-if="errors.has('gender')">@{{ errors.first('gender') }}</span>
</div>
<div class="control-group">
<label for="gender">{{ __('admin::app.customers.customers.gender') }}</label>
<select name="gender" class="control" v-validate="'required'">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</div>
<div class="control-group">
<label for="dob">{{ __('admin::app.customers.customers.date_of_birth') }}</label>
<input type="date" class="control" name="date_of_birth">
</div>
<div class="control-group">
<label for="dob">{{ __('admin::app.customers.customers.date_of_birth') }}</label>
<input type="date" class="control" name="date_of_birth" v-validate="'required'">
</div>
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone">{{ __('admin::app.customers.customers.phone') }}</label>
<input type="text" class="control" v-validate="'numeric'" name="phone" value="{{ old('phone') }}">
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
</div>
<div class="control-group">
<label for="phone">{{ __('admin::app.customers.customers.phone') }}</label>
<input type="text" class="control" name="phone" v-validate="'required'">
</div>
<div class="control-group">
<label for="name" >{{ __('admin::app.customers.customers.customer_group') }}</label>
<select class="control" name="customer_group_id">
@foreach ($customerGroup as $group)
<option value="{{ $group->id }}"> {{ $group->group_name}} </>
@endforeach
</select>
</div>
</div>
</accordian>
<div class="control-group">
<label for="name" >{{ __('admin::app.customers.customers.customer_group') }}</label>
<select class="control" name="customer_group_id">
@foreach ($customerGroup as $group)
<option value="{{ $group->id }}"> {{ $group->group_name}} </>
@endforeach
</select>
</div>
</div>
</div>

View File

@ -13,7 +13,7 @@
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.account.save-btn-title') }}
{{ __('admin::app.customers.customers.save-btn-title') }}
</button>
</div>
</div>
@ -28,37 +28,42 @@
<accordian :title="'{{ __('admin::app.account.general') }}'" :active="true">
<div slot="body">
<div class="control-group">
<label for="name" > {{ __('admin::app.customers.customers.first_name') }}</label>
<input type="text" class="control" name="first_name" value="{{$customer->first_name}}"/>
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
<label for="first_name" class="required"> {{ __('admin::app.customers.customers.first_name') }}</label>
<input type="text" class="control" name="first_name" v-validate="'required'" value="{{$customer->first_name}}"/>
<span class="control-error" v-if="errors.has('first_name')">@{{ errors.first('first_name') }}</span>
</div>
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
<label for="last_name" class="required"> {{ __('admin::app.customers.customers.last_name') }}</label>
<input type="text" class="control" name="last_name" v-validate="'required'" value="{{$customer->last_name}}"/>
<span class="control-error" v-if="errors.has('last_name')">@{{ errors.first('last_name') }}</span>
</div>
<div class="control-group" :class="[errors.has('email') ? 'has-error' : '']">
<label for="email" class="required"> {{ __('admin::app.customers.customers.email') }}</label>
<input type="email" class="control" name="email" v-validate="'required|email'" value="{{$customer->email}}"/>
<span class="control-error" v-if="errors.has('email')">@{{ errors.first('email') }}</span>
</div>
<div class="control-group">
<label for="name" > {{ __('admin::app.customers.customers.last_name') }}</label>
<input type="text" class="control" name="last_name" value="{{$customer->last_name}}"/>
</div>
<div class="control-group">
<label for="name" > {{ __('admin::app.customers.customers.email') }}</label>
<input type="text" class="control" name="email" value="{{$customer->email}}"/>
</div>
<div class="control-group">
<label for="email">{{ __('admin::app.customers.customers.gender') }}</label>
<select name="gender" class="control" value="{{ $customer->gender }}" v-validate="'required'">
<label for="email" class="required">{{ __('admin::app.customers.customers.gender') }}</label>
<select name="gender" class="control" v-validate="'gender'" value="{{ $customer->gender }}" v-validate="'required'">
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
<span class="control-error" v-if="errors.has('gender')">@{{ errors.first('gender') }}</span>
</div>
<div class="control-group">
<label for="dob">{{ __('admin::app.customers.customers.date_of_birth') }}</label>
<input type="date" class="control" name="date_of_birth" value="{{ $customer->date_of_birth }}" v-validate="'required'">
<input type="date" class="control" name="date_of_birth" value="{{ $customer->date_of_birth }}">
</div>
<div class="control-group">
<div class="control-group" :class="[errors.has('phone') ? 'has-error' : '']">
<label for="phone">{{ __('admin::app.customers.customers.phone') }}</label>
<input type="text" class="control" name="phone" value="{{ $customer->phone }}" v-validate="'required'">
<input type="text" class="control" v-validate="'numeric'" name="phone" value="{{ $customer->phone }}">
<span class="control-error" v-if="errors.has('phone')">@{{ errors.first('phone') }}</span>
</div>
<div class="control-group">

View File

@ -43,7 +43,7 @@
</div>
<div class="control-group">
<label for="name" >{{ __('admin::app.customers.reviews.status') }}</label>
<label for="name" class="required">{{ __('admin::app.customers.reviews.status') }}</label>
<select class="control" name="status">
<option value="pending" {{ $review->status == "pending" ? 'selected' : ''}}>
pending

View File

@ -15,6 +15,12 @@
</div>
<div class="page-action">
@if($order->canCancel())
<a href="{{ route('admin.sales.orders.cancel', $order->id) }}" class="btn btn-lg btn-primary" v-alert:message="'{{ __('admin::app.sales.orders.cancel-confirm-msg') }}'">
{{ __('admin::app.sales.orders.cancel-btn-title') }}
</a>
@endif
@if($order->canInvoice())
<a href="{{ route('admin.sales.invoices.create', $order->id) }}" class="btn btn-lg btn-primary">
{{ __('admin::app.sales.orders.invoice-btn-title') }}
@ -229,7 +235,19 @@
<td>{{ $item->name }}</td>
<td>{{ core()->formatBasePrice($item->base_price) }}</td>
<td>{{ $item->qty_ordered }}</td>
<td>Packed (2)</td>
<td>
<span class="qty-row">
{{ $item->qty_invoiced ? __('admin::app.sales.orders.item-invoice', ['qty_invoiced' => $item->qty_invoiced]) : '' }}
</span>
<span class="qty-row">
{{ $item->qty_shipped ? __('admin::app.sales.orders.item-shipped', ['qty_shipped' => $item->qty_shipped]) : '' }}
</span>
<span class="qty-row">
{{ $item->qty_canceled ? __('admin::app.sales.orders.item-canceled', ['qty_canceled' => $item->qty_canceled]) : '' }}
</span>
</td>
<td>{{ core()->formatBasePrice($item->base_total) }}</td>
<td>{{ $item->tax_percent }}%</td>
<td>{{ core()->formatBasePrice($item->base_tax_amount) }}</td>
@ -252,7 +270,7 @@
<td>{{ core()->formatBasePrice($order->base_shipping_amount) }}</td>
</tr>
<tr>
<tr class="border">
<td>{{ __('admin::app.sales.orders.tax') }}</td>
<td>-</td>
<td>{{ core()->formatBasePrice($order->base_tax_amount) }}</td>
@ -263,6 +281,24 @@
<td>-</td>
<td>{{ core()->formatBasePrice($order->base_grand_total) }}</td>
</tr>
<tr class="bold">
<td>{{ __('admin::app.sales.orders.total-paid') }}</td>
<td>-</td>
<td>{{ core()->formatBasePrice($order->base_grand_total_invoiced) }}</td>
</tr>
<tr class="bold">
<td>{{ __('admin::app.sales.orders.total-refunded') }}</td>
<td>-</td>
<td>{{ core()->formatBasePrice($order->base_grand_total_refunded) }}</td>
</tr>
<tr class="bold">
<td>{{ __('admin::app.sales.orders.total-due') }}</td>
<td>-</td>
<td>{{ core()->formatBasePrice($order->base_total_due) }}</td>
</tr>
</table>
</div>

View File

@ -69,7 +69,7 @@
<div class="control-group" :class="[errors.has('taxrates') ? 'has-error' : '']">
<label for="taxrates" class="required">{{ __('admin::app.configuration.tax-categories.select-taxrates') }}</label>
@inject('taxRates', 'Webkul\Core\Repositories\TaxRatesRepository')
@inject('taxRates', 'Webkul\Tax\Repositories\TaxRateRepository')
<select multiple="multiple" class="control" id="taxrates" name="taxrates[]" v-validate="'required'">
@foreach($taxRates->all() as $taxRate)

View File

@ -61,7 +61,7 @@ class AttributeTableSeeder extends Seeder
'en' => [
'name' => 'Tax Category'
],
'type' => 'text',
'type' => 'select',
'position' => 4,
'is_unique' => 0,
'is_required' => 0,

View File

@ -10,7 +10,7 @@ class Attribute extends TranslatableModel
{
public $translatedAttributes = ['name'];
protected $fillable = ['code', 'admin_name', 'type', 'position', 'is_required', 'is_unique', 'value_per_locale', 'value_per_channel', 'is_filterable', 'is_configurable', 'is_visible_on_front'];
protected $fillable = ['code', 'admin_name', 'type', 'position', 'is_required', 'is_unique', 'value_per_locale', 'value_per_channel', 'is_filterable', 'is_configurable', 'is_visible_on_front', 'is_user_defined'];
protected $with = ['options'];

View File

@ -8,6 +8,7 @@ use Webkul\Checkout\Repositories\CartItemRepository;
use Webkul\Checkout\Repositories\CartAddressRepository;
use Webkul\Customer\Repositories\CustomerRepository;
use Webkul\Product\Repositories\ProductRepository;
use Webkul\Tax\Repositories\TaxCategoryRepository;
use Webkul\Checkout\Models\CartPayment;
/**
@ -54,6 +55,13 @@ class Cart {
*/
protected $product;
/**
* TaxCategoryRepository model
*
* @var mixed
*/
protected $taxCategory;
/**
* Create a new controller instance.
*
@ -62,6 +70,7 @@ class Cart {
* @param Webkul\Checkout\Repositories\CartAddressRepository $cartAddress
* @param Webkul\Customer\Repositories\CustomerRepository $customer
* @param Webkul\Product\Repositories\ProductRepository $product
* @param Webkul\Product\Repositories\TaxCategoryRepository $taxCategory
* @return void
*/
public function __construct(
@ -69,7 +78,9 @@ class Cart {
CartItemRepository $cartItem,
CartAddressRepository $cartAddress,
CustomerRepository $customer,
ProductRepository $product)
ProductRepository $product,
TaxCategoryRepository $taxCategory
)
{
$this->customer = $customer;
@ -80,6 +91,8 @@ class Cart {
$this->cartAddress = $cartAddress;
$this->product = $product;
$this->taxCategory = $taxCategory;
}
/**
@ -564,7 +577,11 @@ class Cart {
$cart = null;
if(auth()->guard('customer')->check()) {
$cart = $this->cart->findOneByField('customer_id', auth()->guard('customer')->user()->id);
$cart = $this->cart->findOneWhere([
'customer_id' => auth()->guard('customer')->user()->id,
'is_active' => 1
]);
} elseif(session()->has('cart')) {
$cart = $this->cart->find(session()->get('cart')->id);
}
@ -659,6 +676,8 @@ class Cart {
}
}
// If customer is guest, than save shipping address's email and name in cart as customer details
return true;
}
@ -718,20 +737,15 @@ class Cart {
if(!$cart = $this->getCart())
return false;
$this->calulateItemsTax();
$this->calculateItemsTax();
$cart->grand_total = 0;
$cart->base_grand_total = 0;
$cart->sub_total = 0;
$cart->base_sub_total = 0;
$cart->tax_total = 0;
$cart->base_tax_total = 0;
$cart->grand_total = $cart->base_grand_total = 0;
$cart->sub_total = $cart->base_sub_total = 0;
$cart->tax_total = $cart->base_tax_total = 0;
foreach ($cart->items()->get() as $item) {
$cart->grand_total = (float) $cart->grand_total + $item->total;
$cart->base_grand_total = (float) $cart->base_grand_total + $item->base_total;
$cart->grand_total = (float) $cart->grand_total + $item->total + $item->tax_amount;
$cart->base_grand_total = (float) $cart->base_grand_total + $item->base_total + $item->base_tax_amount;
$cart->sub_total = (float) $cart->sub_total + $item->total;
$cart->base_sub_total = (float) $cart->base_sub_total + $item->base_total;
@ -762,12 +776,46 @@ class Cart {
*
* @return void
*/
public function calulateItemsTax()
public function calculateItemsTax()
{
$cart = $this->getCart();
if(!$shippingAddress = $cart->shipping_address)
return;
foreach ($cart->items()->get() as $item) {
$product = $item->product;
$taxCategory = $this->taxCategory->find($item->product->tax_category_id);
if(!$taxCategory)
continue;
$taxRates = $taxCategory->tax_rates()->where([
'state' => $shippingAddress->state,
'country' => $shippingAddress->country,
])->orderBy('tax_rate', 'desc')->get();
foreach($taxRates as $rate) {
$haveTaxRate = false;
if(!$rate->is_zip) {
if($rate->zip_code == '*' || $rate->zip_code == $shippingAddress->postcode) {
$haveTaxRate = true;
}
} else {
if($shippingAddress->postcode >= $rate->zip_code && $shippingAddress->postcode <= $rate->zip_code) {
$haveTaxRate = true;
}
}
if($haveTaxRate) {
$item->tax_percent = $rate->tax_rate;
$item->tax_amount = ($item->total * $rate->tax_rate) / 100;
$item->base_tax_amount = ($item->base_total * $rate->tax_rate) / 100;
$item->save();
break;
}
}
}
}
@ -848,7 +896,7 @@ class Cart {
'customer_email' => $data['customer_email'],
'customer_first_name' => $data['customer_first_name'],
'customer_last_name' => $data['customer_last_name'],
'customer' => auth()->guard('customer')->check() ? auth()->guard('customer')->user : null,
'customer' => auth()->guard('customer')->check() ? auth()->guard('customer')->user() : null,
'shipping_method' => $data['selected_shipping_rate']['method'],
'shipping_title' => $data['selected_shipping_rate']['carrier_title'] . ' - ' . $data['selected_shipping_rate']['method_title'],

View File

@ -46,6 +46,42 @@ abstract class Repository extends BaseRepository {
return $model->first();
}
/**
* Find data by id
*
* @param $id
* @param array $columns
*
* @return mixed
*/
public function find($id, $columns = ['*'])
{
$this->applyCriteria();
$this->applyScope();
$model = $this->model->find($id, $columns);
$this->resetModel();
return $this->parserResult($model);
}
/**
* Find data by id
*
* @param $id
* @param array $columns
*
* @return mixed
*/
public function findOrFail($id, $columns = ['*'])
{
$this->applyCriteria();
$this->applyScope();
$model = $this->model->findOrFail($id, $columns);
$this->resetModel();
return $this->parserResult($model);
}
/**
* @return mixed
*/

View File

@ -84,11 +84,11 @@ class CustomerController extends Controller
public function store(Request $request)
{
$request->validate([
'first_name' => 'string|required',
'last_name' => 'string|required',
'email' => 'email|required',
'gender' => 'required',
'phone' => 'nullable|numeric',
'email' => 'required|unique:customers,email'
]);
$data=$request->all();
@ -102,7 +102,6 @@ class CustomerController extends Controller
session()->flash('success', 'Customer created successfully.');
return redirect()->route($this->_config['redirect']);
}
/**
@ -129,6 +128,13 @@ class CustomerController extends Controller
*/
public function update(Request $request, $id)
{
$request->validate([
'first_name' => 'string|required',
'last_name' => 'string|required',
'gender' => 'required',
'phone' => 'nullable|numeric',
'email' => 'required|unique:customers,email,'. $id
]);
$this->customer->update(request()->all(),$id);
@ -136,6 +142,4 @@ class CustomerController extends Controller
return redirect()->route($this->_config['redirect']);
}
}

View File

@ -5,6 +5,7 @@ namespace Webkul\Customer\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Customer\Repositories\CustomerRepository;
use Webkul\Sales\Repositories\OrderRepository;
use Auth;
/**
@ -25,26 +26,18 @@ class OrdersController extends Controller
*/
protected $_config;
protected $customer;
protected $order;
public function __construct(CustomerRepository $customer)
public function __construct(CustomerRepository $customer ,OrderRepository $order)
{
$this->middleware('customer');
$this->_config = request('_config');
$this->customer = $customer;
}
/**
* For taking the customer
* to the dashboard after
* authentication
* @return view
*/
private function getCustomer($id) {
$customer = collect($this->customer->findOneWhere(['id'=>$id]));
return $customer;
$this->order = $order;
}
public function index() {
@ -56,6 +49,13 @@ class OrdersController extends Controller
}
public function orders() {
return view($this->_config['view']);
$id = auth()->guard('customer')->user()->id;
$orders = $this->order->customerOrder($id);
return view($this->_config['view'],compact('orders'));
}
}

View File

@ -5,6 +5,7 @@ namespace Webkul\Customer\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Webkul\Customer\Models\CustomersGroups;
use Webkul\Sales\Models\Order;
// use Webkul\User\Notifications\AdminResetPassword;
@ -37,6 +38,4 @@ class Customer extends Authenticatable
{
return $this->belongsTo(CustomersGroups::class);
}
}

View File

@ -159,9 +159,9 @@ class ProductRepository extends Repository
$attributes = $product->attribute_family->custom_attributes;
foreach ($attributes as $attribute) {
if(!isset($data[$attribute->code]) || !$data[$attribute->code])
if(!isset($data[$attribute->code]) || ($attribute->code == 'boolean' && !$data[$attribute->code]))
continue;
$attributeValue = $this->attributeValue->findOneWhere([
'product_id' => $product->id,
'attribute_id' => $attribute->id,

View File

@ -26,6 +26,7 @@ class CreateOrderItemsTable extends Migration
$table->integer('qty_ordered')->default(0)->nullable();
$table->integer('qty_shipped')->default(0)->nullable();
$table->integer('qty_invoiced')->default(0)->nullable();
$table->integer('qty_canceled')->default(0)->nullable();
$table->integer('qty_refunded')->default(0)->nullable();
$table->decimal('price', 12,4)->default(0);

View File

@ -7,11 +7,12 @@ use Webkul\Sales\Contracts\Order as OrderContract;
class Order extends Model implements OrderContract
{
protected $guarded = ['id', 'items', 'shipping_address', 'billing_address', 'channel', 'payment', 'created_at', 'updated_at'];
protected $guarded = ['id', 'items', 'shipping_address', 'billing_address', 'customer', 'channel', 'payment', 'created_at', 'updated_at'];
protected $statusLabel = [
'pending' => 'Pending',
'processing' => 'Processing',
'completed' => 'Completed',
'canceled' => 'Canceled',
'closed' => 'Closed',
];
@ -31,6 +32,22 @@ class Order extends Model implements OrderContract
return $this->statusLabel[$this->status];
}
/**
* Return base total due amount
*/
public function getBaseTotalDueAttribute()
{
return $this->base_grand_total - $this->base_grand_total_invoiced;
}
/**
* Return total due amount
*/
public function getTotalDueAttribute()
{
return $this->grand_total - $this->base_total_invoiced;
}
/**
* Get the order items record associated with the order.
*/
@ -143,4 +160,18 @@ class Order extends Model implements OrderContract
return false;
}
/**
* Checks if order could can canceled on not
*/
public function canCancel()
{
foreach($this->items as $item) {
if ($item->qty_to_cancel > 0) {
return true;
}
}
return false;
}
}

View File

@ -4,7 +4,6 @@ namespace Webkul\Sales\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Sales\Contracts\OrderAddress as OrderAddressContract;
use Webkul\Customer\Models\Customer;
class OrderAddress extends Model implements OrderAddressContract
{
@ -19,7 +18,7 @@ class OrderAddress extends Model implements OrderAddressContract
{
return $this->first_name . ' ' . $this->last_name;
}
/**
* Get the customer record associated with the order.
*/

View File

@ -13,14 +13,21 @@ class OrderItem extends Model implements OrderItemContract
* Get remaining qty for shipping.
*/
public function getQtyToShipAttribute() {
return $this->qty_ordered - $this->qty_shipped - $this->qty_refunded;
return $this->qty_ordered - $this->qty_shipped - $this->qty_refunded - $this->qty_canceled;
}
/**
* Get remaining qty for invoice.
*/
public function getQtyToInvoiceAttribute() {
return $this->qty_ordered - $this->qty_invoiced - $this->qty_refunded;
return $this->qty_ordered - $this->qty_invoiced - $this->qty_canceled;
}
/**
* Get remaining qty for cancel.
*/
public function getQtyToCancelAttribute() {
return $this->qty_ordered - $this->qty_canceled - $this->qty_invoiced;
}
/**

View File

@ -138,8 +138,8 @@ class InvoiceRepository extends Repository
'base_price' => $childOrderItem->base_price,
'total' => $childOrderItem->price * $qty,
'base_total' => $childOrderItem->base_price * $qty,
'tax_amount' => ( ($childOrderItem->tax_amount / $childOrderItem->qty_ordered) * $qty ),
'base_tax_amount' => ( ($childOrderItem->base_tax_amount / $childOrderItem->qty_ordered) * $qty ),
'tax_amount' => 0,
'base_tax_amount' => 0,
'product_id' => $childOrderItem->product_id,
'product_type' => $childOrderItem->product_type,
'additional' => $childOrderItem->additional,
@ -153,7 +153,7 @@ class InvoiceRepository extends Repository
$this->order->collectTotals($order);
$this->order->updateOrderStatus($order->id);
$this->order->updateOrderStatus($order);
} catch (\Exception $e) {
DB::rollBack();

View File

@ -71,7 +71,7 @@ class OrderRepository extends Repository
public function create(array $data)
{
DB::beginTransaction();
try {
Event::fire('checkout.order.save.before', $data);
@ -97,7 +97,7 @@ class OrderRepository extends Repository
$order->payment()->create($data['payment']);
$order->addresses()->create($data['shipping_address']);
$order->addresses()->create($data['billing_address']);
foreach($data['items'] as $item) {
@ -114,7 +114,7 @@ class OrderRepository extends Repository
throw $e;
}
DB::commit();
Event::fire('checkout.order.save.after', $order);
@ -122,6 +122,30 @@ class OrderRepository extends Repository
return $order;
}
/**
* @param int $orderId
* @return mixed
*/
public function cancel($orderId)
{
$order = $this->findOrFail($orderId);
if(!$order->canCancel())
return false;
foreach($order->items as $item) {
if($item->qty_to_cancel) {
$item->qty_canceled += $item->qty_to_cancel;
$item->save();
}
}
$this->updateOrderStatus($order);
return true;
}
/**
* @inheritDoc
*/
@ -135,12 +159,94 @@ class OrderRepository extends Repository
}
/**
* @param int $orderId
* @param mixed $order
* @return void
*/
public function updateOrderStatus(int $orderId)
public function isInCompletedState($order)
{
$order = $this->find($orderId);
$totalQtyOrdered = 0;
$totalQtyInvoiced = 0;
$totalQtyShipped = 0;
$totalQtyRefunded = 0;
$totalQtyCanceled = 0;
foreach($order->items as $item) {
$totalQtyOrdered += $item->qty_ordered;
$totalQtyInvoiced += $item->qty_invoiced;
$totalQtyShipped += $item->qty_shipped;
$totalQtyRefunded += $item->qty_refunded;
$totalQtyCanceled += $item->qty_canceled;
}
if($totalQtyOrdered != ($totalQtyRefunded + $totalQtyCanceled) &&
$totalQtyOrdered == $totalQtyInvoiced + $totalQtyRefunded + $totalQtyCanceled &&
$totalQtyOrdered == $totalQtyShipped + $totalQtyRefunded + $totalQtyCanceled)
return true;
return false;
}
/**
* @param mixed $order
* @return void
*/
public function isInCanceledState($order)
{
$totalQtyOrdered = 0;
$totalQtyCanceled = 0;
foreach($order->items as $item) {
$totalQtyOrdered += $item->qty_ordered;
$totalQtyCanceled += $item->qty_canceled;
}
if($totalQtyOrdered == $totalQtyCanceled)
return true;
return false;
}
/**
* @param mixed $order
* @return void
*/
public function isInClosedState($order)
{
$totalQtyOrdered = 0;
$totalQtyRefunded = 0;
$totalQtyCanceled = 0;
foreach($order->items as $item) {
$totalQtyOrdered += $item->qty_ordered;
$totalQtyRefunded += $item->qty_refunded;
$totalQtyCanceled += $item->qty_canceled;
}
if($totalQtyOrdered == $totalQtyRefunded + $totalQtyCanceled)
return true;
return false;
}
/**
* @param mixed $order
* @return void
*/
public function updateOrderStatus($order)
{
$status = 'processing';
if($this->isInCompletedState($order))
$status = 'completed';
if($this->isInCanceledState($order))
$status = 'canceled';
if($this->isInClosedState($order))
$status = 'closed';
$order->status = $status;
$order->save();
}
/**
@ -180,4 +286,13 @@ class OrderRepository extends Repository
return $order;
}
/**
* @param int $customerId
* @return void
*/
public function customerOrder($customerId)
{
return $this->model->where('customer_id',$customerId)->get();
}
}

View File

@ -127,7 +127,7 @@ class ShipmentRepository extends Repository
$this->orderItem->update(['qty_shipped' => $orderItem->qty_shipped + $qty], $orderItem->id);
}
$this->order->updateOrderStatus($order->id);
$this->order->updateOrderStatus($order);
} catch (\Exception $e) {
DB::rollBack();

View File

@ -178,7 +178,7 @@ Route::group(['middleware' => ['web']], function () {
/* Reviews route */
Route::get('reviews', 'Webkul\Customer\Http\Controllers\CustomerController@reviews')->defaults('_config', [
'view' => 'shop::customers.account.reviews.reviews'
'view' => 'shop::customers.account.reviews.index'
])->name('customer.reviews.index');
});
});

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
<title>Expand-Light-On</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Expand-Light-On" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g transform="translate(2.000000, 6.000000)" fill="#8E8E8E" id="Path-2">
<polygon points="0 0 13.3424655 0 6.67123275 7.3125"></polygon>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 635 B

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
<title>Expand-Light</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Expand-Light" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g transform="translate(9.000000, 9.000000) rotate(-90.000000) translate(-9.000000, -9.000000) translate(2.000000, 5.000000)" fill="#3A3A3A" id="Path-2">
<polygon points="0 0 13.3424655 0 6.67123275 7.3125"></polygon>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 710 B

View File

@ -1,10 +1,11 @@
<template>
<li>
<a :href="url+'/categories/'+this.item['translations'][0].slug">{{ this.item['translations'][0].name }}&emsp;<i class="icon dropdown-right-icon"
v-if="haveChildren && item.parent_id != null"></i></a>
<i :class="[show ? 'icon arrow-down-icon mt-15' : 'icon dropdown-right-icon mt-15']"
v-if="haveChildren || item.parent_id == null" @click="showOrHide"></i>
v-if="haveChildren" @click="showOrHide"></i>
<ul v-if="haveChildren && show">
<category-item
@ -29,19 +30,16 @@ export default {
show: false,
};
},
mounted: function() {
if(window.innerWidth > 770){
this.show = true;
}
},
computed: {
haveChildren() {
return this.item.children.length ? true : false;
}
},
methods: {
showOrHide: function() {
this.show = !this.show;

View File

@ -480,6 +480,10 @@ section.slider-block {
position: relative;
}
.nav a:first-child{
margin-left: 20px;
}
.nav li > .icon{
display: none;
}
@ -497,7 +501,6 @@ section.slider-block {
.nav > li {
float: left;
margin-right: 1px;
}
.nav > li > a {
@ -649,8 +652,6 @@ section.slider-block {
padding: 12px 4.8px 12px 8px;
text-transform: uppercase;
letter-spacing: 2px;
position: relative;
width: 90%;
}
.nav li > .icon{
@ -661,11 +662,11 @@ section.slider-block {
display: none;
}
.nav > li {
.nav > li {
border-bottom: 1px solid $border-color;
}
.nav li:first-child {
.nav li:first-child {
border-top: 1px solid $border-color;
}

View File

@ -95,4 +95,28 @@
background-image: url('../images/wishlist.svg');
width: 32px;
height: 32px;
}
.icon-arrow-up {
background-image: url('../images/arrow-up.svg');
width: 16px;
height: 16px;
}
.icon-arrow-down {
background-image: url('../images/arrow-down.svg');
width: 16px;
height: 16px;
}
.expand-icon {
background-image: url("../images/Expand-Light.svg");
width: 18px;
height: 18px;
}
.expand-on-icon {
background-image: url("../images/Expand-Light-On.svg");
width: 18px;
height: 18px;
}

View File

@ -116,6 +116,24 @@ return [
'title' => 'Edit Address',
'submit' => 'Edit Address'
]
],
'order' => [
'index' => [
'page-title' => 'Customer-Order',
'title' => 'Orders',
'order_id' => 'Order ID',
'date' => 'Date',
'status' => 'Status',
'item' => 'Item',
'total' => 'total'
]
],
'review' => [
'index' => [
'title' => 'Reviews'
]
]
]
],

View File

@ -6,7 +6,7 @@
@section('content-wrapper')
<div class="order-success-content">
<div class="order-success-content" style="min-height: 300px;">
<h1>{{ __('shop::app.checkout.success.thanks') }}</h1>
@ -15,7 +15,7 @@
<p>{{ __('shop::app.checkout.success.info') }}</p>
<div class="misc-controls">
<a href="{{ route('shop.home.index') }}" class="btn btn-lg btn-primary">
<a style="display: inline-block" href="{{ route('shop.home.index') }}" class="btn btn-lg btn-primary">
{{ __('shop::app.checkout.cart.continue-shopping') }}
</a>
</div>

View File

@ -4,4 +4,4 @@
@include('shop::customers.account.partials.sidemenu')
<h1>Account Index Page</h1>
</div>
@endsection
@endsection

View File

@ -1 +1,53 @@
<h1>Customer past orders page</h1>
@extends('shop::layouts.master')
@section('page_title')
{{ __('shop::app.customer.account.order.index.page-title') }}
@endsection
@section('content-wrapper')
<div class="account-content">
@include('shop::customers.account.partials.sidemenu')
<div class="account-layout">
<div class="account-head">
<span class="account-heading">{{ __('shop::app.customer.account.order.index.title') }}</span>
<div class="horizontal-rule"></div>
</div>
<div class="account-items-list">
<div class="table">
<table>
<thead>
<tr>
<th> {{ __('shop::app.customer.account.order.index.order_id') }}</th>
<th> {{ __('shop::app.customer.account.order.index.date') }} </th>
<th> {{ __('shop::app.customer.account.order.index.status')}} </th>
<th> {{ __('shop::app.customer.account.order.index.item') }} </th>
<th> {{ __('shop::app.customer.account.order.index.total') }} </th>
</tr>
</thead>
<tbody>
@foreach($orders as $order)
<tr>
<td>{{ $order->id }}</td>
<td></td>
<td>Shipped (2)</td>
<td>2</td>
<td>$35.00</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection

View File

@ -1,3 +1,8 @@
{{-- <div class="side-menu-title mb-20" id="side-menu-title">
<strong>Menu</strong>
<i class="icon icon-arrow-down right" id="down-icon"></i>
</div> --}}
<ul class="account-side-menu">
@foreach($menu->items as $key=>$value)
@ -5,3 +10,38 @@
@endforeach
</ul>
@push('scripts')
<script>
$(document).ready(function(){
var sideMenuTitle = document.getElementById("side-menu-title");
var downIcon = document.getElementById("down-icon");
var accountSideMenu = document.getElementsByClassName("account-side-menu");
sideMenuTitle.addEventListener("click", function(){
if(downIcon.className == 'icon icon-arrow-down right'){
for(let i=0 ; i < accountSideMenu.length ; i++){
accountSideMenu[i].style.display="block";
}
downIcon.classList.remove("icon","icon-arrow-down","right");
downIcon.classList.add("icon","icon-arrow-up","right");
}else{
for(let i=0 ; i < accountSideMenu.length ; i++){
accountSideMenu[i].style.display="none";
}
downIcon.classList.remove("icon","icon-arrow-up","right");
downIcon.classList.add("icon","icon-arrow-down","right");
}
});
});
</script>
@endpush

View File

@ -1,6 +1,6 @@
@extends('shop::layouts.master')
@section('page_title')
{{ __('shop::app.customer.account.profile.index.page-title') }}
{{ __('shop::app.order.page-title') }}
@endsection
@section('content-wrapper')
@ -12,6 +12,8 @@
<div class="account-head">
{{-- <span class="back-icon"><a href="{{ route('customer.account.index') }}"><i class="icon icon-menu-back"></i></a></span> --}}
<span class="account-heading">{{ __('shop::app.customer.account.profile.index.title') }}</span>
<span class="account-action">

View File

@ -0,0 +1,55 @@
@inject ('productImageHelper', 'Webkul\Product\Product\ProductImage')
@extends('shop::layouts.master')
@section('content-wrapper')
<div class="account-content">
@include('shop::customers.account.partials.sidemenu')
<div class="account-layout">
<div class="account-head">
<span class="account-heading">{{ __('shop::app.customer.account.review.index.title') }}</span>
<div class="horizontal-rule"></div>
</div>
<div class="account-items-list">
@if(is_null($reviews))
@foreach($reviews as $review)
<div class="account-item-card mt-15 mb-15">
<div class="media-info">
<?php $image = $productImageHelper->getGalleryImages($review->product); ?>
<img class="media" src="{{ $image[0]['small_image_url'] }}" />
<div class="info mt-20">
<div class="product-name">{{$review->product->name}}</div>
<div>
@for($i=0 ; $i < $review->rating ; $i++)
<span class="icon star-icon"></span>
@endfor
</div>
<div>
{{ $review->comment }}
</div>
</div>
</div>
<div class="operations">
</div>
</div>
<div class="horizontal-rule mb-10 mt-10"></div>
@endforeach
@else
<div class="empty">
{{-- {{ __('customer::app.wishlist.empty') }} --}}
</div>
@endif
</div>
</div>
</div>
@endsection

View File

@ -1,3 +1,4 @@
<div class="header" id="header">
<div class="header-top">
<div class="left-content">
@ -255,7 +256,85 @@
<span class="suggestion mt-15">Designer sarees</span>
</div>
</div>
<div class="responsive-nav-menu">
<div class="responsive-nav">
<category-nav categories='@json($categories)' url="{{url()->to('/')}}"></category-nav>
</div>
</div>
</div>
@push('scripts')
<script>
window.onload = function() {
var hamMenu = document.getElementById("hammenu");
var search = document.getElementById("search");
var searchResponsive = document.getElementsByClassName('search-responsive')[0];
var sortLimit = document.getElementsByClassName('reponsive-sorter-limiter')[0];
var layerFilter = document.getElementsByClassName('responsive-layred-filter')[0];
var navResponsive = document.getElementsByClassName('responsive-nav')[0];
var thumbList = document.getElementsByClassName('thumb-list')[0];
var thumbFrame = document.getElementsByClassName('thumb-frame');
var productHeroImage = document.getElementsByClassName('product-hero-image')[0];
search.addEventListener("click", header);
hamMenu.addEventListener("click", header);
// activate on window resize
window.addEventListener('resize', function(){
if(window.innerWidth > 720){
searchResponsive.style.display = 'none';
navResponsive.style.display = 'none';
if(layerFilter && sortLimit){
layerFilter.style.display ="none";
sortLimit.style.display ="none";
}
}
if(window.innerWidth < 1313 && window.innerWidth > 720){
if(thumbList){
thumbList.style.maxHeight = productHeroImage.offsetHeight + "px";
for(let i=0 ; i < thumbFrame.length ; i++){
thumbFrame[i].style.height = (productHeroImage.offsetHeight/4) + "px";
}
}
}else {
for(let i=0 ; i < thumbFrame.length ; i++){
thumbFrame[i].style.height = 120 + "px";
}
}
});
// for header responsive icon
function header(){
var className = document.getElementById(this.id).className;
if(className === 'icon icon-search' ){
search.classList.remove("icon-search");
search.classList.add("icon-menu-close");
hamMenu.classList.remove("icon-menu-close");
hamMenu.classList.add("icon-menu");
searchResponsive.style.display = 'block';
navResponsive.style.display = 'none';
}else if(className === 'icon icon-menu'){
hamMenu.classList.remove("icon-menu");
hamMenu.classList.add("icon-menu-close");
search.classList.remove("icon-menu-close");
search.classList.add("icon-search");
searchResponsive.style.display = 'none';
navResponsive.style.display = 'block';
}else{
search.classList.remove("icon-menu-close");
search.classList.add("icon-search");
hamMenu.classList.remove("icon-menu-close");
hamMenu.classList.add("icon-menu");
searchResponsive.style.display = 'none';
navResponsive.style.display = 'none';
}
}
}
</script>
@endpush

View File

@ -42,7 +42,6 @@
<script type="text/javascript">
window.flashMessages = [];
@if($success = session('success'))
window.flashMessages = [{'type': 'alert-success', 'message': "{{ $success }}" }];
@elseif($warning = session('warning'))
@ -50,7 +49,6 @@
@elseif($error = session('error'))
window.flashMessages = [{'type': 'alert-error', 'message': "{{ $error }}" }];
@endif
window.serverErrors = [];
@if (count($errors))
window.serverErrors = @json($errors->getMessages());
@ -60,57 +58,8 @@
<script type="text/javascript" src="{{ bagisto_asset('js/shop.js') }}"></script>
<script type="text/javascript" src="{{ asset('vendor/webkul/ui/assets/js/ui.js') }}"></script>
{{-- For JS that requires onload property --}}
<script>
window.onload = function () {
//header
var hamMenu = document.getElementById("hammenu");
var search = document.getElementById("search");
var sort = document.getElementById("sort");
var filter = document.getElementById("filter");
var searchResponsive = document.getElementsByClassName('search-responsive')[0];
var sortLimit = document.getElementsByClassName('reponsive-sorter-limiter')[0];
var layerFilter = document.getElementsByClassName('responsive-layred-filter')[0];
var navResponsive = document.getElementsByClassName('responsive-nav')[0];
search.addEventListener("click", header);
hamMenu.addEventListener("click", header);
//clone nav menu
};
// for responsive header
function header(){
var className = document.getElementById(this.id).className;
if(className === 'icon search-icon' ){
search.classList.remove("search-icon");
search.classList.add("icon-menu-close");
hamMenu.classList.remove("icon-menu-close");
hamMenu.classList.add("sortable-icon");
searchResponsive.style.display = 'block';
navResponsive.style.display = 'none';
}else if(className === 'icon sortable-icon'){
hamMenu.classList.remove("sortable-icon");
hamMenu.classList.add("icon-menu-close");
search.classList.remove("icon-menu-close");
search.classList.add("search-icon");
searchResponsive.style.display = 'none';
navResponsive.style.display = 'block';
}else{
search.classList.remove("icon-menu-close");
search.classList.add("search-icon");
hamMenu.classList.remove("icon-menu-close");
hamMenu.classList.add("sortable-icon");
searchResponsive.style.display = 'none';
navResponsive.style.display = 'none';
}
}
</script>
@stack('scripts')
</body>
</html>

View File

@ -55,4 +55,52 @@
@stop
@push('scripts')
<script>
$(document).ready(function() {
var sort = document.getElementById("sort");
var filter = document.getElementById("filter");
var sortLimit = document.getElementsByClassName('reponsive-sorter-limiter')[0];
var layerFilter = document.getElementsByClassName('responsive-layred-filter')[0];
if(sort && filter){
sort.addEventListener("click", sortFilter);
filter.addEventListener("click", sortFilter);
}
function sortFilter(){
var className = document.getElementById(this.id).className;
if(className === 'icon sort-icon' ){
sort.classList.remove("sort-icon");
sort.classList.add("icon-menu-close");
filter.classList.remove("icon-menu-close");
filter.classList.add("filter-icon");
sortLimit.style.display ="flex";
sortLimit.style.justifyContent="space-between";
layerFilter.style.display ="none";
}else if(className === 'icon filter-icon'){
filter.classList.remove("filter-icon");
filter.classList.add("icon-menu-close");
sort.classList.remove("icon-menu-close");
sort.classList.add("sort-icon");
layerFilter.style.display ="block";
sortLimit.style.display ="none";
}else{
sort.classList.remove("icon-menu-close");
sort.classList.add("sort-icon");
filter.classList.remove("icon-menu-close");
filter.classList.add("filter-icon");
sortLimit.style.display ="none";
layerFilter.style.display ="none";
}
}
})
</script>
@endpush

View File

@ -75,4 +75,42 @@
@endsection
@push('scripts')
<script>
document.onreadystatechange = function () {
var state = document.readyState
var galleryTemplate = document.getElementById('product-gallery-template');
var addTOButton = document.getElementsByClassName('add-to-buttons')[0];
if(galleryTemplate){
if (state == 'interactive') {
galleryTemplate.style.display="none";
} else {
document.getElementById('loader').style.display="none";
addTOButton.style.display="flex";
}
}
}
$(document).ready(function() {
var thumbList = document.getElementsByClassName('thumb-list')[0];
var thumbFrame = document.getElementsByClassName('thumb-frame');
var productHeroImage = document.getElementsByClassName('product-hero-image')[0];
// for product page resize image
if(thumbList && productHeroImage){
thumbList.style.maxHeight = productHeroImage.offsetHeight + "px";
for(let i=0 ; i < thumbFrame.length ; i++){
thumbFrame[i].style.height = (productHeroImage.offsetHeight/4) + "px";
}
}
})
</script>
@endpush

View File

@ -5,8 +5,8 @@ namespace Webkul\Tax\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Channel as Channel;
use Webkul\Tax\Repositories\TaxCategoriesRepository as TaxRule;
use Webkul\Tax\Repositories\TaxRatesRepository as TaxRate;
use Webkul\Tax\Repositories\TaxCategoryRepository as TaxRule;
use Webkul\Tax\Repositories\TaxRateRepository as TaxRate;
use Webkul\Tax\Repositories\TaxMapRepository as TaxMap;
/**
@ -34,7 +34,7 @@ class TaxCategoryController extends Controller
/**
* Create a new controller instance.
*
* @param Webkul\Tax\Repositories\TaxCategoriesRepository $taxRule
* @param Webkul\Tax\Repositories\TaxCategoryRepository $taxRule
* @return void
*/
public function __construct(TaxRule $taxRule, TaxRate $taxRate, TaxMap $taxMap)

View File

@ -5,8 +5,8 @@ namespace Webkul\Tax\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Core\Repositories\ChannelRepository as Channel;
use Webkul\Tax\Repositories\TaxCategoriesRepository as TaxRule;
use Webkul\Tax\Repositories\TaxRatesRepository as TaxRate;
use Webkul\Tax\Repositories\TaxCategoryRepository as TaxRule;
use Webkul\Tax\Repositories\TaxRateRepository as TaxRate;
use Webkul\Tax\Repositories\TaxMapRepository as TaxMap;
@ -57,8 +57,8 @@ class TaxController extends Controller
* Create a new controller instance.
*
* @param Webkul\Core\Repositories\ChannelRepository $channel
* @param Webkul\Tax\Repositories\TaxCategoriesRepository $taxRule
* @param Webkul\Tax\Repositories\TaxRatesRepository $taxRate
* @param Webkul\Tax\Repositories\TaxCategoryRepository $taxRule
* @param Webkul\Tax\Repositories\TaxRateRepository $taxRate
* @param Webkul\Tax\Repositories\TaxMapRepository $taxMap
* @return void
*/

View File

@ -4,7 +4,7 @@ namespace Webkul\Tax\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Webkul\Tax\Repositories\TaxRatesRepository as TaxRate;
use Webkul\Tax\Repositories\TaxRateRepository as TaxRate;
/**
@ -32,7 +32,7 @@ class TaxRateController extends Controller
/**
* Create a new controller instance.
*
* @param Webkul\Tax\Repositories\TaxRatesRepository $taxRate
* @param Webkul\Tax\Repositories\TaxRateRepository $taxRate
* @return void
*/
public function __construct(TaxRate $taxRate)

View File

@ -10,7 +10,7 @@ use Webkul\Core\Eloquent\Repository;
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class TaxCategoriesRepository extends Repository
class TaxCategoryRepository extends Repository
{
/**
* Specify Model class name

View File

@ -10,7 +10,7 @@ use Webkul\Core\Eloquent\Repository;
* @author Prashant Singh <prashant.singh852@webkul.com>
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
*/
class TaxRatesRepository extends Repository
class TaxRateRepository extends Repository
{
/**
* Specify Model class name

View File

@ -13,3 +13,4 @@ Vue.component("image-wrapper", require("./components/image/image-wrapper"));
Vue.component("image-item", require("./components/image/image-item"));
Vue.directive("slugify", require("./directives/slugify"));
Vue.directive("code", require("./directives/code"));
Vue.directive("alert", require("./directives/alert"));

View File

@ -0,0 +1,18 @@
<script>
export default {
bind(el, binding, vnode) {
el.addEventListener('click', function(e) {
e.preventDefault();
var message = "Are your sure you want to perform this action ?";
if(binding.value && binding.value != '')
message = binding.value;
if (confirm(message)) {
window.location.href = el.href;
}
});
}
}
</script>

View File

@ -2,7 +2,7 @@
export default {
bind(el, binding, vnode) {
let handler = function(e) {
setTimeout(function(){
setTimeout(function() {
e.target.value = e.target.value.toString().toLowerCase()
.replace(/[^\w_ ]+/g,'')
.trim()

View File

@ -2,7 +2,7 @@
export default {
bind(el, binding, vnode) {
let handler = function(e) {
setTimeout(function(){
setTimeout(function() {
e.target.value = e.target.value.toString().toLowerCase()
.replace(/[^\w- ]+/g,'')
.trim()

View File

@ -141,6 +141,12 @@
height: 18px;
}
.expand-on-icon {
background-image: url("../images/Expand-Light-On.svg");
width: 18px;
height: 18px;
}
.dark-left-icon {
background-image: url("../images/arrow-left-dark.svg");
width: 18px;

View File

@ -97,6 +97,75 @@
height: 32px;
}
<<<<<<< HEAD
=======
.icon-arrow-up {
background-image: url("../images/arrow-up.svg");
width: 16px;
height: 16px;
}
.icon-arrow-down {
background-image: url("../images/arrow-down.svg");
width: 16px;
height: 16px;
}
.expand-icon {
background-image: url("../images/Expand-Light.svg");
width: 18px;
height: 18px;
}
.expand-on-icon {
background-image: url("../images/Expand-Light-On.svg");
width: 18px;
height: 18px;
}
.product-grid-4 {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
grid-auto-rows: auto;
grid-column-gap: 48px;
grid-row-gap: 15px;
}
.product-grid-3 {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
grid-gap: 27px;
grid-auto-rows: auto;
}
@media only screen and (max-width: 854px) {
.product-grid-4 {
grid-template-columns: 29.5% 29.5% 29.5%;
grid-column-gap: 35px;
}
}
@media only screen and (max-width: 653px) {
.product-grid-4 {
grid-template-columns: 48.5% 48.5%;
grid-column-gap: 17px;
}
}
@media only screen and (max-width: 425px) {
.product-card {
font-size: 90%;
}
.product-card .btn.btn-md {
padding: 5px;
}
.product-grid-4 {
grid-template-columns: 48.5% 48.5%;
grid-column-gap: 10px;
}
}
>>>>>>> 0b9568132497b959c68dbcbf51488f2780f13c0d
.product-card .product-image {
max-height: 350px;
max-width: 280px;
@ -1138,6 +1207,10 @@ section.slider-block div.slider-content div.slider-control .light-right-icon {
position: relative;
}
.header .header-bottom .nav a:first-child {
margin-left: 20px;
}
.header .header-bottom .nav li > .icon {
display: none;
}
@ -1303,8 +1376,6 @@ section.slider-block div.slider-content div.slider-control .light-right-icon {
padding: 12px 4.8px 12px 8px;
text-transform: uppercase;
letter-spacing: 2px;
position: relative;
width: 90%;
}
.responsive-nav .nav li > .icon {
float: right;

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/shop.js": "/js/shop.js",
"/css/shop.css": "/css/shop.css"
}
}