@php
function show_tree($part, $indent, $formId, $item) {
$_part = $item->children()->where('part_id', $part->id)->first();
$_condition = $_part ? $_part->condition : 'Normal';
if( in_array($part->id, $item->parts_tree_template?->parts ?? []) ) {
echo '
- '.( $_part ? $_part->condition : '
').'
';
}
$indent = $indent + 30;
foreach( $part->children as $child ) {
show_tree($child, $indent, $formId, $item);
}
}
echo '';
foreach(\App\Models\Part::where('parent_id', null)->get() as $part) {
show_tree($part, 0, $formId, $item);
}
echo '
';
@endphp
@push('scripts')
@endpush
{{-- @push('scripts')
@endpush --}}