Compare commits
2 Commits
7783f4dc18
...
48d329e503
Author | SHA1 | Date | |
---|---|---|---|
48d329e503 | |||
d20a62ad48 |
@ -124,6 +124,25 @@ class Domain extends Model
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function filearea_stats()
|
||||||
|
{
|
||||||
|
$dt = Carbon::now()->startOfday();
|
||||||
|
$case = CaseBuilder::whenRaw("datetime >= '?'",$dt->subDays(7)->format('Y-m-d'))->thenRaw("'week'")
|
||||||
|
->whenRaw("datetime >= '?'",$dt->subMonth()->format('Y-m-d'))->thenRaw("'month'")
|
||||||
|
->elseRaw("'all'");
|
||||||
|
|
||||||
|
return Filearea::select(['fileareas.id','fileareas.name','description','active',DB::raw('count(files.id) AS count'),DB::raw('min(datetime) as first_file'),DB::raw('max(datetime) as last_file')])
|
||||||
|
->selectRaw($case->toRaw().' AS stats')
|
||||||
|
->join('files',['files.filearea_id'=>'fileareas.id'],NULL,NULL,'left outer')
|
||||||
|
->where('domain_id',$this->id)
|
||||||
|
->groupBy('fileareas.id')
|
||||||
|
->groupBy('fileareas.name')
|
||||||
|
->groupBy('stats')
|
||||||
|
->orderBy('fileareas.name')
|
||||||
|
->orderBy('last_file','DESC')
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if this zone is managed by this host
|
* Determine if this zone is managed by this host
|
||||||
*
|
*
|
||||||
|
@ -11,6 +11,11 @@ class Filearea extends Model
|
|||||||
{
|
{
|
||||||
use SoftDeletes,ScopeActive,AreaSecurity;
|
use SoftDeletes,ScopeActive,AreaSecurity;
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'first_file' => 'datetime:Y-m-d H:i:s',
|
||||||
|
'last_file' => 'datetime:Y-m-d H:i:s',
|
||||||
|
];
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
];
|
];
|
||||||
@ -26,4 +31,9 @@ class Filearea extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(Domain::class);
|
return $this->belongsTo(Domain::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function files()
|
||||||
|
{
|
||||||
|
return $this->hasMany(File::class);
|
||||||
|
}
|
||||||
}
|
}
|
@ -58,10 +58,10 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($o->echoarea_stats()->groupBy('id') as $oo)
|
@foreach ($o->echoarea_stats()->groupBy('id') as $oo)
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 15%;"><a href="{{ url('echoarea/addedit',[($x=$oo->first())->id]) }}">{{ $x->name }}</a></td>
|
<td style="width: 10%;"><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>{{ ($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>{{ $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>
|
||||||
<td class="text-end">{{ number_format($oo->where('stats','week')->pop()?->count) }}</td>
|
<td class="text-end">{{ number_format($oo->where('stats','week')->pop()?->count) }}</td>
|
||||||
@ -88,21 +88,35 @@
|
|||||||
<div class="accordion-body">
|
<div class="accordion-body">
|
||||||
@if($o->fileareas->count())
|
@if($o->fileareas->count())
|
||||||
<p>This network provides the following File areas:</p>
|
<p>This network provides the following File areas:</p>
|
||||||
<table class="table monotable" id="filearea">
|
<table class="table monotable w-100" id="filearea">
|
||||||
<thead>
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="w-75" colspan="4"></th>
|
||||||
|
<th colspan="4" class="text-center">Files</th>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Filearea</th>
|
<th>Filearea</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
<th>Last File Sent</th>
|
<th>First File</th>
|
||||||
|
<th>Last File</th>
|
||||||
|
<th>Area Active</th>
|
||||||
|
<th class="text-end">Week</th>
|
||||||
|
<th class="text-end">Month</th>
|
||||||
|
<th class="text-end">Total</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($o->fileareas->sortBy('name') as $oo)
|
@foreach ($o->filearea_stats()->groupBy('id') as $oo)
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 15%;"><a href="{{ url('filearea/addedit',[$oo->id]) }}">{{ $oo->name }}</a></td>
|
<td style="width: 10%;"><a href="{{ url('filearea/addedit',[($x=$oo->first())->id]) }}">{{ $x->name }}</a></td>
|
||||||
<td>{{ $oo->description }}</td>
|
<td>{{ $x->description }}</td>
|
||||||
<td style="width: 15%;">-</td>
|
<td>{{ ($xx=$oo->min('first_file')) ? $xx->format('Y-m-d H:i') : '-' }}</td>
|
||||||
|
<td>{{ $x->last_file ? $x->last_file->format('Y-m-d H:i') : '-' }}</td>
|
||||||
|
<td>{{ $x->active ? 'Active' : 'Archive' }}</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->sum('count')) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -247,7 +261,16 @@
|
|||||||
conditionalPaging: {
|
conditionalPaging: {
|
||||||
style: 'fade',
|
style: 'fade',
|
||||||
speed: 500 // optional
|
speed: 500 // optional
|
||||||
}
|
},
|
||||||
|
rowGroup: {
|
||||||
|
dataSrc: [4],
|
||||||
|
},
|
||||||
|
columnDefs: [
|
||||||
|
{
|
||||||
|
targets: [4],
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#system').DataTable({
|
$('#system').DataTable({
|
||||||
|
@ -150,5 +150,61 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
@if ($o->files->count())
|
||||||
|
<table class="table monotable" id="files">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>File</th>
|
||||||
|
<th>Size</th>
|
||||||
|
<th>Hatched</th>
|
||||||
|
<th>Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@foreach ($o->files as $oo)
|
||||||
|
<tr>
|
||||||
|
<td><a href="{{ url('file/view',[$oo->id]) }}">{{ $oo->id }}</a></td>
|
||||||
|
<td>{{ $oo->name }}</td>
|
||||||
|
<td class="text-end">{{ number_format($oo->size) }}</td>
|
||||||
|
<td>{{ $oo->datetime->format('Y-m-d H:i:s') }}</td>
|
||||||
|
<td><small>{{ $oo->desc }}</small></td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
@else
|
||||||
|
<p>No files yet in this area.</p>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
@section('page-css')
|
||||||
|
@css('datatables')
|
||||||
|
@append
|
||||||
|
|
||||||
|
@section('page-scripts')
|
||||||
|
@js('datatables')
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#files').DataTable({
|
||||||
|
paging: true,
|
||||||
|
pageLength: 25,
|
||||||
|
searching: true,
|
||||||
|
ordering: true,
|
||||||
|
order: [1,'asc'],
|
||||||
|
conditionalPaging: {
|
||||||
|
style: 'fade',
|
||||||
|
speed: 500 // optional
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@append
|
Loading…
Reference in New Issue
Block a user