Merge pull request #4801 from devansh-webkul/issue-4519
Zip Mandatory Removed On Disabled Zip Range #4519
This commit is contained in:
commit
da1dadd2fe
|
|
@ -57,8 +57,8 @@
|
|||
</div>
|
||||
|
||||
<div v-if="! is_zip" class="control-group" :class="[errors.has('zip_code') ? 'has-error' : '']" id="zip_code">
|
||||
<label for="zip_code" class="required">{{ __('admin::app.configuration.tax-rates.zip_code') }}</label>
|
||||
<input v-validate="'required'" class="control" id="zip_code" name="zip_code" data-vv-as=""{{ __('admin::app.configuration.tax-rates.zip_code') }}"" value="{{ old('zip_code') }}"/>
|
||||
<label for="zip_code">{{ __('admin::app.configuration.tax-rates.zip_code') }}</label>
|
||||
<input class="control" id="zip_code" name="zip_code" data-vv-as=""{{ __('admin::app.configuration.tax-rates.zip_code') }}"" value="{{ old('zip_code') }}"/>
|
||||
<span class="control-error" v-if="errors.has('zip_code')">@{{ errors.first('zip_code') }}</span>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@
|
|||
</div>
|
||||
@else
|
||||
<div class="control-group" :class="[errors.has('zip_code') ? 'has-error' : '']">
|
||||
<label for="zip_code" class="required">{{ __('admin::app.configuration.tax-rates.zip_code') }}</label>
|
||||
<input v-validate="'required'" class="control" id="zip_code" name="zip_code" data-vv-as=""{{ __('admin::app.configuration.tax-rates.zip_code') }}"" value="{{ old('zip_code') ?: $taxRate->zip_code }}" />
|
||||
<label for="zip_code">{{ __('admin::app.configuration.tax-rates.zip_code') }}</label>
|
||||
<input class="control" id="zip_code" name="zip_code" data-vv-as=""{{ __('admin::app.configuration.tax-rates.zip_code') }}"" value="{{ old('zip_code') ?: $taxRate->zip_code }}" />
|
||||
<span class="control-error" v-if="errors.has('zip_code')">@{{ errors.first('zip_code') }}</span>
|
||||
</div>
|
||||
@endif
|
||||
|
|
|
|||
|
|
@ -692,7 +692,7 @@ class Cart
|
|||
}
|
||||
|
||||
if (! $rate->is_zip) {
|
||||
if ($rate->zip_code == '*' || $rate->zip_code == $address->postcode) {
|
||||
if (empty($rate->zip_code) || in_array($rate->zip_code, ['*', $address->postcode])) {
|
||||
$haveTaxRate = true;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -3,16 +3,15 @@
|
|||
namespace Webkul\Tax\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Tax\Repositories\TaxRateRepository;
|
||||
use Webkul\Admin\Imports\DataGridImport;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Excel;
|
||||
use Maatwebsite\Excel\Validators\Failure;
|
||||
use Webkul\Tax\Repositories\TaxRateRepository;
|
||||
|
||||
class TaxRateController extends Controller
|
||||
{
|
||||
/**
|
||||
* Contains route related configuration
|
||||
* Contains route related configuration.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
|
@ -49,7 +48,7 @@ class TaxRateController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Display a create form for tax rate
|
||||
* Display a create form for tax rate.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
|
|
@ -59,7 +58,7 @@ class TaxRateController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Create the tax rate
|
||||
* Create the tax rate.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
|
|
@ -68,7 +67,7 @@ class TaxRateController extends Controller
|
|||
$this->validate(request(), [
|
||||
'identifier' => 'required|string|unique:tax_rates,identifier',
|
||||
'is_zip' => 'sometimes',
|
||||
'zip_code' => 'sometimes|required_without:is_zip',
|
||||
'zip_code' => 'nullable',
|
||||
'zip_from' => 'nullable|required_with:is_zip',
|
||||
'zip_to' => 'nullable|required_with:is_zip,zip_from',
|
||||
'country' => 'required|string',
|
||||
|
|
@ -108,7 +107,7 @@ class TaxRateController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Edit the previous tax rate
|
||||
* Edit the previous tax rate.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
|
|
@ -163,7 +162,7 @@ class TaxRateController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* import function for the upload
|
||||
* import function for the upload.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
|
|
@ -190,7 +189,7 @@ class TaxRateController extends Controller
|
|||
'country' => 'required|string',
|
||||
'tax_rate' => 'required|numeric|min:0.0001',
|
||||
'is_zip' => 'sometimes',
|
||||
'zip_code' => 'sometimes|required_without:is_zip',
|
||||
'zip_code' => 'nullable',
|
||||
'zip_from' => 'nullable|required_with:is_zip',
|
||||
'zip_to' => 'nullable|required_with:is_zip,zip_from',
|
||||
]);
|
||||
|
|
@ -263,7 +262,7 @@ class TaxRateController extends Controller
|
|||
|
||||
if (isset($rateIdentifier)) {
|
||||
$id = array_search($uploadData['identifier'], $rateIdentifier);
|
||||
|
||||
|
||||
if ($id) {
|
||||
$this->taxRateRepository->update($uploadData, $id);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue