generated from filamentphp/plugin-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
7 changed files
with
127 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<x-filament-widgets::widget> | ||
<x-filament::section> | ||
<div class="p-4 space-y-4"> | ||
@if ($forecast) | ||
<h2 class="text-xl font-bold">Long-Term Forecast</h2> | ||
<div class="flex justify-between text-sm text-gray-500"> | ||
<span>From: {{ \Carbon\Carbon::parse($forecast['startdate'])->format('d M Y') }}</span> | ||
<span>To: {{ \Carbon\Carbon::parse($forecast['enddate'])->format('d M Y') }}</span> | ||
</div> | ||
<div class="prose max-w-none"> | ||
{!! nl2br(new Illuminate\Support\HtmlString($forecast['forecast'])) !!} | ||
</div> | ||
@else | ||
<p>No long-term forecast available.</p> | ||
@endif | ||
</div> | ||
</x-filament::section> | ||
</x-filament-widgets::widget> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<x-filament-widgets::widget> | ||
<x-filament::section> | ||
<div class="p-4 space-y-4"> | ||
@if ($forecast) | ||
<h2 class="text-xl font-bold">Short-Term Forecast</h2> | ||
<div class="flex justify-between text-sm text-gray-500"> | ||
<span>From: {{ \Carbon\Carbon::parse($forecast['startdate'])->format('d M Y') }}</span> | ||
<span>To: {{ \Carbon\Carbon::parse($forecast['enddate'])->format('d M Y') }}</span> | ||
</div> | ||
<div class="prose max-w-none"> | ||
{!! nl2br(new Illuminate\Support\HtmlString($forecast['forecast'])) !!} | ||
</div> | ||
@else | ||
<p>No short-term forecast available.</p> | ||
@endif | ||
</div> | ||
</x-filament::section> | ||
</x-filament-widgets::widget> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Baspa\FilamentBuienradarWidget\Widgets; | ||
|
||
use Baspa\Buienradar\Buienradar; | ||
use Filament\Widgets\Widget; | ||
use Illuminate\Contracts\View\View; | ||
|
||
class ForecastLongTermWidget extends Widget | ||
{ | ||
public ?array $forecast = null; | ||
|
||
protected static string $view = 'filament-buienradar-widget::widgets.forecast-long-term'; | ||
|
||
protected int | string | array $columnSpan = 'full'; | ||
|
||
public null | string | array $width = null; | ||
|
||
public function getColumnSpan(): int | string | array | ||
{ | ||
return $this->width ?? 'full'; | ||
} | ||
|
||
public function render(): View | ||
{ | ||
$this->columnSpan = $this->width ?? 0; | ||
|
||
return view(static::$view, $this->getViewData()); | ||
} | ||
|
||
public function mount(): void | ||
{ | ||
$buienradar = new Buienradar; | ||
|
||
$this->forecast = $buienradar->forecast()->longTerm(); | ||
} | ||
} |
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,37 @@ | ||
<?php | ||
|
||
namespace Baspa\FilamentBuienradarWidget\Widgets; | ||
|
||
use Baspa\Buienradar\Buienradar; | ||
use Filament\Widgets\Widget; | ||
use Illuminate\Contracts\View\View; | ||
|
||
class ForecastShortTermWidget extends Widget | ||
{ | ||
public ?array $forecast = null; | ||
|
||
protected static string $view = 'filament-buienradar-widget::widgets.forecast-short-term'; | ||
|
||
protected int | string | array $columnSpan = 'full'; | ||
|
||
public null | string | array $width = null; | ||
|
||
public function getColumnSpan(): int | string | array | ||
{ | ||
return $this->width ?? 'full'; | ||
} | ||
|
||
public function render(): View | ||
{ | ||
$this->columnSpan = $this->width ?? 0; | ||
|
||
return view(static::$view, $this->getViewData()); | ||
} | ||
|
||
public function mount(): void | ||
{ | ||
$buienradar = new Buienradar; | ||
|
||
$this->forecast = $buienradar->forecast()->shortTerm(); | ||
} | ||
} |