<?php $__env->startSection('title', 'Survey SKM - ' . $opd->name); ?>

<?php $__env->startSection('content'); ?>
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-10">
            <div class="card card-gov shadow-sm mb-4">
                <div class="card-header">
                    <h4 class="mb-0">
                        <i class="bi bi-clipboard-check me-2"></i> 
                        Survey Kepuasan Masyarakat - <?php echo e($opd->name); ?>

                    </h4>
                </div>
                <div class="card-body p-4">
                    <form id="surveyForm" action="<?php echo e(route('public.submit', $opd->id)); ?>" method="POST">
                        <?php echo csrf_field(); ?>
                        
                        <div class="alert alert-info border-start border-info border-4 mb-4">
                            <div class="d-flex">
                                <div class="flex-shrink-0">
                                    <i class="bi bi-info-circle fs-4 text-info"></i>
                                </div>
                                <div class="flex-grow-1 ms-3">
                                    <h6 class="alert-heading mb-2">Petunjuk Penilaian</h6>
                                    <p class="mb-2" style="font-size: 0.95rem;">
                                        Silakan berikan penilaian untuk setiap pertanyaan dengan menggunakan skala penilaian yang tersedia untuk masing-masing pertanyaan.
                                    </p>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <?php $__currentLoopData = $questions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $question): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="col-md-6 mb-4">
                                    <div class="card h-100 border shadow-sm" style="border-left: 4px solid #1e3a8a !important;">
                                        <div class="card-body p-4">
                                            <div class="d-flex align-items-start mb-3">
                                                <span class="badge-gov me-2"><?php echo e($question->code); ?></span>
                                                <div class="flex-grow-1">
                                                    <h6 class="card-title mb-2" style="color: #1e3a8a; font-weight: 600; font-size: 0.95rem;">
                                                        <?php echo e($question->question); ?>

                                                    </h6>
                                                    <p class="text-muted small mb-0">
                                                        <i class="bi bi-tag me-1"></i> 
                                                        <strong>Elemen:</strong> <?php echo e($question->element); ?>

                                                    </p>
                                                </div>
                                            </div>
                                            
                                            <div class="rating-group mb-3">
                                                <?php $__currentLoopData = $question->activeAnswerOptions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $option): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <input type="radio" name="responses[<?php echo e($index); ?>][answer_option_id]" 
                                                           value="<?php echo e($option->id); ?>" 
                                                           id="answer_<?php echo e($index); ?>_<?php echo e($option->id); ?>" 
                                                           required>
                                                    <label for="answer_<?php echo e($index); ?>_<?php echo e($option->id); ?>" class="rating-label">
                                                        <span class="badge bg-primary mb-1" style="font-size: 0.75rem;"><?php echo e($option->score); ?></span>
                                                        <small style="font-size: 0.8rem;"><?php echo e($option->label); ?></small>
                                                    </label>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </div>
                                            
                                            <input type="hidden" name="responses[<?php echo e($index); ?>][question_id]" value="<?php echo e($question->id); ?>">
                                            
                                            <div class="mb-2">
                                                <label for="comment_<?php echo e($index); ?>" class="form-label small">Komentar (Opsional)</label>
                                                <textarea class="form-control form-control-sm" name="responses[<?php echo e($index); ?>][comment]" id="comment_<?php echo e($index); ?>" rows="2" placeholder="Masukkan komentar..."></textarea>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>

                        <div class="card border shadow-sm mb-4" style="border-left: 4px solid #28a745 !important;">
                            <div class="card-header bg-light">
                                <h5 class="mb-0" style="color: #1e3a8a;">
                                    <i class="bi bi-person me-2"></i> Data Responden (Opsional)
                                </h5>
                            </div>
                            <div class="card-body p-4">
                                <p class="text-muted small mb-3">
                                    <i class="bi bi-info-circle me-1"></i>
                                    Data responden bersifat opsional dan akan digunakan untuk keperluan verifikasi atau follow-up jika diperlukan.
                                </p>
                                <div class="row">
                                    <div class="col-md-4 mb-3">
                                        <label for="respondent_name" class="form-label fw-semibold">Nama Lengkap</label>
                                        <input type="text" class="form-control" name="respondent_name" id="respondent_name" placeholder="Masukkan nama lengkap">
                                    </div>
                                    <div class="col-md-4 mb-3">
                                        <label for="respondent_phone" class="form-label fw-semibold">Nomor Telepon</label>
                                        <input type="text" class="form-control" name="respondent_phone" id="respondent_phone" placeholder="08xxxxxxxxxx">
                                    </div>
                                    <div class="col-md-4 mb-3">
                                        <label for="respondent_email" class="form-label fw-semibold">Alamat Email</label>
                                        <input type="email" class="form-control" name="respondent_email" id="respondent_email" placeholder="nama@email.com">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="alert alert-warning border-warning border-start border-4 mb-4">
                            <div class="d-flex">
                                <div class="flex-shrink-0">
                                    <i class="bi bi-exclamation-triangle fs-4 text-warning"></i>
                                </div>
                                <div class="flex-grow-1 ms-3">
                                    <strong>Perhatian!</strong> Pastikan Anda telah menjawab semua pertanyaan sebelum mengirimkan survey. 
                                    Setelah survey dikirim, Anda tidak dapat mengubah jawaban.
                                </div>
                            </div>
                        </div>

                        <div class="d-flex justify-content-between align-items-center">
                            <a href="<?php echo e(route('public.index')); ?>" class="btn btn-outline-secondary">
                                <i class="bi bi-arrow-left me-2"></i> Kembali
                            </a>
                            <button type="submit" class="btn btn-gov-primary btn-lg px-5">
                                <i class="bi bi-check-circle me-2"></i> Kirim Survey
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<?php $__env->startPush('styles'); ?>
<style>
.rating-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.rating-group input[type="radio"] {
    display: none;
}

.rating-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 10px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 100px;
    background: #fff;
    flex: 1;
}

.rating-label:hover {
    border-color: #1e3a8a;
    background-color: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(30, 58, 138, 0.15);
}

.rating-group input[type="radio"]:checked + .rating-label {
    border-color: #1e3a8a;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.rating-label small {
    font-size: 0.875rem;
    font-weight: 500;
}

.rating-group input[type="radio"]:checked + .rating-label small {
    color: white;
}

.rating-label .badge {
    font-size: 1rem;
    padding: 4px 8px;
}
</style>
<?php $__env->stopPush(); ?>
<?php $__env->stopSection(); ?>


<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Users/user/Documents/giriwidyan/project/inhouse/skm/resources/views/public/survey.blade.php ENDPATH**/ ?>