@include("messages")
<?php
$yes_no = Config::get('params.yes_no');
$template = Config::get('params.template');
$size = Config::get('params.best_boiler_image_size');

$required = "";
$action = "pages";
?>

<div class="row">
    <ul id="tabsJustified" class="nav nav-tabs">
        <li class="nav-item"><a href="#_" data-target="#information" data-toggle="tab" class="nav-link small text-uppercase active">Information</a></li>
        <li class="nav-item"><a href="#_" data-target="#meta" data-toggle="tab" class="nav-link small text-uppercase ">Meta</a></li>
        <li class="nav-item"><a href="#_" data-target="#faqs" data-toggle="tab" class="nav-link small text-uppercase ">Faqs</a></li>
    </ul>
</div>

<div id="tabsJustifiedContent" class="tab-content">
    
    <div id="information" class="tab-pane fade active show">
        <div class="row">
            <div class="col-md-6 ">
                <div class="form-group">
                    {!! Form::label('Title') !!}
                    {!! Form::text('Title', null , array('class' => 'form-control',$required) ) !!}
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    {!! Form::label('Template') !!}
                    {!! Form::select('Template', $template,null,['class' => 'form-control','name'=>'Template','id'=>'template'] ) !!}
                </div>
            </div>
           
        </div>
        
        <div class="row">
            <div class="col-sm-12">
                <div class="form-group">
                    {!! Form::label('short description') !!}
                    {!! Form::textarea('short_description', null, ['class'=>'form-control ckeditor', 'rows' => 3, 'cols' => 3, 'style' => '']) !!}
                </div>
            </div>
        </div>
        
        
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    {!! Form::label('Is Permanent Redirect ?') !!}
                    {!! Form::select('IsPermanentRedirect', $yes_no,null,['class' => 'form-control','name'=>'IsPermanentRedirect'] ) !!}
                </div>
            </div>


            <div class="col-sm-6">
                <div class="form-group">
                    {!! Form::label('Permanent Redirect URL') !!}
                    {!! Form::text('PermanentRedirectURL', null , array('class' => 'form-control',$required) ) !!}
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    {!! Form::label('No Index Follow Tag') !!}
                    {!! Form::select('NoIndexFollowTag', $yes_no,null,['class' => 'form-control','name'=>'NoIndexFollowTag'] ) !!}
                </div>
            </div>
            
             <div class="col-sm-6">
                 <div class="d-flex justify-content-start flex-wrap">
                     <div class="custom-control custom-switch custom-switch-success mr-2 mb-1">
                         <p class="mb-0">Status</p>
                         <input type="checkbox" 

                                @if(isset($model->Status) && $model->Status=="Enabled")
                                checked 
                                @endif
                                class="custom-control-input" name="Status" id="Status" value="Enabled">
                                <label class="custom-control-label" for="Status">Status</label>
                     </div>
                 </div>
             </div>
        </div>
        <div class="row">
            <div class="col-md-12 col-xs-12 col-lg-12">
                <div class="form-group">
                    {!! Form::label('URL') !!}
                    {!! Form::text('AccessURL', null , array('class' => 'form-control',$required) ) !!}
                </div>
            </div>    
        </div>
         <div id="bannerimage">
            <div class="row">
                
            <div class="col-sm-12">
                <div class="row form-group">
                    <label class="col-xl-2 col-lg-2 col-form-label"> Image</label>
                    <div class="col-lg-6 col-xl-6">
                        <input   value="<?php echo isset($model->bannerImage) ? $model->bannerImage : ""; ?>"  placeholder="Upload Image" id="bannerImage" name="bannerImage" type="text" class="form-control "  readonly="">
                      <br clear="all"/>
                      Best Image Size(<?php echo $size; ?>)
                    </div>
                    <div class="col-lg-2 col-xl-2">
                        <button type="button" class="btn btn-warning btn-label-brand btn-md mediaModel" data-toggle="modal" data-target="#media-model" data-control="bannerImage">Browse</button>
                    </div>
                    <div class="col-lg-1 col-xl-1 ">

                        <p id="removeImage2" class="btn btn-outline-warning mr-1 mb-1 waves-effect waves-light float-right">Remove</p>

                    </div>
                </div>
            </div>   
            </div>
            
        </div>
        <div id="noneTemplate">
            <div class="row">

                <div class="col-md-12 col-xs-12 col-lg-12">
                    <div class="form-group">
                        {!! Form::label('Header Title') !!}
                        {!! Form::text('HeaderTitle',null, array('class' => 'form-control',$required) ) !!}

                    </div>
                </div>  
            </div>
            <div class="row">
                <div class="col-md-12 col-xs-12 col-lg-12">
                    <div class="form-group">
                        {!! Form::label('Content') !!}
                        {!! Form::textarea('Content', null, ['class'=>'form-control ckeditor','rows' => 3, 'cols' => 3]) !!}
                    </div>
                </div>    
            </div>
        <div id="img">
            <div class="row">
                
            <div class="col-sm-12">
                <div class="row form-group">
                    <label class="col-xl-2 col-lg-2 col-form-label"> Image</label>
                    <div class="col-lg-6 col-xl-6">
                        <input   value="<?php echo isset($model->HeaderImageName) ? $model->HeaderImageName : ""; ?>"  placeholder="Upload Image" id="HeaderImageName" name="HeaderImageName" type="text" class="form-control "  readonly="">
                      <br clear="all"/>
                      Best Image Size(<?php echo $size; ?>)
                    </div>
                    <div class="col-lg-2 col-xl-2">
                        <button type="button" class="btn btn-warning btn-label-brand btn-md mediaModel" data-toggle="modal" data-target="#media-model" data-control="HeaderImageName">Browse</button>
                    </div>
                     <div class="col-lg-1 col-xl-1 ">

                        <p id="removeImage" class="btn btn-outline-warning mr-1 mb-1 waves-effect waves-light float-right">Remove</p>

                    </div>
                </div>
            </div>   
            </div>
            
        </div>
        </div>
        
        <div class="row" id="boilerTemplate">
            <div class="col-sm-12">
                <div class="form-group">
                    {!! Form::label('Content 2') !!}
                    {!! Form::textarea('Content2', null, ['class'=>'form-control ckeditor', 'rows' => 3, 'cols' => 3, 'style' => '']) !!}
                </div>
            </div>
        </div>

       
        
        
    </div>
    
    <div id="meta" class="tab-pane fade">
        <div class="row">
            <div class="col-md-6 ">
                <div class="form-group">
                    {!! Form::label('Meta Title') !!}
                    {!! Form::text('MetaTitle', null , array('class' => 'form-control',$required) ) !!}
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    {!! Form::label('Meta Keyword') !!}
                    {!! Form::text('MetaKeyword', null , array('class' => 'form-control',$required) ) !!}
                </div>
            </div>
            
        </div>
        
        <div class="row">
            
            <div class="col-md-12 col-xs-12 col-lg-12">
                <div class="form-group">
                    {!! Form::label('Meta Description') !!}
                    {!! Form::textarea('MetaDescription', null, ['class'=>'form-control','id' => 'MetaDescription', 'rows' => 5, 'cols' => 100]) !!}
                </div>
            </div>
        </div>
        
    </div>
    
    <div id="faqs" class="tab-pane fade">
        @include("admin.common.faqs_form")
    </div>
    
    
    
</div>

<br clear="all"/>
<div class="row">
    <div class="col-md-8">
                {!! Form::hidden('_token', csrf_token(),array("id"=>"_token")) !!}

        <button type="submit" class="btn btn-primary mr-1 mb-1 waves-effect waves-light">Save</button>
        <a href="{{url('admin/pages')}}" class="btn btn-outline-warning mr-1 mb-1 waves-effect waves-light">Cancel</a>
    </div>
</div>
@include('vendor_script')
@section('myscript')
{{-- Page js files --}}
<script>
  var options = {
    filebrowserImageBrowseUrl: '/laravel-filemanager?type=Images',
    filebrowserImageUploadUrl: '/laravel-filemanager/upload?type=Images&_token={{csrf_token()}}',
    filebrowserBrowseUrl: '/laravel-filemanager?type=Files',
    filebrowserUploadUrl: '/laravel-filemanager/upload?type=Files&_token={{csrf_token()}}'
  };
</script>
<script>
    $(document).ready(function () {

        CKEDITOR.config.allowedContent = true;
        CKEDITOR.replace("ckeditor", {filebrowserImageBrowseUrl: '/file-manager/ckeditor',
        });

    });

</script>

<script>
    $( document ).ready(function() {
        $('#media_action').val("<?php echo $action; ?>");
        if($( "#template" ).val()=="None"){
            
            $("#noneTemplate").show();
             $("#boilerTemplate").hide();
              $("#bannerimage").hide();
             
        }else  if($( "#template" ).val()=="Boiler"){
            $("#boilerTemplate").show();
            $("#bannerimage").hide();
        }else  if($( "#template" ).val()=="About"){
            $("#boilerTemplate").hide();
            $("#bannerimage").show();
        }else  if($( "#template" ).val()=="WhatsCovered"){
            $("#boilerTemplate").hide();
            $("#img").hide();
            $("#bannerimage").hide();
        }

    $('#template').on('change', function() {
        var value = $(this).val();
        if(value== "None"){
            
            $("#noneTemplate").show();
             $("#boilerTemplate").hide(); 
             $("#bannerimage").hide();

        }else if(value == "Boiler"){
            $("#boilerTemplate").show();
            $("#bannerimage").hide();
           
        }else  if($( "#template" ).val()=="About"){
            $("#boilerTemplate").hide();
            $("#bannerimage").show();
        }else  if($( "#template" ).val()=="WhatsCovered"){
            $("#boilerTemplate").hide();
              $("#img").hide();
              $("#bannerimage").hide();
        }
    });
    $( "#removeImage" ).click(function() {
            $("#HeaderImageName").val(" ");
            
          });
           $( "#removeImage2" ).click(function() {
            $("#bannerImage").val(" ");
            
          });
    
    
    });
</script>

@endsection