<?php $__env->startSection('title','Review Statement Import'); ?>
<?php $__env->startSection('crumbs','<a href="'.route('bank-transactions.index').'">Bank Transactions</a> · <b>Review import</b>'); ?>
<?php $__env->startSection('content'); ?>
<div class="card"><div class="card-h"><h2>Review — <?php echo e($bank->display_name); ?> (<?php echo e(count($rows)); ?> rows)</h2></div>
<div class="card-b">
<form method="POST" action="<?php echo e(route('bank-import.confirm')); ?>"><?php echo csrf_field(); ?>
<div class="twrap"><table class="tbl">
<thead><tr><th>Date</th><th>Statement narration</th><th>Dr</th><th>Cr</th><th>Suggested match</th><th>Action</th></tr></thead>
<tbody>
<?php $__currentLoopData = $rows; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i => $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php $m = $row['match']; $dup = $m && $m['reconciled']; ?>
<tr>
<td style="white-space:nowrap"><?php echo e(fdate($row['date'])); ?></td>
<td><?php echo e($row['narration']); ?><?php if($row['reference']): ?> <small class="muted"><?php echo e($row['reference']); ?></small><?php endif; ?></td>
<td><?php echo e($row['direction']==='Dr' ? money($row['amount']) : ''); ?></td>
<td><?php echo e($row['direction']==='Cr' ? money($row['amount']) : ''); ?></td>
<td><?php if($m): ?><b><?php echo e($m['txn_no']); ?></b> <small class="muted"><?php echo e($m['txn_date']); ?> · <?php echo e(Str::limit($m['narration'] ?? '', 40)); ?></small>
<?php if($dup): ?><span class="bdg b-warn">already reconciled</span><?php endif; ?>
<?php else: ?><span class="muted">— new —</span><?php endif; ?></td>
<td style="white-space:nowrap">
<?php if($m && !$dup): ?>
<label><input type="radio" name="rows[<?php echo e($i); ?>][action]" value="match" checked> Match</label>
<input type="hidden" name="rows[<?php echo e($i); ?>][txn_id]" value="<?php echo e($m['id']); ?>">
<?php endif; ?>
<label><input type="radio" name="rows[<?php echo e($i); ?>][action]" value="new" <?php echo e((!$m || $dup) ? 'checked' : ''); ?>> New</label>
<select name="rows[<?php echo e($i); ?>][txn_type]">
<?php $__currentLoopData = ($row['direction']==='Cr' ? ['deposit'=>'Deposit','transfer-in'=>'Transfer in','interest'=>'Interest'] : ['withdrawal'=>'Withdrawal','transfer-out'=>'Transfer out','bank-charges'=>'Bank charges']); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $v=>$l): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($v); ?>"><?php echo e($l); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<label><input type="radio" name="rows[<?php echo e($i); ?>][action]" value="skip"> Skip</label>
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody></table></div>
<div style="margin-top:12px;display:flex;gap:8px">
<button class="btn">Confirm import</button>
<a class="btn btn-ghost" href="<?php echo e(route('bank-import.create')); ?>">Back</a>
</div>
</form>
</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/bank-import/review.blade.php ENDPATH**/ ?>