@include('admin.crud.form', [ 'action' => route('admin.course-units.store', $course->id), 'formId' => 'add-course-unit-form', 'submitText' => 'Save Course Unit', 'class' => 'ajax-crud-form', 'redirect' => route('admin.course-content.index', $course->id), 'fields' => [ [ 'type' => 'hidden', 'name' => 'course_id', 'id' => 'course_id', 'value' => $course->id, 'label' => ($parentUnit ? false : true) ? 'Course: ' . $course->title ?? null : false, ], [ 'type' => 'hidden', 'name' => 'parent_id', 'id' => 'parent_id', 'value' => $parentUnit->id ?? null, 'label' => ($course ? $course->title . ' > ' : '') . ($parentUnit ? ($parentUnit->parent ? $parentUnit->parent->title. ' > ' : '') : '') . ($parentUnit->title ?? 'None'), 'enabled' => $parentUnit ? true : false, ], [ 'type' => 'text', 'name' => 'title', 'id' => 'title', 'label' => 'Unit Title', 'placeholder' => 'Enter Unit Title', 'required' => true, 'col' => 12 ], [ 'type' => 'textarea', 'name' => 'description', 'id' => 'description', 'label' => 'Description', 'placeholder' => 'Enter Unit Description', 'col' => 12 ], [ 'type' => 'select', 'name' => 'access_type', 'id' => 'access_type', 'label' => 'Access Type', 'required' => true, 'options' => [ 'paid' => 'Paid', 'free' => [ 'label' => $isParentPaid == true ? 'Free (Parent as paid)' : 'Free', 'readonly' => $isParentPaid ], ], 'value' => $parentUnit != null ? ($isParentPaid == true ? 'paid' : 'free') : '', 'col' => 4 ], [ 'type' => 'select', 'name' => 'status', 'id' => 'status', 'label' => 'Status', 'required' => true, 'options' => [ 'active' => 'Active', 'inactive' => 'Inactive' ], 'col' => 4 ], [ 'type' => 'number', 'name' => 'price', 'id' => 'price', 'label' => 'Price', 'placeholder' => 'Enter price (optional)', 'step' => '0.01', 'min' => '0', 'col' => 4, 'enabled' => has_feature('can_purchase.course_units') ? true : false, 'show_if' => ['access_type' => 'paid'] ], [ 'type' => 'seperator', 'col' => 12, 'enabled' => $parentUnit ? false : true, ], [ 'type' => 'image', 'name' => 'thumbnail', 'label' => 'Thumbnail', 'presetKey' => 'course_units_thumbnail', 'subPreset' => 'original', 'col' => 12, 'enabled' => $parentUnit ? false : true, ] ] ])