Add total messages to domain view, and improve echoarea stats query

This commit is contained in:
2023-07-30 20:14:38 +10:00
parent 61f64c7c75
commit 7ca6fdc195
3 changed files with 29 additions and 20 deletions

View File

@@ -34,7 +34,7 @@
<thead>
<tr>
<th class="w-75" colspan="4"></th>
<th colspan="3" class="text-center">Messages</th>
<th colspan="4" class="text-center">Messages</th>
</tr>
<tr>
<th>Echoarea</th>
@@ -44,19 +44,21 @@
<th class="text-end">Day</th>
<th class="text-end">Week</th>
<th class="text-end">Month</th>
<th class="text-end">Total</th>
</tr>
</thead>
<tbody>
@foreach ($o->latest_echomail_message() as $oo)
@foreach ($o->echoarea_stats()->groupBy('id') as $oo)
<tr>
<td style="width: 15%;"><a href="{{ url('ftn/echoarea/addedit',[$oo->id]) }}">{{ $oo->name }}</a></td>
<td>{{ $oo->description }}</td>
<td style="width: 15%;">{{ $oo->last_message ? $oo->last_message->format('Y-m-d H:i') : '-' }}</td>
<td>{{ $oo->active ? 'Active' : 'Archive' }}</td>
<td class="text-end">{{ number_format($oo->messages_count(1)) }}</td>
<td class="text-end">{{ number_format($oo->messages_count(7)) }}</td>
<td class="text-end">{{ number_format($oo->messages_count(30)) }}</td>
<td style="width: 15%;"><a href="{{ url('ftn/echoarea/addedit',[($x=$oo->first())->id]) }}">{{ $x->name }}</a></td>
<td>{{ $x->description }}</td>
<td style="width: 15%;">{{ $x->last_message ? $x->last_message->format('Y-m-d H:i') : '-' }}</td>
<td>{{ $x->active ? 'Active' : 'Archive' }}</td>
<td class="text-end">{{ number_format($oo->where('stats','day')->pop()?->count) }}</td>
<td class="text-end">{{ number_format($oo->where('stats','week')->pop()?->count) }}</td>
<td class="text-end">{{ number_format($oo->where('stats','month')->pop()?->count) }}</td>
<td class="text-end">{{ number_format($oo->where('stats','all')->pop()?->count) }}</td>
</tr>
@endforeach
</tbody>