Monthly summarys now are only displayed for months after the first booking.

This commit is contained in:
Lukas Halbritter
2018-10-12 12:05:04 +02:00
parent aee30b2a2f
commit ae6238a0b4
2 changed files with 27 additions and 4 deletions
+9
View File
@@ -109,4 +109,13 @@ class Booking extends Model
{ {
return $this->subBookings->count() === 1; return $this->subBookings->count() === 1;
} }
/**
* Get the date of the very first booking.
*
* @return string
*/
public static function firstDate() {
return Booking::min('date');
}
} }
+18 -4
View File
@@ -25,8 +25,15 @@
<th>Projekt</th> <th>Projekt</th>
</tr> </tr>
@for ($month = 1; $month <= 12; $month++) @for ($month = 1; $month <= 12; $month++)
@if (date('Y') > $year @if ((
or (date('Y') == $year and date('m') >= $month)) date('Y') > $year
or (date('Y') == $year
and date('m') >= $month)
) and (
$firstDate['Y'] < $year
or $firstDate['Y'] == $year
and $firstDate['m'] <= $month
))
<tr style='color: red; font-weight: bold'> <tr style='color: red; font-weight: bold'>
<td></td> <td></td>
<td></td> <td></td>
@@ -105,8 +112,15 @@
@endif @endif
@endforeach @endforeach
@endif @endif
@if (date('Y') > $year @if ((
or (date('Y') == $year and date('m') >= $month)) date('Y') > $year
or (date('Y') == $year
and date('m') >= $month)
) and (
$firstDate['Y'] < $year
or $firstDate['Y'] == $year
and $firstDate['m'] <= $month
))
<tr style='color: #000080; font-weight: bold'> <tr style='color: #000080; font-weight: bold'>
<td></td> <td></td>
<td></td> <td></td>