<?php $__env->startSection('footer_js'); ?>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#sidebar li').removeClass('active');
            $('#sidebar a').removeClass('active');
            $('#sidebar').find('#contents').addClass('active');
            $('#sidebar').find('#page').addClass('active');

            $('.date-picker').datepicker({format: 'yyyy-mm-dd'});

            $('#pageAddForm').formValidation({
                framework: 'bootstrap',
                excluded: ':disabled',
                icon: {
                    valid: 'glyphicon glyphicon-ok',
                    invalid: 'glyphicon glyphicon-remove',
                    validating: 'glyphicon glyphicon-refresh'
                },
                fields: {
                    attachment: {
                        validators: {
                            file: {
                                extension: 'jpg,jpeg,png',
                                maxSize: 10485760,   // 1 * 1024 * 1024
                                message: 'The selected file is not valid or file size greater than 10 MB.'
                            }
                        }
                    },
                    thumbnail: {
                        validators: {
                            file: {
                                extension: 'jpg,jpeg,png',
                                maxSize: 10485760,   // 1 * 1024 * 1024
                                message: 'The selected file is not valid or file size greater than 10 MB.'
                            }
                        }
                    },
                    heading: {
                        validators: {
                            notEmpty: {
                                message: 'This field is required.'
                            }
                        }
                    },
                    title: {
                        validators: {
                            notEmpty: {
                                message: 'This field is required.'
                            }
                        }
                    },
                    description: {
                        validators: {
                            notEmpty: {
                                message: 'This field is required.'
                            }
                        }
                    },
                }
            }).on('blur', '[name="heading"]', function(e){
                $('#pageAddForm').formValidation('revalidateField', 'heading');
                $('#pageAddForm').formValidation('revalidateField', 'title');
                $('#pageAddForm').formValidation('revalidateField', 'description');
            }).find('[name="description"]')
                .each(function () {
                    $(this)
                        .ckeditor()
                        .editor
                        .on('change', function (e) {
                            $('#pageAddForm').formValidation('revalidateField', e.sender.name);
                        });
                });
        });
    </script>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('dynamicdata'); ?>

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

            <div data-collapsed="0" class="panel">
                <header class="panel-heading">
                    Add Page
                </header>

                <div class="panel-body">

                    <?php echo $__env->make('layout.backend.alert', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

                    <form id="pageAddForm" action="<?php echo e(route('admin.content.page.store')); ?>" method="post"
                          enctype="multipart/form-data">
                        <div class="form-group col-md-6 col-xs-11">
                            <label for="">Parent *</label>
                            <select name="parent_id" class="form-control">
                                <option value="0">Parent Itself</option>
                                <?php foreach($parents as $parent): ?>
                                <option value="<?php echo $parent->id; ?>"><?php echo $parent->heading; ?></option>
                                <?php endforeach; ?>
                            </select>
                        </div>
                        <div class="clearfix"></div>


                                        <div class="form-group col-md-6 col-xs-11">
                                            <label for="moduleSlug">Heading *</label>
                                            <input type="text" name="heading" value="<?php echo old('heading'); ?>"
                                                   class="form-control heading" placeholder="Enter Heading"/>
                                        </div>
                                        <div class="form-group col-md-6 col-xs-11">
                                            <label for="moduleSlug">Page Title *</label>
                                            <input type="text" name="title" value="<?php echo old('title'); ?>"
                                                   class="form-control title" placeholder="Enter Title"/>
                                        </div>
                                        <div class="form-group col-md-12 col-xs-11">
                                            <label for="moduleSlug">Meta Tags</label>
                                            <input type="text" name="meta_tags"
                                                   value="<?php echo old('meta_tags'); ?>"
                                                   class="form-control meta_tags" placeholder="Enter Meta Tags"/>
                                        </div>
                                        <div class="form-group col-md-12 col-xs-11">
                                            <label for="moduleSlug">Meta Description</label>
                                            <input type="text" name="meta_description"
                                                   value="<?php echo old('meta_description'); ?>"
                                                   class="form-control meta_description"
                                                   placeholder="Enter Meta Description"/>
                                        </div>
                                        <div class="form-group col-md-12 col-xs-11">
                                            <label for="moduleSlug">Short Description</label>
                                            <input type="text" name="short_description"
                                                   value="<?php echo old('short_description'); ?>"
                                                   class="form-control short_description"
                                                   placeholder="Enter Short Description"/>
                                        </div>
                                        <div class="form-group col-md-12 col-xs-11">
                                            <label for="moduleSlug">Description</label>
                                            <textarea class="form-control" name="description"
                                                      rows="6"><?php echo old('description'); ?></textarea>
                                        </div>

                        <div class="form-group col-md-6 col-xs-11">
                            <label for="">Show In</label>
                            <?php foreach($show_in as $key=>$value): ?>
                                <input type="checkbox" name="show_in[]" value="<?php echo $key; ?>"><?php echo $value; ?>

                            <?php endforeach; ?>
                        </div>
                        <div class="clearfix"></div>

                        <div class="form-group col-md-6 col-xs-11">
                            <label for="">Status</label>
                            <select name="is_active" class="form-control">
                                <option value="0">Unpublished</option>
                                <option value="1">Published</option>
                            </select>
                        </div>
                        <div class="clearfix"></div>


                        <div class="form-group col-md-6 col-xs-11">
                            <label for="attachment">Attachment</label>

                            <div class="fileupload fileupload-new" data-provides="fileupload">
                                <div class="fileupload-new thumbnail" style="width: 200px; height: 150px;">
                                    <img src="<?php echo e(asset('uploads/noimage.jpg')); ?>" alt="">
                                </div>
                                <div class="fileupload-preview fileupload-exists thumbnail"
                                     style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
                                <div>
                                                   <span class="btn btn-white btn-file">
                                                   <span class="fileupload-new"><i class="fa fa-paper-clip"></i> Select image</span>
                                                   <span class="fileupload-exists"><i
                                                               class="fa fa-undo"></i> Change</span>
                                                   <input type="file" name="attachment" class="default"/>
                                                   </span>
                                </div>
                            </div>
                            <span class="label label-danger">NOTE!</span>
                            <span>Valid file extensions are jpg,jpeg and png.</span>

                        </div>
                        <div class="form-group col-md-6 col-xs-11">
                            <label for="attachment">Thumbnail</label>

                            <div class="fileupload fileupload-new" data-provides="fileupload">
                                <div class="fileupload-new thumbnail" style="width: 200px; height: 150px;">
                                    <img src="<?php echo e(asset('uploads/noimage.jpg')); ?>" alt="">
                                </div>
                                <div class="fileupload-preview fileupload-exists thumbnail"
                                     style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
                                <div>
                                                   <span class="btn btn-white btn-file">
                                                   <span class="fileupload-new"><i class="fa fa-paper-clip"></i> Select thumbnail / icon image</span>
                                                   <span class="fileupload-exists"><i
                                                               class="fa fa-undo"></i> Change</span>
                                                   <input type="file" name="thumbnail" class="default"/>
                                                   </span>
                                </div>
                            </div>
                            <span class="label label-danger">NOTE!</span>
                            <span>Valid file extensions are jpg,jpeg and png.</span>

                        </div>
                        <div class="clearfix"></div>

                        <?php echo csrf_field(); ?>

                        <button type="submit" class="btn btn-info">Submit</button>
                    </form>

                </div>

            </div>

        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layout.backend.containerform', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>