Added transaction chart
This commit is contained in:
@@ -22,7 +22,7 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
//use Livewire\Livewire;
|
||||
use Livewire\Livewire;
|
||||
|
||||
class ProductionQuantityResource extends Resource
|
||||
{
|
||||
@@ -33,6 +33,7 @@ class ProductionQuantityResource extends Resource
|
||||
// protected static ?string $navigationParentItem = 'Display Transactions';
|
||||
|
||||
protected static ?string $navigationGroup = 'Production';
|
||||
public $plant_id;
|
||||
|
||||
|
||||
public static function form(Form $form): Form
|
||||
@@ -54,8 +55,19 @@ class ProductionQuantityResource extends Resource
|
||||
// ->afterStateUpdated(fn ($set) => $set('block_name', null))
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
|
||||
//...
|
||||
|
||||
// $set('plantId', $state);
|
||||
|
||||
session(['select_plant' => $state]);
|
||||
session()->forget('select_line'); // Reset line filter
|
||||
|
||||
//...
|
||||
|
||||
$set('block_name', null);
|
||||
if (!$plantId) {
|
||||
if (!$plantId)
|
||||
{
|
||||
$set('pqPlantError', 'Please select a plant first.');
|
||||
return;
|
||||
}
|
||||
@@ -64,7 +76,24 @@ class ProductionQuantityResource extends Resource
|
||||
$set('validationError', null);
|
||||
$set('pqPlantError', null);
|
||||
}
|
||||
|
||||
})
|
||||
->extraAttributes([
|
||||
'x-on:change' => "
|
||||
if (\$event.target.value) {
|
||||
\$wire.dispatch('filtersUpdated', { plantId: \$event.target.value });
|
||||
}
|
||||
",
|
||||
])
|
||||
|
||||
// ->extraAttributes([
|
||||
// 'x-on:change' => "\$wire.dispatch('filtersUpdated', { plantId: \$event.target.value })"
|
||||
// ])
|
||||
// ->extraAttributes([
|
||||
// 'x-on:change' => "\$wire.set('plantId', \$event.target.value)"
|
||||
// ])
|
||||
|
||||
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('pqPlantError') ? 'border-red-500' : '',
|
||||
])
|
||||
@@ -230,7 +259,16 @@ class ProductionQuantityResource extends Resource
|
||||
// $set('recent_qr', null);
|
||||
// }
|
||||
}
|
||||
|
||||
//..
|
||||
session(['select_line' => $state]);
|
||||
})
|
||||
// ->extraAttributes([
|
||||
// 'x-on:change' => "\$wire.dispatch('filtersUpdated')", // Dispatch Livewire event from Alpine.js
|
||||
// ])
|
||||
->extraAttributes([
|
||||
'x-on:change' => "\$wire.dispatch('filtersUpdated', { lineId: \$event.target.value })"
|
||||
])
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('pqLineError') ? 'border-red-500' : '',
|
||||
])
|
||||
@@ -793,6 +831,7 @@ class ProductionQuantityResource extends Resource
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
|
||||
Reference in New Issue
Block a user