components input / InputLocale
This commit is contained in:
parent
3a456ceb58
commit
af6f079b43
|
|
@ -16,19 +16,22 @@ class Input extends Component
|
|||
|
||||
public string $width;
|
||||
|
||||
public string $placeholder;
|
||||
|
||||
public string $type;
|
||||
|
||||
public string $step;
|
||||
|
||||
public bool $required;
|
||||
|
||||
public function __construct(string $name, string $title, string $value, bool $required = false, string $error = '', string $width = '400', string $type = 'text', string $step = '')
|
||||
public function __construct(string $name, string $title, string $value, bool $required = false, string $error = '', string $width = '400', string $type = 'text', string $step = '', string $placeholder = '')
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->title = $title;
|
||||
$this->value = html_entity_decode($value, ENT_QUOTES);
|
||||
$this->error = $error;
|
||||
$this->width = $width;
|
||||
$this->placeholder = $placeholder;
|
||||
$this->type = $type;
|
||||
$this->step = $step;
|
||||
$this->required = $required;
|
||||
|
|
|
|||
|
|
@ -14,15 +14,18 @@ class InputLocale extends Component
|
|||
|
||||
public string $width;
|
||||
|
||||
public string $placeholder;
|
||||
|
||||
public $value;
|
||||
|
||||
public bool $required;
|
||||
|
||||
public function __construct(string $name, string $title, $value, string $width = '400', bool $required = false)
|
||||
public function __construct(string $name, string $title, $value, string $width = '400', bool $required = false, string $placeholder = '')
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->title = $title;
|
||||
$this->width = $width;
|
||||
$this->placeholder = $placeholder;
|
||||
$this->value = $value;
|
||||
$this->required = $required;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<div class="d-flex wp-{{ $width }}">
|
||||
<span class="input-group-text wp-100 px-1" id="basic-addon1">{{ $locale['name'] }}</span>
|
||||
<input type="text" name="{{ $formatName($locale['code']) }}" value="{{ $formatValue($locale['code']) }}"
|
||||
class="form-control short" placeholder="{{ $locale['name'] }}" @if ($required) required @endif>
|
||||
class="form-control short" placeholder="{{ $placeholder ?: $locale['name'] }}" @if ($required) required @endif>
|
||||
<span class="invalid-feedback w-auto"
|
||||
style="white-space:nowrap;">{{ __('common.error_required', ['name' => $title]) }}</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<x-admin::form.row :title="$title" :required="$required">
|
||||
<input type="{{ $type }}" name="{{ $name }}"
|
||||
class="form-control wp-{{ $width }} {{ $error ? 'is-invalid' : '' }}" value="{{ $value }}"
|
||||
placeholder="{{ $title }}" @if ($required) required @endif @if ($step) step="{{ $step }}" @endif>
|
||||
placeholder="{{ $placeholder ?: $title }}" @if ($required) required @endif @if ($step) step="{{ $step }}" @endif>
|
||||
<span class="invalid-feedback" role="alert">
|
||||
@if ($error)
|
||||
{{ $error }}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
<x-admin-form-input
|
||||
:name="$column['name']"
|
||||
:title="$column['label']"
|
||||
:placeholder="$column['placeholder'] ?? ''"
|
||||
:error="$errors->first($column['name'])"
|
||||
:required="$column['required'] ? true : false"
|
||||
:value="old($column['name'], $column['value'] ?? '')" />
|
||||
|
|
@ -30,6 +31,7 @@
|
|||
<x-admin-form-input-locale
|
||||
:name="$column['name'].'.*'"
|
||||
:title="$column['label']"
|
||||
:placeholder="$column['placeholder'] ?? ''"
|
||||
:error="$errors->first($column['name'])"
|
||||
:required="$column['required'] ? true : false"
|
||||
:value="old($column['name'], $column['value'] ?? '')" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue