@if($available_tags_by_category && $available_tags_by_category->isNotEmpty())
@foreach($available_tags_by_category as $categoryName => $categoryTags)
{{ $categoryName ?: 'Uncategorized' }}
@php
$parentTags = $categoryTags->where('is_default',0)->filter(function($tag) { return !$tag->isSubTag(); });
$subTags = $categoryTags->where('is_default',0)->filter(function($tag) { return $tag->isSubTag(); });
@endphp
@foreach($parentTags as $parentTag)
@php
$children = $subTags->filter(function($tag) use ($parentTag) { return $tag->parent_id == $parentTag->id; });
@endphp
@if($children->count() > 0)
@endif
@endforeach
@php
$standaloneSubTags = $subTags->filter(function($tag) use ($parentTags) {
return !$parentTags->contains('id', $tag->parent_id);
});
@endphp
@if($standaloneSubTags->count() > 0)
@endif
@endforeach
@elseif($available_tags_tree && count($available_tags_tree) > 0)
No tags available for this form. Please assign tags to this form first.