Fixes
This commit is contained in:
@@ -15,9 +15,16 @@ class ArticlesDataTable extends DataTable
|
|||||||
// $model = $model::with('Family')->select('shop_articles.*','family.name as family_name')->join('shop_article_families as family', 'family.id', '=', 'shop_articles.article_family_id')->groupBy('shop_articles.id');
|
// $model = $model::with('Family')->select('shop_articles.*','family.name as family_name')->join('shop_article_families as family', 'family.id', '=', 'shop_articles.article_family_id')->groupBy('shop_articles.id');
|
||||||
$model = $model::with('article_nature')->select('shop_articles.*');
|
$model = $model::with('article_nature')->select('shop_articles.*');
|
||||||
// $model = $model::joinRelations('Family')->select('shop_articles.*','shop_article_families.name as family_name');
|
// $model = $model::joinRelations('Family')->select('shop_articles.*','shop_article_families.name as family_name');
|
||||||
|
$model = self::filterByArticleNature($model);
|
||||||
return self::buildQuery($model);
|
return self::buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function filterByArticleNature($model, $article_nature_id = false)
|
||||||
|
{
|
||||||
|
$article_nature_id = $article_nature_id ? $article_nature_id : self::isFilteredByField('article_nature_id');
|
||||||
|
return $article_nature_id ? $model->byArticleNature($article_nature_id) : $model;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getColumns()
|
protected function getColumns()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ class TagsDataTable extends DataTable
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Column::make('group.name')->title('Groupe'),
|
Column::make('group.name')->title('Groupe'),
|
||||||
Column::make('sort_order')->title('Ordre'),
|
|
||||||
Column::make('name')->title('Nom'),
|
Column::make('name')->title('Nom'),
|
||||||
self::makeColumnButtons(),
|
self::makeColumnButtons(),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class ArticleController extends Controller
|
|||||||
|
|
||||||
public function index(ArticlesDataTable $dataTable)
|
public function index(ArticlesDataTable $dataTable)
|
||||||
{
|
{
|
||||||
$data['families'] = ArticleNatures::getOptions();
|
$data['article_natures'] = ArticleNatures::getOptions();
|
||||||
return $dataTable->render('Admin.Shop.Articles.list', $data);
|
return $dataTable->render('Admin.Shop.Articles.list', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,8 +44,7 @@ class ArticleController extends Controller
|
|||||||
|
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$data = Articles::getMeta();
|
$data = Articles::getFull($id);
|
||||||
$data['article'] = Articles::getFull($id);
|
|
||||||
return view('Admin.Shop.Articles.edit', $data);
|
return view('Admin.Shop.Articles.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,16 +61,26 @@ class Article extends Model implements HasMedia
|
|||||||
|
|
||||||
public function scopeByArticle($query, $id)
|
public function scopeByArticle($query, $id)
|
||||||
{
|
{
|
||||||
return $query->where('shop_articles.id', $id);
|
return $query->where($this->table . '.id', $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeByCategory($query, $category_id)
|
public function scopeByCategory($query, $category_id)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeByFamily($query, $id)
|
public function scopeByArticleNature($query, $id)
|
||||||
{
|
{
|
||||||
return $query->where('shop_articles.article_family_id', $id);
|
return $query->where($this->table . '.article_nature_id', $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopeByProduct($query, $model)
|
||||||
|
{
|
||||||
|
return $query->where($this->table . '.product_type', $model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function scopeByProductId($query, $model_id)
|
||||||
|
{
|
||||||
|
return $query->where($this->table . '.product_id', $model_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function registerMediaConversions(Media $media = null) : void
|
public function registerMediaConversions(Media $media = null) : void
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class Articles
|
|||||||
|
|
||||||
public static function getFull($id)
|
public static function getFull($id)
|
||||||
{
|
{
|
||||||
$data = self::getArticleEdit($id);
|
$data['article'] = self::getArticleEdit($id);
|
||||||
self::getMeta($data);
|
self::getMeta($data);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,10 +173,10 @@ return [
|
|||||||
'title' => 'Unités',
|
'title' => 'Unités',
|
||||||
'name' => 'Unité',
|
'name' => 'Unité',
|
||||||
'description' => 'Gérer les unités',
|
'description' => 'Gérer les unités',
|
||||||
'add' => 'Ajouter une unités',
|
'add' => 'Ajouter une unité',
|
||||||
'edit' => 'Editer une unités',
|
'edit' => 'Editer une unité',
|
||||||
'del' => 'Effacer une unités',
|
'del' => 'Effacer une unité',
|
||||||
'list' => 'Liste des unitéss',
|
'list' => 'Liste des unités',
|
||||||
'successadd' => 'L\'unité a été correctement ajoutée',
|
'successadd' => 'L\'unité a été correctement ajoutée',
|
||||||
'successmod' => 'L\'unité a été correctement modifiée',
|
'successmod' => 'L\'unité a été correctement modifiée',
|
||||||
'successdel' => 'L\'unité a été correctement effacée',
|
'successdel' => 'L\'unité a été correctement effacée',
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@extends('layout.index', [
|
@extends('layout.index', [
|
||||||
'title' => __('article_natures.title'),
|
'title' => __('shop.article_natures.title'),
|
||||||
'subtitle' => __('article_natures.add'),
|
'subtitle' => __('shop.article_natures.add'),
|
||||||
'breadcrumb' => [__('article_natures.title'), __('article_natures.add')]
|
'breadcrumb' => [__('shop.article_natures.title'), __('shop.article_natures.add')]
|
||||||
])
|
])
|
||||||
|
|
||||||
@include('boilerplate::load.fileinput')
|
@include('boilerplate::load.fileinput')
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@extends('layout.index', [
|
@extends('layout.index', [
|
||||||
'title' => __('article_natures.title'),
|
'title' => __('shop.article_natures.title'),
|
||||||
'subtitle' => __('article_natures.edit'),
|
'subtitle' => __('shop.article_natures.edit'),
|
||||||
'breadcrumb' => [__('article_natures.title'), __('article_natures.edit')]
|
'breadcrumb' => [__('shop.article_natures.title'), __('shop.article_natures.edit')]
|
||||||
])
|
])
|
||||||
|
|
||||||
@include('boilerplate::load.fileinput')
|
@include('boilerplate::load.fileinput')
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
'breadcrumb' => [__('shop.articles.title')]
|
'breadcrumb' => [__('shop.articles.title')]
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@include('load.form.select2')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@include('components.datatable', ['route' => route('Admin.Shop.Articles.index'), 'model' => 'articles', 'with_filters' => true])
|
@include('components.datatable', ['route' => route('Admin.Shop.Articles.index'), 'model' => 'articles', 'with_filters' => true])
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<form id="articles-filters">
|
<form id="articles-filters">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label class="col-4">Familles d'articles</label>
|
<label class="col-4">{{ __('article_natures.title') }}</label>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
@include('components.select', ['name' => 'family_id', 'list' => (isset($families)) ? $families : [], 'value' => (isset($filters['family_id'])) ? $filters['family_id'] : null, 'class' => 'form-control-sm select2', 'with_empty' => ' '])
|
@include('components.select', ['name' => 'article_nature_id', 'list' => $article_natures ?? [], 'value' => $filters['article_nature_id'] ?? null, 'class' => 'form-control-sm select2', 'with_empty' => ' '])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,25 +1,12 @@
|
|||||||
@extends('layout.index', [
|
@extends('layout.index', [
|
||||||
'title' => __('tags.title'),
|
'title' => __('shop.tags.add'),
|
||||||
'subtitle' => __('tags.create.title'),
|
'subtitle' => __('shop.tags.title'),
|
||||||
'breadcrumb' => [__('tags.title'), __('tags.create.title')]
|
'breadcrumb' => [__('shop.tags.title'), __('shop.tags.create')]
|
||||||
])
|
])
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{ Form::open(['route' => 'Admin.Shop.Tags.store', 'id' => 'tag-form', 'autocomplete' => 'off']) }}
|
{{ Form::open(['route' => 'Admin.Shop.Tags.store', 'id' => 'tag-form', 'autocomplete' => 'off']) }}
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-12 mbl">
|
|
||||||
<a href="{{ route("Admin.Shop.Articles.index") }}" class="btn btn-default">
|
|
||||||
{{ __('tags.list.title') }}
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<span class="btn-group pull-right">
|
|
||||||
@include('components.button-save')
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@include('Admin.Shop.Tags.form')
|
@include('Admin.Shop.Tags.form')
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,12 @@
|
|||||||
@extends('layout.index', [
|
@extends('layout.index', [
|
||||||
'title' => __('tags.title'),
|
'title' => __('shop.tags.edit'),
|
||||||
'subtitle' => __('tags.edit.title'),
|
'subtitle' => __('shop.tags.title'),
|
||||||
'breadcrumb' => [__('tags.title'), __('tags.create.title')]
|
'breadcrumb' => [__('shop.tags.title'), __('shop.tags.add')]
|
||||||
])
|
])
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{ Form::open(['route' => 'Admin.Shop.Tags.store', 'id' => 'tag-form', 'autocomplete' => 'off']) }}
|
{{ Form::open(['route' => 'Admin.Shop.Tags.store', 'id' => 'tag-form', 'autocomplete' => 'off']) }}
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-12 mbl">
|
|
||||||
<a href="{{ route("Admin.Shop.Tags.index") }}" class="btn btn-default">
|
|
||||||
{{ __('tags.title') }}
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<span class="btn-group pull-right">
|
|
||||||
@include('components.button-save')
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input type="hidden" name="id" value="{{ $id }}">
|
<input type="hidden" name="id" value="{{ $id }}">
|
||||||
@include('Admin.Shop.Tags.form')
|
@include('Admin.Shop.Tags.form')
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{{ Form::label('name', 'Groupe') }}
|
{{ Form::label('name', 'Groupe') }}
|
||||||
@include('components.select', ['name' => 'tag_group_id', 'list' => $tag_groups, 'value' => isset($tag_group_id) ? $tag_group_id : null, 'required' => true])
|
@include('components.select', ['name' => 'tag_group_id', 'list' => $tag_groups, 'value' => isset($tag_group_id) ? $tag_group_id : null, 'required' => true, 'with_empty' => ''])
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
|||||||
@@ -1,28 +1,11 @@
|
|||||||
@extends('layout.index', [
|
@extends('layout.index', [
|
||||||
'title' => __('unities.title'),
|
'title' => __('shop.unities.title'),
|
||||||
'subtitle' => __('unities.create.title'),
|
'subtitle' => __('shop.unities.add'),
|
||||||
'breadcrumb' => [__('unities.title')]
|
'breadcrumb' => [__('shop.unities.title')]
|
||||||
])
|
])
|
||||||
|
|
||||||
@include('boilerplate::load.fileinput')
|
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
{{ Form::open(['route' => 'Admin.Shop.Unities.store', 'id' => 'unity-form', 'autocomplete' => 'off']) }}
|
||||||
{{ Form::open(['route' => 'Admin.Shop.Unities.store', 'id' => 'unity-form', 'autocomplete' => 'off', 'files' => true]) }}
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm-12 mbl">
|
|
||||||
<a href="{{ route("Admin.Shop.Unities.index") }}" class="btn btn-default">
|
|
||||||
{{ __('unities.list.title') }}
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<span class="btn-group pull-right">
|
|
||||||
@include('components.button-save')
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@include('Admin.Shop.Unities.form')
|
@include('Admin.Shop.Unities.form')
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@extends('layout.index', [
|
@extends('layout.index', [
|
||||||
'title' => 'Unités',
|
'title' => __('shop.unities.title'),
|
||||||
'subtitle' => 'Edition d\'une unité',
|
'subtitle' => __('shop.unities.edit'),
|
||||||
'breadcrumb' => ['Unités']
|
'breadcrumb' => [__('shop.unities.title'), __('shop.unities.edit')]
|
||||||
])
|
])
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|||||||
Reference in New Issue
Block a user