@extends('layouts.dashboard') @section('content')

Leave Policy

{{-- Success Message --}} @if(session('success')) @endif @if($errors->any())
    @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif {{-- Upload Form --}}
@csrf
{{-- Preview Section --}} {{-- Preview Section --}} @if($policy)
{{ $policy->title }}
@php $ext = strtolower(pathinfo($policy->file_path, PATHINFO_EXTENSION)); $filename = pathinfo($policy->file_path, PATHINFO_BASENAME); // actual file name with extension @endphp
{{-- Thumbnail / Icon --}} @if(in_array($ext, ['jpg','jpeg','png','gif'])) {{-- Image Thumbnail --}}

{{ $filename }}

@elseif($ext == 'pdf') {{-- PDF Thumbnail --}}

{{ $filename }}

@else

No preview available ({{ strtoupper($ext) }})

@endif {{-- Buttons beside thumbnail --}}
Download
@csrf @method('DELETE')
{{-- Modal for Preview --}} @endif
@endsection @push('scripts') @endpush