diff --git a/resources/views/components/frameworks/bootstrap5/filters/number.blade.php b/resources/views/components/frameworks/bootstrap5/filters/number.blade.php index b7515b0c..d10af300 100644 --- a/resources/views/components/frameworks/bootstrap5/filters/number.blade.php +++ b/resources/views/components/frameworks/bootstrap5/filters/number.blade.php @@ -7,6 +7,7 @@ @php $fieldClassName = data_get($filter, 'className'); + $field = data_get($filter, 'field'); $componentAttributes = (array) data_get($filter, 'attributes'); @@ -14,6 +15,8 @@ $defaultAttributes = $fieldClassName::getWireAttributes($field, array_merge($filter, (array)$column)); $filterClasses = Arr::toCssClasses([data_get($theme, 'inputClass'), data_get($column, 'headerClass'), 'power_grid']); + + $placeholder = data_get($filter, 'placeholder'); $params = array_merge([...data_get($filter, 'attributes'), ...$defaultAttributes, $filterClasses], $filter); @endphp diff --git a/resources/views/components/frameworks/tailwind/filters/number.blade.php b/resources/views/components/frameworks/tailwind/filters/number.blade.php index 53b2ce98..017e5b8c 100644 --- a/resources/views/components/frameworks/tailwind/filters/number.blade.php +++ b/resources/views/components/frameworks/tailwind/filters/number.blade.php @@ -5,7 +5,9 @@ 'column' => '', ]) @php + $fieldClassName = data_get($filter, 'className'); + $field = data_get($filter, 'field'); $componentAttributes = (array) data_get($filter, 'attributes'); @@ -14,6 +16,8 @@ $filterClasses = Arr::toCssClasses([data_get($theme, 'inputClass'), data_get($column, 'headerClass'), 'power_grid']); + $placeholder = data_get($filter, 'placeholder'); + $params = array_merge([...data_get($filter, 'attributes'), ...$defaultAttributes, $filterClasses], $filter); @endphp diff --git a/tests/Feature/Filters/FilterMultipleTest.php b/tests/Feature/Filters/FilterMultipleTest.php index 19cbbeac..cdcf58c8 100644 --- a/tests/Feature/Filters/FilterMultipleTest.php +++ b/tests/Feature/Filters/FilterMultipleTest.php @@ -14,11 +14,10 @@ public function filters(): array { return [ - Filter::number('price') - ->thousands('.') - ->decimal(','), - Filter::inputText('name')->operators(), - Filter::number('price')->thousands('.')->decimal(','), + Filter::number('price_BRL')->placeholder('min_xyz_placeholder', 'max_xyz_placeholder')->thousands('.') ->decimal(','), + Filter::number('price') ->placeholder('min_xyz_placeholder', 'max_xyz_placeholder')->thousands('.') ->decimal(','), + Filter::inputText('name')->placeholder('dish_name_xyz_placeholder')->operators(), + Filter::number('price')->placeholder('min_xyz_placeholder', 'max_xyz_placeholder')->thousands('.')->decimal(','), Filter::boolean('in_stock'), ]; } @@ -28,11 +27,10 @@ public function filters(): array public function filters(): array { return [ - Filter::number('price') - ->thousands('.') - ->decimal(','), - Filter::inputText('name')->operators(), - Filter::number('price')->thousands('.')->decimal(','), + Filter::number('price_BRL')->placeholder('min_xyz_placeholder', 'max_xyz_placeholder')->thousands('.') ->decimal(','), + Filter::number('price') ->placeholder('min_xyz_placeholder', 'max_xyz_placeholder')->thousands('.') ->decimal(','), + Filter::inputText('name')->placeholder('dish_name_xyz_placeholder')->operators(), + Filter::number('price')->placeholder('min_xyz_placeholder', 'max_xyz_placeholder')->thousands('.')->decimal(','), Filter::boolean('in_stock'), ]; } @@ -42,11 +40,9 @@ public function filters(): array public function filters(): array { return [ - Filter::number('price') - ->thousands('.') - ->decimal(','), - Filter::inputText('name')->operators(), - Filter::number('price')->thousands('.')->decimal(','), + Filter::number('price_BRL') ->placeholder('min_xyz_placeholder', 'max_xyz_placeholder')->thousands('.') ->decimal(','), + Filter::inputText('dish_name')->placeholder('dish_name_xyz_placeholder')->operators(), + Filter::number('price')->placeholder('min_xyz_placeholder', 'max_xyz_placeholder')->thousands('.')->decimal(','), Filter::boolean('in_stock'), ]; } @@ -92,11 +88,14 @@ public function filters(): array ]); } - $component->assertSee('Barco-Sushi da Sueli'); + $component->assertSee('Barco-Sushi da Sueli') + ->assertSeeHtml('dish_name_xyz_placeholder'); $filters = array_merge($component->filters, filterNumber('price', '80.00', '100')); $component->set('filters', $filters) + ->assertSeeHtml('placeholder="min_xyz_placeholder"') + ->assertSeeHtml('placeholder="max_xyz_placeholder"') ->assertDontSee('Barco-Sushi da Sueli') ->assertSee('Barco-Sushi Simples') ->assertDontSee('Polpetone Filé Mignon')