Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace form components #913

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a10cdad
fix: change logout to a post route
daveroverts Oct 22, 2024
2305972
style: format all blade files
daveroverts Oct 23, 2024
bc622c8
chore: add input + label + button components
daveroverts Oct 26, 2024
7d46847
chore: add select and form-group
daveroverts Oct 27, 2024
c29472f
chore: convert airport admin form
daveroverts Oct 27, 2024
64a1d36
chore: convert airport + event link forms
daveroverts Oct 27, 2024
23f4b9c
fix: add help text to airport/event link that name is optional
daveroverts Oct 27, 2024
66139d3
chore: add help text and inline support for form-group
daveroverts Oct 28, 2024
a8da665
chore: add radio
daveroverts Oct 28, 2024
786d09d
chore: override input to better support radio's
daveroverts Nov 2, 2024
b1dcd08
chore: add placeholder to select
daveroverts Nov 2, 2024
f63ee41
chore: add textarea
daveroverts Nov 2, 2024
80b8f7c
chore: convert event admin form
daveroverts Nov 2, 2024
26da2a7
chore: make name optional for from-group
daveroverts Nov 2, 2024
006a6da
chore: add ability to add classes in input group
daveroverts Nov 2, 2024
bbf0224
chore: don't use tinymce by default on textarea
daveroverts Nov 2, 2024
cb2169d
chore: add checkbox component
daveroverts Nov 2, 2024
3e0c5a0
chore: convert create and edit booking admin views
daveroverts Nov 2, 2024
9bb6f82
chore: ensure link forms use old value when needed
daveroverts Feb 9, 2025
7debaea
chore: remove old package already
daveroverts Feb 9, 2025
c18d28e
chore: fix radio on faq form
daveroverts Feb 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions app/View/Components/Forms/Inputs/Input.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace App\View\Components\Forms\Inputs;

use BladeUIKit\Components\Forms\Inputs\Input as OriginalInput;

class Input extends OriginalInput
{
public function __construct(string $name, string $id = null, string $type = 'text', ?string $value = '')
{
$this->name = $name;
$this->id = $id ?? $name;
$this->type = $type;

$this->value = old($name, $value ?? '');
}
}
32 changes: 32 additions & 0 deletions app/View/Components/Forms/Label.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace App\View\Components\Forms;

use Closure;
use Illuminate\Support\Str;
use Illuminate\View\Component;
use Illuminate\Contracts\View\View;

class Label extends Component
{
public function __construct(public string $for, public ?string $label = null)
{
//
}

/**
* Get the view / contents that represent the component.
*/
public function render(): View
{
return view('components.forms.label', [
'for' => $this->for,
'fallback' => $this->fallback(),
]);
}

public function fallback(): string
{
return Str::ucfirst(str_replace('_', ' ', $this->for));
}
}
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"livewire/livewire": "^2.12.8",
"maatwebsite/excel": "^3.1",
"predis/predis": "^2.0",
"protonemedia/laravel-form-components": "^3.8",
"sentry/sentry-laravel": "^3.2",
"spatie/laravel-activitylog": "^4.7",
"spatie/laravel-ignition": "^2.0",
Expand Down Expand Up @@ -97,4 +96,4 @@
},
"minimum-stability": "stable",
"prefer-stable": true
}
}
86 changes: 1 addition & 85 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions config/blade-ui-kit.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use App\View\Components\FlatPickr;
use BladeUIKit\Components;

return [
Expand All @@ -17,30 +16,30 @@
*/

'components' => [
// 'alert' => Components\Alerts\Alert::class,
'alert' => Components\Alerts\Alert::class,
// 'avatar' => Components\Support\Avatar::class,
// 'carbon' => Components\DateTime\Carbon::class,
// 'checkbox' => Components\Forms\Inputs\Checkbox::class,
'checkbox' => Components\Forms\Inputs\Checkbox::class,
// 'color-picker' => Components\Forms\Inputs\ColorPicker::class,
// 'countdown' => Components\DateTime\Countdown::class,
// 'cron' => Components\Support\Cron::class,
// 'dropdown' => Components\Navigation\Dropdown::class,
// 'easy-mde' => Components\Editors\EasyMDE::class,
// 'email' => Components\Forms\Inputs\Email::class,
// 'error' => Components\Forms\Error::class,
'flat-pickr' => FlatPickr::class,
// 'form' => Components\Forms\Form::class,
// 'form-button' => Components\Buttons\FormButton::class,
// 'html' => Components\Layouts\Html::class,
// 'input' => Components\Forms\Inputs\Input::class,
// 'label' => Components\Forms\Label::class,
// 'logout' => Components\Buttons\Logout::class,
'error' => Components\Forms\Error::class,
'flat-pickr' => App\View\Components\FlatPickr::class,
'form' => Components\Forms\Form::class,
'form-button' => Components\Buttons\FormButton::class,
'html' => Components\Layouts\Html::class,
'input' => App\View\Components\Forms\Inputs\Input::class,
'label' => Components\Forms\Label::class,
'logout' => Components\Buttons\Logout::class,
// 'mapbox' => Components\Maps\Mapbox::class,
// 'markdown' => Components\Markdown\Markdown::class,
// 'password' => Components\Forms\Inputs\Password::class,
// 'pikaday' => Components\Forms\Inputs\Pikaday::class,
// 'social-meta' => Components\Layouts\SocialMeta::class,
// 'textarea' => Components\Forms\Inputs\Textarea::class,
'textarea' => Components\Forms\Inputs\Textarea::class,
// 'toc' => Components\Markdown\ToC::class,
// 'trix' => Components\Editors\Trix::class,
// 'unsplash' => Components\Support\Unsplash::class,
Expand Down
79 changes: 0 additions & 79 deletions config/form-components.php

This file was deleted.

20 changes: 8 additions & 12 deletions resources/views/airport/admin/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,21 @@
<div class="card-header">{{ $airport->id ? __('Edit') : __('Add new') }} {{ __('Airport') }}</div>

<div class="card-body">
<x-form
:action="$airport->id ? route('admin.airports.update', $airport) : route('admin.airports.store')"
:method="$airport->id ? 'PATCH' : 'POST'">
<x-form :action="$airport->id ? route('admin.airports.update', $airport) : route('admin.airports.store')" :method="$airport->id ? 'PATCH' : 'POST'">

@bind($airport)
<x-form-input name="icao" :label="__('ICAO')" required maxlength="4" />
<x-form-input name="iata" :label="__('IATA')" required maxlength="3" />
<x-form-input name="name" :label="__('Name')" required />
<x-form-input name="latitude" :label="__('Latitude')" />
<x-form-input name="longitude" :label="__('Longitude')" />
<x-forms.input name="icao" :label="__('ICAO')" :value="$airport->icao" required maxlength="4" />
<x-forms.input name="iata" :label="__('IATA')" :value="$airport->iata" required maxlength="3" />
<x-forms.input name="name" :label="__('Name')" :value="$airport->name" required />
<x-forms.input name="latitude" :value="$airport->latitude" />
<x-forms.input name="longitude" :label="__('Longitude')" :value="$airport->longitude" />

<x-form-submit>
<x-forms.button type="submit">
@if ($airport->id)
<i class="fa fa-check"></i> {{ __('Edit') }}
@else
<i class="fa fa-plus"></i> {{ __('Add') }}
@endif
</x-form-submit>
@endbind
</x-forms.button>
</x-form>
</div>
</div>
Expand Down
9 changes: 6 additions & 3 deletions resources/views/airport/admin/overview.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@
</a>
</td>
<td>
@if ($airport->flightsDep->isEmpty() && $airport->flightsArr->isEmpty() && $airport->eventDep->isEmpty() && $airport->eventArr->isEmpty())
@if (
$airport->flightsDep->isEmpty() &&
$airport->flightsArr->isEmpty() &&
$airport->eventDep->isEmpty() &&
$airport->eventArr->isEmpty())
<form action="{{ route('admin.airports.destroy', $airport) }}" method="post">
@method('DELETE')
<button class="btn btn-danger delete-airport"><i class="fa fa-trash"></i> Remove Airport
Expand All @@ -87,6 +91,5 @@
{{ $airports->links() }}
</table>
{{ $airports->links() }}
<x-form :action="route('admin.airports.destroyUnused')" id="delete-unused-airports" method="POST"
style="display: none;"></x-form>
<x-form :action="route('admin.airports.destroyUnused')" id="delete-unused-airports" method="POST" style="display: none;"></x-form>
@endsection
9 changes: 4 additions & 5 deletions resources/views/airport/admin/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
<div class="card-header">{{ $airport->name }} [{{ $airport->icao }} | {{ $airport->iata }}]</div>

<div class="card-body">
@foreach($airport->links as $link)
@foreach ($airport->links as $link)
<div class="form-group row">
<label for="{{ $link->type->name . '-' . $loop->index }}"
class="col-md-4 col-form-label text-md-right">{{ $link->name ?? $link->type->name }}</label>
class="col-md-4 col-form-label text-md-right">{{ $link->name ?? $link->type->name }}</label>

<div class="col-md-6">
<div class="form-control-plaintext"><a
href="{{ $link->url }}"
target="_blank">Link</a></div>
<div class="form-control-plaintext"><a href="{{ $link->url }}" target="_blank">Link</a>
</div>
</div>
</div>
@endforeach
Expand Down
Loading
Loading