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('article_nature')->select('shop_articles.*');
|
||||
// $model = $model::joinRelations('Family')->select('shop_articles.*','shop_article_families.name as family_name');
|
||||
$model = self::filterByArticleNature($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()
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -21,7 +21,6 @@ class TagsDataTable extends DataTable
|
||||
{
|
||||
return [
|
||||
Column::make('group.name')->title('Groupe'),
|
||||
Column::make('sort_order')->title('Ordre'),
|
||||
Column::make('name')->title('Nom'),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
|
||||
@@ -18,7 +18,7 @@ class ArticleController extends Controller
|
||||
|
||||
public function index(ArticlesDataTable $dataTable)
|
||||
{
|
||||
$data['families'] = ArticleNatures::getOptions();
|
||||
$data['article_natures'] = ArticleNatures::getOptions();
|
||||
return $dataTable->render('Admin.Shop.Articles.list', $data);
|
||||
}
|
||||
|
||||
@@ -44,8 +44,7 @@ class ArticleController extends Controller
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = Articles::getMeta();
|
||||
$data['article'] = Articles::getFull($id);
|
||||
$data = Articles::getFull($id);
|
||||
return view('Admin.Shop.Articles.edit', $data);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,16 +61,26 @@ class Article extends Model implements HasMedia
|
||||
|
||||
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 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
|
||||
|
||||
@@ -46,7 +46,7 @@ class Articles
|
||||
|
||||
public static function getFull($id)
|
||||
{
|
||||
$data = self::getArticleEdit($id);
|
||||
$data['article'] = self::getArticleEdit($id);
|
||||
self::getMeta($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -173,10 +173,10 @@ return [
|
||||
'title' => 'Unités',
|
||||
'name' => 'Unité',
|
||||
'description' => 'Gérer les unités',
|
||||
'add' => 'Ajouter une unités',
|
||||
'edit' => 'Editer une unités',
|
||||
'del' => 'Effacer une unités',
|
||||
'list' => 'Liste des unitéss',
|
||||
'add' => 'Ajouter une unité',
|
||||
'edit' => 'Editer une unité',
|
||||
'del' => 'Effacer une unité',
|
||||
'list' => 'Liste des unités',
|
||||
'successadd' => 'L\'unité a été correctement ajoutée',
|
||||
'successmod' => 'L\'unité a été correctement modifiée',
|
||||
'successdel' => 'L\'unité a été correctement effacée',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('article_natures.title'),
|
||||
'subtitle' => __('article_natures.add'),
|
||||
'breadcrumb' => [__('article_natures.title'), __('article_natures.add')]
|
||||
'title' => __('shop.article_natures.title'),
|
||||
'subtitle' => __('shop.article_natures.add'),
|
||||
'breadcrumb' => [__('shop.article_natures.title'), __('shop.article_natures.add')]
|
||||
])
|
||||
|
||||
@include('boilerplate::load.fileinput')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('article_natures.title'),
|
||||
'subtitle' => __('article_natures.edit'),
|
||||
'breadcrumb' => [__('article_natures.title'), __('article_natures.edit')]
|
||||
'title' => __('shop.article_natures.title'),
|
||||
'subtitle' => __('shop.article_natures.edit'),
|
||||
'breadcrumb' => [__('shop.article_natures.title'), __('shop.article_natures.edit')]
|
||||
])
|
||||
|
||||
@include('boilerplate::load.fileinput')
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
'breadcrumb' => [__('shop.articles.title')]
|
||||
])
|
||||
|
||||
@include('load.form.select2')
|
||||
|
||||
@section('content')
|
||||
@include('components.datatable', ['route' => route('Admin.Shop.Articles.index'), 'model' => 'articles', 'with_filters' => true])
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<form id="articles-filters">
|
||||
<div class="row">
|
||||
<label class="col-4">Familles d'articles</label>
|
||||
<label class="col-4">{{ __('article_natures.title') }}</label>
|
||||
<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>
|
||||
</form>
|
||||
|
||||
@@ -1,25 +1,12 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('tags.title'),
|
||||
'subtitle' => __('tags.create.title'),
|
||||
'breadcrumb' => [__('tags.title'), __('tags.create.title')]
|
||||
'title' => __('shop.tags.add'),
|
||||
'subtitle' => __('shop.tags.title'),
|
||||
'breadcrumb' => [__('shop.tags.title'), __('shop.tags.create')]
|
||||
])
|
||||
|
||||
@section('content')
|
||||
|
||||
{{ 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')
|
||||
</form>
|
||||
|
||||
|
||||
@@ -1,25 +1,12 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('tags.title'),
|
||||
'subtitle' => __('tags.edit.title'),
|
||||
'breadcrumb' => [__('tags.title'), __('tags.create.title')]
|
||||
'title' => __('shop.tags.edit'),
|
||||
'subtitle' => __('shop.tags.title'),
|
||||
'breadcrumb' => [__('shop.tags.title'), __('shop.tags.add')]
|
||||
])
|
||||
|
||||
@section('content')
|
||||
|
||||
{{ 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 }}">
|
||||
@include('Admin.Shop.Tags.form')
|
||||
</form>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{{ 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 class="col-md-6">
|
||||
|
||||
@@ -1,28 +1,11 @@
|
||||
@extends('layout.index', [
|
||||
'title' => __('unities.title'),
|
||||
'subtitle' => __('unities.create.title'),
|
||||
'breadcrumb' => [__('unities.title')]
|
||||
'title' => __('shop.unities.title'),
|
||||
'subtitle' => __('shop.unities.add'),
|
||||
'breadcrumb' => [__('shop.unities.title')]
|
||||
])
|
||||
|
||||
@include('boilerplate::load.fileinput')
|
||||
|
||||
@section('content')
|
||||
|
||||
{{ 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>
|
||||
|
||||
{{ Form::open(['route' => 'Admin.Shop.Unities.store', 'id' => 'unity-form', 'autocomplete' => 'off']) }}
|
||||
@include('Admin.Shop.Unities.form')
|
||||
</form>
|
||||
|
||||
@endsection
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@extends('layout.index', [
|
||||
'title' => 'Unités',
|
||||
'subtitle' => 'Edition d\'une unité',
|
||||
'breadcrumb' => ['Unités']
|
||||
'title' => __('shop.unities.title'),
|
||||
'subtitle' => __('shop.unities.edit'),
|
||||
'breadcrumb' => [__('shop.unities.title'), __('shop.unities.edit')]
|
||||
])
|
||||
|
||||
@section('content')
|
||||
|
||||
Reference in New Issue
Block a user