[WIP] Admin for Families, Genres and Species

This commit is contained in:
Ludovic CANDELLIER
2020-04-13 01:43:04 +02:00
parent 134e04d197
commit b7edcd402f
37 changed files with 655 additions and 334 deletions

View File

@@ -0,0 +1,61 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\Shop\Family;
use App\Models\Shop\Genre;
class migrate extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'create_relation';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Migration from old version';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$genres = Genre::all();
foreach ($genres as $genre) {
$family_name = $genre->family;
dump($family_name);
if (!empty($family_name)) {
$family = Family::byName($family_name)->first();
if (isset($family->name))
{
dump($family->name);
$genre->family_id = $family->id;
$genre->save();
} else {
dump("non trouvé");
}
} else {
dump("Aucune famille");
}
}
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\DataTables;
use Yajra\DataTables\Html\Column;
use App\DataTables\ParentDataTable as DataTable;
use App\Models\Shop\Product;
class ProductsDataTable extends DataTable
{
public $model_name = 'Products';
public function query(Product $model)
{
return self::buildQuery($model);
}
protected function getColumns()
{
return [
Column::make('name'),
Column::make('alias'),
Column::make('latin'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(60)
->addClass('text-center'),
];
}
}

View File

@@ -2,67 +2,19 @@
namespace App\DataTables; namespace App\DataTables;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column; use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor; use App\DataTables\ParentDataTable as DataTable;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
use App\Models\Shop\Family; use App\Models\Shop\Family;
class FamiliesDataTable extends DataTable class FamiliesDataTable extends DataTable
{ {
/** public $model_name = 'Families';
* Build DataTable class.
*
* @param mixed $query Results from query() method.
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
{
return datatables()
->eloquent($query)
->addColumn('action', '<a href="{{$id}}"><i class="fa fa-edit"></i></a>');
}
/**
* Get query source of dataTable.
*
* @param \App\Family $model
* @return \Illuminate\Database\Eloquent\Builder
*/
public function query(Family $model) public function query(Family $model)
{ {
return $model->newQuery(); return self::buildQuery($model);
} }
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return $this->builder()
->setTableId('families-table')
->columns($this->getColumns())
->minifiedAjax()
->dom('Bfrtip')
->orderBy(1)
->buttons(
Button::make('create'),
Button::make('export'),
Button::make('print'),
Button::make('reset'),
Button::make('reload')
);
}
/**
* Get columns.
*
* @return array
*/
protected function getColumns() protected function getColumns()
{ {
return [ return [
@@ -72,18 +24,9 @@ class FamiliesDataTable extends DataTable
Column::computed('action') Column::computed('action')
->exportable(false) ->exportable(false)
->printable(false) ->printable(false)
->width(60) ->width(120)
->addClass('text-center'), ->addClass('text-center'),
]; ];
} }
/**
* Get filename for export.
*
* @return string
*/
protected function filename()
{
return 'Families_' . date('YmdHis');
}
} }

View File

@@ -0,0 +1,32 @@
<?php
namespace App\DataTables;
use Yajra\DataTables\Html\Column;
use App\DataTables\ParentDataTable as DataTable;
use App\Models\Shop\Genre;
class GenresDataTable extends DataTable
{
public $model_name = 'Genres';
public function query(Genre $model)
{
return self::buildQuery($model);
}
protected function getColumns()
{
return [
Column::make('name'),
Column::make('alias'),
Column::make('latin'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(120)
->addClass('text-center'),
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\DataTables;
use Yajra\DataTables\Html\Column;
use App\DataTables\ParentDataTable as DataTable;
use App\Models\Shop\Product;
class ProductsDataTable extends DataTable
{
public $model_name = 'Products';
public function query(Product $model)
{
return self::buildQuery($model);
}
protected function getColumns()
{
return [
Column::make('name'),
Column::make('alias'),
Column::make('latin'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(60)
->addClass('text-center'),
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\DataTables;
use Yajra\DataTables\Html\Column;
use App\DataTables\ParentDataTable as DataTable;
use App\Models\Shop\Product;
class ProductsDataTable extends DataTable
{
public $model_name = 'Products';
public function query(Product $model)
{
return self::buildQuery($model);
}
protected function getColumns()
{
return [
Column::make('name'),
Column::make('alias'),
Column::make('latin'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(60)
->addClass('text-center'),
];
}
}

View File

@@ -0,0 +1,99 @@
<?php
namespace App\DataTables;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class ParentDataTable extends DataTable
{
/**
* Build DataTable class.
*
* @param mixed $query Results from query() method.
* @return \Yajra\DataTables\DataTableAbstract
*/
public function dataTable($query)
{
$datatables = datatables()->eloquent($query);
return self::addButtons($datatables);
}
/**
* Add buttons DataTable class.
*
* @param mixed $query Results from query() method.
* @return \Yajra\DataTables\DataTableAbstract
*/
public function addButtons($datatables)
{
$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-danger btn-del"><i class="fa fa-fw fa-trash"></i></button>';
return $datatables->addColumn('action', $buttons);
}
/**
* Get query source of dataTable.
*
* @param \App\Family $model
* @return \Illuminate\Database\Eloquent\Builder
*/
public function buildQuery($model)
{
return $model->newQuery();
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function html()
{
return self::buildHtml(strtolower($this->model_name) . '-table');
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\DataTables\Html\Builder
*/
public function buildHtml($id)
{
return $this->builder()
->setTableId($id)
->columns($this->getColumns())
->minifiedAjax()
->dom('Bfrtip')
->orderBy(0,'asc')
->buttons(
Button::make('export'),
Button::make('print')
);
}
/**
* Get filename for export.
*
* @return string
*/
protected function filename()
{
return self::buildFilename($this->model_name);
}
/**
* Get filename for export.
*
* @return string
*/
protected function buildFilename($models_name)
{
return $models_name . '_' . date('YmdHis');
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\DataTables;
use Yajra\DataTables\Html\Column;
use App\DataTables\ParentDataTable as DataTable;
use App\Models\Shop\Product;
class ProductsDataTable extends DataTable
{
public $model_name = 'Products';
public function query(Product $model)
{
return self::buildQuery($model);
}
protected function getColumns()
{
return [
Column::make('name'),
Column::make('alias'),
Column::make('latin'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(60)
->addClass('text-center'),
];
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\DataTables;
use Yajra\DataTables\Html\Column;
use App\DataTables\ParentDataTable as DataTable;
use App\Models\Shop\Specie;
class SpeciesDataTable extends DataTable
{
public $model_name = 'Species';
public function query(Specie $model)
{
return self::buildQuery($model);
}
protected function getColumns()
{
return [
Column::make('name'),
Column::make('alias'),
Column::make('latin'),
Column::make('genre'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(120)
->addClass('text-center'),
];
}
}

View File

@@ -5,7 +5,7 @@ namespace App\Http\Controllers\Shop\Admin;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Repositories\Families; use App\Repositories\Shop\Families;
use App\DataTables\FamiliesDataTable; use App\DataTables\FamiliesDataTable;
class FamilyController extends Controller class FamilyController extends Controller
@@ -41,7 +41,7 @@ class FamilyController extends Controller
public function edit($id) public function edit($id)
{ {
$data = Families::get($id); $data['family'] = Families::get($id)->toArray();
return view('Shop.Admin.Families.edit', $data); return view('Shop.Admin.Families.edit', $data);
} }

View File

@@ -5,47 +5,42 @@ namespace App\Http\Controllers\Shop\Admin;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Repositories\Genres; use App\Repositories\Shop\Genres;
use App\DataTables\GenresDataTable;
class GenreController extends Controller class GenreController extends Controller
{ {
public function index(Request $request) public function index(GenresDataTable $dataTable)
{ {
if ($request->ajax()) { return $dataTable->render('Shop.Admin.Genres.list');
return self::getDatatable($request);
} else {
$data = [];
return view('Admin.Shop.Genres.list', $data);
}
} }
public function getDatatable(Request $request) public function getDatatable(Request $request)
{ {
return Genres::getTables($request->all()); return Genres::getDataTable($request->all());
} }
public function create() public function create()
{ {
$data = []; return view('Shop.Admin.Genres.create');
return view('Admin.Shop.Genres.create', $data);
} }
public function store(Request $request) public function store(Request $request)
{ {
$ret = Genres::store($request); $ret = Genres::store($request);
return redirect()->route('Admin.Shop.Genres.index'); return redirect()->route('Shop.Admin.Genres.index');
} }
public function show($id) public function show($id)
{ {
$data = Genres::get($id); $data = Genres::get($id);
return view('Admin.Shop.Genres.view', $data); return view('Shop.Admin.Genres.view', $data);
} }
public function edit($id) public function edit($id)
{ {
$data = Genres::get($id); $data['genre'] = Genres::get($id);
return view('Admin.Shop.Genres.edit', $data); return view('Shop.Admin.Genres.edit', $data);
} }
public function destroy($id) public function destroy($id)

View File

@@ -5,23 +5,14 @@ namespace App\Http\Controllers\Shop\Admin;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Repositories\Species; use App\Repositories\Shop\Species;
use App\DataTables\SpeciesDataTable;
class SpecieController extends Controller class SpecieController extends Controller
{ {
/** public function index(SpeciesDataTable $dataTable)
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{ {
if ($request->ajax()) { return $dataTable->render('Shop.Admin.Species.list');
return self::getDatatable($request);
} else {
$data = [];
return view('Shop.Admin.Species.list', $data);
}
} }
public function getDatatable(Request $request) public function getDatatable(Request $request)
@@ -29,73 +20,32 @@ class SpecieController extends Controller
return Species::getDatatable($request->all()); return Species::getDatatable($request->all());
} }
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create() public function create()
{ {
$data = []; return view('Shop.Admin.Species.create');
return view('Shop.Admin.Species.create', $data);
} }
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request) public function store(Request $request)
{ {
$ret = Species::store($request); $ret = Species::store($request);
return redirect()->route('Shop.Admin.Species.index'); return redirect()->route('Shop.Admin.Species.index');
} }
/**
* Display the specified resource.
*
* @param \App\Customer $customer
* @return \Illuminate\Http\Response
*/
public function show($id) public function show($id)
{ {
$data = Species::get($id); $data = Species::get($id);
return view('Shop.Admin.Species.view', $data); return view('Shop.Admin.Species.view', $data);
} }
/**
* Show the form for editing the specified resource.
*
* @param \App\Customer $customer
* @return \Illuminate\Http\Response
*/
public function edit($id) public function edit($id)
{ {
$data = Species::get($id); $data['specie'] = Species::get($id);
return view('Shop.Admin.Species.edit', $data); return view('Shop.Admin.Species.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) public function destroy($id)
{ {
return Species::destroy($id); return Species::destroy($id);
} }
} }

View File

@@ -13,4 +13,10 @@ class Family extends Model
{ {
return $this->hasMany('App\Models\Shop\Genre'); return $this->hasMany('App\Models\Shop\Genre');
} }
public function scopeByName($query,$name)
{
return $query->where('name', $name);
}
} }

View File

@@ -4,7 +4,7 @@ namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Genres extends Model class Genre extends Model
{ {
protected $guarded = ['id']; protected $guarded = ['id'];
protected $table = 'shop_product_genres'; protected $table = 'shop_product_genres';
@@ -14,4 +14,9 @@ class Genres extends Model
return $this->belongsTo('App\Models\Shop\Family'); return $this->belongsTo('App\Models\Shop\Family');
} }
public function scopeByName($query,$name)
{
return $query->where('name', $name);
}
} }

View File

@@ -4,7 +4,7 @@ namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
class Species extends Model class Specie extends Model
{ {
protected $guarded = ['id']; protected $guarded = ['id'];
protected $table = 'shop_product_species'; protected $table = 'shop_product_species';

View File

@@ -28,7 +28,7 @@ return [
'bg' => 'gray-dark', 'bg' => 'gray-dark',
'logo' => [ 'logo' => [
'bg' => 'green', 'bg' => 'green',
'icon' => '<i class="fa fa-cubes"></i>', 'icon' => '<i class="fa fa-leaf"></i>',
'text' => '<strong>O</strong>pen<strong>S</strong>em', 'text' => '<strong>O</strong>pen<strong>S</strong>em',
'shadow' => 2, 'shadow' => 2,
], ],
@@ -39,7 +39,7 @@ return [
], ],
], ],
'footer' => [ 'footer' => [
'visible' => true, 'visible' => false,
'vendorname' => 'OpenSem', 'vendorname' => 'OpenSem',
'vendorlink' => '', 'vendorlink' => '',
], ],

View File

@@ -51,9 +51,9 @@
"chart.js": "^2.8.0", "chart.js": "^2.8.0",
"datatables": "^1.10.18", "datatables": "^1.10.18",
"datatables.net": "^1.10.19", "datatables.net": "^1.10.19",
"datatables.net-bs4": "^1.10.19", "datatables.net-bs4": "^1.10.20",
"datatables.net-buttons": "^1.5.6", "datatables.net-buttons": "^1.5.6",
"datatables.net-buttons-bs4": "^1.5.6", "datatables.net-buttons-bs4": "^1.6.1",
"datatables.net-colreorder": "^1.5.1", "datatables.net-colreorder": "^1.5.1",
"datatables.net-colreorder-bs4": "^1.5.1", "datatables.net-colreorder-bs4": "^1.5.1",
"datatables.net-fixedcolumns": "^3.2.6", "datatables.net-fixedcolumns": "^3.2.6",
@@ -79,23 +79,24 @@
"handlebars-layouts": "^3.1.4", "handlebars-layouts": "^3.1.4",
"icheck": "^1.0.2", "icheck": "^1.0.2",
"iconate": "*", "iconate": "*",
"imports-loader": "^0.8.0",
"input-switch": "^1.1.0", "input-switch": "^1.1.0",
"inputmask": "^4.0.8", "inputmask": "^4.0.8",
"isotope-layout": "^3.0.6", "isotope-layout": "^3.0.6",
"izimodal": "^1.5.1", "izimodal": "^1.5.1",
"jQuery-QueryBuilder": "^2.5.2",
"jquery-confirm": "^3.3.4", "jquery-confirm": "^3.3.4",
"jquery-form": "^4.2.2", "jquery-form": "^4.2.2",
"jquery-jeditable": "^2.0.13", "jquery-jeditable": "^2.0.13",
"jquery-json": "^2.6.0", "jquery-json": "^2.6.0",
"jQuery-QueryBuilder": "^2.5.2",
"jquery-migrate": "^3.1.0", "jquery-migrate": "^3.1.0",
"jquery-placeholder": "^2.3.1", "jquery-placeholder": "^2.3.1",
"jquery.are-you-sure": "^1.9.0",
"jquery-serializejson": "^2.9.0", "jquery-serializejson": "^2.9.0",
"jquery-slidePanel": "^0.3.5", "jquery-slidePanel": "^0.3.5",
"jquery-slimscroll": "^1.3.8", "jquery-slimscroll": "^1.3.8",
"jquery-ui": "^1.12.1", "jquery-ui": "^1.12.1",
"jquery-validation": "^1.19.0", "jquery-validation": "^1.19.0",
"jquery.are-you-sure": "^1.9.0",
"jquery.cookie": "^1.4.1", "jquery.cookie": "^1.4.1",
"jquery.documentsize": "^1.2.5", "jquery.documentsize": "^1.2.5",
"jquery.filer": "^1.3.0", "jquery.filer": "^1.3.0",
@@ -116,8 +117,8 @@
"promise-polyfill": "^8.1.3", "promise-polyfill": "^8.1.3",
"pwstrength-bootstrap": "^3.0.3", "pwstrength-bootstrap": "^3.0.3",
"raphael": "^2.2.8", "raphael": "^2.2.8",
"selectize": "^0.12.6",
"screenfull": "^4.2.0", "screenfull": "^4.2.0",
"selectize": "^0.12.6",
"slidebars": "^2.0.2", "slidebars": "^2.0.2",
"summernote": "^0.8.12", "summernote": "^0.8.12",
"swag": "^0.7.0", "swag": "^0.7.0",

View File

@@ -31,7 +31,7 @@ window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
try { try {
window.$ = window.jQuery = require('jquery'); window.$ = window.jQuery = require('jquery');
require('datatables.net'); require('bootstrap');
require('datatables.net-bs4'); require('datatables.net-bs4');
require('datatables.net-buttons-bs4'); require('datatables.net-buttons-bs4');
} catch (e) {} } catch (e) {}

View File

@@ -21,6 +21,42 @@ return [
'successdel' => 'La catégorie a été correctement effacée', 'successdel' => 'La catégorie a été correctement effacée',
'confirmdelete' => 'Confirmez-vous la suppression de la catégorie ?', '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' => [ 'products' => [
'title' => 'Gestion des produits', 'title' => 'Gestion des produits',
'description' => 'Gérer les produits', 'description' => 'Gérer les produits',

View File

@@ -1,4 +1,3 @@
TEST
<nav class="main-header navbar navbar-expand navbar-{{ config('boilerplate.theme.navbar.bg') }} navbar-{{ config('boilerplate.theme.navbar.type') }} {{ config('boilerplate.theme.navbar.border') ? "" : "border-bottom-0" }}"> <nav class="main-header navbar navbar-expand navbar-{{ config('boilerplate.theme.navbar.bg') }} navbar-{{ config('boilerplate.theme.navbar.type') }} {{ config('boilerplate.theme.navbar.border') ? "" : "border-bottom-0" }}">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li class="nav-item"> <li class="nav-item">

View File

@@ -13,8 +13,10 @@
</head> </head>
<body class="layout-fixed layout-navbar-fixed sidebar-mini"> <body class="layout-fixed layout-navbar-fixed sidebar-mini">
<div class="wrapper"> <div class="wrapper">
@include('layout.header') @include('layout.header')
@include('boilerplate::layout.mainsidebar') @include('boilerplate::layout.mainsidebar')
<div class="content-wrapper"> <div class="content-wrapper">
@include('layout.contentheader') @include('layout.contentheader')
<section class="content"> <section class="content">
@@ -23,7 +25,9 @@
</div> </div>
</section> </section>
</div> </div>
@includeWhen(config('boilerplate.theme.footer.visible', true), 'layout.footer') @includeWhen(config('boilerplate.theme.footer.visible', true), 'layout.footer')
<aside class="control-sidebar control-sidebar-{{ config('boilerplate.theme.sidebar.type') }} elevation-{{ config('boilerplate.theme.sidebar.shadow') }}"> <aside class="control-sidebar control-sidebar-{{ config('boilerplate.theme.sidebar.type') }} elevation-{{ config('boilerplate.theme.sidebar.shadow') }}">
<button class="btn btn-sm" data-widget="control-sidebar"><span class="fa fa-times"></span></button> <button class="btn btn-sm" data-widget="control-sidebar"><span class="fa fa-times"></span></button>
<div class="control-sidebar-content"> <div class="control-sidebar-content">
@@ -32,6 +36,7 @@
</div> </div>
</div> </div>
</aside> </aside>
<div class="control-sidebar-bg"></div> <div class="control-sidebar-bg"></div>
</div> </div>
<script src="{{ mix('/bootstrap.min.js', '/assets/vendor/boilerplate') }}"></script> <script src="{{ mix('/bootstrap.min.js', '/assets/vendor/boilerplate') }}"></script>

View File

@@ -9,13 +9,6 @@
@section('content') @section('content')
{{ Form::open(['route' => 'Shop.Admin.families.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }} {{ Form::open(['route' => 'Shop.Admin.families.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }}
<div class="row">
<div class="col-12 text-right">
@include('components.button-save')
</div>
</div>
@include('Shop.Admin.families.form') @include('Shop.Admin.families.form')
</form> </form>

View File

@@ -1,39 +1,16 @@
@extends('layout.index', [ @extends('layout.index', [
'title' => 'Familles', 'title' => __('shop.families.title'),
'subtitle' => 'Edition d\'une famille', 'subtitle' => __('shop.families.edit'),
'breadcrumb' => ['Familles'] 'breadcrumb' => ['Familles']
]) ])
@include('boilerplate::load.icheck')
@include('boilerplate::load.fileinput')
@prepend('js')
@include('components.js', ['js' => '/js/main.min.js'])
@endprepend
@push('css')
@include('components.css', ['css' => '/css/main.min.css'])
@endpush
@section('content') @section('content')
{{ Form::open(['route' => 'Shop.Admin.Families.update', 'id' => 'lot-form', 'autocomplete' => 'off', 'files' => true]) }} {{ Form::open(['route' => 'Shop.Admin.Families.store', 'id' => 'form', 'autocomplete' => 'off']) }}
<input type="hidden" name="id" value="{{ $family['id'] }}">
<div class="row">
<div class="col-sm-12 mbl">
<a href="{{ route("Shop.Admin.Families.index") }}" class="btn btn-default">
{{ __('families.list.title') }}
</a>
<span class="btn-group pull-right">
@include('components.button-save')
</span>
</div>
</div>
<input type="hidden" name="id" value="{{ $id }}">
@include('Shop.Admin.Families.form') @include('Shop.Admin.Families.form')
</form> </form>
@endsection @endsection

View File

@@ -1,38 +1,21 @@
<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($section['name'])) ? $section['name'] : null, 'required' => true]) @include('components.input', ['name' => 'name', 'value' => (isset($family['name'])) ? $family['name'] : null, 'required' => true])
{{ Form::label('description', 'Description') }} {{ Form::label('alias', 'Alias') }}
@include('components.textarea', ['name' => 'description', 'id_name' => 'description', 'value' => (isset($section['description'])) ? $section['description'] : null, 'required' => true]) @include('components.input', ['name' => 'alias', 'value' => (isset($family['alias'])) ? $family['alias'] : null, 'required' => true])
{{ Form::label('description', 'Rubrique parente') }} {{ Form::label('latin', 'Nom latin') }}
@include('components.input', ['name' => 'latin', 'value' => (isset($family['latin'])) ? $family['latin'] : null, 'required' => true])
</div> </div>
<div class="col-md-4">
<div class="row">
<div class="col-md-12 row-new-lot-photo row-lot-photo mt-3">
<!--
<p>
<button type="button" class="btn btn-danger delete-new-lot-photo-btn"><i class="fa fa-minus-circle"></i></button>
Photo <span class="row-photo-number"></span>
</p>
-->
<input name="lot_photos[][file]" type="file" class="file" data-show-upload="false" data-show-caption="true" data-msg-placeholder="Choisissez une photo">
</div>
</div>
</div> </div>
@include('boilerplate::load.tinymce') <div class="row">
<div class="col-md-8">
@push('js') <div class="float-right mt-3">
<script> @include('components.button-save')
$(function() { </div>
$('#description').tinymce({}); </div>
}) </div>
</script>
@endpush

View File

@@ -1,5 +1,6 @@
@extends('layout.index', [ @extends('layout.index', [
'title' => __('shop.families.title'), 'title' => __('shop.families.title'),
'subtitle' => __('shop.families.list'),
'breadcrumb' => [__('shop.families.title')] 'breadcrumb' => [__('shop.families.title')]
]) ])
@@ -17,4 +18,36 @@
@push('scripts') @push('scripts')
{{$dataTable->scripts()}} {{$dataTable->scripts()}}
<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

View File

@@ -0,0 +1,13 @@
@extends('layout.index', [
'title' => __('shop.genres.title'),
'subtitle' => __('shop.genres.add'),
'breadcrumb' => [__('shop.genres.title'), __('shop.genres.add')]
])
@section('content')
{{ Form::open(['route' => 'Shop.Admin.genres.store', 'id' => 'form', 'autocomplete' => 'off']) }}
@include('Shop.Admin.genres.form')
</form>
@endsection

View File

@@ -0,0 +1,16 @@
@extends('layout.index', [
'title' => __('shop.genres.title'),
'subtitle' => __('shop.genres.edit'),
'breadcrumb' => ['Familles']
])
@section('content')
{{ Form::open(['route' => 'Shop.Admin.Genres.store', 'id' => 'form', 'autocomplete' => 'off']) }}
<input type="hidden" name="id" value="{{ $genre['id'] }}">
@include('Shop.Admin.Genres.form')
</form>
@endsection

View File

@@ -0,0 +1,24 @@
<div class="row">
<div class="col-md-8">
{{ Form::label('name', 'Nom') }}
@include('components.input', ['name' => 'name', 'value' => (isset($genre['name'])) ? $genre['name'] : null, 'required' => true])
{{ Form::label('alias', 'Alias') }}
@include('components.input', ['name' => 'alias', 'value' => (isset($genre['alias'])) ? $genre['alias'] : null, 'required' => true])
{{ Form::label('latin', 'Nom latin') }}
@include('components.input', ['name' => 'latin', 'value' => (isset($genre['latin'])) ? $genre['latin'] : null, 'required' => true])
{{ Form::label('description', 'Description') }}
@include('components.textarea', ['name' => 'description', 'value' => (isset($genre['description'])) ? $genre['description'] : null, 'class' => 'editor', 'required' => false])
</div>
</div>
<div class="row">
<div class="col-md-8">
<div class="float-right mt-3">
@include('components.button-save')
</div>
</div>
</div>

View File

@@ -0,0 +1,32 @@
@extends('layout.index', [
'title' => __('shop.genres.title'),
'subtitle' => __('shop.genres.list'),
'breadcrumb' => [__('shop.genres.title')]
])
@section('content')
<div class="row pb-3">
<div class="col text-right">
<a href="{{ route('Shop.Admin.Genres.create') }}" class="btn btn-sm btn-success">{{ __('shop.genres.add') }} <i class="fa fa-plus"></i></a>
</div>
</div>
{{$dataTable->table()}}
@endsection
@push('scripts')
{{$dataTable->scripts()}}
<script>
$('#genres-table').on( 'draw.dt', function () {
$('.btn-edit').click(function() {
url = '/Shop/Admin/Genres/edit/' + $(this).data('id');
window.location = url;
});
});
</script>
@endpush

View 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

View File

@@ -1,22 +1,16 @@
@extends('boilerplate::layout.index', [ @extends('layout.index', [
'title' => __('shop.families.title'), 'title' => __('shop.species.title'),
'subtitle' => __('shop.families.add'), 'subtitle' => __('shop.species.add'),
'breadcrumb' => [__('shop.families.title'), __('shop.families.add')] 'breadcrumb' => [__('shop.species.title'), __('shop.species.add')]
]) ])
@include('boilerplate::load.fileinput') @include('boilerplate::load.fileinput')
@section('content') @section('content')
{{ Form::open(['route' => 'Shop.Admin.families.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }} {{ Form::open(['route' => 'Shop.Admin.species.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }}
<div class="row"> @include('Shop.Admin.species.form')
<div class="col-12 text-right">
@include('components.button-save')
</div>
</div>
@include('Shop.Admin.families.form')
</form> </form>
@endsection @endsection

View File

@@ -1,39 +1,16 @@
@extends('layout.index', [ @extends('layout.index', [
'title' => 'Familles', 'title' => __('shop.species.title'),
'subtitle' => 'Edition d\'une famille', 'subtitle' => __('shop.species.edit'),
'breadcrumb' => ['Familles'] 'breadcrumb' => ['Familles']
]) ])
@include('boilerplate::load.icheck')
@include('boilerplate::load.fileinput')
@prepend('js')
@include('components.js', ['js' => '/js/main.min.js'])
@endprepend
@push('css')
@include('components.css', ['css' => '/css/main.min.css'])
@endpush
@section('content') @section('content')
{{ Form::open(['route' => 'Shop.Admin.Families.update', 'id' => 'lot-form', 'autocomplete' => 'off', 'files' => true]) }} {{ Form::open(['route' => 'Shop.Admin.Species.store', 'id' => 'form', 'autocomplete' => 'off']) }}
<input type="hidden" name="id" value="{{ $specie['id'] }}">
<div class="row"> @include('Shop.Admin.Species.form')
<div class="col-sm-12 mbl">
<a href="{{ route("Shop.Admin.Families.index") }}" class="btn btn-default">
{{ __('families.list.title') }}
</a>
<span class="btn-group pull-right">
@include('components.button-save')
</span>
</div>
</div>
<input type="hidden" name="id" value="{{ $id }}">
@include('Shop.Admin.Families.form')
</form> </form>
@endsection @endsection

View File

@@ -1,38 +1,24 @@
<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($section['name'])) ? $section['name'] : null, 'required' => true]) @include('components.input', ['name' => 'name', 'value' => (isset($specie['name'])) ? $specie['name'] : null, 'required' => true])
{{ Form::label('alias', 'Alias') }}
@include('components.input', ['name' => 'alias', 'value' => (isset($specie['alias'])) ? $specie['alias'] : null, 'required' => true])
{{ Form::label('latin', 'Nom latin') }}
@include('components.input', ['name' => 'latin', 'value' => (isset($specie['latin'])) ? $specie['latin'] : null, 'required' => true])
{{ Form::label('description', 'Description') }} {{ Form::label('description', 'Description') }}
@include('components.textarea', ['name' => 'description', 'id_name' => 'description', 'value' => (isset($section['description'])) ? $section['description'] : null, 'required' => true]) @include('components.textarea', ['name' => 'description', 'value' => (isset($specie['description'])) ? $specie['description'] : null, 'class' => 'editor', 'required' => false])
{{ Form::label('description', 'Rubrique parente') }}
</div>
<div class="col-md-4">
<div class="row">
<div class="col-md-12 row-new-lot-photo row-lot-photo mt-3">
<!--
<p>
<button type="button" class="btn btn-danger delete-new-lot-photo-btn"><i class="fa fa-minus-circle"></i></button>
Photo <span class="row-photo-number"></span>
</p>
-->
<input name="lot_photos[][file]" type="file" class="file" data-show-upload="false" data-show-caption="true" data-msg-placeholder="Choisissez une photo">
</div>
</div> </div>
</div> </div>
@include('boilerplate::load.tinymce') <div class="row">
<div class="col-md-8">
@push('js') <div class="float-right mt-3">
<script> @include('components.button-save')
$(function() { </div>
$('#description').tinymce({}); </div>
}) </div>
</script>
@endpush

View File

@@ -1,62 +1,32 @@
@extends('boilerplate::layout.index', [ @extends('layout.index', [
'title' => __('shop.species.title'), 'title' => __('shop.species.title'),
'subtitle' => __('shop.species.list'),
'breadcrumb' => [__('shop.species.title')] 'breadcrumb' => [__('shop.species.title')]
]) ])
@section('content') @section('content')
<div class="box">
<div class="box-body"> <div class="row pb-3">
<table class="table table-striped table-hover va-middle" id="species-table"> <div class="col text-right">
<thead>
<tr>
<th>
<input type="text" class="form-control-sm" style="max-width: 100px;">
</th>
<th>
</th>
<th class="text-right">
<a href="{{ route('Shop.Admin.Species.create') }}" class="btn btn-sm btn-success">{{ __('shop.species.add') }} <i class="fa fa-plus"></i></a> <a href="{{ route('Shop.Admin.Species.create') }}" class="btn btn-sm btn-success">{{ __('shop.species.add') }} <i class="fa fa-plus"></i></a>
</th>
</tr>
<tr>
<th>Nom</th>
<th>Nb produits</th>
<th></th>
</tr>
</thead>
</table>
</div> </div>
</div> </div>
{{$dataTable->table()}}
@endsection @endsection
@include('boilerplate::load.datatables') @push('scripts')
{{$dataTable->scripts()}}
@push('js') <script>
<script> $('#species-table').on( 'draw.dt', function () {
$(function () { $('.btn-edit').click(function() {
url = '/Shop/Admin/Species/edit/' + $(this).data('id');
$('#species-table').dataTable(); window.location = url;
$('#species-table').on('click', '.destroy', function (e) {
e.preventDefault();
var href = $(this).attr('href');
var line = $(this).closest('tr');
bootbox.confirm("{{ __('boilerplate::shop.admin.species.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.species.list.deletesuccess') }}", 'success');
}
}); });
}); });
}); </script>
});
</script>
@endpush @endpush