@extends('layouts.masterBackend')

@section('title', __('backend.settings'))

@section('content')
    <!-- MAIN CONTENT -->
    <div class="container-fluid">
	    <div class="row">

        {{-- company profile --}}
        <div class="col-xs-12">
          @include('backend.settings.profile')
        </div>
        {{-- /. company profile --}}

        {{-- font setting --}}
        <div class="col-xs-12">
          @include('backend.settings.font')
        </div>
        {{-- /. font setting --}}


        {{-- colors setting --}}
        <div class="col-xs-12">
          @include('backend.settings.colors')
        </div>
        {{-- /. colors settings --}}

        {{-- page name --}}
        <div class="col-xs-12">
          @include('backend.settings.pagename')
        </div>

        {{-- button redirection --}}
        <div class="col-xs-12">
          @include('backend.settings.redirection')
        </div>
        {{-- /. button redirection --}}

        {{-- compresison level --}}
        <div class="col-xs-12">
          @include('backend.settings.compression')          
        </div>
        {{-- /. compression level --}}

        {{-- sitemap --}}
        <div class="col-xs-12">
          @include('backend.settings.sitemap')                    
        </div>
        {{-- /. sitemap --}}

        {{-- maintenace mode --}}
        <div class="col-xs-12">
          @include('backend.settings.maintenace')
        </div>
        {{-- /. maintenace mode --}}

      </div>
    </div>
@endsection

@section('script')
  <script type="text/javascript">
    $("#text_onbanner").on("change",function() {
      var $color = $(this).val();
      $("#textOnBannerExample").find(".content-text").css("color","#"+$color);
    });

    $("input[name='btn_color[]']").each(function() {
      $($(this)).on('change',function(){
        var $id = $(this).data('id');
        var $color = $(this).val();
        if($id == "bgcolor"){
          $("#styleBtnBgColor").html('#btnExample{background-color: #'+$color+'}');
        }else if ($id == "bgcolorhover") {
          $("#styleBtnBgColorHover").html('#btnExample:hover{background-color: #'+$color+'}');
        }else if ($id == "txtcolor") {
          $("#styleBtnTxtColor").html('#btnExample{color: #'+$color+'}');
        }else if ($id == "txtcolorhover") {
          $("#styleBtnTxtColorHover").html('#btnExample:hover{color: #'+$color+'}');
        }
      });
    });

    $("input[name='panel_color[]']").each(function() {
      $($(this)).on('change',function(){
        var $color1 = $("input[data-id='color1']").val();
        var $color2 = $("input[data-id='color2']").val();
        $("#panelColorStyle").html("#panelColor{background: #"+$color1+";background: -webkit-linear-gradient(#"+$color1+", #"+$color2+");background: -o-linear-gradient(#"+$color1+", #"+$color2+");background: -moz-linear-gradient(#"+$color1+", #"+$color2+");background: linear-gradient(#"+$color1+", #"+$color2+");}");
      });
    });

    $(document).ready(function(){
        $('[data-toggle="popover"]').popover();

        $('.fontselect').each(function(){
            var $id = $(this).data('id');

            // replace + signs with spaces for css
            var font = $($(this)).val().replace(/\+/g, ' ');

            // split font into family and weight
            font = font.split(':');

            // set family on paragraphs
            if($id == "caption"){
              $('#captionFont').css('font-family', font[0]);
            }else if($id == "subcaption"){
              $('#subCaptionFont').css('font-family', font[0]);
            }else{
              $($(this)).parents('.font-selector').find('.fontExample').css('font-family', font[0]);
            }
        });
    });

    $('.fontselect').fontselect().each(function(){
      $($(this)).change(function(){

        var $id = $(this).data('id');

        // replace + signs with spaces for css
        var font = $(this).val().replace(/\+/g, ' ');

        // split font into family and weight
        font = font.split(':');

        // set family on paragraphs
        if($id == "caption"){
          $('#captionFont').css('font-family', font[0]);
        }else if($id == "subcaption"){
          $('#subCaptionFont').css('font-family', font[0]);
        }else{
          $(this).parents('.font-selector').find('.fontExample').css('font-family', font[0]);
        }
      });
    });

    $("#defaultFont").click(function(){
      $('.fontselect').each(function(){
        $($(this)).val("");
      });
    });
  </script>
@endsection
