<h1 class="bda-fs-24 title-light">{{__('Edit Package')}}</h1>
<div class="bda-pt-30 bda-pb-30">
    <form class="ajax" data-table-id="packageDataTable" data-modal-id="packageEditModal"
          action="{{route('admin.package.update')}}" method="POST"
          enctype="multipart/form-data" data-callback="formResponse">
        @csrf
        <input type="hidden" name="updateId" value="{{encrypt($package?->id)}}">
        <div class="row">
            <div class="col-md-12">
                <div class="col-md-12 d-flex gap-5">
                    <div class="bda-from-box">
                        <div class="bda-form-group-check">
                            <input type="checkbox" id="isPopularStatus" name="is_popular" {{old('is_popular', $package->is_popular)== IS_POPULAR_YES ? 'checked' : ''}}>
                            <label for="isPopularStatus">{{ __('Is Popular ?') }}</label>
                        </div>
                        @error('is_popular')
                        <span class="invalid-feedback mb-3 mt-0 pt-0" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                        @enderror
                    </div>
                    <div class="bda-from-box">
                        <div class="bda-form-group-check">
                            <input type="checkbox" id="isTrailStatus" name="is_trail" {{old('is_trail', $package->is_trail)== IS_TRAIL_YES ? 'checked' : ''}}>
                            <label for="isTrailStatus">{{ __('Is Trail ?') }}</label>
                        </div>
                        @error('is_trail')
                        <span class="invalid-feedback mb-3 mt-0 pt-0" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                        @enderror
                    </div>
                </div>

            </div>
            <div class="col-md-6">
                <div class="bda-from-box">
                    <label class="bda-text-label">{{ __('Package Name') }}</label>
                    <input type="text" class="bda-from-control @error('package_name') is-invalid @enderror"
                           name="package_name" placeholder="{{ __('Package Name') }}"
                           value="{{old('package_name') ?? $package?->package_name}}">
                    @error('package_name')
                    <span class="invalid-feedback mb-3 mt-0 pt-0" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                    @enderror
                </div>
            </div>
            <div class="col-md-6">
                <div class="bda-from-box">
                    <label class="bda-text-label">{{ __('Monthly Price') }}</label>
                    <input type="text" class="bda-from-control @error('monthly_price') is-invalid @enderror"
                           name="monthly_price"
                           placeholder="{{ __('Monthly Price') }}"
                           value="{{old('monthly_price') ?? $package?->monthly_price}}">
                    @error('monthly_price')
                    <span class="invalid-feedback mb-3 mt-0 pt-0" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                    @enderror
                </div>
            </div>
            <div class="col-md-6">
                <div class="bda-from-box">
                    <label class="bda-text-label">{{ __('Yearly Price') }}</label>
                    <input type="text" class="bda-from-control @error('yearly_price') is-invalid @enderror"
                           name="yearly_price"
                           placeholder="{{ __('Yearly Price') }}"
                           value="{{old('yearly_price') ?? $package?->yearly_price}}">
                    @error('yearly_price')
                    <span class="invalid-feedback mb-3 mt-0 pt-0" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                    @enderror
                </div>
            </div>
            <div class="col-md-6">
                <div class="bda-from-box">
                    <label class="bda-text-label">{{ __('Credit') }}</label>
                    <input type="text" class="bda-from-control @error('credit') is-invalid @enderror" name="credit"
                           placeholder="{{ __('Credit') }}" value="{{old('credit') ?? $package?->credit}}">
                    @error('credit')
                    <span class="invalid-feedback mb-3 mt-0 pt-0" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                    @enderror
                </div>
            </div>
            <div class="col-md-6">
                <div class="bda-from-box">
                    <label class="bda-text-label">{{ __('Change Status') }}</label>
                    <select name="status" id="status"
                            class="bda-from-control w-100 @error('status') is-invalid @enderror">
                        <option selected disabled>{{ __('Choose One') }}</option>
                        <option
                            value="{{ PACKAGE_STATUS_ENABLE }}" {{old('status', $package?->status)== PACKAGE_STATUS_ENABLE ? 'selected' : ''}}>{{ __('Active') }}</option>
                        <option
                            value="{{ PACKAGE_STATUS_DISABLE }}" {{old('status', $package?->status)== PACKAGE_STATUS_DISABLE ? 'selected' : ''}}>{{ __('Inactive') }}</option>
                    </select>
                    @error('status')
                    <span class="invalid-feedback mb-3 mt-0 pt-0" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                    @enderror
                </div>
            </div>
            <div class="col-md-6">
                <div class="bda-from-box">
                    <p class="bda-text-label d-flex gap-2 align-items-center flex-wrap">{{__('Package Icon')}}  <i title="{{__('Recommended size is 48 x 48 px')}}" class="ri-information-line"></i></p>
                    <label for="updatePackageIcon">
                        <img class="avatar-preview"
                             src="{{$package->icon != null?asset($package?->icon):asset('assets/images/uplod-logo.png')}}"
                             alt="{{__('Package Icon')}}">
                        <input type="file" name="package_icon"
                               class="d-none file-input @error('package_icon') is-invalid @enderror"
                               id="updatePackageIcon" accept="image/*"/>
                    </label>
                    @error('package_icon')
                    <span class="invalid-feedback mb-3 mt-0 pt-0" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                    @enderror
                </div>
            </div>
            <div class="modal-footer flex-wrap border-0 gap-3 p-0">
                <button type="button" class="bda-btu-theme-border" data-bs-dismiss="modal">{{__('Close')}}</button>
                <button type="submit" class="bda-btu-theme">{{__('Save changes')}}</button>
            </div>
        </div>
    </form>
</div>
