Merge pull request #4595 from devansh-webkul/issue-4588
Fixed channel drop down which gets blank when admin panel filter based on new locale #4588
This commit is contained in:
commit
df6308cb68
|
|
@ -49,9 +49,11 @@ class ChannelDataGrid extends DataGrid
|
|||
public function prepareQueryBuilder()
|
||||
{
|
||||
$queryBuilder = $this->channelRepository->query()
|
||||
->leftJoin('channel_translations', 'channel_translations.channel_id', '=', 'channels.id')
|
||||
->addSelect('channels.id', 'channels.code', 'channel_translations.locale', 'channel_translations.name as translated_name', 'channels.hostname')
|
||||
->where('channel_translations.locale', '=', $this->locale);
|
||||
->leftJoin('channel_translations', function($leftJoin) {
|
||||
$leftJoin->on('channel_translations.channel_id', '=', 'channels.id')
|
||||
->where('channel_translations.locale', $this->locale);
|
||||
})
|
||||
->addSelect('channels.id', 'channels.code', 'channel_translations.locale', 'channel_translations.name as translated_name', 'channels.hostname');
|
||||
|
||||
$this->addFilter('id', 'channels.id');
|
||||
$this->addFilter('code', 'channels.code');
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@
|
|||
|
||||
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.parent_category.controls.before') !!}
|
||||
|
||||
<tree-view value-field="id" name-field="parent_id" input-type="radio" items='@json($categories)'></tree-view>
|
||||
<tree-view value-field="id" name-field="parent_id" input-type="radio" items='@json($categories)' fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
|
||||
|
||||
{!! view_render_event('bagisto.admin.catalog.category.create_form_accordian.parent_category.controls.after') !!}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@
|
|||
|
||||
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.parent_category.controls.before', ['category' => $category]) !!}
|
||||
|
||||
<tree-view value-field="id" name-field="parent_id" input-type="radio" items='@json($categories)' value='@json($category->parent_id)'></tree-view>
|
||||
<tree-view value-field="id" name-field="parent_id" input-type="radio" items='@json($categories)' value='@json($category->parent_id)' fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
|
||||
|
||||
{!! view_render_event('bagisto.admin.catalog.category.edit_form_accordian.parent_category.controls.before', ['category' => $category]) !!}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.categories.controls.before', ['product' => $product]) !!}
|
||||
|
||||
<tree-view behavior="normal" value-field="id" name-field="categories" input-type="checkbox" items='@json($categories)' value='@json($product->categories->pluck("id"))'></tree-view>
|
||||
<tree-view behavior="normal" value-field="id" name-field="categories" input-type="checkbox" items='@json($categories)' value='@json($product->categories->pluck("id"))' fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
|
||||
|
||||
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.categories.controls.after', ['product' => $product]) !!}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<select class="control" name="channels[]" v-validate="'required'" data-vv-as=""{{ __('admin::app.catalog.products.channel') }}"" multiple>
|
||||
@foreach (app('Webkul\Core\Repositories\ChannelRepository')->all() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ in_array($channel->code, $productChannels) ? 'selected' : ''}}>
|
||||
{{ $channel->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -6,8 +6,16 @@
|
|||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<?php $locale = request()->get('locale') ?: app()->getLocale(); ?>
|
||||
<?php $channel = request()->get('channel') ?: core()->getDefaultChannelCode(); ?>
|
||||
@php
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
$channel = request()->get('channel') ?: core()->getDefaultChannelCode();
|
||||
|
||||
$channelLocales = app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales;
|
||||
|
||||
if (! $channelLocales->contains('code', $locale)) {
|
||||
$locale = config('app.fallback_locale');
|
||||
}
|
||||
@endphp
|
||||
|
||||
{!! view_render_event('bagisto.admin.catalog.product.edit.before', ['product' => $product]) !!}
|
||||
|
||||
|
|
@ -29,7 +37,7 @@
|
|||
|
||||
<option
|
||||
value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
|
||||
{{ $channelModel->name }}
|
||||
{{ core()->getChannelName($channelModel) }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
|
@ -38,7 +46,7 @@
|
|||
|
||||
<div class="control-group">
|
||||
<select class="control" id="locale-switcher" name="locale">
|
||||
@foreach (app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales as $localeModel)
|
||||
@foreach ($channelLocales as $localeModel)
|
||||
|
||||
<option
|
||||
value="{{ $localeModel->code }}" {{ ($localeModel->code) == $locale ? 'selected' : '' }}>
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
<select type="text" class="control" name="channels[]" v-validate="'required'" value="{{ old('channel[]') }}" data-vv-as=""{{ __('admin::app.cms.pages.channel') }}"" multiple="multiple">
|
||||
@foreach($channels->all() as $channel)
|
||||
<option value="{{ $channel->id }}">{{ $channel->name }}</option>
|
||||
<option value="{{ $channel->id }}">{{ core()->getChannelName($channel) }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
<select type="text" class="control" name="channels[]" v-validate="'required'" value="{{ old('channel[]') }}" data-vv-as=""{{ __('admin::app.cms.pages.channel') }}"" multiple="multiple">
|
||||
@foreach(app('Webkul\Core\Repositories\ChannelRepository')->all() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ in_array($channel->id, $selectedOptionIds) ? 'selected' : '' }}>
|
||||
{{ $channel->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -6,8 +6,16 @@
|
|||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<?php $locale = request()->get('locale') ?: app()->getLocale(); ?>
|
||||
<?php $channel = request()->get('channel') ?: core()->getDefaultChannelCode(); ?>
|
||||
@php
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
$channel = request()->get('channel') ?: core()->getDefaultChannelCode();
|
||||
|
||||
$channelLocales = app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales;
|
||||
|
||||
if (! $channelLocales->contains('code', $locale)) {
|
||||
$locale = config('app.fallback_locale');
|
||||
}
|
||||
@endphp
|
||||
|
||||
<form method="POST" action="" @submit.prevent="onSubmit" enctype="multipart/form-data">
|
||||
|
||||
|
|
@ -23,7 +31,7 @@
|
|||
@foreach (core()->getAllChannels() as $channelModel)
|
||||
|
||||
<option value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
|
||||
{{ $channelModel->name }}
|
||||
{{ core()->getChannelName($channelModel) }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
|
@ -32,7 +40,7 @@
|
|||
|
||||
<div class="control-group">
|
||||
<select class="control" id="locale-switcher" name="locale">
|
||||
@foreach (core()->getAllLocales() as $localeModel)
|
||||
@foreach ($channelLocales as $localeModel)
|
||||
|
||||
<option value="{{ $localeModel->code }}" {{ ($localeModel->code) == $locale ? 'selected' : '' }}>
|
||||
{{ $localeModel->name }}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@
|
|||
<select v-validate="'required'" class="control" id="channel_id" name="channel_id" data-vv-as=""{{ __('admin::app.marketing.campaigns.channel') }}"">
|
||||
@foreach (app('Webkul\Core\Repositories\ChannelRepository')->all() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ old('channel_id') == $channel->id ? 'selected' : '' }}>
|
||||
{{ $channel->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@
|
|||
<select v-validate="'required'" class="control" id="channel_id" name="channel_id" data-vv-as=""{{ __('admin::app.marketing.campaigns.channel') }}"">
|
||||
@foreach (app('Webkul\Core\Repositories\ChannelRepository')->all() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ $selectedOption == $channel->id ? 'selected' : '' }}>
|
||||
{{ $channel->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
@foreach(core()->getAllChannels() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ old('channels') && in_array($channel->id, old('channels')) ? 'selected' : '' }}>
|
||||
{{ $channel->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
|
|
@ -306,7 +306,7 @@
|
|||
<input type="hidden" :name="['conditions[' + index + '][attribute_type]']" v-model="matchedAttribute.type">
|
||||
|
||||
<div v-if="matchedAttribute.key == 'product|category_ids' || matchedAttribute.key == 'product|category_ids' || matchedAttribute.key == 'product|parent::category_ids'">
|
||||
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :behavior="'no'"></tree-view>
|
||||
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :behavior="'no'" fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
|
||||
@foreach(core()->getAllChannels() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ in_array($channel->id, $selectedOptionIds) ? 'selected' : '' }}>
|
||||
{{ $channel->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
|
|
@ -343,7 +343,7 @@
|
|||
<input type="hidden" :name="['conditions[' + index + '][attribute_type]']" v-model="matchedAttribute.type">
|
||||
|
||||
<div v-if="matchedAttribute.key == 'product|children::category_ids' || matchedAttribute.key == 'product|category_ids' || matchedAttribute.key == 'product|parent::category_ids'">
|
||||
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :value='condition.value' :behavior="'no'"></tree-view>
|
||||
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :value='condition.value' :behavior="'no'" fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
|
|
@ -783,7 +783,7 @@
|
|||
},
|
||||
|
||||
showModal(id) {
|
||||
this.$root.$set(this.$root.modalIds, id, true);
|
||||
this.$root.$set(this.$root.modalIds, id, true);
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
@foreach(core()->getAllChannels() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ old('channels') && in_array($channel->id, old('channels')) ? 'selected' : '' }}>
|
||||
{{ $channel->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
|
|
@ -230,7 +230,7 @@
|
|||
<input type="hidden" :name="['conditions[' + index + '][attribute_type]']" v-model="matchedAttribute.type">
|
||||
|
||||
<div v-if="matchedAttribute.key == 'product|category_ids'">
|
||||
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :behavior="'no'"></tree-view>
|
||||
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :behavior="'no'" fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@
|
|||
|
||||
@foreach(core()->getAllChannels() as $channel)
|
||||
<option value="{{ $channel->id }}" {{ in_array($channel->id, $selectedOptionIds) ? 'selected' : '' }}>
|
||||
{{ $channel->name }}
|
||||
{{ core()->getChannelName($channel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
|
|
@ -239,7 +239,7 @@
|
|||
<input type="hidden" :name="['conditions[' + index + '][attribute_type]']" v-model="matchedAttribute.type">
|
||||
|
||||
<div v-if="matchedAttribute.key == 'product|category_ids'">
|
||||
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :value='condition.value' :behavior="'no'"></tree-view>
|
||||
<tree-view value-field="id" id-field="id" :name-field="'conditions[' + index + '][value]'" input-type="checkbox" :items='matchedAttribute.options' :value='condition.value' :behavior="'no'" fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<tree-view value-field="key" id-field="key" items='@json($acl->items)'></tree-view>
|
||||
<tree-view value-field="key" id-field="key" items='@json($acl->items)' fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group tree-wrapper {{ $role->permission_type == 'all' ? 'hide' : '' }}">
|
||||
<tree-view value-field="key" id-field="key" items='@json($acl->items)' value='@json($role->permissions)'></tree-view>
|
||||
<tree-view value-field="key" id-field="key" items='@json($acl->items)' value='@json($role->permissions)' fallback-locale="{{ config('app.fallback_locale') }}"></tree-view>
|
||||
</div>
|
||||
</div>
|
||||
</accordian>
|
||||
|
|
|
|||
|
|
@ -221,6 +221,24 @@ class Core
|
|||
return ($channel = $this->getDefaultChannel()) ? $channelCode = $channel->code : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the channel name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getChannelName($channel): string
|
||||
{
|
||||
static $channelName;
|
||||
|
||||
if ($channelName) {
|
||||
return $channelName;
|
||||
}
|
||||
|
||||
return $channelName = $channel->name
|
||||
?? $channel->translate(app()->getLocale())->name
|
||||
?? $channel->translate(config('app.fallback_locale'))->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all locales
|
||||
*
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,18 +1,18 @@
|
|||
/* flatpickr v4.6.3, @license MIT */
|
||||
/* flatpickr v4.6.6, @license MIT */
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/ui.js": "/js/ui.js?id=9480d375da1da8eb3366",
|
||||
"/css/ui.css": "/css/ui.css?id=6555a7029beea2bc5c1e"
|
||||
"/js/ui.js": "/js/ui.js?id=8eae585f880f44e9aa39",
|
||||
"/css/ui.css": "/css/ui.css?id=72e23fc21cf1623e7aff"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<script>
|
||||
|
||||
export default {
|
||||
name: 'tree-view',
|
||||
|
||||
|
|
@ -40,7 +39,12 @@
|
|||
type: Array,
|
||||
required: false,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
|
||||
fallbackLocale: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
},
|
||||
|
||||
created () {
|
||||
|
|
@ -62,6 +66,8 @@
|
|||
computed: {
|
||||
caption () {
|
||||
return this.items[this.captionField]
|
||||
? this.items[this.captionField]
|
||||
: this.items.translations.filter((translation) => translation.locale === this.fallbackLocale)[0][this.captionField];
|
||||
},
|
||||
|
||||
allChildren () {
|
||||
|
|
@ -81,7 +87,7 @@
|
|||
}
|
||||
|
||||
searchTree(this.items)
|
||||
|
||||
|
||||
return leafs;
|
||||
},
|
||||
|
||||
|
|
@ -201,7 +207,8 @@
|
|||
childrenField: this.childrenField,
|
||||
valueField: this.valueField,
|
||||
idField: this.idField,
|
||||
behavior: this.behavior
|
||||
behavior: this.behavior,
|
||||
fallbackLocale: this.fallbackLocale
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<script>
|
||||
|
||||
export default {
|
||||
name: 'tree-view',
|
||||
|
||||
|
|
@ -58,7 +57,12 @@
|
|||
type: [Array, String, Object],
|
||||
required: false,
|
||||
default: () => ([])
|
||||
}
|
||||
},
|
||||
|
||||
fallbackLocale: {
|
||||
type: String,
|
||||
required: false
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
|
|
@ -105,7 +109,8 @@
|
|||
childrenField: this.childrenField,
|
||||
valueField: this.valueField,
|
||||
idField: this.idField,
|
||||
behavior: this.behavior
|
||||
behavior: this.behavior,
|
||||
fallbackLocale: this.fallbackLocale
|
||||
},
|
||||
on: {
|
||||
input: selection => {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,21 @@
|
|||
@php
|
||||
/* all locales */
|
||||
$locales = core()->getAllLocales();
|
||||
|
||||
/* request and fallback handling */
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
|
||||
$customer_group = request()->get('customer_group');
|
||||
|
||||
if ($channel == 'all') {
|
||||
$locales = core()->getAllLocales();
|
||||
} else {
|
||||
$locales = app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales;
|
||||
/* handling cases for new locale if not present in current channel */
|
||||
if ($channel !== 'all') {
|
||||
$channelLocales = app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales;
|
||||
|
||||
if ($channelLocales->contains('code', $locale)) {
|
||||
$locales = $channelLocales;
|
||||
} else {
|
||||
$channel = 'all';
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
|
||||
|
|
@ -35,7 +44,7 @@
|
|||
<option
|
||||
value="{{ $channelModel->code }}"
|
||||
{{ (isset($channel) && ($channelModel->code) == $channel) ? 'selected' : '' }}>
|
||||
{{ $channelModel->name }}
|
||||
{{ core()->getChannelName($channelModel) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,13 @@
|
|||
|
||||
@php
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
$channel = request()->get('channel') ?: core()->getCurrentChannelCode();
|
||||
$channel = request()->get('channel') ?: core()->getDefaultChannelCode();
|
||||
|
||||
$channelLocales = app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales;
|
||||
|
||||
if (! $channelLocales->contains('code', $locale)) {
|
||||
$locale = config('app.fallback_locale');
|
||||
}
|
||||
@endphp
|
||||
|
||||
@section('content')
|
||||
|
|
@ -38,7 +44,7 @@
|
|||
|
||||
<option
|
||||
value="{{ $channelModel->code }}" {{ ($channelModel->code) == $channel ? 'selected' : '' }}>
|
||||
{{ $channelModel->name }}
|
||||
{{ core()->getChannelName($channelModel) }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
|
|
@ -47,7 +53,7 @@
|
|||
|
||||
<div class="control-group">
|
||||
<select class="control" id="locale-switcher" name="locale">
|
||||
@foreach (app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales as $localeModel)
|
||||
@foreach ($channelLocales as $localeModel)
|
||||
|
||||
<option
|
||||
value="{{ $localeModel->code }}" {{ ($localeModel->code) == $locale ? 'selected' : '' }}>
|
||||
|
|
@ -113,7 +119,7 @@
|
|||
<div class="control-group">
|
||||
<label style="width:100%;">
|
||||
{{ __('velocity::app.admin.meta-data.home-page-content') }}
|
||||
<span class="locale">[{{ $metaData ? $metaData->channel : $channel }} - {{ $metaData ? $metaData->locale : $locale }}]</span>
|
||||
<span class="locale">[{{ $channel }} - {{ $locale }}]</span>
|
||||
</label>
|
||||
|
||||
<textarea
|
||||
|
|
@ -127,7 +133,7 @@
|
|||
<div class="control-group">
|
||||
<label style="width:100%;">
|
||||
{{ __('velocity::app.admin.meta-data.product-policy') }}
|
||||
<span class="locale">[{{ $metaData ? $metaData->channel : $channel }} - {{ $metaData ? $metaData->locale : $locale }}]</span>
|
||||
<span class="locale">[{{ $channel }} - {{ $locale }}]</span>
|
||||
</label>
|
||||
|
||||
<textarea
|
||||
|
|
@ -295,7 +301,7 @@
|
|||
<div class="control-group">
|
||||
<label style="width:100%;">
|
||||
{{ __('velocity::app.admin.meta-data.subscription-content') }}
|
||||
<span class="locale">[{{ $metaData ? $metaData->channel : $channel }} - {{ $metaData ? $metaData->locale : $locale }}]</span>
|
||||
<span class="locale">[{{ $channel }} - {{ $locale }}]</span>
|
||||
</label>
|
||||
|
||||
<textarea
|
||||
|
|
@ -309,7 +315,7 @@
|
|||
<div class="control-group">
|
||||
<label style="width:100%;">
|
||||
{{ __('velocity::app.admin.meta-data.footer-left-content') }}
|
||||
<span class="locale">[{{ $metaData ? $metaData->channel : $channel }} - {{ $metaData ? $metaData->locale : $locale }}]</span>
|
||||
<span class="locale">[{{ $channel }} - {{ $locale }}]</span>
|
||||
</label>
|
||||
|
||||
<textarea
|
||||
|
|
@ -323,7 +329,7 @@
|
|||
<div class="control-group">
|
||||
<label style="width:100%;">
|
||||
{{ __('velocity::app.admin.meta-data.footer-middle-content') }}
|
||||
<span class="locale">[{{ $metaData ? $metaData->channel : $channel }} - {{ $metaData ? $metaData->locale : $locale }}]</span>
|
||||
<span class="locale">[{{ $channel }} - {{ $locale }}]</span>
|
||||
</label>
|
||||
|
||||
<textarea
|
||||
|
|
@ -358,7 +364,7 @@
|
|||
$('#channel-switcher').val()
|
||||
|
||||
if (event.target.id == 'channel-switcher') {
|
||||
let locale = "{{ app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales->first()->code }}";
|
||||
let locale = "{{ $channelLocales->first()->code }}";
|
||||
|
||||
$('#locale-switcher').val(locale);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue