feat: [equipment] 설비 QR 코드 점검 시스템 추가
- 설비 상세 basic-info 탭에 QR 코드 표시 (qrcode.js CDN)
- QR PNG 다운로드/인쇄 기능
- 모바일 전용 레이아웃 (layouts/mobile.blade.php)
- 모바일 점검 페이지 (/m/inspect/{id})
- setResult API (PATCH /inspections/set-result)
- 4버튼 직접 결과 설정 (양호/이상/수리/취소)
- 전체 양호 일괄 처리
- 주기 탭 전환 (활성 주기만 표시)
This commit is contained in:
62
app/Http/Controllers/Mobile/MobileInspectionController.php
Normal file
62
app/Http/Controllers/Mobile/MobileInspectionController.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Mobile;
|
||||
|
||||
use App\Enums\InspectionCycle;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Equipment\Equipment;
|
||||
use App\Models\Equipment\EquipmentInspection;
|
||||
use App\Models\Equipment\EquipmentInspectionDetail;
|
||||
use App\Models\Equipment\EquipmentInspectionTemplate;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class MobileInspectionController extends Controller
|
||||
{
|
||||
public function show(Request $request, int $id): View
|
||||
{
|
||||
$equipment = Equipment::with(['manager', 'subManager'])->findOrFail($id);
|
||||
|
||||
$cycle = $request->input('cycle', InspectionCycle::DAILY);
|
||||
$today = now()->format('Y-m-d');
|
||||
$period = InspectionCycle::resolvePeriod($cycle, $today);
|
||||
|
||||
$activeCycles = EquipmentInspectionTemplate::where('equipment_id', $equipment->id)
|
||||
->where('is_active', true)
|
||||
->distinct()
|
||||
->pluck('inspection_cycle')
|
||||
->toArray();
|
||||
|
||||
$templates = EquipmentInspectionTemplate::where('equipment_id', $equipment->id)
|
||||
->where('inspection_cycle', $cycle)
|
||||
->where('is_active', true)
|
||||
->orderBy('sort_order')
|
||||
->get();
|
||||
|
||||
$inspection = EquipmentInspection::where('equipment_id', $equipment->id)
|
||||
->where('inspection_cycle', $cycle)
|
||||
->where('year_month', $period)
|
||||
->first();
|
||||
|
||||
$details = collect();
|
||||
if ($inspection) {
|
||||
$details = EquipmentInspectionDetail::where('inspection_id', $inspection->id)
|
||||
->where('check_date', $today)
|
||||
->get()
|
||||
->keyBy('template_item_id');
|
||||
}
|
||||
|
||||
$canInspect = $equipment->canInspect();
|
||||
|
||||
return view('mobile.inspection.show', compact(
|
||||
'equipment',
|
||||
'cycle',
|
||||
'today',
|
||||
'period',
|
||||
'activeCycles',
|
||||
'templates',
|
||||
'details',
|
||||
'canInspect',
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user