add filter not collapsed if filter is on
This commit is contained in:
@@ -53,7 +53,7 @@ class CategoryController extends Controller
|
|||||||
'tags' => TagGroups::getWithTagsAndCountOffers($categoryId),
|
'tags' => TagGroups::getWithTagsAndCountOffers($categoryId),
|
||||||
];
|
];
|
||||||
|
|
||||||
dump($data);
|
// dump($data);
|
||||||
// exit;
|
// exit;
|
||||||
return view('Shop.Shelves.shelve', $data);
|
return view('Shop.Shelves.shelve', $data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ class TagGroups
|
|||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
$tags = Tag::withCountArticlesByCategory($category_id)->get()->toArray();
|
$tags = Tag::withCountArticlesByCategory($category_id)->get()->toArray();
|
||||||
$tag_groups = TagGroup::pluck('name', 'id')->toArray();
|
$tagGroups = TagGroup::pluck('name', 'id')->toArray();
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
if (! $tag['articles_count']) {
|
if (! $tag['articles_count']) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$data[$tag['tag_group_id']]['name'] = $tag_groups[$tag['tag_group_id']];
|
$data[$tag['tag_group_id']]['name'] = $tagGroups[$tag['tag_group_id']];
|
||||||
$data[$tag['tag_group_id']]['tags'][] = [
|
$data[$tag['tag_group_id']]['tags'][] = [
|
||||||
'id' => $tag['id'],
|
'id' => $tag['id'],
|
||||||
'name' => $tag['name'],
|
'name' => $tag['name'],
|
||||||
@@ -33,6 +33,17 @@ class TagGroups
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function isTagGroupHaveSelected($tagsSelected, $tags)
|
||||||
|
{
|
||||||
|
foreach ($tags as $tag) {
|
||||||
|
if (in_array($tag['id'], $tagsSelected)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getTreeTags()
|
public static function getTreeTags()
|
||||||
{
|
{
|
||||||
$items = TagGroup::with('tags')->get();
|
$items = TagGroup::with('tags')->get();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
@component('components.layout.box-collapse', [
|
@component('components.layout.box-collapse', [
|
||||||
'title' => $group['name'],
|
'title' => $group['name'],
|
||||||
'id' => 'tag_group_' . $tag_group_id,
|
'id' => 'tag_group_' . $tag_group_id,
|
||||||
|
'collapsed' => App\Repositories\Shop\TagGroups::isTagGroupHaveSelected($tags_selected, $group['tags']),
|
||||||
])
|
])
|
||||||
@foreach ($group['tags'] as $tag)
|
@foreach ($group['tags'] as $tag)
|
||||||
<div class="form-inline">
|
<div class="form-inline">
|
||||||
|
|||||||
Reference in New Issue
Block a user