Fixes
This commit is contained in:
@@ -13,7 +13,7 @@ class SpeciesDataTable extends DataTable
|
|||||||
|
|
||||||
public function query(Specie $model)
|
public function query(Specie $model)
|
||||||
{
|
{
|
||||||
$model = $model::withCount('varieties')->with(['genre','image']);
|
$model = $model::withCount(['images','varieties','tags'])->with(['genre','image','tags']);
|
||||||
return $this->buildQuery($model);
|
return $this->buildQuery($model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,7 +26,14 @@ class SpeciesDataTable extends DataTable
|
|||||||
->editColumn('genre_name', function (Specie $specie) {
|
->editColumn('genre_name', function (Specie $specie) {
|
||||||
return $specie->genre ? $specie->genre->name : '';
|
return $specie->genre ? $specie->genre->name : '';
|
||||||
})
|
})
|
||||||
->rawColumns(['thumb', 'genre_name', 'action']);
|
->editColumn('tags2', function (Specie $specie) {
|
||||||
|
$html = '';
|
||||||
|
foreach ($specie->tags as $tag) {
|
||||||
|
$html .= '<span class="btn btn-xs btn-secondary pb-2">' . $tag->slug . '</span> ';
|
||||||
|
}
|
||||||
|
return $html;
|
||||||
|
})
|
||||||
|
->rawColumns(['thumb', 'tags2', 'genre_name', 'action']);
|
||||||
return parent::modifier($datatables);
|
return parent::modifier($datatables);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +45,10 @@ class SpeciesDataTable extends DataTable
|
|||||||
Column::make('alias'),
|
Column::make('alias'),
|
||||||
Column::make('genre.name')->data('genre_name')->title('Genre'),
|
Column::make('genre.name')->data('genre_name')->title('Genre'),
|
||||||
Column::make('latin'),
|
Column::make('latin'),
|
||||||
Column::make('varieties_count')->title('Nb variétés')->searchable(false)->addClass('text-right'),
|
Column::make('tags2')->title('Tags')->searchable(false)->orderable(false),
|
||||||
|
Column::make('varieties_count')->title('#Var')->searchable(false)->addClass('text-right'),
|
||||||
|
Column::make('tags_count')->title('#Tag')->searchable(false)->addClass('text-right'),
|
||||||
|
Column::make('images_count')->title('#Pho')->searchable(false)->addClass('text-right'),
|
||||||
$this->makeColumnButtons(),
|
$this->makeColumnButtons(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ class ParentDataTable extends DataTable
|
|||||||
*/
|
*/
|
||||||
public function buildQuery($model)
|
public function buildQuery($model)
|
||||||
{
|
{
|
||||||
// $model = $model->select($model->getTable() . '.*');
|
|
||||||
return $model->newQuery();
|
return $model->newQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +149,7 @@ class ParentDataTable extends DataTable
|
|||||||
'colReorder' => $this->colReorder,
|
'colReorder' => $this->colReorder,
|
||||||
'fixedColumns' => $this->fixedColumns,
|
'fixedColumns' => $this->fixedColumns,
|
||||||
'fixedHeader' => $this->fixedHeader,
|
'fixedHeader' => $this->fixedHeader,
|
||||||
'pageLength' => 5,
|
'pageLength' => 10,
|
||||||
'searchDelay' => 500,
|
'searchDelay' => 500,
|
||||||
'scrollX' => $this->scrollX,
|
'scrollX' => $this->scrollX,
|
||||||
'scrollCollapse' => $this->scrollCollapse,
|
'scrollCollapse' => $this->scrollCollapse,
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ class Shop
|
|||||||
$menu->addTo('shop', 'Tags', [ 'route' => 'Admin.Shop.Tags.index', 'permission' => 'backend_access' ])
|
$menu->addTo('shop', 'Tags', [ 'route' => 'Admin.Shop.Tags.index', 'permission' => 'backend_access' ])
|
||||||
->activeIfRoute(['Admin.Shop.Tags.*'])->order(8);
|
->activeIfRoute(['Admin.Shop.Tags.*'])->order(8);
|
||||||
|
|
||||||
|
$menu->addTo('shop', 'Groupes de tags', [ 'route' => 'Admin.Shop.TagGroups.index', 'permission' => 'backend_access' ])
|
||||||
|
->activeIfRoute(['Admin.Shop.TagGroups.*'])->order(8);
|
||||||
|
|
||||||
$menu->addTo('shop', 'Natures d\'articles', [ 'route' => 'Admin.Shop.ArticleNatures.index', 'permission' => 'backend_access' ])
|
$menu->addTo('shop', 'Natures d\'articles', [ 'route' => 'Admin.Shop.ArticleNatures.index', 'permission' => 'backend_access' ])
|
||||||
->activeIfRoute(['Admin.Shop.ArticleNatures.*'])->order(9);
|
->activeIfRoute(['Admin.Shop.ArticleNatures.*'])->order(9);
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,12 @@ namespace App\Models\Shop;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
use Spatie\Translatable\HasTranslations;
|
||||||
|
|
||||||
class Tag extends Model
|
class Tag extends Model
|
||||||
{
|
{
|
||||||
|
use HasTranslations;
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
public $translatable = ['name'];
|
public $translatable = ['name'];
|
||||||
|
|
||||||
@@ -40,9 +44,4 @@ class Tag extends Model
|
|||||||
{
|
{
|
||||||
return $query->where($this->table . '.tag_group_id', $id);
|
return $query->where($this->table . '.tag_group_id', $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNameAttribute($value)
|
|
||||||
{
|
|
||||||
return json_decode($value)->fr ?? false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,13 +49,10 @@ class Tags
|
|||||||
|
|
||||||
public static function create($data)
|
public static function create($data)
|
||||||
{
|
{
|
||||||
$slug = self::buildSlug($data);
|
$data['name'] = ['fr' => $data['name']];
|
||||||
$tag = app('rinvex.tags.tag')->create([
|
$data['slug'] = self::buildSlug($data);
|
||||||
'name' => ['fr' => $data['name']],
|
$data['sort_order'] = self::getNewOrder($data['tag_group_id']);
|
||||||
'slug' => $slug,
|
$tag = Tag::create($data);
|
||||||
'tag_group_id' => $data['tag_group_id'],
|
|
||||||
'sort_order' => self::getNewOrder($data['tag_group_id'])
|
|
||||||
]);
|
|
||||||
return $tag;
|
return $tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,7 @@
|
|||||||
])
|
])
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{ Form::open(['route' => 'Admin.Botanic.Species.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }}
|
{{ Form::open(['route' => 'Admin.Botanic.Species.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||||
@include('Admin.Botanic.Species.form')
|
@include('Admin.Botanic.Species.form')
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -5,10 +5,8 @@
|
|||||||
])
|
])
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
{{ Form::open(['route' => 'Admin.Botanic.Species.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }}
|
{{ Form::open(['route' => 'Admin.Botanic.Species.store', 'id' => 'form', 'autocomplete' => 'off', 'files' => true]) }}
|
||||||
<input type="hidden" name="id" value="{{ $specie['id'] }}">
|
<input type="hidden" name="id" id="id" value="{{ $specie['id'] }}">
|
||||||
@include('Admin.Botanic.Species.form')
|
@include('Admin.Botanic.Species.form')
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
@include('boilerplate::load.fileinput')
|
|
||||||
@include('boilerplate::load.select2')
|
|
||||||
@include('boilerplate::load.tinymce')
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
@@ -43,7 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
@include('components.uploader.widget', ['load_url' => route('Admin.Botanic.Species.getImages', ['id' => $specie['id'] ?? false]), 'delete_url' => route('Admin.Botanic.Species.deleteImage'), 'name' => 'images'])
|
@include('components.uploader.widget', ['load_url' => ($specie['id'] ?? false) ? route('Admin.Botanic.Species.getImages', ['id' => $specie['id']]) : null, 'delete_url' => route('Admin.Botanic.Species.deleteImage'), 'name' => 'images'])
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -53,9 +49,7 @@
|
|||||||
@include('load.form.editor')
|
@include('load.form.editor')
|
||||||
@include('load.form.save')
|
@include('load.form.save')
|
||||||
@include('load.form.select2')
|
@include('load.form.select2')
|
||||||
|
|
||||||
@include('load.form.upload.fileinput')
|
@include('load.form.upload.fileinput')
|
||||||
@include('boilerplate::load.tinymce')
|
|
||||||
|
|
||||||
@push('js')
|
@push('js')
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</button>
|
</button>
|
||||||
@if ($can_edit ?? true)
|
@if ($can_edit ?? true)
|
||||||
<button type="button" class="btn btn-xs btn-outline-danger">
|
<button type="button" class="btn btn-xs btn-outline-danger">
|
||||||
<i class="fas fa-trash" data-index="{{ $key }}"></i>
|
<i class="fas fa-trash" data-index="{{ $key }}" data-id="{{ $image['id'] }}"></i>
|
||||||
</button>
|
</button>
|
||||||
@endif
|
@endif
|
||||||
</figcaption>
|
</figcaption>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
@endcomponent
|
@endcomponent
|
||||||
|
|
||||||
@include('boilerplate::load.fileinput')
|
@include('load.form.upload.fileinput')
|
||||||
|
|
||||||
@if ($no_popup ?? true)
|
@if ($no_popup ?? true)
|
||||||
@push('js')
|
@push('js')
|
||||||
@@ -52,9 +52,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if ($load_url)
|
||||||
$(function() {
|
$(function() {
|
||||||
{{ $prefix ?? '' }}loadImages();
|
{{ $prefix ?? '' }}loadImages();
|
||||||
});
|
});
|
||||||
|
@endif
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@if ($no_popup ?? true)
|
@if ($no_popup ?? true)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@if(!defined('LOAD_SELECT2'))
|
@if(!defined('LOAD_SELECT2'))
|
||||||
@push('scripts')
|
@push('scripts')
|
||||||
<script src="/assets/plugins/select2/js/select2.full.min.js"></script>
|
<script src="/assets/plugins/select2/js/select2.full.min.js"></script>
|
||||||
<script src="/assets/plugins/select2/js/i18n/" . App::getLocale() . ".js"></script>
|
<script src="/assets/plugins/select2/js/i18n/{{ App::getLocale() }}.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function initSelect2(sel) {
|
function initSelect2(sel) {
|
||||||
@@ -14,9 +14,15 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('select2:open', () => {
|
$(document).on('select2:open',(e) => {
|
||||||
document.querySelector('.select2-search__field').focus();
|
let t = $(e.target);
|
||||||
});
|
console.log(t);
|
||||||
|
if (t && t.length) {
|
||||||
|
let id = t[0].id || t[0].name;
|
||||||
|
let item = document.querySelector(`input[aria-controls*='${id}']`);
|
||||||
|
return item ? item.focus() : false;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
||||||
|
|||||||
Reference in New Issue
Block a user