Replace checkins list with partial in email template

This commit is contained in:
Ben Goldsworthy 2022-11-28 13:49:14 -06:00
parent 8dc74febcf
commit 33f9a8584d
3 changed files with 6 additions and 22 deletions

View file

@ -33,7 +33,7 @@ class Digest extends Mailable
*
* @var string
*/
public $checkins;
public $checkinsList;
/**
* Create a new message instance.
@ -72,8 +72,8 @@ class Digest extends Mailable
}
);
$this->checkins = array_filter(
$trip->checkins,
$this->checkinsList = array_filter(
$trip->checkinsList,
function($elem) use ($cutoffDateTime) {
$elemDateTime = new DateTime($elem->created_at);
return $elemDateTime > $cutoffDateTime;

View file

@ -37,24 +37,9 @@
<p>View the tracker <a href="https://track.bengoldsworthy.net">here.</a></p>
<hr>
<h2>Checkins</h2>
@if($checkins)
@if($checkinsList)
<ol>
@foreach($checkins as $checkin)
<li>
<details class="checkin" id="{{ $checkin->id }}">
<summary class="checkin__summary">
<h3 class="checkin__title">{!! $checkin->title ?? "<i>Untitled</i>" !!}</h3>
<p class="checkin__meta">{!! render_date_difference($checkin->date) !!}</p>
</summary>
@if($checkin->note)
{!! $checkin->note !!}
@endif
@if($checkin->image_url)
<img class="popup__image" loading="lazy" src="{{ $checkin->image_url }}">
@endif
</details>
</li>
@endforeach
@include('partials.checkins-list')
</ol>
@else
<p>No new checkins</p>

View file

@ -38,8 +38,7 @@
@php $checkinsList = array_slice(array_reverse($trip->checkins), 0, 10) @endphp
@endif
@include('partials.checkin-list')
@include('partials.checkins-list')
</ol>
@if (!$showAllCheckins)
<p><a id="allCheckinsLink" href="?show=all">Show all checkins</a></p>