@extends('layouts.admin_layout')

@section('content')



<main class="h-full pb-16 overflow-y-auto">
          <div class="container px-6 mx-auto grid">
            <br><br>
            <h2
              class="flex my-6 text-2xl font-semibold text-gray-700 dark:text-gray-200"
            >
             <a href="{{ route('admin.testimonials') }}">
                <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                   <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
                </svg>
             </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Edit Testimonial
            </h2>
            <!-- CTA -->
            <a
              class="flex items-center justify-between p-4 mb-8 text-sm font-semibold rounded-lg shadow-md focus:outline-none focus:shadow-outline-green"
              href="{{ url('/') }}" style="background-color: #e4ab0d; color: #fff;"
            >
              <div class="flex items-center">
                <svg
                  class="w-5 h-5 mr-2"
                  fill="currentColor"
                  viewBox="0 0 20 20"
                >
                  <path
                    d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"
                  ></path>
                </svg>
                <span>Go to website</span>
              </div>
              <span>View &RightArrow;</span>
            </a>

            <!-- General elements -->
            <h4
              class="mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300"
            >
              Edit Testimonial Details
            </h4>
            <div
              class="px-4 py-3 mb-8 bg-white rounded-lg shadow-md dark:bg-gray-800"
            >
            <x-alert/>
            <form method="post" action="{{ route('admin.testimonial_update', $testimonial->id) }}" class="mt-4" enctype="multipart/form-data">
            @csrf
            @method('patch')

            <div class="flex items-center mb-4">
              <label class="block w-full mr-3 text-sm mb-5">
                <span class="text-gray-700 dark:text-gray-400 font-semibold">First Name</span>
                <input
                  class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-green-400 focus:outline-none focus:shadow-outline-green dark:text-gray-300 dark:focus:shadow-outline-gray form-input" name="first_name" value="{{ $testimonial->first_name }}" type="text"
                />
              </label>
             
              <label class="block w-full mr-3 text-sm mb-5">
                <span class="text-gray-700 dark:text-gray-400 font-semibold">Last Name</span>
                <input
                  class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-green-400 focus:outline-none focus:shadow-outline-green dark:text-gray-300 dark:focus:shadow-outline-gray form-input" name="last_name" value="{{ $testimonial->last_name }}" type="text"
                />
              </label>
            </div>
            
            <div class="flex items-center mb-4">
              <label class="block w-full mr-3 text-sm mb-5">
                <span class="text-gray-700 dark:text-gray-400 font-semibold">Facebook Handle</span>
                <input
                  class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-green-400 focus:outline-none focus:shadow-outline-green dark:text-gray-300 dark:focus:shadow-outline-gray form-input" name="facebook" value="{{ $testimonial->facebook }}" type="text"
                />
              </label>
             
              <label class="block w-full text-sm mb-5">
                <span class="text-gray-700 dark:text-gray-400 font-semibold">Instagram Handle</span>
                <input
                  class="block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-green-400 focus:outline-none focus:shadow-outline-green dark:text-gray-300 dark:focus:shadow-outline-gray form-input" name="instagram" value="{{ $testimonial->instagram }}" type="text"
                />
              </label>
            </div>
            
                <div
                  align="center" class="rounded-full">
                  @if($testimonial->image != null)
                  <img src="{!! asset('storage/images/'.$testimonial->image) !!}" alt="Testifier photo" style="height: 150px !important; width:150px; border-radius: 50%; border: 2px solid #e4ab0d; object-fit: cover;">
                  @else
                  <img src="{!! asset('assets/img/download.png') !!}" alt="Testifier photo" style="height: 150px !important; width:150px; border-radius: 50%; border: 2px solid #e4ab0d;">
                  @endif
                </div>

            <div class="flex items-center mb-4">
              <label class="block w-full text-sm mb-5">
              <span class="text-gray-700 dark:text-gray-400 font-semibold">Testifier Image</span>
              <input type="file" class="@error('image') focus:border-red-400 focus:outline-none focus:shadow-outline-red @enderror block w-full mt-1 text-sm dark:border-gray-600 dark:bg-gray-700 focus:border-green-400 focus:outline-none focus:shadow-outline-green dark:text-gray-300 dark:focus:shadow-outline-gray form-input" 
               id="upload" name="image">
              @error('image')
              <span class="text-xs text-red-600 dark:text-red-400">
                  {{ $message }}
                </span>
              @enderror
              </label>
            </div>
            
            <div class="md:flex items-center mb-4">
            <label class="block w-full mt-4 text-sm">
                <span class="text-gray-700 dark:text-gray-400 font-semibold">Testifier Message</span>
                <textarea
                  class="@error('content') focus:border-red-400 focus:outline-none focus:shadow-outline-red @enderror 
                  block w-full mt-1 text-sm dark:text-gray-300 dark:border-gray-600 dark:bg-gray-700 form-textarea 
                  focus:border-purple-400 focus:outline-none focus:shadow-outline-purple dark:focus:shadow-outline-gray"
                  rows="4" name="content"
                > {{ $testimonial->content }}</textarea>
                @error('content')
                <span class="text-xs text-red-600 dark:text-red-400">
                    {{ $message }}
                    </span>
                @enderror
              </label>
            </div>


              <div class="flex mx-auto">
              <button
                  class="inline-flex items-center px-5 py-3 font-medium leading-5 text-white transition-colors duration-150 border border-transparent rounded-lg active:bg-green-500 hover:bg-green-700 focus:outline-none focus:shadow-outline-green"
                  type="submit" style="background-color: #e4ab0d; color: #fff;border-radius:25px;"
                >
                  Done &nbsp;<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6"    fill="none" viewBox="0 0 24 24" stroke="currentColor">
                          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
                       </svg>
                </button>
              </div>
            </form>

        </div>
      </div>                      
    </div>
</main>



@endsection