@extends('layouts.app')

@section('title', 'Edit Opsi Jawaban - SKM Survey')

@section('content')
<div class="container-fluid">
    <div class="row mb-4">
        <div class="col-12">
            <a href="{{ route('admin.answer-options.index') }}" class="btn btn-secondary mb-3">
                <i class="bi bi-arrow-left"></i> Kembali
            </a>
            <h2 style="color: #1e3a8a; font-weight: 700;">
                <i class="bi bi-pencil me-2"></i> Edit Opsi Jawaban
            </h2>
        </div>
    </div>

    <div class="card card-gov shadow-sm">
        <div class="card-header">
            <h5 class="mb-0">Form Edit Opsi Jawaban</h5>
        </div>
        <div class="card-body">
            <form method="POST" action="{{ route('admin.answer-options.update', $answerOption->id) }}">
                @csrf
                @method('PUT')
                <div class="row">
                    <div class="col-md-6 mb-3">
                        <label for="text" class="form-label fw-semibold">Text Jawaban <span class="text-danger">*</span></label>
                        <input type="text" class="form-control @error('text') is-invalid @enderror" 
                               id="text" name="text" value="{{ old('text', $answerOption->text) }}" required>
                        @error('text')
                            <div class="invalid-feedback">{{ $message }}</div>
                        @enderror
                    </div>
                    <div class="col-md-3 mb-3">
                        <label for="score" class="form-label fw-semibold">Score <span class="text-danger">*</span></label>
                        <input type="number" class="form-control @error('score') is-invalid @enderror" 
                               id="score" name="score" value="{{ old('score', $answerOption->score) }}" min="1" required>
                        @error('score')
                            <div class="invalid-feedback">{{ $message }}</div>
                        @enderror
                    </div>
                    <div class="col-md-3 mb-3">
                        <label for="weight" class="form-label fw-semibold">Weight <span class="text-danger">*</span></label>
                        <input type="number" step="0.01" class="form-control @error('weight') is-invalid @enderror" 
                               id="weight" name="weight" value="{{ old('weight', $answerOption->weight) }}" min="0" required>
                        @error('weight')
                            <div class="invalid-feedback">{{ $message }}</div>
                        @enderror
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6 mb-3">
                        <label for="order" class="form-label fw-semibold">Urutan</label>
                        <input type="number" class="form-control @error('order') is-invalid @enderror" 
                               id="order" name="order" value="{{ old('order', $answerOption->order) }}" min="0">
                        @error('order')
                            <div class="invalid-feedback">{{ $message }}</div>
                        @enderror
                    </div>
                    <div class="col-md-6 mb-3">
                        <div class="form-check mt-4">
                            <input class="form-check-input" type="checkbox" id="is_active" name="is_active" value="1" {{ old('is_active', $answerOption->is_active) ? 'checked' : '' }}>
                            <label class="form-check-label" for="is_active">
                                Aktif
                            </label>
                        </div>
                    </div>
                </div>
                <div class="d-flex justify-content-end">
                    <a href="{{ route('admin.answer-options.index') }}" class="btn btn-secondary me-2">
                        <i class="bi bi-x-circle me-2"></i> Batal
                    </a>
                    <button type="submit" class="btn btn-gov-primary">
                        <i class="bi bi-check-circle me-2"></i> Update
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
@endsection



