phases one of time logged now with log display
This commit is contained in:
+18
-70
@@ -13,23 +13,12 @@
|
||||
@endphp
|
||||
|
||||
<x-filament-widgets::widget class="fi-wi-chart">
|
||||
<x-filament::section
|
||||
:description="$description"
|
||||
:heading="$heading"
|
||||
:collapsible="$isCollapsible"
|
||||
>
|
||||
<x-filament::section :description="$description" :heading="$heading" :collapsible="$isCollapsible">
|
||||
@if ($filters || method_exists($this, 'getFiltersSchema'))
|
||||
<x-slot name="afterHeader">
|
||||
@if ($filters)
|
||||
<x-filament::input.wrapper
|
||||
inline-prefix
|
||||
wire:target="filter"
|
||||
class="fi-wi-chart-filter"
|
||||
>
|
||||
<x-filament::input.select
|
||||
inline-prefix
|
||||
wire:model.live="filter"
|
||||
>
|
||||
<x-filament::input.wrapper inline-prefix wire:target="filter" class="fi-wi-chart-filter">
|
||||
<x-filament::input.select inline-prefix wire:model.live="filter">
|
||||
@foreach ($filters as $value => $label)
|
||||
<option value="{{ $value }}">
|
||||
{{ $label }}
|
||||
@@ -40,12 +29,7 @@
|
||||
@endif
|
||||
|
||||
@if (method_exists($this, 'getFiltersSchema'))
|
||||
<x-filament::dropdown
|
||||
placement="bottom-end"
|
||||
shift
|
||||
width="xs"
|
||||
class="fi-wi-chart-filter"
|
||||
>
|
||||
<x-filament::dropdown placement="bottom-end" shift width="xs" class="fi-wi-chart-filter">
|
||||
<x-slot name="trigger">
|
||||
{{ $this->getFiltersTriggerAction() }}
|
||||
</x-slot>
|
||||
@@ -54,9 +38,7 @@
|
||||
{{ $this->getFiltersSchema() }}
|
||||
|
||||
@if (method_exists($this, 'hasDeferredFilters') && $this->hasDeferredFilters())
|
||||
<div
|
||||
class="fi-wi-chart-filter-content-actions-ctn"
|
||||
>
|
||||
<div class="fi-wi-chart-filter-content-actions-ctn">
|
||||
{{ $this->getFiltersApplyAction() }}
|
||||
|
||||
{{ $this->getFiltersResetAction() }}
|
||||
@@ -68,58 +50,24 @@
|
||||
</x-slot>
|
||||
@endif
|
||||
|
||||
<div
|
||||
@if ($pollingInterval = $this->getPollingInterval())
|
||||
wire:poll.{{ $pollingInterval }}="updateChartData"
|
||||
@endif
|
||||
>
|
||||
<div
|
||||
x-load
|
||||
<div @if ($pollingInterval = $this->getPollingInterval()) wire:poll.{{ $pollingInterval }}="updateChartData" @endif>
|
||||
<div x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('chart', 'filament/widgets') }}"
|
||||
wire:ignore
|
||||
data-chart-type="{{ $type }}"
|
||||
x-data="chart({
|
||||
cachedData: @js($this->getCachedData()),
|
||||
options: @js($this->getOptions()),
|
||||
type: @js($type),
|
||||
})"
|
||||
{{
|
||||
(new ComponentAttributeBag)
|
||||
->color(ChartWidgetComponent::class, $color)
|
||||
->class([
|
||||
'fi-wi-chart-canvas-ctn',
|
||||
'fi-wi-chart-canvas-ctn-no-aspect-ratio' => $hasMaxHeight,
|
||||
])
|
||||
}}
|
||||
>
|
||||
<canvas
|
||||
x-ref="canvas"
|
||||
@style([
|
||||
'width: 100%',
|
||||
'height: 100%; max-height: 100%' => ! $hasMaxHeight,
|
||||
('max-height: ' . e($maxHeight)) => $hasMaxHeight,
|
||||
])
|
||||
></canvas>
|
||||
wire:ignore data-chart-type="{{ $type }}" x-data="chart({
|
||||
cachedData: @js($this->getCachedData()),
|
||||
options: @js($this->getOptions()),
|
||||
type: @js($type),
|
||||
})"
|
||||
{{ new ComponentAttributeBag()->color(ChartWidgetComponent::class, $color)->class(['fi-wi-chart-canvas-ctn', 'fi-wi-chart-canvas-ctn-no-aspect-ratio' => $hasMaxHeight]) }}>
|
||||
<canvas x-ref="canvas" @style(['width: 100%', 'height: 100%; max-height: 100%' => !$hasMaxHeight, 'max-height: ' . e($maxHeight) => $hasMaxHeight])></canvas>
|
||||
|
||||
<span
|
||||
x-ref="backgroundColorElement"
|
||||
class="fi-wi-chart-bg-color"
|
||||
></span>
|
||||
<span x-ref="backgroundColorElement" class="fi-wi-chart-bg-color"></span>
|
||||
|
||||
<span
|
||||
x-ref="borderColorElement"
|
||||
class="fi-wi-chart-border-color"
|
||||
></span>
|
||||
<span x-ref="borderColorElement" class="fi-wi-chart-border-color"></span>
|
||||
|
||||
<span
|
||||
x-ref="gridColorElement"
|
||||
class="fi-wi-chart-grid-color"
|
||||
></span>
|
||||
<span x-ref="gridColorElement" class="fi-wi-chart-grid-color"></span>
|
||||
|
||||
<span
|
||||
x-ref="textColorElement"
|
||||
class="fi-wi-chart-text-color"
|
||||
></span>
|
||||
<span x-ref="textColorElement" class="fi-wi-chart-text-color"></span>
|
||||
</div>
|
||||
</div>
|
||||
</x-filament::section>
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
<div
|
||||
{{ $attributes->gridColumn($this->getColumnSpan(), $this->getColumnStart())->class(['fi-wi-widget']) }}
|
||||
>
|
||||
<div {{ $attributes->gridColumn($this->getColumnSpan(), $this->getColumnStart())->class(['fi-wi-widget']) }}>
|
||||
{{ $slot }}
|
||||
</div>
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
@php
|
||||
if (is_array($columns)) {
|
||||
$columns['lg'] ??= ($columns ? (is_array($columns) ? null : $columns) : 2);
|
||||
$columns['lg'] ??= $columns ? (is_array($columns) ? null : $columns) : 2;
|
||||
}
|
||||
@endphp
|
||||
|
||||
<div {{ $attributes->grid($columns)->class(['fi-wi']) }}>
|
||||
@php
|
||||
$normalizeWidgetClass = function (string | Filament\Widgets\WidgetConfiguration $widget): string {
|
||||
$normalizeWidgetClass = function (string|Filament\Widgets\WidgetConfiguration $widget): string {
|
||||
if ($widget instanceof \Filament\Widgets\WidgetConfiguration) {
|
||||
return $widget->widget;
|
||||
}
|
||||
@@ -30,10 +30,6 @@
|
||||
$widgetClass = $normalizeWidgetClass($widget);
|
||||
@endphp
|
||||
|
||||
@livewire(
|
||||
$widgetClass,
|
||||
[...(($widget instanceof \Filament\Widgets\WidgetConfiguration) ? [...$widget->widget::getDefaultProperties(), ...$widget->getProperties()] : $widget::getDefaultProperties()), ...$data],
|
||||
key("{$widgetClass}-{$widgetKey}"),
|
||||
)
|
||||
@livewire($widgetClass, [...$widget instanceof \Filament\Widgets\WidgetConfiguration ? [...$widget->widget::getDefaultProperties(), ...$widget->getProperties()] : $widget::getDefaultProperties(), ...$data], key("{$widgetClass}-{$widgetKey}"))
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@@ -8,16 +8,13 @@
|
||||
$hasDescription = filled($description);
|
||||
@endphp
|
||||
|
||||
<x-filament-widgets::widget
|
||||
:attributes="
|
||||
(new \Illuminate\View\ComponentAttributeBag)
|
||||
->merge([
|
||||
'wire:poll.' . $pollingInterval => $pollingInterval ? true : null,
|
||||
], escape: false)
|
||||
->class([
|
||||
'fi-wi-stats-overview',
|
||||
])
|
||||
"
|
||||
>
|
||||
<x-filament-widgets::widget :attributes="new \Illuminate\View\ComponentAttributeBag()
|
||||
->merge(
|
||||
[
|
||||
'wire:poll.' . $pollingInterval => $pollingInterval ? true : null,
|
||||
],
|
||||
escape: false,
|
||||
)
|
||||
->class(['fi-wi-stats-overview'])">
|
||||
{{ $this->content }}
|
||||
</x-filament-widgets::widget>
|
||||
|
||||
+14
-31
@@ -14,16 +14,8 @@
|
||||
@endphp
|
||||
|
||||
<{!! $tag !!}
|
||||
@if ($url)
|
||||
{{ \Filament\Support\generate_href_html($url, $shouldOpenUrlInNewTab()) }}
|
||||
@endif
|
||||
{{
|
||||
$getExtraAttributeBag()
|
||||
->class([
|
||||
'fi-wi-stats-overview-stat',
|
||||
])
|
||||
}}
|
||||
>
|
||||
@if ($url) {{ \Filament\Support\generate_href_html($url, $shouldOpenUrlInNewTab()) }} @endif
|
||||
{{ $getExtraAttributeBag()->class(['fi-wi-stats-overview-stat']) }}>
|
||||
<div class="fi-wi-stats-overview-stat-content">
|
||||
<div class="fi-wi-stats-overview-stat-label-ctn">
|
||||
{{ \Filament\Support\generate_icon_html($getIcon()) }}
|
||||
@@ -39,10 +31,9 @@
|
||||
|
||||
@if ($description = $getDescription())
|
||||
<div
|
||||
{{ (new ComponentAttributeBag)->color(DescriptionComponent::class, $descriptionColor)->class(['fi-wi-stats-overview-stat-description']) }}
|
||||
>
|
||||
{{ new ComponentAttributeBag()->color(DescriptionComponent::class, $descriptionColor)->class(['fi-wi-stats-overview-stat-description']) }}>
|
||||
@if ($descriptionIcon && in_array($descriptionIconPosition, [IconPosition::Before, 'before']))
|
||||
{{ \Filament\Support\generate_icon_html($descriptionIcon, attributes: (new \Illuminate\View\ComponentAttributeBag)) }}
|
||||
{{ \Filament\Support\generate_icon_html($descriptionIcon, attributes: new \Illuminate\View\ComponentAttributeBag()) }}
|
||||
@endif
|
||||
|
||||
<span>
|
||||
@@ -50,7 +41,7 @@
|
||||
</span>
|
||||
|
||||
@if ($descriptionIcon && in_array($descriptionIconPosition, [IconPosition::After, 'after']))
|
||||
{{ \Filament\Support\generate_icon_html($descriptionIcon, attributes: (new \Illuminate\View\ComponentAttributeBag)) }}
|
||||
{{ \Filament\Support\generate_icon_html($descriptionIcon, attributes: new \Illuminate\View\ComponentAttributeBag()) }}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@@ -59,28 +50,20 @@
|
||||
@if ($chart = $getChart())
|
||||
{{-- An empty function to initialize the Alpine component with until it's loaded with `x-load`. This removes the need for `x-ignore`, allowing the chart to be updated via Livewire polling. --}}
|
||||
<div x-data="{ statsOverviewStatChart() {} }">
|
||||
<div
|
||||
x-load
|
||||
<div x-load
|
||||
x-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('stats-overview/stat/chart', 'filament/widgets') }}"
|
||||
x-data="statsOverviewStatChart({
|
||||
dataChecksum: @js($chartDataChecksum),
|
||||
labels: @js(array_keys($chart)),
|
||||
values: @js(array_values($chart)),
|
||||
})"
|
||||
{{ (new ComponentAttributeBag)->color(StatsOverviewWidgetStatChartComponent::class, $chartColor)->class(['fi-wi-stats-overview-stat-chart']) }}
|
||||
>
|
||||
dataChecksum: @js($chartDataChecksum),
|
||||
labels: @js(array_keys($chart)),
|
||||
values: @js(array_values($chart)),
|
||||
})"
|
||||
{{ new ComponentAttributeBag()->color(StatsOverviewWidgetStatChartComponent::class, $chartColor)->class(['fi-wi-stats-overview-stat-chart']) }}>
|
||||
<canvas x-ref="canvas"></canvas>
|
||||
|
||||
<span
|
||||
x-ref="backgroundColorElement"
|
||||
class="fi-wi-stats-overview-stat-chart-bg-color"
|
||||
></span>
|
||||
<span x-ref="backgroundColorElement" class="fi-wi-stats-overview-stat-chart-bg-color"></span>
|
||||
|
||||
<span
|
||||
x-ref="borderColorElement"
|
||||
class="fi-wi-stats-overview-stat-chart-border-color"
|
||||
></span>
|
||||
<span x-ref="borderColorElement" class="fi-wi-stats-overview-stat-chart-border-color"></span>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</{!! $tag !!}>
|
||||
</{!! $tag !!}>
|
||||
|
||||
Reference in New Issue
Block a user