

    <?= $this->element('page_top', array('title' => __('Add Report Format Type'), 'permissions' => $user_permission)); ?>

    <div class="box box-primary">
        <!-- /.box-header -->
        <div class="box-body">
            <div class="row">
                <div class="col-md-12">
                    <?= $this->Form->create(null, ['id' => 'report_type_form', 'class'=> 'input-form-section']); ?>

                    <div id="basic_info_div">

                        <div class="col-md-9 col-sm-9 col-xs-9 text-left">

                            <div class="form-group row <?php if(isset($errors['name'])){ echo 'has-error';} ?>">
                                <label class="control-label col-lg-3 required">Name</label>
                                <div class="col-lg-9">
                                    <?php echo $this->Form->input('name', ['label' =>false,['class' => 'required' ], 'placeholder'=>'Type Title', 'class' => 'form-control', 'required' => false]); ?>
                                    <span class="help-block text-center">
                                                        <?php
                                                        if (isset($errors['name']['_empty'])) {
                                                            echo $errors['name']['_empty'];
                                                        }
                                                        ?>
                                        </span>
                                </div>
                            </div>
                            <div class="form-group row <?php if(isset($errors['description'])){ echo 'has-error';} ?>">
                                <label class="control-label col-lg-3 required">Description</label>
                                <div class="col-lg-9">
                                    <?php echo $this->Form->input('description', ['label' =>false,['class' => 'required' ],'placeholder'=>'Type Description', 'class' => 'form-control', 'required' => false]); ?>
                                    <span class="help-block text-center">
                                                        <?php
                                                        if (isset($errors['description']['_empty'])) {
                                                            echo $errors['description']['_empty'];
                                                        }
                                                        ?>
                                        </span>
                                </div>
                            </div>



                            <div class="form-group row ">
                                <label class="control-label col-lg-3"></label>
                                <div class="col-lg-9">
                                    <?= $this->Form->button(__('Submit'), ['class' => 'btn btn-success tab3Save pull-left btn-grid btn-flat','id'=>'submit']) ?>
                                    <a href="<?php echo $this->Url->build('/report-format-type'); ?>"  class="btn btn-default tab3Save pull-left btn-grid btn-flat btn-orange-color" id="default-btn">
                                        <?php echo __('Back'); ?>
                                    </a>
                                </div>
                            </div>


                        </div>



                        <!-- /.form-group -->
                    </div>
                    <?= $this->Form->end() ?>
                    <!-- /.form-group -->


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

        </div>
    </div>

    <script>

        $('#report_type_form').validate({
            rules:{
                'name':'required',
                'description': 'required'
            },
            messages: {
                'name':{
                    required: "Please enter course title"
                },
                'description':{
                    required: "Please enter course description"
                }

            },
            highlight: function(element) {
                $(element).parent().addClass("has-error");
            },
            submitHandler: function(form) {
                form.submit();
            }
        });

    </script>
