<x-ui.layout.page :title="__('performance.my_reviews')" page-icon="fe fe-star">
    @forelse($reviews as $review)
        <div class="card mb-3"><div class="card-body">
            <div class="d-flex justify-content-between mb-3">
                <strong>{{ $review->cycle?->name ?? __('performance.review') }}</strong>
                <x-ui.operational.status-badge :label="__('performance.status.'.$review->status)" />
            </div>
            @if(in_array($review->status, ['draft', 'pending', 'assigned'], true))
                <form method="POST" action="{{ route('me.performance.self-update', $review) }}" class="row g-3">
                    @csrf @method('PUT')
                    <div class="col-md-3"><x-ui.form.input name="self_score" type="number" min="0" max="100" :label="__('performance.fields.self_score')" :value="$review->self_score" /></div>
                    <div class="col-md-9"><x-ui.form.input name="self_assessment" :label="__('performance.fields.self_assessment')" :value="$review->self_assessment" /></div>
                    <div class="col-12"><x-ui.buttons.primary type="submit">{{ __('performance.actions.submit_self') }}</x-ui.buttons.primary></div>
                </form>
            @else
                <p class="mb-1">{{ $review->self_assessment ?: '—' }}</p>
                <small class="text-muted">{{ __('performance.fields.final_score') }}: {{ $review->final_score ?? '—' }}</small>
            @endif
        </div></div>
    @empty
        <x-ui.operational.empty-state :title="__('performance.empty_reviews')" />
    @endforelse
    <div class="mt-3">{{ $reviews->links() }}</div>
</x-ui.layout.page>
