@extends('frontend.layouts.app')
@php
use Illuminate\Support\Str;
$metaDescription = $temple->seo_description ?: Str::limit(strip_tags($temple->short_description ?: $temple->description ?: ''), 155);
$cover = $temple->featured_image ?: $temple->image;
$mapHref = $temple->map_url
?: (($temple->latitude !== null && $temple->longitude !== null)
? 'https://maps.google.com/?q='.(float) $temple->latitude.','.(float) $temple->longitude
: null);
$faithCat = $temple->faithCategory ?? $temple->place?->faithCategory;
@endphp
@section('title', $temple->seo_title ?: $temple->trans('name').' — '.($temple->place?->trans('name') ?? __('Braj')))
@section('meta_description', e($metaDescription))
@section('og_title', $temple->seo_title ?: $temple->trans('name').' | '.__('THE BRAJ'))
@section('og_description', e($metaDescription))
@if($temple->canonical_url)
@section('canonical', $temple->canonical_url)
@endif
@if($temple->og_image)
@section('og_image', Str::startsWith($temple->og_image, ['http://', 'https://']) ? $temple->og_image : asset($temple->og_image))
@elseif($cover)
@section('og_image', Str::startsWith($cover, ['http://', 'https://']) ? $cover : asset($cover))
@endif
@section('jsonld')
@endsection
@section('content')
{{-- Breadcrumb --}}
@include('frontend.shared._report', ['type' => 'temple', 'id' => $temple->id])
{{-- Hero --}}
@if($cover)
@endif
{{-- Faith Badge & Verification Indicator --}}
@if($faithCat)
@if($faithCat->icon)
@endif
{{ __($faithCat->name) }}
•
{{ $temple->getAdaptiveLabel('sacred_place_type', 'Sacred Shrine') }}
@endif
@if($temple->verification_status === 'verified')
{{ __('Verified Shrine') }}
@endif
{{ $temple->trans('name') }}
@if(app()->getLocale() !== 'hi' && $temple->name_hi)
{{ $temple->name_hi }}
@endif
@if($temple->deity){{ $temple->getAdaptiveLabel('primary_dedication', 'Dedicated to') }}: {{ $temple->deity }} · @endif
@if($temple->place){{ $temple->place->trans('name') }}@endif
@if($temple->short_description)
{{ $temple->trans('short_description') }}
@endif
{{-- Text sections — only when they hold data --}}
@php
$sections = [
__('Introduction') => $temple->trans('description'),
__('Historical Overview') => $temple->trans('history'),
__('Spiritual Significance') => $temple->trans('significance'),
$temple->getAdaptiveLabel('tradition_lineage', 'Traditions & Special Features') => $temple->trans('traditions'),
$temple->getAdaptiveLabel('festival_calendar', 'Festivals & Occasions') => $temple->trans('festivals'),
];
@endphp
@foreach($sections as $label => $html)
@if($html && trim(strip_tags($html)) !== '')
{{ $label }}
{!! $html !!}
@endif
@endforeach
{{-- Dedicated Community Kitchen / Langar / Mahaprasad Callout --}}
@if($temple->community_kitchen_info && trim(strip_tags($temple->community_kitchen_info)) !== '')
{{ $temple->getAdaptiveLabel('community_kitchen', 'Community Kitchen & Prasad') }}
{!! $temple->community_kitchen_info !!}
@endif
{{-- Visiting Hours & Daily Rituals Schedule --}}
@if($temple->darshan_timings || $temple->aarti_schedule || $temple->timing_note)
{{ $temple->getAdaptiveLabel('visiting_hours', 'Visiting Hours') }} & {{ $temple->getAdaptiveLabel('daily_rituals', 'Schedule') }}
@if($temple->darshan_timings)
{{ $temple->getAdaptiveLabel('visiting_hours', 'Darshan Timings') }}
{{ $temple->darshan_timings }}
@endif
@if($temple->aarti_schedule)
{{ $temple->getAdaptiveLabel('daily_rituals', 'Aarti Schedule') }}
{{ $temple->aarti_schedule }}
@endif
@if($temple->timing_note)
{{ $temple->timing_note }}
@endif
@if($temple->timings_verified_on || $temple->timings_source)
{{ __('Timings last verified') }}
@if($temple->timings_verified_on) on {{ $temple->timings_verified_on->format('d M Y') }}@endif
@if($temple->timings_source) (source: {{ $temple->timings_source }})@endif
— {{ __('please reconfirm locally before visiting.') }}
@endif
@endif
{{-- Location & contact --}}
@if($temple->address || $temple->phone || $temple->website || ($temple->latitude !== null && $temple->longitude !== null))
{{ __('Location & Contact') }}
@if($temple->address)
{{ $temple->address }}@if($temple->place), {{ $temple->place->trans('name') }}@endif
@endif
@if($temple->phone)
{{ $temple->phone }}
@endif
@if($temple->website)
@endif
@endif
{{-- Visitor Guidelines & Etiquette --}}
@if(($temple->visitor_guidelines && trim(strip_tags($temple->visitor_guidelines)) !== '') || $temple->photography_rules || $temple->entry_fee)
{{ $temple->getAdaptiveLabel('visitor_guidelines', 'Visitor Guidelines & Etiquette') }}
@if($temple->visitor_guidelines && trim(strip_tags($temple->visitor_guidelines)) !== '')
{!! $temple->visitor_guidelines !!}
@endif
@if($temple->photography_rules)
{{ __('Photography') }}: {{ $temple->photography_rules }}
@endif
@if($temple->entry_fee)
{{ __('Entry Fee') }}: {{ $temple->entry_fee }}
@endif
@endif
{{-- Related shrines (same place only) --}}
@if($related->isNotEmpty())
{{ __('More') }} {{ $temple->getAdaptiveLabel('sacred_places_title', 'Temples') }} {{ __('in') }} {{ $temple->place?->trans('name') }}
@endif
{{-- Devotee Darshan Experiences & Memoirs --}}
@include('frontend.partials._darshan_experiences', ['target' => $temple, 'targetType' => 'place_entity'])
@include('frontend.partials.related-stories', ['stories' => $entityStories])
@endsection