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

<?php $__env->startSection('content'); ?>
<div class="row mb-3">
    <div class="col-sm-6">
        <h5 class="mb-0 font-weight-bold">Daftar Pelanggan</h5>
    </div>
    <div class="col-sm-6 text-right">
        <a href="<?php echo e(route('customers.create')); ?>" class="btn btn-primary">
            <i class="fas fa-user-plus"></i> Tambah Pelanggan
        </a>
    </div>
</div>

<div class="card mb-3">
    <div class="card-body py-2">
        <form method="GET" class="form-inline">
            <div class="form-group mr-2 mb-2">
                <input type="text" name="search" value="<?php echo e(request('search')); ?>" class="form-control form-control-sm" style="width: 300px;" placeholder="Cari nama, telepon, email...">
            </div>
            <div class="form-group mb-2">
                <button type="submit" class="btn btn-sm btn-secondary mr-1">Cari</button>
                <a href="<?php echo e(route('customers.index')); ?>" class="btn btn-sm btn-outline-secondary">Reset</a>
            </div>
        </form>
    </div>
</div>

<div class="card">
    <div class="card-body p-0">
        <div class="table-responsive">
            <table class="table table-hover align-middle mb-0">
                <thead>
                    <tr>
                        <th>Nama</th>
                        <th>Alamat</th>
                        <th>Telepon</th>
                        <th>Email</th>
                        <th class="text-center">Invoice</th>
                        <th class="text-center">Aksi</th>
                    </tr>
                </thead>
                <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $customers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $c): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                <tr>
                    <td class="font-weight-bold"><?php echo e($c->name); ?></td>
                    <td class="text-muted small"><?php echo e(Str::limit($c->address, 50)); ?></td>
                    <td><?php echo e($c->phone ?? '-'); ?></td>
                    <td><?php echo e($c->email ?? '-'); ?></td>
                    <td class="text-center"><span class="badge badge-primary"><?php echo e($c->invoices_count); ?></span></td>
                    <td class="text-center">
                        <div class="btn-group btn-group-sm">
                            <a href="<?php echo e(route('customers.show', $c)); ?>" class="btn btn-outline-primary" title="Detail"><i class="fas fa-eye"></i></a>
                            <a href="<?php echo e(route('customers.edit', $c)); ?>" class="btn btn-outline-warning" title="Edit"><i class="fas fa-edit"></i></a>
                            <form method="POST" action="<?php echo e(route('customers.destroy', $c)); ?>" onsubmit="return confirm('Hapus pelanggan ini?')" class="d-inline">
                                <?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
                                <button type="submit" class="btn btn-outline-danger" title="Hapus"><i class="fas fa-trash"></i></button>
                            </form>
                        </div>
                    </td>
                </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                <tr><td colspan="6" class="text-center text-muted py-5">Belum ada pelanggan</td></tr>
                <?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
    <?php if($customers->hasPages()): ?>
        <div class="card-footer"><?php echo e($customers->links()); ?></div>
    <?php endif; ?>
</div>
<?php $__env->stopSection(); ?>


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