mirror of
https://github.com/10h30/MoveMate.git
synced 2026-07-11 18:56:06 +09:00
Add manual authentication, create, read, update task
This commit is contained in:
@@ -1 +1,44 @@
|
||||
Hello
|
||||
<x-layout>
|
||||
<x-slot:heading>Create New Task</x-slot:heading>
|
||||
@if (session('success'))
|
||||
<div class="bg-green-500 text-white p-3 rounded mb-4">
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
<form action="/task/create" method="POST" class="space-y-4">
|
||||
@csrf
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-600">Task Name</label>
|
||||
<input type="text" name="name" class="w-full p-2 mt-1 border rounded-md focus:ring focus:ring-blue-300" required>
|
||||
<x-form-error name="name"></x-form-error>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-600">Description</label>
|
||||
<textarea name="description" class="w-full p-2 mt-1 border rounded-md focus:ring focus:ring-blue-300" rows="3" required></textarea>
|
||||
<x-form-error name="description"></x-form-error>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-600">Category</label>
|
||||
<select name="category_id" class="w-full p-2 mt-1 border rounded-md focus:ring focus:ring-blue-300" required>
|
||||
@foreach($categories as $category)
|
||||
<option value="{{ $category->id }}">{{ $category->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<x-form-error name="category_id"></x-form-error>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-600">Location</label>
|
||||
<input type="text" name="location" class="w-full p-2 mt-1 border rounded-md focus:ring focus:ring-blue-300">
|
||||
<x-form-error name="location"></x-form-error>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-600">Estimated Time (hours)</label>
|
||||
<input type="number" name="time_estimate" class="w-full p-2 mt-1 border rounded-md focus:ring focus:ring-blue-300" min="0" step="0.5" required>
|
||||
<x-form-error name="time_estimate"></x-form-error>
|
||||
</div>
|
||||
<div class="flex flex-col items-center gap-y-6">
|
||||
<button type="submit" class="w-full p-2 text-white bg-blue-500 rounded-md hover:bg-blue-600">Create Task</button>
|
||||
<a href="/task/" class="text-sm font-semibold text-gray-900">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</x-layout>
|
||||
@@ -0,0 +1,48 @@
|
||||
<x-layout>
|
||||
<x-slot:heading>Update Task</x-slot:heading>
|
||||
@if (session('success'))
|
||||
<div class="bg-green-500 text-white p-3 rounded mb-4">
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
<form action="/task/{{ $task->id }}" method="POST" class="space-y-4">
|
||||
@csrf
|
||||
@method('PATCH')
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-600">Task Name</label>
|
||||
<input value={{ $task->name }} type="text" name="name" class="w-full p-2 mt-1 border rounded-md focus:ring focus:ring-blue-300" required>
|
||||
<x-form-error name="name"></x-form-error>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-600">Description</label>
|
||||
<textarea name="description" class="w-full p-2 mt-1 border rounded-md focus:ring focus:ring-blue-300" rows="3" required>{{ $task->description }}</textarea>
|
||||
<x-form-error name="description"></x-form-error>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-600">Category</label>
|
||||
<select name="category_id" class="w-full p-2 mt-1 border rounded-md focus:ring focus:ring-blue-300" required>
|
||||
@foreach($categories as $category)
|
||||
<option value="{{ $category->id }}"
|
||||
{{ $category->id == $task->category_id ? 'selected' : '' }}>
|
||||
{{ $category->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<x-form-error name="category_id"></x-form-error>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-600">Location</label>
|
||||
<input type="text" value="{{ $task->location }}" name="location" class="w-full p-2 mt-1 border rounded-md focus:ring focus:ring-blue-300">
|
||||
<x-form-error name="location"></x-form-error>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-600">Estimated Time (hours)</label>
|
||||
<input type="number" value="{{ $task->time_estimate }}" name="time_estimate" class="w-full p-2 mt-1 border rounded-md focus:ring focus:ring-blue-300" min="0" step="0.5" required>
|
||||
<x-form-error name="time_estimate"></x-form-error>
|
||||
</div>
|
||||
<div class="flex flex-col items-center gap-y-6">
|
||||
<button type="submit" class="w-full p-2 text-white bg-blue-500 rounded-md hover:bg-blue-600">Update Task</button>
|
||||
<a href="/jobs/{{ $task->id }}" type="button" class="text-sm font-semibold text-gray-900">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</x-layout>
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
<x-layout>
|
||||
<x-slot:heading>{{ $task->name }}</x-slot:heading>
|
||||
|
||||
|
||||
<div>
|
||||
<div class="text-lg mb-4"> {{ $task->description }}</div>
|
||||
<div><strong>Where to go:</strong> {{ $task->location }}</div>
|
||||
<div><strong>Time Estimate:</strong> {{ $task->time_estimate }} hour</div>
|
||||
<div><strong>Category:</strong> {{ $task->category->name }}</div>
|
||||
<div><strong>Owner:</strong> {{ $task->user->name }}</div>
|
||||
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<a href="/task/{{ $task->id }}/edit" class="text-sm text-blue-600 dark:text-blue-500 hover:underline">Edit</a>
|
||||
</div>
|
||||
</x-layout>
|
||||
Reference in New Issue
Block a user