@props([
    'action',
    'method' => 'POST',
    'scorecard' => null,
    'recommendationOptions',
    '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.search-select
                        name="interview_id"
                        lookup="interviews"
                        :label="__('recruitment.interview_scorecards.fields.interview')"
                        :options="$scorecard?->interview
                            ? [$scorecard->interview_id => $scorecard->interview->reference_code]
                            : []"
                        :selected="old('interview_id', $scorecard?->interview_id)"
                        :placeholder="__('common.select')"
                        required
                    />
                </div>
                <div class="col-md-3">
                    <x-ui.form.input
                        name="overall_score"
                        type="number"
                        min="1"
                        max="100"
                        :label="__('recruitment.interview_scorecards.fields.overall_score')"
                        :value="old('overall_score', $scorecard?->overall_score)"
                        required
                    />
                </div>
                <div class="col-md-3">
                    <x-ui.form.select
                        name="recommendation"
                        :label="__('recruitment.interview_scorecards.fields.recommendation')"
                        :options="$recommendationOptions"
                        :selected="old('recommendation', $scorecard?->recommendation)"
                        required
                    />
                </div>
                <div class="col-md-6">
                    <x-ui.form.input
                        name="strengths"
                        :label="__('recruitment.interview_scorecards.fields.strengths')"
                        :value="old('strengths', $scorecard?->strengths)"
                    />
                </div>
                <div class="col-md-6">
                    <x-ui.form.input
                        name="weaknesses"
                        :label="__('recruitment.interview_scorecards.fields.weaknesses')"
                        :value="old('weaknesses', $scorecard?->weaknesses)"
                    />
                </div>
                <div class="col-12">
                    <x-ui.form.input
                        name="notes"
                        :label="__('recruitment.interview_scorecards.fields.notes')"
                        :value="old('notes', $scorecard?->notes)"
                    />
                </div>
            </div>
        </div>
        <div class="card-footer d-flex justify-content-end gap-2 bg-white">
            <x-ui.buttons.secondary :href="route('hr.recruitment.interview-scorecards.index')">{{ __('common.cancel') }}</x-ui.buttons.secondary>
            <x-ui.buttons.primary type="submit">{{ $submitLabel }}</x-ui.buttons.primary>
        </div>
    </div>
</form>
