diff --git a/app/Enums/FlowMeasureType.php b/app/Enums/FlowMeasureType.php index d7ace921..d76c52c6 100644 --- a/app/Enums/FlowMeasureType.php +++ b/app/Enums/FlowMeasureType.php @@ -20,7 +20,7 @@ public function getFormattedName(): string return match ($this) { self::MINIMUM_DEPARTURE_INTERVAL => 'Minimum Departure Interval [MDI]', self::AVERAGE_DEPARTURE_INTERVAL => 'Average Departure Interval [ADI]', - self::PER_HOUR => 'Per hour', + self::PER_HOUR => 'Rate Per Hour', self::MILES_IN_TRAIL => 'Miles In Trail [MIT]', self::MAX_IAS => 'Max IAS', self::MAX_MACH => 'Max Mach', diff --git a/app/Filament/Resources/EventResource.php b/app/Filament/Resources/EventResource.php index b116932a..105bd9f9 100644 --- a/app/Filament/Resources/EventResource.php +++ b/app/Filament/Resources/EventResource.php @@ -61,12 +61,12 @@ public static function form(Form $form): Form ) ->required(), Forms\Components\DateTimePicker::make('date_start') - ->label('Start (UTC)') + ->label('Start [UTC]') ->default(now()->addWeek()->startOfHour()) ->withoutSeconds() ->required(), Forms\Components\DateTimePicker::make('date_end') - ->label('End (UTC)') + ->label('End [UTC]') ->default(now()->addWeek()->addHours(4)->startOfHour()) ->withoutSeconds() ->after('date_start') diff --git a/app/Filament/Resources/FlowMeasureResource.php b/app/Filament/Resources/FlowMeasureResource.php index 523f7d13..1f64abce 100644 --- a/app/Filament/Resources/FlowMeasureResource.php +++ b/app/Filament/Resources/FlowMeasureResource.php @@ -65,13 +65,13 @@ public static function form(Form $form): Form ->disabled(fn (Page $livewire) => !$livewire instanceof CreateRecord) ->dehydrated(fn (Page $livewire) => $livewire instanceof CreateRecord) ->visible(fn (Page $livewire) => $livewire instanceof CreateRecord) - ->required(fn (Closure $get) => $get('event_id') == null), + ->required(), Forms\Components\TextInput::make('flight_information_region_name') ->label('Flight Information Region') ->hintIcon('heroicon-o-folder') ->disabled(true) ->dehydrated(false) - ->afterStateHydrated(function (TextInput $component, Closure $get, $state) { + ->afterStateHydrated(function (TextInput $component, Closure $get) { $component->state(FlightInformationRegion::find($get('flight_information_region_id'))?->identifier_name ?? null); }) ->visible(fn (Page $livewire) => !$livewire instanceof CreateRecord), @@ -92,8 +92,7 @@ public static function form(Form $form): Form ->disabled(fn (Page $livewire) => !$livewire instanceof CreateRecord) ->dehydrated(fn (Page $livewire) => $livewire instanceof CreateRecord) ->reactive() - ->visible(fn (Page $livewire) => $livewire instanceof CreateRecord) - ->required(fn (Closure $get) => $get('flight_information_region_id') == null), + ->visible(fn (Page $livewire) => $livewire instanceof CreateRecord), Forms\Components\TextInput::make('event_name') ->label(__('Event')) ->hintIcon('heroicon-o-calendar') @@ -104,6 +103,7 @@ public static function form(Form $form): Form }) ->visible(fn (Page $livewire) => !$livewire instanceof CreateRecord), Forms\Components\DateTimePicker::make('start_time') + ->label(__('Start time [UTC]')) ->default(now()->addMinutes(5)) ->withoutSeconds() ->afterOrEqual(now()) @@ -117,6 +117,7 @@ public static function form(Form $form): Form }) ->required(), Forms\Components\DateTimePicker::make('end_time') + ->label(__('End time [UTC]')) ->default(now()->addHours(2)->addMinutes(5)) ->withoutSeconds() ->after('start_time') diff --git a/app/Filament/Resources/FlowMeasureResource/Pages/CreateFlowMeasure.php b/app/Filament/Resources/FlowMeasureResource/Pages/CreateFlowMeasure.php index 0b189c05..c3c02bef 100644 --- a/app/Filament/Resources/FlowMeasureResource/Pages/CreateFlowMeasure.php +++ b/app/Filament/Resources/FlowMeasureResource/Pages/CreateFlowMeasure.php @@ -19,12 +19,7 @@ class CreateFlowMeasure extends CreateRecord protected function mutateFormDataBeforeCreate(array $data): array { - if (!$data['event_id']) { - $fir = FlightInformationRegion::find($data['flight_information_region_id']); - } else { - $fir = Event::find($data['event_id'])->flightInformationRegion; - $data['flight_information_region_id'] ??= $fir->id; - } + $fir = FlightInformationRegion::find($data['flight_information_region_id']); $startTime = Carbon::parse($data['start_time']); $data['identifier'] = FlowMeasureIdentifierGenerator::generateIdentifier($startTime, $fir); diff --git a/tests/Discord/FlowMeasure/Field/RestrictionTest.php b/tests/Discord/FlowMeasure/Field/RestrictionTest.php index aa25ac91..7dd94045 100644 --- a/tests/Discord/FlowMeasure/Field/RestrictionTest.php +++ b/tests/Discord/FlowMeasure/Field/RestrictionTest.php @@ -156,7 +156,7 @@ public function testItCanBePerHour() $field = $this->getField($measure); $this->assertEquals( - 'Per hour', + 'Rate Per Hour', $field->name() );