¨4.0.1¨
This commit is contained in:
@@ -14,6 +14,7 @@ class AttributeSetTabs extends Tabs
|
||||
->add($this->general());
|
||||
}
|
||||
|
||||
|
||||
private function general()
|
||||
{
|
||||
return tap(new Tab('general', trans('attribute::attribute_sets.tabs.general')), function (Tab $tab) {
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
namespace Modules\Attribute\Admin;
|
||||
|
||||
use Modules\Admin\Ui\AdminTable;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class AttributeTable extends AdminTable
|
||||
{
|
||||
/**
|
||||
* Make table response for the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function make()
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@ class AttributeTabs extends Tabs
|
||||
->add($this->values());
|
||||
}
|
||||
|
||||
|
||||
private function general()
|
||||
{
|
||||
return tap(new Tab('general', trans('attribute::admin.tabs.general')), function (Tab $tab) {
|
||||
@@ -30,12 +31,14 @@ class AttributeTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function getAttributeSets()
|
||||
{
|
||||
return AttributeSet::all()->sortBy('name')->pluck('name', 'id')
|
||||
->prepend(trans('admin::admin.form.please_select'), '');
|
||||
}
|
||||
|
||||
|
||||
private function values()
|
||||
{
|
||||
return tap(new Tab('values', trans('attribute::admin.tabs.values')), function (Tab $tab) {
|
||||
|
||||
@@ -19,6 +19,7 @@ class CreateAttributeSetsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -24,6 +24,7 @@ class CreateAttributeSetTranslationsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -23,6 +23,7 @@ class CreateAttributesTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -24,6 +24,7 @@ class CreateAttributeTranslationsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -23,6 +23,7 @@ class CreateProductAttributesTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -23,6 +23,7 @@ class CreateAttributeValuesTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -24,6 +24,7 @@ class CreateAttributeValueTranslationsTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -23,6 +23,7 @@ class CreateProductAttributeValuesTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -23,6 +23,7 @@ class CreateAttributeCategoriesTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -18,6 +18,7 @@ class AddSlugColumnToAttributesTable extends Migration
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
||||
@@ -12,20 +12,24 @@ class Attribute extends Model
|
||||
{
|
||||
use Translatable, Sluggable;
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatedAttributes = ['name'];
|
||||
/**
|
||||
* The relations to eager load on every query.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $with = ['translations'];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['attribute_set_id', 'slug', 'is_filterable'];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*
|
||||
@@ -34,14 +38,6 @@ class Attribute extends Model
|
||||
protected $casts = [
|
||||
'is_filterable' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatedAttributes = ['name'];
|
||||
|
||||
/**
|
||||
* The attribute that will be slugged.
|
||||
*
|
||||
@@ -49,6 +45,7 @@ class Attribute extends Model
|
||||
*/
|
||||
protected $slugAttribute = 'name';
|
||||
|
||||
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
@@ -61,25 +58,6 @@ class Attribute extends Model
|
||||
});
|
||||
}
|
||||
|
||||
public function attributeSet()
|
||||
{
|
||||
return $this->belongsTo(AttributeSet::class);
|
||||
}
|
||||
|
||||
public function categories()
|
||||
{
|
||||
return $this->belongsToMany(Category::class, 'attribute_categories');
|
||||
}
|
||||
|
||||
public function values()
|
||||
{
|
||||
return $this->hasMany(AttributeValue::class)->orderBy('position');
|
||||
}
|
||||
|
||||
public function table()
|
||||
{
|
||||
return new AttributeTable($this->with('attributeSet'));
|
||||
}
|
||||
|
||||
public function saveRelations(array $attributes)
|
||||
{
|
||||
@@ -87,6 +65,13 @@ class Attribute extends Model
|
||||
$this->saveValues(array_get($attributes, 'values', []));
|
||||
}
|
||||
|
||||
|
||||
public function categories()
|
||||
{
|
||||
return $this->belongsToMany(Category::class, 'attribute_categories');
|
||||
}
|
||||
|
||||
|
||||
public function saveValues($values = [])
|
||||
{
|
||||
$ids = $this->getDeleteCandidates($values);
|
||||
@@ -103,6 +88,25 @@ class Attribute extends Model
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function values()
|
||||
{
|
||||
return $this->hasMany(AttributeValue::class)->orderBy('position');
|
||||
}
|
||||
|
||||
|
||||
public function attributeSet()
|
||||
{
|
||||
return $this->belongsTo(AttributeSet::class);
|
||||
}
|
||||
|
||||
|
||||
public function table()
|
||||
{
|
||||
return new AttributeTable($this->with('attributeSet'));
|
||||
}
|
||||
|
||||
|
||||
private function getDeleteCandidates($values = [])
|
||||
{
|
||||
return $this->values()
|
||||
|
||||
@@ -10,13 +10,18 @@ class AttributeSet extends Model
|
||||
{
|
||||
use Translatable;
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatedAttributes = ['name'];
|
||||
/**
|
||||
* The relations to eager load on every query.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $with = ['translations'];
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
*
|
||||
@@ -24,18 +29,13 @@ class AttributeSet extends Model
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatedAttributes = ['name'];
|
||||
|
||||
public function attributes()
|
||||
{
|
||||
return $this->hasMany(Attribute::class);
|
||||
}
|
||||
|
||||
|
||||
public function table()
|
||||
{
|
||||
return new AdminTable($this->newQuery());
|
||||
|
||||
@@ -9,24 +9,22 @@ class AttributeValue extends Model
|
||||
{
|
||||
use Translatable;
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatedAttributes = ['value'];
|
||||
/**
|
||||
* The relations to eager load on every query.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $with = ['translations'];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['position'];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatedAttributes = ['value'];
|
||||
}
|
||||
|
||||
@@ -6,20 +6,24 @@ use Modules\Support\Eloquent\Model;
|
||||
|
||||
class ProductAttribute extends Model
|
||||
{
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
/**
|
||||
* The relations to eager load on every query.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $with = ['attribute', 'values'];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['attribute_id'];
|
||||
|
||||
/**
|
||||
* The accessors to append to the model's array form.
|
||||
*
|
||||
@@ -27,28 +31,25 @@ class ProductAttribute extends Model
|
||||
*/
|
||||
protected $appends = ['name'];
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
public function attribute()
|
||||
{
|
||||
return $this->belongsTo(Attribute::class);
|
||||
}
|
||||
|
||||
|
||||
public function values()
|
||||
{
|
||||
return $this->hasMany(ProductAttributeValue::class, 'product_attribute_id');
|
||||
}
|
||||
|
||||
|
||||
public function getNameAttribute()
|
||||
{
|
||||
return $this->attribute->name;
|
||||
}
|
||||
|
||||
|
||||
public function getAttributeSetAttribute()
|
||||
{
|
||||
return $this->attribute->attributeSet->name;
|
||||
|
||||
@@ -27,21 +27,25 @@ class ProductAttributeValue extends Model
|
||||
*/
|
||||
protected $appends = ['value'];
|
||||
|
||||
|
||||
public function exists()
|
||||
{
|
||||
return ! is_null($this->attributeValue);
|
||||
return !is_null($this->attributeValue);
|
||||
}
|
||||
|
||||
|
||||
public function attributeValue()
|
||||
{
|
||||
return $this->belongsTo(AttributeValue::class, 'attribute_value_id');
|
||||
}
|
||||
|
||||
|
||||
public function getIdAttribute()
|
||||
{
|
||||
return $this->attributeValue->id;
|
||||
}
|
||||
|
||||
|
||||
public function getValueAttribute()
|
||||
{
|
||||
return $this->attributeValue->value;
|
||||
|
||||
@@ -15,6 +15,7 @@ class SaveAttributeRequest extends Request
|
||||
*/
|
||||
protected $availableAttributes = 'attribute::attributes.attributes';
|
||||
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
@@ -30,18 +31,6 @@ class SaveAttributeRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
private function getSlugRules()
|
||||
{
|
||||
$rules = $this->route()->getName() === 'admin.attributes.update'
|
||||
? ['required']
|
||||
: ['sometimes'];
|
||||
|
||||
$slug = Attribute::where('id', $this->id)->value('slug');
|
||||
|
||||
$rules[] = Rule::unique('attributes', 'slug')->ignore($slug, 'slug');
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data to be validated from the request.
|
||||
@@ -55,16 +44,32 @@ class SaveAttributeRequest extends Request
|
||||
])->all();
|
||||
}
|
||||
|
||||
|
||||
private function getSlugRules()
|
||||
{
|
||||
$rules = $this->route()->getName() === 'admin.attributes.update'
|
||||
? ['required']
|
||||
: ['sometimes'];
|
||||
|
||||
$slug = Attribute::where('id', $this->id)->value('slug');
|
||||
|
||||
$rules[] = Rule::unique('attributes', 'slug')->ignore($slug, 'slug');
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filter attribute values.
|
||||
*
|
||||
* @param array $values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function filter($values = [])
|
||||
{
|
||||
return array_filter($values, function ($value) {
|
||||
return ! is_null($value['value']);
|
||||
return !is_null($value['value']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class SaveAttributeSetRequest extends Request
|
||||
*/
|
||||
protected $availableAttributes = 'attribute::attributes.attribute_sets';
|
||||
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
|
||||
@@ -14,6 +14,7 @@ class SaveProductAttributesRequest extends Request
|
||||
*/
|
||||
protected $availableAttributes = 'attribute::attributes.product_attributes';
|
||||
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
@@ -27,6 +28,7 @@ class SaveProductAttributesRequest extends Request
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get data to be validated from the request.
|
||||
*
|
||||
@@ -43,16 +45,18 @@ class SaveProductAttributesRequest extends Request
|
||||
])->all();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filter product attributes.
|
||||
*
|
||||
* @param array $attributes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function filter($attributes = [])
|
||||
{
|
||||
return array_filter($attributes, function ($attribute) {
|
||||
return ! is_null($attribute['attribute_id']);
|
||||
return !is_null($attribute['attribute_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ class SaveProductAttributes
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param \Modules\Product\Entities\Product $product
|
||||
* @param Product $product
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Product $product)
|
||||
@@ -19,10 +20,12 @@ class SaveProductAttributes
|
||||
$this->createProductAttributes($product);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete all product attributes associated with the given product.
|
||||
*
|
||||
* @param \Modules\Product\Entities\Product $product
|
||||
* @param Product $product
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function deleteProductAttributes(Product $product)
|
||||
@@ -30,10 +33,12 @@ class SaveProductAttributes
|
||||
$product->attributes()->delete();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create product attributes for the given product.
|
||||
*
|
||||
* @param \Modules\Product\Entities\Product $product
|
||||
* @param Product $product
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function createProductAttributes(Product $product)
|
||||
@@ -56,10 +61,12 @@ class SaveProductAttributes
|
||||
$this->createProductAttributeValues($productAttributeValues);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the given product attribute values.
|
||||
*
|
||||
* @param array $productAttributeValues
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function createProductAttributeValues(array $productAttributeValues)
|
||||
|
||||
@@ -2,17 +2,14 @@
|
||||
|
||||
namespace Modules\Attribute\Providers;
|
||||
|
||||
use Modules\Support\Traits\AddsAsset;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Admin\Ui\Facades\TabManager;
|
||||
use Modules\Attribute\Admin\AttributeTabs;
|
||||
use Modules\Attribute\Admin\AttributeSetTabs;
|
||||
use Modules\Attribute\Admin\ProductTabsExtender;
|
||||
|
||||
|
||||
class AttributeServiceProvider extends ServiceProvider
|
||||
{
|
||||
use AddsAsset;
|
||||
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*
|
||||
@@ -22,8 +19,5 @@ class AttributeServiceProvider extends ServiceProvider
|
||||
{
|
||||
TabManager::register('attributes', AttributeTabs::class);
|
||||
TabManager::register('attribute_sets', AttributeSetTabs::class);
|
||||
TabManager::extend('products', ProductTabsExtender::class);
|
||||
|
||||
$this->addAdminAssets('admin.(attributes|products).(create|edit)', ['admin.attribute.css', 'admin.attribute.js']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace Modules\Attribute\Providers;
|
||||
|
||||
use Modules\Product\Entities\Product;
|
||||
use Modules\Attribute\Listeners\SaveProductAttributes;
|
||||
use Modules\Attribute\Http\Requests\SaveProductAttributesRequest;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
@@ -18,10 +17,6 @@ class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
Product::saving(function () {
|
||||
resolve(SaveProductAttributesRequest::class);
|
||||
});
|
||||
|
||||
Product::saved(SaveProductAttributes::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ export default class {
|
||||
this.attributeId = 0;
|
||||
this.valuesCount = 0;
|
||||
|
||||
this.addOldValues(FleetCart.data['attribute.values']);
|
||||
this.addOldValues(FleetCart.data["attribute.values"]);
|
||||
|
||||
if (this.valuesCount === 0) {
|
||||
this.addAttributeValue();
|
||||
@@ -12,7 +12,7 @@ export default class {
|
||||
this.eventListeners();
|
||||
this.sortable();
|
||||
|
||||
window.admin.removeSubmitButtonOffsetOn('#values');
|
||||
window.admin.removeSubmitButtonOffsetOn("#values");
|
||||
}
|
||||
|
||||
addOldValues(values = {}) {
|
||||
@@ -21,26 +21,26 @@ export default class {
|
||||
}
|
||||
}
|
||||
|
||||
addAttributeValue(value = { id: '', value: '' }) {
|
||||
let template = _.template($('#attribute-value-template').html());
|
||||
addAttributeValue(value = { id: "", value: "" }) {
|
||||
let template = _.template($("#attribute-value-template").html());
|
||||
let html = template({ valueId: this.valuesCount++, value });
|
||||
|
||||
$('#attribute-values').append(html);
|
||||
$("#attribute-values").append(html);
|
||||
|
||||
window.admin.tooltip();
|
||||
}
|
||||
|
||||
eventListeners() {
|
||||
$('#add-new-value').on('click', () => this.addAttributeValue());
|
||||
$("#add-new-value").on("click", () => this.addAttributeValue());
|
||||
|
||||
$('#attribute-values').on('click', '.delete-row', (e) => {
|
||||
$(e.currentTarget).closest('tr').remove();
|
||||
$("#attribute-values").on("click", ".delete-row", (e) => {
|
||||
$(e.currentTarget).closest("tr").remove();
|
||||
});
|
||||
}
|
||||
|
||||
sortable() {
|
||||
Sortable.create(document.getElementById('attribute-values'), {
|
||||
handle: '.drag-icon',
|
||||
Sortable.create(document.getElementById("attribute-values"), {
|
||||
handle: ".drag-handle",
|
||||
animation: 150,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import AttributeValues from './AttributeValues';
|
||||
import ProductAttributes from './ProductAttributes';
|
||||
import AttributeValues from "./AttributeValues";
|
||||
|
||||
if ($('#attribute-values-wrapper').length !== 0) {
|
||||
if ($("#attribute-values-wrapper").length !== 0) {
|
||||
new AttributeValues();
|
||||
}
|
||||
|
||||
if ($('#product-attributes-wrapper').length !== 0) {
|
||||
new ProductAttributes();
|
||||
}
|
||||
|
||||
@@ -1,49 +1,23 @@
|
||||
#product-attributes-wrapper,
|
||||
#attribute-values-wrapper {
|
||||
margin-bottom: 15px;
|
||||
|
||||
.table {
|
||||
.form-group {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
thead th {
|
||||
&:first-child {
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
width: 60px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#product-attributes-wrapper {
|
||||
.table-responsive {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.table {
|
||||
> tbody > tr {
|
||||
> td {
|
||||
vertical-align: middle;
|
||||
|
||||
&:nth-child(2) {
|
||||
width: 160px;
|
||||
width: 190px;
|
||||
min-width: 160px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.options {
|
||||
.drag-icon {
|
||||
margin-top: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#attribute-values-wrapper {
|
||||
margin-bottom: 15px;
|
||||
|
||||
.table-responsive {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.table {
|
||||
> tbody > tr {
|
||||
> td {
|
||||
@@ -55,19 +29,55 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 767px) {
|
||||
#product-attributes-wrapper {
|
||||
.options {
|
||||
.drag-icon {
|
||||
margin-top: 0;
|
||||
#product-attributes-wrapper,
|
||||
#attribute-values-wrapper {
|
||||
.table-responsive {
|
||||
margin-bottom: 15px;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.table {
|
||||
thead th {
|
||||
&:first-child {
|
||||
width: 35px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
width: 60px;
|
||||
}
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 991px) {
|
||||
#product-attributes-wrapper {
|
||||
.table {
|
||||
> tbody > tr {
|
||||
> td {
|
||||
&:nth-child(2) {
|
||||
min-width: 160px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 767px) {
|
||||
#product-attributes-wrapper {
|
||||
.table {
|
||||
> tbody > tr {
|
||||
border-top: 1px solid #e9e9e9;
|
||||
|
||||
> td {
|
||||
&:nth-child(2) {
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
&:nth-child(2),
|
||||
&:nth-child(3),
|
||||
&:nth-child(4) {
|
||||
@@ -77,7 +87,6 @@
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
text-align: left;
|
||||
vertical-align: initial;
|
||||
}
|
||||
|
||||
&:nth-child(4) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
return [
|
||||
'attribute' => 'Attribute',
|
||||
'attributes' => 'Attributes',
|
||||
|
||||
'table' => [
|
||||
'name' => 'Name',
|
||||
'attribute_set' => 'Attribute Set',
|
||||
@@ -10,26 +11,20 @@ return [
|
||||
'yes' => 'Yes',
|
||||
'no' => 'No',
|
||||
],
|
||||
|
||||
'tabs' => [
|
||||
'group' => [
|
||||
'attribute_information' => 'Attribute Information',
|
||||
],
|
||||
|
||||
'general' => 'General',
|
||||
'values' => 'Values',
|
||||
'product' => [
|
||||
'attributes' => 'Attributes',
|
||||
],
|
||||
],
|
||||
|
||||
'form' => [
|
||||
'use_this_attribute_for_filtering_products' => 'Use this attribute for filtering products',
|
||||
'value' => 'Value',
|
||||
'add_new_value' => 'Add New Value',
|
||||
'delete_value' => 'Delete Value',
|
||||
'product' => [
|
||||
'attribute' => 'Attribute',
|
||||
'values' => 'Values',
|
||||
'add_new_attribute' => 'Add New Attribute',
|
||||
'delete_attribute' => 'Delete Attribute',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
@endcomponent
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
<script type="module">
|
||||
new DataTable('#attribute_sets-table .table', {
|
||||
columns: [
|
||||
{ data: 'checkbox', orderable: false, searchable: false, width: '3%' },
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
<script type="module">
|
||||
keypressAction([
|
||||
{ key: 'b', route: "{{ route('admin.attribute_sets.index') }}" }
|
||||
]);
|
||||
|
||||
@@ -16,3 +16,10 @@
|
||||
@endsection
|
||||
|
||||
@include('attribute::admin.attributes.partials.shortcuts')
|
||||
|
||||
@push('globals')
|
||||
@vite([
|
||||
'Modules/Attribute/Resources/assets/admin/sass/main.scss',
|
||||
'Modules/Attribute/Resources/assets/admin/js/main.js',
|
||||
])
|
||||
@endpush
|
||||
|
||||
@@ -18,3 +18,10 @@
|
||||
@endsection
|
||||
|
||||
@include('attribute::admin.attributes.partials.shortcuts')
|
||||
|
||||
@push('globals')
|
||||
@vite([
|
||||
'Modules/Attribute/Resources/assets/admin/sass/main.scss',
|
||||
'Modules/Attribute/Resources/assets/admin/js/main.js',
|
||||
])
|
||||
@endpush
|
||||
@@ -27,7 +27,7 @@
|
||||
@endcomponent
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
<script type="module">
|
||||
new DataTable('#attributes-table .table', {
|
||||
columns: [
|
||||
{ data: 'checkbox', orderable: false, searchable: false, width: '3%' },
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
@endpush
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
<script type="module">
|
||||
keypressAction([
|
||||
{ key: 'b', route: "{{ route('admin.attributes.index') }}" }
|
||||
]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script type="text/html" id="attribute-value-template">
|
||||
<tr>
|
||||
<td class="text-center">
|
||||
<span class="drag-icon">
|
||||
<span class="drag-handle">
|
||||
<i class="fa"></i>
|
||||
<i class="fa"></i>
|
||||
</span>
|
||||
|
||||
@@ -38,12 +38,24 @@ Route::delete('attributes/{ids?}', [
|
||||
'middleware' => 'can:admin.attributes.destroy',
|
||||
]);
|
||||
|
||||
Route::get('attributes/index/table', [
|
||||
'as' => 'admin.attributes.table',
|
||||
'uses' => 'AttributeController@table',
|
||||
'middleware' => 'can:admin.attributes.index',
|
||||
]);
|
||||
|
||||
Route::get('attributes-sets', [
|
||||
'as' => 'admin.attribute_sets.index',
|
||||
'uses' => 'AttributeSetController@index',
|
||||
'middleware' => 'can:admin.attribute_sets.index',
|
||||
]);
|
||||
|
||||
Route::get('attributes-sets/index/table', [
|
||||
'as' => 'admin.attribute_sets.table',
|
||||
'uses' => 'AttributeSetController@table',
|
||||
'middleware' => 'can:admin.attribute_sets.index',
|
||||
]);
|
||||
|
||||
Route::get('attributes-sets/create', [
|
||||
'as' => 'admin.attribute_sets.create',
|
||||
'uses' => 'AttributeSetController@create',
|
||||
|
||||
21
Modules/Attribute/Transformers/AttributeResource.php
Normal file
21
Modules/Attribute/Transformers/AttributeResource.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Attribute\Transformers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class AttributeResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param Request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return parent::toArray($request);
|
||||
}
|
||||
}
|
||||
21
Modules/Attribute/Transformers/AttributeValueResource.php
Normal file
21
Modules/Attribute/Transformers/AttributeValueResource.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Attribute\Transformers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class AttributeValueResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param Request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return parent::toArray($request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user