67 lines
3.1 KiB
PHP
67 lines
3.1 KiB
PHP
<div class="mx-auto max-w-4xl">
|
|
{{-- Header: Identik dengan RoleManager --}}
|
|
<div class="flex justify-between items-center mb-8">
|
|
<div>
|
|
<flux:heading size="xl">Tulis Berita</flux:heading>
|
|
<flux:subheading>Buat artikel edukasi kesehatan untuk pasien Anda.</flux:subheading>
|
|
</div>
|
|
<flux:button :href="route('admin.news')" variant="ghost" icon="arrow-left" wire:navigate>Kembali</flux:button>
|
|
</div>
|
|
|
|
<flux:card>
|
|
<form wire:submit.prevent="save" class="space-y-6">
|
|
{{-- Input Judul --}}
|
|
<flux:input wire:model="title" label="Judul Berita" placeholder="Masukkan judul artikel..." autofocus />
|
|
|
|
<div class="gap-6 grid grid-cols-1 md:grid-cols-2">
|
|
{{-- Dropdown Kategori --}}
|
|
<div class="space-y-2">
|
|
<flux:select wire:model.live="category_id" label="Kategori" placeholder="Pilih kategori...">
|
|
@foreach ($categories as $cat)
|
|
<flux:select.option value="{{ $cat->id }}">{{ $cat->name }}</flux:select.option>
|
|
@endforeach
|
|
</flux:select>
|
|
<flux:error name="category_id" />
|
|
</div>
|
|
|
|
{{-- Input Gambar --}}
|
|
<div class="space-y-2">
|
|
<flux:input type="file" wire:model="image" label="Gambar Thumbnail" secondary />
|
|
<flux:error name="image" />
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Preview Gambar jika sudah dipilih --}}
|
|
@if ($image)
|
|
<div class="relative border border-zinc-200 dark:border-zinc-700 rounded-xl overflow-hidden">
|
|
<img src="{{ $image->temporaryUrl() }}" class="w-full h-48 object-cover">
|
|
<div class="absolute inset-0 bg-black/10"></div>
|
|
</div>
|
|
@endif
|
|
|
|
{{-- Isi Berita --}}
|
|
<div class="space-y-2">
|
|
<flux:label>Konten Berita</flux:label>
|
|
|
|
<div wire:ignore x-data="{ value: @entangle('content') }" x-init="$refs.trix.editor.loadHTML(value)"
|
|
x-on:trix-change="value = $refs.trix.value"
|
|
class="bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-xl overflow-hidden">
|
|
<input id="x_create" type="hidden">
|
|
<trix-editor x-ref="trix" input="x_create"
|
|
class="p-4 focus:outline-none min-h-[300px] dark:text-white trix-content"></trix-editor>
|
|
</div>
|
|
|
|
<flux:error name="content" />
|
|
</div>
|
|
|
|
<div
|
|
class="flex justify-between items-center bg-zinc-50 dark:bg-white/5 p-4 border border-zinc-200 dark:border-zinc-700 rounded-xl">
|
|
<flux:checkbox wire:model="is_published" label="Publikasikan langsung"
|
|
description="Berita akan langsung terlihat oleh publik jika dicentang." />
|
|
|
|
<flux:button type="submit" variant="primary">Simpan Berita</flux:button>
|
|
</div>
|
|
</form>
|
|
</flux:card>
|
|
</div>
|