<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('header', null, []); ?> 
        <div class="flex items-center gap-3">
            <a href="<?php echo e(route('dokter.pasien.detail', $pasien->id)); ?>"
               class="w-8 h-8 rounded-lg flex items-center justify-center transition-colors hover:bg-white/20"
               title="Kembali">
                <i class="fas fa-arrow-left text-white text-sm"></i>
            </a>
            <div>
                <h2 class="font-semibold text-lg text-white leading-tight">Update Penanganan Pasien</h2>
                <p class="text-teal-100 text-xs mt-0.5 opacity-90"><?php echo e($pasien->nama_lengkap); ?></p>
            </div>
        </div>
     <?php $__env->endSlot(); ?>

    <?php $__env->startPush('styles'); ?>
    <style>
        .form-field label {
            display: block;
            font-size: 0.8125rem;
            font-weight: 600;
            color: #334155;
            margin-bottom: 0.375rem;
        }
        .dark .form-field label { color: #cbd5e1; }

        .form-control {
            width: 100%;
            padding: 0.625rem 0.875rem;
            border: 1px solid #e2e8f0;
            border-radius: 0.5rem;
            font-size: 0.875rem;
            background: #fff;
            color: #0f172a;
            outline: none;
            transition: border-color .2s, box-shadow .2s;
        }
        .dark .form-control {
            background: #0f172a;
            border-color: #334155;
            color: #f1f5f9;
        }
        .form-control:focus {
            border-color: #14b8a6;
            box-shadow: 0 0 0 3px rgba(20,184,166,.18);
        }
        textarea.form-control { resize: vertical; }

        .form-hint {
            font-size: 0.75rem;
            color: #94a3b8;
            margin-top: 0.25rem;
        }
        .form-error { font-size: 0.75rem; color: #ef4444; margin-top: 0.25rem; }
        .dark .form-error { color: #fca5a5; }

        /* Section divider */
        .form-section-title {
            font-size: 0.7rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: #14b8a6;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        .form-section-title::after {
            content: '';
            flex: 1;
            height: 1px;
            background: linear-gradient(90deg, rgba(20,184,166,.3), transparent);
        }
    </style>
    <?php $__env->stopPush(); ?>

    <div class="py-6 px-4 sm:px-6 lg:px-8 max-w-3xl mx-auto space-y-5">

        
        <div class="kkd-card overflow-hidden relative"
             style="background:linear-gradient(135deg,#0d9488,#0f766e);border:none;padding:1.25rem 1.5rem;">
            <div class="absolute -top-4 -right-4 w-24 h-24 rounded-full opacity-10"
                 style="background:rgba(255,255,255,.4);"></div>
            <div class="relative flex flex-col sm:flex-row sm:items-center gap-4">
                <div class="w-12 h-12 rounded-xl flex items-center justify-center flex-shrink-0 text-white text-xl font-bold shadow"
                     style="background:rgba(255,255,255,.2);backdrop-filter:blur(8px);">
                    <?php echo e(strtoupper(substr($pasien->nama_lengkap, 0, 1))); ?>

                </div>
                <div class="flex-1 min-w-0">
                    <p class="text-white font-bold text-base leading-tight"><?php echo e($pasien->nama_lengkap); ?></p>
                    <div class="flex flex-wrap gap-3 mt-1">
                        <span class="text-teal-100 text-xs flex items-center gap-1">
                            <i class="fas fa-id-card text-[10px]"></i>
                            <?php echo e($pasien->no_rekam_medis); ?>

                        </span>
                        <span class="text-teal-100 text-xs flex items-center gap-1">
                            <i class="fas fa-birthday-cake text-[10px]"></i>
                            <?php echo e($pasien->tanggal_lahir ? \Carbon\Carbon::parse($pasien->tanggal_lahir)->age : ($pasien->usia > 0 ? $pasien->usia : '-')); ?> tahun
                        </span>
                        <span class="text-teal-100 text-xs flex items-center gap-1">
                            <i class="fas fa-clock text-[10px]"></i>
                            Update: <?php echo e($penanganan->updated_at->format('d M Y')); ?>

                        </span>
                    </div>
                </div>
                <span class="inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-semibold flex-shrink-0"
                      style="background:rgba(255,255,255,.2);color:#fff;">
                    <span class="w-1.5 h-1.5 rounded-full bg-green-300 animate-pulse inline-block"></span>
                    Dalam Penanganan
                </span>
            </div>
        </div>

        
        <div class="kkd-card">
            <form method="POST" action="<?php echo e(route('dokter.pasien.update-penanganan.store', $pasien->id)); ?>">
                <?php echo csrf_field(); ?>
                <?php echo method_field('PUT'); ?>

                <div class="space-y-6">

                    
                    <div>
                        <p class="form-section-title mb-4">
                            <i class="fas fa-stethoscope"></i> Data Klinis
                        </p>
                        <div class="space-y-4">

                            
                            <div class="form-field">
                                <label for="diagnosis_utama">
                                    Diagnosis Utama <span class="text-red-400">*</span>
                                </label>
                                <textarea id="diagnosis_utama" name="diagnosis_utama" rows="3" required
                                          class="form-control"
                                          placeholder="Tuliskan diagnosis utama pasien..."><?php echo e(old('diagnosis_utama', $penanganan->diagnosis_utama)); ?></textarea>
                                <?php $__errorArgs = ['diagnosis_utama'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                    <p class="form-error"><i class="fas fa-circle-exclamation mr-1"></i><?php echo e($message); ?></p>
                                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                            </div>

                            
                            <div class="form-field">
                                <label for="rencana_perawatan">Rencana Perawatan</label>
                                <textarea id="rencana_perawatan" name="rencana_perawatan" rows="2"
                                          class="form-control"
                                          placeholder="Jelaskan rencana perawatan yang akan dilakukan..."><?php echo e(old('rencana_perawatan', $penanganan->rencana_perawatan)); ?></textarea>
                            </div>

                        </div>
                    </div>

                    
                    <div class="border-t border-slate-100 dark:border-slate-700"></div>

                    
                    <div>
                        <p class="form-section-title mb-4">
                            <i class="fas fa-pills"></i> Resep & Catatan
                        </p>
                        <div class="space-y-4">

                            
                            <div class="form-field">
                                <label for="resep_dokter">Resep Obat</label>
                                <textarea id="resep_dokter" name="resep_dokter" rows="4"
                                          class="form-control font-mono text-sm"
                                          placeholder="Contoh:&#10;• Paracetamol 500mg - 3x1 - Sesudah makan&#10;• Amoxicillin 500mg - 3x1 - Sesudah makan"><?php echo e(old('resep_dokter', $penanganan->resep_dokter)); ?></textarea>
                                <p class="form-hint">
                                    <i class="fas fa-circle-info mr-1"></i>
                                    Format: Nama Obat — Dosis — Aturan Pakai
                                </p>
                            </div>

                            
                            <div class="form-field">
                                <label for="catatan_dokter">Catatan Medis</label>
                                <textarea id="catatan_dokter" name="catatan_dokter" rows="2"
                                          class="form-control"
                                          placeholder="Catatan tambahan untuk pasien..."><?php echo e(old('catatan_dokter', $penanganan->catatan_dokter)); ?></textarea>
                            </div>

                        </div>
                    </div>

                    
                    <div class="border-t border-slate-100 dark:border-slate-700"></div>

                    
                    <div>
                        <p class="form-section-title mb-4">
                            <i class="fas fa-calendar-alt"></i> Jadwal & Status
                        </p>
                        <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">

                            
                            <div class="form-field">
                                <label for="tanggal_kontrol_berikutnya">Kontrol Berikutnya</label>
                                <input type="date" id="tanggal_kontrol_berikutnya"
                                       name="tanggal_kontrol_berikutnya"
                                       class="form-control"
                                       value="<?php echo e(old('tanggal_kontrol_berikutnya', $penanganan->tanggal_kontrol_berikutnya
                                           ? \Carbon\Carbon::parse($penanganan->tanggal_kontrol_berikutnya)->format('Y-m-d')
                                           : '')); ?>">
                                <p class="form-hint">Kosongkan jika belum ada jadwal</p>
                            </div>

                            
                            <div class="form-field">
                                <label for="status_penanganan">
                                    Status Penanganan <span class="text-red-400">*</span>
                                </label>
                                <select id="status_penanganan" name="status_penanganan" required class="form-control">
                                    <option value="AKTIF"   <?php echo e(old('status_penanganan', $penanganan->status_penanganan) == 'AKTIF'   ? 'selected' : ''); ?>>
                                        Aktif
                                    </option>
                                    <option value="SELESAI" <?php echo e(old('status_penanganan', $penanganan->status_penanganan) == 'SELESAI' ? 'selected' : ''); ?>>
                                        Selesai
                                    </option>
                                    <option value="RUJUK"   <?php echo e(old('status_penanganan', $penanganan->status_penanganan) == 'RUJUK'   ? 'selected' : ''); ?>>
                                        Rujuk ke Fasilitas Lain
                                    </option>
                                </select>

                                
                                <div id="warningSelesai" class="hidden mt-2 p-2.5 rounded-lg text-xs"
                                     style="background:rgba(239,68,68,.08);color:#dc2626;border:1px solid rgba(239,68,68,.2);">
                                    <i class="fas fa-triangle-exclamation mr-1"></i>
                                    Menandai <strong>Selesai</strong> akan mengeluarkan pasien dari daftar penanganan aktif.
                                </div>
                                <div id="warningRujuk" class="hidden mt-2 p-2.5 rounded-lg text-xs"
                                     style="background:rgba(249,115,22,.08);color:#ea580c;border:1px solid rgba(249,115,22,.2);">
                                    <i class="fas fa-triangle-exclamation mr-1"></i>
                                    Pastikan sudah ada surat rujukan sebelum menyimpan status <strong>Rujuk</strong>.
                                </div>
                            </div>

                        </div>
                    </div>

                </div>

                
                <div class="mt-8 pt-5 border-t border-slate-100 dark:border-slate-700 flex flex-col sm:flex-row justify-end gap-3">
                    <button type="button" onclick="window.history.back()"
                            class="px-5 py-2.5 rounded-lg text-sm font-semibold border border-slate-200 dark:border-slate-700 section-subtitle hover:bg-slate-50 dark:hover:bg-slate-800 transition-colors">
                        <i class="fas fa-xmark mr-1.5"></i> Batal
                    </button>
                    <button type="submit"
                            class="px-6 py-2.5 rounded-lg text-sm font-semibold text-white shadow-sm transition-all hover:opacity-90 hover:-translate-y-0.5"
                            style="background:linear-gradient(135deg,#14b8a6,#0d9488);box-shadow:0 4px 12px rgba(20,184,166,.3);">
                        <i class="fas fa-floppy-disk mr-1.5"></i> Simpan Perubahan
                    </button>
                </div>

            </form>
        </div>

    </div>

    <?php $__env->startPush('scripts'); ?>
    <script>
        const statusSel = document.getElementById('status_penanganan');
        const warnSelesai = document.getElementById('warningSelesai');
        const warnRujuk   = document.getElementById('warningRujuk');

        function toggleWarnings() {
            warnSelesai.classList.toggle('hidden', statusSel.value !== 'SELESAI');
            warnRujuk.classList.toggle('hidden',   statusSel.value !== 'RUJUK');
        }

        statusSel.addEventListener('change', toggleWarnings);
        toggleWarnings(); // init

        // Auto bullet resep
        document.getElementById('resep_dokter').addEventListener('blur', function () {
            let val = this.value.trim();
            if (!val) return;
            let lines = val.split('\n').map(l => {
                l = l.trim();
                if (l && !l.startsWith('•') && !l.startsWith('-')) return `• ${l}`;
                return l;
            });
            this.value = lines.join('\n');
        });
    </script>
    <?php $__env->stopPush(); ?>

 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?><?php /**PATH C:\laragon\www\KESEHATAN\resources\views/dokter/pasien/update-penanganan.blade.php ENDPATH**/ ?>