Adde panel box qr code logic fro production order screen
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
This commit is contained in:
@@ -45,7 +45,8 @@ class ProductionOrderResource extends Resource
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||
->disabled(fn (string $context): bool => $context == 'edit')
|
||||
->dehydrated(true)
|
||||
->default(function () {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
@@ -84,7 +85,7 @@ class ProductionOrderResource extends Resource
|
||||
->default(function () {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? optional(ProductionOrder::where('plant_id', $userHas)->latest()->first())->plant_id : optional(ProductionOrder::latest()->first())->plant_id;
|
||||
return ($userHas && strlen($userHas) > 0) ? optional(ProductionOrder::where('plant_id', $userHas)->latest()->first())->item_id : optional(ProductionOrder::latest()->first())->item_id;
|
||||
})
|
||||
->required()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
@@ -102,6 +103,7 @@ class ProductionOrderResource extends Resource
|
||||
->integer()
|
||||
->required()
|
||||
->readOnly(fn ($get) => ($get('plant_id') == null || $get('item_id') == null))
|
||||
->disabled(fn (string $context): bool => $context === 'edit')
|
||||
->afterStateUpdated(function ($state, callable $set, $get) {
|
||||
if (! empty($state) && $state > 0) {
|
||||
$set('show_extra_fields', true);
|
||||
@@ -170,21 +172,39 @@ class ProductionOrderResource extends Resource
|
||||
Forms\Components\Hidden::make('show_extra_fields')
|
||||
->default(false),
|
||||
Forms\Components\DateTimePicker::make('start_date')
|
||||
->label('Start Date'),
|
||||
->label('Start Date')
|
||||
->reactive()
|
||||
// ->minDate(function () {
|
||||
// return Carbon::now()->addMinute();
|
||||
// })
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('end_date', null);
|
||||
}),
|
||||
Forms\Components\DateTimePicker::make('end_date')
|
||||
->label('End Date'),
|
||||
->label('End Date')
|
||||
->reactive(),
|
||||
// ->rule('after:start_date')
|
||||
// ->minDate(function (callable $get) {
|
||||
// $startDate = $get('start_date');
|
||||
// if ($startDate) {
|
||||
// return Carbon::parse($startDate)->addMinute();
|
||||
// }
|
||||
|
||||
// return Carbon::now()->addMinute();
|
||||
// }),
|
||||
Forms\Components\TextInput::make('production_order')
|
||||
->label('Production Order')
|
||||
->readOnly()
|
||||
->visible(fn ($get) => $get('show_extra_fields')),
|
||||
->visible(fn ($get) => $get('quantity') > 0),
|
||||
// ->visible(fn ($get) => $get('show_extra_fields')),
|
||||
Forms\Components\TextInput::make('from_serial_number')
|
||||
->label('From Serial Number')
|
||||
->readOnly()
|
||||
->visible(fn ($get) => $get('show_extra_fields')),
|
||||
->visible(fn ($get) => $get('quantity') > 0),
|
||||
Forms\Components\TextInput::make('to_serial_number')
|
||||
->label('To Serial Number')
|
||||
->readOnly()
|
||||
->visible(fn ($get) => $get('show_extra_fields')),
|
||||
->visible(fn ($get) => $get('quantity') > 0),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
|
||||
Reference in New Issue
Block a user