@extends('layouts.app')
@push('title')
    {{ $pageTitle }}
@endpush
@section('content')

    <div class="page-content-wrapper bda-pb-100 bda-pt-30 bda-px-18 ">
        <div class="bda-mb-30">
            <!-- breadcrumb  -->
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb bda-breadcrumb">
                    <li class="breadcrumb-item title-light">{{$previousBreadcrumb}}</a></li>
                    <li class="breadcrumb-item active " aria-current="page">{{$breadcrumb}}</li>
                </ol>
            </nav>
        </div>
        <!-- data table area start -->
        <div class="bda-table-data overflow-x-auto">
            <div class="bda-card-area-box">
                <div class="bda-card-box">
                    <form class="ajax" action="{{ route('admin.settings.open-ai.update') }}" method="POST"
                          data-callback="formResponse">
                        @csrf
                        <div class="row">
                            <div class="col-md-4 bda-from-box">
                                <label class="bda-text-label">{{__('Choose Model')}}</label>
                                <select name="model" class="bda-from-control" id="">
                                    <option selected disabled>{{__('Select One')}}</option>
                                    @foreach (openAiModel() as $modelValue => $modelLabel)
                                        <option
                                            value="{{ $modelValue }}" {{ $openAiData?->model == $modelValue ? 'selected' : '' }}>
                                            {{ __($modelLabel) }}
                                        </option>
                                    @endforeach
                                </select>
                                @error('model')
                                <span class="invalid-feedback mb-3 mt-0 pt-0" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                                @enderror
                            </div>
                            <div class="col-md-4 bda-from-box">
                                <label class="bda-text-label">{{__('Secret Key')}}</label>
                                <input type="text"
                                       class="bda-from-control @error('secret_key') is-invalid @enderror"
                                       name="secret_key" placeholder="{{__('Secret Key')}}"
                                       value="{{ old('secret_key') ?? $openAiData?->secret_key }}">
                                @error('secret_key')
                                <span class="invalid-feedback mb-3 mt-0 pt-0" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                                @enderror
                            </div>
                            <div class="col-md-4 bda-from-box">
                                <label class="bda-text-label">{{__('Character Limit')}}</label>
                                <input type="text"
                                       class="bda-from-control @error('character_limit') is-invalid @enderror"
                                       name="character_limit" placeholder="{{__('Character Limit')}}"
                                       value="{{ old('character_limit') ?? $openAiData?->character_limit }}">
                                @error('character_limit')
                                <span class="invalid-feedback mb-3 mt-0 pt-0" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                                @enderror
                            </div>
                        </div>
                        <div>
                            <button class="bda-btu-theme" type="submit">{{__("Update")}}</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <!-- data table area end -->
    </div>

@endsection
