@extends('layouts.app')
@section('content')
<main class="nxl-container"><div class="nxl-content"><div class="page-header"><h5>Notification Preferences</h5></div>
<div class="main-content"><div class="card"><div class="card-body">
@if(session('success'))<div class="alert alert-success">{{ session('success') }}</div>@endif
<form method="POST" action="{{ route('notification-preferences.update') }}">@csrf @method('PUT')
<table class="table"><thead><tr><th>Event</th><th>In App</th><th>Email</th></tr></thead><tbody>
@foreach($events as $event) @php($item=$preferences->get($event))
<tr><td>{{ ucwords(str_replace('_',' ',$event)) }}</td>
<td><input type="checkbox" name="preferences[{{ $event }}][in_app]" value="1" @checked($item?->in_app ?? true)></td>
<td><input type="checkbox" name="preferences[{{ $event }}][email]" value="1" @checked($item?->email ?? true)></td></tr>
@endforeach
</tbody></table><button class="btn btn-primary">Save Preferences</button></form>
</div></div></div></div></main>
@endsection
