12 lines
4.2 KiB
PHP
12 lines
4.2 KiB
PHP
<div><div class="flex flex-wrap gap-4 mb-6"><label class="min-w-56">Manage<select wire:model.live="section">@foreach($sections as $name)<option value="{{ $name }}">{{ ucwords(str_replace('_',' ',$name)) }}</option>@endforeach</select></label><div class="card flex-1 text-sm muted">Protected by administrator access and confirmed 2FA. Showing the latest 100 records per section. Mutations are audited.</div></div>@if(session('status'))<p role="status" class="text-cyan-200 mb-4">{{ session('status') }}</p>@endif @if($errors->any())<p role="alert" class="text-rose-300 mb-4">{{ $errors->first() }}</p>@endif
|
|
@if(in_array($section,['pages','releases']))<form wire:submit="save" class="card grid md:grid-cols-2 gap-4 mb-8"><h2>{{ $editing?'Edit':'Create' }} {{ rtrim($section,'s') }}</h2>@foreach($section==='pages'?['slug','title','description']:['version','channel','platform'] as $field)<label>{{ ucfirst($field) }}<input wire:model="form.{{ $field }}"></label>@endforeach<label class="md:col-span-2">{{ $section==='pages'?'Body (plain text, safe by default)':'Release notes' }}<textarea rows="6" wire:model="form.{{ $section==='pages'?'body':'notes' }}"></textarea></label>@if($section==='releases')<label>Private binary (ZIP, DMG or PKG)<input type="file" wire:model="upload" accept=".zip,.dmg,.pkg"></label>@endif<label><input type="checkbox" wire:model="form.published"> Published</label><button class="button" wire:loading.attr="disabled">Save</button><button type="button" class="secondary" wire:click="newRecord">New record</button></form>@endif
|
|
@if($section==='settings')<form wire:submit="saveSettings" class="card mb-8 space-y-4"><h2>Storefront settings</h2>@foreach(['headline','tagline','price_label'] as $field)<label>{{ ucwords(str_replace('_',' ',$field)) }}<input wire:model="form.{{ $field }}" required></label>@endforeach<button class="button">Save settings</button></form>@endif
|
|
@if(in_array($section,['navigation','media','redirects','email_templates']))
|
|
<form wire:submit="saveResource" class="card mb-6 grid md:grid-cols-2 gap-4"><h2 class="md:col-span-2">Add {{ $section }}</h2>
|
|
@foreach(match($section){'navigation'=>['label','path','position'],'media'=>['title','alt'],'redirects'=>['source','destination'],'email_templates'=>['slug','subject','body']} as $field)
|
|
<label>{{ ucfirst($field) }}@if($field==='body')<textarea wire:model="form.{{ $field }}" required></textarea>@else<input wire:model="form.{{ $field }}" required>@endif</label>@endforeach
|
|
@if($section==='media')<label>Image<input type="file" wire:model="upload" accept="image/png,image/jpeg,image/webp"></label>@endif
|
|
@if($section==='navigation')<label><input type="checkbox" wire:model="form.published"> Published</label>@endif
|
|
<button class="button" wire:loading.attr="disabled">Add</button></form>@endif
|
|
@if($section==='licenses')<label class="max-w-xs">Device limit to apply<input type="number" wire:model="form.device_limit" min="1" max="100"></label>@endif
|
|
<div class="card overflow-x-auto"><table class="w-full text-left text-sm"><thead><tr>@if($rows->isNotEmpty())@foreach(array_keys((array)$rows->first()) as $key)<th class="p-3 text-slate-400">{{ $key }}</th>@endforeach<th>Actions</th>@endif</tr></thead><tbody>@forelse($rows as $row)<tr class="border-t border-slate-800">@foreach((array)$row as $key=>$value)<td class="p-3 max-w-64 break-words">{{ \Illuminate\Support\Str::limit((string)$value,160) }}</td>@endforeach<td class="p-3">@if(in_array($section,['pages','releases']))<button class="text-cyan-200" wire:click="edit({{ $row->id }})">Edit</button>@elseif(in_array($section,['navigation','media','redirects','email_templates']))<button wire:confirm="Delete this record?" wire:click="remove({{ $row->id }})">Delete</button>@elseif($section==='licenses')<button wire:click="setDeviceLimit({{ $row->id }})">Set limit</button> <button class="text-rose-200" wire:confirm="Revoke this license?" wire:click="revoke({{ $row->id }})">Revoke</button>@elseif($section==='privacy_requests' && $row->status==='pending')<button wire:confirm="Erase customer profile and support data, revoke licenses, and retain billing records?" wire:click="fulfillDeletion({{ $row->id }})">Fulfill deletion</button>@endif</td></tr>@empty<tr><td class="p-5 muted">No records yet.</td></tr>@endforelse</tbody></table></div></div> |