Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
fb19e9a579
commit
092a78e306
1 file changed
+17
-3
@@ -70,11 +70,25 @@ class SpiceChart extends ApexChartWidget {
|
||||
}
|
||||
|
||||
protected function extraJsOptions(): ?RawJs {
|
||||
return RawJs::make(<<<'JS'
|
||||
$urls = \App\Models\Spice::all()
|
||||
->map(fn ($s) => \App\Filament\User\Resources\SpiceResource::getUrl('edit', ['record' => $s->id]))
|
||||
->values()
|
||||
->toJson();
|
||||
|
||||
return RawJs::make(<<<JS
|
||||
{
|
||||
chart: {
|
||||
events: {
|
||||
dataPointSelection: function(event, chartContext, config) {
|
||||
var urls = {$urls};
|
||||
var url = urls[config.dataPointIndex];
|
||||
if (url) window.location.href = url;
|
||||
}
|
||||
}
|
||||
},
|
||||
xaxis: {
|
||||
labels: {
|
||||
formatter: function (val, timestamp, opts) {
|
||||
formatter: function (val) {
|
||||
return val.replace('( ', '(')
|
||||
}
|
||||
}
|
||||
@@ -86,7 +100,7 @@ class SpiceChart extends ApexChartWidget {
|
||||
},
|
||||
dropShadow: {
|
||||
enabled: true
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
JS);
|
||||
|
||||
Reference in new issue
Block a user