<?php $__env->startSection('title','New Virement'); ?>
<?php $__env->startSection('crumbs','<a href="'.route('budget-virements.index').'">Budget Virements</a> · <b>New</b>'); ?>
<?php $__env->startSection('content'); ?>
<div class="card" style="max-width:720px"><div class="card-h"><h2>New virement <small class="muted"><?php echo e($docNo); ?></small></h2></div>
<div class="card-b">
<?php if($errors->any()): ?><div class="flash err">✕ <?php echo e($errors->first()); ?></div><?php endif; ?>
<form method="GET" action="<?php echo e(route('budget-virements.create')); ?>">
<div class="frow"><div class="fld c6"><label>Budget</label>
<select name="budget_id" onchange="this.form.submit()">
<?php $__currentLoopData = $budgets; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($b->id); ?>" <?php echo e($budgetId==$b->id?'selected':''); ?>><?php echo e($b->name); ?> (<?php echo e($b->fiscalYear->name ?? ''); ?> · <?php echo e($b->status); ?>)</option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select></div></div>
</form>
<form method="POST" action="<?php echo e(route('budget-virements.store')); ?>"><?php echo csrf_field(); ?>
<div class="frow">
<div class="fld c6"><label>From line</label>
<select name="from_budget_line_id" required>
<?php $__currentLoopData = $lines; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $l): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($l->id); ?>"><?php echo e($l->account->display_name ?? 'Acc #'.$l->account_id); ?> — M<?php echo e($l->month); ?> · avail <?php echo e(money(\App\Services\VirementService::available($l))); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select></div>
<div class="fld c6"><label>To line</label>
<select name="to_budget_line_id" required>
<?php $__currentLoopData = $lines; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $l): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($l->id); ?>"><?php echo e($l->account->display_name ?? 'Acc #'.$l->account_id); ?> — M<?php echo e($l->month); ?> · avail <?php echo e(money(\App\Services\VirementService::available($l))); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select></div>
<div class="fld c4"><label>Amount</label><input type="number" step="0.01" min="0.01" name="amount" value="<?php echo e(old('amount')); ?>" required></div>
<div class="fld c8"><label>Reason</label><input type="text" name="reason" value="<?php echo e(old('reason')); ?>" required maxlength="500" placeholder="Why are funds being moved?"></div>
</div>
<div style="margin-top:12px;display:flex;gap:8px">
<button class="btn">Submit for approval</button>
<a class="btn btn-ghost" href="<?php echo e(route('budget-virements.index')); ?>">Cancel</a>
</div>
</form>
<p class="muted" style="margin-top:8px">Lines move within one budget only. The transfer posts when Finance approves (available funds re-checked at posting).</p>
</div></div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/user/nowills-sqc-erp/resources/views/docs/virement/form.blade.php ENDPATH**/ ?>