feat:검사기준서 탭 개선 - 공차/범위, 검사방식 드롭다운, 측정유형 추가
- 검사기준서 테이블 7컬럼→9컬럼 (공차/범위, 검사방식, 측정유형)
- 검사방식 select: common_codes inspection_method 그룹에서 동적 로드
- 검사방식 변경 시 측정유형 자동매핑 (수동 변경 가능)
- saveRelations, duplicate, prepareTemplateData에 새 필드 반영
- 공통코드 JSON API 엔드포인트 추가 (/api/admin/common-codes/{group})
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -282,7 +282,9 @@ public function duplicate(Request $request, int $id): JsonResponse
|
||||
'category' => $item->category,
|
||||
'item' => $item->item,
|
||||
'standard' => $item->standard,
|
||||
'tolerance' => $item->tolerance,
|
||||
'method' => $item->method,
|
||||
'measurement_type' => $item->measurement_type,
|
||||
'frequency' => $item->frequency,
|
||||
'regulation' => $item->regulation,
|
||||
'sort_order' => $item->sort_order,
|
||||
@@ -337,6 +339,31 @@ public function uploadImage(Request $request): JsonResponse
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통코드 그룹 조회 (JSON)
|
||||
*/
|
||||
public function getCommonCodes(string $group): JsonResponse
|
||||
{
|
||||
$tenantId = session('selected_tenant_id');
|
||||
|
||||
$codes = \App\Models\Products\CommonCode::query()
|
||||
->where('code_group', $group)
|
||||
->where('is_active', true)
|
||||
->where(function ($q) use ($tenantId) {
|
||||
$q->whereNull('tenant_id');
|
||||
if ($tenantId) {
|
||||
$q->orWhere('tenant_id', $tenantId);
|
||||
}
|
||||
})
|
||||
->orderBy('sort_order')
|
||||
->get(['code', 'name']);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'data' => $codes,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 관계 데이터 저장
|
||||
*/
|
||||
@@ -394,7 +421,9 @@ private function saveRelations(DocumentTemplate $template, array $data, bool $de
|
||||
'category' => $item['category'] ?? '',
|
||||
'item' => $item['item'] ?? '',
|
||||
'standard' => $item['standard'] ?? '',
|
||||
'tolerance' => $item['tolerance'] ?? null,
|
||||
'method' => $item['method'] ?? '',
|
||||
'measurement_type' => $item['measurement_type'] ?? null,
|
||||
'frequency' => $item['frequency'] ?? '',
|
||||
'regulation' => $item['regulation'] ?? '',
|
||||
'sort_order' => $iIndex,
|
||||
|
||||
Reference in New Issue
Block a user