@extends('admin.layouts.container')

@section('content')
    <div class="side-title">
        <h3>{{ $head ?? ''}}</h3>
    </div>

    <div class="border-item">
        <form class="form-row" method="post" onsubmit="saveForm(this)" action="{{ $action }}">
            @if(isset($review) && ($review->id ?? false))
                @method('PUT')
            @endif
            @csrf

            @foreach($languages as $language)
                <div class="form-group col-lg-6">
                    <label>{{ __('reviews.customer_name') }} {{ count($languages) > 1 ? "({$language->name})" : '' }}</label>
                    <input type="text" class="form-control {{ $errors->has('customer_name_' . $language->local) ? 'is-invalid' : '' }}" name="customer_name_{{ $language->local }}" value="{{ old('customer_name_' . $language->local, data_get($review ?? null, $language->local . '.customer_name')) }}" maxlength="90" required>
                    <small class="form-text text-muted">{{ __('reviews.customer_name_limit') }}</small>
                </div>
                <div class="form-group col-lg-6">
                    <label>{{ __('reviews.company_name') }} {{ count($languages) > 1 ? "({$language->name})" : '' }}</label>
                    <input type="text" class="form-control {{ $errors->has('company_name_' . $language->local) ? 'is-invalid' : '' }}" name="company_name_{{ $language->local }}" value="{{ old('company_name_' . $language->local, data_get($review ?? null, $language->local . '.company_name')) }}" maxlength="90" required>
                    <small class="form-text text-muted">{{ __('reviews.company_name_limit') }}</small>
                </div>
                <div class="form-group col-lg-12">
                    <label>{{ __('reviews.body') }} {{ count($languages) > 1 ? "({$language->name})" : '' }}</label>
                    <textarea name="body_{{ $language->local }}" class="form-control {{ $errors->has('body_' . $language->local) ? 'is-invalid' : '' }}" maxlength="300" required>{{ old('body_' . $language->local, data_get($review ?? null, $language->local . '.body')) }}</textarea>
                    <small class="form-text text-muted">{{ __('reviews.body_limit') }}</small>
                </div>
            @endforeach

            <div class="text-center mt-5 col-12">
                <button class="butn"><span>{{ __('dashboard.save') }}</span></button>
            </div>
        </form>
    </div>
@endsection

@section('inner_js')
@endsection
