Compare commits
2 commits
77aaf4748f
...
85d4c19693
Author | SHA1 | Date | |
---|---|---|---|
85d4c19693 | |||
6eaaff513c |
4 changed files with 41 additions and 21 deletions
|
@ -34,13 +34,26 @@ class TrackerController extends Controller
|
||||||
if (!$tripId) return view('no-trip');
|
if (!$tripId) return view('no-trip');
|
||||||
|
|
||||||
$viewMode = $request->input('show', null);
|
$viewMode = $request->input('show', null);
|
||||||
|
$fromCheckin = $request->input('from', null);
|
||||||
|
$toCheckin = $request->input('to', null);
|
||||||
|
|
||||||
$tripData = $this->get_trip_data($tripId);
|
$tripData = $this->get_trip_data($tripId);
|
||||||
|
|
||||||
|
if ($fromCheckin) {
|
||||||
|
$tripData->checkins = array_filter($tripData->checkins, function($key) use ($fromCheckin) { return $key >= $fromCheckin; }, ARRAY_FILTER_USE_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($toCheckin) {
|
||||||
|
$tripData->checkins = array_filter($tripData->checkins, function($key) use ($toCheckin) { return $key <= $toCheckin; }, ARRAY_FILTER_USE_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
return view(
|
return view(
|
||||||
'tracker',
|
'tracker',
|
||||||
[
|
[
|
||||||
'trip' => $tripData,
|
'trip' => $tripData,
|
||||||
'showAllCheckins' => ($viewMode === 'all')
|
'showAllCheckins' => ($viewMode === 'all'),
|
||||||
|
'fromCheckin' => $fromCheckin,
|
||||||
|
'toCheckin' => $toCheckin
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,9 @@ class Digest extends Mailable
|
||||||
case 'weekly':
|
case 'weekly':
|
||||||
$cutoffDateTime->modify('-1 week');
|
$cutoffDateTime->modify('-1 week');
|
||||||
break;
|
break;
|
||||||
|
case 'fortnightly':
|
||||||
|
$cutoffDateTime->modify('-2 weeks');
|
||||||
|
break;
|
||||||
case 'monthly':
|
case 'monthly':
|
||||||
$cutoffDateTime->modify('-1 month');
|
$cutoffDateTime->modify('-1 month');
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -37,8 +37,9 @@
|
||||||
<p>View the tracker <a href="https://track.bengoldsworthy.net">here.</a></p>
|
<p>View the tracker <a href="https://track.bengoldsworthy.net">here.</a></p>
|
||||||
<hr>
|
<hr>
|
||||||
<h2>Checkins</h2>
|
<h2>Checkins</h2>
|
||||||
<ol>
|
@if($checkins)
|
||||||
@foreach($checkins as $checkin)
|
<ol>
|
||||||
|
@foreach($checkins as $checkin)
|
||||||
<li>
|
<li>
|
||||||
<details class="checkin" id="{{ $checkin->id }}">
|
<details class="checkin" id="{{ $checkin->id }}">
|
||||||
<summary class="checkin__summary">
|
<summary class="checkin__summary">
|
||||||
|
@ -53,5 +54,8 @@
|
||||||
@endif
|
@endif
|
||||||
</details>
|
</details>
|
||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
</ol>
|
</ol>
|
||||||
|
@else
|
||||||
|
<p>No new checkins</p>
|
||||||
|
@endif
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
</section>
|
</section>
|
||||||
<section id="checkinList">
|
<section id="checkinList">
|
||||||
<h2 class="section__title">@if ($showAllCheckins) Check-ins @else Recent Check-ins @endif</h2>
|
<h2 class="section__title">@if ($showAllCheckins) Check-ins @else Recent Check-ins @endif</h2>
|
||||||
<ol start="{{ count($trip->checkins) }}" reversed>
|
<ol start="{{ $toCheckin ?? count($trip->checkins) }}" reversed>
|
||||||
@if($showAllCheckins)
|
@if($showAllCheckins || $toCheckin || $fromCheckin)
|
||||||
@php $checkinsList = array_reverse($trip->checkins) @endphp
|
@php $checkinsList = array_reverse($trip->checkins) @endphp
|
||||||
@else
|
@else
|
||||||
@php $checkinsList = array_slice(array_reverse($trip->checkins), 0, 10) @endphp
|
@php $checkinsList = array_slice(array_reverse($trip->checkins), 0, 10) @endphp
|
||||||
|
|
Loading…
Reference in a new issue