feat: [bending] 등록 시 분류코드 드롭다운 선택 + 순번 자동 채번, 수정 시 코드 읽기전용

This commit is contained in:
김보곤
2026-03-21 11:01:33 +09:00
parent cc58a0f37a
commit 2cd0fd554c
2 changed files with 27 additions and 6 deletions

View File

@@ -116,7 +116,7 @@ public function edit(int $id): View
public function store(Request $request)
{
$validated = $request->validate([
'code' => 'required|string|max:100',
'code' => ['required', 'string', 'max:10', 'regex:/^BD-[A-Z]{2}$/'],
'name' => 'required|string|max:200',
'item_sep' => 'required|in:스크린,철재',
'item_bending' => 'required|string|max:50',
@@ -124,7 +124,8 @@ public function store(Request $request)
'material' => 'required|string|max:50',
'model_UA' => 'nullable|in:인정,비인정',
], [
'code.required' => '코드를 입력하세요.',
'code.required' => '분류코드를 선택하세요.',
'code.regex' => '분류코드 형식이 올바르지 않습니다. (BD-XX)',
'name.required' => '이름을 입력하세요.',
'item_sep.required' => '대분류를 선택하세요.',
'item_sep.in' => '대분류는 스크린 또는 철재만 선택 가능합니다.',
@@ -167,7 +168,6 @@ public function store(Request $request)
public function update(Request $request, int $id)
{
$validated = $request->validate([
'code' => 'required|string|max:100',
'name' => 'required|string|max:200',
'item_sep' => 'required|in:스크린,철재',
'item_bending' => 'required|string|max:50',
@@ -175,7 +175,6 @@ public function update(Request $request, int $id)
'material' => 'required|string|max:50',
'model_UA' => 'nullable|in:인정,비인정',
], [
'code.required' => '코드를 입력하세요.',
'name.required' => '이름을 입력하세요.',
'item_sep.required' => '대분류를 선택하세요.',
'item_sep.in' => '대분류는 스크린 또는 철재만 선택 가능합니다.',

View File

@@ -73,8 +73,30 @@
<div class="grid grid-cols-4 gap-3">
<div>
<label class="block text-xs text-gray-500 mb-1">코드 <span class="text-red-500">*</span></label>
<input type="text" name="code" value="{{ old('code', $itemCode) }}" {{ $isView ? 'disabled' : 'required' }}
class="w-full border border-gray-300 rounded px-3 py-1.5 text-sm {{ $isView ? 'bg-gray-100' : '' }}">
@if($isCreate)
{{-- 등록: 분류코드 선택 순번 자동 채번 --}}
<select name="code" required class="w-full border border-gray-300 rounded px-3 py-1.5 text-sm">
<option value="">분류코드 선택</option>
@foreach([
'RS' => '가이드레일 SUS마감재', 'RM' => '가이드레일 본체/보강', 'RC' => '가이드레일 C형',
'RD' => '가이드레일 D형', 'RE' => '가이드레일 측면마감', 'RT' => '가이드레일 절단판',
'RH' => '가이드레일 뒷보강', 'RN' => '가이드레일 비인정',
'CP' => '케이스 밑면판/점검구', 'CF' => '케이스 전면판', 'CB' => '케이스 후면코너/후면부',
'CL' => '케이스 린텔', 'CX' => '케이스 상부덮개',
'BS' => '하단마감재 SUS', 'BE' => '하단마감재 EGI', 'BH' => '하단마감재 보강평철',
'TS' => '철재 하단마감재 SUS', 'TE' => '철재 하단마감재 EGI',
'XE' => '마구리', 'LE' => 'L-BAR',
'ZP' => '특수 밑면/점검구', 'ZF' => '특수 전면판', 'ZB' => '특수 후면',
] as $prefix => $label)
<option value="BD-{{ $prefix }}" {{ old('code') === "BD-{$prefix}" ? 'selected' : '' }}>BD-{{ $prefix }} ({{ $label }})</option>
@endforeach
</select>
<p class="text-xs text-gray-400 mt-0.5">순번은 저장 자동 채번</p>
@else
{{-- 수정/조회: 코드 읽기전용 --}}
<input type="text" value="{{ $itemCode }}" disabled
class="w-full border border-gray-300 rounded px-3 py-1.5 text-sm bg-gray-100 font-mono">
@endif
</div>
<div>
<label class="block text-xs text-gray-500 mb-1">이름 <span class="text-red-500">*</span></label>