diff --git a/Gruntfile.js b/Gruntfile.js index 4fbdb612..0393c25e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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', diff --git a/app/DataTables/Botanic/FamiliesDataTable.php b/app/DataTables/Botanic/FamiliesDataTable.php index e1984886..db791b51 100644 --- a/app/DataTables/Botanic/FamiliesDataTable.php +++ b/app/DataTables/Botanic/FamiliesDataTable.php @@ -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) diff --git a/app/DataTables/Botanic/GenresDataTable.php b/app/DataTables/Botanic/GenresDataTable.php index 131c996a..0f8eed5c 100644 --- a/app/DataTables/Botanic/GenresDataTable.php +++ b/app/DataTables/Botanic/GenresDataTable.php @@ -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) diff --git a/app/DataTables/Shop/ArticleFamiliesDataTable.php b/app/DataTables/Shop/ArticleFamiliesDataTable.php new file mode 100644 index 00000000..765d4e5f --- /dev/null +++ b/app/DataTables/Shop/ArticleFamiliesDataTable.php @@ -0,0 +1,30 @@ +exportable(false) + ->printable(false) + ->width(120) + ->addClass('text-center'), + ]; + } + +} diff --git a/app/Http/Controllers/Shop/Admin/ArticleController.php b/app/Http/Controllers/Shop/Admin/ArticleController.php index d29f8e77..b680cdf7 100644 --- a/app/Http/Controllers/Shop/Admin/ArticleController.php +++ b/app/Http/Controllers/Shop/Admin/ArticleController.php @@ -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) - { - // - } } diff --git a/app/Http/Controllers/Shop/Admin/ArticleFamilyController.php b/app/Http/Controllers/Shop/Admin/ArticleFamilyController.php new file mode 100644 index 00000000..894c17b9 --- /dev/null +++ b/app/Http/Controllers/Shop/Admin/ArticleFamilyController.php @@ -0,0 +1,56 @@ +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); + } + +} diff --git a/app/Http/Controllers/Shop/Admin/CategoryController.php b/app/Http/Controllers/Shop/Admin/CategoryController.php index 8c2cc8da..0c945884 100644 --- a/app/Http/Controllers/Shop/Admin/CategoryController.php +++ b/app/Http/Controllers/Shop/Admin/CategoryController.php @@ -14,78 +14,44 @@ class CategoryController extends Controller public function index(CategoriesDataTable $dataTable) { return $dataTable->render('Shop.Admin.Categories.list'); - } + } public function getDatatable(Request $request) { 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); diff --git a/app/Http/Controllers/Shop/CategoryController.php b/app/Http/Controllers/Shop/CategoryController.php index b40d9a49..b5dd9768 100644 --- a/app/Http/Controllers/Shop/CategoryController.php +++ b/app/Http/Controllers/Shop/CategoryController.php @@ -27,4 +27,9 @@ class CategoryController extends Controller return view('Shop.Categories.view', $data); } + public function getTree() + { + return response()->json(Categories::getTree()); + } + } diff --git a/app/Menu/Botanic.php b/app/Menu/Botanic.php index 4bef437b..883ad20f 100644 --- a/app/Menu/Botanic.php +++ b/app/Menu/Botanic.php @@ -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); } } diff --git a/app/Menu/Shop.php b/app/Menu/Shop.php index 8346285d..b4d872d0 100644 --- a/app/Menu/Shop.php +++ b/app/Menu/Shop.php @@ -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); } } diff --git a/app/Models/Botanic/Family.php b/app/Models/Botanic/Family.php index e55405f1..7f45a3d4 100644 --- a/app/Models/Botanic/Family.php +++ b/app/Models/Botanic/Family.php @@ -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); diff --git a/app/Models/Botanic/Genre.php b/app/Models/Botanic/Genre.php index 4a3f79b5..f059a6e6 100644 --- a/app/Models/Botanic/Genre.php +++ b/app/Models/Botanic/Genre.php @@ -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); diff --git a/app/Models/Shop/Article.php b/app/Models/Shop/Article.php index bd147694..f60d917c 100644 --- a/app/Models/Shop/Article.php +++ b/app/Models/Shop/Article.php @@ -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'); + } + } \ No newline at end of file diff --git a/app/Models/Shop/ArticleAttribute.php b/app/Models/Shop/ArticleAttribute.php index 0e165fbc..951a0111 100644 --- a/app/Models/Shop/ArticleAttribute.php +++ b/app/Models/Shop/ArticleAttribute.php @@ -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'); + } } \ No newline at end of file diff --git a/app/Repositories/Core/Tags.php b/app/Repositories/Core/Tags.php new file mode 100644 index 00000000..8d8f5042 --- /dev/null +++ b/app/Repositories/Core/Tags.php @@ -0,0 +1,55 @@ +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); + } + +} diff --git a/app/Repositories/Shop/ArticleAttributeFamilies.php b/app/Repositories/Shop/ArticleAttributeFamilies.php new file mode 100644 index 00000000..5585f9e8 --- /dev/null +++ b/app/Repositories/Shop/ArticleAttributeFamilies.php @@ -0,0 +1,50 @@ +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); + } + +} diff --git a/app/Repositories/Shop/ArticleAttributeValues.php b/app/Repositories/Shop/ArticleAttributeValues.php new file mode 100644 index 00000000..d7906ad1 --- /dev/null +++ b/app/Repositories/Shop/ArticleAttributeValues.php @@ -0,0 +1,50 @@ +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); + } + +} diff --git a/app/Repositories/Shop/ArticleAttributes.php b/app/Repositories/Shop/ArticleAttributes.php new file mode 100644 index 00000000..27284730 --- /dev/null +++ b/app/Repositories/Shop/ArticleAttributes.php @@ -0,0 +1,50 @@ +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); + } + +} diff --git a/app/Repositories/Shop/ArticleCategories.php b/app/Repositories/Shop/ArticleCategories.php new file mode 100644 index 00000000..8ea28331 --- /dev/null +++ b/app/Repositories/Shop/ArticleCategories.php @@ -0,0 +1,50 @@ +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); + } + +} diff --git a/app/Repositories/Shop/ArticleComponents.php b/app/Repositories/Shop/ArticleComponents.php new file mode 100644 index 00000000..27771371 --- /dev/null +++ b/app/Repositories/Shop/ArticleComponents.php @@ -0,0 +1,54 @@ +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); + } + +} diff --git a/app/Repositories/Shop/ArticleFamilies.php b/app/Repositories/Shop/ArticleFamilies.php new file mode 100644 index 00000000..00a42d6c --- /dev/null +++ b/app/Repositories/Shop/ArticleFamilies.php @@ -0,0 +1,50 @@ +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); + } + +} diff --git a/app/Repositories/Shop/ArticlePrices.php b/app/Repositories/Shop/ArticlePrices.php new file mode 100644 index 00000000..8d916bf4 --- /dev/null +++ b/app/Repositories/Shop/ArticlePrices.php @@ -0,0 +1,54 @@ +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); + } + +} diff --git a/app/Repositories/Shop/Categories.php b/app/Repositories/Shop/Categories.php index bb3e81ba..30bede9b 100644 --- a/app/Repositories/Shop/Categories.php +++ b/app/Repositories/Shop/Categories.php @@ -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; } diff --git a/app/Repositories/Shop/CategoryTrees.php b/app/Repositories/Shop/CategoryTrees.php index d4f38664..474ed98c 100644 --- a/app/Repositories/Shop/CategoryTrees.php +++ b/app/Repositories/Shop/CategoryTrees.php @@ -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) { diff --git a/package.json b/package.json index e93a2494..5662fa8e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/resources/views/Shop/Admin/ArticleFamilies/create.blade.php b/resources/views/Shop/Admin/ArticleFamilies/create.blade.php new file mode 100644 index 00000000..53d5e646 --- /dev/null +++ b/resources/views/Shop/Admin/ArticleFamilies/create.blade.php @@ -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]) }} + +