@extends('dashboard.layouts.app')
@section('title', trans('admin.edit') . ' - ')
@section('speedbar')
    <div class="content-header row">
        <div class="content-header-left col-md-9 col-12 mb-2">
            <div class="row breadcrumbs-top">
                <div class="col-12">
                    <h2 class="content-header-title float-left mb-0">@lang('admin.edit')</h2>
                    <div class="breadcrumb-wrapper col-12">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item ">
                                <a href="{{ route('dashboard') }}">@lang('admin.home')</a>
                            </li>
                            <li class="breadcrumb-item ">
                                <a href="{{ route('dashboard.payment-systems.index') }}">@lang('admin.payment-systems.title')</a>
                            </li>
                            <li class="breadcrumb-item">
                                <a
                                    href="{{ route('dashboard.payment-system-items.index', $paymentSystemId) }}">@lang('admin.payment-system-items.title')</a>
                            </li>
                            <li class="breadcrumb-item active">
                                @lang('admin.edit')
                            </li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('content')
    <div class="row">
        <div class="col-md-12 col-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">@lang('admin.edit')</h4>
                </div>
                <div class="card-content">
                    <form class="form form-vertical"
                        action="{{ route('dashboard.payment-system-items.update', ['paymentSystemId' => $paymentSystemId, 'payment_system_item' => $item->id]) }}"
                        enctype="multipart/form-data" method="post">
                        @method('put')
                        @csrf
                        <div class="card-body">
                            <div class="form-body">
                                <p>@lang('admin.all_fields_with')</p>
                                <div class="row">

                                    <div class="col-12">
                                        <div class="row">
                                            <div class="col-12">
                                                <div class="form-group">
                                                    <label for="title_uz">@lang('admin.partners.name') (uz) *</label>
                                                    <input type="text" id="title_uz" required
                                                        class="form-control @error('title_uz') is-invalid @enderror"
                                                        name="title_uz" value="{{ old('title_uz', $item->title['uz']) }}"
                                                        placeholder="@lang('admin.partners.name') (uz)">
                                                    @error('title_uz')
                                                        <div class="invalid-feedback">
                                                            {{ $message }}
                                                        </div>
                                                    @enderror
                                                </div>
                                            </div>
                                            <div class="col-12">
                                                <div class="form-group">
                                                    <label for="title_ru">@lang('admin.partners.name') (ru) *</label>
                                                    <input type="text" id="title_ru" required
                                                        class="form-control @error('title_ru') is-invalid @enderror"
                                                        name="title_ru" value="{{ old('title_ru', $item->title['ru']) }}"
                                                        placeholder="@lang('admin.partners.name') (ru)">
                                                    @error('title_ru')
                                                        <div class="invalid-feedback">
                                                            {{ $message }}
                                                        </div>
                                                    @enderror
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-12">
                                        <div class="form-group">
                                            <label for="description_uz">@lang('admin.partners.description') (uz)</label>
                                            <textarea id="description_uz" class="form-control @error('description_uz') is-invalid @enderror" name="description_uz"
                                                placeholder="@lang('admin.partners.description')">@if (isset($item->description['uz'])){{ old('description_uz', $item->description['uz']) }}@else{{ old('description_uz') }}@endif</textarea>
                                            @error('description_uz')
                                                <div class="invalid-feedback">
                                                    {{ $message }}
                                                </div>
                                            @enderror
                                        </div>
                                    </div>

                                    <div class="col-12">
                                        <div class="form-group">
                                            <label for="description_ru">@lang('admin.partners.description') (ru)</label>
                                            <textarea id="description_ru" class="form-control @error('description_ru') is-invalid @enderror" name="description_ru"
                                                placeholder="@lang('admin.partners.description')">@if (isset($item->description['ru'])){{ old('description_ru', $item->description['ru']) }}@else{{ old('description_ru') }}@endif</textarea>
                                            @error('description_ru')
                                                <div class="invalid-feedback">
                                                    {{ $message }}
                                                </div>
                                            @enderror
                                        </div>
                                    </div>

                                    <div class="col-12">
                                        <div class="form-group">
                                            <label for="logo">@lang('admin.payment-systems.logo') @if ($item->getLogo())
                                                    <a href="{{ $item->getLogo() }}" target="_blank">@lang('admin.see')</a>
                                                @endif
                                            </label>
                                            <input type="file" id="logo"
                                                class="form-control @error('logo') is-invalid @enderror" name="logo">
                                            @error('logo')
                                                <div class="invalid-feedback">
                                                    {{ $message }}
                                                </div>
                                            @enderror
                                        </div>
                                    </div>

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

                        <div class="card-footer pb-0 pl-0 pt-1">
                            <div class="col-12 mb-0">
                                <div class="row">
                                    <div class="col-3">
                                        <button type="submit"
                                            class="btn btn-primary mr-1 mb-1 waves-effect waves-light btn-icon">
                                            <i class="feather icon-save"></i> @lang('admin.save')
                                        </button>
                                    </div>

                                    <div class="col-9">
                                        <a href="{{ route('dashboard.payment-system-items.index', $paymentSystemId) }}"
                                            class="btn btn-danger mr-1 mb-1 waves-effect waves-light btn-icon pull-right">
                                            <i class="feather icon-x-circle"></i> @lang('admin.cancel')
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
@endsection
