Archived
feat: delete quotes/fix mobile view/models
This commit is contained in:
1 parent
94e719d5f3
commit
5d73183787
15 files changed
+226
-138
No files matched your search
@@ -0,0 +1,3 @@
|
||||
<button {{ $attributes->merge(['type' => 'submit', 'class' => 'inline-flex items-center justify-center px-4 py-2 border border-transparent rounded-md font-bold text-xs text-white tracking-widest focus:outline-none focus:ring-2 focus:ring-nexi-red focus:ring-offset-2 transition ease-in-out duration-150']) }}>
|
||||
{{ $slot }}
|
||||
</button>
|
||||
@@ -1,3 +1,3 @@
|
||||
<button {{ $attributes->merge(['type' => 'submit', 'class' => 'inline-flex items-center justify-center px-4 py-2 bg-nexi-red border border-transparent rounded-md font-bold text-xs text-white tracking-widest focus:outline-none focus:ring-2 focus:ring-nexi-red focus:ring-offset-2 transition ease-in-out duration-150']) }}>
|
||||
<button {{ $attributes->merge(['type' => 'submit', 'class' => 'inline-flex items-center justify-center px-4 py-2 border border-transparent rounded-md font-bold text-xs text-white tracking-widest focus:outline-none focus:ring-2 focus:ring-nexi-red focus:ring-offset-2 transition ease-in-out duration-150 bg-nexi-red']) }}>
|
||||
{{ $slot }}
|
||||
</button>
|
||||
@@ -1,3 +1,3 @@
|
||||
<button {{ $attributes->merge(['type' => 'button', 'class' => 'inline-flex items-center px-4 py-2 bg-white dark:bg-nexi-black border border-gray-300 dark:border-gray-500 rounded-md font-semibold text-xs text-gray-700 dark:text-gray-300 uppercase tracking-widest shadow-sm hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 dark:focus:ring-offset-nexi-black disabled:opacity-25 transition ease-in-out duration-150']) }}>
|
||||
<button {{ $attributes->merge(['type' => 'button', 'class' => 'inline-flex items-center justify-center px-4 py-2 bg-white dark:bg-nexi-black border border-nexi-red rounded-md font-semibold text-xs text-gray-700 dark:text-gray-300 uppercase tracking-widest shadow-sm hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-nexi-red focus:ring-offset-2 dark:focus:ring-offset-nexi-black disabled:opacity-25 transition ease-in-out duration-150']) }}>
|
||||
{{ $slot }}
|
||||
</button>
|
||||
@@ -29,23 +29,25 @@
|
||||
</ul>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<div class="text-xs font-semibold leading-6 text-gray-400">Admin Menu</div>
|
||||
<ul role="list" class="-mx-2 mt-2 space-y-1">
|
||||
<li>
|
||||
{{-- TODO: fill with SVG icons to make it pretty --}}
|
||||
{{-- <x-sidebar-nav :href="route('a-1')" route="a-1">First Page</x-sidebar-nav>--}}
|
||||
</li>
|
||||
<li>
|
||||
{{-- TODO: fill with SVG icons to make it pretty --}}
|
||||
{{-- <x-sidebar-nav :href="route('a-2')" route="a-2">Second Page</x-sidebar-nav>--}}
|
||||
</li>
|
||||
<li>
|
||||
{{-- TODO: fill with SVG icons to make it pretty --}}
|
||||
{{-- <x-sidebar-nav :href="route('a-3')" route="a-3">Third Page</x-sidebar-nav>--}}
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@if(auth()->user()->is_admin)
|
||||
<li>
|
||||
<div class="text-xs font-semibold leading-6 text-gray-400">Admin Menu</div>
|
||||
<ul role="list" class="-mx-2 mt-2 space-y-1">
|
||||
<li>
|
||||
{{-- TODO: fill with SVG icons to make it pretty --}}
|
||||
{{-- <x-sidebar-nav :href="route('a-1')" route="a-1">First Page</x-sidebar-nav>--}}
|
||||
</li>
|
||||
<li>
|
||||
{{-- TODO: fill with SVG icons to make it pretty --}}
|
||||
{{-- <x-sidebar-nav :href="route('a-2')" route="a-2">Second Page</x-sidebar-nav>--}}
|
||||
</li>
|
||||
<li>
|
||||
{{-- TODO: fill with SVG icons to make it pretty --}}
|
||||
{{-- <x-sidebar-nav :href="route('a-3')" route="a-3">Third Page</x-sidebar-nav>--}}
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@endif
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
@@ -6,6 +6,7 @@
|
||||
}"
|
||||
x-init="$watch('darkMode', val => localStorage.setItem('darkMode', val))"
|
||||
x-bind:class="{'dark': darkMode === 'dark' || (darkMode === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches)}"
|
||||
class="h-full"
|
||||
>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
@@ -21,7 +22,7 @@
|
||||
<!-- Scripts -->
|
||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||
</head>
|
||||
<body class="antialiased bg-nexi-primary dark:bg-nexi-primary-dark font-sans text-nexi-black transition-colors duration-300">
|
||||
<body class="antialiased bg-nexi-primary dark:bg-nexi-primary-dark font-sans text-nexi-black transition-colors duration-300 h-full">
|
||||
<div x-data="{ sidebarOpen: false }">
|
||||
<div class="relative z-50 lg:hidden" role="dialog" aria-modal="true">
|
||||
{{-- TODO: Look into why the fuck does this not work? mobile views seem to not work with livewire clicks??? --}}
|
||||
@@ -32,35 +33,36 @@
|
||||
x-transition:leave="transition-opacity ease-linear duration-300"
|
||||
x-transition:leave-start="opacity-100"
|
||||
x-transition:leave-end="opacity-0"
|
||||
class="fixed inset-0 bg-nexi-black/80"></div>
|
||||
|
||||
<div class="fixed inset-0 flex">
|
||||
<div x-show="sidebarOpen"
|
||||
x-transition:enter="transition ease-in-out duration-300 transform"
|
||||
x-transition:enter-start="-translate-x-full"
|
||||
x-transition:enter-end="translate-x-0"
|
||||
x-transition:leave="transition ease-in-out duration-300 transform"
|
||||
x-transition:leave-start="translate-x-0"
|
||||
x-transition:leave-end="-translate-x-full"
|
||||
class="relative mr-16 flex w-full max-w-xs flex-1">
|
||||
class="fixed inset-0 bg-nexi-black/80">
|
||||
|
||||
<div class="fixed inset-0 flex">
|
||||
<div x-show="sidebarOpen"
|
||||
x-transition:enter="ease-in-out duration-300"
|
||||
x-transition:enter-start="opacity-0"
|
||||
x-transition:enter-end="opacity-100"
|
||||
x-transition:leave="ease-in-out duration-300"
|
||||
x-transition:leave-start="opacity-100"
|
||||
x-transition:leave-end="opacity-0"
|
||||
class="absolute left-full top-0 flex w-16 justify-center pt-5">
|
||||
<button type="button" class="-m-2.5 p-2.5" @click="sidebarOpen = false">
|
||||
<svg class="h-6 w-6 text-white" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
x-transition:enter="transition ease-in-out duration-300 transform"
|
||||
x-transition:enter-start="-translate-x-full"
|
||||
x-transition:enter-end="translate-x-0"
|
||||
x-transition:leave="transition ease-in-out duration-300 transform"
|
||||
x-transition:leave-start="translate-x-0"
|
||||
x-transition:leave-end="-translate-x-full"
|
||||
class="relative mr-16 flex w-full max-w-xs flex-1">
|
||||
|
||||
<div class="flex grow flex-col gap-y-5 overflow-y-auto px-6 pb-4">
|
||||
<x-sidebar/>
|
||||
<div x-show="sidebarOpen"
|
||||
x-transition:enter="ease-in-out duration-300"
|
||||
x-transition:enter-start="opacity-0"
|
||||
x-transition:enter-end="opacity-100"
|
||||
x-transition:leave="ease-in-out duration-300"
|
||||
x-transition:leave-start="opacity-100"
|
||||
x-transition:leave-end="opacity-0"
|
||||
class="absolute left-full top-0 flex w-16 justify-center pt-5">
|
||||
<button type="button" class="-m-2.5 p-2.5" @click="sidebarOpen = false">
|
||||
<svg class="h-6 w-6 text-white" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex grow flex-col gap-y-5 overflow-y-auto px-6 pb-4 bg-nexi-primary dark:bg-nexi-primary-dark">
|
||||
<x-sidebar/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,18 @@ new #[Layout('layouts.guest')] class extends Component
|
||||
// TODO: add code to send a notification
|
||||
}
|
||||
|
||||
public function delete(Quote $quote): void
|
||||
{
|
||||
$this->authorize('request', $quote);
|
||||
|
||||
$quote->delete();
|
||||
|
||||
$this->dispatch('quote-deleted');
|
||||
|
||||
}
|
||||
|
||||
#[On('quote-approved')]
|
||||
#[On('quote-deleted')]
|
||||
public function getQuotes(): void
|
||||
{
|
||||
$this->quotes = Quote::all()->whereNull('deleted_at')->sortDesc();
|
||||
@@ -54,8 +65,40 @@ new #[Layout('layouts.guest')] class extends Component
|
||||
<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 wire:loading.attr="disabled" wire:loading.class="opacity-50" class="bg-nexi-purple w-24">{{ __('Request') }}</x-primary-button>
|
||||
<x-button wire:loading.attr="disabled" wire:loading.class="opacity-50" class="bg-nexi-purple w-24">{{ __('Request') }}</x-button>
|
||||
</form>
|
||||
@if(auth()->user()->is_admin)
|
||||
<x-button
|
||||
x-data=""
|
||||
x-on:click.prevent="$dispatch('open-modal', 'confirm-quote-deletion-{{ $quote->id }}')"
|
||||
wire:loading.attr="disabled"
|
||||
wire:loading.class="opacity-50"
|
||||
class="bg-nexi-red w-24"
|
||||
>{{ __('Delete') }}</x-button>
|
||||
|
||||
<x-modal name="confirm-quote-deletion-{{ $quote->id }}" :show="$errors->isNotEmpty()" focusable>
|
||||
<form wire:submit="delete({{ $quote }})" class="p-6">
|
||||
<h2 class="text-lg font-medium text-nexi-black dark:text-gray-100">
|
||||
{{ __('Are you sure you want to delete the quote?') }}
|
||||
</h2>
|
||||
|
||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
||||
"{{ $quote->quote }}"
|
||||
</p>
|
||||
|
||||
<div class="mt-6 flex justify-end">
|
||||
<x-secondary-button x-on:click="$dispatch('close')">
|
||||
{{ __('Cancel') }}
|
||||
</x-secondary-button>
|
||||
<x-primary-button
|
||||
wire:loading.attr="disabled"
|
||||
wire:loading.class="opacity-50"
|
||||
class="w-24 ml-3"
|
||||
>{{ __('Delete') }}</x-primary-button>
|
||||
</div>
|
||||
</form>
|
||||
</x-modal>
|
||||
@endif
|
||||
</div>
|
||||
</td>
|
||||
@endif
|
||||
|
||||
@@ -35,6 +35,6 @@ new #[Layout('layouts.guest')] class extends Component
|
||||
></x-text-input>
|
||||
|
||||
<x-input-error :messages="$errors->get('quote')" class="mt-2"/>
|
||||
<x-primary-button wire:loading.attr="disabled" wire:loading.class="opacity-50" class="mt-4">{{ __('Request') }}</x-primary-button>
|
||||
<x-button wire:loading.attr="disabled" wire:loading.class="opacity-50" class="bg-nexi-red mt-4">{{ __('Request') }}</x-button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -69,12 +69,67 @@ new #[Layout('layouts.guest')] class extends Component
|
||||
@if(!empty(auth()->user()) && auth()->user()->is_admin)
|
||||
<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="approve({{ $quote }})">
|
||||
<x-primary-button wire:loading.attr="disabled" wire:loading.class="opacity-50" class="bg-nexi-green w-24">{{ __('Approve') }}</x-primary-button>
|
||||
</form>
|
||||
<form wire:submit="reject({{ $quote }})">
|
||||
<x-primary-button wire:loading.attr="disabled" wire:loading.class="opacity-50" class="bg-nexi-red w-24">{{ __('Reject') }}</x-primary-button>
|
||||
</form>
|
||||
<x-button
|
||||
x-data=""
|
||||
x-on:click.prevent="$dispatch('open-modal', 'confirm-quote-approve-{{ $quote->id }}')"
|
||||
wire:loading.attr="disabled"
|
||||
wire:loading.class="opacity-50"
|
||||
class="bg-nexi-green w-24"
|
||||
>{{ __('Approve') }}</x-button>
|
||||
|
||||
<x-modal name="confirm-quote-approve-{{ $quote->id }}" :show="$errors->isNotEmpty()" focusable>
|
||||
<form wire:submit="approve({{ $quote }})" class="p-6">
|
||||
<h2 class="text-lg font-medium text-nexi-black dark:text-gray-100">
|
||||
{{ __('Are you sure you want to approve the quote?') }}
|
||||
</h2>
|
||||
|
||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
||||
"{{ $quote->quote }}"
|
||||
</p>
|
||||
|
||||
<div class="mt-6 flex justify-end">
|
||||
<x-secondary-button x-on:click="$dispatch('close')">
|
||||
{{ __('Cancel') }}
|
||||
</x-secondary-button>
|
||||
<x-button
|
||||
wire:loading.attr="disabled"
|
||||
wire:loading.class="opacity-50"
|
||||
class="bg-nexi-green w-24 ml-3"
|
||||
>{{ __('Approve') }}</x-button>
|
||||
</div>
|
||||
</form>
|
||||
</x-modal>
|
||||
|
||||
<x-button
|
||||
x-data=""
|
||||
x-on:click.prevent="$dispatch('open-modal', 'confirm-quote-reject-{{ $quote->id }}')"
|
||||
wire:loading.attr="disabled"
|
||||
wire:loading.class="opacity-50"
|
||||
class="bg-nexi-red w-24"
|
||||
>{{ __('Reject') }}</x-button>
|
||||
|
||||
<x-modal name="confirm-quote-reject-{{ $quote->id }}" :show="$errors->isNotEmpty()" focusable>
|
||||
<form wire:submit="reject({{ $quote }})" class="p-6">
|
||||
<h2 class="text-lg font-medium text-nexi-black dark:text-gray-100">
|
||||
{{ __('Are you sure you want to reject the quote?') }}
|
||||
</h2>
|
||||
|
||||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">
|
||||
"{{ $quote->quote }}"
|
||||
</p>
|
||||
|
||||
<div class="mt-6 flex justify-end">
|
||||
<x-secondary-button x-on:click="$dispatch('close')">
|
||||
{{ __('Cancel') }}
|
||||
</x-secondary-button>
|
||||
<x-button
|
||||
wire:loading.attr="disabled"
|
||||
wire:loading.class="opacity-50"
|
||||
class="bg-nexi-red w-24 ml-3"
|
||||
>{{ __('Reject') }}</x-button>
|
||||
</div>
|
||||
</form>
|
||||
</x-modal>
|
||||
</div>
|
||||
</td>
|
||||
@endif
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
|
||||
<div class="py-12">
|
||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
|
||||
<div class="p-4 sm:p-8 shadow sm:rounded-lg dark:shadow-zinc-600">
|
||||
<div class="max-w-xl">
|
||||
<livewire:profile.update-profile-information-form />
|
||||
</div>
|
||||
</div>
|
||||
{{-- <div class="p-4 sm:p-8 shadow sm:rounded-lg dark:shadow-zinc-600">--}}
|
||||
{{-- <div class="max-w-xl">--}}
|
||||
{{-- <livewire:profile.update-profile-information-form />--}}
|
||||
{{-- </div>--}}
|
||||
{{-- </div>--}}
|
||||
|
||||
<div class="p-4 sm:p-8 shadow sm:rounded-lg dark:shadow-zinc-600">
|
||||
<div class="max-w-xl">
|
||||
@@ -19,11 +19,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="p-4 sm:p-8 shadow sm:rounded-lg dark:shadow-zinc-600">
|
||||
<div class="max-w-xl">
|
||||
<livewire:profile.delete-user-form />
|
||||
</div>
|
||||
</div>
|
||||
{{-- <div class="p-4 sm:p-8 shadow sm:rounded-lg dark:shadow-zinc-600">--}}
|
||||
{{-- <div class="max-w-xl">--}}
|
||||
{{-- <livewire:profile.delete-user-form />--}}
|
||||
{{-- </div>--}}
|
||||
{{-- </div>--}}
|
||||
</div>
|
||||
</div>
|
||||
</x-app-layout>
|
||||
Reference in new issue
Block a user