new way to add all locales to datagrid

This commit is contained in:
AmooAti 2021-08-13 19:36:01 +04:30
parent e6b83beb33
commit cccd1f6331
2 changed files with 16 additions and 4 deletions

View File

@ -12,10 +12,6 @@ class CategoryDataGrid extends DataGrid
protected $sortOrder = 'desc';
protected $extraFilters = [
'locales'
];
protected $locale = 'all';
public function __construct()

View File

@ -1,3 +1,5 @@
@php( $locale = core()->getRequestedLocaleCode())
@extends('admin::layouts.content')
@section('page_title')
@ -16,6 +18,20 @@
{{ __('admin::app.catalog.categories.add-title') }}
</a>
</div>
<div class="control-group">
<select class="control" id="locale-switcher" name="locale"
onchange="reloadPage('locale', this.value)">
<option value="all" {{ ! isset($locale) ? 'selected' : '' }}>
{{ __('admin::app.admin.system.all-locales') }}
</option>
@foreach (core()->getAllLocales() as $localeModel)
<option
value="{{ $localeModel->code }}" {{ (isset($locale) && ($localeModel->code) == $locale) ? 'selected' : '' }}>
{{ $localeModel->name }}
</option>
@endforeach
</select>
</div>
</div>
{!! view_render_event('bagisto.admin.catalog.categories.list.before') !!}