644 lines
20 KiB
PHP
644 lines
20 KiB
PHP
@extends('admin.layouts.app')
|
|
|
|
@section('page-title', 'Mark List')
|
|
|
|
@section('content')
|
|
<div class="card shadow-sm rounded-4 border-0 animate-card">
|
|
<div class="card-body">
|
|
<h4 class="mb-3 fw-bold text-dark">Mark List Management</h4>
|
|
|
|
<style>
|
|
/* ✨ Attractive Interactive Design without color change */
|
|
.animate-card {
|
|
animation: fadeInUp 0.8s ease;
|
|
}
|
|
|
|
@keyframes fadeInUp {
|
|
0% {
|
|
transform: translateY(20px);
|
|
opacity: 0;
|
|
}
|
|
100% {
|
|
transform: translateY(0);
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
.thead-orange th {
|
|
background-color: #fde4b3 !important;
|
|
font-weight: 600;
|
|
text-align: left;
|
|
padding: 10px 14px !important;
|
|
border-bottom: 2px solid #f3d38b;
|
|
color: #222;
|
|
vertical-align: middle;
|
|
transition: all 0.3s ease-in-out;
|
|
}
|
|
|
|
.thead-orange th:hover {
|
|
background-color: #ffe6a8 !important;
|
|
transform: translateY(-2px);
|
|
}
|
|
|
|
.card {
|
|
border-radius: 1rem;
|
|
overflow: hidden;
|
|
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1) !important;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.card:hover {
|
|
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
|
|
transform: scale(1.01);
|
|
}
|
|
|
|
.table {
|
|
background: #fff;
|
|
border-radius: 1rem;
|
|
overflow: hidden;
|
|
font-size: 0.95rem;
|
|
}
|
|
|
|
.table-hover tbody tr {
|
|
transition: all 0.25s ease;
|
|
}
|
|
|
|
.table-hover tbody tr:hover {
|
|
background-color: #fff9e6 !important;
|
|
cursor: pointer;
|
|
transform: scale(1.005);
|
|
}
|
|
|
|
.table-bordered td, .table-bordered th {
|
|
border: 1px solid #eaeaea !important;
|
|
}
|
|
|
|
.table tbody td {
|
|
padding: 12px 18px !important;
|
|
color: #414a58;
|
|
vertical-align: middle;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
/* ✨ NEW BADGE STYLES - Same as Invoice System */
|
|
.badge {
|
|
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;
|
|
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
|
|
border: 2px solid transparent !important;
|
|
min-width: 40px;
|
|
box-sizing: border-box;
|
|
line-height: 1.2;
|
|
gap: 6px;
|
|
}
|
|
|
|
/* Status icons */
|
|
.status-icon {
|
|
font-size: 12px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
/* Custom status badge backgrounds with icons */
|
|
.badge-active {
|
|
background: url('/images/status-bg-paid.png') !important;
|
|
}
|
|
|
|
.badge-inactive {
|
|
background: url('/images/status-bg-overdue.png') !important;
|
|
}
|
|
|
|
/* Fallback colors if images don't load - ALL WITH SAME SIZE */
|
|
.badge.badge-active {
|
|
background: linear-gradient(135deg, #d1fae5, #a7f3d0) !important;
|
|
color: #065f46 !important;
|
|
border-color: #10b981 !important;
|
|
width: 98px;
|
|
}
|
|
|
|
.badge.badge-inactive {
|
|
background: linear-gradient(135deg, #e9d5ff, #c4b5fd) !important;
|
|
color: #6b21a8 !important;
|
|
border-color: #8b5cf6 !important;
|
|
}
|
|
|
|
/* Animation effects for badges */
|
|
.badge.badge-active {
|
|
animation: pulseGreen 2s infinite;
|
|
}
|
|
|
|
.badge.badge-inactive {
|
|
animation: pulseRed 2s infinite;
|
|
}
|
|
|
|
@keyframes pulseGreen {
|
|
0% { box-shadow: 0 0 8px #6ee86e77; }
|
|
50% { box-shadow: 0 0 14px #5dd75d88; }
|
|
100% { box-shadow: 0 0 8px #6ee86e77; }
|
|
}
|
|
|
|
@keyframes pulseRed {
|
|
0% { box-shadow: 0 0 8px #f97f7f77; }
|
|
50% { box-shadow: 0 0 14px #ff868677; }
|
|
100% { box-shadow: 0 0 8px #f97f7f77; }
|
|
}
|
|
|
|
/* ✨ ENHANCED ACTION BUTTONS - Professional & Attractive */
|
|
.btn-action {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
border: none;
|
|
color: white;
|
|
padding: 10px 22px;
|
|
font-size: 0.85rem;
|
|
border-radius: 12px;
|
|
font-weight: 600;
|
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
margin: 3px;
|
|
cursor: pointer;
|
|
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
text-decoration: none;
|
|
min-width: 120px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.btn-action::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: -100%;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
|
|
transition: left 0.5s;
|
|
}
|
|
|
|
.btn-action:hover::before {
|
|
left: 100%;
|
|
}
|
|
|
|
.btn-action:hover {
|
|
transform: translateY(-3px);
|
|
box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
|
|
color: white;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.btn-action:active {
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
|
|
}
|
|
|
|
/* Specific styles for Activate button */
|
|
.btn-action-activate {
|
|
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
|
|
box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
|
|
}
|
|
|
|
.btn-action-activate:hover {
|
|
box-shadow: 0 8px 25px rgba(79, 172, 254, 0.5);
|
|
}
|
|
|
|
/* Specific styles for Deactivate button */
|
|
.btn-action-deactivate {
|
|
background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
|
|
box-shadow: 0 4px 15px rgba(250, 112, 154, 0.3);
|
|
}
|
|
|
|
.btn-action-deactivate:hover {
|
|
box-shadow: 0 8px 25px rgba(250, 112, 154, 0.5);
|
|
}
|
|
|
|
/* Button icons */
|
|
.btn-icon {
|
|
font-size: 14px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.text-muted {
|
|
color: #888 !important;
|
|
font-style: italic;
|
|
}
|
|
|
|
.search-container {
|
|
position: relative;
|
|
max-width: 380px;
|
|
margin-bottom: 28px;
|
|
}
|
|
|
|
.search-container input {
|
|
width: 100%;
|
|
padding: 10px 14px 10px 40px;
|
|
border-radius: 99px;
|
|
border: 1.8px solid #d8d2bb;
|
|
font-size: 1rem;
|
|
box-shadow: 0 2px 7px #d2cabf96 inset;
|
|
transition: all 0.25s ease;
|
|
}
|
|
|
|
.search-container input:focus {
|
|
border-color: #7d6a05;
|
|
outline: none;
|
|
box-shadow: 0 0 11px #b4a024dd inset;
|
|
transform: scale(1.02);
|
|
}
|
|
|
|
.search-icon {
|
|
position: absolute;
|
|
left: 14px;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
font-size: 21px;
|
|
color: #a09c82;
|
|
pointer-events: none;
|
|
}
|
|
|
|
/* subtle fade for search input */
|
|
@keyframes fadeGlow {
|
|
from { box-shadow: 0 0 0px #b4a02455 inset; }
|
|
to { box-shadow: 0 0 10px #b4a024aa inset; }
|
|
}
|
|
|
|
/* ---------- Pagination Styles ---------- */
|
|
.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;
|
|
}
|
|
|
|
.pagination-btn {
|
|
background: #fff;
|
|
border: 1px solid #e3eaf6;
|
|
color: #1a2951;
|
|
padding: 8px 12px;
|
|
border-radius: 6px;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-width: 40px;
|
|
height: 32px;
|
|
}
|
|
|
|
.pagination-btn:hover:not(:disabled) {
|
|
background: #1a2951;
|
|
color: white;
|
|
border-color: #1a2951;
|
|
}
|
|
|
|
.pagination-btn:disabled {
|
|
background: #f8fafc;
|
|
color: #cbd5e0;
|
|
border-color: #e2e8f0;
|
|
cursor: not-allowed;
|
|
opacity: 0.6;
|
|
}
|
|
|
|
.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:hover {
|
|
background: #1a2951;
|
|
color: white;
|
|
border-color: #1a2951;
|
|
}
|
|
|
|
.pagination-page-btn.active {
|
|
background: #1a2951;
|
|
color: white;
|
|
border-color: #1a2951;
|
|
}
|
|
|
|
.pagination-pages {
|
|
display: flex;
|
|
gap: 4px;
|
|
align-items: center;
|
|
}
|
|
|
|
.pagination-ellipsis {
|
|
color: #9ba5bb;
|
|
font-size: 13px;
|
|
padding: 0 4px;
|
|
}
|
|
|
|
/* Image-based pagination buttons */
|
|
.pagination-img-btn {
|
|
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;
|
|
padding: 0;
|
|
}
|
|
|
|
.pagination-img-btn:hover:not(:disabled) {
|
|
background: #1a2951;
|
|
border-color: #1a2951;
|
|
}
|
|
|
|
.pagination-img-btn:disabled {
|
|
background: #f8fafc;
|
|
border-color: #e2e8f0;
|
|
cursor: not-allowed;
|
|
opacity: 0.5;
|
|
}
|
|
|
|
.pagination-img-btn img {
|
|
width: 16px;
|
|
height: 16px;
|
|
filter: brightness(0) saturate(100%) invert(26%) sepia(89%) saturate(748%) hue-rotate(201deg) brightness(93%) contrast(89%);
|
|
transition: filter 0.3s ease;
|
|
}
|
|
|
|
.pagination-img-btn:hover:not(:disabled) img {
|
|
filter: brightness(0) saturate(100%) invert(100%) sepia(100%) saturate(0%) hue-rotate(288deg) brightness(106%) contrast(101%);
|
|
}
|
|
|
|
.pagination-img-btn:disabled img {
|
|
filter: brightness(0) saturate(100%) invert(84%) sepia(8%) saturate(165%) hue-rotate(179deg) brightness(89%) contrast(86%);
|
|
}
|
|
</style>
|
|
|
|
@if(session('success'))
|
|
<div class="alert alert-success rounded-3 shadow-sm">{{ session('success') }}</div>
|
|
@endif
|
|
|
|
<div class="search-container">
|
|
<input type="text" id="globalSearch" placeholder="Search in all fields..." />
|
|
<span class="search-icon">🔍</span>
|
|
</div>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered table-hover align-middle" id="markListTable">
|
|
<thead class="thead-orange">
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Mark No/Item No</th>
|
|
<th>Origin</th>
|
|
<th>Destination</th>
|
|
<th>Customer Name</th>
|
|
<th>Customer Id</th>
|
|
<th>Customer No</th>
|
|
<th>Date</th>
|
|
<th>Status</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="markListTableBody">
|
|
<!-- Data will be loaded dynamically -->
|
|
</tbody>
|
|
</table>
|
|
|
|
<!-- Pagination Controls -->
|
|
<div class="pagination-container">
|
|
<div class="pagination-info" id="pageInfo">Showing 0 entries</div>
|
|
<div class="pagination-controls">
|
|
<button class="pagination-img-btn" id="prevPageBtn" title="Previous page" disabled>
|
|
<!-- Left arrow SVG -->
|
|
<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"/>
|
|
</svg>
|
|
</button>
|
|
<div class="pagination-pages" id="paginationPages">
|
|
<!-- Page numbers will be inserted here -->
|
|
</div>
|
|
<button class="pagination-img-btn" id="nextPageBtn" title="Next page" disabled>
|
|
<!-- Right arrow SVG -->
|
|
<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"/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="noResults" class="py-4 text-center text-muted fst-italic" style="display: none;">No mark numbers found.</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Pagination state
|
|
let currentPage = 1;
|
|
const itemsPerPage = 10;
|
|
let allMarkList = @json($markList);
|
|
let filteredMarkList = [...allMarkList];
|
|
|
|
// Initialize pagination
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
renderTable();
|
|
updatePaginationControls();
|
|
|
|
// Bind pagination events
|
|
document.getElementById('prevPageBtn').addEventListener('click', goToPreviousPage);
|
|
document.getElementById('nextPageBtn').addEventListener('click', goToNextPage);
|
|
|
|
// Bind search event
|
|
document.getElementById('globalSearch').addEventListener('input', handleSearch);
|
|
});
|
|
|
|
// Pagination Functions
|
|
function goToPreviousPage() {
|
|
if (currentPage > 1) {
|
|
currentPage--;
|
|
renderTable();
|
|
updatePaginationControls();
|
|
}
|
|
}
|
|
|
|
function goToNextPage() {
|
|
const totalPages = Math.ceil(filteredMarkList.length / itemsPerPage);
|
|
if (currentPage < totalPages) {
|
|
currentPage++;
|
|
renderTable();
|
|
updatePaginationControls();
|
|
}
|
|
}
|
|
|
|
function updatePaginationControls() {
|
|
const totalPages = Math.ceil(filteredMarkList.length / itemsPerPage);
|
|
const prevBtn = document.getElementById('prevPageBtn');
|
|
const nextBtn = document.getElementById('nextPageBtn');
|
|
const pageInfo = document.getElementById('pageInfo');
|
|
const paginationPages = document.getElementById('paginationPages');
|
|
|
|
prevBtn.disabled = currentPage === 1;
|
|
nextBtn.disabled = currentPage === totalPages || totalPages === 0;
|
|
|
|
// Update page info text
|
|
const startIndex = (currentPage - 1) * itemsPerPage + 1;
|
|
const endIndex = Math.min(currentPage * itemsPerPage, filteredMarkList.length);
|
|
pageInfo.textContent = `Showing ${startIndex} to ${endIndex} of ${filteredMarkList.length} entries`;
|
|
|
|
// Generate page numbers
|
|
paginationPages.innerHTML = '';
|
|
|
|
if (totalPages <= 7) {
|
|
// Show all pages
|
|
for (let i = 1; i <= totalPages; i++) {
|
|
addPageButton(i, paginationPages);
|
|
}
|
|
} else {
|
|
// Show first page, current page range, and last page
|
|
addPageButton(1, paginationPages);
|
|
|
|
if (currentPage > 3) {
|
|
paginationPages.innerHTML += '<span class="pagination-ellipsis">...</span>';
|
|
}
|
|
|
|
const start = Math.max(2, currentPage - 1);
|
|
const end = Math.min(totalPages - 1, currentPage + 1);
|
|
|
|
for (let i = start; i <= end; i++) {
|
|
addPageButton(i, paginationPages);
|
|
}
|
|
|
|
if (currentPage < totalPages - 2) {
|
|
paginationPages.innerHTML += '<span class="pagination-ellipsis">...</span>';
|
|
}
|
|
|
|
addPageButton(totalPages, paginationPages);
|
|
}
|
|
}
|
|
|
|
function addPageButton(pageNumber, container) {
|
|
const button = document.createElement('button');
|
|
button.className = 'pagination-page-btn';
|
|
if (pageNumber === currentPage) {
|
|
button.classList.add('active');
|
|
}
|
|
button.textContent = pageNumber;
|
|
button.addEventListener('click', () => {
|
|
currentPage = pageNumber;
|
|
renderTable();
|
|
updatePaginationControls();
|
|
});
|
|
container.appendChild(button);
|
|
}
|
|
|
|
// Search Function
|
|
function handleSearch() {
|
|
const filter = this.value.toLowerCase();
|
|
filteredMarkList = allMarkList.filter(mark => {
|
|
return Object.values(mark).some(value =>
|
|
String(value).toLowerCase().includes(filter)
|
|
);
|
|
});
|
|
|
|
currentPage = 1;
|
|
renderTable();
|
|
updatePaginationControls();
|
|
}
|
|
|
|
// Render Table Function - FIXED: Using direct URL construction
|
|
function renderTable() {
|
|
const tbody = document.getElementById('markListTableBody');
|
|
const noResults = document.getElementById('noResults');
|
|
tbody.innerHTML = '';
|
|
|
|
if (filteredMarkList.length === 0) {
|
|
tbody.innerHTML = '';
|
|
noResults.style.display = 'block';
|
|
return;
|
|
}
|
|
|
|
noResults.style.display = 'none';
|
|
|
|
// Calculate pagination
|
|
const startIndex = (currentPage - 1) * itemsPerPage;
|
|
const endIndex = startIndex + itemsPerPage;
|
|
const paginatedItems = filteredMarkList.slice(startIndex, endIndex);
|
|
|
|
paginatedItems.forEach(mark => {
|
|
const row = document.createElement('tr');
|
|
row.innerHTML = `
|
|
<td>${mark.id}</td>
|
|
<td>${mark.mark_no}</td>
|
|
<td>${mark.origin}</td>
|
|
<td>${mark.destination}</td>
|
|
<td>${mark.customer_name}</td>
|
|
<td>${mark.customer_id}</td>
|
|
<td>${mark.mobile_no}</td>
|
|
<td>${new Date(mark.date).toLocaleDateString('en-GB')}</td>
|
|
<td>
|
|
${mark.status == 'active'
|
|
? `<span class="badge badge-active">
|
|
<i class="bi bi-check-circle-fill status-icon"></i>
|
|
Active
|
|
</span>`
|
|
: `<span class="badge badge-inactive">
|
|
<i class="bi bi-exclamation-triangle-fill status-icon"></i>
|
|
In-Active
|
|
</span>`
|
|
}
|
|
</td>
|
|
<td>
|
|
${mark.status == 'active'
|
|
? `<a href="/admin/mark-list/status/${mark.id}" class="btn-action btn-action-deactivate">
|
|
<i class="bi bi-power btn-icon"></i>
|
|
Deactivate
|
|
</a>`
|
|
: `<a href="/admin/mark-list/status/${mark.id}" class="btn-action btn-action-activate">
|
|
<i class="bi bi-play-circle btn-icon"></i>
|
|
Activate
|
|
</a>`
|
|
}
|
|
</td>
|
|
`;
|
|
tbody.appendChild(row);
|
|
});
|
|
}
|
|
</script>
|
|
</div>
|
|
</div>
|
|
@endsection |