@if($assigned_tags_tree && count($assigned_tags_tree) > 0) @foreach($assigned_tags_tree as $parentId => $treeItem) @php $parentTag = $treeItem['tag']; $children = $treeItem['children']; @endphp
@if($parentTag->description || ($parentTag->isSubTag() && $parentTag->parent))
@if($parentTag->isSubTag() && $parentTag->parent)
{{ $parentTag->parent->name }} → {{ $parentTag->name }}
@endif @if($parentTag->description) @if($parentTag->isSubTag() && $parentTag->parent)
@endif
Description
{{ $parentTag->description }}
@endif
@endif
@foreach($children as $childTag) @php // Ensure parent is loaded for sub-tags if ($childTag->isSubTag() && !$childTag->relationLoaded('parent')) { $childTag->load('parent'); } // Get parent name for tooltip $parentName = $childTag->parent ? $childTag->parent->name : 'Unknown Parent'; @endphp
@if($childTag->description)
{{ $parentName }} → {{ $childTag->name }}

{{ $childTag->description }}
@endif
@endforeach @endforeach @else @foreach ($case_default_tags as $index => $case_tag) @php $case_tag = \App\Models\case_tags::with('category')->withTrashed()->find($case_tag) @endphp @if (isset($case_tag))
@if($case_tag->description)
Tag Description
{{ $case_tag->description }}
@endif
@endif @endforeach @endif
@if($isVisible)
@if ($isEdit && $isCustomTag)
@foreach ($svgs as $index => $svg)
{!! $svg !!}
@endforeach
{{-- ✅ Priority Field for CaseTag --}}
@endif @if($isEdit)
{{-- @if($available_tags && $available_tags->count() > 0) --}} @foreach(($available_tags ?? collect())->where('is_default',0) as $index => $tag)
@endforeach
@else
@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)
@if($parentTag->description)
Tag Description
{{ $parentTag->description }}
@endif
@php $children = $subTags->filter(function($tag) use ($parentTag) { return $tag->parent_id == $parentTag->id; }); @endphp @if($children->count() > 0)
@foreach($children as $childTag) @php $parentName = $childTag->parent ? $childTag->parent->name : 'Unknown Parent'; @endphp
@if($childTag->description)
Tag Hierarchy
Parent: {{ $parentName }}

Description
{{ $childTag->description }}
@endif
@endforeach
@endif
@endforeach
@php $standaloneSubTags = $subTags->filter(function($tag) use ($parentTags) { return !$parentTags->contains('id', $tag->parent_id); }); @endphp @if($standaloneSubTags->count() > 0)
@foreach($standaloneSubTags as $childTag) @php $parentName = $childTag->parent ? $childTag->parent->name : 'Unknown Parent'; @endphp
@if($childTag->description)
Tag Hierarchy
Parent: {{ $parentName }}

Description
{{ $childTag->description }}
@endif
@endforeach
@endif
@endforeach @elseif($available_tags_tree && count($available_tags_tree) > 0)
@foreach($available_tags_tree as $parentId => $treeItem) @php $parentTag = $treeItem['tag']; $children = $treeItem['children']; @endphp
@if($parentTag->description)
Tag Description
{{ $parentTag->description }}
@endif
@if(count($children) > 0)
@foreach($children as $childTag) @php $parentName = $childTag->parent ? $childTag->parent->name : 'Unknown Parent'; @endphp
@if($childTag->description)
Tag Hierarchy
Parent: {{ $parentName }}

Description
{{ $childTag->description }}
@endif
@endforeach
@endif
@endforeach
@else

No tags available for this form. Please assign tags to this form first.

@endif
@endif
{{-- --}} @isset($msg)

{{$msg}}

@endisset
@endif