@extends('layouts.admin_layout')

@section('content')



<main class="h-full pb-16 overflow-y-auto">
          <div class="container grid px-6 mx-auto">
            <br><br>
            <h2
              class="my-6 text-2xl font-semibold text-gray-700 dark:text-gray-200"
            >
            <span class="text-blue-500">Edit</span> Package
            </h2>
            <!-- CTA -->
            <a
              class="flex items-center justify-between p-4 mb-8 text-sm font-semibold bg-blue-600 shadow-md focus:outline-none focus:shadow-outline-green"
              href="{{ url('/') }}" style="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="flex mb-4 text-lg font-semibold text-gray-600 dark:text-gray-300"
            >
              {{ $plan->name }} <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 mt-1 ml-2" viewBox="0 0 20 20" fill="currentColor">
                <path fill-rule="evenodd" d="M10 2a4 4 0 00-4 4v1H5a1 1 0 00-.994.89l-1 9A1 1 0 004 18h12a1 1 0 
                00.994-1.11l-1-9A1 1 0 0015 7h-1V6a4 4 0 00-4-4zm2 5V6a2 2 0 10-4 0v1h4zm-6 3a1 1 0 112 0 1 1 0 01-2 
                0zm7-1a1 1 0 100 2 1 1 0 000-2z" clip-rule="evenodd" />
              </svg>
            </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.plan_update', $plan->id) }}" class="mt-4" enctype="multipart/form-data">
            @csrf
            @method('patch')
            <div class="flex items-center mb-4">
              <label class="block w-full mb-5 mr-3 text-sm">
                <span class="font-semibold text-gray-700 dark:text-gray-400">Package Name</span>
                <input
                  class="@error('name') 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"
                   name="name" type="text" value="{{ $plan->name }}"
                />
                @error('name')
                <span class="text-xs text-red-600 dark:text-red-400">
                    {{ $message }}
                    </span>
                @enderror
              </label>

              
              <label class="block w-full mb-5 text-sm">
                <span class="font-semibold text-gray-700 dark:text-gray-400">Period</span>
                <input
                  class="@error('period') 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"
                   name="period" type="number" value="{{ $plan->period }}"
                />
                @error('period')
                <span class="text-xs text-red-600 dark:text-red-400">
                    {{ $message }}
                    </span>
                @enderror
              </label>
            </div>

            <div class="flex items-center mb-4">
              <label class="block w-full mb-5 mr-3 text-sm">
                <span class="font-semibold text-gray-700 dark:text-gray-400">Min Amount</span>
                <input
                  class="@error('min_amount') 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"
                   name="min_fund" type="number" value="{{ $plan->min_fund }}" step="any"
                />
                @error('min_fund')
                <span class="text-xs text-red-600 dark:text-red-400">
                    {{ $message }}
                    </span>
                @enderror
              </label>

              
              <label class="block w-full mb-5 text-sm">
                <span class="font-semibold text-gray-700 dark:text-gray-400">Max Amount</span>
                <input
                  class="@error('max_amount') 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"
                   name="max_fund" type="number" value="{{ $plan->max_fund }}" step="any"
                />
                @error('max_fund')
                <span class="text-xs text-red-600 dark:text-red-400">
                    {{ $message }}
                    </span>
                @enderror
              </label>
            </div>

            <div class="flex items-center mb-4">
              <label class="block w-full mb-5 mr-3 text-sm">
                <span class="font-semibold text-gray-700 dark:text-gray-400">Minimum ROI</span>
                <input
                  class="@error('percent_profit') 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"
                   name="min_roi" type="number" value="{{ $plan->min_roi }}" step="any"
                />
                @error('min_roi')
                <span class="text-xs text-red-600 dark:text-red-400">
                    {{ $message }}
                    </span>
                @enderror
              </label>
             
              <label class="block w-full mb-5 text-sm">
                <span class="font-semibold text-gray-700 dark:text-gray-400">Maximum ROI</span>
                <input
                  class="@error('profit_days') 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"
                   name="max_roi" type="number" value="{{ $plan->max_roi }}" step="any"
                />
                @error('max_roi')
                <span class="text-xs text-red-600 dark:text-red-400">
                    {{ $message }}
                    </span>
                @enderror
              </label>
            </div>


            <div class="flex items-center mb-4">
              <label class="block w-full mb-5 mr-3 text-sm">
                <span class="font-semibold text-gray-700 dark:text-gray-400">Minimum Limit</span>
                <input
                  class="@error('percent_profit') 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"
                   name="limit_min" type="number" value="{{ $plan->limit_min }}" step="any"
                />
                @error('limit_min')
                <span class="text-xs text-red-600 dark:text-red-400">
                    {{ $message }}
                    </span>
                @enderror
              </label>
             
              <label class="block w-full mb-5 text-sm">
                <span class="font-semibold text-gray-700 dark:text-gray-400">Maximum Limit</span>
                <input
                  class="@error('profit_days') 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"
                   name="limit_max" type="number" value="{{ $plan->limit_max }}" step="any"
                />
                @error('limit_max')
                <span class="text-xs text-red-600 dark:text-red-400">
                    {{ $message }}
                    </span>
                @enderror
              </label>
            </div>


            <div class="items-center mb-4 md:flex">
            <label class="block w-full mt-4 text-sm">
                <span class="font-semibold text-gray-700 dark:text-gray-400">Description</span>
                <textarea
                  class="@error('description') 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-green-400 focus:outline-none focus:shadow-outline-green dark:focus:shadow-outline-gray"
                  rows="4" name="description" required
                >{{ $plan->description }}</textarea>
                @error('description')
                <span class="text-xs text-red-600 dark:text-red-400">
                    {{ $message }}
                    </span>
                @enderror
              </label>
            </div>


              <div class="mx-auto">
              <button
                  class="px-5 py-3 font-medium leading-5 text-white transition-colors duration-150 bg-blue-600 border border-transparent active:bg-green-500 hover:bg-green-700 focus:outline-none focus:shadow-outline-green"
                  type="submit" style="color: #fff;"
                >
                  Update
                </button>
              </div>
            </form>

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



@endsection