Merge pull request #751 from rahulshukla-webkul/development
Development
This commit is contained in:
commit
e5505aad1c
|
|
@ -19,7 +19,7 @@ class TaxRateDataGrid extends DataGrid
|
|||
|
||||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = DB::table('tax_rates')->addSelect('id', 'identifier', 'state', 'country', 'tax_rate');
|
||||
$queryBuilder = DB::table('tax_rates')->addSelect('id', 'identifier', 'state', 'country', 'zip_code', 'zip_from', 'zip_to', 'tax_rate');
|
||||
|
||||
$this->setQueryBuilder($queryBuilder);
|
||||
}
|
||||
|
|
@ -62,6 +62,33 @@ class TaxRateDataGrid extends DataGrid
|
|||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'zip_code',
|
||||
'label' => trans('admin::app.configuration.tax-rates.zip_code'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'zip_from',
|
||||
'label' => trans('admin::app.configuration.tax-rates.zip_from'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'zip_to',
|
||||
'label' => trans('admin::app.configuration.tax-rates.zip_to'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'filterable' => true
|
||||
]);
|
||||
|
||||
$this->addColumn([
|
||||
'index' => 'tax_rate',
|
||||
'label' => trans('admin::app.datagrid.tax-rate'),
|
||||
|
|
|
|||
|
|
@ -94,8 +94,8 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('description') ? 'has-error' : '']">
|
||||
<label for="description" class="required">{{ __('admin::app.catalog.categories.description') }}</label>
|
||||
<textarea v-validate="'required'" class="control" id="description" name="description" data-vv-as=""{{ __('admin::app.catalog.categories.description') }}"">{{ old('description') }}</textarea>
|
||||
<label for="description" id="descript-label" class="required">{{ __('admin::app.catalog.categories.description') }}</label>
|
||||
<textarea v-validate="''" class="control" id="description" name="description" data-vv-as=""{{ __('admin::app.catalog.categories.description') }}"">{{ old('description') }}</textarea>
|
||||
<span class="control-error" v-if="errors.has('description')">@{{ errors.first('description') }}</span>
|
||||
</div>
|
||||
|
||||
|
|
@ -189,6 +189,14 @@
|
|||
toolbar1: 'formatselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat | code',
|
||||
image_advtab: true
|
||||
});
|
||||
|
||||
$('#display_mode').on('change', function (e) {
|
||||
if ($('#display_mode').val() != 'products_only') {
|
||||
$("#descript-label").addClass("required");
|
||||
} else {
|
||||
$("#descript-label").removeClass("required");
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
|
@ -107,8 +107,8 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('{{$locale}}[description]') ? 'has-error' : '']">
|
||||
<label for="description" class="required">{{ __('admin::app.catalog.categories.description') }}</label>
|
||||
<textarea v-validate="'required'" class="control" id="description" name="{{$locale}}[description]" data-vv-as=""{{ __('admin::app.catalog.categories.description') }}"">{{ old($locale)['description'] ?: $category->translate($locale)['description'] }}</textarea>
|
||||
<label for="description">{{ __('admin::app.catalog.categories.description') }}</label>
|
||||
<textarea class="control" id="description" name="{{$locale}}[description]" data-vv-as=""{{ __('admin::app.catalog.categories.description') }}"">{{ old($locale)['description'] ?: $category->translate($locale)['description'] }}</textarea>
|
||||
<span class="control-error" v-if="errors.has('{{$locale}}[description]')">@{{ errors.first('{!!$locale!!}[description]') }}</span>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,8 @@ class CategoryController extends Controller
|
|||
$this->validate(request(), [
|
||||
'slug' => ['required', 'unique:category_translations,slug', new \Webkul\Core\Contracts\Validations\Slug],
|
||||
'name' => 'required',
|
||||
'image.*' => 'mimes:jpeg,jpg,bmp,png'
|
||||
'image.*' => 'mimes:jpeg,jpg,bmp,png',
|
||||
'description' => 'required_if:display_mode,==,description_only,products_and_description'
|
||||
]);
|
||||
|
||||
if (strtolower(request()->input('name')) == 'root') {
|
||||
|
|
|
|||
|
|
@ -37,9 +37,17 @@ class SearchRepository extends Repository
|
|||
}
|
||||
|
||||
public function search($data) {
|
||||
$term = $data['term'];
|
||||
$query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
|
||||
$searchTerm = explode("?", $query);
|
||||
$serachQuery = '';
|
||||
|
||||
$products = $this->product->searchProductByAttribute($term);
|
||||
foreach($searchTerm as $term){
|
||||
if (strpos($term, 'term') !== false) {
|
||||
$serachQuery = last(explode("=", $term));
|
||||
}
|
||||
}
|
||||
|
||||
$products = $this->product->searchProductByAttribute($serachQuery);
|
||||
|
||||
return $products;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace Webkul\Sales\Repositories;
|
|||
|
||||
use Illuminate\Container\Container as App;
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
/**
|
||||
* ShipmentItem Reposotory
|
||||
|
|
@ -31,16 +32,16 @@ class ShipmentItemRepository extends Repository
|
|||
{
|
||||
if (! $data['product'])
|
||||
return;
|
||||
|
||||
|
||||
$orderedInventory = $data['product']->ordered_inventories()
|
||||
->where('channel_id', $data['shipment']->order->channel->id)
|
||||
->first();
|
||||
|
||||
|
||||
if ($orderedInventory) {
|
||||
if (($orderedQty = $orderedInventory->qty - $data['qty']) < 0) {
|
||||
$orderedQty = 0;
|
||||
}
|
||||
|
||||
|
||||
$orderedInventory->update([
|
||||
'qty' => $orderedQty
|
||||
]);
|
||||
|
|
@ -59,7 +60,7 @@ class ShipmentItemRepository extends Repository
|
|||
|
||||
if (!$inventory)
|
||||
return;
|
||||
|
||||
|
||||
if (($qty = $inventory->qty - $data['qty']) < 0) {
|
||||
$qty = 0;
|
||||
}
|
||||
|
|
@ -67,5 +68,7 @@ class ShipmentItemRepository extends Repository
|
|||
$inventory->update([
|
||||
'qty' => $qty
|
||||
]);
|
||||
|
||||
Event::fire('catalog.product.update.after', $data['product']);
|
||||
}
|
||||
}
|
||||
|
|
@ -46,6 +46,8 @@ class CartController extends Controller
|
|||
|
||||
protected $productView;
|
||||
|
||||
protected $suppressFlash = false;
|
||||
|
||||
public function __construct(
|
||||
CartRepository $cart,
|
||||
CartItemRepository $cartItem,
|
||||
|
|
@ -102,7 +104,7 @@ class CartController extends Controller
|
|||
if ($result) {
|
||||
session()->flash('success', trans('shop::app.checkout.cart.item.success'));
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
return redirect()->back();
|
||||
} else {
|
||||
session()->flash('warning', trans('shop::app.checkout.cart.item.error-add'));
|
||||
|
||||
|
|
@ -153,7 +155,6 @@ class CartController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($request['qty'] as $key => $value) {
|
||||
$item = $this->cartItem->findOneByField('id', $key);
|
||||
|
||||
|
|
@ -161,7 +162,11 @@ class CartController extends Controller
|
|||
|
||||
Event::fire('checkout.cart.update.before', $key);
|
||||
|
||||
Cart::updateItem($item->product_id, $data, $key);
|
||||
$result = Cart::updateItem($item->product_id, $data, $key);
|
||||
|
||||
if ($result == false) {
|
||||
$this->suppressFlash = true;
|
||||
}
|
||||
|
||||
Event::fire('checkout.cart.update.after', $item);
|
||||
|
||||
|
|
@ -171,6 +176,12 @@ class CartController extends Controller
|
|||
|
||||
Cart::collectTotals();
|
||||
|
||||
if ($this->suppressFlash) {
|
||||
session()->forget('success');
|
||||
session()->forget('warning');
|
||||
session()->flash('info', trans('shop::app.checkout.cart.partial-cart-update'));
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,17 @@ class Currency
|
|||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($currency = $request->get('currency')) {
|
||||
$query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
|
||||
$currencyTerm = explode("?", $query);
|
||||
$currencyCode = '';
|
||||
|
||||
foreach($currencyTerm as $term){
|
||||
if (strpos($term, 'currency') !== false) {
|
||||
$currencyCode = last(explode("=", $term));
|
||||
}
|
||||
}
|
||||
|
||||
if ($currency = $currencyCode) {
|
||||
if ($this->currency->findOneByField('code', $currency)) {
|
||||
session()->put('currency', $currency);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,17 @@ class Locale
|
|||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($locale = $request->get('locale')) {
|
||||
$query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
|
||||
$localeTerm = explode("?", $query);
|
||||
$localCode = '';
|
||||
|
||||
foreach($localeTerm as $term){
|
||||
if (strpos($term, 'locale') !== false) {
|
||||
$localCode = last(explode("=", $term));
|
||||
}
|
||||
}
|
||||
|
||||
if ($locale = $localCode) {
|
||||
if ($this->locale->findOneByField('code', $locale)) {
|
||||
app()->setLocale($locale);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ return [
|
|||
'wishlist' => 'قائمة الأماني',
|
||||
'orders' => 'الأوامر',
|
||||
],
|
||||
|
||||
|
||||
'common' => [
|
||||
'error' => 'حدث شيء خاطئ ، رجاء حاول ثانية لاحقا.'
|
||||
],
|
||||
|
|
@ -385,7 +385,8 @@ return [
|
|||
],
|
||||
'quantity-error' => 'الكمية المطلوبة غير متوفرة',
|
||||
'cart-subtotal' => 'المجموع الفرعي للعربات',
|
||||
'cart-remove-action' => 'هل تريد حقا أن تفعل هذا ؟'
|
||||
'cart-remove-action' => 'هل تريد حقا أن تفعل هذا ؟',
|
||||
'partial-cart-update' => 'Only some of the product(s) were updated'
|
||||
],
|
||||
|
||||
'onepage' => [
|
||||
|
|
|
|||
|
|
@ -389,7 +389,8 @@ return [
|
|||
],
|
||||
'quantity-error' => 'Requested Quantity Is Not Available',
|
||||
'cart-subtotal' => 'Cart Subtotal',
|
||||
'cart-remove-action' => 'Do you really want to do this ?'
|
||||
'cart-remove-action' => 'Do you really want to do this ?',
|
||||
'partial-cart-update' => 'Only some of the product(s) were updated'
|
||||
],
|
||||
|
||||
'onepage' => [
|
||||
|
|
|
|||
|
|
@ -390,7 +390,8 @@ return [
|
|||
],
|
||||
'quantity-error' => 'Quantidade solicitada não está disponível',
|
||||
'cart-subtotal' => 'Subtotal do carrinho',
|
||||
'cart-remove-action' => 'Você realmente quer fazer isso ?'
|
||||
'cart-remove-action' => 'Você realmente quer fazer isso ?',
|
||||
'partial-cart-update' => 'Only some of the product(s) were updated'
|
||||
],
|
||||
|
||||
'onepage' => [
|
||||
|
|
|
|||
|
|
@ -30,13 +30,28 @@
|
|||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
|
||||
$searchTerm = explode("?", $query);
|
||||
|
||||
foreach($searchTerm as $term){
|
||||
if (strpos($term, 'term') !== false) {
|
||||
$serachQuery = $term;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<span class="list-heading">{{ __('shop::app.footer.locale') }}</span>
|
||||
<div class="form-container">
|
||||
<div class="control-group">
|
||||
<select class="control locale-switcher" onchange="window.location.href = this.value">
|
||||
|
||||
@foreach (core()->getCurrentChannel()->locales as $locale)
|
||||
<option value="?locale={{ $locale->code }}" {{ $locale->code == app()->getLocale() ? 'selected' : '' }}>{{ $locale->name }}</option>
|
||||
@if(isset($serachQuery))
|
||||
<option value="?{{ $serachQuery }}?locale={{ $locale->code }}" {{ $locale->code == app()->getLocale() ? 'selected' : '' }}>{{ $locale->name }}</option>
|
||||
@else
|
||||
<option value="?locale={{ $locale->code }}" {{ $locale->code == app()->getLocale() ? 'selected' : '' }}>{{ $locale->name }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
|
|
@ -50,7 +65,11 @@
|
|||
<select class="control locale-switcher" onchange="window.location.href = this.value">
|
||||
|
||||
@foreach (core()->getCurrentChannel()->currencies as $currency)
|
||||
<option value="?currency={{ $currency->code }}" {{ $currency->code == core()->getCurrentCurrencyCode() ? 'selected' : '' }}>{{ $currency->code }}</option>
|
||||
@if(isset($serachQuery))
|
||||
<option value="?{{ $serachQuery }}?currency={{ $currency->code }}" {{ $currency->code == core()->getCurrentCurrencyCode() ? 'selected' : '' }}>{{ $currency->code }}</option>
|
||||
@else
|
||||
<option value="?currency={{ $currency->code }}" {{ $currency->code == core()->getCurrentCurrencyCode() ? 'selected' : '' }}>{{ $currency->code }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -28,6 +28,16 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
|
||||
$searchTerm = explode("?", $query);
|
||||
|
||||
foreach($searchTerm as $term){
|
||||
if (strpos($term, 'term') !== false) {
|
||||
$serachQuery = $term;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="right-content">
|
||||
|
||||
|
|
@ -48,7 +58,11 @@
|
|||
<ul class="dropdown-list currency">
|
||||
@foreach (core()->getCurrentChannel()->currencies as $currency)
|
||||
<li>
|
||||
<a href="?currency={{ $currency->code }}">{{ $currency->code }}</a>
|
||||
@if(isset($serachQuery))
|
||||
<a href="?{{ $serachQuery }}?currency={{ $currency->code }}">{{ $currency->code }}</a>
|
||||
@else
|
||||
<a href="?currency={{ $currency->code }}">{{ $currency->code }}</a>
|
||||
@endif
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -189,11 +189,20 @@ class TaxRateController extends Controller
|
|||
|
||||
foreach ($excelData as $data) {
|
||||
foreach ($data as $column => $uploadData) {
|
||||
|
||||
if (!is_null($uploadData['zip_from']) && !is_null($uploadData['zip_to'])) {
|
||||
$uploadData['is_zip'] = 1;
|
||||
}
|
||||
|
||||
$validator = Validator::make($uploadData, [
|
||||
'identifier' => 'required|string',
|
||||
'state' => 'required|string',
|
||||
'country' => 'required|string',
|
||||
'tax_rate' => 'required|numeric'
|
||||
'tax_rate' => 'required|numeric',
|
||||
'is_zip' => 'sometimes',
|
||||
'zip_code' => 'sometimes|required_without:is_zip',
|
||||
'zip_from' => 'nullable|required_with:is_zip',
|
||||
'zip_to' => 'nullable|required_with:is_zip,zip_from',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
|
@ -230,6 +239,12 @@ class TaxRateController extends Controller
|
|||
$errorMsg[$coulmn] = $fail->first('country');
|
||||
} else if ($fail->first('state')) {
|
||||
$errorMsg[$coulmn] = $fail->first('state');
|
||||
} else if ($fail->first('zip_code')) {
|
||||
$errorMsg[$coulmn] = $fail->first('zip_code');
|
||||
} else if ($fail->first('zip_from')) {
|
||||
$errorMsg[$coulmn] = $fail->first('zip_from');
|
||||
} else if ($fail->first('zip_to')) {
|
||||
$errorMsg[$coulmn] = $fail->first('zip_to');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -250,6 +265,11 @@ class TaxRateController extends Controller
|
|||
|
||||
foreach ($excelData as $data) {
|
||||
foreach ($data as $column => $uploadData) {
|
||||
if (!is_null($uploadData['zip_from']) && !is_null($uploadData['zip_to'])) {
|
||||
$uploadData['is_zip'] = 1;
|
||||
$uploadData['zip_code'] = NULL;
|
||||
}
|
||||
|
||||
if (isset($rateIdentifier)) {
|
||||
$id = array_search($uploadData['identifier'], $rateIdentifier);
|
||||
if ($id) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue