Add first message date to domain echoarea list
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 41s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 2m2s
Create Docker Image / Final Docker Image Manifest (push) Successful in 11s

This commit is contained in:
Deon George 2024-09-09 13:30:45 +10:00
parent 75f5424d4f
commit 967aadf21d
3 changed files with 12 additions and 7 deletions

View File

@ -94,7 +94,7 @@ class Domain extends Model
->whenRaw("datetime >= '?'",$dt->subMonth()->format('Y-m-d'))->thenRaw("'month'") ->whenRaw("datetime >= '?'",$dt->subMonth()->format('Y-m-d'))->thenRaw("'month'")
->elseRaw("'all'"); ->elseRaw("'all'");
return Echoarea::select(['echoareas.id','name','description','active',DB::raw('count(echomails.id) AS count'),DB::raw('max(datetime) as last_message')]) return Echoarea::select(['echoareas.id','name','description','active',DB::raw('count(echomails.id) AS count'),DB::raw('min(datetime) as first_message'),DB::raw('max(datetime) as last_message')])
->selectRaw($case->toRaw().' AS stats') ->selectRaw($case->toRaw().' AS stats')
->join('echomails',['echomails.echoarea_id'=>'echoareas.id'],NULL,NULL,'left outer') ->join('echomails',['echomails.echoarea_id'=>'echoareas.id'],NULL,NULL,'left outer')
->where('domain_id',$this->id) ->where('domain_id',$this->id)

View File

@ -46,7 +46,8 @@ class Echoarea extends Model
private const CACHE_TIME = 3600; private const CACHE_TIME = 3600;
protected $casts = [ protected $casts = [
'last_message' => 'datetime:Y-m-d H:i:s' 'first_message' => 'datetime:Y-m-d H:i:s',
'last_message' => 'datetime:Y-m-d H:i:s',
]; ];
/* RELATIONS */ /* RELATIONS */

View File

@ -1,4 +1,6 @@
<!-- $o = Domain::class --> <!-- $o=Domain::class -->
@use(Illuminate\Mail\Markdown)
@extends('layouts.app') @extends('layouts.app')
@section('htmlheader_title') @section('htmlheader_title')
{{ $o->name }} {{ $o->name }}
@ -19,7 +21,7 @@
<div id="collapse_about" class="accordion-collapse collapse show" aria-labelledby="about" data-bs-parent="#accordion_homepage"> <div id="collapse_about" class="accordion-collapse collapse show" aria-labelledby="about" data-bs-parent="#accordion_homepage">
<div class="accordion-body"> <div class="accordion-body">
<div class="float-end" style="max-height: 25em;" id="network_traffic"></div> <div class="float-end" style="max-height: 25em;" id="network_traffic"></div>
{!! \Illuminate\Mail\Markdown::parse($o->homepage) !!} {!! Markdown::parse($o->homepage) !!}
</div> </div>
</div> </div>
</div> </div>
@ -43,6 +45,7 @@
<tr> <tr>
<th>Echoarea</th> <th>Echoarea</th>
<th>Description</th> <th>Description</th>
<th>First Message</th>
<th>Last Message</th> <th>Last Message</th>
<th>Area Active</th> <th>Area Active</th>
<th class="text-end">Day</th> <th class="text-end">Day</th>
@ -57,6 +60,7 @@
<tr> <tr>
<td style="width: 15%;"><a href="{{ url('echoarea/addedit',[($x=$oo->first())->id]) }}">{{ $x->name }}</a></td> <td style="width: 15%;"><a href="{{ url('echoarea/addedit',[($x=$oo->first())->id]) }}">{{ $x->name }}</a></td>
<td>{{ $x->description }}</td> <td>{{ $x->description }}</td>
<td style="width: 15%;">{{ ($xx=$oo->min('first_message')) ? $xx->format('Y-m-d H:i') : '-' }}</td>
<td style="width: 15%;">{{ $x->last_message ? $x->last_message->format('Y-m-d H:i') : '-' }}</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>{{ $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','day')->pop()?->count) }}</td>
@ -218,17 +222,17 @@
pageLength: 25, pageLength: 25,
searching: true, searching: true,
ordering: true, ordering: true,
order: [[3,'asc'],[1,'asc']], order: [[4,'asc'],[1,'asc']],
conditionalPaging: { conditionalPaging: {
style: 'fade', style: 'fade',
speed: 500 // optional speed: 500 // optional
}, },
rowGroup: { rowGroup: {
dataSrc: [3], dataSrc: [4],
}, },
columnDefs: [ columnDefs: [
{ {
targets: [3], targets: [4],
visible: false, visible: false,
}, },
], ],