Skip to content

Commit

Permalink
Just Keep Swimming 🐠
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Newhouse committed Oct 24, 2024
1 parent f04a56a commit bc3d224
Showing 1 changed file with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ public function table(Table $table): Table
->counts('reviews')
->label('# Reviews')
->sortable()
->toggleable()
->toggleable(isToggledHiddenByDefault: true)
->hidden(! in_array($this->ownerRecord->id, [35, 38])),
TextColumn::make('reviews_avg_score')
->avg('reviews', 'score')
->label('Avg. Score')
->sortable()
->toggleable()
->toggleable(isToggledHiddenByDefault: true)
->hidden(! in_array($this->ownerRecord->id, [35, 38])),
IconColumn::make('reviewed')
->label('You Reviewed')
->boolean()
->getStateUsing(fn (Model $record) => $record->reviews->pluck('user_id')->contains(auth()->id()))
->falseIcon('')
->toggleable()
->toggleable(isToggledHiddenByDefault: true)
->hidden(! in_array($this->ownerRecord->id, [35, 38])),
TextColumn::make('id')
->label('Proposal ID')
Expand Down Expand Up @@ -105,36 +105,36 @@ public function table(Table $table): Table
SelectFilter::make('user')
->relationship('user', 'email')
->searchable(),
SelectFilter::make('track-first-choice')
->options(
fn ($livewire) => collect($livewire->ownerRecord->questions
->firstWhere('data.id', 'track-first-choice')['data']['options'])
->mapWithKeys(function ($option) {
$key = explode(':', $option)[0];
// SelectFilter::make('track-first-choice')
// ->options(
// fn ($livewire) => collect($livewire->ownerRecord->questions
// ->firstWhere('data.id', 'track-first-choice')['data']['options'])
// ->mapWithKeys(function ($option) {
// $key = explode(':', $option)[0];

return [$key => $key];
})
)
->query(fn ($query, $data) => $query->when(
$data['value'] !== null,
fn ($query) => $query->where('answers->track-first-choice', $data['value'])
))
->hidden(! in_array($this->ownerRecord->id, [35, 38])),
SelectFilter::make('track-second-choice')
->options(
fn ($livewire) => collect($livewire->ownerRecord->questions
->firstWhere('data.id', 'track-second-choice')['data']['options'])
->mapWithKeys(function ($option) {
$key = explode(':', $option)[0];
// return [$key => $key];
// })
// )
// ->query(fn ($query, $data) => $query->when(
// $data['value'] !== null,
// fn ($query) => $query->where('answers->track-first-choice', $data['value'])
// ))
// ->hidden(! in_array($this->ownerRecord->id, [35, 38])),
// SelectFilter::make('track-second-choice')
// ->options(
// fn ($livewire) => collect($livewire->ownerRecord->questions
// ->firstWhere('data.id', 'track-second-choice')['data']['options'])
// ->mapWithKeys(function ($option) {
// $key = explode(':', $option)[0];

return [$key => $key];
})
)
->query(fn ($query, $data) => $query->when(
$data['value'] !== null,
fn ($query) => $query->where('answers->track-second-choice', $data['value'])
))
->hidden(! in_array($this->ownerRecord->id, [35, 38])),
// return [$key => $key];
// })
// )
// ->query(fn ($query, $data) => $query->when(
// $data['value'] !== null,
// fn ($query) => $query->where('answers->track-second-choice', $data['value'])
// ))
// ->hidden(! in_array($this->ownerRecord->id, [35, 38])),
], layout: FiltersLayout::AboveContent)
->actions([
ActionGroup::make([
Expand Down

0 comments on commit bc3d224

Please sign in to comment.