From e7a99054a3b4aea657c7f1cc9eab54f5e690d29a Mon Sep 17 00:00:00 2001 From: Dave Roverts Date: Sun, 17 Jul 2022 14:06:29 +0200 Subject: [PATCH 1/2] fix(FlowMeasureResource): allow value to be edited while fm is active Closes #164 --- app/Filament/Resources/FlowMeasureResource.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Filament/Resources/FlowMeasureResource.php b/app/Filament/Resources/FlowMeasureResource.php index 3eabe892..d9413768 100644 --- a/app/Filament/Resources/FlowMeasureResource.php +++ b/app/Filament/Resources/FlowMeasureResource.php @@ -169,11 +169,10 @@ public static function form(Form $form): Form ->required(), Forms\Components\TextInput::make('value') ->columnSpan(2) - ->disabled(fn (Closure $get) => $get('edit_mode') == FlowMeasureResource::PARTIAL_EDIT || - in_array($get('type'), [ - FlowMeasureType::MANDATORY_ROUTE->value, - FlowMeasureType::PROHIBIT->value, - ]) + ->disabled(fn (Closure $get) => in_array($get('type'), [ + FlowMeasureType::MANDATORY_ROUTE->value, + FlowMeasureType::PROHIBIT->value, + ]) || $get('type') == null) ->required(fn (Closure $get) => !in_array($get('type'), [ FlowMeasureType::MANDATORY_ROUTE->value, From 90cf164cac9e1140b29e2b055c1ecf6ce6156513 Mon Sep 17 00:00:00 2001 From: Dave Roverts Date: Sun, 17 Jul 2022 14:44:14 +0200 Subject: [PATCH 2/2] fix(FlowMeasureResource): change value to numeric and add validation Closes #165 --- app/Filament/Resources/FlowMeasureResource.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Filament/Resources/FlowMeasureResource.php b/app/Filament/Resources/FlowMeasureResource.php index d9413768..1727ba31 100644 --- a/app/Filament/Resources/FlowMeasureResource.php +++ b/app/Filament/Resources/FlowMeasureResource.php @@ -178,6 +178,10 @@ public static function form(Form $form): Form FlowMeasureType::MANDATORY_ROUTE->value, FlowMeasureType::PROHIBIT->value, ])) + ->numeric() + ->minValue(1) + ->maxValue(400) + ->step(1) ->hidden(fn (Closure $get) => in_array($get('type'), [ FlowMeasureType::MINIMUM_DEPARTURE_INTERVAL->value, FlowMeasureType::AVERAGE_DEPARTURE_INTERVAL->value,