<?php $__env->startSection('title', __('Payments & Receipts')); ?>
<?php $__env->startSection('content'); ?>
<div class="row g-3"><div class="col-lg-6"><div class="card h-100"><div class="card-body p-4"><h6><i class="fa-solid fa-arrow-down text-success me-2"></i><?php echo e(__('Receive from Customer')); ?></h6><p class="text-muted small"><?php echo e(__('Record money received against a customer sale.')); ?></p><form method="POST" action="<?php echo e(route('payments.receive')); ?>"><?php echo csrf_field(); ?><label class="form-label"><?php echo e(__('Unpaid Invoice')); ?></label><select name="invoice_id" class="form-select" required><option value=""><?php echo e(__('Select invoice')); ?></option><?php $__currentLoopData = $customerInvoices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $invoice): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($invoice->id); ?>"><?php echo e($invoice->invoice_number); ?> — <?php echo e($invoice->customer?->name ?? __('Walk-in Customer')); ?> — <?php echo e(number_format($invoice->due_amount,2)); ?> <?php echo e($invoice->currency_code); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select><div class="row g-2 mt-1"><div class="col-6"><label class="form-label"><?php echo e(__('Amount')); ?></label><input name="amount" type="number" min="0.01" step="0.01" class="form-control" required></div><div class="col-6"><label class="form-label"><?php echo e(__('Date')); ?></label><input name="payment_date" type="date" class="form-control" value="<?php echo e(now()->toDateString()); ?>"></div></div><label class="form-label mt-3"><?php echo e(__('Method')); ?></label><select name="method" class="form-select"><option value="cash"><?php echo e(__('Cash')); ?></option><option value="bank"><?php echo e(__('Bank')); ?></option><option value="mobile"><?php echo e(__('Mobile Money')); ?></option><option value="other"><?php echo e(__('Other')); ?></option></select><input name="reference" class="form-control mt-3" placeholder="<?php echo e(__('Reference number')); ?>"><button class="btn btn-success w-100 mt-3"><i class="fa-solid fa-circle-down me-1"></i><?php echo e(__('Receive Payment')); ?></button></form></div></div></div><div class="col-lg-6"><div class="card h-100"><div class="card-body p-4"><h6><i class="fa-solid fa-arrow-up text-danger me-2"></i><?php echo e(__('Pay Supplier')); ?></h6><p class="text-muted small"><?php echo e(__('Record money paid against a supplier purchase.')); ?></p><form method="POST" action="<?php echo e(route('payments.supplier')); ?>"><?php echo csrf_field(); ?><label class="form-label"><?php echo e(__('Unpaid Purchase')); ?></label><select name="purchase_id" class="form-select" required><option value=""><?php echo e(__('Select purchase')); ?></option><?php $__currentLoopData = $supplierPurchases; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $purchase): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($purchase->id); ?>"><?php echo e($purchase->purchase_number); ?> — <?php echo e($purchase->supplier?->name ?? '—'); ?> — <?php echo e(number_format($purchase->due_amount,2)); ?> <?php echo e($purchase->currency_code); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select><div class="row g-2 mt-1"><div class="col-6"><label class="form-label"><?php echo e(__('Amount')); ?></label><input name="amount" type="number" min="0.01" step="0.01" class="form-control" required></div><div class="col-6"><label class="form-label"><?php echo e(__('Date')); ?></label><input name="payment_date" type="date" class="form-control" value="<?php echo e(now()->toDateString()); ?>"></div></div><label class="form-label mt-3"><?php echo e(__('Method')); ?></label><select name="method" class="form-select"><option value="cash"><?php echo e(__('Cash')); ?></option><option value="bank"><?php echo e(__('Bank')); ?></option><option value="mobile"><?php echo e(__('Mobile Money')); ?></option><option value="other"><?php echo e(__('Other')); ?></option></select><input name="reference" class="form-control mt-3" placeholder="<?php echo e(__('Reference number')); ?>"><button class="btn btn-danger w-100 mt-3"><i class="fa-solid fa-circle-up me-1"></i><?php echo e(__('Pay Supplier')); ?></button></form></div></div></div></div>
<div class="row g-3 mt-1"><div class="col-lg-6"><div class="card"><div class="card-body"><h6><?php echo e(__('Recent Customer Receipts')); ?></h6><table class="table table-sm"><thead><tr><th><?php echo e(__('Date')); ?></th><th><?php echo e(__('Customer')); ?></th><th><?php echo e(__('Amount')); ?></th></tr></thead><tbody><?php $__empty_1 = true; $__currentLoopData = $receipts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $receipt): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><tr><td><?php echo e($receipt->payment_date->format('d M')); ?></td><td><?php echo e($receipt->customer?->name ?? __('Walk-in Customer')); ?><small class="d-block"><?php echo e($receipt->invoice?->invoice_number); ?></small></td><td class="text-success"><?php echo e(number_format($receipt->amount,2)); ?> <?php echo e($receipt->currency_code); ?></td></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="3" class="text-muted text-center"><?php echo e(__('No receipts yet.')); ?></td></tr><?php endif; ?></tbody></table></div></div></div><div class="col-lg-6"><div class="card"><div class="card-body"><h6><?php echo e(__('Recent Supplier Payments')); ?></h6><table class="table table-sm"><thead><tr><th><?php echo e(__('Date')); ?></th><th><?php echo e(__('Supplier')); ?></th><th><?php echo e(__('Amount')); ?></th></tr></thead><tbody><?php $__empty_1 = true; $__currentLoopData = $supplierPayments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $payment): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><tr><td><?php echo e($payment->payment_date->format('d M')); ?></td><td><?php echo e($payment->supplier?->name); ?><small class="d-block"><?php echo e($payment->purchase?->purchase_number); ?></small></td><td class="text-danger"><?php echo e(number_format($payment->amount,2)); ?> <?php echo e($payment->currency_code); ?></td></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="3" class="text-muted text-center"><?php echo e(__('No supplier payments yet.')); ?></td></tr><?php endif; ?></tbody></table></div></div></div></div>
<div class="row g-3 mt-1"><div class="col-lg-6"><div class="card"><div class="card-body p-4"><h6><i class="fa-solid fa-circle-plus text-success me-2"></i><?php echo e(__('General Receipt')); ?></h6><form method="POST" action="<?php echo e(route('payments.general')); ?>"><?php echo csrf_field(); ?><input type="hidden" name="type" value="receipt"><div class="row g-2"><div class="col-6"><input name="party_name" class="form-control" placeholder="<?php echo e(__('From / Party')); ?>"></div><div class="col-6"><input name="category" class="form-control" placeholder="<?php echo e(__('Category')); ?>" required></div><div class="col-6"><input name="amount" type="number" min="0.01" step="0.01" class="form-control" placeholder="<?php echo e(__('Amount')); ?>" required></div><div class="col-6"><select name="currency_code" class="form-select"><?php $__currentLoopData = $currencies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $currency): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($currency->code); ?>" <?php if($currency->is_default): echo 'selected'; endif; ?>><?php echo e($currency->code); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></div><div class="col-6"><input name="transaction_date" type="date" class="form-control" value="<?php echo e(now()->toDateString()); ?>"></div><div class="col-6"><select name="method" class="form-select"><option value="cash"><?php echo e(__('Cash')); ?></option><option value="bank"><?php echo e(__('Bank')); ?></option><option value="mobile"><?php echo e(__('Mobile Money')); ?></option></select></div></div><input name="reference" class="form-control mt-2" placeholder="<?php echo e(__('Reference number')); ?>"><textarea name="notes" class="form-control mt-2" rows="2" placeholder="<?php echo e(__('Notes')); ?>"></textarea><button class="btn btn-success w-100 mt-3"><?php echo e(__('Save General Receipt')); ?></button></form></div></div></div><div class="col-lg-6"><div class="card"><div class="card-body p-4"><h6><i class="fa-solid fa-circle-minus text-danger me-2"></i><?php echo e(__('General Payment')); ?></h6><form method="POST" action="<?php echo e(route('payments.general')); ?>"><?php echo csrf_field(); ?><input type="hidden" name="type" value="payment"><div class="row g-2"><div class="col-6"><input name="party_name" class="form-control" placeholder="<?php echo e(__('To / Party')); ?>"></div><div class="col-6"><input name="category" class="form-control" placeholder="<?php echo e(__('Category')); ?>" required></div><div class="col-6"><input name="amount" type="number" min="0.01" step="0.01" class="form-control" placeholder="<?php echo e(__('Amount')); ?>" required></div><div class="col-6"><select name="currency_code" class="form-select"><?php $__currentLoopData = $currencies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $currency): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><option value="<?php echo e($currency->code); ?>" <?php if($currency->is_default): echo 'selected'; endif; ?>><?php echo e($currency->code); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></div><div class="col-6"><input name="transaction_date" type="date" class="form-control" value="<?php echo e(now()->toDateString()); ?>"></div><div class="col-6"><select name="method" class="form-select"><option value="cash"><?php echo e(__('Cash')); ?></option><option value="bank"><?php echo e(__('Bank')); ?></option><option value="mobile"><?php echo e(__('Mobile Money')); ?></option></select></div></div><input name="reference" class="form-control mt-2" placeholder="<?php echo e(__('Reference number')); ?>"><textarea name="notes" class="form-control mt-2" rows="2" placeholder="<?php echo e(__('Notes')); ?>"></textarea><button class="btn btn-danger w-100 mt-3"><?php echo e(__('Save General Payment')); ?></button></form></div></div></div></div>
<div class="card mt-3"><div class="card-body"><h6><?php echo e(__('General Transactions')); ?></h6><table class="table table-sm"><thead><tr><th><?php echo e(__('Date')); ?></th><th><?php echo e(__('Type')); ?></th><th><?php echo e(__('Party')); ?></th><th><?php echo e(__('Category')); ?></th><th><?php echo e(__('Amount')); ?></th></tr></thead><tbody><?php $__empty_1 = true; $__currentLoopData = $generalTransactions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transaction): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><tr><td><?php echo e($transaction->transaction_date->format('d M Y')); ?></td><td><span class="badge <?php echo e($transaction->type==='receipt'?'badge-soft':'badge-danger'); ?>"><?php echo e(ucfirst($transaction->type)); ?></span></td><td><?php echo e($transaction->party_name); ?></td><td><?php echo e($transaction->category); ?></td><td class="<?php echo e($transaction->type==='receipt'?'text-success':'text-danger'); ?>"><?php echo e(number_format($transaction->amount,2)); ?> <?php echo e($transaction->currency_code); ?></td></tr><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><tr><td colspan="5" class="text-muted text-center"><?php echo e(__('No general transactions yet.')); ?></td></tr><?php endif; ?></tbody></table></div></div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\TradeERP\resources\views/payments/index.blade.php ENDPATH**/ ?>