@props([
    'action',
    'method' => 'POST',
    'tenant' => null,
    'plans' => [],
    '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-6">
                    <x-ui.form.input
                        name="name"
                        :label="__('tenants.fields.name')"
                        :value="$tenant?->name"
                        required
                    />
                </div>

                <div class="col-md-6">
                    <x-ui.form.input
                        name="slug"
                        :label="__('tenants.fields.slug')"
                        :value="$tenant?->slug"
                        required
                    />
                </div>

                <div class="col-md-6">
                    <x-ui.form.input
                        name="email"
                        type="email"
                        :label="__('tenants.fields.email')"
                        :value="$tenant?->email"
                    />
                </div>

                <div class="col-md-6">
                    <x-ui.form.search-select
                        name="plan_id"
                        :label="__('tenants.fields.plan')"
                        :options="$plans"
                        :selected="$tenant?->plan_id"
                        :placeholder="__('tenants.placeholders.plan')"
                        optional
                    />
                </div>

                <div class="col-12">
                    <x-ui.form.checkbox
                        name="is_active"
                        :label="__('tenants.fields.is_active')"
                        :checked="$tenant?->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('admin.tenants.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>
