패키지 구성품 (Bundle Items)
이 패키지에 포함될 기본 프로그램들과 횟수를 지정하세요. (최대 10개)
기본 프로그램 명칭
횟수 (수량)
정렬 순서
관리
@php
$oldBundleItems = old('bundle_items');
// 1. 유효성 에러로 재출력되는 경우 (등록/수정 공통 old 데이터 복구)
if (!empty($oldBundleItems)) {
$childIds = collect($oldBundleItems)->pluck('child_id')->filter()->toArray();
$fetchedPrograms = !empty($childIds) ? \App\Models\Program::whereIn('id', $childIds)->get()->keyBy('id') : collect();
}
@endphp
@if(!empty($oldBundleItems))
{{-- 유효성 검사 실패로 튕겨 돌아온 경우 (old 데이터 기준 렌더링) --}}
@foreach($oldBundleItems as $index => $item)
@php
$childProg = $fetchedPrograms[$item['child_id']] ?? null;
if (!$childProg) continue;
// 패키지 타입 판별 (수정페이지는 $program->execution_type, 등록페이지는 old('execution_type') 활용 가능)
$currentExecType = $program->execution_type ?? old('execution_type', 'package_single');
@endphp
@endforeach
@elseif(isset($program) && $program->execution_type != 'single' && $program->bundleItems)
{{-- 수정 페이지 최초 진입 시 (기존 DB 데이터 렌더링) --}}
@foreach($program->bundleItems as $index => $item)
@endforeach
@endif