generated from rawilk/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
10 changed files
with
1,778 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
resources/views/components/inputs/timezone-select.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<div class="form-text-container {{ $maxWidth }}"> | ||
@include('form-components::partials.leading-addons') | ||
|
||
<select name="{{ $name }}" | ||
id="{{ $id }}" | ||
@if ($multiple) multiple @endif | ||
|
||
@if ($hasErrorsAndShow($name)) | ||
aria-invalid="true" | ||
|
||
@if (! $attributes->offsetExists('aria-describedby')) | ||
aria-describedby="{{ $id }}-error" | ||
@endif | ||
@endif | ||
|
||
{{ $attributes->merge(['class' => $inputClass()]) }} | ||
> | ||
{{ $slot }} | ||
|
||
@foreach (app('fc-timezone')->only($only)->all() as $region => $regionTimezones) | ||
<optgroup label="{{ $region }}"> | ||
@foreach ($regionTimezones as $key => $display) | ||
<option value="{{ $key }}"@if ($isSelected($key)) selected @endif>{{ $display }}</option> | ||
@endforeach | ||
</optgroup> | ||
@endforeach | ||
</select> | ||
|
||
@include('form-components::partials.trailing-addons') | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rawilk\FormComponents\Components\Inputs; | ||
|
||
class TimezoneSelect extends Select | ||
{ | ||
/** @var string */ | ||
public $selectedKey; | ||
|
||
public bool $multiple; | ||
|
||
/** @var string */ | ||
public $maxWidth; | ||
|
||
public $only; | ||
|
||
public function __construct( | ||
string $name = '', | ||
string $id = null, | ||
$value = null, | ||
bool $multiple = false, | ||
string $maxWidth = null, | ||
bool $showErrors = true, | ||
$leadingAddon = false, | ||
$inlineAddon = false, | ||
$inlineAddonPadding = self::DEFAULT_INLINE_ADDON_PADDING, | ||
$leadingIcon = false, | ||
$trailingAddon = false, | ||
$trailingAddonPadding = self::DEFAULT_TRAILING_ADDON_PADDING, | ||
$trailingIcon = false, | ||
$only = null | ||
) { | ||
parent::__construct( | ||
$name, | ||
$id, | ||
[], | ||
$value, | ||
$multiple, | ||
$maxWidth, | ||
$showErrors, | ||
$leadingAddon, | ||
$inlineAddon, | ||
$inlineAddonPadding, | ||
$leadingIcon, | ||
$trailingAddon, | ||
$trailingAddonPadding, | ||
$trailingIcon | ||
); | ||
|
||
$this->only = is_null($only) ? config('form-components.timezone_subset', false) : $only; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rawilk\FormComponents\Support; | ||
|
||
final class TimeZoneRegion | ||
{ | ||
/** | ||
* A "general" timezone region. | ||
* | ||
* @var string | ||
*/ | ||
public const GENERAL = 'General'; | ||
|
||
/** @var string */ | ||
public const AFRICA = 'Africa'; | ||
|
||
/** @var string */ | ||
public const AMERICA = 'America'; | ||
|
||
/** @var string */ | ||
public const ANTARCTICA = 'Antarctica'; | ||
|
||
/** @var string */ | ||
public const ARCTIC = 'Arctic'; | ||
|
||
/** @var string */ | ||
public const ASIA = 'Asia'; | ||
|
||
/** @var string */ | ||
public const ATLANTIC = 'Atlantic'; | ||
|
||
/** @var string */ | ||
public const AUSTRALIA = 'Australia'; | ||
|
||
/** @var string */ | ||
public const EUROPE = 'Europe'; | ||
|
||
/** @var string */ | ||
public const INDIAN = 'Indian'; | ||
|
||
/** @var string */ | ||
public const PACIFIC = 'Pacific'; | ||
} |
Oops, something went wrong.