<div class="card-box">
<div class="col-12">
    <div class="card-box-header">
        <h5>
            <i class="fa fa-file-excel-o" onclick="exportToExcel('supplier_detailview','suppliers')" style="color:#17179e;font-size:18px;cursor:pointer;margin-right:8px;" title="Export Excel"></i>
            <i class="fa fa-print" onclick="window.print()" style="font-size:18px;cursor:pointer;margin-right:8px;" title="Print"></i>
            <i class="fa-solid fa-truck" style="color:#0891b2;"></i> Supplier Master
        </h5>
        <a href="<?php echo site_url('supplier/create'); ?>" class="btn btn-primary btn-sm">
            <i class="fa-solid fa-plus me-1"></i> Add Supplier
        </a>
    </div>
    <div class="print-title" style="display:none;">Supplier Master</div>
    <div class="table-responsive">
        <table id="supplier_detailview" class="table table-bordered table-hover dt-table mb-0">
            <thead>
                <tr>
                    <th width="60">Sr.</th>
                    <th>Supplier Name</th>
                    <th>Mobile</th>
                    <th>Email</th>
                    <th>GST No</th>
                    <th>Address</th>
                    <th width="120" class="text-center">Status</th>
                    <th width="160" class="text-center">Action</th>
                </tr>
            </thead>
            <tbody>
                <?php if(!empty($supplierdata)): $sr = 1; foreach($supplierdata as $row): ?>
                <tr>
                    <td><?php echo $sr++; ?></td>
                    <td><?php echo htmlspecialchars($row->supplier_name); ?></td>
                    <td><?php echo $row->mobile; ?></td>
                    <td><?php echo $row->email; ?></td>
                    <td><?php echo $row->gst_no; ?></td>
                    <td><?php echo $row->address; ?></td>
                    <td class="text-center">
                        <?php if($row->status == 1): ?>
                            <span class="badge-active"><i class="fa-solid fa-circle-check me-1"></i>Active</span>
                        <?php else: ?>
                            <span class="badge-inactive"><i class="fa-solid fa-circle-xmark me-1"></i>Inactive</span>
                        <?php endif; ?>
                    </td>
                    <td class="text-center">
                        <a href="<?php echo site_url('supplier/edit/'.$row->id); ?>" class="btn btn-sm btn-edit me-1"><i class="fa-solid fa-pen-to-square"></i></a>
                        <!--<a href="<?php echo site_url('supplier/delete/'.$row->id); ?>" class="btn btn-sm btn-delete btn-delete-confirm"><i class="fa-solid fa-trash"></i></a>-->
                    </td>
                </tr>
                <?php endforeach; else: ?>
                <tr><td colspan="8" class="text-center py-4 text-muted">No suppliers found. <a href="<?php echo site_url('supplier/create'); ?>">Add first</a></td></tr>
                <?php endif; ?>
            </tbody>
        </table>
    </div>
</div>
</div>