From 12198a271a7ce52d7a6db48cfd0004578bd9aa36 Mon Sep 17 00:00:00 2001 From: d9it Date: Fri, 15 Mar 2024 11:46:53 +0530 Subject: [PATCH] Add logic for taxonomy data --- .../views/frontEnd/contacts/show.blade.php | 23 ++++++++++++++-- .../views/frontEnd/locations/show.blade.php | 27 ++++++++++++++----- .../frontEnd/organizations/show.blade.php | 23 ++++++++++++++-- .../frontEnd/services/services.blade.php | 26 +++++++++--------- .../views/frontEnd/services/show.blade.php | 18 +++++++++---- 5 files changed, 90 insertions(+), 27 deletions(-) diff --git a/resources/views/frontEnd/contacts/show.blade.php b/resources/views/frontEnd/contacts/show.blade.php index 02666098..b1f25f96 100644 --- a/resources/views/frontEnd/contacts/show.blade.php +++ b/resources/views/frontEnd/contacts/show.blade.php @@ -171,11 +171,27 @@ @php $i = 0; $j = 0; + $service_category_data = 0; + $service_eligibility_data = 0; + foreach ($service->taxonomy as $service_taxonomy_info) { + $taxonomyTypeCategory = $service_taxonomy_info?->taxonomy_type->where('name','Service Category')->first(); + + if (!empty($taxonomyTypeCategory)) { + $service_category_data += 1; + } + $taxonomyTypeEligibility = $service_taxonomy_info?->taxonomy_type->where('name','Service Eligibility')->first(); + if (!empty($taxonomyTypeEligibility)) { + $service_eligibility_data += 1; + } + } @endphp
@foreach ($service->taxonomy as $service_taxonomy_info) - @if (isset($service_taxonomy_info->taxonomy_type) && count($service_taxonomy_info->taxonomy_type) > 0 && $service_taxonomy_info->taxonomy_type[0]->name == 'Service Category') + @php + $taxonomyTypeCategory = $service_taxonomy_info?->taxonomy_type->where('name','Service Category')->first(); + @endphp + @if (!empty($taxonomyTypeCategory)) {{-- @if($service->service_taxonomy != null) --}} @if ($i == 0) Service Category: @@ -193,7 +209,10 @@
@foreach ($service->taxonomy as $service_taxonomy_info) - @if (isset($service_taxonomy_info->taxonomy_type) && count($service_taxonomy_info->taxonomy_type) > 0 && $service_taxonomy_info->taxonomy_type[0]->name == 'Service Eligibility') + @php + $taxonomyTypeEligibility = $service_taxonomy_info?->taxonomy_type->where('name','Service Eligibility')->first(); + @endphp + @if (!empty($taxonomyTypeEligibility)) {{-- @if($service->service_taxonomy != null) --}} @if ($j == 0) Service Eligibility: diff --git a/resources/views/frontEnd/locations/show.blade.php b/resources/views/frontEnd/locations/show.blade.php index 29d91316..b6001a33 100644 --- a/resources/views/frontEnd/locations/show.blade.php +++ b/resources/views/frontEnd/locations/show.blade.php @@ -256,13 +256,27 @@ @php $i = 0; $j = 0; + $service_category_data = 0; + $service_eligibility_data = 0; + foreach ($service->taxonomy as $service_taxonomy_info) { + $taxonomyTypeCategory = $service_taxonomy_info?->taxonomy_type->where('name','Service Category')->first(); + + if (!empty($taxonomyTypeCategory)) { + $service_category_data += 1; + } + $taxonomyTypeEligibility = $service_taxonomy_info?->taxonomy_type->where('name','Service Eligibility')->first(); + if (!empty($taxonomyTypeEligibility)) { + $service_eligibility_data += 1; + } + } @endphp
@foreach ($service->taxonomy as $service_taxonomy_info) - @if (isset($service_taxonomy_info->taxonomy_type) && - count($service_taxonomy_info->taxonomy_type) > 0 && - $service_taxonomy_info->taxonomy_type[0]->name == 'Service Category') + @php + $taxonomyTypeCategory = $service_taxonomy_info?->taxonomy_type->where('name','Service Category')->first(); + @endphp + @if (!empty($taxonomyTypeCategory)) {{-- @if($service->service_taxonomy != null) --}} @if ($i == 0) Service Category: @@ -281,9 +295,10 @@
@foreach ($service->taxonomy as $service_taxonomy_info) - @if (isset($service_taxonomy_info->taxonomy_type) && - count($service_taxonomy_info->taxonomy_type) > 0 && - $service_taxonomy_info->taxonomy_type[0]->name == 'Service Eligibility') + @php + $taxonomyTypeEligibility = $service_taxonomy_info?->taxonomy_type->where('name','Service Eligibility')->first(); + @endphp + @if (!empty($taxonomyTypeEligibility)) {{-- @if($service->service_taxonomy != null) --}} @if ($j == 0) Service Eligibility: diff --git a/resources/views/frontEnd/organizations/show.blade.php b/resources/views/frontEnd/organizations/show.blade.php index 55a20d5f..4a724fbb 100644 --- a/resources/views/frontEnd/organizations/show.blade.php +++ b/resources/views/frontEnd/organizations/show.blade.php @@ -357,11 +357,27 @@ class="subtitle">{{ $detail['detail_type'] }}: @php $i = 0; $j = 0; + $service_category_data = 0; + $service_eligibility_data = 0; + foreach ($service->taxonomy as $service_taxonomy_info) { + $taxonomyTypeCategory = $service_taxonomy_info?->taxonomy_type->where('name','Service Category')->first(); + + if (!empty($taxonomyTypeCategory)) { + $service_category_data += 1; + } + $taxonomyTypeEligibility = $service_taxonomy_info?->taxonomy_type->where('name','Service Eligibility')->first(); + if (!empty($taxonomyTypeEligibility)) { + $service_eligibility_data += 1; + } + } @endphp
@foreach ($service->taxonomy as $service_taxonomy_info) - @if (isset($service_taxonomy_info->taxonomy_type) && count($service_taxonomy_info->taxonomy_type) > 0 && $service_taxonomy_info->taxonomy_type[0]->name == 'Service Category') + @php + $taxonomyTypeCategory = $service_taxonomy_info?->taxonomy_type->where('name','Service Category')->first(); + @endphp + @if (!empty($taxonomyTypeCategory)) {{-- @if ($service->service_taxonomy != null) --}} @if ($i == 0) Service Category: @@ -380,7 +396,10 @@ class="subtitle">{{ $detail['detail_type'] }}:
@foreach ($service->taxonomy as $service_taxonomy_info) - @if (isset($service_taxonomy_info->taxonomy_type) && count($service_taxonomy_info->taxonomy_type) > 0 && $service_taxonomy_info->taxonomy_type[0]->name == 'Service Eligibility') + @php + $taxonomyTypeEligibility = $service_taxonomy_info?->taxonomy_type->where('name','Service Eligibility')->first(); + @endphp + @if (!empty($taxonomyTypeEligibility)) {{-- @if ($service->service_taxonomy != null) --}} @if ($j == 0) Service Eligibility: diff --git a/resources/views/frontEnd/services/services.blade.php b/resources/views/frontEnd/services/services.blade.php index 324d335e..855c6a4a 100644 --- a/resources/views/frontEnd/services/services.blade.php +++ b/resources/views/frontEnd/services/services.blade.php @@ -265,25 +265,26 @@ $j = 0; $service_category_data = 0; $service_eligibility_data = 0; - foreach($service->taxonomy as $service_taxonomy_info){ - // dd($service->taxonomy,$service_taxonomy_info->taxonomy_type); - if (isset($service_taxonomy_info->taxonomy_type) && count($service_taxonomy_info->taxonomy_type) > 0 && $service_taxonomy_info->taxonomy_type[0]->name == 'Service Category'){ + foreach ($service->taxonomy as $service_taxonomy_info) { + $taxonomyTypeCategory = $service_taxonomy_info?->taxonomy_type->where('name','Service Category')->first(); + + if (!empty($taxonomyTypeCategory)) { $service_category_data += 1; } - if (isset($service_taxonomy_info->taxonomy_type) && count($service_taxonomy_info->taxonomy_type) > 0 && $service_taxonomy_info->taxonomy_type[0]->name == 'Service Eligibility'){ + $taxonomyTypeEligibility = $service_taxonomy_info?->taxonomy_type->where('name','Service Eligibility')->first(); + if (!empty($taxonomyTypeEligibility)) { $service_eligibility_data += 1; } } - @endphp @if ($service_category_data != 0)
@foreach ($service->taxonomy as $service_taxonomy_info) - @if (isset($service_taxonomy_info->taxonomy_type) && - count($service_taxonomy_info->taxonomy_type) > 0 && - $service_taxonomy_info->taxonomy_type[0]->name == 'Service Category') - {{-- @if($service->service_taxonomy != null)--}} + @php + $taxonomyTypeCategory = $service_taxonomy_info?->taxonomy_type->where('name','Service Category')->first(); + @endphp + @if (!empty($taxonomyTypeCategory)) @if ($i == 0) Service Category: @php @@ -303,9 +304,10 @@
@foreach ($service->taxonomy as $service_taxonomy_info) - @if (isset($service_taxonomy_info->taxonomy_type) && - count($service_taxonomy_info->taxonomy_type) > 0 && - $service_taxonomy_info->taxonomy_type[0]->name == 'Service Eligibility') + @php + $taxonomyTypeEligibility = $service_taxonomy_info?->taxonomy_type->where('name','Service Eligibility')->first(); + @endphp + @if (!empty($taxonomyTypeEligibility)) {{-- @if($service->service_taxonomy != null) --}} @if ($j == 0) Service Eligibility: diff --git a/resources/views/frontEnd/services/show.blade.php b/resources/views/frontEnd/services/show.blade.php index ec41d318..3cc0ae30 100644 --- a/resources/views/frontEnd/services/show.blade.php +++ b/resources/views/frontEnd/services/show.blade.php @@ -194,11 +194,13 @@ $service_category_data = 0; $service_eligibility_data = 0; foreach ($service->taxonomy as $service_taxonomy_info) { - // dd($service_taxonomy_info->taxonomy_type[0]->name); - if (isset($service_taxonomy_info->taxonomy_type) && count($service_taxonomy_info->taxonomy_type) > 0 && $service_taxonomy_info->taxonomy_type[0]->name == 'Service Category') { + $taxonomyTypeCategory = $service_taxonomy_info?->taxonomy_type->where('name','Service Category')->first(); + + if (!empty($taxonomyTypeCategory)) { $service_category_data += 1; } - if (isset($service_taxonomy_info->taxonomy_type) && count($service_taxonomy_info->taxonomy_type) > 0 && $service_taxonomy_info->taxonomy_type[0]->name == 'Service Eligibility') { + $taxonomyTypeEligibility = $service_taxonomy_info?->taxonomy_type->where('name','Service Eligibility')->first(); + if (!empty($taxonomyTypeEligibility)) { $service_eligibility_data += 1; } } @@ -207,7 +209,10 @@
@foreach ($service->taxonomy as $service_taxonomy_info) - @if (isset($service_taxonomy_info->taxonomy_type) && count($service_taxonomy_info->taxonomy_type) > 0 && $service_taxonomy_info->taxonomy_type[0]->name == 'Service Category') + @php + $taxonomyTypeCategory = $service_taxonomy_info?->taxonomy_type->where('name','Service Category')->first(); + @endphp + @if (!empty($taxonomyTypeCategory)) @if ($i == 0) Service Category: @php @@ -226,7 +231,10 @@
@foreach ($service->taxonomy as $service_taxonomy_info) - @if (isset($service_taxonomy_info->taxonomy_type) && count($service_taxonomy_info->taxonomy_type) > 0 && $service_taxonomy_info->taxonomy_type[0]->name == 'Service Eligibility') + @php + $taxonomyTypeEligibility = $service_taxonomy_info?->taxonomy_type->where('name','Service Eligibility')->first(); + @endphp + @if (!empty($taxonomyTypeEligibility)) {{-- @if ($service->service_taxonomy != null)--}} @if ($j == 0) Service Eligibility: