v2
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['user_id']) || empty($_SESSION['user_id'])) {
|
||||
echo "<script>window.location.href = '/Agent/agent-login'</script>";
|
||||
exit;
|
||||
@@ -16,9 +17,8 @@ if ($conn->connect_error) {
|
||||
|
||||
$today = date("Y-m-d");
|
||||
$userId = $_SESSION['user_id'];
|
||||
$message = ""; // success/error message holder
|
||||
$message = "";
|
||||
|
||||
/* === Save button click handle === */
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['save_collection'])) {
|
||||
$rowId = intval($_POST['row_id']);
|
||||
$collectedAmount = floatval($_POST['collected_amount']);
|
||||
@@ -34,7 +34,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['save_collection'])) {
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
/* === Data fetch === */
|
||||
$targetSql = "SELECT * FROM agent_collections WHERE agent = '$userId' AND date = '$today'";
|
||||
$targetResult = $conn->query($targetSql);
|
||||
$targetRows = $targetResult->fetch_all(MYSQLI_ASSOC);
|
||||
@@ -50,26 +49,21 @@ $remaining = $remaining < 0 ? 0 : $remaining;
|
||||
|
||||
$percent = $collectable > 0 ? ($totalAmount / $collectable) * 100 : 0;
|
||||
|
||||
// Fetch last 10 days report
|
||||
$repStmt = "SELECT * FROM agent_collections WHERE agent = '$userId' ORDER BY date DESC LIMIT 10;";
|
||||
$reportsStmt = $conn->query($repStmt);
|
||||
$reportRows = $reportsStmt->fetch_all(MYSQLI_ASSOC);
|
||||
|
||||
// echo json_encode($reportRows);
|
||||
$conn->close();
|
||||
?>
|
||||
|
||||
|
||||
<div class="container" style="margin-bottom: 105px;">
|
||||
<h3 class="welcome-text">
|
||||
Welcome, <?= htmlspecialchars($_SESSION['name']) ?> 👋
|
||||
</h3>
|
||||
|
||||
<!-- Show success/error message -->
|
||||
<?= $message ?>
|
||||
|
||||
<div class="dashboard-total-section">
|
||||
<!-- Total Collection -->
|
||||
<div class="card-box highlight">
|
||||
<h3>₹ <?= number_format($totalAmount, 2) ?></h3>
|
||||
<p>Total Collection</p>
|
||||
@@ -79,7 +73,6 @@ $conn->close();
|
||||
<small><?= round($percent, 2) ?>% Completed</small>
|
||||
</div>
|
||||
|
||||
<!-- Total Collectable (with Remaining) -->
|
||||
<div class="card-box normal">
|
||||
<h3>₹ <?= number_format($collectable, 2) ?></h3>
|
||||
<p>Total Collectable</p>
|
||||
@@ -88,13 +81,12 @@ $conn->close();
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; flex-direction: row; width: 100%; justify-content: space-between; margin-top: 20px;">
|
||||
<!-- Payment Receive Button -->
|
||||
<a class="btn btn-primary w-100" href="/Agent/Receive">
|
||||
<i class="fa-solid fa-credit-card"></i>
|
||||
Receive New Payment
|
||||
</a>
|
||||
<!-- Save Collection Button -->
|
||||
<?php if (!empty($targetRows)) : ?>
|
||||
<form method="post" class="w-100">
|
||||
<input type="hidden" name="save_collection" value="1">
|
||||
@@ -104,6 +96,7 @@ $conn->close();
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($reportRows)) : ?>
|
||||
<div class="report-section">
|
||||
<h4 class="report-title">📊 Last 10 Days Report</h4>
|
||||
@@ -134,17 +127,19 @@ $conn->close();
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="android-links">
|
||||
<a href="/Agent/commission">Commission</a>
|
||||
<!-- <a href="/Agent/Report">Report</a>
|
||||
<a href="/Agent/Profile">Profile</a> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<style>
|
||||
.welcome-text {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.success-msg {
|
||||
color: green;
|
||||
background: #e6ffe6;
|
||||
@@ -152,7 +147,6 @@ $conn->close();
|
||||
border-radius: 6px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.error-msg {
|
||||
color: red;
|
||||
background: #ffe6e6;
|
||||
@@ -160,58 +154,25 @@ $conn->close();
|
||||
border-radius: 6px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.dashboard-total-section {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
margin-top: 20px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.card-box {
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
background: linear-gradient(135deg, #fdfdfd, #f6f6f6);
|
||||
background: linear-gradient(135deg, #f0f0f0ff, #d3d3d3ff);
|
||||
border-radius: 20px;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
box-shadow: 0 6px 20px rgba(0,0,0,0.08);
|
||||
transition: transform 0.25s ease, box-shadow 0.25s ease;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.card-box:hover {
|
||||
transform: translateY(-6px);
|
||||
box-shadow: 0 10px 25px rgba(0,0,0,0.15);
|
||||
}
|
||||
|
||||
.card-box h3 {
|
||||
margin: 0;
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
.card-box p {
|
||||
margin: 6px 0 12px;
|
||||
font-size: 14px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.card-box.highlight {
|
||||
background: linear-gradient(135deg, #e95420, #f37249);
|
||||
color: #fff;
|
||||
}
|
||||
.card-box.normal{
|
||||
background: linear-gradient(135deg, #ecececff, #ffffffff);
|
||||
}
|
||||
|
||||
.card-box.highlight h3,
|
||||
.card-box.highlight p,
|
||||
.card-box.highlight small {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
width: 100%;
|
||||
height: 10px;
|
||||
@@ -220,14 +181,12 @@ $conn->close();
|
||||
margin: 10px 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progress-fill {
|
||||
height: 100%;
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
transition: width 0.4s ease;
|
||||
}
|
||||
|
||||
.remaining-text {
|
||||
margin-top: 8px;
|
||||
font-size: 13px;
|
||||
@@ -237,76 +196,110 @@ $conn->close();
|
||||
padding: 4px 10px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
/* Report Section - Scroll Snap Slider */
|
||||
.report-section {
|
||||
margin-top: 30px;
|
||||
}
|
||||
margin-top: 30px;
|
||||
}
|
||||
.report-title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 15px;
|
||||
color: #333;
|
||||
}
|
||||
.report-cards {
|
||||
display: flex;
|
||||
overflow-x: auto;
|
||||
scroll-snap-type: x mandatory;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
gap: 16px;
|
||||
}
|
||||
.report-card {
|
||||
flex: 0 0 85%;
|
||||
scroll-snap-align: center;
|
||||
background: linear-gradient(135deg, #ecececff, #ffffffff);
|
||||
border-radius: 16px;
|
||||
padding: 16px;
|
||||
box-shadow: 0 4px 15px rgba(0,0,0,0.08);
|
||||
}
|
||||
.report-date {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #666;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.report-details p {
|
||||
margin: 4px 0;
|
||||
font-size: 14px;
|
||||
color: #444;
|
||||
}
|
||||
.report-progress {
|
||||
margin-top: 12px;
|
||||
}
|
||||
.report-card .progress-bar {
|
||||
width: 100%;
|
||||
height: 8px;
|
||||
background: #eee;
|
||||
border-radius: 10px;
|
||||
margin: 8px 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.report-card .progress-fill {
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg, #e95420, #f37249);
|
||||
border-radius: 10px;
|
||||
}
|
||||
/* Report-cards horizontal scrollbar */
|
||||
.report-cards {
|
||||
scrollbar-width: thin; /* Firefox */
|
||||
scrollbar-color: #f37249 rgba(0,0,0,0.04); /* Firefox */
|
||||
}
|
||||
|
||||
.report-title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 15px;
|
||||
color: #333;
|
||||
}
|
||||
/* --- WebKit browsers (Chrome, Edge, Safari) --- */
|
||||
.report-cards::-webkit-scrollbar {
|
||||
height: 8px; /* thin horizontal scrollbar */
|
||||
}
|
||||
|
||||
.report-cards {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
.report-cards::-webkit-scrollbar-track {
|
||||
background: rgba(0,0,0,0.08);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.report-card {
|
||||
background: linear-gradient(135deg, #ecececff, #ffffffff);
|
||||
border-radius: 16px;
|
||||
padding: 16px;
|
||||
box-shadow: 0 4px 15px rgba(0,0,0,0.08);
|
||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
.report-cards::-webkit-scrollbar-thumb {
|
||||
background: linear-gradient(90deg, #e95420, #f37249);
|
||||
border-radius: 999px; /* ✅ fully rounded pill shape */
|
||||
min-width: 30px;
|
||||
}
|
||||
|
||||
.report-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 8px 20px rgba(0,0,0,0.12);
|
||||
}
|
||||
/* Hover effect */
|
||||
.report-cards::-webkit-scrollbar-thumb:hover {
|
||||
background: linear-gradient(90deg, #d7461c, #e65f3c);
|
||||
}
|
||||
|
||||
.report-date {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #666;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.report-details p {
|
||||
margin: 4px 0;
|
||||
font-size: 14px;
|
||||
color: #444;
|
||||
}
|
||||
.android-links {
|
||||
display: flex;
|
||||
gap: 12px; /* বাটনের মাঝে ফাঁকা */
|
||||
flex-wrap: wrap; /* ছোট স্ক্রিনে ভাঙবে */
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.report-details strong {
|
||||
color: #111;
|
||||
}
|
||||
.android-links a {
|
||||
background: #e95420; /* বাটনের ব্যাকগ্রাউন্ড */
|
||||
color: #fff; /* টেক্সট কালার */
|
||||
text-decoration: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 25px; /* গোলাকার প্রান্ত */
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
box-shadow: 0 3px 8px rgba(0,0,0,0.2);
|
||||
transition: all 0.25s ease;
|
||||
}
|
||||
|
||||
.report-progress {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.report-progress small {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.report-card .progress-bar {
|
||||
width: 100%;
|
||||
height: 8px;
|
||||
background: #eee;
|
||||
border-radius: 10px;
|
||||
margin: 8px 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.report-card .progress-fill {
|
||||
height: 100%;
|
||||
background: linear-gradient(135deg, #e95420, #f37249);
|
||||
border-radius: 10px;
|
||||
transition: width 0.4s ease;
|
||||
}
|
||||
.android-links a:hover {
|
||||
background: #cf471c; /* hover হলে একটু গাঢ় */
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 12px rgba(0,0,0,0.25);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user