<?php $__env->startSection('main-content'); ?>
<div class="max-w-4xl mx-auto pb-20">
    <div class="flex justify-between items-end mb-8 border-b border-slate-900 pb-4">
        <div>
            <h1 class="text-3xl font-black text-slate-900">Close Financial Year</h1>
            <p class="text-[10px] font-bold text-slate-400 mt-1 font-sans">Finalize accounting period for <?php echo e($financialYear->year); ?></p>
        </div>
        <a href="<?php echo e(route('financial-years.index')); ?>" class="text-[10px] font-black text-slate-400 hover:text-slate-600 transition uppercase">
            <i class="fas fa-arrow-left mr-2"></i> Back to list
        </a>
    </div>

    <div class="bg-white border border-rose-200 rounded-sm shadow-sm overflow-hidden">
        <div class="p-6 border-b border-rose-100 bg-rose-50">
            <div class="flex items-start">
                <div class="bg-rose-100 p-3 rounded-full mr-4">
                    <i class="fas fa-exclamation-triangle text-rose-600 text-xl"></i>
                </div>
                <div>
                    <h2 class="text-lg font-black text-rose-900">Critical Action Required</h2>
                    <p class="text-rose-700 text-xs mt-1 font-medium leading-relaxed">
                        Closing a financial year is a permanent action. This will lock all transactions for 
                        <span class="font-bold underline"><?php echo e($financialYear->year); ?></span> 
                        (<?php echo e(\Carbon\Carbon::parse($financialYear->start_date)->format('M d, Y')); ?> to <?php echo e(\Carbon\Carbon::parse($financialYear->end_date)->format('M d, Y')); ?>).
                    </p>
                </div>
            </div>
        </div>

        <form action="<?php echo e(route('financial-years.close', $financialYear->id)); ?>" method="POST" class="p-8">
            <?php echo csrf_field(); ?>
            <div class="space-y-6">
                <div class="bg-slate-50 p-6 rounded border border-slate-100">
                    <h3 class="text-xs font-black text-slate-900 uppercase mb-4">Before you proceed:</h3>
                    <ul class="space-y-3">
                        <li class="flex items-center text-xs text-slate-600">
                            <i class="fas fa-check-circle text-emerald-500 mr-3"></i> Ensure all journal entries are posted.
                        </li>
                        <li class="flex items-center text-xs text-slate-600">
                            <i class="fas fa-check-circle text-emerald-500 mr-3"></i> Reconcile all bank accounts.
                        </li>
                        <li class="flex items-center text-xs text-slate-600">
                            <i class="fas fa-check-circle text-emerald-500 mr-3"></i> Generate and save your final Trial Balance and Balance Sheet.
                        </li>
                    </ul>
                </div>

                <div>
                    <label for="confirmation" class="block text-[10px] font-black text-slate-500 mb-2 uppercase">
                        Type <span class="text-rose-600">CLOSE_YEAR</span> to confirm
                    </label>
                    <input type="text" 
                           id="confirmation" 
                           name="confirmation" 
                           autocomplete="off"
                           class="quickbooks-input text-center font-bold tracking-widest text-rose-600" 
                           placeholder="Enter confirmation string"
                           required>
                </div>

                <div class="pt-4 flex justify-center">
                    <button type="submit" 
                            id="closeBtn"
                            disabled
                            class="bg-rose-600 text-white px-12 py-4 text-[10px] font-black uppercase shadow-lg opacity-50 cursor-not-allowed transition-all hover:bg-rose-700"
                            onclick="return confirm('Are you absolutely sure? This will lock the year <?php echo e($financialYear->year); ?>.')">
                        <i class="fas fa-lock mr-2"></i> Lock and Close Financial Year
                    </button>
                </div>
            </div>
        </form>
    </div>
</div>

<style>
    .quickbooks-input { border: 1px solid #e2e8f0; border-radius: 2px; padding: 12px; font-size: 14px; width: 100%; transition: all 0.2s; background: #fff; }
    .quickbooks-input:focus { outline: none; border-color: #f43f5e; box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.1); }
</style>

<script>
    document.getElementById('confirmation').addEventListener('input', function() {
        const btn = document.getElementById('closeBtn');
        if (this.value === 'CLOSE_YEAR') {
            btn.disabled = false;
            btn.classList.remove('opacity-50', 'cursor-not-allowed');
        } else {
            btn.disabled = true;
            btn.classList.add('opacity-50', 'cursor-not-allowed');
        }
    });
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.aura-main', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/edugfqvw/auraaccountify.online/portal/resources/views/financial-years/close.blade.php ENDPATH**/ ?>