Skip to content

Commit

Permalink
Merge pull request #10 from forest-lynx/view
Browse files Browse the repository at this point in the history
Изменено отображение поля, для корректного отображения.
  • Loading branch information
forest-lynx authored Aug 21, 2024
2 parents e71b8da + 2d30fed commit 1b7f4ae
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 32 deletions.
2 changes: 1 addition & 1 deletion public/css/decimal-field.css

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

73 changes: 42 additions & 31 deletions resources/views/fields/decimal.blade.php
Original file line number Diff line number Diff line change
@@ -1,33 +1,44 @@
<x-moonshine::grid class="decimal-field">
<x-moonshine::column adaptiveColSpan="6" colSpan="{{ $element->isGroup() ? '8' : '12' }}">
<x-moonshine::form.input-extensions
:extensions="$element->getExtensions()"
>
<x-moonshine::form.input
:attributes="$element->attributes()->merge([
'id' => $element->id(),
'name' => $element->name($element->column()),
'value' => (string) $value
])"
@class(['form-invalid' => formErrors($errors, $element->getFormName())->has($element->name($element->column()))])
/>
</x-moonshine::form.input-extensions>
</x-moonshine::column>
<div class="decimal-field {{$element->isGroup() ? 'decimal-field-group': ''}}">

<x-moonshine::form.input-extensions
:extensions="$element->getExtensions()"
>
<x-moonshine::form.input
:attributes="$element->attributes()->merge([
'id' => $element->id(),
'name' => $element->name($element->column()),
'value' => (string) (is_array($value) ? $value[$element->column()] : $value)
])"
@class(['form-invalid' => formErrors($errors, $element->getFormName())->has($element->column())])
/>
</x-moonshine::form.input-extensions>
@if($element->isGroup())
<x-moonshine::column adaptiveColSpan="6" colSpan="4">
<x-moonshine::form.select
:id="$element->getUnitColumn()"
:name="$element->name($element->getUnitColumn())"
data-item-select-text=""
>
<x-slot:options>
@foreach($element->values() as $key => $unit)
<option value="{{ $key }}"
@if($element->isSelected($key)) selected @endif
>{{ $unit }}</option>
@endforeach
</x-slot:options>
</x-moonshine::form.select>
</x-moonshine::column>
<x-moonshine::form.select
:id="$element->getUnitColumn()"
:name="$element->name($element->getUnitColumn())"
data-item-select-text=""

@class(['form-invalid' => formErrors($errors, $element->getFormName())->has($element->getUnitColumn())])
>
<x-slot:options>
@foreach($element->values() as $key => $unit)
<option value="{{ $key }}"
@if($element->isSelected($key)) selected @endif
>{{ $unit }}</option>
@endforeach
</x-slot:options>
</x-moonshine::form.select>
@endif
</x-moonshine::grid>
</div>
@if($element->isGroup())
@error($element->column(), $element->getFormName())
<x-moonshine::form.input-error>
{{ $message }}
</x-moonshine::form.input-error>
@enderror
@error($element->getUnitColumn(), $element->getFormName())
<x-moonshine::form.input-error>
{{ $message }}
</x-moonshine::form.input-error>
@enderror
@endif

0 comments on commit 1b7f4ae

Please sign in to comment.