@extends('dashboard.layouts.app')
@section('title', trans('admin.companies.title') . ' - ')
@section('links')
    <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.companies.title')
                    </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 active">
                                @lang('admin.companies.title')
                            </li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('content')
    <div class="row">
        @if ($errors->any())
            <div class="alert alert-danger">
                <ul>
                    @foreach ($errors->all() as $error)
                        <li>{{ $error }}</li>
                    @endforeach
                </ul>
            </div>
        @endif

        <div class="col-md-12 col-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">@lang('admin.companies.title')</h4>
                </div>
                <div class="card-content">
                    <form class="form" action="{{ route('dashboard.companies.update', $company->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-md-6 float-left">
                                                <div class="form-label-group position-relative has-icon-left">
                                                    <input type="text" id="company_name.uz" required
                                                        class="form-control @error('company_name.uz') is-invalid @enderror"
                                                        value="{{ old('company_name.uz', $company->company_name['uz'] ?? '') }}"
                                                        name="company_name[uz]" placeholder="@lang('admin.companies.name')">
                                                    <div class="form-control-position">
                                                        <i class="fa fa-italic"></i>
                                                    </div>
                                                    <label for="company_name.uz">@lang('admin.companies.name') UZ *</label>

                                                    @error('company_name.uz')
                                                        <div class="invalid-feedback">
                                                            {{ $message }}
                                                        </div>
                                                    @enderror
                                                </div>
                                            </div>
                                            <div class="col-md-6 float-left">
                                                <div class="form-label-group position-relative has-icon-left">
                                                    <input type="text" id="company_name.ru" required
                                                        class="form-control @error('company_name.ru') is-invalid @enderror"
                                                        value="{{ old('company_name.ru', $company->company_name['ru'] ?? '') }}"
                                                        name="company_name[ru]" placeholder="@lang('admin.companies.name')">
                                                    <div class="form-control-position">
                                                        <i class="fa fa-italic"></i>
                                                    </div>
                                                    <label for="company_name.ru">@lang('admin.companies.name') RU *</label>

                                                    @error('company_name.ru')
                                                        <div class="invalid-feedback">
                                                            {{ $message }}
                                                        </div>
                                                    @enderror
                                                </div>
                                            </div>
                                            <div class="col-md-6 float-left">
                                                <div class="form-label-group position-relative has-icon-left">
                                                    <input type="text" id="inn" required
                                                        class="form-control @error('inn') is-invalid @enderror"
                                                        value="{{ old('inn', $company->inn) }}" name="inn"
                                                        placeholder="INN">
                                                    <div class="form-control-position">
                                                        <i class="fa fa-italic"></i>
                                                    </div>
                                                    <label for="inn">INN *</label>

                                                    @error('inn')
                                                        <div class="invalid-feedback">
                                                            {{ $message }}
                                                        </div>
                                                    @enderror
                                                </div>
                                            </div>
                                            <div class="col-md-6 float-left">
                                                <div class="form-label-group position-relative has-icon-left">
                                                    <input type="text" id="mfo" required
                                                        class="form-control @error('mfo') is-invalid @enderror"
                                                        value="{{ old('mfo', $company->mfo) }}" name="mfo"
                                                        placeholder="@lang('admin.companies.mfo')">
                                                    <div class="form-control-position">
                                                        <i class="fa fa-italic"></i>
                                                    </div>
                                                    <label for="mfo">@lang('admin.companies.mfo') *</label>

                                                    @error('mfo')
                                                        <div class="invalid-feedback">
                                                            {{ $message }}
                                                        </div>
                                                    @enderror
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-12">
                                        <div class="row">
                                            <div class="col-md-6 float-left">
                                                <div class="form-label-group position-relative has-icon-left">
                                                    <input type="text" id="bank_name.uz" required
                                                        class="form-control @error('bank_name.uz') is-invalid @enderror"
                                                        value="{{ old('bank_name.uz', $company->bank_name['uz'] ?? '') }}" name="bank_name[uz]"
                                                        placeholder="@lang('admin.companies.bank_name')">
                                                    <div class="form-control-position">
                                                        <i class="fa fa-italic"></i>
                                                    </div>
                                                    <label for="bank_name.uz">@lang('admin.companies.bank_name') UZ*</label>

                                                    @error('bank_name.uz')
                                                        <div class="invalid-feedback">
                                                            {{ $message }}
                                                        </div>
                                                    @enderror
                                                </div>
                                            </div>
                                            <div class="col-md-6 float-left">
                                                <div class="form-label-group position-relative has-icon-left">
                                                    <input type="text" id="bank_name.ru" required
                                                        class="form-control @error('bank_name.ru') is-invalid @enderror"
                                                        value="{{ old('bank_name.ru', $company->bank_name['ru'] ?? '') }}" name="bank_name[ru]"
                                                        placeholder="@lang('admin.companies.bank_name')">
                                                    <div class="form-control-position">
                                                        <i class="fa fa-italic"></i>
                                                    </div>
                                                    <label for="bank_name.ru">@lang('admin.companies.bank_name') RU*</label>

                                                    @error('bank_name.ru')
                                                        <div class="invalid-feedback">
                                                            {{ $message }}
                                                        </div>
                                                    @enderror
                                                </div>
                                            </div>

                                        </div>
                                    </div>

                                    <div class="col-12">
                                        <div class="row">
                                            <div class="col-md-6 float-left">
                                                <div class="form-label-group position-relative has-icon-left">
                                                    <input type="text" id="oked" required
                                                        class="form-control @error('oked') is-invalid @enderror"
                                                        value="{{ old('oked', $company->oked) }}" name="oked"
                                                        placeholder="@lang('admin.companies.oked')">
                                                    <div class="form-control-position">
                                                        <i class="fa fa-italic"></i>
                                                    </div>
                                                    <label for="oked">@lang('admin.companies.oked') *</label>

                                                    @error('oked')
                                                        <div class="invalid-feedback">
                                                            {{ $message }}
                                                        </div>
                                                    @enderror
                                                </div>
                                            </div>
                                            <div class="col-md-6 float-left">
                                                <div class="form-label-group position-relative has-icon-left">
                                                    <input type="text" id="payment_account" required
                                                        class="form-control @error('payment_account') is-invalid @enderror"
                                                        value="{{ old('payment_account', $company->payment_account) }}"
                                                        name="payment_account" placeholder="@lang('admin.companies.payment_account')">
                                                    <div class="form-control-position">
                                                        <i class="fa fa-italic"></i>
                                                    </div>
                                                    <label for="payment_account">@lang('admin.companies.payment_account') *</label>

                                                    @error('payment_account')
                                                        <div class="invalid-feedback">
                                                            {{ $message }}
                                                        </div>
                                                    @enderror
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-12">
                                    <div class="row">
                                        <div class="col-md-6 float-left">
                                            <fieldset class="form-label-group">
                                                <textarea class="form-control" required name="address[ru]" id="label-textarea-ru" rows="3"
                                                    placeholder="@lang('admin.settings.address')">{{ old('address.ru', $company->address['ru']) }}</textarea>
                                                <label for="label-textarea-ru">@lang('admin.settings.address') RU *</label>
                                            </fieldset>
                                        </div>

                                        <div class="col-md-6 float-left">
                                            <fieldset class="form-label-group">
                                                <textarea class="form-control" name="address[uz]" required id="label-textarea" rows="3"
                                                    placeholder="@lang('admin.settings.address')">{{ old('address.uz', $company->address['uz']) }}</textarea>
                                                <label for="label-textarea">@lang('admin.settings.address') UZ *</label>
                                            </fieldset>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-12">
                                    <div class="row">
                                        <div class="col-md-6 float-left">
                                            <div class="form-label-group position-relative has-icon-left">
                                                <input type="text" id="director_full_name.uz" required
                                                    class="form-control @error('director_full_name.uz') is-invalid @enderror"
                                                    value="{{ old('director_full_name.uz', $company->director_full_name['uz'] ?? '') }}"
                                                    name="director_full_name[uz]" placeholder="@lang('admin.companies.director_full_name')">
                                                <div class="form-control-position">
                                                    <i class="fa fa-italic"></i>
                                                </div>
                                                <label for="director_full_name.uz">@lang('admin.companies.director_full_name') UZ *</label>

                                                @error('director_full_name.uz')
                                                    <div class="invalid-feedback">
                                                        {{ $message }}
                                                    </div>
                                                @enderror
                                            </div>
                                        </div>
                                        <div class="col-md-6 float-left">
                                            <div class="form-label-group position-relative has-icon-left">
                                                <input type="text" id="director_full_name.ru" required
                                                    class="form-control @error('director_full_name.ru') is-invalid @enderror"
                                                    value="{{ old('director_full_name.ru', $company->director_full_name['ru'] ?? '') }}"
                                                    name="director_full_name[ru]" placeholder="@lang('admin.companies.director_full_name')">
                                                <div class="form-control-position">
                                                    <i class="fa fa-italic"></i>
                                                </div>
                                                <label for="director_full_name.ru">@lang('admin.companies.director_full_name') RU *</label>

                                                @error('director_full_name.ru')
                                                    <div class="invalid-feedback">
                                                        {{ $message }}
                                                    </div>
                                                @enderror
                                            </div>
                                        </div>
                                        <div class="col-md-6 float-left">
                                            <div class="form-label-group position-relative has-icon-left">
                                                <input type="text" id="phone" required
                                                    class="form-control @error('phone') is-invalid @enderror"
                                                    value="{{ old('phone', $company->phone) }}" name="phone"
                                                    placeholder="@lang('admin.companies.phone')">
                                                <div class="form-control-position">
                                                    <i class="fa fa-italic"></i>
                                                </div>
                                                <label for="phone">@lang('admin.companies.phone') *</label>

                                                @error('phone')
                                                    <div class="invalid-feedback">
                                                        {{ $message }}
                                                    </div>
                                                @enderror
                                            </div>
                                        </div>
                                    </div>
                                </div>

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

                <div class="card-footer">
                    <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') }}"
                                    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
