diff --git a/app/Http/Controllers/PreApplicationController.php b/app/Http/Controllers/PreApplicationController.php index 448b132..8c13818 100644 --- a/app/Http/Controllers/PreApplicationController.php +++ b/app/Http/Controllers/PreApplicationController.php @@ -83,4 +83,27 @@ class PreApplicationController extends Controller } return ["messageStatus" => "failure", "errorMessage" => __("controller_messages.PreApplicationController.event_not_found")]; } + + public static function applicationsPaginated(){ + return PreApplications::paginate(50); + } + + public function addApplication(Request $request){ + if(Auth::check()){ + try { + $pa = new PreApplications(); + $pa->first_name = $request->input('first_name'); + $pa->last_name = $request->input('last_name'); + $pa->location = $request->input('location'); + $pa->passport_type = $request->input('passport_type'); + $pa->reference_number = $request->input('reference_number'); + $pa->event_id = $request->input('event_id'); + $pa->email = $request->input('email'); + $pa->save(); + } + catch(\Exception $e){ + return ["messageStatus" => "failure", "errorMessage" => $e->getMessage()]; + } + } + } } diff --git a/app/Http/Controllers/WebsiteController.php b/app/Http/Controllers/WebsiteController.php index 5047dbb..ef2ca0c 100644 --- a/app/Http/Controllers/WebsiteController.php +++ b/app/Http/Controllers/WebsiteController.php @@ -81,4 +81,14 @@ class WebsiteController extends Controller } abort(404); } + + public function editApplications(){ + if(Auth::check()){ + return response() + ->view('application.edit', ['applications' => PreApplicationController::applicationsPaginated()]) + ->header('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); + } + abort(404); + } + } diff --git a/app/Models/ChaosEvents.php b/app/Models/ChaosEvents.php index 4c48689..0b3854d 100644 --- a/app/Models/ChaosEvents.php +++ b/app/Models/ChaosEvents.php @@ -23,7 +23,7 @@ class ChaosEvents extends Model } public static function getActiveEvents(){ - return self::where('to_date_internal', '>=', today()) + return self::where('active', 1)->where('to_date_internal', '>=', today()) ->where('from_date_internal', '<=', today())->get(); } } diff --git a/lang/de/app.php b/lang/de/app.php index 82f8fa4..a85e401 100644 --- a/lang/de/app.php +++ b/lang/de/app.php @@ -17,6 +17,10 @@ return [ 'contact' => 'Kontakt', 'imprint' => 'Impressum', 'apply' => 'Jetzt beantragen', + 'editTicker' => 'Ticker bearbeiten', + 'editNews' => 'Neuigkeiten bearbeiten', + 'editApplications' => 'Anträge bearbeiten', + 'logout' => 'Abmelden' ], 'about' => [ 'subtitle' => 'Unbeschwertes Einreisen in die stationären sowie temporären CCC Bezirksregionen', @@ -70,7 +74,7 @@ return [ 'title' => 'Vorantrag auf Reisepass gem. § 5 C3GovVerwV', 'content' => 'Bitte wählen Sie eine (temporäre) Bezirksregion aus, um Ihren Vorantrag auf einen Reisepass zu stellen.
Nachdem Sie den Vorantrag abgeschickt haben, erhalten Sie eine Bestätigung via elektronischer Post.', - 'noevent' => 'Es sind derzeit keine (temporären) Bezirksregionen verfügbar.', + 'noevent' => 'Es sind derzeit keine Termine verfügbar.', 'region' => 'Bezirksregion', 'passport_type' => 'Reisepass-Typ', 'passport' => [ @@ -81,7 +85,18 @@ return [ 'firstname' => 'Vorname (Nick)', 'lastname' => 'Nachname (optional)', 'location' => 'Hackspace / Ort (optional)', - 'apply' => 'Vorantrag abschicken' + 'reference_number' => 'Bearbeitungsnummer', + 'created_at' => 'Eingereicht am', + 'actions' => 'Aktionen', + 'apply' => 'Vorantrag abschicken', + 'edit' => [ + 'title' => 'Anträge bearbeiten', + 'description' => 'Hier können Sie Anträge bearbeiten oder löschen.', + 'add' => 'Antrag hinzufügen', + 'save' => 'Speichern', + 'delete' => 'Löschen', + 'generated' => 'Wird generiert' + ] ], 'common' => [ 'error_occurred' => 'Es ist ein Fehler geschehen: ', diff --git a/lang/en/app.php b/lang/en/app.php index f2644bb..1874ed8 100644 --- a/lang/en/app.php +++ b/lang/en/app.php @@ -17,6 +17,10 @@ return [ 'contact' => 'Contact', 'imprint' => 'Imprint', 'apply' => 'Apply now', + 'editTicker' => 'Edit ticker', + 'editNews' => 'Edit news', + 'editApplications' => 'Edit applications', + 'logout' => 'Logout' ], 'about' => [ 'subtitle' => 'Hassle-Free Entry into CCC\'s Permanent and Temporary District Regions', @@ -70,7 +74,7 @@ return [ 'title' => 'Pre-application for Passport according to § 5 C3GovVerwV', 'content' => 'Please select a (temporary) district region to submit your pre-application for a passport.
After you have submitted the pre-application, you will receive a confirmation by e-mail.', - 'noevent' => 'There are currently no (temporary) district regions available.', + 'noevent' => 'Currently, there are no open appointment slots available.', 'region' => 'District region', 'passport_type' => 'Passport type', 'passport' => [ @@ -81,7 +85,18 @@ return [ 'firstname' => 'First name (Nickname)', 'lastname' => 'Last name (optional)', 'location' => 'Hackspace / Location (optional)', - 'apply' => 'Submit pre-application' + 'reference_number' => 'Reference number', + 'created_at' => 'Submitted at', + 'actions' => 'Actions', + 'apply' => 'Submit pre-application', + 'edit' => [ + 'title' => 'Edit applications', + 'description' => 'Here you can edit or delete applications.', + 'add' => 'Add application', + 'save' => 'Save', + 'delete' => 'Delete', + 'generated' => 'Generated' + ] ], 'common' => [ 'error_occurred' => 'An error occurred: ', diff --git a/public/Bilder/kontakt.jpg b/public/Bilder/kontakt.jpg new file mode 100644 index 0000000..b9deb73 Binary files /dev/null and b/public/Bilder/kontakt.jpg differ diff --git a/public/Bilder/neuigkeiten.jpg b/public/Bilder/neuigkeiten.jpg new file mode 100644 index 0000000..8841ea7 Binary files /dev/null and b/public/Bilder/neuigkeiten.jpg differ diff --git a/public/css/style.css b/public/css/style.css index 1ec311b..a8cb660 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -24,6 +24,7 @@ select { height: 3vh; min-height: 24px; flex-shrink: 0; + align-content: center; } .header { @@ -108,6 +109,13 @@ select { padding: 15px; } +.content-img { + width: 33%; + height: 150px; + display: block; + margin: auto; +} + .navbar ul { list-style-type: none; padding: 10px; diff --git a/public/js/preapplication/edit.js b/public/js/preapplication/edit.js new file mode 100644 index 0000000..0b22d89 --- /dev/null +++ b/public/js/preapplication/edit.js @@ -0,0 +1,57 @@ +function addApplication(){ + + let data = {}; + data.district_region = $('#region_new').val(); + data.passport_type = $('#passport_type').val(); + data.mail = $('#mail').val(); + data.first_name = $('#firstname').val(); + data.last_name = $('#lastname').val(); + data.location = $('#location').val(); + + console.log(data); + + $.ajax({ + type: "POST", + url: "/intern/antraege/neu", + data: data, + dataType: "json", + success:function(r){ + if(r.messageStatus === "success"){ + $('#mail').val(""); + $('#firstname').val(""); + $('#lastname').val(""); + $('#location').val(""); + alert(r.errorMessage); + } else { + alert(r.errorMessage); + } + }, + error:function(r, a, e){ + alert(i18n.common.error_occurred + e); + } + }); +} + +function deleteApplication(applicationId){ + let data = {}; + data.id = applicationId; + console.log(data); + if(window.confirm(i18n.blog.confirm_delete)){ + $.ajax({ + type: "DELETE", + url: "/intern/antraege/loeschen", + data: data, + dataType: "json", + success:function(r){ + if(r.messageStatus === "success"){ + alert(r.errorMessage); + } else { + alert(r.errorMessage); + } + }, + error:function(r, a, e){ + alert(i18n.common.error_occurred + e); + } + }); + } +} diff --git a/resources/views/application/edit.blade.php b/resources/views/application/edit.blade.php new file mode 100644 index 0000000..f216be8 --- /dev/null +++ b/resources/views/application/edit.blade.php @@ -0,0 +1,79 @@ +@php + use App\Models\ChaosEvents; +@endphp + +@extends('layout.app') + +@section('scripts') + + +@endsection + +@section('content') +

{{ __("app.preapplication.edit.title") }}

+

{{ __("app.preapplication.edit.description") }}

+ + {{ __('app.preapplication.passport_type') }}
+ d = {{ __('app.preapplication.passport.standard') }}
+ k = {{ __('app.preapplication.passport.kid') }} +

+ + + + + + + + + + + + + + @foreach($applications as $appl) + + + + + + + + + + + + @endforeach + + + + + + + + + + + +
{{ __('app.preapplication.region') }}{{ __('app.preapplication.reference_number') }}{{ __('app.preapplication.firstname') }}{{ __('app.preapplication.lastname') }}{{ __('app.preapplication.location') }}{{ __('app.preapplication.mail') }}{{ __('app.preapplication.passport_type') }}{{ __('app.preapplication.created_at') }}{{ __('app.preapplication.actions') }}
{{ $appl->event()->first()->name }}{{ $appl->reference_number }}{{ $appl->passport_type }}{{ $appl->created_at }}
+ + {{ __('app.preapplication.edit.generated') }} +
+ +@endsection diff --git a/resources/views/content/about.blade.php b/resources/views/content/about.blade.php index 5ad6b49..e92f35a 100644 --- a/resources/views/content/about.blade.php +++ b/resources/views/content/about.blade.php @@ -3,6 +3,7 @@ @endsection @section('content') +

{{ __('app.nav.about') }}

{{ __('app.about.subtitle') }}

diff --git a/resources/views/content/contact.blade.php b/resources/views/content/contact.blade.php index c00b0d6..a2ed4d2 100644 --- a/resources/views/content/contact.blade.php +++ b/resources/views/content/contact.blade.php @@ -3,6 +3,7 @@ @endsection @section('content') + Contact

{{ __('app.contact.title') }}


{!! __('app.contact.content') !!} diff --git a/resources/views/content/imprint.blade.php b/resources/views/content/imprint.blade.php index c9e515b..17969fd 100644 --- a/resources/views/content/imprint.blade.php +++ b/resources/views/content/imprint.blade.php @@ -3,7 +3,8 @@ @endsection @section('content') +

{{ __('app.imprint.title') }}


-

{!! __('app.imprint.content') !!}

+

{!! __('app.imprint.content') !!}

@endsection diff --git a/resources/views/content/index.blade.php b/resources/views/content/index.blade.php index 7b62285..8be92c2 100644 --- a/resources/views/content/index.blade.php +++ b/resources/views/content/index.blade.php @@ -1,5 +1,6 @@ @extends('layout.app') @section('content') -

Guten Tag.

+ +

Guten Tag.

@endsection diff --git a/resources/views/content/news.blade.php b/resources/views/content/news.blade.php index 9d81d8f..7f5b7de 100644 --- a/resources/views/content/news.blade.php +++ b/resources/views/content/news.blade.php @@ -3,6 +3,7 @@ @endsection @section('content') +

{{ __('app.nav.news') }}

@foreach($blogs as $blog)

{{ $blog->title }}

diff --git a/resources/views/content/services.blade.php b/resources/views/content/services.blade.php index c9fcd1c..7c1c30a 100644 --- a/resources/views/content/services.blade.php +++ b/resources/views/content/services.blade.php @@ -5,15 +5,22 @@ @section('content')

{{ __('app.services.title') }}


+

{{ __('app.services.topic1.title') }}

{!! __('app.services.topic1.content') !!}

-
+

+ +

{{ __('app.services.topic2.title') }}

{!! __('app.services.topic2.content') !!}

-
+

+ +

{{ __('app.services.topic3.title') }}

{!! __('app.services.topic3.content') !!}

-
+

+ +

{{ __('app.services.topic4.title') }}

{!! __('app.services.topic4.content') !!}


diff --git a/resources/views/layout/app.blade.php b/resources/views/layout/app.blade.php index 1ecb6bb..912f581 100644 --- a/resources/views/layout/app.blade.php +++ b/resources/views/layout/app.blade.php @@ -45,10 +45,10 @@
  • {{ __('app.nav.apply') }}
  • @auth
    -
  • Ticker bearbeiten
  • -
  • Nachrichten bearbeiten
  • -
  • Abmelden
  • - +
  • {{ __('app.nav.editTicker') }}
  • +
  • {{ __('app.nav.editNews') }}
  • +
  • {{ __('app.nav.editApplications') }}
  • +
  • {{ __('app.nav.logout') }}
  • @endauth
    diff --git a/routes/web.php b/routes/web.php index 8e83e13..caaba57 100644 --- a/routes/web.php +++ b/routes/web.php @@ -39,3 +39,8 @@ Route::get('/intern/nachrichten', [WebsiteController::class, 'editNews'])->name( Route::post('/intern/nachrichten/add', [BlogController::class, 'addBlog']); Route::delete('/intern/nachrichten/delete', [BlogController::class, 'deleteBlog']); Route::put('/intern/nachrichten/edit', [BlogController::class, 'editBlog']); + +Route::get('/intern/antraege', [WebsiteController::class, 'editApplications'])->name('editApplications'); +Route::post('/intern/antraege/add', [PreApplicationController::class, 'addApplication']); +Route::delete('/intern/antraege/delete', [PreApplicationController::class, 'deleteApplication']); +Route::put('/intern/antraege/edit', [PreApplicationController::class, 'editApplication']);