@extends('panel.layouts.layout')
@section('content')

<!-- =====================================
==== Start settings  -->
<br>
<section class="settings">
    <div class="container-fluid">
     <div class="row">
        <div class="col-md-11">
            <div class="wel-text">
                <div class="path">
                 <ul>
                    <a href="{{ URL::to('/admin/home') }}"><i class="icon-home2 position-left"></i> @lang('home.home')</a>
                    <span>/</span>
                    <a href="{{ URL::to('admin/setting') }}"><i class="icon-home2 position-left"></i> @lang('home.general_settings')</a>
                    <span>/</span>
                    @lang('home.update')</span> 

                </ul>
            </div>
        </div>
    </div>

    <div class="col-md-1">
        <div class="dropdown">
          <button class="btn btn-defualt dropdown-toggle" type="button" data-toggle="dropdown">@lang('home.links')
              <span class="caret"></span></button>
              <ul class="dropdown-menu" style="padding: 10px">
                <li  style="padding: 10px"><a href="{{ URL::to('ar/admin/setting') }}"><i class="icon-gear"></i>@lang('home.general_settings')</a></li>
                <li  style="padding: 5px"><a href="{{ URL::to('ar/admin/reports_browsing') }}"><i class="icon-copy"></i> @lang('home.full_report')</a></li>
            </ul>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-lg-10 col-md-6">
        <div class="item">
            <div class="head">
                <h5>  @lang('home.general_settings')</h5>
            </div>
              <form class="form-horizontal form-validate-jquery" method="POST" action="{{ URL::to('/admin/setting') }}" enctype='multipart/form-data'>
                @if ($errors->any())
                @foreach ($errors->all() as $error)
                <div class="alert alert-danger alert-dismissible">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>{{ $error }}
                </div>
                @endforeach
                @endif
                @if(Session::has('success'))
                <div class="alert alert-success alert-dismissible">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>{{ Session::get('success') }}
                </div>
                @endif
                @csrf
                @include('panel.setting.form')
                <button type="submit" class="btn btn-primary">@lang('home.save') <i class="icon-arrow-left13 position-right"></i></button>

            </form>
        </div>
    </div>
    <div class="col-md-2">
        @if(isset($setting))
            @if($setting->logo != null)
                <img src="{{url(@$info->logo)}}" class="img-responsive" style="max-width:100%" >
            @else
                <img src="{{asset('/img/unknown.png')}}" class="img-responsive" style="max-width:100%" >
            @endif
        @endif
    </div>
    @if(isset($info))
    @foreach($info->external_resources as $file)
    <div class="col-md-2">
        <a href="{{@$file->file}}" target="_blank">
            <img src="{{asset('/img/code.svg')}}" style="height: 70px; margin: 0 30px;" class="img-responsive">
        </a>
        <small class="text-center">
            @include('dashboard.setting.external_delete_model')
        </small>
    </div>
    @endforeach
    @endif
    
</div>
</div>
</section>

@stop

@section('jsCode')
    <script>
   //start email generator
   var wrap_emails = $(".wrap_emails>#space_emails");
   var add_new_email = $(".add_new_email");
   $(add_new_email).click(function (e) {
    e.preventDefault();
    $(wrap_emails).append('<div class="form-group row" ><label class="control-label col-lg-12">@lang('home.email') </label><div class="col-lg-5 mt-0 mb-0"><input type="email" name="email[]" class="full-width line-height-24" id="email" placeholder="@lang('home.email')"></div><div class="col-lg-5 mt-0 mb-0"><input type="text" name="department[]" class="full-width line-height-24" id="text"  placeholder="@lang('home.department')"></div><div class="col-lg-2 mt-0 mb-0"><button class="remove_field full-width btn btn-danger line-height-24 mt-0 mb-0">-</button></div></div>');
  });
    //start email generator
   var wrap_address = $(".wrap_address>#space_address");
   var add_new_address = $(".add_new_address");
   $(add_new_address).click(function (e) {
    e.preventDefault();
    $(wrap_address).append('<div class="form-group row" ><label class="control-label col-lg-12">@lang('home.address') </label><div class="col-lg-10"><input type="text" name="address[]" class="full-width" id="text" placeholder="@lang('home.address')"></div><div class="col-lg-2 mt-0 mb-0"><button class="remove_field btn btn-danger fz-14 line-height-24 mt-0 mb-0">-</button></div></div>');
  });
   //start phones generator
   var wrap_phones = $(".wrap_phones>#space_phones");
   var add_new_phone = $(".add_new_phone");
   $(add_new_phone).click(function (e) {
    e.preventDefault();
    $(wrap_phones).append('<div class="form-group row" ><label class="control-label col-lg-12">@lang('home.phone') </label><div class="col-lg-10"><input type="text" name="phone[]" class="full-width" id="phone" placeholder="@lang('home.phone')"></div><div class="col-lg-2  "><button class="remove_field btn btn-danger  mt-0 mb-0">-</button></div></div>');
  });

   //start whatsapp generator
   var wrap_whatsapp = $(".wrap_whatsapp>#space_whatsapp");
   var add_new_whatsapp = $(".add_new_whatsapp");
   $(add_new_whatsapp).click(function (e) {
    e.preventDefault();
    $(wrap_whatsapp).append('<div class="form-group row" ><label class="control-label col-lg-12">@lang('home.whatsapp') </label><div class="col-lg-10"><input type="text" name="whatsapp[]" class="full-width" id="whatsapp" placeholder="@lang('home.whatsapp')"></div><div class="col-lg-2 "><button class="remove_field btn btn-danger  mt-0 mb-0">-</button></div></div>');
  });
   //start  social media generator
   var wrap_social_media = $(".wrap_social_media>#space_social_media");
   var add_new_social_media = $(".add_new_social_media");
   $(add_new_social_media).click(function (e) {
    e.preventDefault();
    $(wrap_social_media).append('<div class="form-group row" ><div class="col-lg-2"><button class="remove_field btn btn-danger fz-14 line-height-24 mt-0 mb-0">-</button></div><input type="hidden" name="social_img[]" value="/img/unknown.png"multiple><input type="hidden" name="social_media_lang[]" value="{{ @$lang->id }}"  multiple><div class="col-lg-2"><img src="{{url('/img/unknown.png')}}" class="img-responsive" style="max-height: 46px; object-fit: contain;" ></div><div class="col-lg-4 mt-0 mb-0"><input type="text" name="url[]" multiple class="full-width" id="url"  placeholder="@lang('home.url')"></div><div class="col-lg-4 mt-0 mb-0"><input type="file" name="social_logo[]" class="file-styled"  multiple></div></div>');
  });

   $(document).on("click",".remove_field",function(){
    $(this).parent().parent().remove();
  });
    </script>
@stop
