« Back to History
employee_list.php
|
20260721_154032.php
Initial Bulk Import
Copy Code
<?php require_once __DIR__ . '/modules/auth/page_acl.php'; $ctx = page_require_access('employee_list'); $pdo = $ctx['pdo']; $company_id = (int)$ctx['company_id']; function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); } /* ========================= FETCH EMPLOYEES ========================= */ $st = $pdo->prepare(" SELECT id, employee_code, name, mobile, department_name, designation_name, payment_type, is_active FROM company_employee_master WHERE company_id = :cid ORDER BY name "); $st->execute([':cid' => $company_id]); $rows = $st->fetchAll(PDO::FETCH_ASSOC); ?> <?php require_once __DIR__ . '/partials/header.php'; ?> <div class="container-fluid mt-4"> <!-- Page Header --> <div class="d-flex justify-content-between align-items-center mb-3"> <h4 class="fw-bold mb-0">Employee List</h4> <a href="employee_register_new.php" class="btn btn-success btn-sm"> + Add Employee </a> </div> <div class="card shadow-sm border-0"> <div class="card-body"> <div class="table-responsive"> <table class="table table-hover table-bordered align-middle table-sm mb-0"> <thead class="table-light text-center"> <tr> <th>Code</th> <th class="text-start">Name</th> <th>Mobile</th> <th>Department</th> <th>Designation</th> <th>Payment</th> <th>Status</th> <th style="width:90px">Action</th> </tr> </thead> <tbody> <?php foreach ($rows as $r): ?> <tr class="text-center"> <td><?=h($r['employee_code'])?></td> <td class="text-start fw-semibold"> <?=h($r['name'])?> </td> <td><?=h($r['mobile'])?></td> <td><?=h($r['department_name'])?></td> <td><?=h($r['designation_name'])?></td> <td> <span class="badge <?= $r['payment_type']=='BANK' ? 'bg-primary' : 'bg-secondary' ?>"> <?=h($r['payment_type'])?> </span> </td> <td> <?php if ($r['is_active']): ?> <span class="badge bg-success">Active</span> <?php else: ?> <span class="badge bg-danger">Inactive</span> <?php endif; ?> </td> <td> <a class="btn btn-sm btn-outline-primary" href="employee_edit_new.php?id=<?=$r['id']?>"> Edit </a> </td> </tr> <?php endforeach; ?> <?php if (empty($rows)): ?> <tr> <td colspan="8" class="text-center text-muted py-4"> No employees found. </td> </tr> <?php endif; ?> </tbody> </table> </div> </div> </div> </div> <?php require_once __DIR__ . '/partials/footer.php'; ?>