This commit is contained in:
parent
00f39f15f4
commit
d1277a2b4a
@ -78,30 +78,32 @@ class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
view()->composer('layouts.app', function($view){
|
||||
|
||||
// 未対応のみ集計
|
||||
$stats = DB::table('operator_que')
|
||||
->selectRaw("
|
||||
SUM(CASE WHEN que_status IN (1,2) AND que_class < 100 THEN 1 ELSE 0 END) AS task_total,
|
||||
MAX(CASE WHEN que_status IN (1,2) AND que_class < 100 THEN created_at END) AS task_latest,
|
||||
SUM(CASE WHEN que_status IN (1,2) AND que_class > 99 THEN 1 ELSE 0 END) AS hard_total,
|
||||
MAX(CASE WHEN que_status IN (1,2) AND que_class > 99 THEN created_at END) AS hard_latest
|
||||
SUM(CASE WHEN que_status = 1 AND que_class < 100 THEN 1 ELSE 0 END) AS task_untreated,
|
||||
MAX(CASE WHEN que_status = 1 AND que_class < 100 THEN created_at END) AS task_latest,
|
||||
SUM(CASE WHEN que_status = 1 AND que_class > 99 THEN 1 ELSE 0 END) AS hard_untreated,
|
||||
MAX(CASE WHEN que_status = 1 AND que_class > 99 THEN created_at END) AS hard_latest
|
||||
")
|
||||
->first();
|
||||
|
||||
$taskCount = (int)($stats->task_total ?? 0);
|
||||
$hardCount = (int)($stats->hard_total ?? 0);
|
||||
// 変数名は互換維持(内容は未対応件数)
|
||||
$taskCount = (int)($stats->task_untreated ?? 0);
|
||||
$hardCount = (int)($stats->hard_untreated ?? 0);
|
||||
$taskLatest = $stats->task_latest ?? null;
|
||||
$hardLatest = $stats->hard_latest ?? null;
|
||||
|
||||
// 最新5件 (未対応/作業中)
|
||||
// ドロップダウン最新5件 も未対応のみ
|
||||
$latestTasks = DB::table('operator_que')
|
||||
->whereIn('que_status',[1,2])
|
||||
->where('que_status',1)
|
||||
->where('que_class','<',100)
|
||||
->orderByDesc('created_at')
|
||||
->limit(5)
|
||||
->get();
|
||||
|
||||
$latestHards = DB::table('operator_que')
|
||||
->whereIn('que_status',[1,2])
|
||||
->where('que_status',1)
|
||||
->where('que_class','>',99)
|
||||
->orderByDesc('created_at')
|
||||
->limit(5)
|
||||
|
||||
@ -198,9 +198,58 @@
|
||||
</div>
|
||||
|
||||
<!-- ページネーション -->
|
||||
<div class="mt-2">
|
||||
{{ $jobs->links() }}
|
||||
@php
|
||||
$paginator = $jobs;
|
||||
$current = $paginator->currentPage();
|
||||
$last = $paginator->lastPage();
|
||||
$query = request()->except('page');
|
||||
$pages = [];
|
||||
if($last <= 20){
|
||||
$pages = range(1,$last);
|
||||
}else{
|
||||
$pages[] = 1;
|
||||
if($current > 4) $pages[] = '...L';
|
||||
$windowStart = max(2, $current - 2);
|
||||
$windowEnd = min($last-1, $current + 2);
|
||||
for($i=$windowStart; $i<=$windowEnd; $i++){
|
||||
$pages[] = $i;
|
||||
}
|
||||
if($current < $last - 3) $pages[] = '...R';
|
||||
$pages[] = $last;
|
||||
}
|
||||
function pageUrl($page,$query){
|
||||
return url()->current() . '?' . http_build_query(array_merge($query,['page'=>$page]));
|
||||
}
|
||||
@endphp
|
||||
@if($last > 1)
|
||||
<div class="mt-2 d-flex justify-content-start">
|
||||
<nav aria-label="ページネーション" class="custom-pagination">
|
||||
<ul class="pagination pagination-sm mb-0">
|
||||
<li class="page-item {{ $current==1?'disabled':'' }}">
|
||||
<a class="page-link" href="{{ $current==1?'#':pageUrl(1,$query) }}">‹‹</a>
|
||||
</li>
|
||||
<li class="page-item {{ $current==1?'disabled':'' }}">
|
||||
<a class="page-link" href="{{ $current==1?'#':pageUrl($current-1,$query) }}">‹</a>
|
||||
</li>
|
||||
@foreach($pages as $p)
|
||||
@if(is_string($p) && str_starts_with($p,'...'))
|
||||
<li class="page-item disabled"><span class="page-link">…</span></li>
|
||||
@else
|
||||
<li class="page-item {{ $p==$current?'active':'' }}">
|
||||
<a class="page-link" href="{{ $p==$current?'#':pageUrl($p,$query) }}">{{ $p }}</a>
|
||||
</li>
|
||||
@endif
|
||||
@endforeach
|
||||
<li class="page-item {{ $current==$last?'disabled':'' }}">
|
||||
<a class="page-link" href="{{ $current==$last?'#':pageUrl($current+1,$query) }}">›</a>
|
||||
</li>
|
||||
<li class="page-item {{ $current==$last?'disabled':'' }}">
|
||||
<a class="page-link" href="{{ $current==$last?'#':pageUrl($last,$query) }}">››</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
</span>
|
||||
<div class="dropdown-divider"></div>
|
||||
@foreach($latestHards as $hq)
|
||||
<a href="{{ route('information', ['type'=>'hard','status'=>'untreated']) }}" class="dropdown-item"
|
||||
<a href="{{ route('information', ['type'=>'hard','status'=>'untreated','period'=>'all']) }}" class="dropdown-item"
|
||||
style="white-space:normal;">
|
||||
{{ Str::limit($hq->que_comment ?? 'ハード異常', 40) }}
|
||||
<span class="float-right text-muted text-sm">
|
||||
@ -98,7 +98,7 @@
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
@endforeach
|
||||
<a href="{{ route('information', ['type'=>'hard']) }}" class="dropdown-item dropdown-footer">
|
||||
<a href="{{ route('information', ['type'=>'hard','period'=>'all']) }}" class="dropdown-item dropdown-footer">
|
||||
すべてを見る
|
||||
</a>
|
||||
</div>
|
||||
@ -124,7 +124,7 @@
|
||||
</span>
|
||||
<div class="dropdown-divider"></div>
|
||||
@foreach($latestTasks as $tq)
|
||||
<a href="{{ route('information', ['type'=>'task','status'=>'untreated']) }}" class="dropdown-item"
|
||||
<a href="{{ route('information', ['type'=>'task','status'=>'untreated','period'=>'all']) }}" class="dropdown-item"
|
||||
style="white-space:normal;">
|
||||
{{ Str::limit($tq->que_comment ?? 'タスク', 40) }}
|
||||
<span class="float-right text-muted text-sm">
|
||||
@ -133,7 +133,7 @@
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
@endforeach
|
||||
<a href="{{ route('information', ['type'=>'task']) }}" class="dropdown-item dropdown-footer">
|
||||
<a href="{{ route('information', ['type'=>'task','period'=>'all']) }}" class="dropdown-item dropdown-footer">
|
||||
過去のタスクを全て見る
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user