<!doctype html>
<html lang="ms">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?php echo e($mode === 'create' ? 'Tambah' : 'Edit'); ?> Rekod Surat</title>
    <link rel="preconnect" href="https://fonts.bunny.net">
    <link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body{
            margin:0;
            font-family:Figtree,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
            background:radial-gradient(circle at top,#1d4ed8,#020617);
            color:#e5e7eb;
        }
        .shell{min-height:100vh;padding:24px 18px 28px;display:flex;justify-content:center;}
        .card-glass{
            width:100%;
            max-width:920px;
            background:linear-gradient(160deg, rgba(30,41,59,.98) 0%, rgba(15,23,42,.98) 100%);
            border-radius:18px;
            border:1px solid rgba(148,163,184,.35);
            box-shadow:0 24px 80px rgba(0,0,0,.45);
        }
        .form-label{color:#f1f5f9;}
        .form-control,.form-select{
            background:rgba(30,41,59,.9);
            border-color:rgba(148,163,184,.5);
            color:#f8fafc;
        }
        .form-control::placeholder{color:#94a3b8;opacity:1;}
        .form-control:focus,.form-select:focus{
            background:rgba(30,41,59,.95);
            border-color:rgba(56,189,248,.8);
            box-shadow:0 0 0 .25rem rgba(56,189,248,.18);
            color:#f8fafc;
        }
        .form-text{color:#94a3b8 !important;}
        .form-select option{background:#1e293b;color:#f8fafc;}
        input[type="date"],input[type="text"]{color:#f8fafc;}
        .btn-gradient{
            border:none;
            background:linear-gradient(135deg,#38bdf8,#0ea5e9);
            color:#0f172a;
            font-weight:700;
        }
    </style>
</head>
<body>
<div class="shell">
    <div class="card card-glass">
        <div class="card-body p-4">
            <div class="d-flex align-items-start justify-content-between gap-3 flex-wrap">
                <div>
                    <h1 class="h4 mb-1"><?php echo e($mode === 'create' ? 'Tambah Rekod Surat' : 'Edit Rekod Surat'); ?></h1>
                    <div class="text-secondary">Sila masukkan nombor, nama, jenis dan tarikh surat.</div>
                </div>
                <a href="<?php echo e(route('officer.letters.index')); ?>" class="btn btn-outline-light btn-sm">&larr; Kembali</a>
            </div>

            <?php if($errors->any()): ?>
                <div class="alert alert-danger mt-3 mb-0">
                    <div class="fw-bold mb-1">Ralat Pengesahan</div>
                    <ul class="mb-0">
                        <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <li><?php echo e($error); ?></li>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </ul>
                </div>
            <?php endif; ?>

            <form class="mt-3" method="post" action="<?php echo e(route('officer.letters.store')); ?>">
                <?php echo csrf_field(); ?>

                <div class="row g-3">
                    <div class="col-12 col-md-4">
                        <label class="form-label" for="jenis">Jenis Surat</label>
                        <select name="jenis" id="jenis" class="form-select <?php $__errorArgs = ['jenis'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" required>
                            <option value="">-- Pilih jenis --</option>
                            <option value="masuk" <?php if(old('jenis') === 'masuk'): echo 'selected'; endif; ?>>Surat Masuk</option>
                            <option value="keluar" <?php if(old('jenis') === 'keluar'): echo 'selected'; endif; ?>>Surat Keluar</option>
                        </select>
                        <?php $__errorArgs = ['jenis'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="invalid-feedback"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="col-12 col-md-4">
                        <label class="form-label" for="tarikh_surat">Tarikh Surat</label>
                        <input type="date" name="tarikh_surat" id="tarikh_surat" value="<?php echo e(old('tarikh_surat')); ?>"
                               class="form-control <?php $__errorArgs = ['tarikh_surat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" required>
                        <?php $__errorArgs = ['tarikh_surat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="invalid-feedback"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="col-12 col-md-4">
                        <label class="form-label" for="created_by">Diisi oleh (Officer)</label>
                        <input type="text" name="created_by" id="created_by" value="<?php echo e(old('created_by')); ?>"
                               class="form-control <?php $__errorArgs = ['created_by'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" maxlength="120"
                               placeholder="Contoh: Officer A">
                        <?php $__errorArgs = ['created_by'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="invalid-feedback"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                        <div class="form-text">Jika tiada sistem login officer, isi nama ringkas di sini.</div>
                    </div>

                    <div class="col-12">
                        <label class="form-label" for="nombor_surat">Nombor Surat</label>
                        <input type="text" name="nombor_surat" id="nombor_surat" value="<?php echo e(old('nombor_surat')); ?>"
                               class="form-control <?php $__errorArgs = ['nombor_surat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" required maxlength="80"
                               placeholder="Contoh: KVS/ADM/123/2026">
                        <?php $__errorArgs = ['nombor_surat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="invalid-feedback"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="col-12">
                        <label class="form-label" for="nama_surat">Nama Surat</label>
                        <input type="text" name="nama_surat" id="nama_surat" value="<?php echo e(old('nama_surat')); ?>"
                               class="form-control <?php $__errorArgs = ['nama_surat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" required maxlength="255"
                               placeholder="Contoh: Surat Jemputan Mesyuarat">
                        <?php $__errorArgs = ['nama_surat'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="invalid-feedback"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>
                </div>

                <div class="d-flex justify-content-end gap-2 mt-4">
                    <a href="<?php echo e(route('officer.letters.index')); ?>" class="btn btn-outline-light">Batal</a>
                    <button type="submit" class="btn btn-gradient">Simpan</button>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>

<?php /**PATH C:\xampp\htdocs\dash\resources\views/officer/letters/form.blade.php ENDPATH**/ ?>