From a18d30b65c8fa8300b901c2c44e0ef3b15934af4 Mon Sep 17 00:00:00 2001 From: Ludovic CANDELLIER Date: Wed, 22 Apr 2020 01:26:03 +0200 Subject: [PATCH] [WIP] Refactor architecture, models --- app/Console/Commands/migrate.php | 7 ++- app/Datatables/Botanic/GenresDataTable.php | 2 +- app/Datatables/Botanic/SpeciesDataTable.php | 4 +- app/Datatables/Botanic/VarietiesDataTable.php | 4 +- .../{ => Shop}/ArticlesDataTable.php | 2 +- .../{ => Shop}/CategoriesDataTable.php | 2 +- .../{ => Shop}/CustomersDataTable.php | 10 ++-- .../{ => Shop}/InvoicesDataTable.php | 10 ++-- app/Datatables/{ => Shop}/OrdersDataTable.php | 10 ++-- .../Shop/Admin/CategoryController.php | 4 +- .../Controllers/Shop/CategoryController.php | 28 +++------ app/Models/Botanic/Specie.php | 2 +- app/Models/Shop/{Product.php => Article.php} | 18 ++++-- ...ductAttribute.php => ArticleAttribute.php} | 6 +- app/Models/Shop/ArticleCategory.php | 31 ++++++++++ app/Models/Shop/ArticleFamily.php | 19 ++++++ app/Models/Shop/ArticlePrice.php | 26 +++++++++ app/Models/Shop/{Section.php => Category.php} | 5 +- app/Models/Shop/ProductPrice.php | 26 --------- app/Models/Shop/ProductSection.php | 31 ---------- app/Repositories/Botanic/Genres.php | 2 +- app/Repositories/Botanic/Species.php | 5 ++ app/Repositories/Botanic/Varieties.php | 54 +++++++++++++++++ app/Repositories/Shop/Categories.php | 40 ++++++++----- app/Repositories/Shop/CategoryTrees.php | 39 +++++++++++++ composer.json | 10 +++- ...212813_create_shop_category_tags_table.php | 35 ----------- resources/lang/fr/botanic.php | 58 +++++++++++++++++++ resources/lang/fr/shop.php | 50 +++------------- .../Botanic/Admin/Species/create.blade.php | 5 +- .../Botanic/Admin/Species/edit.blade.php | 17 +++++- .../Botanic/Admin/Species/form.blade.php | 45 +++++++++++--- .../Botanic/Admin/Varieties/edit.blade.php | 2 +- .../Botanic/Admin/Varieties/form.blade.php | 23 ++++---- .../Shop/Admin/Categories/create.blade.php | 13 ++--- .../Shop/Admin/Categories/edit.blade.php | 14 ++--- .../Shop/Admin/Categories/form.blade.php | 41 ++++++++++++- .../Shop/Admin/Categories/list.blade.php | 10 ++-- resources/views/components/select.blade.php | 2 + 39 files changed, 446 insertions(+), 266 deletions(-) rename app/Datatables/{ => Shop}/ArticlesDataTable.php (95%) rename app/Datatables/{ => Shop}/CategoriesDataTable.php (95%) rename app/Datatables/{ => Shop}/CustomersDataTable.php (70%) rename app/Datatables/{ => Shop}/InvoicesDataTable.php (70%) rename app/Datatables/{ => Shop}/OrdersDataTable.php (70%) rename app/Models/Shop/{Product.php => Article.php} (57%) rename app/Models/Shop/{ProductAttribute.php => ArticleAttribute.php} (62%) create mode 100644 app/Models/Shop/ArticleCategory.php create mode 100644 app/Models/Shop/ArticleFamily.php create mode 100644 app/Models/Shop/ArticlePrice.php rename app/Models/Shop/{Section.php => Category.php} (77%) delete mode 100644 app/Models/Shop/ProductPrice.php delete mode 100644 app/Models/Shop/ProductSection.php create mode 100644 app/Repositories/Botanic/Varieties.php create mode 100644 app/Repositories/Shop/CategoryTrees.php delete mode 100644 database/migrations/2020_04_20_212813_create_shop_category_tags_table.php create mode 100644 resources/lang/fr/botanic.php diff --git a/app/Console/Commands/migrate.php b/app/Console/Commands/migrate.php index 018f736f..8443eb5e 100644 --- a/app/Console/Commands/migrate.php +++ b/app/Console/Commands/migrate.php @@ -41,6 +41,7 @@ class migrate extends Command */ public function handle() { +/* $varieties = Variety::all(); foreach ($varieties as $variety) { $specie_name = $variety->specie; @@ -59,7 +60,7 @@ class migrate extends Command dump("Aucune espèce"); } } - /* +*/ $species = Specie::all(); foreach ($species as $specie) { $genre_name = $specie->genre; @@ -78,8 +79,8 @@ class migrate extends Command dump("Aucun genre"); } } - */ - /* + +/* $genres = Genre::all(); foreach ($genres as $genre) { $family_name = $genre->family; diff --git a/app/Datatables/Botanic/GenresDataTable.php b/app/Datatables/Botanic/GenresDataTable.php index 4cb5b511..131c996a 100644 --- a/app/Datatables/Botanic/GenresDataTable.php +++ b/app/Datatables/Botanic/GenresDataTable.php @@ -23,7 +23,7 @@ class GenresDataTable extends DataTable Column::make('alias'), Column::make('latin'), Column::make('family.name'), - Column::make('species_count')->title('Nb Espèces'), + Column::make('species_count')->title('Nb Espèces')->searchable(false), Column::computed('action') ->exportable(false) ->printable(false) diff --git a/app/Datatables/Botanic/SpeciesDataTable.php b/app/Datatables/Botanic/SpeciesDataTable.php index 308ba84f..400d8e64 100644 --- a/app/Datatables/Botanic/SpeciesDataTable.php +++ b/app/Datatables/Botanic/SpeciesDataTable.php @@ -21,9 +21,9 @@ class SpeciesDataTable extends DataTable return [ Column::make('name')->title('Nom'), Column::make('alias'), - Column::make('genre_name'), + Column::make('genre.name'), Column::make('latin'), - Column::make('varieties_count')->title('Nb variétés'), + Column::make('varieties_count')->title('Nb variétés')->searchable(false), Column::computed('action') ->exportable(false) ->printable(false) diff --git a/app/Datatables/Botanic/VarietiesDataTable.php b/app/Datatables/Botanic/VarietiesDataTable.php index 50e6d5ba..0c8f6da2 100644 --- a/app/Datatables/Botanic/VarietiesDataTable.php +++ b/app/Datatables/Botanic/VarietiesDataTable.php @@ -19,8 +19,8 @@ class VarietiesDataTable extends DataTable protected function getColumns() { return [ - Column::make('specie_name'), - Column::make('name'), + Column::make('specie_name')->title('Espèce'), + Column::make('name')->title('Nom'), Column::computed('action') ->exportable(false) ->printable(false) diff --git a/app/Datatables/ArticlesDataTable.php b/app/Datatables/Shop/ArticlesDataTable.php similarity index 95% rename from app/Datatables/ArticlesDataTable.php rename to app/Datatables/Shop/ArticlesDataTable.php index c38ef69a..e2dcfed1 100644 --- a/app/Datatables/ArticlesDataTable.php +++ b/app/Datatables/Shop/ArticlesDataTable.php @@ -1,6 +1,6 @@ exportable(false) ->printable(false) diff --git a/app/Datatables/InvoicesDataTable.php b/app/Datatables/Shop/InvoicesDataTable.php similarity index 70% rename from app/Datatables/InvoicesDataTable.php rename to app/Datatables/Shop/InvoicesDataTable.php index b76fd131..c392d864 100644 --- a/app/Datatables/InvoicesDataTable.php +++ b/app/Datatables/Shop/InvoicesDataTable.php @@ -1,14 +1,14 @@ exportable(false) ->printable(false) diff --git a/app/Datatables/OrdersDataTable.php b/app/Datatables/Shop/OrdersDataTable.php similarity index 70% rename from app/Datatables/OrdersDataTable.php rename to app/Datatables/Shop/OrdersDataTable.php index b76fd131..98727f6c 100644 --- a/app/Datatables/OrdersDataTable.php +++ b/app/Datatables/Shop/OrdersDataTable.php @@ -1,14 +1,14 @@ exportable(false) ->printable(false) diff --git a/app/Http/Controllers/Shop/Admin/CategoryController.php b/app/Http/Controllers/Shop/Admin/CategoryController.php index 7d0cbcca..8c2cc8da 100644 --- a/app/Http/Controllers/Shop/Admin/CategoryController.php +++ b/app/Http/Controllers/Shop/Admin/CategoryController.php @@ -6,7 +6,7 @@ use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Repositories\Shop\Categories; -use App\DataTables\CategoriesDataTable; +use App\DataTables\Shop\CategoriesDataTable; class CategoryController extends Controller { @@ -40,7 +40,7 @@ class CategoryController extends Controller */ public function store(Request $request) { - $ret = Categories::store($request); + $ret = Categories::store($request->all()); return redirect()->route('Shop.Admin.Categories.index'); } diff --git a/app/Http/Controllers/Shop/CategoryController.php b/app/Http/Controllers/Shop/CategoryController.php index afa96396..b40d9a49 100644 --- a/app/Http/Controllers/Shop/CategoryController.php +++ b/app/Http/Controllers/Shop/CategoryController.php @@ -5,40 +5,26 @@ namespace App\Http\Controllers\Shop; use Illuminate\Http\Request; use App\Http\Controllers\Controller; -use App\Repositories\Shop\Categorys; +use App\Repositories\Shop\Categories; +use App\DataTables\Shop\CategoriesDataTable; class CategoryController extends Controller { - /** - * Display a listing of the resource. - * - * @return \Illuminate\Http\Response - */ - public function index(Request $request) + + public function index(CategoriesDataTable $dataTable) { - if ($request->ajax()) { - return self::getDatatable($request); - } else { - $data = []; - return view('Shop.Categories.list', $data); - } - } + return $dataTable->render('Shop.Categories.list'); + } public function getDatatable(Request $request) { return Categories::getDatatable($request->all()); } - /** - * 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); + return view('Shop.Categories.view', $data); } } diff --git a/app/Models/Botanic/Specie.php b/app/Models/Botanic/Specie.php index 85bf4d31..0b1ce34e 100644 --- a/app/Models/Botanic/Specie.php +++ b/app/Models/Botanic/Specie.php @@ -11,7 +11,7 @@ class Specie extends Model public function Genre() { - return $this->belongsTo('App\Models\Botanic\Family'); + return $this->belongsTo('App\Models\Botanic\Genre'); } public function Varieties() diff --git a/app/Models/Shop/Product.php b/app/Models/Shop/Article.php similarity index 57% rename from app/Models/Shop/Product.php rename to app/Models/Shop/Article.php index b3f4d295..bd147694 100644 --- a/app/Models/Shop/Product.php +++ b/app/Models/Shop/Article.php @@ -5,12 +5,20 @@ namespace App\Models\Shop; use Illuminate\Database\Eloquent\Model; use Rinvex\Categories\Traits\Categorizable; +use Conner\Tagging\Taggable; -class Product extends Model +class Article extends Model { use Categorizable; + use Taggable; + protected $guarded = ['id']; - protected $table = 'shop_products'; + protected $table = 'shop_articles'; + + public function Family() + { + return $this->belongsTo('App\Models\Shop\Family'); + } public function Inventories() { @@ -19,17 +27,17 @@ class Product extends Model public function Prices() { - return $this->hasMany('App\Models\Shop\ProductPrice'); + return $this->hasMany('App\Models\Shop\ArticlePrice'); } public function ProductAttributes() { - return $this->hasMany('App\Models\Shop\ProductAttribute'); + return $this->hasMany('App\Models\Shop\ArticleAttribute'); } public function Categories() { - return $this->hasMany('App\Models\Shop\CategoryProduct'); + return $this->hasMany('App\Models\Shop\ArticleCategory'); } public function InvoiceItems() diff --git a/app/Models/Shop/ProductAttribute.php b/app/Models/Shop/ArticleAttribute.php similarity index 62% rename from app/Models/Shop/ProductAttribute.php rename to app/Models/Shop/ArticleAttribute.php index c44ef62a..0e165fbc 100644 --- a/app/Models/Shop/ProductAttribute.php +++ b/app/Models/Shop/ArticleAttribute.php @@ -4,15 +4,15 @@ namespace App\Models\Shop; use Illuminate\Database\Eloquent\Model; -class ProductAttribute extends Model +class ArticleAttribute extends Model { protected $guarded = ['id']; /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function Product() + public function Article() { - return $this->belongsTo('App\Models\Shop\Product'); + return $this->belongsTo('App\Models\Shop\Article'); } } \ No newline at end of file diff --git a/app/Models/Shop/ArticleCategory.php b/app/Models/Shop/ArticleCategory.php new file mode 100644 index 00000000..2c452111 --- /dev/null +++ b/app/Models/Shop/ArticleCategory.php @@ -0,0 +1,31 @@ +belongsTo('App\Models\Shop\Article'); + } + + public function Category() + { + return $this->belongsTo('App\Models\Shop\Category'); + } + + public function scopeByArticle($query, $id) + { + return $query->where('article_id', $id); + } + + public function scopeByCategory($query, $id) + { + return $query->where('category_id', $id); + } +} \ No newline at end of file diff --git a/app/Models/Shop/ArticleFamily.php b/app/Models/Shop/ArticleFamily.php new file mode 100644 index 00000000..9209afc2 --- /dev/null +++ b/app/Models/Shop/ArticleFamily.php @@ -0,0 +1,19 @@ +hasMany('App\Models\Shop\Article'); + } +} \ No newline at end of file diff --git a/app/Models/Shop/ArticlePrice.php b/app/Models/Shop/ArticlePrice.php new file mode 100644 index 00000000..aeb21df0 --- /dev/null +++ b/app/Models/Shop/ArticlePrice.php @@ -0,0 +1,26 @@ +belongsTo('App\Models\Shop\Article'); + } + + public function ArticleAttribute() + { + return $this->belongsTo('App\Models\Shop\ArticleAttribute'); + } + + public function scopeByArticle($query, $id) + { + return $query->where('article_id', $id); + } + +} \ No newline at end of file diff --git a/app/Models/Shop/Section.php b/app/Models/Shop/Category.php similarity index 77% rename from app/Models/Shop/Section.php rename to app/Models/Shop/Category.php index df05fd37..f59de402 100644 --- a/app/Models/Shop/Section.php +++ b/app/Models/Shop/Category.php @@ -5,11 +5,12 @@ namespace App\Models\Shop; use Illuminate\Database\Eloquent\Model; use Rinvex\Categories\Traits\Categorizable; +use Conner\Tagging\Taggable; -class Section extends Model +class Category extends Model { protected $guarded = ['id']; - protected $table = 'shop_sections'; + protected $table = 'shop_categories'; public function Category() { diff --git a/app/Models/Shop/ProductPrice.php b/app/Models/Shop/ProductPrice.php deleted file mode 100644 index 1d49891e..00000000 --- a/app/Models/Shop/ProductPrice.php +++ /dev/null @@ -1,26 +0,0 @@ -belongsTo('App\Models\Shop\Product'); - } - - public function ProductAttribute() - { - return $this->belongsTo('App\Models\Shop\ProductAttribute'); - } - - public function scopeByProduct($query, $id) - { - return $query->where('product_id', $id); - } - -} \ No newline at end of file diff --git a/app/Models/Shop/ProductSection.php b/app/Models/Shop/ProductSection.php deleted file mode 100644 index 86a2ab0b..00000000 --- a/app/Models/Shop/ProductSection.php +++ /dev/null @@ -1,31 +0,0 @@ -belongsTo('App\Models\Shop\Product'); - } - - public function Section() - { - return $this->belongsTo('App\Models\Shop\Product'); - } - - public function scopeByProduct($query, $id) - { - return $query->where('product_id', $id); - } - - public function scopeBySection($query, $id) - { - return $query->where('section_id', $id); - } -} \ No newline at end of file diff --git a/app/Repositories/Botanic/Genres.php b/app/Repositories/Botanic/Genres.php index fa63cb7c..f6715f9e 100644 --- a/app/Repositories/Botanic/Genres.php +++ b/app/Repositories/Botanic/Genres.php @@ -21,7 +21,7 @@ class Genres public static function getOptions() { - return Family::get()->SortBy('name')->pluck('name','id')->toArray(); + return Genre::get()->SortBy('name')->pluck('name','id')->toArray(); } public static function getAll() diff --git a/app/Repositories/Botanic/Species.php b/app/Repositories/Botanic/Species.php index 0a9e58fe..243ee5b7 100644 --- a/app/Repositories/Botanic/Species.php +++ b/app/Repositories/Botanic/Species.php @@ -19,6 +19,11 @@ class Species return Datatables::of($model)->make(true); } + public static function getOptions() + { + return Specie::get()->SortBy('name')->pluck('name','id')->toArray(); + } + public static function getAll() { return Specie::orderBy('name','asc')->get(); diff --git a/app/Repositories/Botanic/Varieties.php b/app/Repositories/Botanic/Varieties.php new file mode 100644 index 00000000..28fd13d2 --- /dev/null +++ b/app/Repositories/Botanic/Varieties.php @@ -0,0 +1,54 @@ +make(true); + } + + public static function getAll() + { + return Variety::orderBy('name','asc')->get(); + } + + public static function get($id) + { + return Variety::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 Variety::create($data); + } + + public static function update($data) + { + return Variety::find($id)->update($data); + } + + public static function destroy($id) + { + return Variety::destroy($id); + } + +} diff --git a/app/Repositories/Shop/Categories.php b/app/Repositories/Shop/Categories.php index 697917a9..bb3e81ba 100644 --- a/app/Repositories/Shop/Categories.php +++ b/app/Repositories/Shop/Categories.php @@ -2,55 +2,63 @@ 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\Categorie; +use App\Models\Shop\Category; class Categories { public static function getDatatable() { - $model = Categorie::orderBy('name'); + $model = Category::orderBy('name'); return Datatables::of($model)->make(true); } public static function getAll() { - return Categorie::orderBy('name','asc')->get(); + return Category::orderBy('name','asc')->get(); } public static function get($id) { - return Categorie::find($id); + return Category::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; + return $id ? self::update($data, $id) : self::create($data); } public static function create($data) { - app('rinvex.categories.category')->create(['name' => $data['name']]); - return Categorie::create($data); + $node = CategoryTrees::create($data); + $data['category_id'] = $node->id; + dump($data); + $category = Category::create($data); + exit; + return $category; } - public static function update($data) + public static function update($data, $id = false) { - app('rinvex.categories.category')->update(['name' => $data['name']]); - return Categorie::find($id)->update($data); + $id = $id ? $id : $data['id']; + $category = Category::find($id)->update($data); + CategoryTrees::update($data, $category->category_id); + return $category; } public static function destroy($id) { - return Categorie::destroy($id); + // $category = self::get($id); + // self::deleteNode($category->category_id); + return Category::destroy($id); + } + + public static function getRoot() + { + return app('rinvex.categorys.category')->find(1); } } diff --git a/app/Repositories/Shop/CategoryTrees.php b/app/Repositories/Shop/CategoryTrees.php new file mode 100644 index 00000000..d4f38664 --- /dev/null +++ b/app/Repositories/Shop/CategoryTrees.php @@ -0,0 +1,39 @@ +create(['name' => $data['name']]); + $category->appendToNode($parent)->save(); + return $category; + } + + public static function update($data, $id = false) + { + $id = $id ? $id : $data['category_id']; + return self::getNode($id)->update(['name' => $data['name']]); + } + + public static function destroy($id) + { + // return Category::destroy($id); + } + + public static function getRoot() + { + return self::getNode(1); + } + + public static function getNode($id) + { + return app('rinvex.categories.category')->find($id); + } + +} diff --git a/composer.json b/composer.json index 510845f6..f2a283ad 100644 --- a/composer.json +++ b/composer.json @@ -136,5 +136,13 @@ "post-create-project-cmd": [ "@php artisan key:generate --ansi" ] - } + }, + "authors": [ + { + "name": "Ludovic CANDELLIER", + "email": "ludo@huma.net", + "homepage": "https://huma.net", + "role": "Developper" + } + ] } diff --git a/database/migrations/2020_04_20_212813_create_shop_category_tags_table.php b/database/migrations/2020_04_20_212813_create_shop_category_tags_table.php deleted file mode 100644 index 5b88f239..00000000 --- a/database/migrations/2020_04_20_212813_create_shop_category_tags_table.php +++ /dev/null @@ -1,35 +0,0 @@ -increments('id'); - $table->integer('category_id')->unsigned()->nullable(); - $table->string('name', 50)->nullable(); - $table->text('description', 65535)->nullable(); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('shop_category_tags'); - } - -} diff --git a/resources/lang/fr/botanic.php b/resources/lang/fr/botanic.php new file mode 100644 index 00000000..2bf5e8dd --- /dev/null +++ b/resources/lang/fr/botanic.php @@ -0,0 +1,58 @@ + 'Résidences', + 'name' => 'Référence', + 'parameters' => 'Paramètres', + 'label' => 'Libellé', + 'description' => 'Description', + 'savebutton' => 'Enregistrer', + 'families' => [ + 'title' => 'Familles', + 'description' => 'Gérer les familles', + 'list' => 'Liste des familles', + 'add' => 'Ajouter une famille', + 'edit' => 'Editer une famille', + 'del' => 'Effacer une famille', + 'successadd' => 'La famille a été correctement ajoutée', + 'successmod' => 'La famille a été correctement modifiée', + 'successdel' => 'La famille a été correctement effacée', + 'confirmdelete' => 'Confirmez-vous la suppression de la famille ?', + ], + 'species' => [ + 'title' => 'Espèces', + 'description' => 'Gérer les espèce', + 'list' => 'Liste des espèces', + 'add' => 'Ajouter une espèce', + 'edit' => 'Editer une espèce', + 'del' => 'Effacer une espèce', + 'successadd' => 'L\'espèce a été correctement ajoutée', + 'successmod' => 'L\'espèce a été correctement modifiée', + 'successdel' => 'L\'espèce a été correctement effacée', + 'confirmdelete' => 'Confirmez-vous la suppression de l\'espèce ?', + ], + 'genres' => [ + 'title' => 'Genres', + 'description' => 'Gérer les genres', + 'list' => 'Liste des genres', + 'add' => 'Ajouter un genre', + 'edit' => 'Editer un genre', + 'del' => 'Effacer un genre', + 'successadd' => 'Le genre a été correctement ajoutée', + 'successmod' => 'Le genre a été correctement modifiée', + 'successdel' => 'Le genre a été correctement effacée', + 'confirmdelete' => 'Confirmez-vous la suppression du genre ?', + ], + 'varieties' => [ + 'title' => 'Variétés', + 'description' => 'Gérer les Variétés', + 'list' => 'Liste des Variétés', + 'add' => 'Ajouter une Variété', + 'edit' => 'Editer une Variété', + 'del' => 'Effacer une Variété', + 'successadd' => 'La Variété a été correctement ajoutée', + 'successmod' => 'La Variété a été correctement modifiée', + 'successdel' => 'La Variété a été correctement effacée', + 'confirmdelete' => 'Confirmez-vous la suppression de la Variété ?', + ], +]; diff --git a/resources/lang/fr/shop.php b/resources/lang/fr/shop.php index 7961ee9f..9951e8aa 100644 --- a/resources/lang/fr/shop.php +++ b/resources/lang/fr/shop.php @@ -7,8 +7,8 @@ return [ 'label' => 'Libellé', 'description' => 'Description', 'savebutton' => 'Enregistrer', - 'sections' => [ - 'title' => 'Gestion des catégories', + 'categories' => [ + 'title' => 'Catégories', 'description' => 'Gérer les catégories', 'add' => 'Ajouter une catégorie', 'edit' => 'Editer une catégorie', @@ -19,48 +19,14 @@ return [ 'successdel' => 'La catégorie a été correctement effacée', 'confirmdelete' => 'Confirmez-vous la suppression de la catégorie ?', ], - 'families' => [ - 'title' => 'Familles', - 'description' => 'Gérer les familles', - 'list' => 'Liste des familles', - 'add' => 'Ajouter une famille', - 'edit' => 'Editer une famille', - 'del' => 'Effacer une famille', - 'successadd' => 'La famille a été correctement ajoutée', - 'successmod' => 'La famille a été correctement modifiée', - 'successdel' => 'La famille a été correctement effacée', - 'confirmdelete' => 'Confirmez-vous la suppression de la famille ?', - ], - 'species' => [ - 'title' => 'Espèces', - 'description' => 'Gérer les espèce', - 'list' => 'Liste des espèces', - 'add' => 'Ajouter une espèce', - 'edit' => 'Editer une espèce', - 'del' => 'Effacer une espèce', - 'successadd' => 'L\'espèce a été correctement ajoutée', - 'successmod' => 'L\'espèce a été correctement modifiée', - 'successdel' => 'L\'espèce a été correctement effacée', - 'confirmdelete' => 'Confirmez-vous la suppression de l\'espèce ?', - ], - 'genres' => [ - 'title' => 'Genres', - 'description' => 'Gérer les genres', - 'list' => 'Liste des genres', - 'add' => 'Ajouter un genre', - 'edit' => 'Editer un genre', - 'del' => 'Effacer un genre', - 'successadd' => 'Le genre a été correctement ajoutée', - 'successmod' => 'Le genre a été correctement modifiée', - 'successdel' => 'Le genre a été correctement effacée', - 'confirmdelete' => 'Confirmez-vous la suppression du genre ?', - ], - 'products' => [ - 'title' => 'Gestion des produits', - 'description' => 'Gérer les produits', + 'articles' => [ + 'title' => 'Articles', + 'list' => 'Liste des articles', + 'description' => 'Gérer les articles', ], 'customers' => [ - 'title' => "Gestion des clients", + 'title' => "Clients", + 'list' => 'Liste des clients', 'description' => 'Gérer les clients', ], ]; diff --git a/resources/views/Botanic/Admin/Species/create.blade.php b/resources/views/Botanic/Admin/Species/create.blade.php index 068615a9..346f53de 100644 --- a/resources/views/Botanic/Admin/Species/create.blade.php +++ b/resources/views/Botanic/Admin/Species/create.blade.php @@ -4,12 +4,9 @@ 'breadcrumb' => [__('Botanic.species.title'), __('Botanic.species.add')] ]) -@include('boilerplate::load.fileinput') - @section('content') - {{ Form::open(['route' => 'Botanic.Admin.Species.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }} - + {{ Form::open(['route' => 'Botanic.Admin.Species.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }} @include('Botanic.Admin.Species.form') diff --git a/resources/views/Botanic/Admin/Species/edit.blade.php b/resources/views/Botanic/Admin/Species/edit.blade.php index a0751925..ef272e66 100644 --- a/resources/views/Botanic/Admin/Species/edit.blade.php +++ b/resources/views/Botanic/Admin/Species/edit.blade.php @@ -1,16 +1,27 @@ @extends('layout.index', [ 'title' => __('Botanic.species.title'), 'subtitle' => __('Botanic.species.edit'), - 'breadcrumb' => ['Botanic.species.title'] + 'breadcrumb' => [__('Botanic.species.title'), __('Botanic.species.list')] ]) +@include('boilerplate::load.fileinput') +@include('boilerplate::load.select2') + @section('content') - {{ Form::open(['route' => 'Botanic.Admin.Species.store', 'id' => 'form', 'autocomplete' => 'off']) }} - + {{ Form::open(['route' => 'Botanic.Admin.Species.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }} + @include('Botanic.Admin.Species.form') @endsection + +@push('js') + +@endpush \ No newline at end of file diff --git a/resources/views/Botanic/Admin/Species/form.blade.php b/resources/views/Botanic/Admin/Species/form.blade.php index 17e8cdfa..3f2c0ec2 100644 --- a/resources/views/Botanic/Admin/Species/form.blade.php +++ b/resources/views/Botanic/Admin/Species/form.blade.php @@ -1,20 +1,40 @@ +@include('boilerplate::load.fileinput') +@include('boilerplate::load.select2') +@include('boilerplate::load.tinymce') +
- {{ Form::label('name', 'Nom') }} - @include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true]) +
+
+ {{ Form::label('name', 'Nom') }} + @include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true]) +
+
+ {{ Form::label('latin', 'Nom latin') }} + @include('components.input', ['name' => 'latin', 'value' => isset($latin) ? $latin : null, 'required' => true]) +
+
- {{ Form::label('alias', 'Alias') }} - @include('components.input', ['name' => 'alias', 'value' => isset($alias) ? $alias : null, 'required' => true]) +
+
+ {{ Form::label('genre', 'Genre') }} + @include('components.select', ['name' => 'genre_id', 'list' => $genres, 'value' => isset($genre_id) ? $genre_id : null, 'class' => 'select2 form-control', 'required' => false]) +
+
+ {{ Form::label('alias', 'Alias') }} + @include('components.input', ['name' => 'alias', 'value' => isset($alias) ? $alias : null, 'required' => true]) +
+
- {{ Form::label('latin', 'Nom latin') }} - @include('components.input', ['name' => 'latin', 'value' => isset($latin) ? $latin : null, 'required' => true]) {{ Form::label('description', 'Description') }} @include('components.textarea', ['name' => 'description', 'value' => isset($description) ? $description : null, 'class' => 'editor', 'required' => false]) - {{ Form::label('genre', 'Genre') }} - @include('components.select', ['name' => 'genre_id', 'list' => $genres, 'value' => isset($genre_id) ? $genre_id : null, 'required' => false]) +
+
+ {{ Form::label('photo', 'Photos') }} + @include('components.file', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true])
@@ -26,3 +46,12 @@ + +@push('js') + +@endpush \ No newline at end of file diff --git a/resources/views/Botanic/Admin/Varieties/edit.blade.php b/resources/views/Botanic/Admin/Varieties/edit.blade.php index 2a887774..a2a9e37b 100644 --- a/resources/views/Botanic/Admin/Varieties/edit.blade.php +++ b/resources/views/Botanic/Admin/Varieties/edit.blade.php @@ -7,7 +7,7 @@ @section('content') {{ Form::open(['route' => 'Botanic.Admin.Varieties.store', 'id' => 'form', 'autocomplete' => 'off']) }} - + @include('Botanic.Admin.Varieties.form') diff --git a/resources/views/Botanic/Admin/Varieties/form.blade.php b/resources/views/Botanic/Admin/Varieties/form.blade.php index 17e8cdfa..322e0fba 100644 --- a/resources/views/Botanic/Admin/Varieties/form.blade.php +++ b/resources/views/Botanic/Admin/Varieties/form.blade.php @@ -1,20 +1,19 @@
- {{ Form::label('name', 'Nom') }} - @include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true]) - - {{ Form::label('alias', 'Alias') }} - @include('components.input', ['name' => 'alias', 'value' => isset($alias) ? $alias : null, 'required' => true]) - - {{ Form::label('latin', 'Nom latin') }} - @include('components.input', ['name' => 'latin', 'value' => isset($latin) ? $latin : null, 'required' => true]) +
+
+ {{ Form::label('name', 'Nom') }} + @include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true]) +
+
+ {{ Form::label('genre', 'Espèce') }} + @include('components.select', ['name' => 'specie_id', 'list' => $species, 'value' => isset($specie_id) ? $specie_id : null, 'required' => false]) +
+
{{ Form::label('description', 'Description') }} - @include('components.textarea', ['name' => 'description', 'value' => isset($description) ? $description : null, 'class' => 'editor', 'required' => false]) + @include('components.textarea', ['name' => 'description', 'value' => isset($description) ? $description : null, 'class' => 'editor', 'rows' => 5, 'required' => false]) - {{ Form::label('genre', 'Genre') }} - @include('components.select', ['name' => 'genre_id', 'list' => $genres, 'value' => isset($genre_id) ? $genre_id : null, 'required' => false]) -
diff --git a/resources/views/Shop/Admin/Categories/create.blade.php b/resources/views/Shop/Admin/Categories/create.blade.php index ee61cdbf..8cb4309b 100644 --- a/resources/views/Shop/Admin/Categories/create.blade.php +++ b/resources/views/Shop/Admin/Categories/create.blade.php @@ -1,16 +1,13 @@ @extends('layout.index', [ - 'title' => __('Shop.sections.title'), - 'subtitle' => __('Shop.sections.add'), - 'breadcrumb' => [__('Shop.sections.title'), __('Shop.sections.add')] + 'title' => __('Shop.categories.title'), + 'subtitle' => __('Shop.categories.add'), + 'breadcrumb' => [__('Shop.categories.title'), __('Shop.categories.list')] ]) -@include('boilerplate::load.fileinput') - @section('content') - {{ Form::open(['route' => 'Shop.Admin.Sections.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }} - - @include('Shop.Admin.Sections.form') + {{ Form::open(['route' => 'Shop.Admin.Categories.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }} + @include('Shop.Admin.Categories.form') @endsection diff --git a/resources/views/Shop/Admin/Categories/edit.blade.php b/resources/views/Shop/Admin/Categories/edit.blade.php index 0c792c69..17683077 100644 --- a/resources/views/Shop/Admin/Categories/edit.blade.php +++ b/resources/views/Shop/Admin/Categories/edit.blade.php @@ -1,16 +1,14 @@ @extends('layout.index', [ - 'title' => __('Shop.species.title'), - 'subtitle' => __('Shop.species.edit'), - 'breadcrumb' => ['Familles'] + 'title' => __('Shop.categories.title'), + 'subtitle' => __('Shop.categories.edit'), + 'breadcrumb' => [__('Shop.categories.title'), __('Shop.categories.list')] ]) @section('content') - {{ Form::open(['route' => 'Shop.Admin.Species.store', 'id' => 'form', 'autocomplete' => 'off']) }} - - - @include('Shop.Admin.Species.form') - + {{ Form::open(['route' => 'Shop.Admin.Categories.store', 'id' => 'form', 'autocomplete' => 'off']) }} + + @include('Shop.Admin.Categories.form') @endsection diff --git a/resources/views/Shop/Admin/Categories/form.blade.php b/resources/views/Shop/Admin/Categories/form.blade.php index 5bcd71ec..f46c382a 100644 --- a/resources/views/Shop/Admin/Categories/form.blade.php +++ b/resources/views/Shop/Admin/Categories/form.blade.php @@ -1,8 +1,35 @@ +@include('boilerplate::load.fileinput') +@include('boilerplate::load.select2') +@include('boilerplate::load.tinymce') +
- {{ Form::label('name', 'Nom') }} - @include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true]) - +
+
+ {{ Form::label('name', 'Nom') }} + @include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true]) +
+
+ {{ 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]) +
+
+
+
+ {{ Form::label('tags', 'Tags') }} + @include('components.select', ['name' => 'tags', 'value' => isset($tags) ? $tags : null, 'class' => 'select2 form-control', 'multiple' => true]) +
+
+
+
+ {{ Form::label('description', 'Description') }} + @include('components.textarea', ['name' => 'description', 'value' => isset($description) ? $description : null, 'class' => 'editor', 'required' => true]) +
+
+
+
+ {{ Form::label('photo', 'Photos') }} + @include('components.file', ['name' => 'photo', 'value' => isset($photo) ? $photo : null, 'required' => true])
@@ -14,3 +41,11 @@ +@push('js') + +@endpush \ No newline at end of file diff --git a/resources/views/Shop/Admin/Categories/list.blade.php b/resources/views/Shop/Admin/Categories/list.blade.php index 4052f9c4..d822aa64 100644 --- a/resources/views/Shop/Admin/Categories/list.blade.php +++ b/resources/views/Shop/Admin/Categories/list.blade.php @@ -1,14 +1,14 @@ @extends('layout.index', [ - 'title' => __('Shop.Categories.title'), - 'subtitle' => __('Shop.Categories.list'), - 'breadcrumb' => [__('Shop.Categories.title')] + 'title' => __('Shop.categories.title'), + 'subtitle' => __('Shop.categories.list'), + 'breadcrumb' => [__('Shop.categories.title')] ]) @section('content')
@@ -23,6 +23,6 @@ @endsection @push('scripts') - @include('components.js.datatable', ['route' => '/Shop/Admin/Categories', 'model' => 'Categories']) + @include('components.js.datatable', ['route' => '/Shop/Admin/Categories', 'model' => 'categories']) @endpush diff --git a/resources/views/components/select.blade.php b/resources/views/components/select.blade.php index ae05c50d..fa60652a 100644 --- a/resources/views/components/select.blade.php +++ b/resources/views/components/select.blade.php @@ -3,6 +3,8 @@ @if (isset($id_name))id="{{ $id_name }}"@endif class="@if (isset($class)){{ $class }} @else form-control @endif" @if (isset($style))style="{{ $style }}" @endif + @if (isset($required))required="required"@endif + @if (isset($multiple))multiple="multiple"@endif > @if (isset($complex) && $complex)