<div class="panel panel-primary">

    <header class="panel-heading">
      <h2>@lang('backend.button-redirection')</h2>
    </header>

    <div class="panel-body">

      @include('flash::message')

      <form action="{{ route('updateRedirection') }}" method="POST">
        {{ csrf_field() }}
        <input name="id1" type="hidden" value="{{ $banner1->id or '' }}">
        <input name="id2" type="hidden" value="{{ $banner2->id or '' }}">

        <div class="col-xs-12 col-sm-6">
          <div class="panel panel-primary">

            <div class="panel-heading">
              @php
                $get = $banner1->locales()->where('locale',config('app.locale'))->first();
                $target_page = '';
                if ($banner1->media_target) {
                  $target_page = App\PageName::where('key', $banner1->media_target)->first();
                }
              @endphp
              <h3>{{ $get->media_title or $banner1->media_title }}</h3>
            </div>

            <div class="panel-body">

              <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
                  <div class="form-group">
                    <label for="button" class="control-label">@lang('backend.current-button')</label>
                    <a class="btn btn-primary" href="/{{ $target_page ? $target_page->slug : '' }}">
                      {{ $target_page ? ucwords($target_page->page_name) : 'No Target' }}
                    </a>
                  </div>
                </div>

                <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
                  <label for="select" class="control-label">@lang('backend.new-redirection')</label>
                  <select name="redirect1" class="selectpicker" data-width="100%">
                    @foreach ($pageName as $page)
                      <option value="{{ $page->key }}" {{ $page->key==$banner1->media_target ? 'selected' : '' }}>
                        {{ $page->page_name }}
                      </option>
                   @endforeach
                  </select>
                </div>
              </div>

            </div>

          </div>
        </div>

        <div class="col-xs-12 col-sm-6">
          <div class="panel panel-primary">

            <div class="panel-heading">
              @php
                $get = $banner2->locales()->where('locale',config('app.locale'))->first();
                $target_page = '';
                if ($banner2->media_target) {
                  $target_page = App\PageName::where('key', $banner2->media_target)->first();
                }
              @endphp
              <h3>{{ $get->media_title or $banner2->media_title }}</h3>
            </div>

            <div class="panel-body">

              <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
                  <div class="form-group">
                    <label for="button" class="control-label">@lang('backend.current-page')</label>
                    <a class="btn btn-primary" href="/{{ $target_page ? $target_page->slug : '' }}">
                      {{ $target_page ? ucwords($target_page->page_name) : 'No Target' }}
                    </a>
                  </div>
                </div>

                <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
                  <label for="select" class="control-label">@lang('backend.new-redirection')</label>
                  <select name="redirect2" class="selectpicker" data-width="100%">
                    @foreach ($pageName as $page)
                      <option value="{{ $page->key }}" {{ $page->key==$banner2->media_target ? 'selected' : '' }}>
                        {{ $page->page_name }}
                      </option>
                    @endforeach
                  </select>
                </div>
              </div>

            </div>

          </div>
        </div>

        <div class="col-xs-12 text-right">
          <button type="submit" class="btn btn-primary">@lang('backend.update')</button>
        </div>

      </form>

    </div>


  </div>