diff options
Diffstat (limited to 'resources/views/do.blade.php')
| -rwxr-xr-x | resources/views/do.blade.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/resources/views/do.blade.php b/resources/views/do.blade.php new file mode 100755 index 0000000..246c522 --- /dev/null +++ b/resources/views/do.blade.php @@ -0,0 +1,48 @@ +@extends('template') +@section('content') +<main> + <section style="background-color: hsl(0, 0%, 72%); padding: 1rem;"> + <center> + <h2>To Do</h2> + </center> + </section> + + <section> + @if(Auth::check() && Auth::user()->isAdmin()) + <form method="POST" action="/do" style="margin-bottom: 1rem;"> + @csrf + <textarea name="content" rows="3" placeholder="Add a todo item…" style="width: 100%; font-family: monospace; padding: 0.5rem;">{{ old('content') }}</textarea> + <div style="margin-top: 0.5rem; display: flex; gap: 0.5rem;"> + <button type="submit" name="op" value="append">+ Append</button> + <button type="submit" name="op" value="overwrite" onclick="return confirm('This will replace the entire list. Continue?')">⤬ Overwrite</button> + </div> + </form> + @endif + + @if(session('status')) + <p style="color: green;">{{ session('status') }}</p> + @endif + </section> + + <section> + <h3>Current List</h3> + @if(count($items ?? []) === 0) + <p style="color: #888;"><em>Nothing here yet.</em></p> + @else + <ul style="font-family: monospace; line-height: 1.8;"> + @foreach($items as $i => $item) + <li> + <form method="POST" action="/do" style="display: inline;"> + @csrf + <input type="hidden" name="op" value="delete"> + <input type="hidden" name="index" value="{{ $i }}"> + <button type="submit" style="cursor:pointer; background:none; border:none; color:red;" title="Delete">✕</button> + </form> + {{ $item }} + </li> + @endforeach + </ul> + @endif + </section> +</main> +@endsection
\ No newline at end of file |
