meobda-website/resources/views/admin/news/edit.blade.php

63 lines
3.1 KiB
PHP

<x-layout.admin>
<x-card class="max-w-3xl mx-auto">
<x-slot:header class="bg-brand-600!">Create News Story</x-slot:header>
<x-slot:body class="bg-white border border-brand-600">
@if($errors->any())
@foreach($errors->all() as $error)
<x-alert color="red">{{ $error }}</x-alert>
@endforeach
@endif
<x-form method="PATCH" :action="route('admin.news.update', $newsStory)">
<div>
<x-form.input name="headline" label="Headline" value="{{ $newsStory->headline }}" />
</div>
<div class="mt-3">
<x-form.textarea name="body" label="Body">
{{ $newsStory->body }}
</x-form.textarea>
</div>
<div class="mt-3">
<x-form.radio-group name="active">
<x-slot:label>Status</x-slot:label>
@if($newsStory->active)
<x-form.radio-group-item id="active" value="true" checked>Active</x-form.radio-group-item>
<x-form.radio-group-item id="draft" value="false">Draft</x-form.radio-group-item>
@else
<x-form.radio-group-item id="active" value="true">Active</x-form.radio-group-item>
<x-form.radio-group-item id="draft" value="false" checked>Draft</x-form.radio-group-item>
@endif
</x-form.radio-group>
</div>
<div x-data="{ showStartDate: {{ $newsStory->start_publication_date ? 'true' : 'false' }} }" class="mt-3">
<x-form.checkbox name="scheduleStart" x-model="showStartDate" value="true"
label="Schedule Publication"/>
<x-form.input
type="date"
name="start_publication_date"
label=""
value="{{ $newsStory->start_publication_date?->toDateString() ?? now()->toDateString() }}"
x-show="showStartDate"
x-cloak
/>
</div>
<div x-data="{ showEndDate: {{ $newsStory->stop_publication_date ? 'true' : 'false' }} }" class="mt-3">
<x-form.checkbox name="scheduleEnd" x-model="showEndDate" value="true" label="Schedule Removal"/>
<x-form.input
type="date"
name="stop_publication_date"
label=""
value="{{ $newsStory->stop_publication_date?->toDateString() ?? '' }}"
x-show="showEndDate"
x-cloak
/>
</div>
<div class="mt-3 text-right">
<x-form.button type="submit">Save Story</x-form.button>
</div>
</x-form>
</x-slot:body>
</x-card>
</x-layout.admin>