Merge pull request #2903 from Haendlerbund/unnecessary-channel-for-taxes

Bugfix: Channel assigned to tax category
This commit is contained in:
Jitendra Singh 2020-04-24 18:03:48 +05:30 committed by GitHub
commit da9382d090
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 39 additions and 39 deletions

View File

@ -26,22 +26,6 @@
<div class="form-container">
@csrf()
<div class="control-group" :class="[errors.has('channel') ? 'has-error' : '']">
<label for="channel" class="required">{{ __('admin::app.configuration.tax-categories.select-channel') }}</label>
<select class="control" name="channel_id">
@foreach (core()->getAllChannels() as $channelModel)
<option value="{{ $channelModel->id }}">
{{ $channelModel->name }}
</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('channel')">@{{ errors.first('channel') }}</span>
</div>
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
<label for="code" class="required">{{ __('admin::app.configuration.tax-categories.code') }}</label>
@ -67,7 +51,7 @@
</div>
<?php $selectedOptions = old('taxrates') ?: [] ?>
<div class="control-group" :class="[errors.has('taxrates[]') ? 'has-error' : '']">
<label for="taxrates" class="required">{{ __('admin::app.configuration.tax-categories.select-taxrates') }}</label>

View File

@ -27,22 +27,6 @@
<div class="form-container">
@csrf()
@method('PUT')
<div class="control-group" :class="[errors.has('channel') ? 'has-error' : '']">
<label for="channel" class="required">{{ __('admin::app.settings.tax-categories.select-channel') }}</label>
<select class="control" name="channel_id">
@foreach (core()->getAllChannels() as $channelModel)
<option @if ($taxCategory->channel_id == $channelModel->id) selected @endif value="{{ $channelModel->id }}">
{{ $channelModel->name }}
</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('channel')">@{{ errors.first('channel') }}</span>
</div>
<div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
<label for="code" class="required">{{ __('admin::app.settings.tax-categories.code') }}</label>

View File

@ -7,9 +7,6 @@ use Webkul\Tax\Models\TaxCategory;
$factory->define(TaxCategory::class, function (Faker $faker) {
return [
'channel_id' => function () {
return core()->getCurrentChannel()->id;
},
'code' => $faker->uuid,
'name' => $faker->words(2, true),
'description' => $faker->sentence(10),

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RemoveChannelFromTaxCategory extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('tax_categories', function (Blueprint $table) {
$table->dropForeign('tax_categories_channel_id_foreign');
$table->dropColumn('channel_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('tax_categories', function (Blueprint $table) {
$table->integer('channel_id')->unsigned()->after('id');
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
});
}
}

View File

@ -68,7 +68,6 @@ class TaxCategoryController extends Controller
$data = request()->input();
$this->validate(request(), [
'channel_id' => 'required|numeric',
'code' => 'required|string|unique:tax_categories,code',
'name' => 'required|string',
'description' => 'required|string',
@ -111,7 +110,6 @@ class TaxCategoryController extends Controller
public function update($id)
{
$this->validate(request(), [
'channel_id' => 'required|numeric',
'code' => 'required|string|unique:tax_categories,code,' . $id,
'name' => 'required|string',
'description' => 'required|string',

View File

@ -16,7 +16,6 @@ class TaxCategory extends Model implements TaxCategoryContract
protected $table = 'tax_categories';
protected $fillable = [
'channel_id',
'code',
'name',
'description',

4
public/mix-manifest.json Normal file
View File

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