Files
sam-manage/resources/views/equipment/index.blade.php
김보곤 4115bbd7db feat: [equipment] 설비관리 모듈 구현
- 모델 6개 (Equipment, InspectionTemplate, Inspection, InspectionDetail, Repair, Process)
- 서비스 3개 (Equipment, Inspection, Repair)
- API 컨트롤러 3개 + FormRequest 4개
- Blade 컨트롤러 + 라우트 등록
- 뷰: 대시보드, 등록대장(CRUD), 일상점검표(캘린더 그리드), 수리이력
2026-02-25 19:39:59 +09:00

108 lines
4.3 KiB
PHP

@extends('layouts.app')
@section('title', '설비 등록대장')
@section('content')
<!-- 헤더 -->
<div class="flex flex-col sm:flex-row sm:justify-between sm:items-center gap-4 mb-6">
<h1 class="text-2xl font-bold text-gray-800">설비 등록대장</h1>
<a href="{{ route('equipment.create') }}"
class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg transition text-center">
+ 설비 등록
</a>
</div>
<!-- 필터 -->
<x-filter-collapsible id="filterForm">
<form id="filterForm" class="flex flex-wrap gap-2 sm:gap-4">
<input type="hidden" name="per_page" id="perPageInput" value="20">
<input type="hidden" name="page" id="pageInput" value="1">
<div style="flex: 1 1 200px; max-width: 300px;">
<input type="text" name="search" placeholder="설비번호/설비명 검색..."
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div class="shrink-0" style="width: 140px;">
<select name="status" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="">상태 전체</option>
<option value="active">가동</option>
<option value="idle">유휴</option>
<option value="disposed">폐기</option>
</select>
</div>
<div class="shrink-0" style="width: 140px;">
<select name="production_line" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="">라인 전체</option>
<option value="스라트">스라트</option>
<option value="스크린">스크린</option>
<option value="절곡">절곡</option>
<option value="기타">기타</option>
</select>
</div>
<div class="shrink-0" style="width: 140px;">
<select name="equipment_type" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="">유형 전체</option>
<option value="포밍기">포밍기</option>
<option value="미싱기">미싱기</option>
<option value="샤링기">샤링기</option>
<option value="V컷팅기">V컷팅기</option>
<option value="절곡기">절곡기</option>
<option value="프레스">프레스</option>
<option value="드릴">드릴</option>
<option value="기타">기타</option>
</select>
</div>
<button type="submit" class="bg-gray-600 hover:bg-gray-700 text-white px-6 py-2 rounded-lg transition shrink-0">
검색
</button>
</form>
</x-filter-collapsible>
<!-- 테이블 영역 -->
<div id="equipment-table"
hx-get="/admin/equipment"
hx-trigger="load, filterSubmit from:body"
hx-include="#filterForm"
hx-headers='{"X-CSRF-TOKEN": "{{ csrf_token() }}"}'
class="bg-white rounded-lg shadow-sm">
<div class="flex justify-center items-center p-12">
<div class="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"></div>
</div>
</div>
@endsection
@push('scripts')
<script>
document.getElementById('filterForm').addEventListener('submit', function(e) {
e.preventDefault();
document.getElementById('pageInput').value = 1;
htmx.trigger('#equipment-table', 'filterSubmit');
});
function confirmDelete(id, name) {
showDeleteConfirm(name, () => {
fetch(`/admin/equipment/${id}`, {
method: 'DELETE',
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}',
'Accept': 'application/json',
}
})
.then(response => response.json())
.then(data => {
if (data.success) {
htmx.trigger('#equipment-table', 'filterSubmit');
showToast(data.message, 'success');
} else {
showToast(data.message, 'error');
}
});
});
}
</script>
@endpush