Fix on AdminLTE 3, and add some features
This commit is contained in:
31
app/DataTables/Shop/ArticlePricesDataTable.php
Normal file
31
app/DataTables/Shop/ArticlePricesDataTable.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\ArticlePrice;
|
||||
|
||||
class ArticlePricessDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'ArticlePrices';
|
||||
|
||||
public function query(ArticlePrice $model)
|
||||
{
|
||||
$model = $model::with(['Article', 'ArticleAttributes']);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(120)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Articles;
|
||||
use App\Repositories\Shop\ArticleAttributeFamilies;
|
||||
use App\Repositories\Shop\ArticleFamilies;
|
||||
use App\Repositories\Shop\Categories;
|
||||
use App\DataTables\Shop\ArticlesDataTable;
|
||||
@@ -27,6 +28,7 @@ class ArticleController extends Controller
|
||||
$data = [];
|
||||
$data['categories'] = Categories::getOptions();
|
||||
$data['families'] = ArticleFamilies::getOptions();
|
||||
$data['attribute_families'] = ArticleAttributeFamilies::getOptions();
|
||||
$data['models'] = ['App\Models\Botanic\Specie' => 'Espèces', 'App\Models\Botanic\Variety' => 'Variétés'];
|
||||
return view('Shop.Admin.Articles.create', $data);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class Botanic
|
||||
$menu->add('Botanique', [ 'permission' => 'backend_access', 'icon' => 'leaf' ])
|
||||
->id('botanic')
|
||||
->activeIfRoute('botanic')
|
||||
->order(2);
|
||||
->order(4);
|
||||
|
||||
$menu->addTo('botanic', 'Familles', [ 'route' => 'Botanic.Admin.Families.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Botanic.Admin.Families.*'])->order(1);
|
||||
|
||||
21
app/Menu/Customers.php
Normal file
21
app/Menu/Customers.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Menu;
|
||||
|
||||
use Sebastienheyd\Boilerplate\Menu\Builder;
|
||||
|
||||
class Customers
|
||||
{
|
||||
public function make(Builder $menu)
|
||||
{
|
||||
$menu->add('Clients', [ 'permission' => 'backend_access', 'icon' => 'address-card' ])
|
||||
->id('customers')
|
||||
->activeIfRoute('customers')
|
||||
->order(3);
|
||||
|
||||
$menu->addTo('customers', 'Clients', [ 'route' => 'Shop.Admin.Customers.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.Customers.*'])->order(1);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
26
app/Menu/Orders.php
Normal file
26
app/Menu/Orders.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Menu;
|
||||
|
||||
use Sebastienheyd\Boilerplate\Menu\Builder;
|
||||
|
||||
class Orders
|
||||
{
|
||||
public function make(Builder $menu)
|
||||
{
|
||||
$menu->add('Commandes', [ 'permission' => 'backend_access', 'icon' => 'shopping-basket' ])
|
||||
->id('orders')
|
||||
->activeIfRoute('orders')
|
||||
->order(1);
|
||||
|
||||
$menu->addTo('orders', 'Commandes', [ 'route' => 'Shop.Admin.Orders.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.Orders.*'])->order(1);
|
||||
$menu->addTo('orders', 'Factures', [ 'route' => 'Shop.Admin.Invoices.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.Invoices.*'])->order(2);
|
||||
$menu->addTo('orders', 'Avoirs', [ 'route' => 'Shop.Admin.Invoices.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.Invoices.*'])->order(3);
|
||||
$menu->addTo('orders', 'Bons de livraison', [ 'route' => 'Shop.Admin.Invoices.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.Invoices.*'])->order(4);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,33 +3,31 @@
|
||||
namespace App\Menu;
|
||||
|
||||
use Sebastienheyd\Boilerplate\Menu\Builder;
|
||||
use App\Repositories\Users;
|
||||
|
||||
class Shop
|
||||
{
|
||||
public function make(Builder $menu)
|
||||
{
|
||||
$menu->add('Commerce', [ 'permission' => 'backend_access', 'icon' => 'shopping-basket' ])
|
||||
$menu->add('Catalogue', [ 'permission' => 'backend_access', 'icon' => 'store' ])
|
||||
->id('shop')
|
||||
->activeIfRoute('shop')
|
||||
->order(1);
|
||||
->order(2);
|
||||
|
||||
$menu->addTo('shop', 'Categories', [ 'route' => 'Shop.Admin.Categories.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.Categories.*'])->order(1);
|
||||
|
||||
$menu->addTo('shop', 'Articles', [ 'route' => 'Shop.Admin.Articles.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.Articles.*'])->order(2);
|
||||
->activeIfRoute(['Shop.Admin.Articles.*'])->order(1);
|
||||
$menu->addTo('shop', 'Categories', [ 'route' => 'Shop.Admin.Categories.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.Categories.*'])->order(2);
|
||||
$menu->addTo('shop', 'Familles d\'articles', [ 'route' => 'Shop.Admin.ArticleFamilies.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.ArticleFamilies.*'])->order(3);
|
||||
$menu->addTo('shop', 'Familles d\'attributs', [ 'route' => 'Shop.Admin.ArticleAttributeFamilies.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeFamilies.*'])->order(4);
|
||||
$menu->addTo('shop', 'Attributs', [ 'route' => 'Shop.Admin.ArticleAttributeValues.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeValues.*'])->order(5);
|
||||
$menu->addTo('shop', 'Réductions', [ 'route' => 'Shop.Admin.ArticleAttributeValues.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeValues.*'])->order(6);
|
||||
$menu->addTo('shop', 'Stock', [ 'route' => 'Shop.Admin.ArticleAttributeValues.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeValues.*'])->order(7);
|
||||
|
||||
$menu->addTo('shop', 'Commandes', [ 'route' => 'Shop.Admin.Orders.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.Orders.*'])->order(6);
|
||||
$menu->addTo('shop', 'Factures', [ 'route' => 'Shop.Admin.Invoices.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.Invoices.*'])->order(7);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ class Article extends Model
|
||||
return $this->hasMany('App\Models\Shop\ArticlePrice');
|
||||
}
|
||||
|
||||
public function ArticleAttributes()
|
||||
public function Attributes()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\ArticleAttribute');
|
||||
return $this->hasManyThrough('App\Models\Shop\ArticleAttribute','App\Models\Shop\ArticlePrice');
|
||||
}
|
||||
|
||||
public function Categories()
|
||||
|
||||
@@ -2,17 +2,27 @@
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ArticleAttribute extends Pivot
|
||||
class ArticleAttribute extends Model
|
||||
{
|
||||
public function article()
|
||||
public function Price()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
return $this->belongsTo('App\Models\Shop\ArticlePrice');
|
||||
}
|
||||
|
||||
public function value()
|
||||
public function Value()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleAttribute');
|
||||
}
|
||||
|
||||
public function scopeByPrice($query, $article_price_id)
|
||||
{
|
||||
return $query->where('article_price_id', $article_price_id);
|
||||
}
|
||||
|
||||
public function scopeByAttribueValue($query, $article_value_id)
|
||||
{
|
||||
return $query->where('article_value_id', $article_value_id);
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,14 @@ class ArticleAttributeValue extends Model
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_article_attribute_values';
|
||||
|
||||
public function attribute_family()
|
||||
public function AttributeFamily()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleAttributeFamily');
|
||||
}
|
||||
|
||||
public function scopeByFamily($query, $attribute_family_id)
|
||||
{
|
||||
return $query->where('attribute_family_id', $attribute_family_id);
|
||||
}
|
||||
|
||||
}
|
||||
17
app/Models/Shop/ArticleComponent.php
Normal file
17
app/Models/Shop/ArticleComponent.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ArticleComponent extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_article_components';
|
||||
|
||||
public function Article()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,9 +13,9 @@ class ArticlePrice extends Model
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function ArticleAttribute()
|
||||
public function ArticleAttributes()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleAttribute');
|
||||
return $this->hasMany('App\Models\Shop\ArticleAttribute');
|
||||
}
|
||||
|
||||
public function scopeByArticle($query, $id)
|
||||
|
||||
@@ -25,6 +25,11 @@ class ArticleAttributeFamilies
|
||||
return ArticleAttributeFamily::find($id);
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return ArticleAttributeFamily::get()->pluck('name','id')->toArray();
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
|
||||
@@ -25,6 +25,16 @@ class ArticleAttributeValues
|
||||
return ArticleAttributeValue::find($id);
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return ArticleAttributeValue::get()->pluck('name','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getOptionsByFamily($attribute_family_id)
|
||||
{
|
||||
return ArticleAttributeValue::byFamily($attribute_family_id)->get()->pluck('name','id')->toArray();
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
|
||||
Reference in New Issue
Block a user