@extends('admin.layouts.app')

@section('title', __('dashboard.send_notification'))

@section('content')
<x-admin.page-header
    title="{{ __('dashboard.send_notification') }}"
    :breadcrumbs="[__('dashboard.send_notification') => route('admin.notifications.index')]"
/>

<div class="row mt-3">
    <div class="col-lg-8">
        <div class="card">
            <div class="card-header">
                <h5 class="mb-0">{{ __('dashboard.send_notification') }}</h5>
            </div>

            <div class="card-body">
                <form method="POST" action="{{ route('admin.members.notifications.send') }}">
                    @csrf
                    <input type="hidden" name="member_id" value="{{ $member->id ?? '' }}">

                    <div class="mb-3">
                        <label class="form-label">{{ __('dashboard.member') }}</label>
                        <input
                            type="text"
                            class="form-control"
                            value="{{ $member->name ?? '' }}"
                            readonly
                        >
                    </div>

                    <div class="mb-3">
                        <label class="form-label">{{ __('dashboard.title') }}</label>
                        <input
                            type="text"
                            class="form-control"
                            name="title"
                            maxlength="255"
                            required
                        >
                    </div>

                    <div class="mb-3">
                        <label class="form-label">{{ __('dashboard.message') }}</label>
                        <textarea
                            class="form-control"
                            name="message"
                            rows="5"
                            maxlength="1000"
                            required
                        ></textarea>
                    </div>

                    <div class="text-end">
                        <button type="submit" class="btn btn-primary">{{ __('dashboard.send') }}</button>
                    </div>
                </form>

                {{-- Success message --}}
                @if(session('success'))
                    <div class="alert alert-success mt-3">
                        {{ session('success') }}
                    </div>
                @endif

                {{-- Error message --}}
                @if(session('error'))
                    <div class="alert alert-danger mt-3">
                        {{ session('error') }}
                    </div>
                @endif
            </div>
        </div>
    </div>
</div>
@endsection
