Bug fixes in tax rate and categories

This commit is contained in:
prashant-webkul 2018-10-09 17:34:25 +05:30
parent 301eb1959f
commit 36102ac040
12 changed files with 106 additions and 69 deletions

View File

@ -58,8 +58,6 @@ class ProductDataGrid
], ],
'join' => [ 'join' => [
//for getting name of attrib family.
[ [
'join' => 'leftjoin', 'join' => 'leftjoin',
'table' => 'attribute_families as attfam', 'table' => 'attribute_families as attfam',
@ -69,19 +67,19 @@ class ProductDataGrid
], ],
//for getting the attribute values. //for getting the attribute values.
[ // [
'join' => 'leftjoin', // 'join' => 'leftjoin',
'table' => 'product_attribute_values as pav', // 'table' => 'product_attribute_values as pav',
'primaryKey' => 'prods.id', // 'primaryKey' => 'prods.id',
'condition' => '=', // 'condition' => '=',
'secondaryKey' => 'pav.product_id', // 'secondaryKey' => 'pav.product_id',
'withAttributes' => [ // 'withAttributes' => [
'condition' => [ // 'condition' => [
'attribute_id' => 2, // 'attribute_id' => 2,
'select' => 'name', // 'select' => 'name',
] // ]
] // ]
], // ],
// for getting the inventory quantity of a product // for getting the inventory quantity of a product
[ [

View File

@ -92,7 +92,7 @@ class EventServiceProvider extends ServiceProvider
$menu->add('settings.tax', 'Taxes', 'admin.taxrule.index', 9, ''); $menu->add('settings.tax', 'Taxes', 'admin.taxrule.index', 9, '');
$menu->add('settings.tax.taxrule', 'Add Tax Rules', 'admin.taxrule.index', 1, ''); $menu->add('settings.tax.taxrule', 'Add Tax Category', 'admin.taxrule.index', 1, '');
$menu->add('settings.tax.taxrate', 'Add Tax Rates', 'admin.taxrate.index', 2, ''); $menu->add('settings.tax.taxrate', 'Add Tax Rates', 'admin.taxrate.index', 2, '');
}); });

View File

@ -179,22 +179,24 @@ return [
'configuration' => [ 'configuration' => [
'tax' => [ 'tax' => [
'title' => 'Taxes', 'title' => 'Taxes',
'add-title' => 'Add Tax Rule' 'add-title' => 'Add Tax Category'
], ],
'taxrule' => [ 'taxrule' => [
'title' => 'Add Tax Rule', 'title' => 'Add Tax Category',
'create' => 'Create Tax Rule', 'create' => 'Create Tax Category',
'general' => 'Tax Rule', 'general' => 'Tax Category',
'select-channel' => 'Select Channel', 'select-channel' => 'Select Channel',
'name' => 'Name', 'name' => 'Name',
'code' => 'Code', 'code' => 'Code',
'description' => 'Description', 'description' => 'Description',
'select-taxrates' => 'Select Tax Rates', 'select-taxrates' => 'Select Tax Rates',
'edit' => [ 'edit' => [
'title' => 'Edit Tax Rule', 'title' => 'Edit Tax Category',
'edit-button-title' => 'Edit Rule' 'edit-button-title' => 'Edit Tax Category'
] ]
], ],
'taxrate' => [ 'taxrate' => [
'title' => 'Add Tax Rate', 'title' => 'Add Tax Rate',
'general' => 'Tax Rate', 'general' => 'Tax Rate',
@ -208,7 +210,8 @@ return [
'edit' => [ 'edit' => [
'title' => 'Edit Tax Rate', 'title' => 'Edit Tax Rate',
'edit-button-title' => 'Edit Rate' 'edit-button-title' => 'Edit Rate'
] ],
'zip_code' => 'Zip Code'
], ],
], ],

View File

@ -34,32 +34,6 @@
<span class="control-error" v-if="errors.has('identifier')">@{{ errors.first('identifier') }}</span> <span class="control-error" v-if="errors.has('identifier')">@{{ errors.first('identifier') }}</span>
</div> </div>
<div class="control-group">
<span class="checkbox">
<input type="checkbox" id="is_zip" name="is_zip">
<label class="checkbox-view" for="is_zip"></label>
Enable Zip Range
</span>
</div>
<div class="control-group" :class="[errors.has('zip_from') ? 'has-error' : '']">
<label for="zip_from" class="required">{{ __('admin::app.configuration.taxrate.zip_from') }}</label>
<input v-validate="'numeric'" class="control" id="zip_from" name="zip_from" value="{{ old('zip_from') }}"/>
<span class="control-error" v-if="errors.has('zip_from')">@{{ errors.first('zip_from') }}</span>
</div>
<div class="control-group" :class="[errors.has('zip_to') ? 'has-error' : '']">
<label for="zip_to" class="required">{{ __('admin::app.configuration.taxrate.zip_to') }}</label>
<input v-validate="'numeric'" class="control" id="zip_to" name="zip_to" value="{{ old('zip_to') }}"/>
<span class="control-error" v-if="errors.has('zip_to')">@{{ errors.first('zip_to') }}</span>
</div>
<div class="control-group" :class="[errors.has('state') ? 'has-error' : '']"> <div class="control-group" :class="[errors.has('state') ? 'has-error' : '']">
<label for="state" class="required">{{ __('admin::app.configuration.taxrate.state') }}</label> <label for="state" class="required">{{ __('admin::app.configuration.taxrate.state') }}</label>
@ -76,6 +50,40 @@
<span class="control-error" v-if="errors.has('country')">@{{ errors.first('country') }}</span> <span class="control-error" v-if="errors.has('country')">@{{ errors.first('country') }}</span>
</div> </div>
<div class="control-group">
<span class="checkbox">
<input type="checkbox" id="is_zip" name="is_zip" id="is_zip" onclick="myFunction()" value="{{ old('is_zip') }}">
<label class="checkbox-view" for="is_zip"></label>
Enable Zip Range
</span>
</div>
<div class="control-group" :class="[errors.has('zip_code') ? 'has-error' : '']" id="zip_code">
<label for="zip_code" class="required">{{ __('admin::app.configuration.taxrate.zip_code') }}</label>
<input class="control" id="zip_code" name="zip_code" value="{{ old('zip_code') }}"/>
<span class="control-error" v-if="errors.has('zip_code')">@{{ errors.first('zip_code') }}</span>
</div>
<div class="control-group" :class="[errors.has('zip_from') ? 'has-error' : '']" id="zip_from">
<label for="zip_from" class="required">{{ __('admin::app.configuration.taxrate.zip_from') }}</label>
<input v-validate="'numeric'" class="control" id="zip_from" name="zip_from" value="{{ old('zip_from') }}"/>
<span class="control-error" v-if="errors.has('zip_from')">@{{ errors.first('zip_from') }}</span>
</div>
<div class="control-group" :class="[errors.has('zip_to') ? 'has-error' : '']" id="zip_to">
<label for="zip_to" class="required">{{ __('admin::app.configuration.taxrate.zip_to') }}</label>
<input v-validate="'numeric'" class="control" id="zip_to" name="zip_to" value="{{ old('zip_to') }}"/>
<span class="control-error" v-if="errors.has('zip_to')">@{{ errors.first('zip_to') }}</span>
</div>
<div class="control-group" :class="[errors.has('tax_rate') ? 'has-error' : '']"> <div class="control-group" :class="[errors.has('tax_rate') ? 'has-error' : '']">
<label for="tax_rate" class="required">{{ __('admin::app.configuration.taxrate.tax_rate') }}</label> <label for="tax_rate" class="required">{{ __('admin::app.configuration.taxrate.tax_rate') }}</label>
@ -90,4 +98,34 @@
</div> </div>
</form> </form>
</div> </div>
@push('scripts')
<script>
window.onload = function () {
document.getElementById("zip_from").style.display = "none";
document.getElementById("zip_to").style.display = "none";
};
function myFunction() {
value = document.getElementById('is_zip').checked;
if(value) {
document.getElementById("zip_from").style.display = "";
document.getElementById("zip_to").style.display = "";
document.getElementById("zip_code").style.display = "none";
} else {
document.getElementById("zip_from").style.display = "none";
document.getElementById("zip_to").style.display = "none";
document.getElementById("zip_code").style.display = "";
}
console.log("Value = ", value);
}
</script>
@endpush
@stop @stop

View File

@ -153,7 +153,7 @@ class Cart {
'total_weight' => $product->weight * $data['quantity'], 'total_weight' => $product->weight * $data['quantity'],
'base_total_weight' => $product->weight * $data['quantity'], 'base_total_weight' => $product->weight * $data['quantity'],
]; ];
return ['parent' => $parentData, 'child' => null]; return ['parent' => $parentData, 'child' => null];
} }
} }
@ -703,8 +703,6 @@ class Cart {
$canBe = $this->canAddOrUpdate($cartItem->id, $prevQty + $newQty); $canBe = $this->canAddOrUpdate($cartItem->id, $prevQty + $newQty);
if($canBe == false) { if($canBe == false) {
session()->flash('warning', 'The requested quantity is not available, please try back later.');
return redirect()->back(); return redirect()->back();
} }
@ -813,7 +811,7 @@ class Cart {
if(!$this->isItemsHaveSufficientQuantity()) if(!$this->isItemsHaveSufficientQuantity())
return true; return true;
return false; return false;
} }
@ -846,7 +844,7 @@ class Cart {
return true; return true;
} }
/** /**
* Deactivates current cart * Deactivates current cart

View File

@ -20,15 +20,17 @@ class CreateTaxRatesTable extends Migration
$table->boolean('is_zip_from')->default(0); $table->boolean('is_zip_from')->default(0);
$table->integer('zip_from')->unsigned()->nullable(); $table->string('zip_code')->nullable();
$table->integer('zip_to')->unsigned()->nullable(); $table->string('zip_from')->nullable();
$table->string('zip_to')->nullable();
$table->string('state'); $table->string('state');
$table->string('country'); $table->string('country');
$table->float('tax_rate', 6, 4); $table->float('tax_rate', 12, 4);
$table->timestamps(); $table->timestamps();
}); });

View File

@ -77,6 +77,7 @@ class TaxRateController extends Controller
$this->validate(request(), [ $this->validate(request(), [
'identifier' => 'required|string|unique:tax_rates,identifier', 'identifier' => 'required|string|unique:tax_rates,identifier',
'is_zip' => 'sometimes|confirmed', 'is_zip' => 'sometimes|confirmed',
'zip_code' => 'sometimes|required_without:is_zip',
'zip_from' => 'nullable|numeric|required_with:is_zip', 'zip_from' => 'nullable|numeric|required_with:is_zip',
'zip_to' => 'nullable|numeric|required_with:is_zip,zip_from', 'zip_to' => 'nullable|numeric|required_with:is_zip,zip_from',
'state' => 'required|string', 'state' => 'required|string',
@ -94,6 +95,8 @@ class TaxRateController extends Controller
return redirect()->back(); return redirect()->back();
} }
Session()->flash('warning', 'System Cannot Identify the cause of this error, contact system administrator.');
return redirect()->back(); return redirect()->back();
} }

View File

@ -16,7 +16,7 @@ class TaxRate extends Model
protected $table = 'tax_rates'; protected $table = 'tax_rates';
protected $fillable = [ protected $fillable = [
'identifier', 'is_zip_from', 'zip_from', 'zip_to', 'state', 'country', 'tax_rate' 'identifier', 'is_zip_from', 'zip_code', 'zip_from', 'zip_to', 'state', 'country', 'tax_rate'
]; ];
public function tax_categories() { public function tax_categories() {

View File

@ -1,7 +1,6 @@
<?php <?php
Route::group(['middleware' => ['web']], function () { Route::group(['middleware' => ['web']], function () {
Route::get('/', 'Webkul\Shop\Http\Controllers\HomeController@index')->defaults('_config', [ Route::get('/', 'Webkul\Shop\Http\Controllers\HomeController@index')->defaults('_config', [
'view' => 'shop::home.index' 'view' => 'shop::home.index'
])->name('shop.home.index'); ])->name('shop.home.index');

View File

@ -1,4 +1,4 @@
<div class="{{ $css->datagrid }}"> {{-- <div class="{{ $css->datagrid }}">
<table class="{{ $css->table }}"> <table class="{{ $css->table }}">
<thread class="{{ $css->thread }}"> <thread class="{{ $css->thread }}">
<tr> <tr>
@ -15,4 +15,4 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div> --}}

View File

@ -1,4 +1,4 @@
<div class="grid-container{{-- $css->datagrid --}}"> <div class="grid-container {{-- $css->datagrid --}}">
{{-- For loading the filters from includes directory file --}} {{-- For loading the filters from includes directory file --}}
@include('ui::datagrid.filters.default') @include('ui::datagrid.filters.default')
@ -53,7 +53,7 @@
$('.search-btn').click(function() { $('.search-btn').click(function() {
search_value = $(".search-field").val(); search_value = $(".search-field").val();
formURL('search','all',search_value,params); //format for search formURL('search','all', search_value, params); //format for search
}); });
//controls for header when sorting is done //controls for header when sorting is done

File diff suppressed because one or more lines are too long