@props(['action', 'method' => 'POST', 'template' => null, 'types'])
<form method="POST" action="{{ $action }}">
    @csrf
    @if ($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="__('contracts.templates.name')"
            :value="old('name', $template?->name)" required /></div>
        <div class="col-md-6"><x-ui.form.select name="contract_type"
            :label="__('contracts.fields.contract_type')" :options="$types"
            :selected="old('contract_type', $template?->contract_type)" required /></div>
        <div class="col-12"><x-ui.form.field name="body" :label="__('contracts.templates.body')" id="body">
            <textarea class="form-control" rows="12" name="body" id="body" required>{{ old('body', $template?->body) }}</textarea>
        </x-ui.form.field></div>
        <div class="col-md-4"><x-ui.form.select name="is_active" :label="__('contracts.fields.status')"
            :options="[1 => __('contracts.status.active'), 0 => __('contracts.status.inactive')]"
            :selected="old('is_active', $template?->is_active ?? 1)" /></div>
    </div></div><div class="card-footer text-end">
        <x-ui.buttons.primary type="submit">{{ __('common.save') }}</x-ui.buttons.primary>
    </div></div>
</form>
