Files
Kent-logistics-Laravel/resources/views/admin/reports.blade.php

932 lines
28 KiB
PHP
Raw Normal View History

2025-11-06 17:09:52 +05:30
@extends('admin.layouts.app')
2025-11-21 16:07:43 +05:30
@section('page-title', 'Shipping Report List')
2025-11-06 17:09:52 +05:30
@section('content')
2025-11-21 16:07:43 +05:30
<style>
2026-02-27 10:51:26 +05:30
/* GLOBAL RESPONSIVE STYLES (unchanged) */
2025-11-26 23:07:12 +05:30
html, body {
overflow-x: hidden !important;
max-width: 100%;
2025-11-26 23:07:12 +05:30
}
2026-02-27 10:51:26 +05:30
:root {
--admin-font: "Inter", sans-serif;
}
body, input, select, textarea, button, table, th, td, .report-container {
font-family: var(--admin-font);
}
2025-11-21 16:07:43 +05:30
.report-container {
2025-11-26 23:07:12 +05:30
background: #ffffff;
2025-11-21 16:07:43 +05:30
padding: 25px;
2025-11-26 23:07:12 +05:30
border-radius: 16px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
margin: 20px auto;
max-width: 100%;
border: 1px solid #f0f0f0;
2025-11-21 16:07:43 +05:30
}
.report-header {
2025-11-26 23:07:12 +05:30
display: flex;
align-items: center;
gap: 18px;
margin-bottom: 8px;
padding-bottom: 20px;
border-bottom: 2px solid #f8f9fa;
}
.header-icon {
width: 55px;
height: 55px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 14px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}
.header-icon i {
font-size: 24px;
color: white;
}
.header-text {
flex: 1;
}
.report-title {
font-size: 24px;
2025-11-21 16:07:43 +05:30
font-weight: 700;
2025-11-26 23:07:12 +05:30
color: #1a202c;
letter-spacing: -0.6px;
2025-11-21 16:07:43 +05:30
margin-bottom: 4px;
}
.report-subtitle {
2025-11-26 23:07:12 +05:30
font-size: 14px;
color: #718096;
font-weight: 500;
}
2026-02-27 10:51:26 +05:30
/* STATS CARDS (Invoice focused) */
2025-11-26 23:07:12 +05:30
.stats-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
gap: 12px;
2025-11-26 23:07:12 +05:30
margin: 20px 0;
}
.stat-card {
background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
padding: 16px;
2025-11-26 23:07:12 +05:30
border-radius: 12px;
border-left: 4px solid #4f46e5;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
transition: transform 0.3s ease;
display: flex;
align-items: center;
gap: 12px;
min-height: 70px;
2025-11-26 23:07:12 +05:30
}
.stat-card.warning {
border-left-color: #f59e0b;
background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}
.stat-card.success {
border-left-color: #10b981;
background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}
.stat-card.danger {
border-left-color: #ef4444;
background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}
.stat-card.info {
border-left-color: #3b82f6;
background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}
.stat-card.secondary {
border-left-color: #8b5cf6;
background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
}
.stat-icon {
width: 45px;
height: 45px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(79, 70, 229, 0.1);
flex-shrink: 0;
}
2025-11-26 23:07:12 +05:30
.stat-icon i {
font-size: 18px;
color: #4f46e5;
}
.stat-card.warning .stat-icon {
background: rgba(245, 158, 11, 0.1);
}
.stat-card.warning .stat-icon i {
color: #f59e0b;
}
.stat-card.success .stat-icon {
background: rgba(16, 185, 129, 0.1);
}
.stat-card.success .stat-icon i {
color: #10b981;
}
.stat-card.danger .stat-icon {
background: rgba(239, 68, 68, 0.1);
}
.stat-card.danger .stat-icon i {
color: #ef4444;
}
.stat-card.info .stat-icon {
2025-11-26 23:07:12 +05:30
background: rgba(59, 130, 246, 0.1);
}
2025-11-26 23:07:12 +05:30
.stat-card.info .stat-icon i {
color: #3b82f6;
}
.stat-card.secondary .stat-icon {
background: rgba(139, 92, 246, 0.1);
}
.stat-card.secondary .stat-icon i {
color: #8b5cf6;
}
.stat-content {
flex: 1;
}
2025-11-26 23:07:12 +05:30
.stat-value {
font-size: 22px;
font-weight: 700;
color: #1a202c;
line-height: 1.2;
margin-bottom: 2px;
2025-11-26 23:07:12 +05:30
}
.stat-label {
font-size: 12px;
2025-11-26 23:07:12 +05:30
color: #718096;
font-weight: 500;
line-height: 1.3;
}
2026-02-27 10:51:26 +05:30
/* FILTER SECTION (From/To + Company) */
2025-11-26 23:07:12 +05:30
.filter-section {
background: #f8fafc;
border-radius: 12px;
padding: 20px;
2025-11-21 16:07:43 +05:30
margin-bottom: 20px;
2025-11-26 23:07:12 +05:30
border: 1px solid #e2e8f0;
2025-11-21 16:07:43 +05:30
}
.filter-row {
display: flex;
2025-11-26 23:07:12 +05:30
gap: 15px;
2025-11-21 16:07:43 +05:30
flex-wrap: wrap;
2026-02-27 10:51:26 +05:30
align-items: flex-end;
2025-11-21 16:07:43 +05:30
}
2025-11-26 23:07:12 +05:30
.filter-group {
display: flex;
flex-direction: column;
gap: 6px;
min-width: 180px;
flex: 1;
2025-11-21 16:07:43 +05:30
}
2025-11-26 23:07:12 +05:30
.filter-label {
font-size: 13px;
font-weight: 600;
color: #374151;
display: flex;
align-items: center;
gap: 6px;
}
.filter-label i {
color: #6b7280;
font-size: 13px;
}
.filter-control {
padding: 10px 12px;
border-radius: 8px;
border: 1.5px solid #e5e7eb;
background: #ffffff;
2026-02-27 10:51:26 +05:30
font-size: 14px;
2025-11-26 23:07:12 +05:30
color: #1f2937;
transition: all 0.3s ease;
font-family: var(--admin-font);
2025-11-26 23:07:12 +05:30
}
.filter-control:focus {
outline: none;
border-color: #4f46e5;
box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
2026-02-27 10:51:26 +05:30
/* TABLE WRAPPER */
2025-11-26 23:07:12 +05:30
.table-container {
overflow-x: auto;
border-radius: 12px;
border: 1px solid #e5e7eb;
background: white;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
margin-top: 10px;
2026-02-27 10:51:26 +05:30
-webkit-overflow-scrolling: touch;
2025-11-26 23:07:12 +05:30
}
.report-table {
2025-11-21 16:07:43 +05:30
width: 100%;
border-collapse: separate;
border-spacing: 0;
2026-02-27 10:51:26 +05:30
min-width: 1100px;
table-layout: auto;
font-size: 14px;
2025-11-21 16:07:43 +05:30
}
2025-11-26 23:07:12 +05:30
.report-table thead {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
position: sticky;
top: 0;
z-index: 10;
2025-11-21 16:07:43 +05:30
}
2025-11-26 23:07:12 +05:30
.report-table th {
2026-02-27 10:51:26 +05:30
padding: 16px 20px;
text-align: center;
font-size: 14px;
2025-11-26 23:07:12 +05:30
font-weight: 600;
2026-02-27 10:51:26 +05:30
color: #ffffff;
2025-11-21 16:07:43 +05:30
white-space: nowrap;
2025-11-26 23:07:12 +05:30
position: relative;
2026-02-27 10:51:26 +05:30
min-width: 120px;
2025-11-21 16:07:43 +05:30
}
2025-11-26 23:07:12 +05:30
.report-table td {
2026-02-27 10:51:26 +05:30
padding: 14px 20px;
font-size: 14px;
2025-11-26 23:07:12 +05:30
color: #374151;
border-bottom: 1px solid #f3f4f6;
vertical-align: middle;
2026-02-27 10:51:26 +05:30
white-space: nowrap;
2025-11-26 23:07:12 +05:30
overflow: hidden;
2026-02-27 10:51:26 +05:30
text-overflow: ellipsis;
2025-11-26 23:07:12 +05:30
min-width: 120px;
2026-02-27 10:51:26 +05:30
text-align: center;
2025-11-26 23:07:12 +05:30
}
.report-table tbody tr {
transition: all 0.3s ease;
}
.report-table tbody tr:hover {
background-color: #f8faff;
transform: translateY(-1px);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
2025-11-21 16:07:43 +05:30
.status-badge {
2025-11-26 23:07:12 +05:30
font-size: 11px !important;
font-weight: 600 !important;
padding: 6px 12px 6px 8px !important;
border-radius: 20px !important;
text-transform: uppercase;
letter-spacing: 0.3px;
display: inline-flex !important;
align-items: center;
justify-content: center;
background-size: cover !important;
background-position: center !important;
color: #fff !important;
border: 2px solid transparent !important;
min-width: 40px;
box-sizing: border-box;
gap: 6px;
position: relative;
overflow: hidden;
white-space: nowrap;
2026-02-27 10:51:26 +05:30
margin: 0 auto;
2025-11-26 23:07:12 +05:30
}
.status-paid {
background: linear-gradient(135deg, #10b981, #34d399) !important;
border-color: #059669 !important;
width: 99px;
}
.status-pending {
background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
color: #d97706 !important;
border-color: #f59e0b !important;
width: 99px;
}
.status-overdue {
background: linear-gradient(135deg, #fef2f2, #fecaca) !important;
color: #dc2626 !important;
border-color: #ef4444 !important;
width: 99px;
}
.data-highlight {
font-weight: 400;
2025-11-26 23:07:12 +05:30
color: #1a202c;
display: flex;
align-items: center;
2026-02-27 10:51:26 +05:30
justify-content: center;
2025-11-26 23:07:12 +05:30
gap: 4px;
font-size: 14px;
2025-11-26 23:07:12 +05:30
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
2026-02-27 10:51:26 +05:30
margin: 0 auto;
2025-11-26 23:07:12 +05:30
}
2025-11-21 16:07:43 +05:30
2025-11-26 23:07:12 +05:30
.empty-state {
text-align: center;
padding: 50px 20px;
color: #6b7280;
}
2025-11-21 16:07:43 +05:30
2025-11-26 23:07:12 +05:30
.empty-icon {
width: 60px;
height: 60px;
background: #f8f9fa;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 15px;
border: 2px dashed #e5e7eb;
}
2025-11-21 16:07:43 +05:30
2025-11-26 23:07:12 +05:30
.empty-icon i {
font-size: 24px;
color: #9ca3af;
}
2025-11-21 16:07:43 +05:30
2025-11-26 23:07:12 +05:30
.empty-state h3 {
font-size: 16px;
margin-bottom: 6px;
color: #4b5563;
}
2025-11-21 16:07:43 +05:30
2025-11-26 23:07:12 +05:30
.empty-state p {
font-size: 13px;
color: #6b7280;
}
2025-11-21 16:07:43 +05:30
2026-02-27 10:51:26 +05:30
/* Pagination styles (unchanged) */
2025-11-27 19:39:36 +05:30
.pagination-container {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 15px;
padding: 12px 0;
border-top: 1px solid #eef3fb;
}
.pagination-info {
font-size: 13px;
color: #9ba5bb;
font-weight: 600;
}
.pagination-controls {
display: flex;
align-items: center;
gap: 8px;
}
2026-02-27 10:51:26 +05:30
.pagination-img-btn {
2025-11-27 19:39:36 +05:30
background: #fff;
border: 1px solid #e3eaf6;
border-radius: 6px;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
align-items: center;
justify-content: center;
min-width: 40px;
height: 32px;
2026-02-27 10:51:26 +05:30
padding: 0;
2025-11-27 19:39:36 +05:30
}
2026-02-27 10:51:26 +05:30
.pagination-img-btn[disabled] {
2025-11-27 19:39:36 +05:30
background: #f8fafc;
border-color: #e2e8f0;
cursor: not-allowed;
2026-02-27 10:51:26 +05:30
opacity: 0.5;
2025-11-27 19:39:36 +05:30
}
.pagination-page-btn {
background: #fff;
border: 1px solid #e3eaf6;
color: #1a2951;
padding: 6px 12px;
border-radius: 6px;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
min-width: 36px;
text-align: center;
}
.pagination-page-btn.active {
background: #1a2951;
2026-02-27 10:51:26 +05:30
color: #fff;
2025-11-27 19:39:36 +05:30
border-color: #1a2951;
}
.pagination-pages {
display: flex;
gap: 4px;
align-items: center;
}
.pagination-ellipsis {
color: #9ba5bb;
font-size: 13px;
padding: 0 4px;
}
2025-11-26 23:07:12 +05:30
@media (max-width: 768px) {
.report-container {
padding: 15px;
}
.report-table {
2026-02-27 10:51:26 +05:30
min-width: 1100px;
2025-11-26 23:07:12 +05:30
}
}
</style>
<div class="report-container">
<!-- HEADER SECTION -->
<div class="report-header">
<div class="header-icon">
<i class="fas fa-shipping-fast"></i>
</div>
<div class="header-text">
<h1 class="report-title">Shipping Report List</h1>
2026-02-27 10:51:26 +05:30
<p class="report-subtitle">Container-wise invoices overview (Order & Shipment removed)</p>
2025-11-26 23:07:12 +05:30
</div>
2025-11-21 16:07:43 +05:30
</div>
2026-02-27 10:51:26 +05:30
<!-- STATS CARDS (Invoice focused) -->
2025-11-26 23:07:12 +05:30
<div class="stats-container">
<div class="stat-card info">
<div class="stat-icon">
2026-02-27 10:51:26 +05:30
<i class="fas fa-file-invoice"></i>
2025-11-26 23:07:12 +05:30
</div>
<div class="stat-content">
2026-02-27 10:51:26 +05:30
<div class="stat-value" id="totalInvoices">{{ count($reports) }}</div>
<div class="stat-label">Total Invoices</div>
</div>
2025-11-26 23:07:12 +05:30
</div>
2026-02-27 10:51:26 +05:30
<div class="stat-card success">
2025-11-26 23:07:12 +05:30
<div class="stat-icon">
2026-02-27 10:51:26 +05:30
<i class="fas fa-check-circle"></i>
2025-11-26 23:07:12 +05:30
</div>
<div class="stat-content">
2026-02-27 10:51:26 +05:30
<div class="stat-value" id="paidInvoices">0</div>
<div class="stat-label">Paid Invoices</div>
</div>
2025-11-26 23:07:12 +05:30
</div>
2026-02-27 10:51:26 +05:30
<div class="stat-card warning">
2025-11-26 23:07:12 +05:30
<div class="stat-icon">
2026-02-27 10:51:26 +05:30
<i class="fas fa-clock"></i>
2025-11-26 23:07:12 +05:30
</div>
<div class="stat-content">
2026-02-27 10:51:26 +05:30
<div class="stat-value" id="pendingInvoices">0</div>
<div class="stat-label">Pending Invoices</div>
</div>
2025-11-26 23:07:12 +05:30
</div>
2026-02-27 10:51:26 +05:30
2025-11-26 23:07:12 +05:30
<div class="stat-card danger">
<div class="stat-icon">
<i class="fas fa-exclamation-triangle"></i>
</div>
<div class="stat-content">
<div class="stat-value" id="overdueInvoices">0</div>
<div class="stat-label">Overdue Invoices</div>
</div>
2025-11-26 23:07:12 +05:30
</div>
</div>
2025-11-21 16:07:43 +05:30
2026-02-27 10:51:26 +05:30
<!-- FILTER SECTION (basic: From, To, Company) -->
2025-11-26 23:07:12 +05:30
<div class="filter-section">
<div class="filter-row">
<div class="filter-group">
<label class="filter-label">
2026-02-27 10:51:26 +05:30
<i class="fas fa-calendar-alt"></i> From Date
2025-11-26 23:07:12 +05:30
</label>
<input type="date" class="filter-control" id="fromDate">
</div>
2026-02-27 10:51:26 +05:30
2025-11-26 23:07:12 +05:30
<div class="filter-group">
<label class="filter-label">
2026-02-27 10:51:26 +05:30
<i class="fas fa-calendar-check"></i> To Date
2025-11-26 23:07:12 +05:30
</label>
<input type="date" class="filter-control" id="toDate">
</div>
2026-02-27 10:51:26 +05:30
2025-11-26 23:07:12 +05:30
<div class="filter-group">
<label class="filter-label">
2026-02-27 10:51:26 +05:30
<i class="fas fa-building"></i> Company
2025-11-26 23:07:12 +05:30
</label>
<select class="filter-control" id="companyFilter">
2026-02-27 10:51:26 +05:30
<option value="">All Companies</option>
{{-- company_name JS मधून भरू --}}
2025-11-26 23:07:12 +05:30
</select>
</div>
</div>
</div>
2026-02-27 10:51:26 +05:30
2025-11-26 23:07:12 +05:30
<!-- TABLE SECTION -->
<div class="table-container">
<table class="report-table">
<thead>
2026-02-27 10:51:26 +05:30
<tr>
<th>Container No</th>
<th>Container Date</th>
<th>Company Name</th>
<th>Customer Name</th>
2026-03-09 10:24:44 +05:30
{{-- <th>Mark No</th> --}}
2026-02-27 10:51:26 +05:30
<th>Invoice No</th>
<th>Invoice Date</th>
<th>Invoice Amount</th>
<th>Invoice Status</th>
</tr>
2025-11-26 23:07:12 +05:30
</thead>
<tbody id="reportTableBody">
2026-02-27 10:51:26 +05:30
@forelse ($reports as $r)
<tr
data-invoice-status="{{ strtolower($r->invoicestatus ?? '') }}"
data-company="{{ $r->company_name ?? '' }}"
data-date="{{ $r->invoice_date }}"
>
<td>
<span class="data-highlight" title="{{ $r->container_number }}">
{{ $r->container_number }}
</span>
</td>
<td>
{{ $r->container_date ? \Carbon\Carbon::parse($r->container_date)->format('d-m-Y') : '-' }}
</td>
<td>
<span class="data-highlight" title="{{ $r->company_name }}">
{{ $r->company_name ?? '-' }}
</span>
</td>
<td>
<span class="data-highlight" title="{{ $r->customer_name }}">
{{ $r->customer_name ?? '-' }}
</span>
</td>
2026-03-09 10:24:44 +05:30
{{-- <td>
2026-02-27 10:51:26 +05:30
<span class="data-highlight" title="{{ $r->mark_no }}">
{{ $r->mark_no ?? '-' }}
</span>
2026-03-09 10:24:44 +05:30
</td> --}}
2026-02-27 10:51:26 +05:30
<td>
<span class="data-highlight" title="{{ $r->invoice_number }}">
{{ $r->invoice_number }}
</span>
</td>
<td>
{{ $r->invoice_date ? \Carbon\Carbon::parse($r->invoice_date)->format('d-m-Y') : '-' }}
</td>
<td>
<span class="data-highlight" title="{{ number_format($r->final_amount, 2) }}">
{{ number_format($r->final_amount, 2) }}
</span>
</td>
<td>
@php $ist = strtolower($r->invoicestatus ?? ''); @endphp
<span class="status-badge
@if($ist === 'paid') status-paid
@elseif($ist === 'pending') status-pending
@elseif($ist === 'overdue') status-overdue
@endif">
{{ $ist ? ucfirst($ist) : '-' }}
</span>
</td>
</tr>
@empty
<tr>
2026-03-09 10:24:44 +05:30
<td colspan="8">
2026-02-27 10:51:26 +05:30
<div class="empty-state">
<div class="empty-icon">
<i class="fas fa-inbox"></i>
2025-11-26 23:07:12 +05:30
</div>
2026-02-27 10:51:26 +05:30
<h3>No Shipping Reports Found</h3>
<p>There are no shipping reports matching your current filters</p>
</div>
</td>
</tr>
@endforelse
2025-11-26 23:07:12 +05:30
</tbody>
</table>
</div>
2025-11-27 19:39:36 +05:30
<!-- Pagination Controls -->
<div class="pagination-container">
2026-02-27 10:51:26 +05:30
<div class="pagination-info" id="pageInfo">
Showing 1 to {{ min(10, count($reports)) }} of {{ count($reports) }} entries
</div>
2025-11-27 19:39:36 +05:30
<div class="pagination-controls">
<button class="pagination-img-btn" id="prevPageBtn" title="Previous page" disabled>
2026-02-27 10:51:26 +05:30
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M10 12L6 8L10 4" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round"/>
2025-11-27 19:39:36 +05:30
</svg>
</button>
<div class="pagination-pages" id="paginationPages">
2026-02-27 10:51:26 +05:30
<!-- Page numbers via JS -->
2025-11-27 19:39:36 +05:30
</div>
2026-02-27 10:51:26 +05:30
<button class="pagination-img-btn" id="nextPageBtn" title="Next page"
{{ count($reports) <= 10 ? 'disabled' : '' }}>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M6 4L10 8L6 12" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round"/>
2025-11-27 19:39:36 +05:30
</svg>
</button>
</div>
</div>
2025-11-06 17:09:52 +05:30
</div>
2026-02-27 10:51:26 +05:30
{{-- ======================= OLD ORDER + SHIPMENT TABLE (FULLY COMMENTED) =======================
इथे तुझा जुना <table> / JS ठेवू शकतोस backup साठी.
--}}
2025-11-26 23:07:12 +05:30
<script>
2026-02-27 10:51:26 +05:30
// ===== BASIC JS STATE =====
2025-11-27 19:39:36 +05:30
let currentPage = 1;
const itemsPerPage = 10;
let allReports = @json($reports);
let filteredReports = [...allReports];
2026-02-27 10:51:26 +05:30
document.addEventListener('DOMContentLoaded', function () {
populateCompanyFilter(allReports);
const fd = document.getElementById('fromDate');
const td = document.getElementById('toDate');
const cf = document.getElementById('companyFilter');
2026-02-27 10:51:26 +05:30
if (fd) fd.addEventListener('change', filterTable);
if (td) td.addEventListener('change', filterTable);
if (cf) cf.addEventListener('change', filterTable);
2025-11-26 23:07:12 +05:30
const prevBtn = document.getElementById('prevPageBtn');
const nextBtn = document.getElementById('nextPageBtn');
2026-02-27 10:51:26 +05:30
if (prevBtn) prevBtn.addEventListener('click', goToPreviousPage);
if (nextBtn) nextBtn.addEventListener('click', goToNextPage);
2025-11-26 23:07:12 +05:30
2026-02-27 10:51:26 +05:30
filterTable();
});
2025-11-26 23:07:12 +05:30
2026-02-27 10:51:26 +05:30
function populateCompanyFilter(reports) {
const companySelect = document.getElementById('companyFilter');
if (!companySelect) return;
2025-11-27 19:39:36 +05:30
2026-02-27 10:51:26 +05:30
const companies = new Set();
reports.forEach(r => {
if (r.company_name && r.company_name.trim() !== '') {
companies.add(r.company_name.trim());
2025-11-27 19:39:36 +05:30
}
2026-02-27 10:51:26 +05:30
});
2025-11-27 19:39:36 +05:30
2026-02-27 10:51:26 +05:30
const sorted = Array.from(companies).sort();
companySelect.innerHTML = '<option value="">All Companies</option>';
sorted.forEach(c => {
const opt = document.createElement('option');
opt.value = c;
opt.textContent = c;
companySelect.appendChild(opt);
});
}
2026-02-27 10:51:26 +05:30
function goToPreviousPage() {
if (currentPage === 1) return;
currentPage--;
renderTable();
updatePaginationControls();
updateStatistics();
}
2026-02-27 10:51:26 +05:30
function goToNextPage() {
const totalPages = Math.ceil(filteredReports.length / itemsPerPage);
if (currentPage >= totalPages) return;
currentPage++;
renderTable();
updatePaginationControls();
updateStatistics();
}
2026-02-27 10:51:26 +05:30
function updatePaginationControls() {
const totalPages = Math.ceil(filteredReports.length / itemsPerPage);
const prevBtn = document.getElementById('prevPageBtn');
const nextBtn = document.getElementById('nextPageBtn');
const pageInfo = document.getElementById('pageInfo');
const paginationPages = document.getElementById('paginationPages');
if (prevBtn) prevBtn.disabled = currentPage === 1 || totalPages === 0;
if (nextBtn) nextBtn.disabled = currentPage === totalPages || totalPages === 0;
2026-02-27 10:51:26 +05:30
const startIndex = (currentPage - 1) * itemsPerPage + 1;
const endIndex = Math.min(currentPage * itemsPerPage, filteredReports.length);
2026-02-27 10:51:26 +05:30
if (pageInfo) {
if (totalPages === 0) {
pageInfo.textContent = 'Showing 0 to 0 of 0 entries';
} else {
pageInfo.textContent = `Showing ${startIndex} to ${endIndex} of ${filteredReports.length} entries`;
2025-11-27 19:39:36 +05:30
}
}
2026-02-27 10:51:26 +05:30
if (!paginationPages) return;
paginationPages.innerHTML = '';
if (totalPages <= 1) return;
for (let i = 1; i <= totalPages; i++) {
const btn = document.createElement('button');
btn.className = 'pagination-page-btn';
if (i === currentPage) btn.classList.add('active');
btn.textContent = i;
btn.addEventListener('click', function () {
currentPage = i;
2025-11-27 19:39:36 +05:30
renderTable();
updatePaginationControls();
2026-02-27 10:51:26 +05:30
updateStatistics();
2025-11-27 19:39:36 +05:30
});
2026-02-27 10:51:26 +05:30
paginationPages.appendChild(btn);
2025-11-27 19:39:36 +05:30
}
2026-02-27 10:51:26 +05:30
}
2025-11-27 19:39:36 +05:30
2026-02-27 10:51:26 +05:30
function renderTable() {
const tbody = document.getElementById('reportTableBody');
if (!tbody) return;
2026-02-27 10:51:26 +05:30
tbody.innerHTML = '';
if (filteredReports.length === 0) {
tbody.innerHTML = `
<tr>
2026-03-09 10:24:44 +05:30
<td colspan="8">
2026-02-27 10:51:26 +05:30
<div class="empty-state">
<div class="empty-icon">
<i class="fas fa-inbox"></i>
</div>
<h3>No Shipping Reports Found</h3>
<p>There are no shipping reports matching your current filters</p>
</div>
2025-11-27 19:39:36 +05:30
</td>
2026-02-27 10:51:26 +05:30
</tr>`;
return;
}
const startIndex = (currentPage - 1) * itemsPerPage;
const endIndex = startIndex + itemsPerPage;
const paginatedItems = filteredReports.slice(startIndex, endIndex);
paginatedItems.forEach(report => {
const ist = (report.invoicestatus || '').toLowerCase();
const tr = document.createElement('tr');
tr.setAttribute('data-invoice-status', ist);
tr.setAttribute('data-company', report.company_name || '');
tr.setAttribute('data-date', report.invoice_date || '');
tr.innerHTML = `
<td>
<span class="data-highlight" title="${report.container_number || ''}">
${report.container_number || '-'}
</span>
</td>
<td>
${report.container_date ? new Date(report.container_date).toLocaleDateString('en-GB') : '-'}
</td>
<td>
<span class="data-highlight" title="${report.company_name || ''}">
${report.company_name || '-'}
</span>
</td>
<td>
<span class="data-highlight" title="${report.customer_name || ''}">
${report.customer_name || '-'}
</span>
</td>
2026-03-09 10:24:44 +05:30
<!-- <td>
2026-02-27 10:51:26 +05:30
<span class="data-highlight" title="${report.mark_no || ''}">
${report.mark_no || '-'}
</span>
2026-03-09 10:24:44 +05:30
</td> -->
2026-02-27 10:51:26 +05:30
<td>
<span class="data-highlight" title="${report.invoice_number || ''}">
${report.invoice_number || '-'}
</span>
</td>
<td>
${report.invoice_date ? new Date(report.invoice_date).toLocaleDateString('en-GB') : '-'}
</td>
<td>
<span class="data-highlight" title="${Number(report.final_amount || 0).toLocaleString('en-IN', {minimumFractionDigits: 2})}">
${Number(report.final_amount || 0).toLocaleString('en-IN', {minimumFractionDigits: 2})}
</span>
</td>
<td>
<span class="status-badge ${
ist === 'paid' ? 'status-paid' :
ist === 'overdue' ? 'status-overdue' : 'status-pending'
}">
${ist ? ist.charAt(0).toUpperCase() + ist.slice(1) : '-'}
</span>
</td>
`;
tbody.appendChild(tr);
});
}
2025-11-27 19:39:36 +05:30
2026-02-27 10:51:26 +05:30
function filterTable() {
const fromDate = document.getElementById('fromDate')?.value;
const toDate = document.getElementById('toDate')?.value;
const companyFilter = document.getElementById('companyFilter')?.value;
2025-11-26 23:07:12 +05:30
2026-02-27 10:51:26 +05:30
filteredReports = allReports.filter(report => {
let include = true;
2025-11-26 23:07:12 +05:30
2026-02-27 10:51:26 +05:30
if (fromDate && toDate && report.invoice_date) {
const repDate = new Date(report.invoice_date);
const from = new Date(fromDate);
const to = new Date(toDate);
to.setHours(23, 59, 59, 999);
if (repDate < from || repDate > to) include = false;
}
2026-02-27 10:51:26 +05:30
if (companyFilter && report.company_name !== companyFilter) {
include = false;
}
2025-11-26 23:07:12 +05:30
2026-02-27 10:51:26 +05:30
return include;
});
2026-02-27 10:51:26 +05:30
currentPage = 1;
renderTable();
updatePaginationControls();
updateStatistics();
}
2026-02-27 10:51:26 +05:30
function updateStatistics() {
const rows = document.querySelectorAll('#reportTableBody tr');
let total = 0, paid = 0, pending = 0, overdue = 0;
2026-02-27 10:51:26 +05:30
rows.forEach(row => {
const empty = row.querySelector('.empty-state');
if (empty) return;
2026-02-27 10:51:26 +05:30
total++;
const status = (row.getAttribute('data-invoice-status') || '').toLowerCase();
if (status === 'paid') paid++;
else if (status === 'overdue') overdue++;
else if (status === 'pending') pending++;
});
2026-02-27 10:51:26 +05:30
const elTotal = document.getElementById('totalInvoices');
const elPaid = document.getElementById('paidInvoices');
const elPending = document.getElementById('pendingInvoices');
const elOverdue = document.getElementById('overdueInvoices');
2026-02-27 10:51:26 +05:30
if (elTotal) elTotal.textContent = total;
if (elPaid) elPaid.textContent = paid;
if (elPending) elPending.textContent = pending;
if (elOverdue) elOverdue.textContent = overdue;
}
2025-11-26 23:07:12 +05:30
</script>
2026-02-27 10:51:26 +05:30
@endsection