Skip to content

Commit

Permalink
fix sortable
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Jun 2, 2024
1 parent e656c46 commit d086a5c
Show file tree
Hide file tree
Showing 8 changed files with 221 additions and 222 deletions.
396 changes: 201 additions & 195 deletions composer.lock

Large diffs are not rendered by default.

25 changes: 13 additions & 12 deletions src/Concerns/Designer.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,23 @@ private static function drawFields(ZeusSection $section, bool $inline, bool $has

private static function drawSections(Form $zeusForm, ZeusSection $section, array $fields): Tab | Step | Section
{
$component = Section::make($section->name)
->description($section->description)
->aside(fn () => $section->aside)
->compact(fn () => $section->compact)
->icon($section->icon ?? null)
->collapsible();

if (optional($zeusForm->options)['show-as'] === 'tabs') {
$component = Tab::make($section->name)
// ->live()
->icon($section->icon ?? null);
}

if (optional($zeusForm->options)['show-as'] === 'wizard') {
} elseif (optional($zeusForm->options)['show-as'] === 'wizard') {
$component = Step::make($section->name)
// ->live()
->description($section->description)
->icon($section->icon ?? null);
} else {
$component = Section::make($section->name)
// ->live()
->description($section->description)
->aside(fn () => $section->aside)
->compact(fn () => $section->compact)
->icon($section->icon ?? null)
->collapsible();
}

$component->visible(function ($record, Get $get) use ($section) {
Expand All @@ -138,9 +139,9 @@ private static function drawSections(Form $zeusForm, ZeusSection $section, array
});

return $component
->id(str($section->name)->slug() . '-' . $section->id)
//->id(str($section->name)->slug() . '-' . $section->id)
->schema($fields)
->live()
//->live()
->columns($section->columns);
}
}
14 changes: 0 additions & 14 deletions src/Fields/Classes/FileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
namespace LaraZeus\Bolt\Fields\Classes;

use Filament\Forms\Components\Hidden;
use Filament\Tables\Columns\TextColumn;
use LaraZeus\Accordion\Forms\Accordion;
use LaraZeus\Accordion\Forms\Accordions;
use LaraZeus\Bolt\Facades\Bolt;
use LaraZeus\Bolt\Fields\FieldsContract;
use LaraZeus\Bolt\Models\Field;
use LaraZeus\Bolt\Models\FieldResponse;
use LaraZeus\Bolt\Models\Response;

class FileUpload extends FieldsContract
{
Expand Down Expand Up @@ -79,18 +77,6 @@ public function getResponse(Field $field, FieldResponse $resp): string
public function TableColumn(Field $field): ?\Filament\Tables\Columns\Column
{
return null;
/*return TextColumn::make('zeusData.' . $field->id)
->label($field->name)
->url(null)
->searchable(query: function (Builder $query, string $search): Builder {
return $query
->whereHas('fieldsResponses', function ($query) use ($search) {
$query->where('response', 'like', '%' . $search . '%');
});
})
->getStateUsing(fn (Response $record) => $this->getFieldResponseValue($record, $field))
->html()
->toggleable();*/
}

// @phpstan-ignore-next-line
Expand Down
1 change: 1 addition & 0 deletions src/Fields/Classes/Textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public function getResponse(Field $field, FieldResponse $resp): string
public function TableColumn(Field $field): ?Column
{
return TextColumn::make('zeusData.' . $field->id)
->sortable(false)
->label($field->name)
->searchable(query: function (Builder $query, string $search): Builder {
return $query
Expand Down
1 change: 1 addition & 0 deletions src/Fields/Classes/Toggle.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public function appendFilamentComponentsOptions($component, $zeusField, bool $ha
public function TableColumn(Field $field): ?Column
{
return IconColumn::make('zeusData.' . $field->id)
->sortable(false)
->label($field->name)
->boolean()
->searchable(query: function (Builder $query, string $search): Builder {
Expand Down
1 change: 1 addition & 0 deletions src/Fields/FieldsContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ public function TableColumn(Field $field): ?Column
{
return TextColumn::make('zeusData.' . $field->id)
->label($field->name)
->sortable(false)
->searchable(query: function (Builder $query, string $search): Builder {
return $query
->whereHas('fieldsResponses', function ($query) use ($search) {
Expand Down
2 changes: 2 additions & 0 deletions src/Filament/Resources/FormResource/Pages/ManageResponses.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public function table(Table $table): Table

$mainColumns = [
ImageColumn::make('user.avatar')
->sortable(false)
->searchable(false)
->label(__('Avatar'))
->circular()
->toggleable(),
Expand Down
3 changes: 2 additions & 1 deletion src/Models/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace LaraZeus\Bolt\Models;

use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
Expand Down Expand Up @@ -33,7 +34,7 @@ public function getTable()
return config('zeus-bolt.table-prefix') . 'categories';
}

protected static function newFactory(): CategoryFactory
protected static function newFactory(): Factory
{
return CategoryFactory::new();
}
Expand Down

0 comments on commit d086a5c

Please sign in to comment.