@extends('layouts.app')

@section('content')
    <div style="max-width:700px">
        <form method="POST" action="{{ route('company.details.store', ['company' => $company]) }}">
            @csrf
            <div class="row">
                <div class="col">
                    <div class="form-floating mb-3">
                        <input id="user.firstName" name="user[firstName]" value="{{ $details['user']['firstName'] }}"
                            class="form-control rounded-4 bg-white @error('user.firstName') is-invalid @enderror"
                            name="user.firstName" required placeholder="Имя">
                        <label for="user.firstName">Имя</label>
                        @error('user.firstName')
                            <span class="invalid-feedback" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                        @enderror
                    </div>
                </div>
                <div class="col">
                    <div class="form-floating mb-3">
                        <input id="user.secondName" name="user[secondName]" value="{{ $details['user']['secondName'] }}"
                            class="form-control rounded-4 bg-white @error('user.secondName') is-invalid @enderror"
                            name="user.secondName" required placeholder="Фамилия">
                        <label for="user.secondName">Фамилия</label>
                        @error('user.secondName')
                            <span class="invalid-feedback" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                        @enderror
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col">
                    <div class="form-floating mb-3">
                        <input id="user.email" name="user[email]" value="{{ $details['user']['email'] }}"
                            class="form-control rounded-4 bg-white @error('user.email') is-invalid @enderror"
                            name="user.email" required placeholder="Электронная почта">
                        <label for="user.email">Электронная почта</label>
                        @error('user.email')
                            <span class="invalid-feedback" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                        @enderror
                    </div>
                </div>
                <div class="col">
                    <div class="form-floating mb-3">
                        <input id="user.phone" name="user[phone]" value="{{ $details['user']['phone'] }}"
                            class="form-control rounded-4 bg-white @error('user.phone') is-invalid @enderror"
                            name="user.phone" required placeholder="Телефон">
                        <label for="user.phone">Телефон</label>
                        @error('user.phone')
                            <span class="invalid-feedback" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                        @enderror
                    </div>
                </div>
            </div>
            <div class="p-2 fs-5 fw-semibold">Реквизиты</div>

            <div class="form-floating mb-3">
                <input id="details.address" name="details[address]" value="{{ $details['details']['address'] }}"
                    class="form-control rounded-4 bg-white @error('details.address') is-invalid @enderror" required
                    placeholder="Фактический адрес">
                <label for="details.address">Фактический адрес</label>
                @error('details.address')
                    <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                @enderror
            </div>

            <div class="form-floating mb-3">
                <input id="details.legal_address" name="details[legal_address]"
                    value="{{ $details['details']['legal_address'] }}"
                    class="form-control rounded-4 bg-white @error('details.legal_address') is-invalid @enderror" required
                    placeholder="Юридический адрес">
                <label for="details.legal_address">Юридический адрес</label>
                @error('details.legal_address')
                    <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                    </span>
                @enderror
            </div>

            <div class="row">
                <div class="col">
                    <div class="form-floating mb-3">
                        <input id="details.inn" name="details[inn]" value="{{ $details['details']['inn'] }}"
                            class="form-control rounded-4 bg-white @error('details.inn') is-invalid @enderror"
                            name="details.inn" required placeholder="ИНН">
                        <label for="details.inn">ИНН</label>
                        @error('details.inn')
                            <span class="invalid-feedback" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                        @enderror
                    </div>
                </div>
                <div class="col">
                    <div class="form-floating mb-3">
                        <input id="details.snils" name="details[snils]" value="{{ $details['details']['snils'] }}"
                            class="form-control rounded-4 bg-white @error('details.snils') is-invalid @enderror"
                            name="details.snils" required placeholder="СНИЛС">
                        <label for="details.snils">СНИЛС</label>
                        @error('details.snils')
                            <span class="invalid-feedback" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                        @enderror
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col">
                    <div class="form-floating mb-3">
                        <input id="details.bank.name" name="details[bank][name]"
                            value="{{ $details['details']['bank']['name'] }}"
                            class="form-control rounded-4 bg-white @error('details.bank.name') is-invalid @enderror"
                            name="details.bank.name" required placeholder="Наименование банка">
                        <label for="details.bank.name">Наименование банка</label>
                        @error('details.bank.name')
                            <span class="invalid-feedback" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                        @enderror
                    </div>
                </div>
                <div class="col">
                    <div class="form-floating mb-3">
                        <input id="details.bank.bik" name="details[bank][bik]"
                            value="{{ $details['details']['bank']['bik'] }}"
                            class="form-control rounded-4 bg-white @error('details.bank.bik') is-invalid @enderror"
                            name="details.bank.bik" required placeholder="БИК банка">
                        <label for="details.bank.bik">БИК банка</label>
                        @error('details.bank.bik')
                            <span class="invalid-feedback" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                        @enderror
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col">
                    <div class="form-floating mb-3">
                        <input id="details.bank.cur" name="details[bank][cur]"
                            value="{{ $details['details']['bank']['cur'] }}"
                            class="form-control rounded-4 bg-white @error('details.bank.cur') is-invalid @enderror"
                            name="details.bank.cur" required placeholder="Расчетный счет">
                        <label for="details.bank.cur">Расчетный счет</label>
                        @error('details.bank.cur')
                            <span class="invalid-feedback" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                        @enderror
                    </div>
                </div>
                <div class="col">
                    <div class="form-floating mb-3">
                        <input id="details.bank.pers" name="details[bank][pers]"
                            value="{{ $details['details']['bank']['pers'] }}"
                            class="form-control rounded-4 bg-white @error('details.bank.pers') is-invalid @enderror"
                            name="details.bank.pers" required placeholder="Лицевой счет">
                        <label for="details.bank.pers">Лицевой счет</label>
                        @error('details.bank.pers')
                            <span class="invalid-feedback" role="alert">
                                <strong>{{ $message }}</strong>
                            </span>
                        @enderror
                    </div>
                </div>
            </div>
            <button class="btn rounded-4 text-light fw-bold fs-5 w-100 py-3" style="background-color: #20184d;">
                Сохранить изменения
            </button>
        </form>
    </div>
@endsection
