feat: request quotes

This commit is contained in:
llama committed 2023-10-07 21:57:31 +11:00
1 parent 1833146158
commit fb679c3042
3 files changed
+42 -2

No files matched your search

@@ -15,11 +15,18 @@ new #[Layout('layouts.guest')] class extends Component
$this->getQuotes();
}
public function request(Quote $quote): void
{
$this->authorize('request', $quote);
$quote->request();
// TODO: add code to send a notification
}
#[On('quote-approved')]
public function getQuotes(): void
{
$this->quotes = Quote::all()->whereNull('deleted_at')->sortDesc();
}
}; ?>
@@ -32,7 +39,9 @@ new #[Layout('layouts.guest')] class extends Component
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-nexi-black dark:text-gray-200 sm:pl-6">
Quotes
</th>
{{-- TODO: add logged in user stuff --}}
@if(auth()->user())
<th scope="col"></th>
@endif
</tr>
</thead>
<tbody>
@@ -41,6 +50,15 @@ new #[Layout('layouts.guest')] class extends Component
<td class="relative py-4 pl-4 pr-3 text-sm sm:pl-6 border-t text-nexi-black dark:text-gray-200">
{{ $quote->quote }}
</td>
@if(auth()->user())
<td class="relative w-8 pl-4 pr-3 text-sm sm:pl-6 border-t">
<div class="flex flex-row space-x-2">
<form wire:submit="request({{ $quote }})">
<x-primary-button class="bg-nexi-purple w-24">{{ __('Request') }}</x-primary-button>
</form>
</div>
</td>
@endif
</tr>
@endforeach
</tbody>