<?php
echo $this->Html->css('ionicons.min.css');
?>
<?php echo $this->Html->script('bootstrap-datetimepicker.min.js'); ?>
<?php echo $this->Html->script('bootstrap-datepicker.js'); ?>


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

<div class="row">
    <div class="col-md-12">
        <div class="box box-primary">
            <div class="box-header">
                <div class="row">
                    <div class="col-md-12">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="row">
                                    <div class="col-md-6 ">
                                        <div class="row">
                                            <?= $this->Form->create(null, array('type' => 'get', 'id' => 'limitForm')); ?>
                                            <div class="col-md-2"><strong>Show</strong></div>
                                            <div class="col-md-5">
                                                <?php echo $this->element('pagination_dropdown');?>
                                            </div>
                                            <?= $this->Form->end(); ?>
                                        </div>
                                    </div>
                                </div>
                            </div><!-- /col-md-6 -->
                            <div class="col-md-6">

                                <div class="row">

                                    <div class="col-md-12">

                                        <div class="row">

                                            <div class="col-md-8 pull-right">
                                                <?= $this->Form->create(null, array('type' => 'get')); ?>

                                                <div class="box-tools">
                                                    <div class="input-group input-group-sm">

                                                        <?= $this->Form->input('', [ 'placeholder' => __('SEARCH'), 'class' => 'form-control', 'type' => 'text', 'name' => 'search', 'value' => $searchText, 'id' => 'search']); ?>

                                                        <div class="input-group-btn">
                                                            <?= $this->Form->submit(__('Search'), [ 'class' => 'btn btn-success btn-flat']); ?>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <?= $this->Form->end(); ?>
                                    </div>
                                    <div class="col-md-12">
                                        &nbsp;
                                    </div>

                                    <!-- /row -->
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /.box-header -->
                <div class="box-body table-responsive index-table-section">
                    <table class="table table-bordered table-hover" id="index-table">

                        <thead>
                        <tr>

                            <th><?= $this->Paginator->sort('id', ['value' => __('Id')]) ?></th>
                            <th><?= $this->Paginator->sort('name', ['value' => __('Name')]) ?></th>
                            <th><?= $this->Paginator->sort('description', ['value' => __('Description')]) ?></th>
                            <th><?= $this->Paginator->sort('created_at', ['value' => __('Created On')]) ?></th>
                            <th> Action</th>

                        </tr>
                        </thead>
                        <tbody>
                        <?php if (!empty($course_categories)) { ?>
                            <?php foreach ($course_categories as $course_category): ?>

                                <tr>
                                    <td><?php echo $course_category['id'] ?></td>
                                    <td><?php echo $course_category['name'] ?></td>
                                    <td><?php echo $course_category['description'] ?></td>
                                    <td><?php echo $course_category['created_at'] ?></td>
                                    <td>
                                        <?php echo $this->element('permitted_button',['id' => $course_category['id']]) ?>

                                    </td>
                                </tr>

                            <?php

                            endforeach;
                        }
                        ?>
                        </tbody>
                    </table>


                </div>
                <!-- /.box-body -->
                <?php echo $this->element('pagination') ?>

            </div>
            <!-- /.box -->


        </div>
    </div>


</div>

<script>
    $(document).ready(function () {
        $("#from-date").datepicker({autoclose: true, todayHighlight: true, format: 'yyyy-mm-dd'});
        $("#to-date").datepicker({autoclose: true, todayHighlight: true, format: 'yyyy-mm-dd'});
    });
</script>


