[WIP] Add some classes
This commit is contained in:
@@ -21,6 +21,7 @@ var jsMain = [
|
||||
'node_modules/jquery.are-you-sure/jquery.are-you-sure.js',
|
||||
/* 'node_modules/letteringjs/jquery.lettering.js', */
|
||||
/* 'node_modules/textillate/jquery.textillate.js', */
|
||||
'node_modules/jqtree/tree.jquery.js',
|
||||
'node_modules/numeral/min/numeral.min.js',
|
||||
'node_modules/numeral/min/locales/fr.min.js',
|
||||
'build/js/url_on_tab.js',
|
||||
@@ -38,6 +39,7 @@ var cssMain = [
|
||||
'node_modules/bootstrap-slider/dist/css/bootstrap-slider.min.css',
|
||||
'node_modules/jQuery-QueryBuilder/dist/css/query-builder.default.min.css',
|
||||
'node_modules/animate.css/animate.min.css',
|
||||
'node_modules/jqtree/jqtree.css',
|
||||
'build/css/modal-option.css',
|
||||
'build/css/shadow.css',
|
||||
'build/css/utility.css',
|
||||
|
||||
@@ -12,7 +12,7 @@ class FamiliesDataTable extends DataTable
|
||||
|
||||
public function query(Family $model)
|
||||
{
|
||||
$model = $model::withCount('genres');
|
||||
$model = $model::withCount(['genres','species','varieties']);
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,9 @@ class FamiliesDataTable extends DataTable
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('alias'),
|
||||
Column::make('latin'),
|
||||
Column::make('genres_count')->title('Nb genres'),
|
||||
Column::make('genres_count')->title('Nb genres')->searchable(false),
|
||||
Column::make('species_count')->title('Nb espèces')->searchable(false),
|
||||
Column::make('varieties_count')->title('Nb variétés')->searchable(false),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
|
||||
@@ -12,7 +12,7 @@ class GenresDataTable extends DataTable
|
||||
|
||||
public function query(Genre $model)
|
||||
{
|
||||
$model = $model::with('family')->withCount('species');
|
||||
$model = $model::with('family')->withCount('species')->withCount('varieties');
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ class GenresDataTable extends DataTable
|
||||
Column::make('latin'),
|
||||
Column::make('family.name'),
|
||||
Column::make('species_count')->title('Nb Espèces')->searchable(false),
|
||||
Column::make('varieties_count')->title('Nb Variétés')->searchable(false),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
|
||||
30
app/DataTables/Shop/ArticleFamiliesDataTable.php
Normal file
30
app/DataTables/Shop/ArticleFamiliesDataTable.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\ArticleFamily;
|
||||
|
||||
class ArticleFamiliesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'ArticleFamilies';
|
||||
|
||||
public function query(ArticleFamily $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(120)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,84 +5,55 @@ namespace App\Http\Controllers\Shop\Admin;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\Shop\Article;
|
||||
use App\Repositories\Shop\Articles;
|
||||
use App\DataTables\Shop\ArticlesDataTable;
|
||||
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
public function index(ArticlesDataTable $dataTable)
|
||||
{
|
||||
//
|
||||
return $dataTable->render('Shop.Admin.Articles.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return Articles::getTables($request->all());
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
$data = [];
|
||||
$data['categories'] = Articles::getOptions();
|
||||
return view('Shop.Admin.Articles.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
$ret = Articles::store($request->all());
|
||||
return redirect()->route('Shop.Admin.Articles.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Article $Article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Article $Article)
|
||||
public function show($id)
|
||||
{
|
||||
$data = Articles::get($id);
|
||||
return view('Shop.Admin.Articles.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Articles::get($id);
|
||||
$data['categories'] = Articles::getOptions();
|
||||
return view('Shop.Admin.Articles.edit', $data);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Article $Article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Article $Article)
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
return Articles::destroy($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Article $Article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Article $Article)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Article $Article
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Article $Article)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
56
app/Http/Controllers/Shop/Admin/ArticleFamilyController.php
Normal file
56
app/Http/Controllers/Shop/Admin/ArticleFamilyController.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\ArticleFamilies;
|
||||
use App\DataTables\Shop\ArticleFamiliesDataTable;
|
||||
|
||||
class ArticleFamilyController extends Controller
|
||||
{
|
||||
public function index(ArticleFamiliesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.ArticleFamilies.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return ArticleFamilies::getTables($request->all());
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('Shop.Admin.ArticleFamilies.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = ArticleFamilies::store($request->all());
|
||||
return redirect()->route('Shop.Admin.ArticleFamilies.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = ArticleFamilies::get($id);
|
||||
return view('Shop.Admin.ArticleFamilies.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = ArticleFamilies::get($id);
|
||||
return view('Shop.Admin.ArticleFamilies.edit', $data);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return ArticleFamilies::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,71 +21,37 @@ class CategoryController extends Controller
|
||||
return Categories::getTables($request->all());
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$data = [];
|
||||
$data['categories'] = Categories::getOptions();
|
||||
return view('Shop.Admin.Categories.create', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Categories::store($request->all());
|
||||
return redirect()->route('Shop.Admin.Categories.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Customer $customer
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$data = Categories::get($id);
|
||||
return view('Shop.Admin.Categories.view', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Customer $customer
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Categories::get($id);
|
||||
$data['categories'] = Categories::getOptions();
|
||||
return view('Shop.Admin.Categories.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Customer $customer
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Customer $customer
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
return Categories::destroy($id);
|
||||
|
||||
@@ -27,4 +27,9 @@ class CategoryController extends Controller
|
||||
return view('Shop.Categories.view', $data);
|
||||
}
|
||||
|
||||
public function getTree()
|
||||
{
|
||||
return response()->json(Categories::getTree());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,19 +9,19 @@ class Botanic
|
||||
{
|
||||
public function make(Builder $menu)
|
||||
{
|
||||
$menu->add('Botanique', [ 'permission' => 'backend', 'icon' => 'leaf' ])
|
||||
$menu->add('Botanique', [ 'permission' => 'backend_access', 'icon' => 'leaf' ])
|
||||
->id('botanic')
|
||||
->activeIfRoute('botanic')
|
||||
->order(2);
|
||||
|
||||
$menu->addTo('botanic', 'Familles', [ 'route' => 'Botanic.Admin.Families.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Botanic.Admin.Families.index'])->order(1);
|
||||
$menu->addTo('botanic', 'Genres', [ 'route' => 'Botanic.Admin.Genres.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Botanic.Admin.Genres.index'])->order(2);
|
||||
$menu->addTo('botanic', 'Espèces', [ 'route' => 'Botanic.Admin.Species.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Botanic.Admin.Species.index'])->order(3);
|
||||
$menu->addTo('botanic', 'Variétés', [ 'route' => 'Botanic.Admin.Varieties.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Botanic.Admin.Varieties.index'])->order(4);
|
||||
$menu->addTo('botanic', 'Familles', [ 'route' => 'Botanic.Admin.Families.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Botanic.Admin.Families.*'])->order(1);
|
||||
$menu->addTo('botanic', 'Genres', [ 'route' => 'Botanic.Admin.Genres.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Botanic.Admin.Genres.*'])->order(2);
|
||||
$menu->addTo('botanic', 'Espèces', [ 'route' => 'Botanic.Admin.Species.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Botanic.Admin.Species.*'])->order(3);
|
||||
$menu->addTo('botanic', 'Variétés', [ 'route' => 'Botanic.Admin.Varieties.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Botanic.Admin.Varieties.*'])->order(4);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,19 +9,23 @@ class Shop
|
||||
{
|
||||
public function make(Builder $menu)
|
||||
{
|
||||
$menu->add('Commerce', [ 'permission' => 'backend', 'icon' => 'shopping-basket' ])
|
||||
$menu->add('Commerce', [ 'permission' => 'backend_access', 'icon' => 'shopping-basket' ])
|
||||
->id('shop')
|
||||
->activeIfRoute('shop')
|
||||
->order(1);
|
||||
|
||||
$menu->addTo('shop', 'Categories', [ 'route' => 'Shop.Admin.Categories.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Categories.index'])->order(1);
|
||||
$menu->addTo('shop', 'Articles', [ 'route' => 'Shop.Admin.Articles.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Articles.index'])->order(2);
|
||||
$menu->addTo('shop', 'Commandes', [ 'route' => 'Shop.Admin.Orders.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Orders.index'])->order(3);
|
||||
$menu->addTo('shop', 'Factures', [ 'route' => 'Shop.Admin.Invoices.index', 'permission' => 'backend' ])
|
||||
->activeIfRoute(['Shop.Admin.Invoices.index'])->order(4);
|
||||
$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);
|
||||
$menu->addTo('shop', 'Familles d\'articles', [ 'route' => 'Shop.Admin.ArticleFamilies.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.ArticleFamilies.*'])->order(3);
|
||||
|
||||
$menu->addTo('shop', 'Commandes', [ 'route' => 'Shop.Admin.Orders.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.Orders.*'])->order(4);
|
||||
$menu->addTo('shop', 'Factures', [ 'route' => 'Shop.Admin.Invoices.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.Invoices.*'])->order(5);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use \Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class Family extends Model
|
||||
{
|
||||
use HasRelationships;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'botanic_families';
|
||||
|
||||
@@ -14,6 +17,16 @@ class Family extends Model
|
||||
return $this->hasMany('App\Models\Botanic\Genre');
|
||||
}
|
||||
|
||||
public function species()
|
||||
{
|
||||
return $this->hasManyThrough('App\Models\Botanic\Specie', 'App\Models\Botanic\Genre');
|
||||
}
|
||||
|
||||
public function varieties()
|
||||
{
|
||||
return $this->hasManyDeep('App\Models\Botanic\Variety', ['App\Models\Botanic\Genre', 'App\Models\Botanic\Specie']);
|
||||
}
|
||||
|
||||
public function scopeByName($query,$name)
|
||||
{
|
||||
return $query->where('name', $name);
|
||||
|
||||
@@ -19,6 +19,11 @@ class Genre extends Model
|
||||
return $this->hasMany('App\Models\Botanic\Specie');
|
||||
}
|
||||
|
||||
public function varieties()
|
||||
{
|
||||
return $this->hasManyThrough('App\Models\Botanic\Variety', 'App\Models\Botanic\Specie');
|
||||
}
|
||||
|
||||
public function scopeByName($query,$name)
|
||||
{
|
||||
return $query->where('name', $name);
|
||||
|
||||
@@ -44,4 +44,10 @@ class Article extends Model
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\InvoiceItem');
|
||||
}
|
||||
|
||||
public function Product()
|
||||
{
|
||||
return $this->belongsTo($this->model, 'model_id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,17 +2,17 @@
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
|
||||
class ArticleAttribute extends Model
|
||||
class ArticleAttribute extends Pivot
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function Article()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function Attribute()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleAttribute');
|
||||
}
|
||||
}
|
||||
55
app/Repositories/Core/Tags.php
Normal file
55
app/Repositories/Core/Tags.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Botanic\Family;
|
||||
|
||||
class Tags
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = Family::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Family::get()->SortBy('name')->pluck('name','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Family::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Family::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Family::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return Family::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Family::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
50
app/Repositories/Shop/ArticleAttributeFamilies.php
Normal file
50
app/Repositories/Shop/ArticleAttributeFamilies.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\ArticleAttributeFamily;
|
||||
|
||||
class ArticleAttributeFamilies
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = ArticleAttributeFamily::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return ArticleAttributeFamily::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return ArticleAttributeFamily::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return ArticleAttributeFamily::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return ArticleAttributeFamily::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return ArticleAttributeFamily::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
50
app/Repositories/Shop/ArticleAttributeValues.php
Normal file
50
app/Repositories/Shop/ArticleAttributeValues.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\ArticleAttributeValue;
|
||||
|
||||
class ArticleAttributeValues
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = ArticleAttributeValue::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return ArticleAttributeValue::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return ArticleAttributeValue::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return ArticleAttributeValue::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return ArticleAttributeValue::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return ArticleAttributeValue::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
50
app/Repositories/Shop/ArticleAttributes.php
Normal file
50
app/Repositories/Shop/ArticleAttributes.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\ArticleAttribute;
|
||||
|
||||
class ArticleAttributes
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = ArticleAttribute::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return ArticleAttribute::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return ArticleAttribute::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return ArticleAttribute::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return ArticleAttribute::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return ArticleAttribute::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
50
app/Repositories/Shop/ArticleCategories.php
Normal file
50
app/Repositories/Shop/ArticleCategories.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\ArticleCategory;
|
||||
|
||||
class ArticleCategories
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = ArticleCategory::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return ArticleCategory::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return ArticleCategory::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return ArticleCategory::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return ArticleCategory::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return ArticleCategory::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
54
app/Repositories/Shop/ArticleComponents.php
Normal file
54
app/Repositories/Shop/ArticleComponents.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\Article;
|
||||
|
||||
class Articles
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = Article::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Article::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Article::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Article::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return Article::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Article::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
50
app/Repositories/Shop/ArticleFamilies.php
Normal file
50
app/Repositories/Shop/ArticleFamilies.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\ArticleFamily;
|
||||
|
||||
class ArticleFamilies
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = ArticleFamily::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return ArticleFamily::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return ArticleFamily::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return ArticleFamily::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return ArticleFamily::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return ArticleFamily::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
54
app/Repositories/Shop/ArticlePrices.php
Normal file
54
app/Repositories/Shop/ArticlePrices.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
use App\Models\Shop\ArticlePrice;
|
||||
|
||||
class ArticlePrices
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = ArticlePrice::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return ArticlePrice::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return ArticlePrice::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return ArticlePrice::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return ArticlePrice::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return ArticlePrice::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,6 +25,16 @@ class Categories
|
||||
return Category::find($id);
|
||||
}
|
||||
|
||||
public static function getTree()
|
||||
{
|
||||
return CategoryTrees::getTree();
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Category::get()->pluck('name','category_id')->toArray();
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
@@ -35,9 +45,7 @@ class Categories
|
||||
{
|
||||
$node = CategoryTrees::create($data);
|
||||
$data['category_id'] = $node->id;
|
||||
dump($data);
|
||||
$category = Category::create($data);
|
||||
exit;
|
||||
return $category;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,29 @@ use App\Models\Shop\Category;
|
||||
|
||||
class CategoryTrees
|
||||
{
|
||||
public static function getTree()
|
||||
{
|
||||
$categories = app('rinvex.categories.category')->get()->toTree()->toArray();
|
||||
return self::getChildren($categories[0]['children']);
|
||||
}
|
||||
|
||||
public static function getChildren($data)
|
||||
{
|
||||
$tree = [];
|
||||
foreach ($data as $item)
|
||||
{
|
||||
$leaf = [];
|
||||
$leaf['name'] = $item['name'];
|
||||
$leaf['id'] = $item['id'];
|
||||
$children = (isset($item['children'])) ? self::getChildren($item['children']) : false;
|
||||
if ($children) {
|
||||
$leaf['children'] = $children;
|
||||
}
|
||||
$tree[] = $leaf;
|
||||
}
|
||||
return $tree;
|
||||
}
|
||||
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
"isotope-layout": "^3.0.6",
|
||||
"izimodal": "^1.5.1",
|
||||
"jQuery-QueryBuilder": "^2.5.2",
|
||||
"jqtree": "^1.4.12",
|
||||
"jquery-confirm": "^3.3.4",
|
||||
"jquery-form": "^4.2.2",
|
||||
"jquery-jeditable": "^2.0.13",
|
||||
|
||||
28
resources/views/Shop/Admin/ArticleFamilies/create.blade.php
Normal file
28
resources/views/Shop/Admin/ArticleFamilies/create.blade.php
Normal file
@@ -0,0 +1,28 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('article_families.title'),
|
||||
'subtitle' => __('article_families.create.title'),
|
||||
'breadcrumb' => [__('article_families.title'), __('article_families.create.title')]
|
||||
])
|
||||
|
||||
@include('boilerplate::load.fileinput')
|
||||
|
||||
@section('content')
|
||||
|
||||
{{ Form::open(['route' => 'Shop.Admin.ArticleFamilies.store', 'id' => 'article-family-form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 mbl">
|
||||
<a href="{{ route("Shop.Admin.Articles.index") }}" class="btn btn-default">
|
||||
{{ __('article_families.list.title') }}
|
||||
</a>
|
||||
|
||||
<span class="btn-group pull-right">
|
||||
@include('components.button-save')
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('Shop.Admin.ArticleFamilies.form')
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
29
resources/views/Shop/Admin/ArticleFamilies/edit.blade.php
Normal file
29
resources/views/Shop/Admin/ArticleFamilies/edit.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
@extends('layout.index', [
|
||||
'title' => 'Famille d\'articles',
|
||||
'subtitle' => 'Edition d\'une famille d\'article',
|
||||
'breadcrumb' => ['Articles']
|
||||
])
|
||||
|
||||
@include('boilerplate::load.fileinput')
|
||||
|
||||
@section('content')
|
||||
|
||||
{{ Form::open(['route' => 'Shop.Admin.ArticleFamilies.update', 'id' => 'article-family-form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 mbl">
|
||||
<a href="{{ route("Shop.Admin.ArticleFamilies.index") }}" class="btn btn-default">
|
||||
{{ __('article_families.list.title') }}
|
||||
</a>
|
||||
|
||||
<span class="btn-group pull-right">
|
||||
@include('components.button-save')
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="id" value="{{ $id }}">
|
||||
@include('Shop.Admin.ArticleFamilies.form')
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
29
resources/views/Shop/Admin/ArticleFamilies/form.blade.php
Normal file
29
resources/views/Shop/Admin/ArticleFamilies/form.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
@include('boilerplate::load.tinymce')
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::label('name', 'Nom') }}
|
||||
@include('components.input', ['name' => 'name', 'value' => (isset($family['name'])) ? $family['name'] : null, 'required' => true])
|
||||
|
||||
{{ Form::label('description', 'Description') }}
|
||||
@include('components.textarea', ['name' => 'description', 'value' => isset($description) ? $description : null, 'class' => 'editor', 'required' => false])
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="float-right mt-3">
|
||||
@include('components.button-save')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$(function() {
|
||||
$('.editor').tinymce({});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
21
resources/views/Shop/Admin/ArticleFamilies/list.blade.php
Normal file
21
resources/views/Shop/Admin/ArticleFamilies/list.blade.php
Normal file
@@ -0,0 +1,21 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('Shop.article_families.title'),
|
||||
'subtitle' => __('Shop.article_families.list'),
|
||||
'breadcrumb' => [__('Shop.article_families.title')]
|
||||
])
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row pb-3">
|
||||
<div class="col text-right">
|
||||
<a href="{{ route('Shop.Admin.ArticleFamilies.create') }}" class="btn btn-sm btn-success">{{ __('Shop.Admin.ArticleFamilies.add') }} <i class="fa fa-plus"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{$dataTable->table()}}
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@include('components.js.datatable', ['route' => '/Shop/Admin/ArticleFamilies', 'model' => 'articlefamilies'])
|
||||
@endpush
|
||||
36
resources/views/Shop/Admin/ArticleFamilies/show.blade.php
Normal file
36
resources/views/Shop/Admin/ArticleFamilies/show.blade.php
Normal file
@@ -0,0 +1,36 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('products.title'),
|
||||
'subtitle' => __('products.title'),
|
||||
'breadcrumb' => [__('products.title')]
|
||||
])
|
||||
|
||||
@section('content')
|
||||
<form action="{{ route('Shop.Products') }}" method="GET">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-offset-2 col-md-8">
|
||||
|
||||
<div class="box box-info">
|
||||
<div class="box-body">
|
||||
<div class="col-md-6">
|
||||
<h3>{{ name }}</h3>
|
||||
<h4>
|
||||
{{ $product.section.name }}<br>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
<h2>{{ $prix_total }} €</h2>
|
||||
<h4>{{ $residence['type_produit']['name'] }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
@include('Hestimmo.modules.Lot.partials.carousel')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
@@ -1,12 +1,21 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('lots.title'),
|
||||
'subtitle' => __('lots.list.title'),
|
||||
'breadcrumb' => [__('lots.title')]
|
||||
'title' => __('Shop.articles.title'),
|
||||
'subtitle' => __('Shop.articles.list'),
|
||||
'breadcrumb' => [__('Shop.articles.title')]
|
||||
])
|
||||
|
||||
@section('content')
|
||||
<div class="box">
|
||||
<div class="box-body">
|
||||
|
||||
<div class="row pb-3">
|
||||
<div class="col text-right">
|
||||
<a href="{{ route('Shop.Admin.Articles.create') }}" class="btn btn-sm btn-success">{{ __('Shop.Admin.Articles.add') }} <i class="fa fa-plus"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{$dataTable->table()}}
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@include('components.js.datatable', ['route' => '/Shop/Admin/Articles', 'model' => 'articles'])
|
||||
@endpush
|
||||
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
<div class="col-6">
|
||||
{{ Form::label('category_id', 'Catégorie parente') }}
|
||||
@include('components.select', ['name' => 'category_id', 'value' => isset($category_id) ? $category_id : null, 'class' => 'select2 form-control', 'required' => true])
|
||||
@include('components.select', ['name' => 'category_id', 'list' => $categories, 'value' => isset($category_id) ? $category_id : null, 'class' => 'select2 form-control'])
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
{{$dataTable->table()}}
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div id="tree1" data-url="{{ route('Shop.Categories.getTree') }}"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -24,5 +25,15 @@
|
||||
|
||||
@push('scripts')
|
||||
@include('components.js.datatable', ['route' => '/Shop/Admin/Categories', 'model' => 'categories'])
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#tree1').tree({
|
||||
dragAndDrop: true,
|
||||
autoOpen: 0
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
|
||||
|
||||
12
routes/Shop/Admin/ArticleFamilies.php
Normal file
12
routes/Shop/Admin/ArticleFamilies.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
Route::prefix('ArticleFamilies')->name('ArticleFamilies.')->group(function () {
|
||||
Route::get('', 'ArticleFamilyController@index')->name('index');
|
||||
Route::get('create', 'ArticleFamilyController@create')->name('create');
|
||||
Route::delete('destroy', 'ArticleFamilyController@destroy')->name('destroy');
|
||||
Route::post('update', 'ArticleFamilyController@update')->name('update');
|
||||
Route::post('store', 'ArticleFamilyController@store')->name('store');
|
||||
Route::get('edit/{id}', 'ArticleFamilyController@edit')->name('edit');
|
||||
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
Route::middleware('auth')->prefix('Admin')->namespace('Admin')->name('Admin.')->group(function () {
|
||||
Route::get('dashboard', 'DashboardController@index')->name('dashboard');
|
||||
include( __DIR__ . '/ArticleAttributes.php');
|
||||
include( __DIR__ . '/ArticleFamilies.php');
|
||||
include( __DIR__ . '/ArticlePrices.php');
|
||||
include( __DIR__ . '/Articles.php');
|
||||
include( __DIR__ . '/Categories.php');
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
Route::prefix('Categories')->name('Categories.')->group(function () {
|
||||
Route::get('', 'CategoryController@index')->name('index');
|
||||
Route::get('show/{id}', 'CategoryController@show')->name('show');
|
||||
Route::get('getTree', 'CategoryController@getTree')->name('getTree');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user