@extends('admin.layout')

@section('title', 'Edit Page')

@section('content')
    <div class="admin-heading">
        <div>
            <span>{{ strtoupper($locale) }}</span>
            <h1>Edit {{ ucfirst($slug) }}</h1>
        </div>
        <a class="btn btn-ghost" href="{{ route('admin.pages.index') }}">Back</a>
    </div>

    <form class="admin-card admin-edit-form" method="post" action="{{ route('admin.pages.update', [$slug, $locale]) }}">
        @csrf
        @method('put')
        <label>
            <span>Title</span>
            <input name="title" value="{{ old('title', $page->title) }}" required>
            @error('title') <small>{{ $message }}</small> @enderror
        </label>
        <label>
            <span>Intro</span>
            <textarea name="intro" rows="4">{{ old('intro', $page->intro) }}</textarea>
            @error('intro') <small>{{ $message }}</small> @enderror
        </label>
        <label>
            <span>Body</span>
            <textarea name="body" rows="12">{{ old('body', $page->body) }}</textarea>
            @error('body') <small>{{ $message }}</small> @enderror
        </label>
        <button class="btn btn-primary" type="submit">Save page</button>
    </form>
@endsection
