171 lines
8.2 KiB
PHP
171 lines
8.2 KiB
PHP
<?php
|
|
session_start();
|
|
|
|
// If user is not logged in, redirect to login.php
|
|
if (!isset($_SESSION['user_id'])) {
|
|
header('Location: login.php');
|
|
exit;
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Payroll</title>
|
|
<meta name="description" content="Built with Flatlogic Generator">
|
|
<meta name="keywords" content="payroll management, php payroll, csv upload, employee payment, payroll approval, background processing, api integration, flatlogic generator">
|
|
<meta property="og:title" content="Payroll">
|
|
<meta property="og:description" content="Built with Flatlogic Generator">
|
|
<meta property="og:image" content="">
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta name="twitter:image" content="">
|
|
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
</head>
|
|
<body>
|
|
|
|
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
|
|
<div class="container-fluid">
|
|
<a class="navbar-brand fw-bold text-primary" href="#">PayrollApp</a>
|
|
<div class="d-flex align-items-center">
|
|
<span class="navbar-text me-3">
|
|
Welcome, <?php echo htmlspecialchars($_SESSION['username']); ?>! (Role: <?php echo htmlspecialchars($_SESSION['role']); ?>)
|
|
</span>
|
|
<a href="logout.php" class="btn btn-outline-secondary">Logout</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<main class="container mt-4">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h1 class="h3">Payroll Management</h1>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-4 mb-4">
|
|
<div class="card h-100">
|
|
<div class="card-body">
|
|
<h5 class="card-title"><i class="bi bi-upload me-2"></i>Upload Payroll</h5>
|
|
<p class="card-text text-muted">Upload a CSV file to start a new payroll batch.</p>
|
|
<form id="uploadForm" enctype="multipart/form-data">
|
|
<div class="mb-3">
|
|
<label for="payrollName" class="form-label">Payroll Name</label>
|
|
<input type="text" class="form-control" id="payrollName" name="name" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="csvFile" class="form-label">CSV File</label>
|
|
<input class="form-control" type="file" id="csvFile" name="file" accept=".csv" required>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary w-100">
|
|
<span class="spinner-border spinner-border-sm d-none" role="status" aria-hidden="true"></span>
|
|
Upload & Preview
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-8 mb-4">
|
|
<div class="card h-100">
|
|
<div class="card-body">
|
|
<h5 class="card-title"><i class="bi bi-list-task me-2"></i>Payroll Batches</h5>
|
|
<div class="table-responsive">
|
|
<table class="table table-hover">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Name</th>
|
|
<th>File Name</th>
|
|
<th>Created At</th>
|
|
<th>Status</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td colspan="6" class="text-center text-muted pt-4 pb-4">No payroll batches found.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<!-- Preview Modal -->
|
|
<div class="modal fade" id="previewModal" tabindex="-1" aria-labelledby="previewModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog modal-xl modal-dialog-centered modal-dialog-scrollable">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="previewModalLabel">CSV Preview</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p>This is a preview of the data from the uploaded file. The data is being processed in the background.</p>
|
|
<div class="table-responsive">
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>name</th>
|
|
<th>accountNumber</th>
|
|
<th>accountName</th>
|
|
<th>amount</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>John Doe</td>
|
|
<td>1234567890</td>
|
|
<td>John's Savings</td>
|
|
<td>5000.00</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Jane Smith</td>
|
|
<td>0987654321</td>
|
|
<td>Jane's Checking</td>
|
|
<td>7500.50</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Peter Jones</td>
|
|
<td>1122334455</td>
|
|
<td>Peter's Account</td>
|
|
<td>3200.75</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Toast Container -->
|
|
<div class="toast-container position-fixed bottom-0 end-0 p-3">
|
|
<div id="successToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
|
|
<div class="toast-header text-white bg-success">
|
|
<i class="bi bi-check-circle-fill me-2"></i>
|
|
<strong class="me-auto">Success</strong>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="toast" aria-label="Close"></button>
|
|
</div>
|
|
<div class="toast-body">
|
|
File upload started successfully! The data is being processed in the background.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
</body>
|
|
</html>
|