
<?= $this->element('page_top', array('title' => __('View'), 'permissions' => $user_permission)); ?>

<div class="box box-primary">
    <div class="box-body">
        <div class="row">
            <div class="col-md-12 main-view-section">
                <div id="basic_info_div">
                    <h4 class="text-center bg-secondary text-white p-2"><b>Course Information</b></h4>
                    <div class="col-md-6 view-section">
                        <table class="table table-striped">
                            <tr>
                                <th><?= __('Course Name') ?></th>
                                <td><?= h($course->name) ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Course Category') ?></th>
                                <td><?= h($course->course_category->name ?? '') ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Qualification Type') ?></th>
                                <td><?= h($course->qualification_type->name ?? '') ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Level') ?></th>
                                <td><?= h($course->level) ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Total Credit') ?></th>
                                <td><?= h($course->total_credit) ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Course Code') ?></th>
                                <td><?= h($course->code) ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Progression Routes') ?></th>
                                <td><?= h($course->progression_routes) ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Availability Type') ?></th>
                                <td><?= h(AVAILABILITY_TYPE[$course->availability_type] ?? '') ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Delivery Mode') ?></th>
                                <td><?= h(DELIVERY_MODE[$course->delivery_mode] ?? '') ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Duration') ?></th>
                                <td><?= h($course->duration) ?> months</td>
                            </tr>
                            <tr>
                                <th><?= __('Assessment') ?></th>
                                <td><?= h($course->assessment) ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Description') ?></th>
                                <td><?= h($course->description) ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Created On') ?></th>
                                <td><?= h($course->created_at) ?></td>
                            </tr>
                        </table>
                    </div>

                    <h4 class="text-center bg-secondary text-white p-2 mt-4"><b>Course Fee Information</b></h4>
                    <div class="col-md-6 view-section">
                        <table class="table table-striped">
                            <tr>
                                <th><?= __('Online Fee') ?></th>
                                <td><?= h($course_semester_fee->online_fee) ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Discount') ?></th>
                                <td><?= h($course_semester_fee->discount) ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Monthly Installment') ?></th>
                                <td><?= h($course_semester_fee->monthly_installment_amount) ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Upfront Deposit') ?></th>
                                <td><?= h($course_semester_fee->upfront_deposit) ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Blended Fee') ?></th>
                                <td><?= h($course_semester_fee->blended_fee) ?></td>
                            </tr>
                            <tr>
                                <th><?= __('Certificate Fee') ?></th>
                                <td><?= h($course_semester_fee->certificate_fee) ?></td>
                            </tr>
                        </table>
                    </div>

                    <h4 class="text-center bg-secondary text-white p-2 mt-4"><b>Course Unit Information</b></h4>
                    <div class="col-md-6 view-section">
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th>Title</th>
                                <th>Credit</th>
                                <th>Mandatory/Optional</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if (!empty($course_semester_subjects)) : ?>
                                <?php foreach ($course_semester_subjects as $subject) : ?>
                                    <tr>
                                        <td><?= h($subject->title) ?></td>
                                        <td><?= h($subject->credit) ?></td>
                                        <td><?= ($subject->is_mandatory == 1) ? 'Yes' : 'No' ?></td>
                                    </tr>
                                <?php endforeach; ?>
                            <?php else : ?>
                                <tr>
                                    <td colspan="3" class="text-center"><?= __('No subjects added.') ?></td>
                                </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                    </div>

                    <div class="col-md-12 col-offset-12 back-btn-section mt-3">
                        <a href="<?= $this->Url->build('/course') ?>" class="btn btn-success btn-flat btn-orange-color" id="back-btn">
                            <i class="fa fa-arrow-left"></i> <?= __('Back') ?>
                        </a>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

