From 03d46071493cc6f73b59ed1e7745cfeaa25ed6e0 Mon Sep 17 00:00:00 2001 From: d9it Date: Thu, 14 Mar 2024 10:56:58 +0530 Subject: [PATCH] Fix service taxonomy category issue with taxonomy type --- app/Services/ServiceDataService.php | 38 ++++++++++--------- .../views/frontEnd/contacts/show.blade.php | 8 ++-- .../views/frontEnd/locations/show.blade.php | 8 ++-- .../frontEnd/organizations/show.blade.php | 8 ++-- .../services/service_download.blade.php | 4 +- .../frontEnd/services/services.blade.php | 8 ++-- .../services/services_download.blade.php | 8 ++-- .../views/frontEnd/services/show.blade.php | 22 +++++------ 8 files changed, 52 insertions(+), 52 deletions(-) diff --git a/app/Services/ServiceDataService.php b/app/Services/ServiceDataService.php index 5f6fd8c7..1a568e3e 100644 --- a/app/Services/ServiceDataService.php +++ b/app/Services/ServiceDataService.php @@ -93,24 +93,26 @@ public function service_airtable_v3($access_token, $base_url) $service->service_status = isset($record['fields']['status']) ? $record['fields']['status'] : null; - // if (isset($record['fields']['taxonomy'])) { - // $i = 0; - // foreach ($record['fields']['taxonomy'] as $value) { - // $service_taxonomy = new ServiceTaxonomy(); - // $service_taxonomy->service_recordid = $service->service_recordid; - // $service_taxonomy->taxonomy_recordid = $strtointclass->string_to_int($value); - // $service_taxonomy->save(); - // $servicetaxonomy = $strtointclass->string_to_int($value); - - // if ($i != 0) { - // $service->service_taxonomy = $service->service_taxonomy . ',' . $servicetaxonomy; - // } else { - // $service->service_taxonomy = $servicetaxonomy; - // } - - // $i++; - // } - // } + if (isset($record['fields']['taxonomy_terms'])) { + $i = 0; + $servicetaxonomy = []; + foreach ($record['fields']['taxonomy_terms'] as $value) { +// $service_taxonomy = new ServiceTaxonomy(); +// $service_taxonomy->service_recordid = $service->service_recordid; +// $service_taxonomy->taxonomy_recordid = $strtointclass->string_to_int($value); +// $service_taxonomy->save(); + $servicetaxonomy[] = $strtointclass->string_to_int($value); + +// if ($i != 0) { +// $service->service_taxonomy = $service->service_taxonomy . ',' . $servicetaxonomy; +// } else { +// $service->service_taxonomy = $servicetaxonomy; +// } + +// $i++; + } + $service->service_taxonomy = count($servicetaxonomy) > 0 ? implode(',', $servicetaxonomy) : null ; + } $service->service_application_process = isset($record['fields']['application_process']) ? $record['fields']['application_process'] : null; // $service->service_wait_time = isset($record['fields']['wait_time']) ? $record['fields']['wait_time'] : null; diff --git a/resources/views/frontEnd/contacts/show.blade.php b/resources/views/frontEnd/contacts/show.blade.php index 6826a63d..02666098 100644 --- a/resources/views/frontEnd/contacts/show.blade.php +++ b/resources/views/frontEnd/contacts/show.blade.php @@ -176,7 +176,7 @@ @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) + {{-- @if($service->service_taxonomy != null) --}} @if ($i == 0) Service Category: @php @@ -185,7 +185,7 @@ @endif {{$service_taxonomy_info->taxonomy_name}} - @endif + {{-- @endif --}} @endif @endforeach @@ -194,7 +194,7 @@ @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') - @if($service->service_taxonomy != null) + {{-- @if($service->service_taxonomy != null) --}} @if ($j == 0) Service Eligibility: @php @@ -203,7 +203,7 @@ @endif {{$service_taxonomy_info->taxonomy_name}} - @endif + {{-- @endif --}} @endif @endforeach diff --git a/resources/views/frontEnd/locations/show.blade.php b/resources/views/frontEnd/locations/show.blade.php index 20c5cca3..29d91316 100644 --- a/resources/views/frontEnd/locations/show.blade.php +++ b/resources/views/frontEnd/locations/show.blade.php @@ -263,7 +263,7 @@ @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) + {{-- @if($service->service_taxonomy != null) --}} @if ($i == 0) Service Category: @php @@ -273,7 +273,7 @@ {{$service_taxonomy_info->taxonomy_name}} - @endif + {{-- @endif --}} @endif @endforeach @@ -284,7 +284,7 @@ @if (isset($service_taxonomy_info->taxonomy_type) && count($service_taxonomy_info->taxonomy_type) > 0 && $service_taxonomy_info->taxonomy_type[0]->name == 'Service Eligibility') - @if($service->service_taxonomy != null) + {{-- @if($service->service_taxonomy != null) --}} @if ($j == 0) Service Eligibility: @php @@ -294,7 +294,7 @@ {{$service_taxonomy_info->taxonomy_name}} - @endif + {{-- @endif --}} @endif @endforeach diff --git a/resources/views/frontEnd/organizations/show.blade.php b/resources/views/frontEnd/organizations/show.blade.php index be7798db..55a20d5f 100644 --- a/resources/views/frontEnd/organizations/show.blade.php +++ b/resources/views/frontEnd/organizations/show.blade.php @@ -362,7 +362,7 @@ 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 Category') - @if ($service->service_taxonomy != null) + {{-- @if ($service->service_taxonomy != null) --}} @if ($i == 0) Service Category: @php @@ -372,7 +372,7 @@ class="subtitle">{{ $detail['detail_type'] }}: {{ $service_taxonomy_info->taxonomy_name }} - @endif + {{-- @endif --}} @endif @endforeach @@ -381,7 +381,7 @@ 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') - @if ($service->service_taxonomy != null) + {{-- @if ($service->service_taxonomy != null) --}} @if ($j == 0) Service Eligibility: @php @@ -391,7 +391,7 @@ class="subtitle">{{ $detail['detail_type'] }}: {{ $service_taxonomy_info->taxonomy_name }} - @endif + {{-- @endif --}} @endif @endforeach diff --git a/resources/views/frontEnd/services/service_download.blade.php b/resources/views/frontEnd/services/service_download.blade.php index bc01a2a2..08329030 100644 --- a/resources/views/frontEnd/services/service_download.blade.php +++ b/resources/views/frontEnd/services/service_download.blade.php @@ -50,14 +50,14 @@

Alternate Name: {{$service->service_alternate_name}}

Category: - @if($service->service_taxonomy!=0 || $service->service_taxonomy==null) + {{-- @if($service->service_taxonomy!=0 || $service->service_taxonomy==null) --}} @foreach($service->taxonomy as $key => $taxonomy) @if($loop->last) {{$taxonomy->taxonomy_name}} @else {{$taxonomy->taxonomy_name}}, @endif @endforeach - @endif + {{-- @endif --}}

Organization: @if($service->service_organization) diff --git a/resources/views/frontEnd/services/services.blade.php b/resources/views/frontEnd/services/services.blade.php index 8e1b8b31..324d335e 100644 --- a/resources/views/frontEnd/services/services.blade.php +++ b/resources/views/frontEnd/services/services.blade.php @@ -283,7 +283,7 @@ @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) + {{-- @if($service->service_taxonomy != null)--}} @if ($i == 0) Service Category: @php @@ -293,7 +293,7 @@ {{$service_taxonomy_info->taxonomy_name}} - @endif + {{-- @endif--}} @endif @endforeach @@ -306,7 +306,7 @@ @if (isset($service_taxonomy_info->taxonomy_type) && count($service_taxonomy_info->taxonomy_type) > 0 && $service_taxonomy_info->taxonomy_type[0]->name == 'Service Eligibility') - @if($service->service_taxonomy != null) + {{-- @if($service->service_taxonomy != null) --}} @if ($j == 0) Service Eligibility: @php @@ -316,7 +316,7 @@ {{$service_taxonomy_info->taxonomy_name}} - @endif + {{-- @endif --}} @endif @endforeach diff --git a/resources/views/frontEnd/services/services_download.blade.php b/resources/views/frontEnd/services/services_download.blade.php index fd2b6a0a..032b5e51 100644 --- a/resources/views/frontEnd/services/services_download.blade.php +++ b/resources/views/frontEnd/services/services_download.blade.php @@ -16,17 +16,17 @@ href="{{ config('app.url') }}/services/{{ $service->service_recordid }}"> {{ $service->service_name }}

Category: - @if ($service->service_taxonomy != 0) + {{-- @if ($service->service_taxonomy != 0) --}} @foreach ($service->taxonomy as $key => $taxonomy) - @if ($loop->last) + @if ($loop->last) {{ $taxonomy->taxonomy_name }} @else {{ $taxonomy->taxonomy_name }}, @endif - @endforeach - @endif + @endforeach + {{-- @endif --}}

Organization: @if ($service->service_organization != 0) diff --git a/resources/views/frontEnd/services/show.blade.php b/resources/views/frontEnd/services/show.blade.php index b206ad52..ec41d318 100644 --- a/resources/views/frontEnd/services/show.blade.php +++ b/resources/views/frontEnd/services/show.blade.php @@ -208,17 +208,15 @@ @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) - @if ($i == 0) - Service Category: - @php - $i++; - @endphp - @endif - {{ $service_taxonomy_info->taxonomy_name }} + @if ($i == 0) + Service Category: + @php + $i++; + @endphp @endif + {{ $service_taxonomy_info->taxonomy_name }} @endif @endforeach @@ -229,7 +227,7 @@ @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') - @if ($service->service_taxonomy != null) + {{-- @if ($service->service_taxonomy != null)--}} @if ($j == 0) Service Eligibility: @php @@ -239,7 +237,7 @@ {{ $service_taxonomy_info->taxonomy_name }} - @endif + {{-- @endif--}} @endif @endforeach