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

<?php $__env->startSection('content'); ?>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-header d-flex justify-content-between align-items-center">
                    <h4>Customers</h4>
                    <div>
                        <a href="<?php echo e(route('customers.print')); ?>" class="btn btn-secondary btn-sm" target="_blank">Print List</a>
                        <a href="<?php echo e(route('customers.create')); ?>" class="btn btn-primary btn-sm">Add Customer</a>
                    </div>
                </div>
                <div class="card-body">
                    <?php if($customers->count() > 0): ?>
                        <table class="table table-striped">
                            <thead>
                                <tr>
                                    <th>Name</th>
                                    <th>Email</th>
                                    <th>Phone</th>
                                    <th>Address</th>
                                    <th>Actions</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__currentLoopData = $customers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $customer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td><?php echo e($customer->name); ?></td>
                                        <td><?php echo e($customer->email ?? '-'); ?></td>
                                        <td><?php echo e($customer->phone ?? '-'); ?></td>
                                        <td><?php echo e(substr($customer->address ?? '', 0, 50)); ?><?php echo e(strlen($customer->address ?? '') > 50 ? '...' : ''); ?></td>
                                        <td>
                                            <a href="<?php echo e(route('customers.printSingle', ['customer' => $customer, 'autoprint' => 1])); ?>" class="btn btn-secondary btn-sm" target="_blank">Print</a>
                                            <a href="<?php echo e(route('customers.edit', $customer)); ?>" class="btn btn-warning btn-sm">Edit</a>
                                            <form action="<?php echo e(route('customers.destroy', $customer)); ?>" method="POST" style="display:inline;" onsubmit="return confirm('Are you sure?');">
                                                <?php echo csrf_field(); ?>
                                                <?php echo method_field('DELETE'); ?>
                                                <button type="submit" class="btn btn-danger btn-sm">Delete</button>
                                            </form>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>
                        <?php echo e($customers->links()); ?>

                    <?php else: ?>
                        <p class="text-center">No customers found. <a href="<?php echo e(route('customers.create')); ?>">Create one now</a></p>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </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:\Users\startup sabbir\Desktop\jannat\sarvice-accounts\accounting-system\resources\views/customers/index.blade.php ENDPATH**/ ?>