@props([
    'action',
    'method' => 'POST',
    'language' => null,
    'submitLabel',
])

<form method="POST" action="{{ $action }}" novalidate>
    @csrf
    @if (strtoupper($method) !== 'POST')
        @method($method)
    @endif

    <div class="card">
        <div class="card-body">
            <div class="row g-3">
                <div class="col-md-4">
                    <x-ui.form.input
                        name="code"
                        :label="__('languages.fields.code')"
                        :value="$language?->code"
                        :placeholder="__('languages.placeholders.code')"
                        required
                    />
                </div>

                <div class="col-md-4">
                    <x-ui.form.input
                        name="name"
                        :label="__('languages.fields.name')"
                        :value="$language?->name"
                        :placeholder="__('languages.placeholders.name')"
                        required
                    />
                </div>

                <div class="col-md-4">
                    <x-ui.form.input
                        name="native_name"
                        :label="__('languages.fields.native_name')"
                        :value="$language?->native_name"
                        :placeholder="__('languages.placeholders.native_name')"
                    />
                </div>

                <div class="col-md-6">
                    <x-ui.form.checkbox
                        name="is_rtl"
                        :label="__('languages.fields.rtl_label')"
                        :checked="$language?->is_rtl"
                    />
                </div>

                <div class="col-md-6">
                    <x-ui.form.checkbox
                        name="is_active"
                        :label="__('languages.fields.active_label')"
                        :checked="$language?->is_active ?? true"
                    />
                </div>
            </div>
        </div>

        <div class="card-footer d-flex justify-content-end gap-2 bg-white">
            <x-ui.buttons.secondary :href="route('settings.languages.index')">
                {{ __('common.cancel') }}
            </x-ui.buttons.secondary>
            <x-ui.buttons.primary type="submit" icon="fe fe-save">
                {{ $submitLabel }}
            </x-ui.buttons.primary>
        </div>
    </div>
</form>
