-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ed282f
commit 29863d9
Showing
5 changed files
with
53 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
app/Filament/Resources/PointResource/Widgets/PointFromProximity.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources\PointResource\Widgets; | ||
|
||
use App\Filament\Resources\PointResource; | ||
use App\Models\Point; | ||
use Filament\Tables\Columns\TextColumn; | ||
use Filament\Tables\Table; | ||
use Filament\Widgets\TableWidget as BaseWidget; | ||
use Illuminate\Contracts\Support\Htmlable; | ||
use Illuminate\Contracts\View\View; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class PointFromProximity extends BaseWidget | ||
{ | ||
public ?Point $record = null; | ||
|
||
protected int | string | array $columnSpan='full'; | ||
|
||
public function table(Table $table): Table | ||
{ | ||
return $table | ||
->query( | ||
Point::query() | ||
->withCount('problems') | ||
->where('administered_by', $this->record->administered_by) | ||
->where('id', '!=', $this->record->id) | ||
->where('point_type_id', $this->record->point_type_id) | ||
->where('city_id', $this->record->city_id) | ||
->where('county_id', $this->record->county_id) | ||
->where('service_type_id', $this->record->service_type_id) | ||
->withDistanceSphere('location', $this->record->location) | ||
->whereDistance('location', $this->record->location, '<', 100) | ||
) | ||
->heading(__('map_points.proximity_points')) | ||
->columns([TextColumn::make('distance')->label(__('map_points.distance')), ...PointResource::getColumns()]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -328,4 +328,5 @@ public function status(): Attribute | |
return Status::VERIFIED; | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters