From f58b193c4e86c3b5892d45ebab7f8d2f5cc0fa85 Mon Sep 17 00:00:00 2001 From: Lukas Halbritter Date: Fri, 5 Oct 2018 19:38:47 +0200 Subject: [PATCH] Implemented deletion of bookings. --- app/Http/Controllers/BookingsController.php | 8 +++- resources/views/bookings/delete.blade.php | 43 +++++++++++++++++++++ resources/views/bookings/index.blade.php | 9 ++++- 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 resources/views/bookings/delete.blade.php diff --git a/app/Http/Controllers/BookingsController.php b/app/Http/Controllers/BookingsController.php index e445c41..c39cbe9 100644 --- a/app/Http/Controllers/BookingsController.php +++ b/app/Http/Controllers/BookingsController.php @@ -213,7 +213,9 @@ class BookingsController extends Controller */ public function delete(Booking $booking) { - // + $booking->load('subBookings.accountType.accountClass.ioType'); + + return view('/bookings/delete', compact('booking')); } /** @@ -224,7 +226,9 @@ class BookingsController extends Controller */ public function destroy(Booking $booking) { - // + $booking->delete(); + + return redirect('/bookings/year-' . Carbon::parse(request('date'))->format('Y')); } /** diff --git a/resources/views/bookings/delete.blade.php b/resources/views/bookings/delete.blade.php new file mode 100644 index 0000000..73e50b3 --- /dev/null +++ b/resources/views/bookings/delete.blade.php @@ -0,0 +1,43 @@ +@extends('layout.master') + +@section('title', 'Buchung löschen') + +@section('subnav') + Zurück +@endsection + +@section('content') +

@yield('title')

+
+ {{ method_field('delete') }} + {{ csrf_field() }} +

Soll folgende Buchung und alle ihre Teilbuchungen wirklich gelöscht + werden?

+ + + + + + + + + + + + + + + @foreach($booking->subBookings as $subBooking) + + + + + + + @endforeach +
DatumPositionenPerson / FirmaBetrag
{{ $booking->date }}{{ $booking->reference }}{{ $booking->person_or_company }}{{ formatAmount($booking->signedAmount(), true, true) }}
{{ $subBooking->reference }}{{ formatAmount($subBooking->signedAmount(), true, true) }}
+ + +
+@endsection + diff --git a/resources/views/bookings/index.blade.php b/resources/views/bookings/index.blade.php index 43ffccb..c4e0c9f 100644 --- a/resources/views/bookings/index.blade.php +++ b/resources/views/bookings/index.blade.php @@ -14,6 +14,7 @@ + @@ -28,6 +29,7 @@ @if (date('Y') > $year or (date('Y') == $year and date('m') >= $month)) + @@ -47,6 +49,9 @@ v @endif + + + - @for ($i = 0; $i < 9; $i++) + @for ($i = 0; $i < 10; $i++) @endfor
ID Datum
{{ startOfMonth($year, $month) }} + x + {{ $booking->id }} @@ -82,6 +87,7 @@ + {{ $subBooking->reference }} @@ -110,6 +116,7 @@ @if (date('Y') > $year or (date('Y') == $year and date('m') >= $month))
@@ -136,7 +143,7 @@