Added back catalog rule migration, a bug is stuck in convert x to productid migrations

This commit is contained in:
Prashant Singh 2019-07-15 19:54:38 +05:30
parent 93a035b147
commit 6ba5e0df0a
7 changed files with 230 additions and 9 deletions

View File

@ -346,7 +346,7 @@
<div class="control-group" :class="[errors.has('category_values') ? 'has-error' : '']">
<label class="mb-10" for="categories">{{ __('admin::app.promotion.select-category') }}</label>
<multiselect v-model="category_values" :options="category_options" :searchable="false" :custom-label="categoryLabel" :show-labels="true" placeholder="Select Categories" track-by="slug" :multiple="true"></multiselect>
<multiselect v-model="category_values" :close-on-select="false" :options="category_options" :searchable="false" :custom-label="categoryLabel" :show-labels="true" placeholder="Select Categories" track-by="slug" :multiple="true"></multiselect>
</div>
<label class="mb-10" for="attributes">{{ __('admin::app.promotion.select-attribute') }}</label><br/>
@ -363,7 +363,7 @@
</select>
<div v-if='attribute_list[index].type == "select" || attribute_list[index].type == "multiselect"' style="display: flex; width: 220px">
<multiselect v-model="attribute_list[index].value" :options="attribute_list[index].options" :custom-label="attributeListLabel(index)" :track-by="attribute_list[index].options.admin_name" :searchable="false" :show-labels="true" placeholder="{{ __('ui::form.select-attribute', ['attribute' => 'Values']) }}" :multiple="true"></multiselect>
<multiselect v-model="attribute_list[index].value" :close-on-select="false" :options="attribute_list[index].options" :custom-label="attributeListLabel" :searchable="false" :show-labels="true" placeholder="{{ __('ui::form.select-attribute', ['attribute' => 'Values']) }}" :track-by="attribute_list[index].value.id" :multiple="true"></multiselect>
</div>
<div v-if='attribute_list[index].type == "text" || attribute_list[index].type == "textarea" || attribute_list[index].type == "price" || attribute_list[index].type == "textarea"' style="display: flex">
@ -489,17 +489,17 @@
}
},
mounted () {
console.log(this.category_options, this.attribute_input[1].options);
},
methods: {
categoryLabel (category_options) {
return category_options.name + ' [ ' + category_options.slug + ' ]';
},
attributeLabel (attribute_options) {
return attribute_options.name + ' [ ' + attribute_options.type + ' ]';
},
attributeListLabel (index) {
console.log(this.attribute_list[index], index);
attributeListLabel(attribute_list_option) {
return attribute_list_option.label + ' [ ' + attribute_list_option.id + ' ]';
},
addCondition () {
@ -562,7 +562,7 @@
for(i in this.attribute_input) {
if (i == selectedIndex) {
if (this.attribute_input[i].has_options == true) {
this.attribute_input[i].options = this.attribute_input[i].options;
this.attribute_list[index].options = this.attribute_input[i].options;
}
this.attribute_list[index].type = this.attribute_input[i].type;

View File

@ -0,0 +1,45 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCatalogRulesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('catalog_rules', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->nullable();
$table->string('description')->nullable();
$table->boolean('is_guest')->default(0);
$table->datetime('starts_from')->nullable();
$table->datetime('ends_till')->nullable();
$table->boolean('status')->default(0);
$table->integer('priority')->unsigned()->default(0);
$table->json('conditions')->nullable();
$table->string('test_mode')->nullable();
$table->json('actions')->nullable();
$table->boolean('end_other_rules')->default(0);
$table->integer('sort_order')->unsigned()->default(0);
$table->string('action_type')->nullable();
$table->decimal('disc_amount', 12, 4)->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('catalog_rules');
}
}

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCatalogRuleProductsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('catalog_rule_products', function (Blueprint $table) {
$table->increments('id');
$table->integer('catalog_rule_id')->unsigned()->unique();
$table->foreign('catalog_rule_id')->references('id')->on('catalog_rules')->onDelete('cascade');
$table->integer('channel_id')->unsigned();
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
$table->integer('customer_group_id')->unsigned();
$table->foreign('customer_group_id')->references('id')->on('customer_groups')->onDelete('cascade');
$table->integer('product_id')->unsigned();
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
$table->string('act_operator')->default('fixed');
$table->decimal('act_amount', 12, 4)->default(0.0000);
$table->unsignedSmallInteger('act_stop')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('catalog_products');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCatalogRuleCustomerGroupsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('catalog_rule_customer_groups', function (Blueprint $table) {
$table->increments('id');
$table->integer('catalog_rule_id')->unsigned();
$table->foreign('catalog_rule_id')->references('id')->on('catalog_rules')->onDelete('cascade');
$table->integer('customer_group_id')->unsigned();
$table->foreign('customer_group_id')->references('id')->on('customer_groups')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('catalog_rule_customer_groups');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCatalogRuleChannelsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('catalog_rule_channels', function (Blueprint $table) {
$table->increments('id');
$table->integer('catalog_rule_id')->unsigned();
$table->foreign('catalog_rule_id')->references('id')->on('catalog_rules')->onDelete('cascade');
$table->integer('channel_id')->unsigned();
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('catalog_rule_channels');
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCatalogRuleProductsPriceTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('catalog_rule_products_price', function (Blueprint $table) {
$table->increments('id');
$table->integer('cart_rule_product_id')->unsigned();
$table->foreign('cart_rule_product_id')->references('id')->on('cart_rules')->onDelete('cascade');
$table->datetime('starts_from')->nullable();
$table->datetime('ends_till')->nullable();
$table->decimal('price', 12, 4)->default(0.0000);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cart_rule_products_price');
}
}

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCatalogRuleProductsPrice extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}