<?php if (isset($component)) { $__componentOriginal1f9e5f64f242295036c059d9dc1c375c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal1f9e5f64f242295036c059d9dc1c375c = $attributes; } ?>
<?php $component = App\View\Components\Layout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('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\Layout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
    <div class="mb-4">
        <h2 class="text-xl font-semibold text-white">Add Maintenance</h2>
    </div>
    <div class="bg-slate-800 rounded-md shadow-lg border-t-4 border-t-indigo-500 max-w-full">
        <form action="<?php echo e(route('maintenance.store')); ?>" method="POST" enctype="multipart/form-data" id="maintenanceForm">
            <?php echo csrf_field(); ?>
            
            <div class="pt-3 pb-6 px-6 space-y-4">
                <div class="">
                    <div>
                        <label for="unit_name" class="block text-sm font-medium text-slate-300 mb-2">
                            Unit<span class="text-red-400">*</span>
                        </label>
                        <input type="hidden" name="unit_code" id="unit_code" value="<?php echo e($unitData['unit_code']); ?>">
                        <input type="text" name="unit_name" id="unit_name" value="<?php echo e($unitData['unit_code'] . ' - ' . $unitData['unit_name']); ?>"
                            class="block w-full rounded-sm border border-slate-700 bg-slate-900/50 py-2.5 px-3 text-white placeholder:text-slate-500 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-colors cursor-not-allowed" readonly>
                        <?php $__errorArgs = ['unit_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class="text-red-400 text-xs italic mt-1 block"><?php echo e($message); ?></span>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>
                </div>

                <div class="grid grid-cols-1 sm:grid-cols-4 gap-6">
    
                    <!-- Field Maintenance Code (50% atau 2 dari 4 kolom) -->
                    <div class="sm:col-span-2">
                        <label for="mnt_code" class="block text-sm font-medium text-slate-300 mb-2">
                            Maintenance Code <span class="text-red-400">*</span>
                        </label>
                        <input type="text" name="mnt_code" id="mnt_code" value="<?php echo e($mnt_code); ?>"
                            class="block w-full rounded-sm border border-slate-700 bg-slate-900/50 py-2.5 px-3 text-white placeholder:text-slate-500 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-colors cursor-not-allowed" readonly>
                        <?php $__errorArgs = ['mnt_code'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class="text-red-400 text-xs italic mt-1 block"><?php echo e($message); ?></span>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <!-- Field Step (25% atau 1 dari 4 kolom) -->
                    <div class="sm:col-span-1">
                        <label for="step" class="block text-sm font-medium text-slate-300 mb-2">
                            Step <span class="text-red-400">*</span>
                        </label>
                        <input type="text" name="step" id="step" placeholder="Contoh: Step 1" value="<?php echo e($newStep); ?>"
                            class="block w-full rounded-sm border border-slate-700 bg-slate-900/50 py-2.5 px-3 text-white placeholder:text-slate-500 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-colors cursor-not-allowed" readonly>
                        <?php $__errorArgs = ['step'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class="text-red-400 text-xs italic mt-1 block"><?php echo e($message); ?></span>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <!-- Field Date (25% atau 1 dari 4 kolom) -->
                    <div class="sm:col-span-1">
                        <label for="mnt_date" class="block text-sm font-medium text-slate-300 mb-2">
                            Date <span class="text-red-400">*</span>
                        </label>
                        <!-- Tambahin class "datepicker" di sini -->
                        <input type="text" name="mnt_date" id="mnt_date" placeholder="Pilih Tanggal..." value="<?php echo e(old('mnt_date')); ?>"
                            class="datepicker block w-full rounded-sm border border-slate-600 bg-slate-900 py-2.5 px-3 text-white placeholder:text-slate-500 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-colors">
                        <?php $__errorArgs = ['mnt_date'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                            <span class="text-red-400 text-xs italic mt-1 block"><?php echo e($message); ?></span>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                </div>
                <!-- Field Maintenance Description (Dibuat full width mengambil 2 kolom) -->
                <div class="sm:col-span-2">
                    <label for="mnt_description" class="block text-sm font-medium text-slate-300 mb-2">
                        Maintenance Description
                    </label>
                    <textarea name="mnt_description" id="mnt_description" rows="4" placeholder="Tuliskan detail deskripsi maintenance..."
                        class="block w-full rounded-sm border border-slate-600 bg-slate-900 py-2.5 px-3 text-white placeholder:text-slate-500 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-colors"><?php echo e(old('mnt_description')); ?></textarea>
                </div>

                <!-- Field Input File -->
                <div>
                    <label for="file_upload" class="block text-sm font-medium text-slate-300 mb-2">
                        Upload File / Dokumen
                    </label>
                    <!-- Styling khusus input file di Tailwind -->
                    <input type="file" name="file_upload" id="file_upload" accept=".pdf, .PDF"
                        class="block w-full text-sm text-slate-400 file:mr-4 file:py-2.5 file:px-4 file:rounded-sm file:border-0 file:text-sm file:font-semibold file:bg-slate-700 file:text-white hover:file:bg-slate-600 border border-slate-600 bg-slate-900 rounded-sm focus:outline-none transition-colors cursor-pointer">
                    <?php $__errorArgs = ['file_upload'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <span class="text-red-400 text-xs italic mt-1 block"><?php echo e($message); ?></span>
                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
            </div>

            <!-- Card Footer -->
            <div class="bg-slate-900/50 border-t border-slate-700 px-6 py-4 flex items-center justify-end gap-3 rounded-b-md">
                
                <!-- Tombol Batal -->
                <a href="/unit/maintenance_list/<?php echo e($unitData['unit_code']); ?>" class="inline-flex items-center gap-2 text-sm font-medium bg-slate-700 text-white hover:bg-slate-600 px-4 py-2.5 rounded-sm transition-colors border border-slate-600">
                     <?php if (isset($component)) { $__componentOriginal643fe1b47aec0b76658e1a0200b34b2c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c = $attributes; } ?>
<?php $component = BladeUI\Icons\Components\Svg::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('iconpark-back'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\BladeUI\Icons\Components\Svg::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['class' => 'w-4 h-4']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c)): ?>
<?php $attributes = $__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c; ?>
<?php unset($__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal643fe1b47aec0b76658e1a0200b34b2c)): ?>
<?php $component = $__componentOriginal643fe1b47aec0b76658e1a0200b34b2c; ?>
<?php unset($__componentOriginal643fe1b47aec0b76658e1a0200b34b2c); ?>
<?php endif; ?> Batal
                </a>
                
                <!-- Tombol Simpan -->
                <button type="submit" class="inline-flex items-center gap-2 text-sm font-medium bg-indigo-600 text-white hover:bg-indigo-500 px-4 py-2.5 rounded-sm transition-colors cursor-pointer shadow-sm">
                    <?php if (isset($component)) { $__componentOriginal643fe1b47aec0b76658e1a0200b34b2c = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c = $attributes; } ?>
<?php $component = BladeUI\Icons\Components\Svg::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('iconpark-save'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\BladeUI\Icons\Components\Svg::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['class' => 'w-4 h-4']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c)): ?>
<?php $attributes = $__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c; ?>
<?php unset($__attributesOriginal643fe1b47aec0b76658e1a0200b34b2c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal643fe1b47aec0b76658e1a0200b34b2c)): ?>
<?php $component = $__componentOriginal643fe1b47aec0b76658e1a0200b34b2c; ?>
<?php unset($__componentOriginal643fe1b47aec0b76658e1a0200b34b2c); ?>
<?php endif; ?> Simpan
                </button>
                
            </div>
        </form>
    </div>

    <!-- Script Validasi Disesuaikan dengan Field Baru -->
    <script>
        const form = document.getElementById('maintenanceForm');
        form.addEventListener('submit', (event) => {
            event.preventDefault();

            const swalDarkConfig = {
                background: '#1e293b', 
                color: '#f8fafc'       
            };

            Swal.fire({
                title: "Data saved",
                icon: "success",
                ...swalDarkConfig
            }).then(() => {
                form.submit();
            });
            
        })
    </script>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal1f9e5f64f242295036c059d9dc1c375c)): ?>
<?php $attributes = $__attributesOriginal1f9e5f64f242295036c059d9dc1c375c; ?>
<?php unset($__attributesOriginal1f9e5f64f242295036c059d9dc1c375c); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal1f9e5f64f242295036c059d9dc1c375c)): ?>
<?php $component = $__componentOriginal1f9e5f64f242295036c059d9dc1c375c; ?>
<?php unset($__componentOriginal1f9e5f64f242295036c059d9dc1c375c); ?>
<?php endif; ?><?php /**PATH C:\Users\Hype\Herd\symmapan\resources\views/maintenance/maintenance_form.blade.php ENDPATH**/ ?>