@extends('admin.admin-master')
@section('content')
<div>&nbsp; </div>
@if (Session::has('message'))
<span class="alert {{Session::get('class')}}">
    {{Session::get('message')}}
</span>
@endif
<div>&nbsp; </div>
<h3><i class="fa fa-cog"></i> Page Settings  </h3>
<div>&nbsp; </div>
<div class="col-md-12">
    <div class="col-md-6">
        <!-- Form Name -->
        {{Form::open(array('url'=>'/admin/save-page-setting',
                    'method'=>'POST',
                    'id'=>'page_setting_form',
                    'enctype'=>'multipart/form-data'))}}
        <!-- Text input-->
        <h4>Preview Image:</h4>
        <img class="img-responsive" src="{{asset('public/images/'.$settings->header_image)}}">
        <div class="control-group">
            <label class="control-label" for="textinput"> Header Image :  </label>
            {{Form::file('header_img',array('class'=>'filestyle','data-buttonText'=>'Find file','data-size'=>'sm'))}}
            {{Form::hidden('header_img_name',isset($settings->header_image)?$settings->header_image:'')}}
        </div>
        <div class="clearfix">&nbsp;</div>
        <div class="control-group">
            <label class="control-label" for="textinput"> Site name :  </label>
            <div class="controls">
                {{Form::text('site_name',isset($settings->site_name)?$settings->site_name:'',array('class'=>'form-control input-sm','placeholder'=>'Site name'))}}
            </div>
        </div>
        <div class="clearfix">&nbsp;</div>
        <div class="control-group">
            <label class="control-label" for="textinput"> Site title text :  </label>
            <div class="controls">
                {{Form::text('site_title',isset($settings->site_title)?$settings->site_title:'',array('class'=>'form-control input-sm','placeholder'=>'Site title'))}}
            </div>
        </div>
        <div class="clearfix">&nbsp;</div>
        <div class="control-group">
            <label class="control-label" for="textinput"> Welcome text :  </label>
            <div class="controls">
                {{Form::textarea('welcome_text',isset($settings->welcome_text)?$settings->welcome_text:'',array('class'=>'form-control input-sm tinymc','placeholder'=>'Welcome text'))}}

            </div>
        </div>
        <div class="clearfix">&nbsp;</div>
        <div class="control-group">
            <label class="control-label" for="textinput"> Facebook Link :  </label>
            <div class="controls">
                {{Form::text('facebook',isset($settings->facebook)?$settings->facebook:'',array('class'=>'form-control input-sm','placeholder'=>'https://'))}}
            </div>
        </div>
        <div class="clearfix">&nbsp;</div>
        <div class="control-group">
            <label class="control-label" for="textinput"> Google Plus Link :  </label>
            <div class="controls">
                {{Form::text('google',isset($settings->google)?$settings->google:'',array('class'=>'form-control input-sm','placeholder'=>'https://'))}}
            </div>
        </div>
        <div class="clearfix">&nbsp;</div>
        <div class="control-group">
            <label class="control-label" for="textinput"> LinkedIn link :  </label>
            <div class="controls">
                {{Form::text('linkedin',isset($settings->linkedin)?$settings->linkedin:'',array('class'=>'form-control input-sm','placeholder'=>'https://'))}}
            </div>
        </div>

        <div class="clearfix">&nbsp;</div>
        <h4>Ads Image Preview : </h4>
        <img class="img-responsive" src="{{asset('public/images/'.$settings->footer_image)}}">
        <div class="control-group">
            <label class="control-label" for="textinput"> Footer Image :  </label>
            {{Form::file('footer_img',array('class'=>'filestyle','data-buttonText'=>'Find file','data-size'=>'sm'))}}
            {{Form::hidden('footer_img_name',isset($settings->footer_image)?$settings->footer_image:'')}}
            <strong><a href="javascript:void(0)" link="{{$settings->footer_image_link}}" link_id={{$settings->page_id}}" onclick="addImageLink($(this))">Add image link</a></strong>
        </div>
        <div class="clearfix">&nbsp;</div>
        <!-- Button -->
        {{Form::button('Reset',array('type'=>'reset','class'=>'btn btn-sm btn-default'))}}
        {{Form::button('<i class="fa fa-cog"></i> Save ',array('type'=>'button','class'=>'btn btn-sm btn-info','id'=>'save_page_setting'))}}
        <span id="page_loader"></span>
        {{Form::close()}}
        <!--// End Form Name -->
    </div>
    <div class="col-md-6">
        <h3>Home Slider Preview:</h3>
        <!-- Wrapper for slides -->
         @if(!empty($settings->home_page_slider))
        <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
            <!-- Indicators -->
            <ol class="carousel-indicators">
                <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
                <li data-target="#carousel-example-generic" data-slide-to="1"></li>
                <li data-target="#carousel-example-generic" data-slide-to="2"></li>
            </ol>

            <!-- Wrapper for slides -->
            <div class="carousel-inner" role="listbox">
                <?php
                $slider_data = array_filter(unserialize($settings->home_page_slider));
                $c = 0;
                ?>

                @foreach($slider_data as $sl)
                <div class="item {{($c==0)?'active':''}}">
                    <img class="img-responsive" src="{{$sl}}" alt="Vinnorokom Quiz and Poll ">
                    <div class="carousel-caption">
                        <!--  <h3>  Start viral marketing with quiz and poll </h3> -->
                    </div>
                </div>
                <?php ++$c; ?>
                @endforeach

            </div>
            <!-- Controls -->
            <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                <span class="sr-only">Previous</span>
            </a>
            <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
                <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                <span class="sr-only">Next</span>
            </a>
        </div>
         @endif
        {{Form::open(array('url'=>'/admin/homepage-slider-upload',
                    'method'=>'POST',
                    'id'=>'home_page_slider_form',
                    'enctype'=>'multipart/form-data'))}}

        <h4> Add slider Image :</h4>

        @if(!empty($settings->home_page_slider))

        @else
        {{Form::hidden('home_page_slider[]','')}}
        @endif
        <div class="clearfix">&nbsp;</div>
        <!-- Button -->
        <div class="row">
            <div class="col-md-6">
                <div class="control-group">
                    {{Form::hidden('home_page_slider[]','',array('id'=>'file_name','name'=>'image_name'))}}
                    <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>
            <div class="col-md-6">
                <img src="" id="poll_img" class="img-responsive hide">
            </div>
        </div>
        <span id="slider_image"></span>

        <h4> Slider image list :</h4>
        <table class="table table-condensed table-responsive" id="slider-list">
            <tr>
                <th>Image</th>
                <th>Action</th>
            </tr>
            @if(!empty($settings->home_page_slider))
            <?php $slider_data = array_filter(unserialize($settings->home_page_slider)); ?>
            @foreach($slider_data as $sldr)

            <tr>
                <td>
                    {{Form::hidden('home_page_slider[]',$sldr)}}   <img src="{{$sldr}}" class="img-responsive slider" width="30%">
                </td>
                <td><button type="button" class="btn btn-danger btn-sm remove-slider" data-toggle="tooltip" title="Remove Slider" data-placement="top"> <i class="fa fa-close"></i> </button></td>
            </tr>
            @endforeach
            @endif

        </table>
        <div class="clearfix">&nbsp;</div>
        <div class="clearfix right">
            {{Form::button('<i class="fa fa-cog"></i> Save Slider Image',array('type'=>'button','type'=>'submit',
            'class'=>'btn btn-sm btn-info btn-block visible-sm visible-xs',
            'id'=>'save_slider_image'))}}
            {{Form::button('<i class="fa fa-cog"></i> Update Slider Image',array('type'=>'button','type'=>'submit',
            'class'=>'btn btn-sm btn-info hidden-sm hidden-xs',
            'id'=>'save_slider_image'))}}
        </div>
        {{Form::close()}}
    </div>
</div>
<!-- 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 group</h4>
            </div>
            <div class="modal-body group-form">
            </div>
            <p class="">&nbsp;</p>
        </div>
    </div>
</div>

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