Merge pull request #336 from bagisto/rahul

Rahul
This commit is contained in:
JItendra Singh 2018-12-18 13:40:04 +05:30 committed by GitHub
commit ac3a2d5860
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 36095 additions and 235 deletions

View File

@ -106,7 +106,7 @@ class ConfigurationController extends Controller
*/
public function store()
{
$data = request()->all();
$this->coreConfig->create(request()->all());
session()->flash('success', 'Shipping Method is created successfully');

View File

@ -104,7 +104,8 @@ class CustomerController extends Controller
'last_name' => 'string|required',
'gender' => 'required',
'phone' => 'nullable|numeric|unique:customers,phone',
'email' => 'required|unique:customers,email'
'email' => 'required|unique:customers,email',
'date_of_birth' => 'date|before:today'
]);
$data=request()->all();
@ -152,7 +153,8 @@ class CustomerController extends Controller
'last_name' => 'string|required',
'gender' => 'required',
'phone' => 'nullable|numeric|unique:customers,phone,'. $id,
'email' => 'required|unique:customers,email,'. $id
'email' => 'required|unique:customers,email,'. $id,
'date_of_birth' => 'date|before:today'
]);
$this->customer->update(request()->all(),$id);

View File

@ -68,21 +68,14 @@ Route::group(['middleware' => ['web']], function () {
'view' => 'admin::customers.review.index'
])->name('admin.customer.review.index');
// Configuration routes
Route::get('configuration/{slug?}/{slug2?}', 'Webkul\Admin\Http\Controllers\ConfigurationController@index')->defaults('_config', [
'view' => 'admin::configuration.index'
])->name('admin.configuration.index');
//Shipping Methods Routes
Route::get('configuration/sales/shipping-methods', 'Webkul\Admin\Http\Controllers\ConfigurationController@index')->defaults('_config', [
'view' => 'admin::configuration.sales.shipping-method'
])->name('admin.configuration.sales.shipping_methods');
Route::post('configuration/sales/shipping-methods', 'Webkul\Admin\Http\Controllers\ConfigurationController@store')->defaults('_config', [
'redirect' => 'admin.configuration.sales.shipping_methods'
])->name('admin.configuration.sales.shipping_methods.store');
Route::post('configuration/{slug?}/{slug2?}', 'Webkul\Admin\Http\Controllers\ConfigurationController@store')->defaults('_config', [
'redirect' => 'admin.configuration.index'
])->name('admin.configuration.index.store');
// Reviews Routes
Route::get('reviews/edit/{id}', 'Webkul\Product\Http\Controllers\ReviewController@edit')->defaults('_config',[

View File

@ -544,7 +544,9 @@ return [
'channel_name' => 'Channel Name',
'state' => 'State',
'select-state' => 'Select a region, state or province.',
'country' => 'Country'
'country' => 'Country',
'male' => 'Male',
'female' => 'Female'
],
'reviews' => [
'title' => 'Reviews',

View File

@ -8,9 +8,17 @@
$validations = implode('|', array_filter($validations));
$name = $field['name'];
$key = $item['key'];
$key = explode(".", $key);
array_shift($key);
$firstField = current($key);
$secondField = next($key);
$key = implode(".", $key);
$name = $key . '.' . $field['name'];
?>
<div class="control-group {{ $field['type'] }}" :class="[errors.has('{{ $name }}') ? 'has-error' : '']">
<div class="control-group {{ $field['type'] }}" :class="[errors.has('{{ $firstField }}[{{ $secondField }}][{{ $field['name'] }}]') ? 'has-error' : '']">
<label for="{{ $name }}" {{ !isset($field['validation']) || strpos('required', $field['validation']) < 0 ? '' : 'class=required' }}>
{{ $field['title'] }}
@ -34,29 +42,25 @@
</label>
<?php
$configData = core()->getConfigData($name, current($channel_locale), next($channel_locale));
?>
@if ($field['type'] == 'text')
<input type="text" v-validate="'{{ $validations }}'" class="control" id="{{ $name }}" name="{{ $name }}" value="{{ old($name) ?: core()->getConfigData($name) }}" data-vv-as="&quot;{{ $field['name'] }}&quot;">
<input type="text" v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $field['name'] }}]" value="{{ old($name) ?: core()->getConfigData($name) }}" data-vv-as="&quot;{{ $field['name'] }}&quot;">
@elseif ($field['type'] == 'textarea')
<textarea v-validate="'{{ $validations }}'" class="control" id="{{ $name }}" name="{{ $name }}" data-vv-as="&quot;{{ $field['name'] }}&quot;">{{ old($name) ?: core()->getConfigData($name) }}</textarea>
<textarea v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $field['name'] }}]" data-vv-as="&quot;{{ $field['name'] }}&quot;">{{ old($name) ?: core()->getConfigData($name) }}</textarea>
@elseif ($field['type'] == 'select')
<select v-validate="'{{ $validations }}'" class="control" id="{{ $name }}" name="{{ $name }}" data-vv-as="&quot;{{ $field['name'] }}&quot;" >
<select v-validate="'{{ $validations }}'" class="control" id="{{ $firstField }}[{{ $secondField }}][{{ $field['name'] }}]" name="{{ $firstField }}[{{ $secondField }}][{{ $field['name'] }}]" data-vv-as="&quot;{{ $field['name'] }}&quot;" >
@foreach($field['options'] as $option)
<?php
if($option['value']) {
$value = 1;
}else {
if($option['value'] == false) {
$value = 0;
}else {
$value = $option['value'];
}
$selectedOption = core()->getConfigData($name) ?? '';
@ -71,5 +75,5 @@
@endif
<span class="control-error" v-if="errors.has('{{ $name }}')">@{{ errors.first('{!! $name !!}') }}</span>
<span class="control-error" v-if="errors.has('{{ $firstField }}[{{ $secondField }}][{{ $field['name'] }}]')">@{{ errors.first('{!! $firstField !!}[{!! $secondField !!}][{!! $field['name'] !!}]') }}</span>
</div>

View File

@ -55,7 +55,7 @@
@csrf()
@if ($groups = array_get($config->items, request()->route('slug') . '.children.' . request()->route('slug2') . '.children'))
@foreach ($groups as $key => $item)
<accordian :title="'{{ __($item['name']) }}'" :active="true">
@ -64,7 +64,7 @@
@foreach ($item['fields'] as $field)
@include ('admin::configuration.field-type', ['field' => $field])
@endforeach
</div>
@ -88,7 +88,7 @@
$('#channel-switcher').val()
var query = '?channel=' + $('#channel-switcher').val() + '&locale=' + $('#locale-switcher').val();
window.location.href = "{{ route('admin.configuration.sales.shipping_methods') }}" + query;
window.location.href = "{{ route('admin.configuration.index', [request()->route('slug'), request()->route('slug2')]) }}" + query;
})
});
</script>

View File

@ -1,20 +0,0 @@
<select v-validate="'{{$validations}}'" class="control" id="{{ $name }}" name="{{ $name }}" data-vv-as="&quot;{{ $field['name'] }}&quot;" >
@foreach($field['options'] as $option)
<?php
if($option['value']) {
$value = 1;
}else {
$value = 0;
}
$selectedOption = core()->getConfigData($name) ?? '';
?>
<option value="{{ $value }}" {{ $value == $selectedOption ? 'selected' : ''}}>
{{ $option['title'] }}
</option>
@endforeach
</select>

View File

@ -1,8 +0,0 @@
<input type="text" v-validate="'{{$validations}}'" class="control" id="{{ $name }}" name="{{ $name }}" value="{{ old($name) ?: core()->getConfigData($name) }}" data-vv-as="&quot;{{ $field['name'] }}&quot;">

View File

@ -1 +0,0 @@
<textarea v-validate="'{{$validations}}'" class="control" id="{{ $name }}" name="{{ $name }}" data-vv-as="&quot;{{ $field['name'] }}&quot;">{{ old($name) ?: core()->getConfigData($name) }}</textarea>

View File

@ -1,141 +0,0 @@
@extends('admin::layouts.content')
@section('page_title')
{{ __('admin::app.configuration.sales.shipping-method.title') }}
@stop
@section('content')
<div class="content">
<?php $locale = request()->get('locale') ?: app()->getLocale(); ?>
<?php $channel = request()->get('channel') ?: core()->getDefaultChannelCode(); ?>
<form method="POST" action="" @submit.prevent="onSubmit" enctype="multipart/form-data">
<div class="page-header">
<div class="page-title">
<h1>
{{ __('admin::app.configuration.sales.shipping-method.title') }}
</h1>
<div class="control-group">
<select class="control" id="channel-switcher" name="channel">
@foreach(core()->getAllChannels() as $channelModel)
<option value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
{{ $channelModel->name }}
</option>
@endforeach
</select>
</div>
<div class="control-group">
<select class="control" id="locale-switcher" name="locale">
@foreach(core()->getAllLocales() as $localeModel)
<option value="{{ $localeModel->code }}" {{ ($localeModel->code) == $locale ? 'selected' : '' }}>
{{ $localeModel->name }}
</option>
@endforeach
</select>
</div>
</div>
<div class="page-action">
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.configuration.sales.shipping-method.save-btn-title') }}
</button>
</div>
</div>
<div class="page-content">
<div class="form-container">
@csrf()
@foreach (config('core.carriers') as $method => $carrier)
<accordian :title="'{{ __(config('carriers.' . $method . '.title')) }}'" :active="true">
<div slot="body">
@foreach ($carrier as $field)
<?php
$validations = [];
$disabled = false;
if (isset($field['validation'])) {
array_push($validations, $field['validation']);
} else {
$disabled = true;
}
$validations = implode('|', array_filter($validations));
?>
@if (view()->exists($typeView = 'admin::configuration.sales.field-types.' . $field['type']))
<?php
$name = 'carriers' . '.' . $method . '.' . $field['name'];
?>
<div class="control-group {{ $field['type'] }}" :class="[errors.has('{{ $name }}') ? 'has-error' : '']">
<label for="{{ $name }}" {{ $disabled == false ? 'class=required' : '' }}>
{{ $field['title'] }}
<?php
$channel_locale = [];
if(isset($field['channel_based']) && $field['channel_based'])
{
array_push($channel_locale, $channel);
}
if(isset($field['locale_based']) && $field['locale_based']) {
array_push($channel_locale, $locale);
}
?>
@if(count($channel_locale))
<span class="locale">[{{ implode(' - ', $channel_locale) }}]</span>
@endif
</label>
<?php
$configData = core()->getConfigData($name, current($channel_locale), next($channel_locale));
?>
@include ($typeView)
<span class="control-error" v-if="errors.has('{{ $name }}')">@{{ errors.first('{!! $name !!}') }}</span>
</div>
@endif
@endforeach
</div>
</accordian>
@endforeach
</div>
</div>
</form>
</div>
@stop
@push('scripts')
<script>
$(document).ready(function () {
$('#channel-switcher, #locale-switcher').on('change', function (e) {
$('#channel-switcher').val()
var query = '?channel=' + $('#channel-switcher').val() + '&locale=' + $('#locale-switcher').val();
window.location.href = "{{ route('admin.configuration.sales.shipping_methods') }}" + query;
})
});
</script>
@endpush

View File

@ -50,15 +50,16 @@
<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="'required'" data-vv-as="&quot;{{ __('shop::app.customers.customers.gender') }}&quot;">
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Male">{{ __('admin::app.customers.customers.male') }}</option>
<option value="Female">{{ __('admin::app.customers.customers.female') }}</option>
</select>
<span class="control-error" v-if="errors.has('gender')">@{{ errors.first('gender') }}</span>
</div>
<div class="control-group">
<div class="control-group" :class="[errors.has('date_of_birth') ? 'has-error' : '']">
<label for="dob">{{ __('admin::app.customers.customers.date_of_birth') }}</label>
<input type="date" class="control" name="date_of_birth">
<input type="date" class="control" name="date_of_birth" v-validate="" value="{{ old('date_of_birth') }}" data-vv-as="&quot;{{ __('admin::app.customers.customers.date_of_birth') }}&quot;">
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
</div>
<div class="control-group">

View File

@ -53,15 +53,16 @@
<div class="control-group">
<label for="gender" class="required">{{ __('admin::app.customers.customers.gender') }}</label>
<select name="gender" class="control" v-validate="'gender'" value="{{ $customer->gender }}" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customers.customers.gender') }}&quot;">
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Male" {{ $customer->gender == "Male" ? 'selected' : '' }}>{{ __('admin::app.customers.customers.male') }}</option>
<option value="Female" {{ $customer->gender == "Female" ? 'selected' : '' }}>{{ __('admin::app.customers.customers.female') }}</option>
</select>
<span class="control-error" v-if="errors.has('gender')">@{{ errors.first('gender') }}</span>
</div>
<div class="control-group">
<div class="control-group" :class="[errors.has('date_of_birth') ? 'has-error' : '']">
<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 }}">
<input type="date" class="control" name="date_of_birth" value="{{ $customer->date_of_birth }}" v-validate="" data-vv-as="&quot;{{ __('admin::app.customers.customers.date_of_birth') }}&quot;">
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
</div>
<div class="control-group">

View File

@ -15,11 +15,11 @@
</a>
</li>
@endforeach
@else
@foreach($config->items as $key => $item)
<li class="{{ $item['key'] == request()->route('slug') ? 'active' : '' }}">
<a href="{{ route('admin.configuration.index', $item['key']) }}">
{{ isset($item['name']) ? $item['name'] : '' }}

View File

@ -20,7 +20,7 @@
</span>
<span class="role">
Administrator
{{ auth()->guard('admin')->user()->role['name'] }}
</span>
</div>
<i class="icon arrow-down-icon active"></i>

View File

@ -4,7 +4,7 @@
<?php $keys = explode('.', $menu->currentKey); ?>
@foreach(array_get($menu->items, implode('.children.', array_slice($keys, 0, 2)) . '.children') as $item)
<li class="{{ $menu->getActive($item) }}">
<a href="{{ $item['url'] }}">
@ -12,9 +12,9 @@
</a>
</li>
@endforeach
@else
@if (array_get($config->items, request()->route('slug') . '.children'))
@foreach (array_get($config->items, request()->route('slug') . '.children') as $key => $item)

View File

@ -490,9 +490,45 @@ class Core
$locale = request()->get('locale') ?: app()->getLocale();
}
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
'code' => $field
]);
$fields = $this->getConfigField($field);
$channel_based = false;
$locale_based = false;
if (isset($fields['channel_based']) && $fields['channel_based']) {
$channel_based = true;
}
if (isset($fields['locale_based']) && $fields['locale_based']) {
$locale_based = true;
}
if (isset($fields['channel_based']) && $fields['channel_based']) {
if (isset($fields['locale_based']) && $fields['locale_based']) {
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
'code' => $field,
'channel_code' => $channel,
'locale_code' => $locale
]);
} else {
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
'code' => $field,
'channel_code' => $channel,
]);
}
} else {
if (isset($fields['locale_based']) && $fields['locale_based']) {
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
'code' => $field,
'locale_code' => $locale
]);
}
else {
$coreConfigValue = $this->coreConfigRepository->findOneWhere([
'code' => $field
]);
}
}
if(!$coreConfigValue)
return Config::get($field);
@ -608,7 +644,7 @@ class Core
return date('Y-m-d', $end);
}
}
/**
* Method to sort through the acl items and put them in order
*
@ -630,7 +666,31 @@ class Core
});
return $this->convertToAssociativeArray($items);
}
}
/**
* @param string $fieldName
* @return array
*/
public function getConfigField($fieldName) {
foreach (config('core') as $coreData) {
if (isset($coreData['fields'])) {
foreach ($coreData['fields'] as $field) {
$key = $coreData['key'];
$key = explode(".", $key);
array_shift($key);
$key = implode(".", $key);
$name = $key . '.' . $field['name'];
if ($name == $fieldName ) {
return $field;
}
}
}
}
}
public function convertToAssociativeArray($items)
{

View File

@ -21,4 +21,100 @@ class CoreConfigRepository extends Repository
{
return 'Webkul\Core\Models\CoreConfig';
}
/**
* @param array $data
* @return mixed
*/
public function create(array $data)
{
unset($data['_token']);
if ($data['locale'] || $data['channel'])
{
$locale = $data['locale'];
$channel = $data['channel'];
unset($data['locale']);
unset($data['channel']);
}
foreach ($data as $method => $value)
{
foreach ($value as $key => $formData)
{
foreach (array_keys($formData) as $title)
{
$fieldName = $method . '.' . $key . '.' .$title;
$value = $formData[$title];
$field = core()->getConfigField($fieldName);
$channel_based = false;
$locale_based = false;
if (isset($field['channel_based']) && $field['channel_based']) {
$channel_based = true;
}
if (isset($field['locale_based']) && $field['locale_based']) {
$locale_based = true;
}
if (isset($field['channel_based']) && $field['channel_based'])
{
if (isset($field['locale_based']) && $field['locale_based'])
{
$coreConfigValue = $this->model
->where('code', $fieldName)
->where('locale_code', $locale)
->where('channel_code', $channel)
->get();
}
else
{
$coreConfigValue = $this->model
->where('code', $fieldName)
->where('channel_code', $channel)
->get();
}
} else
{
if (isset($field['locale_based']) && $field['locale_based'])
{
$coreConfigValue = $this->model
->where('code', $fieldName)
->where('locale_code', $locale)
->get();
}
else
{
$coreConfigValue = $this->model
->where('code', $fieldName)
->get();
}
}
if (!count($coreConfigValue) > 0)
{
$this->model->create([
'code' => $fieldName,
'value' => $value,
'locale_code' => $locale_based ? $locale : null,
'channel_code' => $channel_based ? $channel : null
]);
} else
{
$updataData['code'] = $fieldName;
$updataData['value'] = $value;
$updataData['locale_code'] = $locale_based ? $locale : null;
$updataData['channel_code'] = $channel_based ? $channel : null;
foreach ($coreConfigValue as $coreConfig)
{
$coreConfig->update($updataData);
}
}
}
}
}
}
}

View File

@ -8,6 +8,7 @@ use Webkul\Customer\Models\CustomerGroup;
use Webkul\Checkout\Models\Cart;
use Webkul\Sales\Models\Order;
use Webkul\Customer\Models\Wishlist;
use Webkul\Product\Models\ProductReview;
use Webkul\Customer\Notifications\CustomerResetPassword;
class Customer extends Authenticatable
@ -89,4 +90,11 @@ class Customer extends Authenticatable
public function active_carts() {
return $this->hasMany(Cart::class, 'customer_id')->where('is_active', 1);
}
/**
* get all reviews of a customer
*/
public function all_reviews() {
return $this->hasMany(ProductReview::class, 'customer_id');
}
}

View File

@ -0,0 +1,172 @@
<?php
return [
[
'key' => 'sales',
'name' => 'Sales',
'sort' => 1
], [
'key' => 'sales.paymentmethods',
'name' => 'Payment Methods',
'sort' => 2,
], [
'key' => 'sales.paymentmethods.cashondelivery',
'name' => 'Cash On Delivery',
'sort' => 1,
'fields' => [
[
'name' => 'title',
'title' => 'Title',
'type' => 'text',
'validation' => 'required',
'channel_based' => false,
'locale_based' => true
], [
'name' => 'description',
'title' => 'Description',
'type' => 'textarea',
'channel_based' => false,
'locale_based' => true
], [
'name' => 'order_status',
'title' => 'Order Status',
'type' => 'select',
'options' => [
[
'title' => 'Pending',
'value' => 'pending'
], [
'title' => 'Approved',
'value' => 'Approved'
], [
'title' => 'Pending Payment',
'value' => 'pending_payment'
]
],
'validation' => 'required'
], [
'name' => 'active',
'title' => 'Status',
'type' => 'select',
'options' => [
[
'title' => 'Active',
'value' => true
], [
'title' => 'Inactive',
'value' => false
]
],
'validation' => 'required'
]
]
], [
'key' => 'sales.paymentmethods.moneytransfer',
'name' => 'Money Transfer',
'sort' => 2,
'fields' => [
[
'name' => 'title',
'title' => 'Title',
'type' => 'text',
'validation' => 'required',
'channel_based' => false,
'locale_based' => true
], [
'name' => 'description',
'title' => 'Description',
'type' => 'textarea',
'channel_based' => false,
'locale_based' => true
], [
'name' => 'order_status',
'title' => 'Order Status',
'type' => 'select',
'options' => [
[
'title' => 'Pending',
'value' => 'pending'
], [
'title' => 'Approved',
'value' => 'Approved'
], [
'title' => 'Pending Payment',
'value' => 'pending_payment'
]
],
'validation' => 'required'
], [
'name' => 'active',
'title' => 'Status',
'type' => 'select',
'options' => [
[
'title' => 'Active',
'value' => true
], [
'title' => 'Inactive',
'value' => false
]
],
'validation' => 'required'
]
]
], [
'key' => 'sales.paymentmethods.paypal_standard',
'name' => 'Paypal Standard',
'sort' => 3,
'fields' => [
[
'name' => 'title',
'title' => 'Title',
'type' => 'text',
'validation' => 'required',
'channel_based' => false,
'locale_based' => true
], [
'name' => 'description',
'title' => 'Description',
'type' => 'textarea',
'channel_based' => false,
'locale_based' => true
], [
'name' => 'order_status',
'title' => 'Order Status',
'type' => 'select',
'options' => [
[
'title' => 'Pending',
'value' => 'pending'
], [
'title' => 'Approved',
'value' => 'Approved'
], [
'title' => 'Pending Payment',
'value' => 'pending_payment'
]
],
'validation' => 'required'
], [
'name' => 'active',
'title' => 'Status',
'type' => 'select',
'options' => [
[
'title' => 'Active',
'value' => true
], [
'title' => 'Inactive',
'value' => false
]
],
'validation' => 'required'
], [
'name' => 'business_account',
'title' => 'Business Account',
'type' => 'select',
'type' => 'text',
'validation' => 'required'
]
]
]
];

View File

@ -19,7 +19,7 @@ class PaymentServiceProvider extends ServiceProvider
{
include __DIR__ . '/../Http/helpers.php';
}
/**
* Register services.
*
@ -29,9 +29,7 @@ class PaymentServiceProvider extends ServiceProvider
{
$this->registerFacades();
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/paymentmethods.php', 'paymentmethods'
);
$this->registerConfig();
}
/**
* Register Bouncer as a singleton.
@ -47,4 +45,19 @@ class PaymentServiceProvider extends ServiceProvider
return new Payment();
});
}
/**
* Register package config.
*
* @return void
*/
protected function registerConfig()
{
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/paymentmethods.php', 'paymentmethods'
);
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/system.php', 'core'
);
}
}

View File

@ -63,10 +63,10 @@ class Review extends AbstractProduct
->orderBy('rating','desc')
->get();
for($i=5; $i >= 1; $i--) {
if(!$reviews->isEmpty()) {
for ($i=5; $i >= 1; $i--) {
if (!$reviews->isEmpty()) {
foreach ($reviews as $review) {
if($review->rating == $i) {
if ($review->rating == $i) {
$percentage[$i] = round(($review->total/$this->getTotalReviews($product))*100);
break;
} else {

View File

@ -136,7 +136,7 @@ class Toolbar extends AbstractProduct
if(isset($params['mode']))
return $params['mode'];
return 'grid';
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/shop.js": "/js/shop.js?id=c6ba9f43bd31f175a665",
"/css/shop.css": "/css/shop.css?id=40d2e5be9b9dd886e1e4"
}
"/js/shop.js": "/js/shop.js",
"/css/shop.css": "/css/shop.css"
}

View File

@ -123,4 +123,23 @@ class ReviewController extends Controller
return redirect()->back();
}
/**
* Function to delete all reviews
*
* @return Mixed Response & Boolean
*/
public function deleteAll() {
$reviews = auth()->guard('customer')->user()->all_reviews;
if($reviews->count() > 0) {
foreach($reviews as $review) {
$this->productReview->delete($review->id);
}
}
session()->flash('success', trans('shop::app.reviews.delete-all'));
return redirect()->back();
}
}

View File

@ -255,7 +255,7 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function
])->name('customer.orders.print');
/* Reviews route */
//Customer reviews(listing) only approved
//Customer reviews
Route::get('reviews', 'Webkul\Customer\Http\Controllers\CustomerController@reviews')->defaults('_config', [
'view' => 'shop::customers.account.reviews.index'
])->name('customer.reviews.index');
@ -264,6 +264,11 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function
Route::get('reviews/delete/{id}', 'Webkul\Shop\Http\Controllers\ReviewController@destroy')->defaults('_config', [
'redirect' => 'customer.reviews.index'
])->name('customer.review.delete');
//Customer all review delete
Route::get('reviews/all-delete', 'Webkul\Shop\Http\Controllers\ReviewController@deleteAll')->defaults('_config', [
'redirect' => 'customer.reviews.index'
])->name('customer.review.deleteall');
});
});
});

View File

@ -64,6 +64,7 @@ return [
'product-review-page-title' => 'Product Review',
'rating-reviews' => 'Rating & Reviews',
'submit' => 'SUBMIT',
'delete-all' => 'All Reviews has deleted Succesfully'
],
'customer' => [

View File

@ -16,6 +16,13 @@
<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.review.index.title') }}</span>
@if(count($reviews) > 1)
<div class="account-action">
<a href="{{ route('customer.review.deleteall') }}">{{ __('shop::app.wishlist.deleteall') }}</a>
</div>
@endif
<span></span>
<div class="horizontal-rule"></div>
</div>

View File

@ -14,7 +14,7 @@
@if(count($items))
<div class="account-action">
<a href="{{ route('customer.wishlist.removeall') }}" style="margin-right: 15px;">{{ __('shop::app.wishlist.deleteall') }}</a>
<a href="{{ route('customer.wishlist.removeall') }}">{{ __('shop::app.wishlist.deleteall') }}</a>
</div>
@endif
<div class="horizontal-rule"></div>