From 6d5684f597eeb1d31339806b2ef3c026c6ffe59d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Parient=C3=A9?= <41431456+arthurpar06@users.noreply.github.com> Date: Wed, 15 May 2024 17:23:20 +0200 Subject: [PATCH 01/13] Add internal user fields (#1805) * Add internal user fields * Apply fixes from StyleCI --------- Co-authored-by: arthurpar06 --- ..._15_144813_add_internal_to_user_fields.php | 27 +++++++++++++++++++ .../Controllers/Admin/UserFieldController.php | 17 +++++++++++- .../Controllers/Auth/RegisterController.php | 5 ++-- .../Frontend/ProfileController.php | 4 +-- app/Models/UserField.php | 2 ++ app/Repositories/UserRepository.php | 17 +++++++----- 6 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 app/Database/migrations/2024_05_15_144813_add_internal_to_user_fields.php diff --git a/app/Database/migrations/2024_05_15_144813_add_internal_to_user_fields.php b/app/Database/migrations/2024_05_15_144813_add_internal_to_user_fields.php new file mode 100644 index 000000000..1f8390177 --- /dev/null +++ b/app/Database/migrations/2024_05_15_144813_add_internal_to_user_fields.php @@ -0,0 +1,27 @@ +boolean('internal')->after('private')->default(false); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('user_fields', function (Blueprint $table) { + $table->dropColumn('internal'); + }); + } +}; diff --git a/app/Http/Controllers/Admin/UserFieldController.php b/app/Http/Controllers/Admin/UserFieldController.php index 814462096..3f07363dd 100644 --- a/app/Http/Controllers/Admin/UserFieldController.php +++ b/app/Http/Controllers/Admin/UserFieldController.php @@ -32,7 +32,7 @@ public function __construct( public function index(Request $request): View { $this->userFieldRepo->pushCriteria(new RequestCriteria($request)); - $fields = $this->userFieldRepo->all(); + $fields = $this->userFieldRepo->where('internal', false)->get(); return view('admin.userfields.index', ['fields' => $fields]); } @@ -99,6 +99,11 @@ public function edit(int $id): RedirectResponse|View return redirect(route('admin.userfields.index')); } + if ($field->internal) { + Flash::error('You cannot edit an internal user field'); + return redirect(route('admin.userfields.index')); + } + return view('admin.userfields.edit', ['field' => $field]); } @@ -121,6 +126,11 @@ public function update(int $id, Request $request): RedirectResponse return redirect(route('admin.userfields.index')); } + if ($field->internal) { + Flash::error('You cannot edit an internal user field'); + return redirect(route('admin.userfields.index')); + } + $this->userFieldRepo->update($request->all(), $id); Flash::success('Field updated successfully.'); @@ -142,6 +152,11 @@ public function destroy(int $id): RedirectResponse return redirect(route('admin.userfields.index')); } + if ($field->internal) { + Flash::error('You cannot delete an internal user field'); + return redirect(route('admin.userfields.index')); + } + if ($this->userFieldRepo->isInUse($id)) { Flash::error('This field cannot be deleted, it is in use. Deactivate it instead'); return redirect(route('admin.userfields.index')); diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 6275e50f7..52a3bef1c 100755 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -84,7 +84,7 @@ public function showRegistrationForm(Request $request): View } $airlines = $this->airlineRepo->selectBoxList(); - $userFields = UserField::where(['show_on_registration' => true, 'active' => true])->get(); + $userFields = UserField::where(['show_on_registration' => true, 'active' => true, 'internal' => false])->get(); return view('auth.register', [ 'airports' => [], @@ -124,6 +124,7 @@ protected function validator(array $data): Validator $userFields = UserField::where([ 'show_on_registration' => true, 'required' => true, + 'internal' => false, 'active' => true, ])->get(); @@ -215,7 +216,7 @@ protected function create(Request $request): User Log::info('User registered: ', $user->toArray()); - $userFields = UserField::where(['show_on_registration' => true, 'active' => true])->get(); + $userFields = UserField::where(['show_on_registration' => true, 'active' => true, 'internal' => false])->get(); foreach ($userFields as $field) { $field_name = 'field_'.$field->slug; UserFieldValue::updateOrCreate([ diff --git a/app/Http/Controllers/Frontend/ProfileController.php b/app/Http/Controllers/Frontend/ProfileController.php index 9b940fa36..ad0dd3d30 100644 --- a/app/Http/Controllers/Frontend/ProfileController.php +++ b/app/Http/Controllers/Frontend/ProfileController.php @@ -154,7 +154,7 @@ public function update(Request $request): RedirectResponse 'avatar' => 'nullable|mimes:jpeg,png,jpg', ]; - $userFields = UserField::where(['show_on_registration' => true, 'required' => true])->get(); + $userFields = UserField::where(['show_on_registration' => true, 'required' => true, 'internal' => false])->get(); foreach ($userFields as $field) { $rules['field_'.$field->slug] = 'required'; } @@ -217,7 +217,7 @@ public function update(Request $request): RedirectResponse } // Save all of the user fields - $userFields = UserField::all(); + $userFields = UserField::where('internal', false)->get(); foreach ($userFields as $field) { $field_name = 'field_'.$field->slug; UserFieldValue::updateOrCreate([ diff --git a/app/Models/UserField.php b/app/Models/UserField.php index 098a42649..226c30547 100644 --- a/app/Models/UserField.php +++ b/app/Models/UserField.php @@ -23,6 +23,7 @@ class UserField extends Model 'show_on_registration', // Show on the registration form? 'required', // Required to be filled out in registration? 'private', // Whether this is shown on the user's public profile + 'internal', // Whether this field is for internal use only (e.g. modules) 'active', ]; @@ -30,6 +31,7 @@ class UserField extends Model 'show_on_registration' => 'boolean', 'required' => 'boolean', 'private' => 'boolean', + 'internal' => 'boolean', 'active' => 'boolean', ]; diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index 86aa20ab1..decbb3b45 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -31,19 +31,24 @@ public function model() /** * Get all of the fields which has the mapped values * - * @param User $user - * @param bool $only_public_fields Only include the user's public fields + * @param User $user + * @param bool $only_public_fields Only include the user's public fields + * @param mixed $with_internal_fields * * @return \App\Models\UserField[]|\Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection */ - public function getUserFields(User $user, $only_public_fields = null): Collection + public function getUserFields(User $user, $only_public_fields = null, $with_internal_fields = false): Collection { + $fields = UserField::when(!$with_internal_fields, function ($query) { + return $query->where('internal', false); + }); + if (is_bool($only_public_fields)) { - $fields = UserField::where(['private' => !$only_public_fields])->get(); - } else { - $fields = UserField::get(); + $fields = $fields->where(['private' => !$only_public_fields]); } + $fields = $fields->get(); + return $fields->map(function ($field, $_) use ($user) { foreach ($user->fields as $userFieldValue) { if ($userFieldValue->field->slug === $field->slug) { From 677f3d5c89d02ea1b6d914430568cd27517bf9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Parient=C3=A9?= <41431456+arthurpar06@users.noreply.github.com> Date: Mon, 20 May 2024 00:20:19 +0200 Subject: [PATCH 02/13] Map LastPirepID in Legacy PirepImporter (#1809) --- app/Services/LegacyImporter/PirepImporter.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Services/LegacyImporter/PirepImporter.php b/app/Services/LegacyImporter/PirepImporter.php index 174fa7625..b9ecd11bc 100644 --- a/app/Services/LegacyImporter/PirepImporter.php +++ b/app/Services/LegacyImporter/PirepImporter.php @@ -136,6 +136,12 @@ public function run($start = 0) $count++; } + if ($pirep->user && $pirep->state === PirepState::ACCEPTED) { + $pirep->user->update([ + 'last_pirep_id' => $pirep->id, + ]); + } + if (!$pirep->airline || !$pirep->airline->journal) { continue; } From 36f79e7faa55f687c131f07b51100ae725669deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Parient=C3=A9?= <41431456+arthurpar06@users.noreply.github.com> Date: Fri, 24 May 2024 16:49:55 +0200 Subject: [PATCH 03/13] Create a console kernel instance before running webcron (#1810) --- app/Http/Controllers/Api/MaintenanceController.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Http/Controllers/Api/MaintenanceController.php b/app/Http/Controllers/Api/MaintenanceController.php index c70f1dcab..a6f6eb0ec 100644 --- a/app/Http/Controllers/Api/MaintenanceController.php +++ b/app/Http/Controllers/Api/MaintenanceController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Api; use App\Console\Cron; +use App\Console\Kernel; use App\Contracts\Controller; use App\Exceptions\CronInvalid; use Illuminate\Http\JsonResponse; @@ -25,6 +26,15 @@ public function cron(Request $request, string $id): JsonResponse throw new CronInvalid(); } + // Create a console kernel instance + $consoleKernel = app()->make(Kernel::class); + + // Run a null artisan thing just so Laravel internals can be setup properly + $status = $consoleKernel->handle( + new \Symfony\Component\Console\Input\ArgvInput(), + new \Symfony\Component\Console\Output\NullOutput() + ); + $cron = app(Cron::class); $run = $cron->run(); From 84ecc61adab68fcdfd1477542ca6845d5ac05602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Parient=C3=A9?= <41431456+arthurpar06@users.noreply.github.com> Date: Fri, 24 May 2024 17:30:21 +0200 Subject: [PATCH 04/13] Update Module AppServiceProvider Stub (#1811) Co-authored-by: Nabeel S --- resources/stubs/modules/provider.stub | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/stubs/modules/provider.stub b/resources/stubs/modules/provider.stub index 015f9f149..1a20d9d6d 100644 --- a/resources/stubs/modules/provider.stub +++ b/resources/stubs/modules/provider.stub @@ -72,9 +72,14 @@ class AppServiceProvider extends ServiceProvider $this->publishes([$sourcePath => $viewPath],'views'); - $this->loadViewsFrom(array_merge(array_map(function ($path) { - return $path . '/modules/$LOWER_NAME$'; - }, \Config::get('view.paths')), [$sourcePath]), '$LOWER_NAME$'); + $this->loadViewsFrom(array_merge(array_filter(array_map(function ($path) { + $path = str_replace('default', setting('general.theme'), $path); + // Check if the directory exists before adding it + if (file_exists($path.'/modules/$LOWER_NAME$') && is_dir($path.'/modules/$LOWER_NAME$')) + return $path.'/modules/$LOWER_NAME$'; + + return null; + }, \Config::get('view.paths'))), [$sourcePath]), '$LOWER_NAME$'); } /** From 287b3bf2013fb6ae4a655d56e1db7a82252b151c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Parient=C3=A9?= <41431456+arthurpar06@users.noreply.github.com> Date: Thu, 30 May 2024 04:06:14 +0200 Subject: [PATCH 05/13] Add ability to edit news (#1814) * Add ability to edit news * Apply fixes from StyleCI * Add option to send notifications * Add option to send notifications when a news is updated * Apply fixes from StyleCI --------- Co-authored-by: arthurpar06 --- app/Events/NewsUpdated.php | 14 ++++ .../Controllers/Admin/DashboardController.php | 5 ++ .../NotificationEventsHandler.php | 20 +++++ app/Providers/RouteServiceProvider.php | 1 + app/Services/NewsService.php | 34 +++++++- .../views/admin/dashboard/news.blade.php | 78 +++++++++++++++++-- tests/NewsTest.php | 7 +- 7 files changed, 149 insertions(+), 10 deletions(-) create mode 100644 app/Events/NewsUpdated.php diff --git a/app/Events/NewsUpdated.php b/app/Events/NewsUpdated.php new file mode 100644 index 000000000..40740bd9e --- /dev/null +++ b/app/Events/NewsUpdated.php @@ -0,0 +1,14 @@ +id; $this->newsSvc->addNews($attrs); + } elseif ($request->isMethod('patch')) { + $attrs = $request->post(); + $attrs['user_id'] = Auth::user()->id; + + $this->newsSvc->updateNews($attrs); } elseif ($request->isMethod('delete')) { $id = $request->input('news_id'); $this->newsSvc->deleteNews($id); diff --git a/app/Notifications/NotificationEventsHandler.php b/app/Notifications/NotificationEventsHandler.php index 260340985..08fc938e4 100644 --- a/app/Notifications/NotificationEventsHandler.php +++ b/app/Notifications/NotificationEventsHandler.php @@ -5,6 +5,7 @@ use App\Contracts\Listener; use App\Events\AwardAwarded; use App\Events\NewsAdded; +use App\Events\NewsUpdated; use App\Events\PirepAccepted; use App\Events\PirepFiled; use App\Events\PirepPrefiled; @@ -33,6 +34,7 @@ class NotificationEventsHandler extends Listener public static $callbacks = [ AwardAwarded::class => 'onAwardAwarded', NewsAdded::class => 'onNewsAdded', + NewsUpdated::class => 'onNewsUpdated', PirepPrefiled::class => 'onPirepPrefile', PirepStatusChange::class => 'onPirepStatusChange', PirepAccepted::class => 'onPirepAccepted', @@ -268,6 +270,24 @@ public function onNewsAdded(NewsAdded $event): void Notification::send([$event->news], new Messages\Broadcast\NewsAdded($event->news)); } + /** + * Notify all users of a news event, but only the users which have opted in + * + * @param \App\Events\NewsUpdated $event + */ + public function onNewsUpdated(NewsUpdated $event): void + { + Log::info('NotificationEvents::onNewsAdded'); + if (setting('notifications.mail_news', true)) { + $this->notifyAllUsers(new Messages\NewsAdded($event->news)); + } + + /* + * Broadcast notifications + */ + Notification::send([$event->news], new Messages\Broadcast\NewsAdded($event->news)); + } + /** * Notify all users that user has awarded a new award * diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index a0276a891..94ba6b13b 100755 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -516,6 +516,7 @@ private function mapAdminRoutes() Route::match([ 'get', + 'patch', 'post', 'delete', ], 'dashboard/news', ['uses' => 'DashboardController@news']) diff --git a/app/Services/NewsService.php b/app/Services/NewsService.php index 0a347ba23..89b726241 100644 --- a/app/Services/NewsService.php +++ b/app/Services/NewsService.php @@ -4,7 +4,10 @@ use App\Contracts\Service; use App\Events\NewsAdded; +use App\Events\NewsUpdated; +use App\Models\News; use App\Repositories\NewsRepository; +use Prettus\Validator\Exceptions\ValidatorException; class NewsService extends Service { @@ -27,7 +30,36 @@ public function __construct(NewsRepository $newsRepo) public function addNews(array $attrs) { $news = $this->newsRepo->create($attrs); - event(new NewsAdded($news)); + + if (array_key_exists('send_notifications', $attrs) && get_truth_state($attrs['send_notifications'])) { + event(new NewsAdded($news)); + } + + return $news; + } + + /** + * Update a news + * + * @param array $attrs + * + * @throws ValidatorException + * + * @return ?News + */ + public function updateNews(array $attrs): ?News + { + $news = $this->newsRepo->find($attrs['id']); + + if (!$news) { + return null; + } + + $news = $this->newsRepo->update($attrs, $attrs['id']); + + if (array_key_exists('send_notifications', $attrs) && get_truth_state($attrs['send_notifications'])) { + event(new NewsUpdated($news)); + } return $news; } diff --git a/resources/views/admin/dashboard/news.blade.php b/resources/views/admin/dashboard/news.blade.php index d08f92c1e..e04d1e791 100644 --- a/resources/views/admin/dashboard/news.blade.php +++ b/resources/views/admin/dashboard/news.blade.php @@ -1,5 +1,5 @@
-
+

Add News

@@ -15,10 +15,52 @@ {!! Form::textarea('body', '', ['id' => 'news_editor', 'class' => 'editor']) !!} - - {{ Form::button(' add', ['type' => 'submit', 'class' => 'btn btn-success btn-s']) }} - +
+
+ +
+
+ {{ Form::button(' add', ['type' => 'submit', 'class' => 'btn btn-success btn-s']) }} +
+
+ {{ Form::close() }} +
+
+ @@ -43,7 +85,8 @@ {!! $item->body!!} {{ optional($item->user)->name_private }} {{ $item->created_at->format('d.M.y') }} - + + {{ Form::open(['route' => 'admin.dashboard.news', 'method' => 'delete', 'class' => 'pjax_news_form']) }} {{ Form::hidden('news_id', $item->id) }} {{ Form::button('Delete', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs text-small', 'onclick' => "return confirm('Are you sure?')"]) }} @@ -55,11 +98,34 @@ @endif
+
@section('scripts') @parent @endsection diff --git a/tests/NewsTest.php b/tests/NewsTest.php index e6f8d3ad8..c6bccdb66 100644 --- a/tests/NewsTest.php +++ b/tests/NewsTest.php @@ -33,9 +33,10 @@ public function testNewsNotifications(): void $users_opt_out = User::factory()->count(5)->create(['opt_in' => false]); $this->newsSvc->addNews([ - 'user_id' => $users_opt_out[0]->id, - 'subject' => 'News Item', - 'body' => 'News!', + 'user_id' => $users_opt_out[0]->id, + 'subject' => 'News Item', + 'body' => 'News!', + 'send_notifications' => true, ]); Notification::assertSentTo($users_opt_in, NewsAdded::class); From a83523dd104bd87a2f131b3e730d876dc874da25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Parient=C3=A9?= <41431456+arthurpar06@users.noreply.github.com> Date: Thu, 13 Jun 2024 15:57:53 +0200 Subject: [PATCH 06/13] Add exception message to logs when there is an API error (#1819) * Add exception message to logs when there is an API error * Apply fixes from StyleCI --------- Co-authored-by: arthurpar06 --- app/Exceptions/Handler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 406331768..4389b6a20 100755 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -69,7 +69,7 @@ public function render($request, Throwable $exception) */ private function handleApiError($request, Throwable $exception) { - Log::error('API Error', $exception->getTrace()); + Log::error('API Error: '.$exception->getMessage(), $exception->getTrace()); if ($exception instanceof AbstractHttpException) { return $exception->getResponse(); From 81903f82e88676a282021f3692e58fd1d64b9642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20Parient=C3=A9?= <41431456+arthurpar06@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:25:12 +0200 Subject: [PATCH 07/13] Use laravel scheduler when proc_open is available (#1812) Co-authored-by: Nabeel S --- app/Services/CronService.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Services/CronService.php b/app/Services/CronService.php index c89511a66..5bf197702 100644 --- a/app/Services/CronService.php +++ b/app/Services/CronService.php @@ -34,9 +34,16 @@ public function getCronPath(): string $php_exec .= ' -d register_argc_argv=On'; } + $command = base_path('bin/cron'); + + // If the server has proc_open then use the default laravel scheduler + if (function_exists('proc_open')) { + $command = base_path('artisan schedule:run'); + } + $path = [ $php_exec, - base_path('bin/cron'), + $command, ]; return implode(' ', $path); From 77cd596ca19c1f031a52e813de352e64fc5e9215 Mon Sep 17 00:00:00 2001 From: "B.Fatih KOZ" Date: Thu, 13 Jun 2024 22:39:11 +0300 Subject: [PATCH 08/13] Update FlightController (Default sort order fix) (#1817) Sorting with `sortable()` does not support multiple columns for default output, thus additional `orderBy()` usage is required for initial/default sorting to get expected results on page load (like admin controller) Co-authored-by: Nabeel S --- app/Http/Controllers/Frontend/FlightController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Frontend/FlightController.php b/app/Http/Controllers/Frontend/FlightController.php index 49028dd41..b12bd21a3 100644 --- a/app/Http/Controllers/Frontend/FlightController.php +++ b/app/Http/Controllers/Frontend/FlightController.php @@ -151,7 +151,7 @@ public function search(Request $request): View ->when($filter_by_user, function ($query) use ($allowed_flights) { return $query->whereIn('id', $allowed_flights); }) - ->sortable('flight_number', 'route_code', 'route_leg') + ->sortable('flight_number')->orderBy('route_code')->orderBy('route_leg') ->paginate(); $saved_flights = []; From 7450d804be5f70216af44cdb7b3227df8b226f5e Mon Sep 17 00:00:00 2001 From: "B.Fatih KOZ" Date: Fri, 14 Jun 2024 02:45:57 +0300 Subject: [PATCH 09/13] Update User Model (#1816) Allow `$user->award->pivot` to have the timestamps --- app/Models/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/User.php b/app/Models/User.php index 592b530bb..d9132b4aa 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -322,7 +322,7 @@ public function airline(): BelongsTo public function awards(): BelongsToMany { - return $this->belongsToMany(Award::class, 'user_awards')->withTrashed(); + return $this->belongsToMany(Award::class, 'user_awards')->withTimestamps()->withTrashed(); } public function bids(): HasMany From 59b4d075e5eb91f970055c29166ce0c58fada2e9 Mon Sep 17 00:00:00 2001 From: "B.Fatih KOZ" Date: Mon, 17 Jun 2024 23:18:01 +0300 Subject: [PATCH 10/13] Add missing IATA Flight Types (#1821) Add Shuttle Mode, Passenger with Cargo In Cabin, General Aviation, Air Taxi and two non standard (company specific) codes. --- app/Models/Enums/FlightType.php | 48 ++++++++++++++++++++++----------- resources/lang/en/flights.php | 39 ++++++++++++++++----------- 2 files changed, 57 insertions(+), 30 deletions(-) diff --git a/app/Models/Enums/FlightType.php b/app/Models/Enums/FlightType.php index 5d9e6e028..bb9de99ec 100644 --- a/app/Models/Enums/FlightType.php +++ b/app/Models/Enums/FlightType.php @@ -21,22 +21,40 @@ class FlightType extends Enum public const TECHNICAL_TEST = 'T'; public const MILITARY = 'W'; public const TECHNICAL_STOP = 'X'; + public const SHUTTLE = 'S'; + public const ADDTL_SHUTTLE = 'B'; + public const CARGO_IN_CABIN = 'Q'; + public const ADDTL_CARGO_IN_CABIN = 'R'; + public const CHARTER_CARGO_IN_CABIN = 'L'; + public const GENERAL_AVIATION = 'D'; + public const AIR_TAXI = 'N'; + public const COMPANY_SPECIFIC = 'Y'; + public const OTHER = 'Z'; protected static array $labels = [ - self::SCHED_PAX => 'flights.type.pass_scheduled', - self::SCHED_CARGO => 'flights.type.cargo_scheduled', - self::CHARTER_PAX_ONLY => 'flights.type.charter_pass_only', - self::ADDITIONAL_CARGO => 'flights.type.addtl_cargo_mail', - self::VIP => 'flights.type.special_vip', - self::ADDTL_PAX => 'flights.type.pass_addtl', - self::CHARTER_CARGO_MAIL => 'flights.type.charter_cargo', - self::AMBULANCE => 'flights.type.ambulance', - self::TRAINING => 'flights.type.training_flight', - self::MAIL_SERVICE => 'flights.type.mail_service', - self::CHARTER_SPECIAL => 'flights.type.charter_special', - self::POSITIONING => 'flights.type.positioning', - self::TECHNICAL_TEST => 'flights.type.technical_test', - self::MILITARY => 'flights.type.military', - self::TECHNICAL_STOP => 'flights.type.technical_stop', + self::SCHED_PAX => 'flights.type.pass_scheduled', + self::SCHED_CARGO => 'flights.type.cargo_scheduled', + self::CHARTER_PAX_ONLY => 'flights.type.charter_pass_only', + self::ADDITIONAL_CARGO => 'flights.type.addtl_cargo_mail', + self::VIP => 'flights.type.special_vip', + self::ADDTL_PAX => 'flights.type.pass_addtl', + self::CHARTER_CARGO_MAIL => 'flights.type.charter_cargo', + self::AMBULANCE => 'flights.type.ambulance', + self::TRAINING => 'flights.type.training_flight', + self::MAIL_SERVICE => 'flights.type.mail_service', + self::CHARTER_SPECIAL => 'flights.type.charter_special', + self::POSITIONING => 'flights.type.positioning', + self::TECHNICAL_TEST => 'flights.type.technical_test', + self::MILITARY => 'flights.type.military', + self::TECHNICAL_STOP => 'flights.type.technical_stop', + self::SHUTTLE => 'flights.type.shuttle', + self::ADDTL_SHUTTLE => 'flights.type.addtl_shuttle', + self::CARGO_IN_CABIN => 'flights.type.cargo_in_cabin', + self::ADDTL_CARGO_IN_CABIN => 'flights.type.addtl_cargo_in_cabin', + self::CHARTER_CARGO_IN_CABIN => 'flights.type.charter_cargo_in_cabin', + self::GENERAL_AVIATION => 'flights.type.general_aviation', + self::AIR_TAXI => 'flights.type.air_taxi', + self::COMPANY_SPECIFIC => 'flights.type.company_specific', + self::OTHER => 'flights.type.other', ]; } diff --git a/resources/lang/en/flights.php b/resources/lang/en/flights.php index 97a726068..4c7e3be62 100644 --- a/resources/lang/en/flights.php +++ b/resources/lang/en/flights.php @@ -23,20 +23,29 @@ 'departuretime' => 'Departure Time', 'arrivaltime' => 'Arrival Time', 'type' => [ - 'pass_scheduled' => 'Passenger (Scheduled)', - 'pass_addtl' => 'Passenger (Additional)', - 'charter_pass_only' => 'Passenger (Charter)', - 'charter_special' => 'Passenger (Special Charter)', - 'cargo_scheduled' => 'Cargo (Scheduled)', - 'addtl_cargo_mail' => 'Cargo (Additional)', - 'charter_cargo' => 'Cargo (Charter)', - 'mail_service' => 'Mail Service', - 'special_vip' => 'VIP Flight', - 'ambulance' => 'Ambulance', - 'training_flight' => 'Training', - 'military' => 'Military', - 'positioning' => 'Positioning', - 'technical_test' => 'Technical Test', - 'technical_stop' => 'Technical Stop', + 'pass_scheduled' => 'Passenger (Scheduled)', + 'pass_addtl' => 'Passenger (Additional)', + 'charter_pass_only' => 'Passenger (Charter)', + 'charter_special' => 'Passenger (Special Charter)', + 'cargo_scheduled' => 'Cargo (Scheduled)', + 'addtl_cargo_mail' => 'Cargo (Additional)', + 'charter_cargo' => 'Cargo (Charter)', + 'mail_service' => 'Mail Service', + 'special_vip' => 'VIP Flight', + 'ambulance' => 'Ambulance', + 'training_flight' => 'Training', + 'military' => 'Military', + 'positioning' => 'Positioning', + 'technical_test' => 'Technical Test', + 'technical_stop' => 'Technical Stop', + 'shuttle' => 'Shuttle (Scheduled)', + 'addtl_shuttle' => 'Shuttle (Additional)', + 'cargo_in_cabin' => 'Passenger/Cargo In Cabin (Scheduled)', + 'addtl_cargo_in_cabin' => 'Passenger/Cargo In Cabin (Additional)', + 'charter_cargo_in_cabin' => 'Passenger/Cargo In Cabin (Charter)', + 'general_aviation' => 'General Aviation', + 'air_taxi' => 'Business/AirTaxi', + 'company_specific' => 'Company Specific (Non Standard)', + 'other' => 'Other (Non Standard)', ], ]; From afdd3db9dc3eb0770f5068cb0d03fbb0093a7449 Mon Sep 17 00:00:00 2001 From: "B.Fatih KOZ" Date: Fri, 21 Jun 2024 02:04:09 +0300 Subject: [PATCH 11/13] Fix Airport Pagination (#1823) Without the change it will not be possible to live sort and use pagination. --- resources/views/admin/airports/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/admin/airports/index.blade.php b/resources/views/admin/airports/index.blade.php index 7c7f28a59..19f2a4548 100644 --- a/resources/views/admin/airports/index.blade.php +++ b/resources/views/admin/airports/index.blade.php @@ -20,7 +20,7 @@
- {{ $airports->links('admin.pagination.default') }} + {{ $airports->withQueryString()->links('admin.pagination.default') }}
@endsection From 2c110baeb61523f9f7b015fe5b5464452a8f689a Mon Sep 17 00:00:00 2001 From: Julian Ramirez <90717365+rcomunica@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:56:50 -0500 Subject: [PATCH 12/13] Add Landing rate to discord broadcast (#1825) * Add Landing rate to discord broadcast Hello, In the last few days I implemented this option in my VA and my pilots liked it, that is why I am sending this change for other VA. * Landing rate in Discord broadcast --- app/Notifications/Messages/Broadcast/PirepStatusChanged.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Notifications/Messages/Broadcast/PirepStatusChanged.php b/app/Notifications/Messages/Broadcast/PirepStatusChanged.php index dad06b392..bd3d6d16a 100644 --- a/app/Notifications/Messages/Broadcast/PirepStatusChanged.php +++ b/app/Notifications/Messages/Broadcast/PirepStatusChanged.php @@ -120,6 +120,10 @@ public function createFields(Pirep $pirep): array 'Flight Time' => Time::minutesToTimeString($pirep->flight_time), ]; + if($pirep->landing_rate){ + $fields['Landing Rate'] = $pirep->landing_rate."ft/min"; + } + // Show the distance, but include the planned distance if it's been set $fields['Distance'] = []; if ($pirep->distance) { From cbccec0b661746d066bfcd8b5007a1a89c357d0f Mon Sep 17 00:00:00 2001 From: Nabeel S Date: Fri, 21 Jun 2024 14:57:49 -0500 Subject: [PATCH 13/13] Apply fixes from StyleCI (#1826) --- app/Notifications/Messages/Broadcast/PirepStatusChanged.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Notifications/Messages/Broadcast/PirepStatusChanged.php b/app/Notifications/Messages/Broadcast/PirepStatusChanged.php index bd3d6d16a..62580ff64 100644 --- a/app/Notifications/Messages/Broadcast/PirepStatusChanged.php +++ b/app/Notifications/Messages/Broadcast/PirepStatusChanged.php @@ -120,8 +120,8 @@ public function createFields(Pirep $pirep): array 'Flight Time' => Time::minutesToTimeString($pirep->flight_time), ]; - if($pirep->landing_rate){ - $fields['Landing Rate'] = $pirep->landing_rate."ft/min"; + if ($pirep->landing_rate) { + $fields['Landing Rate'] = $pirep->landing_rate.'ft/min'; } // Show the distance, but include the planned distance if it's been set