Skip to content

Commit

Permalink
Implemented requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
spitfire305 committed Jan 16, 2025
1 parent c83d882 commit 4414f79
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
5 changes: 1 addition & 4 deletions app/View/Components/Forms/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public function __construct(
public string $label = '',
public string $placeholder = '',
public mixed $selected = null,
public bool $leaveEmpty = false,
public array $extra = [],
) {
}
Expand Down Expand Up @@ -57,9 +56,7 @@ public function fieldId(): string
public function isSelected(mixed $value): bool
{
if (empty($this->selected)) {
if (!$this->leaveEmpty) {
return empty($value);
}
return empty($value);
}
if (is_array($this->selected)) {
return in_array($value, $this->selected);
Expand Down
7 changes: 7 additions & 0 deletions resources/views/cruds/fields/draggable_choice.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<x-forms.field field="is-draggable" :label="__('maps/markers.fields.is_draggable')">
<select name="is_draggable" class="w-full">
<option value=""></option>
<option value="0">{{ __('general.no') }}</option>
<option value="1">{{ __('general.yes') }}</option>
</select>
</x-forms.field>
10 changes: 1 addition & 9 deletions resources/views/layouts/datagrid/bulks/_map-marker.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@
6 => __('maps/markers.circle_sizes.custom'),
];
$typeOptions = [
'' => null,
0 => __('general.no'),
1 => __('general.yes'),
];
$groups = $model->groupOptions();
$groups[-1] = __('crud.filters.options.none');
?>
Expand All @@ -49,9 +43,7 @@
@endif
@include('maps.markers.fields.font_colour', ['dropdownParent' => '#primary-dialog'])

<x-forms.field field="is-draggable" :label="__('maps/markers.fields.is_draggable')">
<x-forms.select name="is_draggable" :leaveEmpty="true" :options="$typeOptions" class="w-full" />
</x-forms.field>
@include('cruds.fields.draggable_choice')

<x-forms.field field="opacity" :label="__('maps/markers.fields.opacity')">
<input type="number" name="opacity" class="w-full" value="{{ $source->opacity ?? old('opacity', $model->opacity ?? null) }}" min="0" step="10" max="100" id="opacity" maxlength="3" />
Expand Down

0 comments on commit 4414f79

Please sign in to comment.