<?php $__env->startSection('title', 'Payment Transactions'); ?>
<?php $__env->startSection('page-title', 'Payment Transactions'); ?>

<?php $__env->startSection('content'); ?>
<!-- Filter Panel Toggle -->
<?php if (isset($component)) { $__componentOriginal775da4db6660fa0c0efa99eeb44c6fa5 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal775da4db6660fa0c0efa99eeb44c6fa5 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.filter-panel','data' => ['class' => 'flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.filter-panel'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['class' => 'flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between']); ?>
    <!-- Search Bar -->
    <div class="flex-1 max-w-md">
        <?php if (isset($component)) { $__componentOriginal5cb383ddee3a6dc44b6e82e90e14b261 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal5cb383ddee3a6dc44b6e82e90e14b261 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.search-input','data' => ['id' => 'paymentsSearch','placeholder' => 'Search transaction, order number, code']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.search-input'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'paymentsSearch','placeholder' => 'Search transaction, order number, code']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal5cb383ddee3a6dc44b6e82e90e14b261)): ?>
<?php $attributes = $__attributesOriginal5cb383ddee3a6dc44b6e82e90e14b261; ?>
<?php unset($__attributesOriginal5cb383ddee3a6dc44b6e82e90e14b261); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal5cb383ddee3a6dc44b6e82e90e14b261)): ?>
<?php $component = $__componentOriginal5cb383ddee3a6dc44b6e82e90e14b261; ?>
<?php unset($__componentOriginal5cb383ddee3a6dc44b6e82e90e14b261); ?>
<?php endif; ?>
    </div>
    
    <!-- Filter Toggle Action -->
    <div class="flex items-center gap-3">
        <?php if (isset($component)) { $__componentOriginal60a020e5340f3f52bbc4501dc9f93102 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal60a020e5340f3f52bbc4501dc9f93102 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin.button','data' => ['type' => 'secondary','id' => 'filterBtn','icon' => 'bi-funnel']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin.button'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['type' => 'secondary','id' => 'filterBtn','icon' => 'bi-funnel']); ?>Filters <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal60a020e5340f3f52bbc4501dc9f93102)): ?>
<?php $attributes = $__attributesOriginal60a020e5340f3f52bbc4501dc9f93102; ?>
<?php unset($__attributesOriginal60a020e5340f3f52bbc4501dc9f93102); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal60a020e5340f3f52bbc4501dc9f93102)): ?>
<?php $component = $__componentOriginal60a020e5340f3f52bbc4501dc9f93102; ?>
<?php unset($__componentOriginal60a020e5340f3f52bbc4501dc9f93102); ?>
<?php endif; ?>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal775da4db6660fa0c0efa99eeb44c6fa5)): ?>
<?php $attributes = $__attributesOriginal775da4db6660fa0c0efa99eeb44c6fa5; ?>
<?php unset($__attributesOriginal775da4db6660fa0c0efa99eeb44c6fa5); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal775da4db6660fa0c0efa99eeb44c6fa5)): ?>
<?php $component = $__componentOriginal775da4db6660fa0c0efa99eeb44c6fa5; ?>
<?php unset($__componentOriginal775da4db6660fa0c0efa99eeb44c6fa5); ?>
<?php endif; ?>

<!-- Filters Panel Content -->
<div id="filterPanel" class="mb-6 bg-white dark:bg-gray-950 border border-gray-200 dark:border-gray-800 rounded-lg p-4 hidden">
    <form id="filterForm" class="space-y-4">
        <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3">
            <!-- Payment Method -->
            <select name="payment_method" 
                    class="py-2 px-4 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-lg text-sm text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-transparent">
                <option value="">All Methods</option>
                <option value="aba">ABA PayWay</option>
                <option value="cod">Cash on Delivery (COD)</option>
            </select>

            <!-- Payment Status -->
            <select name="payment_status" 
                    class="py-2 px-4 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-lg text-sm text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-transparent">
                <option value="">All Statuses</option>
                <option value="pending">Pending</option>
                <option value="paid">Paid</option>
                <option value="failed">Failed</option>
                <option value="cancelled">Cancelled</option>
            </select>

            <!-- Date From -->
            <input type="date" name="date_from" 
                   class="py-2 px-4 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-lg text-sm text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-transparent">

            <!-- Date To -->
            <input type="date" name="date_to" 
                   class="py-2 px-4 bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-lg text-sm text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-transparent">
        </div>

        <div class="flex items-center gap-3">
            <button type="button" id="clearFilters"
                    class="px-4 py-2 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 text-sm font-medium rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors">
                Clear Filters
            </button>
        </div>
    </form>
</div>

<!-- DataTable -->
<?php if (isset($component)) { $__componentOriginal8aaf9779783cdf64609094123653a0b9 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal8aaf9779783cdf64609094123653a0b9 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.datatable','data' => ['id' => 'paymentsTable','ajaxUrl' => route('admin.payments.index'),'columns' => [
        ['data' => 'transaction_id', 'name' => 'transaction_id'],
        ['data' => 'order_number', 'name' => 'order_number'],
        ['data' => 'customer', 'name' => 'customer_name'],
        ['data' => 'amount', 'name' => 'total'],
        ['data' => 'status', 'name' => 'payment_status'],
        ['data' => 'approval_code', 'name' => 'approval_code'],
        ['data' => 'callback_time', 'name' => 'updated_at'],
        ['data' => 'actions', 'name' => 'actions', 'orderable' => false, 'searchable' => false]
    ],'order' => [[6, 'desc']],'columnDefs' => [
        ['className' => 'text-left', 'targets' => [0, 1, 2, 3, 4, 5, 6]],
        ['className' => 'text-right', 'targets' => [7]]
    ],'searchId' => 'paymentsSearch','filterFormId' => 'filterForm','clearFiltersId' => 'clearFilters','padding' => false]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('datatable'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['id' => 'paymentsTable','ajax-url' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(route('admin.payments.index')),'columns' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute([
        ['data' => 'transaction_id', 'name' => 'transaction_id'],
        ['data' => 'order_number', 'name' => 'order_number'],
        ['data' => 'customer', 'name' => 'customer_name'],
        ['data' => 'amount', 'name' => 'total'],
        ['data' => 'status', 'name' => 'payment_status'],
        ['data' => 'approval_code', 'name' => 'approval_code'],
        ['data' => 'callback_time', 'name' => 'updated_at'],
        ['data' => 'actions', 'name' => 'actions', 'orderable' => false, 'searchable' => false]
    ]),'order' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute([[6, 'desc']]),'column-defs' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute([
        ['className' => 'text-left', 'targets' => [0, 1, 2, 3, 4, 5, 6]],
        ['className' => 'text-right', 'targets' => [7]]
    ]),'search-id' => 'paymentsSearch','filter-form-id' => 'filterForm','clear-filters-id' => 'clearFilters','padding' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(false)]); ?>
     <?php $__env->slot('thead', null, []); ?> 
        <th>Transaction ID</th>
        <th>Order Number</th>
        <th>Customer</th>
        <th>Amount</th>
        <th>Payment Status</th>
        <th>Approval Code</th>
        <th>Callback / Settlement Time</th>
        <th class="text-right">Actions</th>
     <?php $__env->endSlot(); ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal8aaf9779783cdf64609094123653a0b9)): ?>
<?php $attributes = $__attributesOriginal8aaf9779783cdf64609094123653a0b9; ?>
<?php unset($__attributesOriginal8aaf9779783cdf64609094123653a0b9); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal8aaf9779783cdf64609094123653a0b9)): ?>
<?php $component = $__componentOriginal8aaf9779783cdf64609094123653a0b9; ?>
<?php unset($__componentOriginal8aaf9779783cdf64609094123653a0b9); ?>
<?php endif; ?>

<!-- Edit Payment Modal -->
<div id="editPaymentModal" class="fixed inset-0 z-50 hidden bg-slate-900/50 backdrop-blur-sm flex items-center justify-center">
    <div class="bg-white dark:bg-slate-950 rounded-2xl max-w-md w-full mx-4 border border-slate-200 dark:border-slate-800 shadow-soft overflow-hidden animate-fade-in">
        <form id="editPaymentForm" method="POST">
            <?php echo csrf_field(); ?>
            <?php echo method_field('PUT'); ?>
            <div class="px-6 py-4 border-b border-slate-100 dark:border-slate-850 flex items-center justify-between">
                <h3 class="font-bold text-slate-900 dark:text-white">Edit Payment Details</h3>
                <button type="button" onclick="closeEditPaymentModal()" class="text-slate-400 hover:text-slate-600 dark:hover:text-slate-200 text-lg"><i class="bi bi-x-lg"></i></button>
            </div>
            <div class="p-6 space-y-4 text-left">
                <div>
                    <label class="block text-xs font-semibold text-slate-500 uppercase tracking-wider mb-2">Payment Method</label>
                    <select name="payment_method" id="edit_payment_method" class="w-full py-2 px-3 bg-slate-50 dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-lg text-sm text-slate-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500">
                        <option value="aba">ABA PayWay</option>
                        <option value="cod">Cash on Delivery (COD)</option>
                    </select>
                </div>
                <div>
                    <label class="block text-xs font-semibold text-slate-500 uppercase tracking-wider mb-2">Transaction ID</label>
                    <input type="text" name="transaction_id" id="edit_transaction_id" class="w-full py-2 px-3 bg-slate-50 dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-lg text-sm text-slate-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500">
                </div>
                <div>
                    <label class="block text-xs font-semibold text-slate-500 uppercase tracking-wider mb-2">Approval Code</label>
                    <input type="text" name="approval_code" id="edit_approval_code" class="w-full py-2 px-3 bg-slate-50 dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-lg text-sm text-slate-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500">
                </div>
                <div>
                    <label class="block text-xs font-semibold text-slate-500 uppercase tracking-wider mb-2">Payment Status</label>
                    <select name="payment_status" id="edit_payment_status" class="w-full py-2 px-3 bg-slate-50 dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-lg text-sm text-slate-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500">
                        <option value="pending">Pending</option>
                        <option value="paid">Paid</option>
                        <option value="failed">Failed</option>
                        <option value="cancelled">Cancelled</option>
                    </select>
                </div>
            </div>
            <div class="px-6 py-4 bg-slate-50 dark:bg-slate-900/50 border-t border-slate-100 dark:border-slate-850 flex justify-end gap-3">
                <button type="button" onclick="closeEditPaymentModal()" class="px-4 py-2 border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 text-slate-700 dark:text-slate-300 font-semibold rounded-lg text-sm hover:bg-slate-50 dark:hover:bg-slate-800 transition">Cancel</button>
                <button type="submit" class="px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-white font-semibold rounded-lg text-sm transition">Save Changes</button>
            </div>
        </form>
    </div>
</div>

<script>
$(document).ready(function() {
    // Toggle filter panel
    $('#filterBtn').on('click', function() {
        $('#filterPanel').toggleClass('hidden');
    });
});

function openEditPaymentModal(id, method, transactionId, approvalCode, status) {
    var form = document.getElementById('editPaymentForm');
    form.action = '/admin/payments/' + id;
    document.getElementById('edit_payment_method').value = method;
    document.getElementById('edit_transaction_id').value = transactionId;
    document.getElementById('edit_approval_code').value = approvalCode;
    document.getElementById('edit_payment_status').value = status;
    document.getElementById('editPaymentModal').classList.remove('hidden');
}

function closeEditPaymentModal() {
    document.getElementById('editPaymentModal').classList.add('hidden');
}
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /Users/mac/Documents/e-com/resources/views/admin/payments/index.blade.php ENDPATH**/ ?>