From 19beedf3821e4c6df9ba167895abf46f2d149970 Mon Sep 17 00:00:00 2001 From: recursivetree Date: Mon, 21 Jul 2025 21:14:15 +0200 Subject: [PATCH 1/4] feature: moon notes when adding moon --- .../Controllers/Tools/MoonsController.php | 1 + src/Http/Validation/ProbeReport.php | 1 + ...025_07_21_000000_add_moon_report_notes.php | 52 +++++++++++++++++++ src/resources/lang/en/moons.php | 3 ++ .../moons/modals/components/content.blade.php | 5 ++ .../moons/modals/import/import.blade.php | 47 +++++++++++++++++ 6 files changed, 109 insertions(+) create mode 100644 src/database/migrations/2025_07_21_000000_add_moon_report_notes.php diff --git a/src/Http/Controllers/Tools/MoonsController.php b/src/Http/Controllers/Tools/MoonsController.php index cd12df462..7cb9e4812 100644 --- a/src/Http/Controllers/Tools/MoonsController.php +++ b/src/Http/Controllers/Tools/MoonsController.php @@ -125,6 +125,7 @@ public function store(ProbeReport $request) $universe_moon = UniverseMoonReport::firstOrNew(['moon_id' => $component->moonID]); $universe_moon->user_id = auth()->user()->getAuthIdentifier(); $universe_moon->updated_at = now(); + $universe_moon->notes = $request->notes; $universe_moon->save(); // search for any existing and outdated report regarding current moon diff --git a/src/Http/Validation/ProbeReport.php b/src/Http/Validation/ProbeReport.php index cf044b6a8..3027a6a4f 100644 --- a/src/Http/Validation/ProbeReport.php +++ b/src/Http/Validation/ProbeReport.php @@ -46,6 +46,7 @@ public function rules() { return [ 'moon-report' => 'required', + 'notes' => 'present|string' ]; } } diff --git a/src/database/migrations/2025_07_21_000000_add_moon_report_notes.php b/src/database/migrations/2025_07_21_000000_add_moon_report_notes.php new file mode 100644 index 000000000..1667176d9 --- /dev/null +++ b/src/database/migrations/2025_07_21_000000_add_moon_report_notes.php @@ -0,0 +1,52 @@ +string('notes')->default(''); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('universe_moon_reports', function (Blueprint $table){ + $table->dropColumn('notes'); + }); + } +}; diff --git a/src/resources/lang/en/moons.php b/src/resources/lang/en/moons.php index bb5f30b54..357eff743 100644 --- a/src/resources/lang/en/moons.php +++ b/src/resources/lang/en/moons.php @@ -55,4 +55,7 @@ 'filter_by_constellation' => 'Filter by constellation', 'filter_by_system' => 'Filter by system', 'import' => 'Import', + 'notes' => 'Notes', + 'notes_instruction' => 'You can enter some notes about the moon(s) here. When adding multiple moons, the note will be added to all of them.', + 'notes_placeholder' => 'Enter your notes here', ]; diff --git a/src/resources/views/tools/moons/modals/components/content.blade.php b/src/resources/views/tools/moons/modals/components/content.blade.php index c54b2a971..8aa10395d 100644 --- a/src/resources/views/tools/moons/modals/components/content.blade.php +++ b/src/resources/views/tools/moons/modals/components/content.blade.php @@ -16,6 +16,11 @@
{{ trans_choice('web::moons.moon', 1) }}
{{ $moon->moon->name }}
+ @if(strip_tags($moon->notes) !== "") +
{{ trans('web::moons.notes') }}
+
{!! $moon->notes !!}
+ @endif +
{{trans_choice('web::moons.region', 1)}}
{{ $moon->moon->region->name }}
diff --git a/src/resources/views/tools/moons/modals/import/import.blade.php b/src/resources/views/tools/moons/modals/import/import.blade.php index c7806e750..ad4592ca7 100644 --- a/src/resources/views/tools/moons/modals/import/import.blade.php +++ b/src/resources/views/tools/moons/modals/import/import.blade.php @@ -17,6 +17,14 @@ {!! trans('web::moons.probe_report_instruction') !!}

+
+ + +
+

+ {!! trans('web::moons.notes_instruction') !!} +

+
+ +@push('head') + +@endpush + +@push('javascript') + + + +@endpush From 42e8d64fe441494e23a8bb5461dd8454b310930c Mon Sep 17 00:00:00 2001 From: recursivetree Date: Mon, 21 Jul 2025 21:56:55 +0200 Subject: [PATCH 2/4] feat: allow editing moon reports --- .../Controllers/Tools/MoonsController.php | 16 +++++++++++++ src/Http/Routes/Tools/Moons.php | 4 ++++ src/Models/UniverseMoonReport.php | 23 +++++++++++++++++++ .../tools/moons/buttons/action.blade.php | 1 + .../views/tools/moons/buttons/edit.blade.php | 3 +++ .../moons/modals/components/content.blade.php | 5 +++- .../moons/modals/import/import.blade.php | 19 +++++++++++---- 7 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 src/resources/views/tools/moons/buttons/edit.blade.php diff --git a/src/Http/Controllers/Tools/MoonsController.php b/src/Http/Controllers/Tools/MoonsController.php index 7cb9e4812..870126c61 100644 --- a/src/Http/Controllers/Tools/MoonsController.php +++ b/src/Http/Controllers/Tools/MoonsController.php @@ -22,6 +22,7 @@ namespace Seat\Web\Http\Controllers\Tools; +use Illuminate\Http\Request; use Seat\Eveapi\Models\Sde\Moon; use Seat\Services\ReportParser\Exceptions\InvalidReportException; use Seat\Services\ReportParser\Parsers\MoonReport; @@ -159,4 +160,19 @@ public function destroy(UniverseMoonReport $report) return redirect()->back(); } + + /** + * @param int $moon + * @return \Illuminate\Http\JsonResponse + */ + public function edit(int $moon) + { + $moon = UniverseMoonReport::with('content')->where('moon_id',$moon)->first(); + if($moon == null) return response()->json([],400); + + return response()->json([ + 'report' => $moon->formatReport(), + 'notes' => $moon->notes, + ]); + } } diff --git a/src/Http/Routes/Tools/Moons.php b/src/Http/Routes/Tools/Moons.php index e49000999..702e7ad58 100644 --- a/src/Http/Routes/Tools/Moons.php +++ b/src/Http/Routes/Tools/Moons.php @@ -34,6 +34,10 @@ ->name('seatcore::tools.moons.show') ->uses('MoonsController@show'); + Route::get('/{id}/edit') + ->name('seatcore::tools.moons.edit') + ->uses('MoonsController@edit'); + Route::post('/') ->name('seatcore::tools.moons.store') ->uses('MoonsController@store') diff --git a/src/Models/UniverseMoonReport.php b/src/Models/UniverseMoonReport.php index 5596e31b7..47b3103ad 100644 --- a/src/Models/UniverseMoonReport.php +++ b/src/Models/UniverseMoonReport.php @@ -147,6 +147,29 @@ public function scopeExceptional($query) }); } + /** + * Converts the moon back into a report string + * + * @return string + */ + public function formatReport(): string + { + // header + moon name + $report = sprintf("Moon Moon Product\tQuantity\tOre TypeID\tSolarSystemID\tPlanetID\tMoonID\n%s\n",$this->moon->name); + + foreach ($this->content as $content){ + $report .= sprintf("\t%s\t%F\t%d\t%d\t%d\t%d\n", + $content->typeName, + $content->pivot->rate, + $content->typeID, + $this->moon->system_id, + $this->moon->planet_id, + $this->moon_id); + } + + return $report; + } + /** * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ diff --git a/src/resources/views/tools/moons/buttons/action.blade.php b/src/resources/views/tools/moons/buttons/action.blade.php index 67e1cf245..f80a84ca5 100644 --- a/src/resources/views/tools/moons/buttons/action.blade.php +++ b/src/resources/views/tools/moons/buttons/action.blade.php @@ -1,4 +1,5 @@
@include('web::tools.moons.buttons.show') + @include('web::tools.moons.buttons.edit') @include('web::tools.moons.buttons.delete')
\ No newline at end of file diff --git a/src/resources/views/tools/moons/buttons/edit.blade.php b/src/resources/views/tools/moons/buttons/edit.blade.php new file mode 100644 index 000000000..9f1c22945 --- /dev/null +++ b/src/resources/views/tools/moons/buttons/edit.blade.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/resources/views/tools/moons/modals/components/content.blade.php b/src/resources/views/tools/moons/modals/components/content.blade.php index 8aa10395d..a66e638ff 100644 --- a/src/resources/views/tools/moons/modals/components/content.blade.php +++ b/src/resources/views/tools/moons/modals/components/content.blade.php @@ -1,4 +1,7 @@ -

{{ $moon->moon->name }}

+

+ {{ $moon->moon->name }} + @include('web::tools.moons.buttons.edit',['row'=>$moon]) +

{{ trans('web::moons.yield_explanation',['volume'=>number_format(Seat\Eveapi\Models\Industry\CorporationIndustryMiningExtraction::BASE_DRILLING_VOLUME, 2),'yield'=>(setting('reprocessing_yield') ?: 0.80) * 100]) }}

diff --git a/src/resources/views/tools/moons/modals/import/import.blade.php b/src/resources/views/tools/moons/modals/import/import.blade.php index ad4592ca7..8448ca6c5 100644 --- a/src/resources/views/tools/moons/modals/import/import.blade.php +++ b/src/resources/views/tools/moons/modals/import/import.blade.php @@ -12,7 +12,7 @@ {{ csrf_field() }}
- +

{!! trans('web::moons.probe_report_instruction') !!}

@@ -43,7 +43,6 @@ @endpush From d23caa7c2b97f4b13a19db67831502bf877a773a Mon Sep 17 00:00:00 2001 From: recursivetree Date: Mon, 21 Jul 2025 22:04:07 +0200 Subject: [PATCH 3/4] styleci --- src/Http/Controllers/Tools/MoonsController.php | 7 +++---- src/Http/Validation/ProbeReport.php | 2 +- src/Models/UniverseMoonReport.php | 4 ++-- .../migrations/2025_07_21_000000_add_moon_report_notes.php | 5 ++--- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Http/Controllers/Tools/MoonsController.php b/src/Http/Controllers/Tools/MoonsController.php index 870126c61..1fbe05227 100644 --- a/src/Http/Controllers/Tools/MoonsController.php +++ b/src/Http/Controllers/Tools/MoonsController.php @@ -22,7 +22,6 @@ namespace Seat\Web\Http\Controllers\Tools; -use Illuminate\Http\Request; use Seat\Eveapi\Models\Sde\Moon; use Seat\Services\ReportParser\Exceptions\InvalidReportException; use Seat\Services\ReportParser\Parsers\MoonReport; @@ -162,13 +161,13 @@ public function destroy(UniverseMoonReport $report) } /** - * @param int $moon + * @param int $moon * @return \Illuminate\Http\JsonResponse */ public function edit(int $moon) { - $moon = UniverseMoonReport::with('content')->where('moon_id',$moon)->first(); - if($moon == null) return response()->json([],400); + $moon = UniverseMoonReport::with('content')->where('moon_id', $moon)->first(); + if($moon == null) return response()->json([], 400); return response()->json([ 'report' => $moon->formatReport(), diff --git a/src/Http/Validation/ProbeReport.php b/src/Http/Validation/ProbeReport.php index 3027a6a4f..a1355812b 100644 --- a/src/Http/Validation/ProbeReport.php +++ b/src/Http/Validation/ProbeReport.php @@ -46,7 +46,7 @@ public function rules() { return [ 'moon-report' => 'required', - 'notes' => 'present|string' + 'notes' => 'present|string', ]; } } diff --git a/src/Models/UniverseMoonReport.php b/src/Models/UniverseMoonReport.php index 47b3103ad..a4a467ef1 100644 --- a/src/Models/UniverseMoonReport.php +++ b/src/Models/UniverseMoonReport.php @@ -148,14 +148,14 @@ public function scopeExceptional($query) } /** - * Converts the moon back into a report string + * Converts the moon back into a report string. * * @return string */ public function formatReport(): string { // header + moon name - $report = sprintf("Moon Moon Product\tQuantity\tOre TypeID\tSolarSystemID\tPlanetID\tMoonID\n%s\n",$this->moon->name); + $report = sprintf("Moon Moon Product\tQuantity\tOre TypeID\tSolarSystemID\tPlanetID\tMoonID\n%s\n", $this->moon->name); foreach ($this->content as $content){ $report .= sprintf("\t%s\t%F\t%d\t%d\t%d\t%d\n", diff --git a/src/database/migrations/2025_07_21_000000_add_moon_report_notes.php b/src/database/migrations/2025_07_21_000000_add_moon_report_notes.php index 1667176d9..8a8192de7 100644 --- a/src/database/migrations/2025_07_21_000000_add_moon_report_notes.php +++ b/src/database/migrations/2025_07_21_000000_add_moon_report_notes.php @@ -22,7 +22,6 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends Migration { @@ -33,7 +32,7 @@ */ public function up() { - Schema::table('universe_moon_reports', function (Blueprint $table){ + Schema::table('universe_moon_reports', function (Blueprint $table) { $table->string('notes')->default(''); }); } @@ -45,7 +44,7 @@ public function up() */ public function down() { - Schema::table('universe_moon_reports', function (Blueprint $table){ + Schema::table('universe_moon_reports', function (Blueprint $table) { $table->dropColumn('notes'); }); } From 3f3982873babf1f749f4b497a33579b45c033404 Mon Sep 17 00:00:00 2001 From: recursivetree Date: Mon, 21 Jul 2025 22:07:39 +0200 Subject: [PATCH 4/4] add german translations I actually speak german :). I just usually don't translate seat stuff because I play EVE in English, so I don't know the game terms in German --- src/resources/lang/de/moons.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/resources/lang/de/moons.php b/src/resources/lang/de/moons.php index 82a181156..6a1a596a0 100644 --- a/src/resources/lang/de/moons.php +++ b/src/resources/lang/de/moons.php @@ -33,4 +33,8 @@ 'uncommon' => 'Ungewöhnlich', 'rare' => 'Selten', 'exceptional' => 'Außergewöhnlich', + + 'notes' => 'Notizen', + 'notes_instruction' => 'Du kannst hier Notizen zu den Mond(en) eingeben. Falls du Daten für mehrere Monde gleichzeitig eingibst, wird die Notiz zu allen neuen Monden hinzugefügt.', + 'notes_placeholder' => 'Gib hier Notizen ein', ];