

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


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

                            <div class="form-group row <?php if(isset($errors['report_format_type_id'])){ echo 'has-error';} ?>">
                                <label class="control-label col-lg-3 required">Report Format Type</label>
                                <div class="col-lg-9">
                                    <?php echo $this->Form->control('report_format_type_id', ['label' =>false,['class' => 'required' ], 'type' => 'select' , 'options'=>$report_format_types, 'empty' => 'Select One', 'default'=> $course->status ,'class' => 'form-control', 'required' => false]); ?>
                                    <span class="help-block text-center">
                                                        <?php
                                                        if (isset($errors['report_format_type_id']['_empty'])) {
                                                            echo $errors['report_format_type_id']['_empty'];
                                                        }
                                                        ?>
                                        </span>
                                </div>
                            </div>
                            <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['content'])){ echo 'has-error';} ?>">
                                <label for="" class="control-label col-lg-3 required">Content</label>
                                <div class="col-lg-9">
                                    <?= $this->Form->textarea('', ['placeholder' => __('Content'),'label'=>false,'style'=>'height:300px','class' => 'form-control editable required', 'type' => 'text','id'=>'content','required' => false,'name' => 'content' ,'disabled'=>$disabled]); ?>
                                    <span class="help-block text-center">
                                                            <?php
                                                            if (isset($errors['content']['_empty'])) {
                                                                echo $errors['content']['_empty'];
                                                            }
                                                            ?>
                                    </span>
                                </div>

                            </div>
                            <div class="form-group row">
                                <label for="" class="control-label col-lg-3">Attachment</label>
                                <div class="col-lg-9">
                                 <?= $this->Form->input('', ['placeholder' => __('Attachment'),'label'=>false, 'class' => 'form-control', 'type' => 'file','name' => 'attachment' ,'disabled'=>$disabled]); ?>
                                </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'); ?>"  class="btn btn-default tab3Save pull-left btn-grid btn-flat btn-orange-color" id="default-btn">
                                        <?php echo __('Back'); ?>
                                    </a>
                                </div>
                            </div>
                        </div>


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

                    <!-- /.form-group -->


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

        </div>
    </div>
<?php echo $this->element('tinymce_js'); ?>

    <script>

        $('#report_format_form').validate({
            rules:{
                'report_format_type_id' : 'required',
                'name':'required',
                'content':'required',
            },
            messages: {
                'name':{
                    required: "Please enter report format title"
                },
                'report_format_type_id':{
                    required: "Please select report format  type"
                },
                'content':{
                    required: "Please enter report content"
                }

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

    </script>
