@extends('layouts.master')

@section('content')
<div class="container">
    <h1>View Event</h1>
    <div class="form-group">
        <label class="form-label" style="font-weight: bold;">List</label>
        <p>{{ $event->list->title }}</p>
    </div>
    <div class="form-group">
        <label class="form-label" style="font-weight: bold;">Description</label>
            <p>
                @php 
                    $description = $event->description;

                    $content1 = new Illuminate\Support\HtmlString(strip_tags($description, '<p><a><strong><em><ul><ol><li><blockquote><code><pre>'));
                    $content2 = new Illuminate\Support\HtmlString(Str::markdown($content1, [
                        'allow_unsafe_links' => false,
                    ])); 

                @endphp
                {{$content2 }}
            </p>                               
    </div>
    <div class="form-group">
        <label class="form-label" style="font-weight: bold;">Short Title</label>
        <p>{{ $event->short_title }}</p>
    </div>
    <div class="form-group">
        <label class="form-label" style="font-weight: bold;">Price</label>
        <p>{{ $event->price }}</p>
    </div>


    <div class="form-group" style="font-weight: bold;">
        <label>Image</label><br>
        <img src="{{ $event->imageURL }}" alt="List Image" width="150">
    </div>

    <a href="{{ route('edit-event', encrypt($event->id)) }}" class="btn btn-warning">Edit</a>
    <form action="{{ route('delete-event', encrypt($event->id)) }}" method="POST" onsubmit="return confirm('Are you sure you want to delete this event?');" style="display:inline;">
        @csrf
        @method('POST')
        <button type="submit" class="btn btn-danger">Delete</button>
    </form>
    <a href="{{ url()->previous() }}" class="btn btn-secondary">Back to Events</a>


</div>
@endsection
