@extends('admin.admin-master')
@section('content')
<div>&nbsp; </div>
<div>&nbsp; </div>
<h3><i class="fa fa-newspaper-o"></i> Pages </h3>
<div>&nbsp; </div>
<!--- User List table  ---->
{{Form::open(array('url'=>'/admin/manage-pages','method'=>'POST', 'id'=>'save_page_form'))}}
<div class="col-md-12">
    <div class="col-md-12">
        <div class="row">
            <div class="col-md-3"><a class="btn btn-warning btn-sm" href="/admin/manage-pages?page=new"><i class="fa fa-paper-plane-o"></i> Add new page</a></div>
            <div class="col-md-3"></div>
            <div class="col-md-3"></div>
            <div class="col-md-3"></div>
        </div>
        <div>&nbsp; </div>
        <div class="row">
            <div class="col-md-8">
                <label>Page Name</label>
                {{Form::text('page_name',isset($page_data->page_name)?$page_data->page_name:'',array('class'=>'form-control input-sm'))}}
                <div class="clearfix">&nbsp;</div>
                <label>Page Content</label>
                {{Form::textarea('content',isset($page_data->content)?$page_data->content:'',array('class'=>'form-control input-sm tinymc'))}}
                <div class="clearfix">&nbsp;</div>
                <div class="row">
                    <div class="col-md-6">
                        <label>Add to</label>
                        {{Form::select('added_to',array(0=>'Select place','1'=>'Nav Bar' , '2'=>'Sub Menu'),isset($page_data->added_to)?$page_data->added_to:'',array('class'=>'form-control input-sm'))}}
                    </div>
                    <div class="col-md-6 load-sub-menu">

                    </div>
                </div>
                <div class="clearfix">&nbsp;</div>

                {{Form::button('<i class="fa fa-save"></i> Save page' , array('class'=>'btn btn-sm btn-info hidden-sm hidden-xs save-btn','type'=>'button'))}}
                {{Form::button('<i class="fa fa-save"></i> Save page' , array('class'=>'btn btn-sm btn-info visible-sm visible-xs btn-block save-btn','type'=>'button'))}}
            </div>
            <div class="col-md-4">
                <label>Add Feature Image</label>
                <img src="{{isset($page_data->featured_image)?$page_data->featured_image:'http://placehold.it/780x300'}}" id="poll_img" class="img-responsive">
                <div class="clearfix">&nbsp;</div>
                <div class="control-group">
                    {{Form::hidden('featured_image',isset($page_data->featured_image)?$page_data->featured_image:'',array('id'=>'file_name','name'=>'featured_image'))}}
                    <a data-toggle="tooltip" data-placement="bottom" title="" class="btn btn-sm btn-default" href="javascript:void(0)" id="load-meadia" data-original-title="Add image"> <i class="fa fa-image"></i> Choose Image </a>
                </div>
                <div class="clearfix">&nbsp;</div>
                <label>Page type</label>
                {{Form::select('page_type',array('1'=>'Page' , '2'=>'Blog'),isset($page_data->page_type)?$page_data->page_type:'',array('class'=>'form-control input-sm'))}}
                <div class="clearfix">&nbsp;</div>
                <label>Featured to home page ?</label>
                {{Form::checkbox('is_featured',1,isset($page_data->is_featured)?$page_data->is_featured:'',array('class'=>''))}}
            </div>
        </div>
        <div class="clearfix">&nbsp;</div>
        <center></center>
    </div>
</div>
{{Form::hidden('page_id',isset($page_data->page_id)?$page_data->page_id:'',array('class'=>''))}}

{{Form::close()}}
<!--- End User List table  ---->
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Update new quiz</h4>
            </div>
            <div class="modal-body quiz-form">
            </div>
            <p class="">&nbsp;</p>
        </div>
    </div>
</div>
<script>
    $('select[name="added_to"]').on('change', function() {
        var add_to = $(this).val();
        if (add_to == 2)
        {
            $.ajax('/admin/manage-pages?sub_menu=' + add_to).done(function(e) {
                $('.load-sub-menu').html(e);
            });
        } else
        {
            $('.load-sub-menu').html('');
        }
    });
</script>

<!---// Modal --->
@stop
