Transferred the loading of the arrays for the booking forms into a own separate

method.
Impemented the booking.edit view and controller method.
Fixed the bug in the bookings.index view that only months with cashflow are
listed.
This commit is contained in:
Lukas Halbritter
2018-10-04 23:10:58 +02:00
parent 20859fe4a9
commit ac49d3857f
3 changed files with 122 additions and 1 deletions
+4
View File
@@ -0,0 +1,4 @@
@extends('layout.forms.bookings.edit')
@section('title', 'Buchung bearbeiten')
+7 -1
View File
@@ -25,7 +25,8 @@
<th>Projekt</th>
</tr>
@for ($month = 1; $month <= 12; $month++)
@if (isset($bookings[$month]))
@if (date('Y') > $year
or (date('Y') == $year and date('m') >= $month))
<tr style='color: red; font-weight: bold'>
<td></td>
<td></td>
@@ -37,6 +38,8 @@
<td></td>
<td></td>
</tr>
@endif
@if (isset($bookings[$month]))
@foreach($bookings[$month] as $booking)
<tr>
<td>
@@ -99,6 +102,9 @@
@endforeach
@endif
@endforeach
@endif
@if (date('Y') > $year
or (date('Y') == $year and date('m') >= $month))
<tr style='color: #000080; font-weight: bold'>
<td></td>
<td></td>
@@ -0,0 +1,111 @@
@extends('layout.master')
@section('subnav')
<a href='{{ url()->previous() }}'>Zurück</a>
@endsection
@section('content')
<h1>@yield('title')</h1>
<form action="/bookings/{{ $booking->id }}" method='post'>
{{ method_field('patch') }}
{{ csrf_field() }}
<h2>Allgemeine Buchungsinformationen</h2>
<table>
<tr>
<td>{{ Form::label('date', 'Datum') }}</td>
<td>{{ Form::date('date', $booking->date) }}</td>
</tr>
<tr>
<td>{{ Form::label('booking_reference', 'Buchungstext') }}</td>
<td>{{ Form::text('booking_reference', $booking->reference) }}</td>
</tr>
<tr>
<td>{{ Form::label('person_or_company', 'Person / Firma') }}</td>
<td>{{ Form::text('person_or_company', $booking->person_or_company) }}</td>
</tr>
<tr>
<td>{{ Form::label('note', 'Anmerkung') }}</td>
<td>{{ Form::textarea('note', $booking->note) }}</td>
</tr>
</table>
<h2>Teilbuchungen</h2>
<table>
<tr>
<th>Betrag</th>
<th>Konto</th>
<th>Personenkonto</th>
<th>Projekt</th>
</tr>
@foreach ($booking->subBookings as $subBooking)
<tr>
<td>{{ Form::text('amount', $subBooking->amount) }}</td>
<td>
{{
Form::select(
'account_type_id',
$accountTypeArray,
$subBooking->account_type_id,
['placeholder' => 'Hier auswählen ...']
)
}}
</td>
<td>
{{
Form::select(
'person_target_id',
$openTargetsArray,
$subBooking->person_target_id,
['placeholder' => 'Hier auswählen ...']
)
}}
</td>
<td>
{{
Form::select(
'project_id',
$projectsArray,
$subBooking->project_id,
['placeholder' => 'Hier auswählen ...']
)
}}
</td>
</tr>
@endforeach
<tr>
<td>{{ Form::text('amount') }}</td>
<td>
{{
Form::select(
'account_type_id',
$accountTypeArray,
'placeholder',
['placeholder' => 'Hier auswählen ...']
)
}}
</td>
<td>
{{
Form::select(
'person_target_id',
$openTargetsArray,
'placeholder',
['placeholder' => 'Hier auswählen ...']
)
}}
</td>
<td>
{{
Form::select(
'project_id',
$projectsArray,
'placeholder',
['placeholder' => 'Hier auswählen ...']
)
}}
</td>
</tr>
</table>
<button type="submit" id="submit">Speichern</button>
</form>
@endsection