@extends('admin.index')
@section('content')

<form action="{{ route('admin.announcements.create') }}" method="post">
    @csrf
    <div class="card">
        <div class="border-bottom card-header">
            <h4 class="card-title">{{ trans('general.new_announcement') }}</h4>
        </div>
        <div class="card-body">
            <div class="row pt-2">
                <div class=" col-md-6 col-12">
                    <div class="row">
                        <div class="col-12">
                            <div class="mb-1">
                                <label class="form-label" for="title">{{ trans('general.title') }}</label>
                                <input required type="text" name="title" class="form-control" id="title" value="{{old('title')? old('title') : ''}}">
                            </div>
                        </div>
                        <div class="col-12">
                            <div class="mb-1">
                                <label class="form-label" for="stageSelect">{{ trans('general.stage') }}</label>
                                <select required name="stage_id" class="form-select" id="stageSelect">
                                    <option value="">--</option>
                                    @can('manageAsSuper',  App\Models\Announcement::class)
                                    <option value="-1">{{ trans('general.all') }}</option>
                                    @endcan
                                    @foreach($stages as $stage)
                                    <option value="{{ $stage->id }}" {{ old('stage_id')? ($stage->id == old('stage_id')? 'selected':'') : ''}}>
                                        {{ $stage->title }}
                                    </option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
                <div class=" col-md-6 col-12">
                    <div class="mb-1">
                        <label class="form-label" for="text">{{ trans('general.text') }}</label>
                        <textarea required name="text" class="form-control" id="text" rows="4">{{old('text')? old('text') : ''}}</textarea>
                    </div>
                </div>
            </div>
        </div>


        <div class="card-footer">
            <button type="submit" class="btn btn-primary waves-effect waves-float waves-light">{{ trans('general.save') }}</button>
            <button type="reset" class="btn btn-outline-secondary waves-effect">{{ trans('general.reset') }}</button>
        </div>
    </div>

</form>

@push('scripts')


@endpush

@push('header')


@endpush
@endsection