Added refresh chart while update plant, block, shift, line
This commit is contained in:
@@ -33,9 +33,8 @@ class ProductionQuantityResource extends Resource
|
|||||||
// protected static ?string $navigationParentItem = 'Display Transactions';
|
// protected static ?string $navigationParentItem = 'Display Transactions';
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Production';
|
protected static ?string $navigationGroup = 'Production';
|
||||||
public $plant_id;
|
|
||||||
|
|
||||||
|
|
||||||
|
// public $plant_id;
|
||||||
public static function form(Form $form): Form
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
@@ -58,8 +57,6 @@ class ProductionQuantityResource extends Resource
|
|||||||
|
|
||||||
//...
|
//...
|
||||||
|
|
||||||
// $set('plantId', $state);
|
|
||||||
|
|
||||||
session(['select_plant' => $state]);
|
session(['select_plant' => $state]);
|
||||||
session()->forget('select_line'); // Reset line filter
|
session()->forget('select_line'); // Reset line filter
|
||||||
|
|
||||||
@@ -116,7 +113,6 @@ class ProductionQuantityResource extends Resource
|
|||||||
$latestShiftId = optional(ProductionQuantity::latest()->first())->shift_id;
|
$latestShiftId = optional(ProductionQuantity::latest()->first())->shift_id;
|
||||||
return optional(Shift::where('id', $latestShiftId)->first())->block_id;
|
return optional(Shift::where('id', $latestShiftId)->first())->block_id;
|
||||||
})
|
})
|
||||||
// ->afterStateUpdated(fn ($set) => $set('shift_id', null))
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
if($get('id'))
|
if($get('id'))
|
||||||
{
|
{
|
||||||
@@ -132,6 +128,9 @@ class ProductionQuantityResource extends Resource
|
|||||||
$blockId = $get('block_name');
|
$blockId = $get('block_name');
|
||||||
$set('shift_id', null);
|
$set('shift_id', null);
|
||||||
|
|
||||||
|
session(['select_plant' => $get('plant_id')]);
|
||||||
|
session()->forget('select_line');
|
||||||
|
|
||||||
if (!$blockId) {
|
if (!$blockId) {
|
||||||
$set('pqBlockError', 'Please select a block first.');
|
$set('pqBlockError', 'Please select a block first.');
|
||||||
return;
|
return;
|
||||||
@@ -180,6 +179,9 @@ class ProductionQuantityResource extends Resource
|
|||||||
$curShiftId = $get('shift_id');
|
$curShiftId = $get('shift_id');
|
||||||
$set('line_id', null);
|
$set('line_id', null);
|
||||||
|
|
||||||
|
session(['select_plant' => $get('plant_id')]);
|
||||||
|
session()->forget('select_line');
|
||||||
|
|
||||||
if (!$curShiftId) {
|
if (!$curShiftId) {
|
||||||
$set('pqShiftError', 'Please select a shift first.');
|
$set('pqShiftError', 'Please select a shift first.');
|
||||||
return;
|
return;
|
||||||
@@ -229,8 +231,12 @@ class ProductionQuantityResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
$lineId = $get('line_id');
|
$lineId = $get('line_id');
|
||||||
|
|
||||||
$set('item_code', null);
|
$set('item_code', null);
|
||||||
|
|
||||||
|
session(['select_plant' => $get('plant_id')]);
|
||||||
|
session()->forget('select_line');
|
||||||
|
session(['select_line' => $state]);
|
||||||
|
|
||||||
if (!$lineId) {
|
if (!$lineId) {
|
||||||
$set('pqLineError', 'Please select a line first.');
|
$set('pqLineError', 'Please select a line first.');
|
||||||
return;
|
return;
|
||||||
@@ -259,9 +265,6 @@ class ProductionQuantityResource extends Resource
|
|||||||
// $set('recent_qr', null);
|
// $set('recent_qr', null);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
//..
|
|
||||||
session(['select_line' => $state]);
|
|
||||||
})
|
})
|
||||||
// ->extraAttributes([
|
// ->extraAttributes([
|
||||||
// 'x-on:change' => "\$wire.dispatch('filtersUpdated')", // Dispatch Livewire event from Alpine.js
|
// 'x-on:change' => "\$wire.dispatch('filtersUpdated')", // Dispatch Livewire event from Alpine.js
|
||||||
|
|||||||
Reference in New Issue
Block a user