Tags
This commit is contained in:
30
app/DataTables/Shop/TagFamiliesDataTable.php
Normal file
30
app/DataTables/Shop/TagFamiliesDataTable.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\TagFamily;
|
||||
|
||||
class TagFamiliesDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'TagFamilies';
|
||||
|
||||
public function query(TagFamily $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(120)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
30
app/DataTables/Shop/TagsDataTable.php
Normal file
30
app/DataTables/Shop/TagsDataTable.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\DataTables\Shop;
|
||||
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\DataTables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Tag;
|
||||
|
||||
class TagsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'Tags';
|
||||
|
||||
public function query(Tag $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(120)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
63
app/Http/Controllers/Shop/Admin/TagController.php
Normal file
63
app/Http/Controllers/Shop/Admin/TagController.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Tags;
|
||||
use App\Repositories\Shop\TagFamilies;
|
||||
use App\DataTables\Shop\TagsDataTable;
|
||||
|
||||
class TagController extends Controller
|
||||
{
|
||||
public function index(TagsDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.Tags.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return Tags::getTables($request->all());
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [];
|
||||
$data['categories'] = Categories::getOptions();
|
||||
$data['families'] = TagFamilies::getOptions();
|
||||
$data['attribute_families'] = TagAttributeFamilies::getOptions();
|
||||
$data['models'] = ['App\Models\Botanic\Specie' => 'Espèces', 'App\Models\Botanic\Variety' => 'Variétés'];
|
||||
return view('Shop.Admin.Tags.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Tags::store($request->all());
|
||||
return redirect()->route('Shop.Admin.Tags.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = Tags::get($id);
|
||||
return view('Shop.Admin.Tags.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Tags::get($id);
|
||||
$data['categories'] = Tags::getOptions();
|
||||
return view('Shop.Admin.Tags.edit', $data);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return Tags::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
62
app/Http/Controllers/Shop/Admin/TagFamilyController.php
Normal file
62
app/Http/Controllers/Shop/Admin/TagFamilyController.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\TagFamily;
|
||||
use App\DataTables\Shop\TagFamiliesDataTable;
|
||||
|
||||
class TagFamilyController extends Controller
|
||||
{
|
||||
public function index(TagFamiliesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.TagFamilies.list');
|
||||
}
|
||||
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
return TagFamilies::getTables($request->all());
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = [];
|
||||
$data['categories'] = Categories::getOptions();
|
||||
$data['families'] = TagFamilyFamilies::getOptions();
|
||||
$data['attribute_families'] = TagFamilyAttributeFamilies::getOptions();
|
||||
$data['models'] = ['App\Models\Botanic\Specie' => 'Espèces', 'App\Models\Botanic\Variety' => 'Variétés'];
|
||||
return view('Shop.Admin.TagFamilies.create', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = TagFamilies::store($request->all());
|
||||
return redirect()->route('Shop.Admin.TagFamilies.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = TagFamilies::get($id);
|
||||
return view('Shop.Admin.TagFamilies.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = TagFamilies::get($id);
|
||||
$data['categories'] = TagFamilies::getOptions();
|
||||
return view('Shop.Admin.TagFamilies.edit', $data);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
return TagFamilies::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,10 +23,16 @@ class Shop
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeFamilies.*'])->order(4);
|
||||
$menu->addTo('shop', 'Attributs', [ 'route' => 'Shop.Admin.ArticleAttributeValues.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeValues.*'])->order(5);
|
||||
$menu->addTo('shop', 'Familles de tags', [ 'route' => 'Shop.Admin.TagFamilies.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.TagFamilies.*'])->order(6);
|
||||
$menu->addTo('shop', 'Tags', [ 'route' => 'Shop.Admin.Tags.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.Tags.*'])->order(7);
|
||||
|
||||
|
||||
$menu->addTo('shop', 'Réductions', [ 'route' => 'Shop.Admin.ArticleAttributeValues.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeValues.*'])->order(6);
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeValues.*'])->order(8);
|
||||
$menu->addTo('shop', 'Stock', [ 'route' => 'Shop.Admin.ArticleAttributeValues.index', 'permission' => 'backend_access' ])
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeValues.*'])->order(7);
|
||||
->activeIfRoute(['Shop.Admin.ArticleAttributeValues.*'])->order(9);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,9 @@ namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TagGroup extends Model
|
||||
class TagFamily extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'tagging_tag_groups';
|
||||
|
||||
}
|
||||
12
app/Models/Shop/TagFamily.php
Normal file
12
app/Models/Shop/TagFamily.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TagFamily extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'tagging_tag_groups';
|
||||
|
||||
}
|
||||
28
resources/views/Shop/Admin/TagFamilies/create.blade.php
Normal file
28
resources/views/Shop/Admin/TagFamilies/create.blade.php
Normal file
@@ -0,0 +1,28 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('tag_families.title'),
|
||||
'subtitle' => __('tag_families.create.title'),
|
||||
'breadcrumb' => [__('tag_families.title'), __('tag_families.create.title')]
|
||||
])
|
||||
|
||||
@include('boilerplate::load.fileinput')
|
||||
|
||||
@section('content')
|
||||
|
||||
{{ Form::open(['route' => 'Shop.Admin.ArticleFamilies.store', 'id' => 'article-family-form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 mbl">
|
||||
<a href="{{ route("Shop.Admin.TagFamilies.index") }}" class="btn btn-default">
|
||||
{{ __('tag_families.list.title') }}
|
||||
</a>
|
||||
|
||||
<span class="btn-group pull-right">
|
||||
@include('components.button-save')
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('Shop.Admin.TagFamilies.form')
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
29
resources/views/Shop/Admin/TagFamilies/edit.blade.php
Normal file
29
resources/views/Shop/Admin/TagFamilies/edit.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
@extends('layout.index', [
|
||||
'title' => 'Famille d\'articles',
|
||||
'subtitle' => 'Edition d\'une famille d\'article',
|
||||
'breadcrumb' => ['Articles']
|
||||
])
|
||||
|
||||
@include('boilerplate::load.fileinput')
|
||||
|
||||
@section('content')
|
||||
|
||||
{{ Form::open(['route' => 'Shop.Admin.TagFamilies.update', 'id' => 'article-family-form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 mbl">
|
||||
<a href="{{ route("Shop.Admin.TagFamilies.index") }}" class="btn btn-default">
|
||||
{{ __('tag_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.TagFamilies.form')
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
29
resources/views/Shop/Admin/TagFamilies/form.blade.php
Normal file
29
resources/views/Shop/Admin/TagFamilies/form.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
@include('boilerplate::load.tinymce')
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::label('name', 'Nom') }}
|
||||
@include('components.input', ['name' => 'name', 'value' => (isset($family['name'])) ? $family['name'] : null, 'required' => true])
|
||||
|
||||
{{ Form::label('description', 'Description') }}
|
||||
@include('components.textarea', ['name' => 'description', 'value' => isset($description) ? $description : null, 'class' => 'editor', 'required' => false])
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="float-right mt-3">
|
||||
@include('components.button-save')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$(function() {
|
||||
$('.editor').tinymce({});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
21
resources/views/Shop/Admin/TagFamilies/list.blade.php
Normal file
21
resources/views/Shop/Admin/TagFamilies/list.blade.php
Normal file
@@ -0,0 +1,21 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('Shop.tag_families.title'),
|
||||
'subtitle' => __('Shop.tag_families.list'),
|
||||
'breadcrumb' => [__('Shop.tag_families.title')]
|
||||
])
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row pb-3">
|
||||
<div class="col text-right">
|
||||
<a href="{{ route('Shop.Admin.TagFamilies.create') }}" class="btn btn-sm btn-success">{{ __('Shop.Admin.ArticleFamilies.add') }} <i class="fa fa-plus"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{$dataTable->table()}}
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@include('components.js.datatable', ['route' => '/Shop/Admin/TagFamilies', 'model' => 'TagFamilies'])
|
||||
@endpush
|
||||
36
resources/views/Shop/Admin/TagFamilies/show.blade.php
Normal file
36
resources/views/Shop/Admin/TagFamilies/show.blade.php
Normal file
@@ -0,0 +1,36 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('products.title'),
|
||||
'subtitle' => __('products.title'),
|
||||
'breadcrumb' => [__('products.title')]
|
||||
])
|
||||
|
||||
@section('content')
|
||||
<form action="{{ route('Shop.Products') }}" method="GET">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-offset-2 col-md-8">
|
||||
|
||||
<div class="box box-info">
|
||||
<div class="box-body">
|
||||
<div class="col-md-6">
|
||||
<h3>{{ name }}</h3>
|
||||
<h4>
|
||||
{{ $product.section.name }}<br>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
<h2>{{ $prix_total }} €</h2>
|
||||
<h4>{{ $residence['type_produit']['name'] }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
@include('Hestimmo.modules.Lot.partials.carousel')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
28
resources/views/Shop/Admin/Tags/create.blade.php
Normal file
28
resources/views/Shop/Admin/Tags/create.blade.php
Normal file
@@ -0,0 +1,28 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('article_families.title'),
|
||||
'subtitle' => __('article_families.create.title'),
|
||||
'breadcrumb' => [__('article_families.title'), __('article_families.create.title')]
|
||||
])
|
||||
|
||||
@include('boilerplate::load.fileinput')
|
||||
|
||||
@section('content')
|
||||
|
||||
{{ Form::open(['route' => 'Shop.Admin.ArticleFamilies.store', 'id' => 'article-family-form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 mbl">
|
||||
<a href="{{ route("Shop.Admin.Articles.index") }}" class="btn btn-default">
|
||||
{{ __('article_families.list.title') }}
|
||||
</a>
|
||||
|
||||
<span class="btn-group pull-right">
|
||||
@include('components.button-save')
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('Shop.Admin.ArticleFamilies.form')
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
29
resources/views/Shop/Admin/Tags/edit.blade.php
Normal file
29
resources/views/Shop/Admin/Tags/edit.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
@extends('layout.index', [
|
||||
'title' => 'Famille d\'articles',
|
||||
'subtitle' => 'Edition d\'une famille d\'article',
|
||||
'breadcrumb' => ['Articles']
|
||||
])
|
||||
|
||||
@include('boilerplate::load.fileinput')
|
||||
|
||||
@section('content')
|
||||
|
||||
{{ Form::open(['route' => 'Shop.Admin.ArticleFamilies.update', 'id' => 'article-family-form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12 mbl">
|
||||
<a href="{{ route("Shop.Admin.ArticleFamilies.index") }}" class="btn btn-default">
|
||||
{{ __('article_families.list.title') }}
|
||||
</a>
|
||||
|
||||
<span class="btn-group pull-right">
|
||||
@include('components.button-save')
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="id" value="{{ $id }}">
|
||||
@include('Shop.Admin.ArticleFamilies.form')
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
29
resources/views/Shop/Admin/Tags/form.blade.php
Normal file
29
resources/views/Shop/Admin/Tags/form.blade.php
Normal file
@@ -0,0 +1,29 @@
|
||||
@include('boilerplate::load.tinymce')
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{{ Form::label('name', 'Nom') }}
|
||||
@include('components.input', ['name' => 'name', 'value' => (isset($family['name'])) ? $family['name'] : null, 'required' => true])
|
||||
|
||||
{{ Form::label('description', 'Description') }}
|
||||
@include('components.textarea', ['name' => 'description', 'value' => isset($description) ? $description : null, 'class' => 'editor', 'required' => false])
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="float-right mt-3">
|
||||
@include('components.button-save')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$(function() {
|
||||
$('.editor').tinymce({});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
21
resources/views/Shop/Admin/Tags/list.blade.php
Normal file
21
resources/views/Shop/Admin/Tags/list.blade.php
Normal file
@@ -0,0 +1,21 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('Shop.tags.title'),
|
||||
'subtitle' => __('Shop.tags.list'),
|
||||
'breadcrumb' => [__('Shop.tags.title')]
|
||||
])
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row pb-3">
|
||||
<div class="col text-right">
|
||||
<a href="{{ route('Shop.Admin.Tags.create') }}" class="btn btn-sm btn-success">{{ __('Shop.Admin.Tags.add') }} <i class="fa fa-plus"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{$dataTable->table()}}
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
@include('components.js.datatable', ['route' => '/Shop/Admin/Tags', 'model' => 'Tags'])
|
||||
@endpush
|
||||
36
resources/views/Shop/Admin/Tags/show.blade.php
Normal file
36
resources/views/Shop/Admin/Tags/show.blade.php
Normal file
@@ -0,0 +1,36 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('products.title'),
|
||||
'subtitle' => __('products.title'),
|
||||
'breadcrumb' => [__('products.title')]
|
||||
])
|
||||
|
||||
@section('content')
|
||||
<form action="{{ route('Shop.Products') }}" method="GET">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-offset-2 col-md-8">
|
||||
|
||||
<div class="box box-info">
|
||||
<div class="box-body">
|
||||
<div class="col-md-6">
|
||||
<h3>{{ name }}</h3>
|
||||
<h4>
|
||||
{{ $product.section.name }}<br>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
<h2>{{ $prix_total }} €</h2>
|
||||
<h4>{{ $residence['type_produit']['name'] }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
@include('Hestimmo.modules.Lot.partials.carousel')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
12
routes/Shop/Admin/TagFamilies.php
Normal file
12
routes/Shop/Admin/TagFamilies.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
Route::prefix('TagFamilies')->name('TagFamilies.')->group(function () {
|
||||
Route::get('', 'TagFamilyController@index')->name('index');
|
||||
Route::get('create', 'TagFamilyController@create')->name('create');
|
||||
Route::delete('destroy', 'TagFamilyController@destroy')->name('destroy');
|
||||
Route::post('update', 'TagFamilyController@update')->name('update');
|
||||
Route::post('store', 'TagFamilyController@store')->name('store');
|
||||
Route::get('edit/{id}', 'TagFamilyController@edit')->name('edit');
|
||||
|
||||
});
|
||||
|
||||
12
routes/Shop/Admin/Tags.php
Normal file
12
routes/Shop/Admin/Tags.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
Route::prefix('Tags')->name('Tags.')->group(function () {
|
||||
Route::get('', 'TagController@index')->name('index');
|
||||
Route::get('create', 'TagController@create')->name('create');
|
||||
Route::delete('destroy', 'TagController@destroy')->name('destroy');
|
||||
Route::post('update', 'TagController@update')->name('update');
|
||||
Route::post('store', 'TagController@store')->name('store');
|
||||
Route::get('edit/{id}', 'TagController@edit')->name('edit');
|
||||
|
||||
});
|
||||
|
||||
@@ -16,5 +16,7 @@ Route::middleware('auth')->prefix('Admin')->namespace('Admin')->name('Admin.')->
|
||||
include( __DIR__ . '/Invoices.php');
|
||||
include( __DIR__ . '/OrderPayments.php');
|
||||
include( __DIR__ . '/Orders.php');
|
||||
include( __DIR__ . '/Tags.php');
|
||||
include( __DIR__ . '/TagFamilies.php');
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user