|
2 | 2 |
|
3 | 3 | @section('title', isset($task) ? 'Edit Task' : 'Add Task')
|
4 | 4 |
|
5 |
| -@section('styles') |
6 |
| -<style> |
7 |
| - .error-message { |
8 |
| - color:red; |
9 |
| - font-size: 0.8rem; |
10 |
| - } |
11 |
| -</style> |
12 |
| -@endsection |
13 |
| - |
14 | 5 | @section('content')
|
15 | 6 | <form action="{{ isset($task) ? route('tasks.update', ['task' => $task->id]) : route('tasks.store') }}" method="POST">
|
16 | 7 | @csrf
|
17 | 8 | @isset($task)
|
18 | 9 | @method('PUT')
|
19 | 10 | @endisset
|
20 |
| - <div> |
| 11 | + <div class="mb-4"> |
21 | 12 | <label for="title">
|
22 | 13 | Title
|
23 | 14 | </label>
|
24 |
| - <input type="text" name="title" id="title" value="{{ $task->title ?? old('title')}}"> |
| 15 | + <input type="text" name="title" id="title" @class(['border-red-500' => $errors->has('title')]) {{-- class="border @error('title') border-red-500 @enderror" --}} |
| 16 | + value="{{ $task->title ?? old('title') }}"> |
25 | 17 | @error('title')
|
26 |
| - <p class="error-message">{{ $message }}</p> |
| 18 | + <p class="error">{{ $message }}</p> |
27 | 19 | @enderror
|
28 | 20 | </div>
|
29 |
| - <div> |
| 21 | + <div class="mb-4"> |
30 | 22 | <label for="description">Description</label>
|
31 |
| - <textarea name="description" id="description" rows="5"> |
32 |
| - {{ $task->description ?? old('description')}} |
| 23 | + <textarea name="description" id="description" @class(['border-red-500' => $errors->has('description')]) rows="5"> |
| 24 | + {{ $task->description ?? old('description') }} |
33 | 25 | </textarea>
|
34 | 26 | @error('description')
|
35 |
| - <p class="error-message">{{ $message }}</p> |
| 27 | + <p class="error">{{ $message }}</p> |
36 | 28 | @enderror
|
37 | 29 | </div>
|
38 |
| - <div> |
| 30 | + <div class="mb-4"> |
39 | 31 | <label for="long_description">Long Description</label>
|
40 |
| - <textarea name="long_description" id="long_description" rows="10"> |
41 |
| - {{ $task->long_description ?? old('long_description')}} |
| 32 | + <textarea name="long_description" id="long_description" @class(['border-red-500' => $errors->has('long_description')]) rows="10"> |
| 33 | + {{ $task->long_description ?? old('long_description') }} |
42 | 34 | </textarea>
|
43 | 35 | @error('long_description')
|
44 |
| - <p class="error-message">{{ $message }}</p> |
| 36 | + <p class="error">{{ $message }}</p> |
45 | 37 | @enderror
|
46 | 38 | </div>
|
47 |
| - <div> |
48 |
| - <button type="submit"> |
| 39 | + <div class="flex gap-2 items-center"> |
| 40 | + <button type="submit" class="btn"> |
49 | 41 | @isset($task)
|
50 | 42 | Update Task
|
51 | 43 | @else
|
52 | 44 | Add Task
|
53 | 45 | @endisset
|
54 | 46 | </button>
|
55 |
| - |
| 47 | + <a href="{{ route('tasks.index') }}" class="link">Cancel</a> |
56 | 48 | </div>
|
57 | 49 | </form>
|
58 | 50 | @endsection
|
0 commit comments