@section('meta_title', __('admin-sections.Translations'))
@section('h1', __('admin-sections.Project') . ': ' . $project->name)
<x-admin.layout>
    <div class="row">
        <div class="col-12 mb-4">
            <div class="card border-0 shadow components-section">
                <div class="card-body">
                    <h3 id="category" class="mb-4">{{ __('admin-sections.Translations') }}</h3>
                    <div class="table-responsive">
                        <form method="post" action="{{ route('admin.projects.translations.update', ['project' => $project->id, 'language' => $language->id]) }}">
                            <table class="table table-centered table-nowrap mb-0 rounded">
                                <thead class="thead-light">
                                <tr>
                                    <th class="border-0" style="width: 250px;">{{ __('validation.attributes.text') }}</th>
                                    <th class="border-0">{{ __('admin-sections.Translations') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($translations as $index => $code)
                                    <tr>
                                        <td>
                                            {{ __($code) }}
                                        </td>
                                        <td>
                                            <x-volt.forms.input-type-hidden :name="'translations[' . $index . '][code]'" :value="$code" />
                                            <x-volt.forms.input title="" :name="'translations[' . $index . '][text]'" :value="$projectTranslations[$code] ?? null" />
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                            @canany(['update'], \App\Models\ProjectTranslation::class)
                                @csrf
                                <button class="btn btn-primary" type="submit">{{ __('Save') }}</button>
                            @endcanany
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</x-admin.layout>