Simplify Form logic
This commit is contained in:
parent
8a2cb7fb1f
commit
b330c431ab
@ -21,8 +21,6 @@ class ApplicationForm extends Component
|
|||||||
|
|
||||||
public $message = '';
|
public $message = '';
|
||||||
|
|
||||||
public $applicationId;
|
|
||||||
|
|
||||||
public $applicationUuid;
|
public $applicationUuid;
|
||||||
|
|
||||||
public $captcha;
|
public $captcha;
|
||||||
@ -73,10 +71,8 @@ class ApplicationForm extends Component
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->applicationId = $application->id;
|
|
||||||
$this->applicationUuid = (string) $application->uuid;
|
$this->applicationUuid = (string) $application->uuid;
|
||||||
|
|
||||||
session()->flash('message', 'Application submitted successfully!');
|
|
||||||
$this->reset(['photos', 'message', 'captchaInput']);
|
$this->reset(['photos', 'message', 'captchaInput']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<div class="max-w-2xl w-full md:w-xl mx-auto mt-10 flex flex-col gap-6">
|
<div class="max-w-2xl w-full md:w-xl mx-auto mt-10 flex flex-col gap-6">
|
||||||
@if (session()->has('message'))
|
|
||||||
@if ($applicationUuid)
|
@if ($applicationUuid)
|
||||||
<flux:callout variant="success" icon="check-circle">
|
<flux:callout variant="success" icon="check-circle">
|
||||||
<flux:callout.heading>Your application has been submitted.</flux:callout.heading>
|
<flux:callout.heading>Your application has been submitted.</flux:callout.heading>
|
||||||
@ -10,10 +9,7 @@
|
|||||||
<br>Please save or bookmark that link, as the approval process can take 24-48 hours.
|
<br>Please save or bookmark that link, as the approval process can take 24-48 hours.
|
||||||
</flux:callout.text>
|
</flux:callout.text>
|
||||||
</flux:callout>
|
</flux:callout>
|
||||||
@endif
|
@else
|
||||||
@endif
|
|
||||||
|
|
||||||
@if (!$applicationUuid)
|
|
||||||
<form wire:submit.prevent="submit" enctype="multipart/form-data">
|
<form wire:submit.prevent="submit" enctype="multipart/form-data">
|
||||||
<div class="flex flex-col gap-4 mb-6">
|
<div class="flex flex-col gap-4 mb-6">
|
||||||
<flux:callout variant="secondary" icon="information-circle" heading="Here you can submit your application."
|
<flux:callout variant="secondary" icon="information-circle" heading="Here you can submit your application."
|
||||||
@ -28,6 +24,17 @@
|
|||||||
<flux:input type="file" wire:model="photos" label="Loli Photos (max. 6 files, max. 8MB per file)"
|
<flux:input type="file" wire:model="photos" label="Loli Photos (max. 6 files, max. 8MB per file)"
|
||||||
multiple />
|
multiple />
|
||||||
|
|
||||||
|
@if ($photos)
|
||||||
|
<div class="mt-4">
|
||||||
|
<flux:heading>Photo Preview</flux:heading>
|
||||||
|
<div class="flex gap-4 mt-2">
|
||||||
|
@foreach ($photos as $photo)
|
||||||
|
<img src="{{ $photo->temporaryUrl() }}" class="w-24 h-24 object-cover rounded">
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<flux:input label="Captcha" wire:model.defer="captchaInput" />
|
<flux:input label="Captcha" wire:model.defer="captchaInput" />
|
||||||
@ -39,15 +46,4 @@
|
|||||||
<flux:button class="w-full" variant="primary" wire:click="submit">Submit Application</flux:button>
|
<flux:button class="w-full" variant="primary" wire:click="submit">Submit Application</flux:button>
|
||||||
</form>
|
</form>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($photos)
|
|
||||||
<div class="mt-4">
|
|
||||||
<h3 class="font-bold">Photo Preview:</h3>
|
|
||||||
<div class="flex gap-4 mt-2">
|
|
||||||
@foreach ($photos as $photo)
|
|
||||||
<img src="{{ $photo->temporaryUrl() }}" class="w-24 h-24 object-cover rounded">
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user