-
Notifications
You must be signed in to change notification settings - Fork 24
/
WeeklyFightLocations.patch
61 lines (59 loc) · 2.14 KB
/
WeeklyFightLocations.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
commit 5a09dbfc0166effe4b7fde29072482a0f5244b16
Author: Adam Balan <[email protected]>
Date: Fri Nov 8 17:53:32 2024 -0700
Added fixes to the way weekly fights happen, as well as a few other fixes here and there.
diff --git a/app/Flare/View/Livewire/Info/Locations/WeeklyFightLocations.php b/app/Flare/View/Livewire/Info/Locations/WeeklyFightLocations.php
new file mode 100644
index 000000000..855a395b3
--- /dev/null
+++ b/app/Flare/View/Livewire/Info/Locations/WeeklyFightLocations.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace App\Flare\View\Livewire\Info\Locations;
+
+use App\Flare\Models\GameMap;
+use App\Flare\Models\Location;
+use App\Flare\Values\LocationType;
+use Illuminate\Database\Eloquent\Builder;
+use Rappasoft\LaravelLivewireTables\DataTableComponent;
+use Rappasoft\LaravelLivewireTables\Views\Column;
+
+class WeeklyFightLocations extends DataTableComponent
+{
+ private array $weeklyFightLocations = [
+ LocationType::LORDS_STRONG_HOLD,
+ LocationType::BROKEN_ANVIL,
+ LocationType::TWSITED_MAIDENS_DUNGEONS,
+ LocationType::ALCHEMY_CHURCH,
+ ];
+
+ public function configure(): void
+ {
+ $this->setPrimaryKey('id');
+ }
+
+ public function builder(): Builder
+ {
+ return Location::whereIn('type', $this->weeklyFightLocations);
+ }
+
+ public function columns(): array
+ {
+ return [
+ Column::make('Name')->searchable()->format(function ($value, $row) {
+ $locationId = Location::where('name', $value)->first()->id;
+
+ return '<a href="/information/locations/' . $locationId . '" >' . $row->name . '</a>';
+ })->html(),
+
+ Column::make('Game Map', 'game_map_id')->searchable()->sortable()->format(function ($value, $row) {
+ $gameMap = GameMap::find($value);
+
+ return '<span>' . $gameMap->name . ($gameMap->only_during_event_type ? ' <i class="fas fa-star text-yellow-700 dark:text-yellow-500"></i> ' : '') . '</span>';
+ })->html(),
+ Column::make('X Coordinate', 'x')->sortable(),
+ Column::make('Y Coordinate', 'y')->sortable(),
+ ];
+ }
+}