Add varieties
This commit is contained in:
@@ -5,6 +5,8 @@ namespace App\Console\Commands;
|
|||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use App\Models\Shop\Family;
|
use App\Models\Shop\Family;
|
||||||
use App\Models\Shop\Genre;
|
use App\Models\Shop\Genre;
|
||||||
|
use App\Models\Shop\Specie;
|
||||||
|
use App\Models\Shop\Variety;
|
||||||
|
|
||||||
class migrate extends Command
|
class migrate extends Command
|
||||||
{
|
{
|
||||||
@@ -39,6 +41,45 @@ class migrate extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
$varieties = Variety::all();
|
||||||
|
foreach ($varieties as $variety) {
|
||||||
|
$specie_name = $variety->specie;
|
||||||
|
dump($specie_name);
|
||||||
|
if (!empty($specie_name)) {
|
||||||
|
$specie = Specie::byName($specie_name)->first();
|
||||||
|
if (isset($specie->name))
|
||||||
|
{
|
||||||
|
dump($specie->name);
|
||||||
|
$variety->specie_id = $specie->id;
|
||||||
|
$variety->save();
|
||||||
|
} else {
|
||||||
|
dump("non trouvé");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dump("Aucune espèce");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
$species = Specie::all();
|
||||||
|
foreach ($species as $specie) {
|
||||||
|
$genre_name = $specie->genre;
|
||||||
|
dump($genre_name);
|
||||||
|
if (!empty($genre_name)) {
|
||||||
|
$genre = Genre::byName($genre_name)->first();
|
||||||
|
if (isset($genre->name))
|
||||||
|
{
|
||||||
|
dump($genre->name);
|
||||||
|
$specie->genre_id = $genre->id;
|
||||||
|
$specie->save();
|
||||||
|
} else {
|
||||||
|
dump("non trouvé");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dump("Aucun genre");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
/*
|
||||||
$genres = Genre::all();
|
$genres = Genre::all();
|
||||||
foreach ($genres as $genre) {
|
foreach ($genres as $genre) {
|
||||||
$family_name = $genre->family;
|
$family_name = $genre->family;
|
||||||
@@ -57,5 +98,6 @@ class migrate extends Command
|
|||||||
dump("Aucune famille");
|
dump("Aucune famille");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,18 +12,21 @@ class FamiliesDataTable extends DataTable
|
|||||||
|
|
||||||
public function query(Family $model)
|
public function query(Family $model)
|
||||||
{
|
{
|
||||||
|
$model = $model::withCount('genres');
|
||||||
return self::buildQuery($model);
|
return self::buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Column::make('name'),
|
Column::make('name')->title('Nom'),
|
||||||
Column::make('alias'),
|
Column::make('alias'),
|
||||||
Column::make('latin'),
|
Column::make('latin'),
|
||||||
|
Column::make('genres_count')->title('Nb genres'),
|
||||||
Column::computed('action')
|
Column::computed('action')
|
||||||
->exportable(false)
|
->exportable(false)
|
||||||
->printable(false)
|
->printable(false)
|
||||||
|
->searchable(false)
|
||||||
->width(120)
|
->width(120)
|
||||||
->addClass('text-center'),
|
->addClass('text-center'),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -12,15 +12,18 @@ class GenresDataTable extends DataTable
|
|||||||
|
|
||||||
public function query(Genre $model)
|
public function query(Genre $model)
|
||||||
{
|
{
|
||||||
|
$model = $model::with('family')->withCount('species');
|
||||||
return self::buildQuery($model);
|
return self::buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Column::make('name'),
|
Column::make('name')->title('Nom'),
|
||||||
Column::make('alias'),
|
Column::make('alias'),
|
||||||
Column::make('latin'),
|
Column::make('latin'),
|
||||||
|
Column::make('family.name'),
|
||||||
|
Column::make('species_count')->title('Nb Espèces'),
|
||||||
Column::computed('action')
|
Column::computed('action')
|
||||||
->exportable(false)
|
->exportable(false)
|
||||||
->printable(false)
|
->printable(false)
|
||||||
|
|||||||
@@ -29,11 +29,17 @@ class ParentDataTable extends DataTable
|
|||||||
* @return \Yajra\DataTables\DataTableAbstract
|
* @return \Yajra\DataTables\DataTableAbstract
|
||||||
*/
|
*/
|
||||||
public function addButtons($datatables)
|
public function addButtons($datatables)
|
||||||
|
{
|
||||||
|
$buttons = self::getHtmlButtons();
|
||||||
|
return $datatables->addColumn('action', $buttons);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHtmlButtons()
|
||||||
{
|
{
|
||||||
$buttons = '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-secondary btn-show mr-2"><i class="fa fa-fw fa-eye"></i></button>';
|
$buttons = '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-secondary btn-show mr-2"><i class="fa fa-fw fa-eye"></i></button>';
|
||||||
$buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-primary btn-edit mr-2"><i class="fa fa-fw fa-edit"></i></button>';
|
$buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-primary btn-edit mr-2"><i class="fa fa-fw fa-edit"></i></button>';
|
||||||
$buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-danger btn-del"><i class="fa fa-fw fa-trash"></i></button>';
|
$buttons .= '<button type="button" data-id="{{$id}}" class="btn btn-xs btn-danger btn-del"><i class="fa fa-fw fa-trash"></i></button>';
|
||||||
return $datatables->addColumn('action', $buttons);
|
return $buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
32
app/Datatables/VarietiesDataTable.php
Normal file
32
app/Datatables/VarietiesDataTable.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\DataTables;
|
||||||
|
|
||||||
|
use Yajra\DataTables\Html\Column;
|
||||||
|
use App\DataTables\ParentDataTable as DataTable;
|
||||||
|
use App\Models\Shop\Variety;
|
||||||
|
|
||||||
|
class VarietiesDataTable extends DataTable
|
||||||
|
{
|
||||||
|
public $model_name = 'Varieties';
|
||||||
|
|
||||||
|
public function query(Variety $model)
|
||||||
|
{
|
||||||
|
$model = $model::with('specie');
|
||||||
|
return self::buildQuery($model);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getColumns()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Column::make('specie_name'),
|
||||||
|
Column::make('name'),
|
||||||
|
Column::computed('action')
|
||||||
|
->exportable(false)
|
||||||
|
->printable(false)
|
||||||
|
->width(120)
|
||||||
|
->addClass('text-center'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
|
||||||
use App\Repositories\Shop\Genres;
|
use App\Repositories\Shop\Genres;
|
||||||
|
use App\Repositories\Shop\Families;
|
||||||
use App\DataTables\GenresDataTable;
|
use App\DataTables\GenresDataTable;
|
||||||
|
|
||||||
class GenreController extends Controller
|
class GenreController extends Controller
|
||||||
@@ -39,7 +40,8 @@ class GenreController extends Controller
|
|||||||
|
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$data['genre'] = Genres::get($id);
|
$data = Genres::get($id);
|
||||||
|
$data['families'] = Families::getOptions();
|
||||||
return view('Shop.Admin.Genres.edit', $data);
|
return view('Shop.Admin.Genres.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
|
||||||
use App\Repositories\Shop\Species;
|
use App\Repositories\Shop\Species;
|
||||||
|
use App\Repositories\Shop\Genres;
|
||||||
use App\DataTables\SpeciesDataTable;
|
use App\DataTables\SpeciesDataTable;
|
||||||
|
|
||||||
class SpecieController extends Controller
|
class SpecieController extends Controller
|
||||||
@@ -39,7 +40,8 @@ class SpecieController extends Controller
|
|||||||
|
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$data['specie'] = Species::get($id);
|
$data = Species::get($id);
|
||||||
|
$data['genres'] = Genres::getOptions();
|
||||||
return view('Shop.Admin.Species.edit', $data);
|
return view('Shop.Admin.Species.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
53
app/Http/Controllers/Shop/Admin/VarietyController.php
Normal file
53
app/Http/Controllers/Shop/Admin/VarietyController.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Shop\Admin;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
|
||||||
|
use App\Repositories\Shop\Varieties;
|
||||||
|
use App\Repositories\Shop\Species;
|
||||||
|
use App\DataTables\VarietiesDataTable;
|
||||||
|
|
||||||
|
class VarietyController extends Controller
|
||||||
|
{
|
||||||
|
public function index(VarietiesDataTable $dataTable)
|
||||||
|
{
|
||||||
|
return $dataTable->render('Shop.Admin.Varieties.list');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDatatable(Request $request)
|
||||||
|
{
|
||||||
|
return Varieties::getDatatable($request->all());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('Shop.Admin.Varieties.create');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$ret = Varieties::store($request);
|
||||||
|
return redirect()->route('Shop.Admin.Varieties.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$data = Varieties::get($id);
|
||||||
|
return view('Shop.Admin.Varieties.view', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$data = Varieties::get($id);
|
||||||
|
$data['species'] = Species::getOptions();
|
||||||
|
return view('Shop.Admin.Varieties.edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
return Varieties::destroy($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -20,15 +20,17 @@ class Shop
|
|||||||
->activeIfRoute(['Shop.Admin.Genres.index'])->order(2);
|
->activeIfRoute(['Shop.Admin.Genres.index'])->order(2);
|
||||||
$menu->addTo('shop', 'Espèces', [ 'route' => 'Shop.Admin.Species.index', 'permission' => 'backend' ])
|
$menu->addTo('shop', 'Espèces', [ 'route' => 'Shop.Admin.Species.index', 'permission' => 'backend' ])
|
||||||
->activeIfRoute(['Shop.Admin.Species.index'])->order(3);
|
->activeIfRoute(['Shop.Admin.Species.index'])->order(3);
|
||||||
|
$menu->addTo('shop', 'Variétés', [ 'route' => 'Shop.Admin.Varieties.index', 'permission' => 'backend' ])
|
||||||
|
->activeIfRoute(['Shop.Admin.Varieties.index'])->order(4);
|
||||||
|
|
||||||
$menu->addTo('shop', 'Categories', [ 'route' => 'Shop.Admin.Sections.index', 'permission' => 'backend' ])
|
$menu->addTo('shop', 'Categories', [ 'route' => 'Shop.Admin.Sections.index', 'permission' => 'backend' ])
|
||||||
->activeIfRoute(['Shop.Admin.Sections.index'])->order(4);
|
->activeIfRoute(['Shop.Admin.Sections.index'])->order(5);
|
||||||
$menu->addTo('shop', 'Produits', [ 'route' => 'Shop.Admin.Products.index', 'permission' => 'backend' ])
|
$menu->addTo('shop', 'Produits', [ 'route' => 'Shop.Admin.Products.index', 'permission' => 'backend' ])
|
||||||
->activeIfRoute(['Shop.Admin.Products.index'])->order(5);
|
->activeIfRoute(['Shop.Admin.Products.index'])->order(6);
|
||||||
$menu->addTo('shop', 'Commandes', [ 'route' => 'Shop.Admin.Orders.index', 'permission' => 'backend' ])
|
$menu->addTo('shop', 'Commandes', [ 'route' => 'Shop.Admin.Orders.index', 'permission' => 'backend' ])
|
||||||
->activeIfRoute(['Shop.Admin.Orders.index'])->order(6);
|
->activeIfRoute(['Shop.Admin.Orders.index'])->order(7);
|
||||||
$menu->addTo('shop', 'Factures', [ 'route' => 'Shop.Admin.Invoices.index', 'permission' => 'backend' ])
|
$menu->addTo('shop', 'Factures', [ 'route' => 'Shop.Admin.Invoices.index', 'permission' => 'backend' ])
|
||||||
->activeIfRoute(['Shop.Admin.Invoices.index'])->order(7);
|
->activeIfRoute(['Shop.Admin.Invoices.index'])->order(8);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ class Genre extends Model
|
|||||||
return $this->belongsTo('App\Models\Shop\Family');
|
return $this->belongsTo('App\Models\Shop\Family');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function species()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Models\Shop\Specie');
|
||||||
|
}
|
||||||
|
|
||||||
public function scopeByName($query,$name)
|
public function scopeByName($query,$name)
|
||||||
{
|
{
|
||||||
return $query->where('name', $name);
|
return $query->where('name', $name);
|
||||||
|
|||||||
@@ -13,4 +13,15 @@ class Specie extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo('App\Models\Shop\Family');
|
return $this->belongsTo('App\Models\Shop\Family');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function Varieties()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Models\Shop\Variety');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopeByName($query,$name)
|
||||||
|
{
|
||||||
|
return $query->where('name', $name);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
16
app/Models/Shop/Variety.php
Normal file
16
app/Models/Shop/Variety.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Shop;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Variety extends Model
|
||||||
|
{
|
||||||
|
protected $guarded = ['id'];
|
||||||
|
protected $table = 'shop_product_varieties';
|
||||||
|
|
||||||
|
public function Specie()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Models\Shop\Specie');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,11 @@ class Families
|
|||||||
return Datatables::of($model)->make(true);
|
return Datatables::of($model)->make(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getOptions()
|
||||||
|
{
|
||||||
|
return Family::get()->SortBy('name')->pluck('name','id')->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
public static function getAll()
|
public static function getAll()
|
||||||
{
|
{
|
||||||
return Family::orderBy('name','asc')->get();
|
return Family::orderBy('name','asc')->get();
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ class Genres
|
|||||||
return Datatables::of($model)->make(true);
|
return Datatables::of($model)->make(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getOptions()
|
||||||
|
{
|
||||||
|
return Family::get()->SortBy('name')->pluck('name','id')->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
public static function getAll()
|
public static function getAll()
|
||||||
{
|
{
|
||||||
return Genre::orderBy('name','asc')->get();
|
return Genre::orderBy('name','asc')->get();
|
||||||
|
|||||||
@@ -9,15 +9,18 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.2",
|
"php": "^7.2",
|
||||||
"arcanedev/log-viewer": "^7.0",
|
"arcanedev/log-viewer": "^5.0",
|
||||||
"arrilot/laravel-widgets": "^3.13",
|
"arrilot/laravel-widgets": "^3.13",
|
||||||
"awssat/laravel-sync-migration": "^0.2",
|
"awssat/laravel-sync-migration": "^0.1",
|
||||||
|
"barryvdh/laravel-dompdf": "^0.8.6",
|
||||||
|
"barryvdh/laravel-snappy": "^0.4.7",
|
||||||
"box/spout": "^3.1",
|
"box/spout": "^3.1",
|
||||||
"browner12/helpers": "^3.0",
|
"browner12/helpers": "^3.0",
|
||||||
"coduo/php-humanizer": "^3.0",
|
"coduo/php-humanizer": "^3.0",
|
||||||
"consoletvs/charts": "^6.5",
|
"consoletvs/charts": "^6.5",
|
||||||
"cornford/googlmapper": "^3.0",
|
"cornford/googlmapper": "^2.3",
|
||||||
"datatables/datatables": "^1.10",
|
"datatables/datatables": "^1.10",
|
||||||
|
"dompdf/dompdf": "^0.8.5",
|
||||||
"eduardokum/laravel-mail-auto-embed": "^1.0",
|
"eduardokum/laravel-mail-auto-embed": "^1.0",
|
||||||
"erjanmx/laravel-migrate-check": "^1.3",
|
"erjanmx/laravel-migrate-check": "^1.3",
|
||||||
"exyplis/eloquent-builder-macros": "^1.5",
|
"exyplis/eloquent-builder-macros": "^1.5",
|
||||||
@@ -31,6 +34,7 @@
|
|||||||
"jenssegers/date": "^3.5",
|
"jenssegers/date": "^3.5",
|
||||||
"jrean/laravel-user-verification": "^8.0",
|
"jrean/laravel-user-verification": "^8.0",
|
||||||
"kalnoy/nestedset": "^5.0",
|
"kalnoy/nestedset": "^5.0",
|
||||||
|
"knplabs/knp-snappy": "^1.2",
|
||||||
"laracasts/utilities": "^3.0",
|
"laracasts/utilities": "^3.0",
|
||||||
"laravel/framework": "^6.2",
|
"laravel/framework": "^6.2",
|
||||||
"laravel/scout": "^7.2",
|
"laravel/scout": "^7.2",
|
||||||
@@ -39,7 +43,7 @@
|
|||||||
"league/climate": "^3.5",
|
"league/climate": "^3.5",
|
||||||
"league/period": "^4.9",
|
"league/period": "^4.9",
|
||||||
"maatwebsite/excel": "^3.1",
|
"maatwebsite/excel": "^3.1",
|
||||||
"mad-web/laravel-initializer": "^3.0",
|
"mad-web/laravel-initializer": "^2.0",
|
||||||
"mediactive-digital/migrations-generator": "^2.0",
|
"mediactive-digital/migrations-generator": "^2.0",
|
||||||
"moneyphp/money": "^3.3",
|
"moneyphp/money": "^3.3",
|
||||||
"mpdf/mpdf": "^8.0",
|
"mpdf/mpdf": "^8.0",
|
||||||
@@ -50,13 +54,13 @@
|
|||||||
"orangehill/iseed": "^2.6",
|
"orangehill/iseed": "^2.6",
|
||||||
"payum/payum": "^1.6",
|
"payum/payum": "^1.6",
|
||||||
"php-console/php-console": "^3.1",
|
"php-console/php-console": "^3.1",
|
||||||
"proengsoft/laravel-jsvalidation": "^3.0",
|
"proengsoft/laravel-jsvalidation": "^2.5",
|
||||||
"qoraiche/laravel-mail-editor": "^1.3",
|
"qoraiche/laravel-mail-editor": "^1.3",
|
||||||
"rcrowe/twigbridge": "^0.11.3",
|
"rcrowe/twigbridge": "^0.11.3",
|
||||||
"respect/validation": "^1.1",
|
"respect/validation": "^1.1",
|
||||||
"rinvex/laravel-categories": "^3.0",
|
"rinvex/laravel-categories": "^3.0",
|
||||||
"rtconner/laravel-tagging": "^4.0",
|
"rtconner/laravel-tagging": "^3.2",
|
||||||
"rutorika/sortable": "^7.0",
|
"rutorika/sortable": "^6.0",
|
||||||
"santigarcor/laratrust": "^5.2",
|
"santigarcor/laratrust": "^5.2",
|
||||||
"sebastienheyd/boilerplate": "^7.0",
|
"sebastienheyd/boilerplate": "^7.0",
|
||||||
"sensiolabs/security-checker": "^6.0",
|
"sensiolabs/security-checker": "^6.0",
|
||||||
@@ -69,7 +73,7 @@
|
|||||||
"staudenmeir/eloquent-has-many-deep": "^1.8",
|
"staudenmeir/eloquent-has-many-deep": "^1.8",
|
||||||
"stillat/numeral.php": "^2.0",
|
"stillat/numeral.php": "^2.0",
|
||||||
"te7a-houdini/laroute": "^1.0",
|
"te7a-houdini/laroute": "^1.0",
|
||||||
"themsaid/laravel-mail-preview": "^3.0",
|
"themsaid/laravel-mail-preview": "^2.0",
|
||||||
"toin0u/geocoder-laravel": "^4.2",
|
"toin0u/geocoder-laravel": "^4.2",
|
||||||
"twig/extensions": "^1.5",
|
"twig/extensions": "^1.5",
|
||||||
"unicodeveloper/laravel-password": "^1.0",
|
"unicodeveloper/laravel-password": "^1.0",
|
||||||
|
|||||||
40
resources/views/components/js/datatable.blade.php
Normal file
40
resources/views/components/js/datatable.blade.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<script>
|
||||||
|
$.extend( true, $.fn.dataTable.defaults, {
|
||||||
|
language: {
|
||||||
|
url: "/assets/vendor/boilerplate/js/datatables/i18n/French.json"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{{$dataTable->scripts()}}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$('#{{ $model }}-table').on( 'draw.dt', function () {
|
||||||
|
$('.btn-edit').click(function() {
|
||||||
|
url = '{{ $route }}' + '/edit/' + $(this).data('id');
|
||||||
|
window.location = url;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('.btn-del').on('click', '.destroy', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
bootbox.confirm("{{ __('boilerplate::shop.admin.confirmdelete') }}", function (result) {
|
||||||
|
if (result === false) return;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: href,
|
||||||
|
method: 'delete',
|
||||||
|
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
|
||||||
|
success: function(){
|
||||||
|
line.remove();
|
||||||
|
growl("{{ __('boilerplate::shop.admin.deletesuccess') }}", 'success');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -17,37 +17,5 @@
|
|||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
{{$dataTable->scripts()}}
|
@include('components.js.datatable', ['route' => '/Shop/Admin/Families', 'model' => 'families'])
|
||||||
|
|
||||||
<script>
|
|
||||||
$('#families-table').on( 'draw.dt', function () {
|
|
||||||
$('.btn-edit').click(function() {
|
|
||||||
url = '/Shop/Admin/Families/edit/' + $(this).data('id');
|
|
||||||
window.location = url;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('.btn-del').on('click', '.destroy', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
bootbox.confirm("{{ __('boilerplate::shop.admin.families.list.confirmdelete') }}", function (result) {
|
|
||||||
if (result === false) return;
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: href,
|
|
||||||
method: 'delete',
|
|
||||||
headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
|
|
||||||
success: function(){
|
|
||||||
line.remove();
|
|
||||||
growl("{{ __('boilerplate::shop.admin.families.list.deletesuccess') }}", 'success');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
@endpush
|
@endpush
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{ Form::open(['route' => 'Shop.Admin.Genres.store', 'id' => 'form', 'autocomplete' => 'off']) }}
|
{{ Form::open(['route' => 'Shop.Admin.Genres.store', 'id' => 'form', 'autocomplete' => 'off']) }}
|
||||||
<input type="hidden" name="id" value="{{ $genre['id'] }}">
|
<input type="hidden" name="id" value="{{ $id }}">
|
||||||
|
|
||||||
@include('Shop.Admin.Genres.form')
|
@include('Shop.Admin.Genres.form')
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,19 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
{{ Form::label('name', 'Nom') }}
|
{{ Form::label('name', 'Nom') }}
|
||||||
@include('components.input', ['name' => 'name', 'value' => (isset($genre['name'])) ? $genre['name'] : null, 'required' => true])
|
@include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true])
|
||||||
|
|
||||||
{{ Form::label('alias', 'Alias') }}
|
{{ Form::label('alias', 'Alias') }}
|
||||||
@include('components.input', ['name' => 'alias', 'value' => (isset($genre['alias'])) ? $genre['alias'] : null, 'required' => true])
|
@include('components.input', ['name' => 'alias', 'value' => isset($alias) ? $alias : null, 'required' => true])
|
||||||
|
|
||||||
{{ Form::label('latin', 'Nom latin') }}
|
{{ Form::label('latin', 'Nom latin') }}
|
||||||
@include('components.input', ['name' => 'latin', 'value' => (isset($genre['latin'])) ? $genre['latin'] : null, 'required' => true])
|
@include('components.input', ['name' => 'latin', 'value' => isset($latin) ? $latin : null, 'required' => true])
|
||||||
|
|
||||||
{{ Form::label('description', 'Description') }}
|
{{ Form::label('description', 'Description') }}
|
||||||
@include('components.textarea', ['name' => 'description', 'value' => (isset($genre['description'])) ? $genre['description'] : null, 'class' => 'editor', 'required' => false])
|
@include('components.textarea', ['name' => 'description', 'value' => isset($description) ? $description : null, 'class' => 'editor', 'required' => false])
|
||||||
|
|
||||||
|
{{ Form::label('family', 'Famille') }}
|
||||||
|
@include('components.select', ['name' => 'family_id', 'list' => $families, 'value' => isset($family_id) ? $family_id : null, 'required' => false])
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,16 +17,6 @@
|
|||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
{{$dataTable->scripts()}}
|
@include('components.js.datatable', ['route' => '/Shop/Admin/Genres', 'model' => 'genres'])
|
||||||
|
|
||||||
<script>
|
|
||||||
$('#genres-table').on( 'draw.dt', function () {
|
|
||||||
$('.btn-edit').click(function() {
|
|
||||||
url = '/Shop/Admin/Genres/edit/' + $(this).data('id');
|
|
||||||
window.location = url;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,19 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
{{ Form::label('name', 'Nom') }}
|
{{ Form::label('name', 'Nom') }}
|
||||||
@include('components.input', ['name' => 'name', 'value' => (isset($specie['name'])) ? $specie['name'] : null, 'required' => true])
|
@include('components.input', ['name' => 'name', 'value' => isset($name) ? $name : null, 'required' => true])
|
||||||
|
|
||||||
{{ Form::label('alias', 'Alias') }}
|
{{ Form::label('alias', 'Alias') }}
|
||||||
@include('components.input', ['name' => 'alias', 'value' => (isset($specie['alias'])) ? $specie['alias'] : null, 'required' => true])
|
@include('components.input', ['name' => 'alias', 'value' => isset($alias) ? $alias : null, 'required' => true])
|
||||||
|
|
||||||
{{ Form::label('latin', 'Nom latin') }}
|
{{ Form::label('latin', 'Nom latin') }}
|
||||||
@include('components.input', ['name' => 'latin', 'value' => (isset($specie['latin'])) ? $specie['latin'] : null, 'required' => true])
|
@include('components.input', ['name' => 'latin', 'value' => isset($latin) ? $latin : null, 'required' => true])
|
||||||
|
|
||||||
{{ Form::label('description', 'Description') }}
|
{{ Form::label('description', 'Description') }}
|
||||||
@include('components.textarea', ['name' => 'description', 'value' => (isset($specie['description'])) ? $specie['description'] : null, 'class' => 'editor', 'required' => false])
|
@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])
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -22,3 +25,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -17,16 +17,6 @@
|
|||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
{{$dataTable->scripts()}}
|
@include('components.js.datatable', ['route' => '/Shop/Admin/Species', 'model' => 'species'])
|
||||||
|
|
||||||
<script>
|
|
||||||
$('#species-table').on( 'draw.dt', function () {
|
|
||||||
$('.btn-edit').click(function() {
|
|
||||||
url = '/Shop/Admin/Species/edit/' + $(this).data('id');
|
|
||||||
window.location = url;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
|
|||||||
16
resources/views/shop/admin/Varieties/create.blade.php
Normal file
16
resources/views/shop/admin/Varieties/create.blade.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
@extends('layout.index', [
|
||||||
|
'title' => __('shop.varieties.title'),
|
||||||
|
'subtitle' => __('shop.varieties.add'),
|
||||||
|
'breadcrumb' => [__('shop.varieties.title'), __('shop.varieties.add')]
|
||||||
|
])
|
||||||
|
|
||||||
|
@include('boilerplate::load.fileinput')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
{{ Form::open(['route' => 'Shop.Admin.Varieties.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||||
|
|
||||||
|
@include('Shop.Admin.Varieties.form')
|
||||||
|
</form>
|
||||||
|
|
||||||
|
@endsection
|
||||||
16
resources/views/shop/admin/Varieties/edit.blade.php
Normal file
16
resources/views/shop/admin/Varieties/edit.blade.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
@extends('layout.index', [
|
||||||
|
'title' => __('shop.varieties.title'),
|
||||||
|
'subtitle' => __('shop.varieties.edit'),
|
||||||
|
'breadcrumb' => ['Familles']
|
||||||
|
])
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
{{ Form::open(['route' => 'Shop.Admin.Varieties.store', 'id' => 'form', 'autocomplete' => 'off']) }}
|
||||||
|
<input type="hidden" name="id" value="{{ $specie['id'] }}">
|
||||||
|
|
||||||
|
@include('Shop.Admin.Varieties.form')
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
@endsection
|
||||||
28
resources/views/shop/admin/Varieties/form.blade.php
Normal file
28
resources/views/shop/admin/Varieties/form.blade.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
{{ 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('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])
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="float-right mt-3">
|
||||||
|
@include('components.button-save')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
22
resources/views/shop/admin/Varieties/list.blade.php
Normal file
22
resources/views/shop/admin/Varieties/list.blade.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
@extends('layout.index', [
|
||||||
|
'title' => __('shop.varieties.title'),
|
||||||
|
'subtitle' => __('shop.varieties.list'),
|
||||||
|
'breadcrumb' => [__('shop.varieties.title')]
|
||||||
|
])
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<div class="row pb-3">
|
||||||
|
<div class="col text-right">
|
||||||
|
<a href="{{ route('Shop.Admin.Varieties.create') }}" class="btn btn-sm btn-success">{{ __('shop.varieties.add') }} <i class="fa fa-plus"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{$dataTable->table()}}
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
@include('components.js.datatable', ['route' => '/Shop/Admin/Varieties', 'model' => 'varieties'])
|
||||||
|
@endpush
|
||||||
|
|
||||||
30
resources/views/shop/admin/Varieties/show.blade.php
Normal file
30
resources/views/shop/admin/Varieties/show.blade.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
@extends('layout.index', [
|
||||||
|
'title' => __('products.title'),
|
||||||
|
'subtitle' => __('products.title'),
|
||||||
|
'breadcrumb' => [__('products.title')]
|
||||||
|
])
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<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-12">
|
||||||
|
@include('components.carousel')
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
12
routes/Admin/Shop/Varieties.php
Normal file
12
routes/Admin/Shop/Varieties.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
Route::prefix('Varieties')->name('Varieties.')->group(function () {
|
||||||
|
Route::get('', 'VarietyController@index')->name('index');
|
||||||
|
Route::get('create', 'VarietyController@create')->name('create');
|
||||||
|
Route::delete('destroy', 'VarietyController@destroy')->name('destroy');
|
||||||
|
Route::post('update', 'VarietyController@update')->name('update');
|
||||||
|
Route::post('store', 'VarietyController@store')->name('store');
|
||||||
|
Route::get('edit/{id}', 'VarietyController@edit')->name('edit');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
@@ -3,3 +3,4 @@
|
|||||||
include( __DIR__ . '/Families.php');
|
include( __DIR__ . '/Families.php');
|
||||||
include( __DIR__ . '/Genres.php');
|
include( __DIR__ . '/Genres.php');
|
||||||
include( __DIR__ . '/Species.php');
|
include( __DIR__ . '/Species.php');
|
||||||
|
include( __DIR__ . '/Varieties.php');
|
||||||
|
|||||||
Reference in New Issue
Block a user