Skip to content

Commit

Permalink
Refactor task button component and task view
Browse files Browse the repository at this point in the history
  • Loading branch information
Ortiix85 committed Jan 20, 2024
1 parent 6535a75 commit d330d32
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
8 changes: 4 additions & 4 deletions resources/views/app/task.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
</div>

<div class="flex justify-start items-center gap-2">
<x-task.button :task="$task" selected="{{$task->status == 0 ? true : false}}" color="cyan-600" status=0>To Do</x-task.button>
<x-task.button :task="$task" selected="{{$task->status == 1 ? true : false}}" color="orange-600" status=1>In progress</x-task.button>
<x-task.button :task="$task" selected="{{$task->status == 2 ? true : false}}" color="purple-600" status=2>In revision</x-task.button>
<x-task.button :task="$task" selected="{{$task->status == 3 ? true : false}}" color="green-600" status=3 stylecss="cursor-not-allowed pointer-events-none">
<x-task.button :task="$task" color="cyan-600" status=0>To Do</x-task.button>
<x-task.button :task="$task" color="orange-600" status=1>In progress</x-task.button>
<x-task.button :task="$task" color="purple-600" status=2>In revision</x-task.button>
<x-task.button :task="$task" color="green-600" status=3 stylecss="pointer-events-none">
<div class="flex justify-center items-center gap-2">
<x-icons.lock size=16/>
<p>Completed</p>
Expand Down
18 changes: 11 additions & 7 deletions resources/views/components/task/button.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,26 @@
'status' => -1,
'task' => null])

@php
//Verifier si le statut est le même
$selected = $task ? ($task->status == $status) : false;
$clickable = $task ? ($task->status == 3) : false;
@endphp


@if($task)
@if($selected)
<button class="border-2 border-{{$color}} bg-{{$color}} {{$stylecss}} cursor-default text-white h-8 rounded-lg px-2">
<button class="border-2 border-{{$color}} bg-{{$color}} {{$stylecss}} cursor-default text-white h-8 rounded-lg px-2">
{{$slot}}
</button>
@elseif($task->status != 3)
@else
<form action="{{ route('update.status', ['id' => $task->id, 'status' => $status]) }}" method="post">
@csrf
<button class="border-2 border-{{$color}} {{$stylecss}} text-dark-gray h-8 rounded-lg px-2" type="submit">
<button class="border-2 border-{{$color}} {{$stylecss}} text-{{$color}} {{$clickable ? 'pointer-events-none' : ''}} h-8 rounded-lg px-2" type="submit">
{{$slot}}
</button>
</form>
@else
<button class="border-2 border-{{$color}} {{$stylecss}} text-dark-gray h-8 rounded-lg px-2" type="submit">
{{$slot}}
</button>
@endif
@endif

0 comments on commit d330d32

Please sign in to comment.