diff --git a/app/Http/Controllers/Admin/AdminInvoiceController.php b/app/Http/Controllers/Admin/AdminInvoiceController.php index 19d313e..4dc58b4 100644 --- a/app/Http/Controllers/Admin/AdminInvoiceController.php +++ b/app/Http/Controllers/Admin/AdminInvoiceController.php @@ -9,6 +9,7 @@ use App\Models\InvoiceItem; use Mpdf\Mpdf; use App\Models\InvoiceInstallment; use Illuminate\Support\Facades\Log; +use Barryvdh\DomPDF\Facade\Pdf; class AdminInvoiceController extends Controller { @@ -41,9 +42,16 @@ class AdminInvoiceController extends Controller public function edit($id) { $invoice = Invoice::with(['order.shipments'])->findOrFail($id); - $shipment = $invoice->order?->shipments?->first(); + $shipment = $invoice->order?->shipments?->first(); - return view('admin.invoice_edit', compact('invoice', 'shipment')); + // ADD THIS SECTION: Calculate customer's total due across all invoices + $customerTotalDue = Invoice::where('customer_id', $invoice->customer_id) + ->where('status', '!=', 'cancelled') + ->where('status', '!=', 'void') + ->sum('final_amount_with_gst'); + + // Pass the new variable to the view + return view('admin.invoice_edit', compact('invoice', 'shipment', 'customerTotalDue')); } // ------------------------------------------------------------- @@ -145,16 +153,11 @@ class AdminInvoiceController extends Controller public function downloadInvoice($id) { - $invoice = Invoice::findOrFail($id); + $invoice = Invoice::findOrFail($id); - // Generate PDF if missing - if ( - !$invoice->pdf_path || - !file_exists(public_path($invoice->pdf_path)) - ) { - $this->generateInvoicePDF($invoice); - $invoice->refresh(); - } + // ALWAYS regenerate to reflect latest HTML/CSS + $this->generateInvoicePDF($invoice); + $invoice->refresh(); return response()->download(public_path($invoice->pdf_path)); } diff --git a/public/invoices/invoice-INV-2025-000001.pdf b/public/invoices/invoice-INV-2025-000001.pdf deleted file mode 100644 index 6e98cc4..0000000 Binary files a/public/invoices/invoice-INV-2025-000001.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000002.pdf b/public/invoices/invoice-INV-2025-000002.pdf deleted file mode 100644 index dde03a9..0000000 Binary files a/public/invoices/invoice-INV-2025-000002.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000003.pdf b/public/invoices/invoice-INV-2025-000003.pdf deleted file mode 100644 index e17839c..0000000 Binary files a/public/invoices/invoice-INV-2025-000003.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000004.pdf b/public/invoices/invoice-INV-2025-000004.pdf deleted file mode 100644 index a443c78..0000000 Binary files a/public/invoices/invoice-INV-2025-000004.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000005.pdf b/public/invoices/invoice-INV-2025-000005.pdf deleted file mode 100644 index f30024c..0000000 Binary files a/public/invoices/invoice-INV-2025-000005.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000006.pdf b/public/invoices/invoice-INV-2025-000006.pdf deleted file mode 100644 index f1d586a..0000000 Binary files a/public/invoices/invoice-INV-2025-000006.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000007.pdf b/public/invoices/invoice-INV-2025-000007.pdf deleted file mode 100644 index 4425ec2..0000000 Binary files a/public/invoices/invoice-INV-2025-000007.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000008.pdf b/public/invoices/invoice-INV-2025-000008.pdf deleted file mode 100644 index e6c8df1..0000000 Binary files a/public/invoices/invoice-INV-2025-000008.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000009.pdf b/public/invoices/invoice-INV-2025-000009.pdf deleted file mode 100644 index 362d2f4..0000000 Binary files a/public/invoices/invoice-INV-2025-000009.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000010.pdf b/public/invoices/invoice-INV-2025-000010.pdf deleted file mode 100644 index 435c32b..0000000 Binary files a/public/invoices/invoice-INV-2025-000010.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000011.pdf b/public/invoices/invoice-INV-2025-000011.pdf deleted file mode 100644 index 5c37efa..0000000 Binary files a/public/invoices/invoice-INV-2025-000011.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000012.pdf b/public/invoices/invoice-INV-2025-000012.pdf deleted file mode 100644 index 188bf50..0000000 Binary files a/public/invoices/invoice-INV-2025-000012.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000013.pdf b/public/invoices/invoice-INV-2025-000013.pdf deleted file mode 100644 index 350715c..0000000 Binary files a/public/invoices/invoice-INV-2025-000013.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000014.pdf b/public/invoices/invoice-INV-2025-000014.pdf deleted file mode 100644 index ab8e570..0000000 Binary files a/public/invoices/invoice-INV-2025-000014.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000016.pdf b/public/invoices/invoice-INV-2025-000016.pdf deleted file mode 100644 index 0a36ff8..0000000 Binary files a/public/invoices/invoice-INV-2025-000016.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000017.pdf b/public/invoices/invoice-INV-2025-000017.pdf deleted file mode 100644 index 23bd004..0000000 Binary files a/public/invoices/invoice-INV-2025-000017.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000019.pdf b/public/invoices/invoice-INV-2025-000019.pdf deleted file mode 100644 index 431b377..0000000 Binary files a/public/invoices/invoice-INV-2025-000019.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000020.pdf b/public/invoices/invoice-INV-2025-000020.pdf deleted file mode 100644 index 89c69e8..0000000 Binary files a/public/invoices/invoice-INV-2025-000020.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000022.pdf b/public/invoices/invoice-INV-2025-000022.pdf deleted file mode 100644 index 663e06a..0000000 Binary files a/public/invoices/invoice-INV-2025-000022.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000023.pdf b/public/invoices/invoice-INV-2025-000023.pdf deleted file mode 100644 index 1519813..0000000 Binary files a/public/invoices/invoice-INV-2025-000023.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000024.pdf b/public/invoices/invoice-INV-2025-000024.pdf deleted file mode 100644 index 0494642..0000000 Binary files a/public/invoices/invoice-INV-2025-000024.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000025.pdf b/public/invoices/invoice-INV-2025-000025.pdf deleted file mode 100644 index b7d7a56..0000000 Binary files a/public/invoices/invoice-INV-2025-000025.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000026.pdf b/public/invoices/invoice-INV-2025-000026.pdf deleted file mode 100644 index 619708c..0000000 Binary files a/public/invoices/invoice-INV-2025-000026.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000027.pdf b/public/invoices/invoice-INV-2025-000027.pdf deleted file mode 100644 index 67f4c00..0000000 Binary files a/public/invoices/invoice-INV-2025-000027.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000028.pdf b/public/invoices/invoice-INV-2025-000028.pdf deleted file mode 100644 index f932979..0000000 Binary files a/public/invoices/invoice-INV-2025-000028.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000029.pdf b/public/invoices/invoice-INV-2025-000029.pdf deleted file mode 100644 index 80c41f2..0000000 Binary files a/public/invoices/invoice-INV-2025-000029.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000030.pdf b/public/invoices/invoice-INV-2025-000030.pdf deleted file mode 100644 index 8eab796..0000000 Binary files a/public/invoices/invoice-INV-2025-000030.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000031.pdf b/public/invoices/invoice-INV-2025-000031.pdf deleted file mode 100644 index 87950b3..0000000 Binary files a/public/invoices/invoice-INV-2025-000031.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000032.pdf b/public/invoices/invoice-INV-2025-000032.pdf deleted file mode 100644 index c681ac0..0000000 Binary files a/public/invoices/invoice-INV-2025-000032.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000033.pdf b/public/invoices/invoice-INV-2025-000033.pdf index 12229f7..11e266b 100644 Binary files a/public/invoices/invoice-INV-2025-000033.pdf and b/public/invoices/invoice-INV-2025-000033.pdf differ diff --git a/public/invoices/invoice-INV-2025-000034.pdf b/public/invoices/invoice-INV-2025-000034.pdf deleted file mode 100644 index 2257043..0000000 Binary files a/public/invoices/invoice-INV-2025-000034.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000044.pdf b/public/invoices/invoice-INV-2025-000044.pdf deleted file mode 100644 index 63c4fa5..0000000 Binary files a/public/invoices/invoice-INV-2025-000044.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000046.pdf b/public/invoices/invoice-INV-2025-000046.pdf deleted file mode 100644 index 39c5a85..0000000 Binary files a/public/invoices/invoice-INV-2025-000046.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000048.pdf b/public/invoices/invoice-INV-2025-000048.pdf deleted file mode 100644 index 6bce3a0..0000000 Binary files a/public/invoices/invoice-INV-2025-000048.pdf and /dev/null differ diff --git a/public/invoices/invoice-INV-2025-000051.pdf b/public/invoices/invoice-INV-2025-000051.pdf deleted file mode 100644 index 82b3fa7..0000000 Binary files a/public/invoices/invoice-INV-2025-000051.pdf and /dev/null differ diff --git a/resources/views/admin/customers.blade.php b/resources/views/admin/customers.blade.php index 31db1f2..1c29b75 100644 --- a/resources/views/admin/customers.blade.php +++ b/resources/views/admin/customers.blade.php @@ -1,1018 +1,1022 @@ -@extends('admin.layouts.app') + @extends('admin.layouts.app') -@section('page-title', 'Customers') + @section('page-title', 'Customers') -@section('content') + @section('content') - - -
- -
-

Customer List

-
- - -
- -
-
- -
-
-
{{ $allCustomers->count() }}
-
Total Customers
-
-
- -
-
- -
-
-
- @php - $newThisMonth = $allCustomers->filter(function($customer) { - return $customer->created_at->format('Y-m') === now()->format('Y-m'); - })->count(); - @endphp - {{ $newThisMonth }} -
-
New This Month
-
-
+ .table tbody tr:hover { + background: rgba(102, 126, 234, 0.03); + transform: translateX(5px); + } - -
-
- -
-
-
- @php - $activeCustomers = $allCustomers->where('status', 'active')->count(); - @endphp - {{ $activeCustomers }} -
-
Active Customers
-
-
+ .customer-details { + font-size: 0.8rem; + color: #6c757d; + } - -
-
- -
-
-
- @php - $premiumCount = $allCustomers->where('customer_type', 'premium')->count(); - @endphp - {{ $premiumCount }} -
-
Premium Customers
-
-
-
+ /* Remove customer-stats since we're adding columns */ + + /* Enhanced table styling - Fixed horizontal scroll */ + .table-container { + border-radius: 10px; + overflow: hidden; + width: 100%; /* Ensure container takes full width */ + } + + /* Fix table responsiveness */ + .table-responsive { + overflow-x: auto; + -webkit-overflow-scrolling: touch; + width: 100%; + } + + /* Ensure table doesn't exceed container */ + .table { + width: 100%; + max-width: 100%; + margin-bottom: 0; + table-layout: auto; /* Changed to auto for better column distribution */ + } + + /* Fix for search and filter section */ + .search-filter-container { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: nowrap; + gap: 15px; + width: 100%; + } + + .search-section { + display: flex; + align-items: center; + flex-shrink: 0; + } + + .filter-section { + display: flex; + align-items: center; + flex-wrap: nowrap; + gap: 6px; + flex-shrink: 0; + } - -
-
- -
-
-
- - - @if(!empty($status)) - - @endif -
-
+ /* New columns styling */ + .orders-column, .total-column, .customer-id-column, .create-date-column { + text-align: center; + font-weight: 500; + min-width: 80px; /* Added minimum widths for consistency */ + } + + .orders-count { + font-size: 14px; + color: #1a202c; + font-weight: 600; + } + + .total-amount { + font-size: 14px; + color: #10b981; + font-weight: 600; + } + + /* ---------- Pagination Styles ---------- */ + .pagination-container { + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 15px; + padding: 12px 0; + border-top: 1px solid #eef3fb; + font-family: 'Inter', sans-serif; + width: 100%; + } + + .pagination-info { + font-size: 13px; + color: #9ba5bb; + font-weight: 600; + flex-shrink: 0; + } + + .pagination-controls { + display: flex; + align-items: center; + gap: 8px; + flex-wrap: wrap; + justify-content: flex-end; + } + + .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; + text-decoration: none; + display: inline-block; + } + + .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; + flex-wrap: wrap; + } + + .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%); + } + + /* Mobile responsive fixes */ + @media (max-width: 1200px) { + .table > :not(caption) > * > * { + padding: 12px 8px; + font-size: 13px; + } + + .customer-info-column { + min-width: 180px; + max-width: 180px; + } + } + + @media (max-width: 992px) { + .search-container { + width: 280px; + } + + .stats-container { + grid-template-columns: repeat(2, 1fr); + } + } + + @media (max-width: 768px) { + .stats-container { + grid-template-columns: repeat(2, 1fr); + } + + .search-filter-container { + flex-direction: column; + align-items: stretch; + gap: 10px; + } + + .search-section { + justify-content: center; + } + + .search-container { + width: 100%; + } + + .filter-section { + justify-content: center; + flex-wrap: wrap; + } + + .pagination-container { + flex-direction: column; + gap: 10px; + align-items: stretch; + } + + .pagination-controls { + justify-content: center; + } + + .table > :not(caption) > * > * { + padding: 10px 6px; + font-size: 12px; + } + + .customer-info-column { + min-width: 150px; + max-width: 150px; + } + + .customer-avatar { + width: 32px; + height: 32px; + font-size: 0.8rem; + } + + .action-btn { + width: 26px; + height: 26px; + font-size: 0.7rem; + } + } + + @media (max-width: 576px) { + .stats-container { + grid-template-columns: 1fr; + } + + .table-responsive { + font-size: 12px; + } + + .customer-info-column { + min-width: 120px; + max-width: 120px; + } + + .premium-badge, + .regular-badge, + .status-badge { + font-size: 0.6rem; + padding: 2px 6px; + } + } + + +
+ +
+

Customer List

+
+ + +
+ +
+
+ +
+
+
{{ $allCustomers->count() }}
+
Total Customers
+
- -
- - Active - - - - Inactive - - - - All - - - @can('customer.create') - - Add Customer - - @endcan + +
+
+ +
+
+
+ @php + $newThisMonth = $allCustomers->filter(function($customer) { + return $customer->created_at->format('Y-m') === now()->format('Y-m'); + })->count(); + @endphp + {{ $newThisMonth }} +
+
New This Month
+
+
+ + +
+
+ +
+
+
+ @php + $activeCustomers = $allCustomers->where('status', 'active')->count(); + @endphp + {{ $activeCustomers }} +
+
Active Customers
+
+
+ + +
+
+ +
+
+
+ @php + $premiumCount = $allCustomers->where('customer_type', 'premium')->count(); + @endphp + {{ $premiumCount }} +
+
Premium Customers
+
-
- -
-
- - - - - - - - {{-- NEW --}} - {{-- NEW --}} - - - - - + +
+
+ +
+
+
+ + + @if(!empty($status)) + + @endif +
+ +
+ + +
- @forelse($customers as $c) - @php - // Invoice total (with GST) - $totalPayable = $c->invoices->sum('final_amount_with_gst'); + + Inactive + - // Total paid via installments - $totalPaid = $c->invoices - ->flatMap(fn($inv) => $inv->installments) - ->sum('amount'); + + All + - // Remaining amount - $remainingAmount = max($totalPayable - $totalPaid, 0); - @endphp - - - + + @empty + + + + @endforelse + +
Customer InfoCustomer IDOrdersOrder TotalTotal PayableRemainingCreate DateStatusActions
-
-
- {{ strtoupper(substr($c->customer_name,0,1)) }} -
-
-
{{ $c->customer_name }}
- @if($c->customer_type == 'premium') - Premium Customer - @else - Regular Customer - @endif -
- {{ $c->email }}
- {{ $c->mobile_no }} + @can('customer.create') + + Add Customer + + @endcan +
+
+
+ + +
+
+ + + + + + + + {{-- NEW --}} + {{-- NEW --}} + + + + + + + + + @forelse($customers as $c) + @php + // Invoice total (with GST) + $totalPayable = $c->invoices->sum('final_amount_with_gst'); + + // Total paid via installments + $totalPaid = $c->invoices + ->flatMap(fn($inv) => $inv->installments) + ->sum('amount'); + + // Remaining amount + $remainingAmount = max($totalPayable - $totalPaid, 0); + @endphp + + + + - - + + - - + + - - - - - - + + + + + + + - + + + + - - + + - - - - - @empty - - - - @endforelse - -
Customer InfoCustomer IDOrdersOrder TotalTotal PayableRemainingPaid AmountCreate DateStatusActions
+
+
+ {{ strtoupper(substr($c->customer_name,0,1)) }} +
+
+
{{ $c->customer_name }}
+ @if($c->customer_type == 'premium') + Premium Customer + @else + Regular Customer + @endif +
+ {{ $c->email }}
+ {{ $c->mobile_no }} +
- -
- {{ $c->customer_id }} - + {{ $c->customer_id }} + - {{ $c->orders->count() }} - + {{ $c->orders->count() }} + - - ₹{{ number_format($c->orders->sum('ttl_amount'), 2) }} - - - - ₹{{ number_format($totalPayable, 2) }} - - - @if($remainingAmount > 0) - - ₹{{ number_format($remainingAmount, 2) }} + + + + ₹{{ number_format($c->orders->sum('ttl_amount'), 2) }} - @else - - ₹0.00 + + + ₹{{ number_format($totalPayable, 2) }} - @endif - + @if($remainingAmount > 0) + + ₹{{ number_format($remainingAmount, 2) }} + + @else + + ₹0.00 + + @endif + + + ₹{{ number_format($totalPaid, 2) }} + + + {{ $c->created_at ? $c->created_at->format('d-m-Y') : '-' }} + + @if($c->status === 'active') + Active + @else + Inactive + @endif + - {{ $c->created_at ? $c->created_at->format('d-m-Y') : '-' }} - +
+ + + - -
- @if($c->status === 'active') - Active - @else - Inactive - @endif - -
- - - - -
- @csrf - -
-
-
- - No customers found. -
-
-
- - -
-
- Showing {{ $customers->firstItem() ?? 0 }} to {{ $customers->lastItem() ?? 0 }} of {{ $customers->total() }} entries -
-
- -
- @for ($i = 1; $i <= $customers->lastPage(); $i++) - - {{ $i }} - - @endfor +
+ @csrf + +
+
+
+ + No customers found. +
+
+
+ + +
+
+ Showing {{ $customers->firstItem() ?? 0 }} to {{ $customers->lastItem() ?? 0 }} of {{ $customers->total() }} entries +
+
+ +
+ @for ($i = 1; $i <= $customers->lastPage(); $i++) + + {{ $i }} + + @endfor +
+
-
-
- - // Pagination button handlers - document.getElementById('prevPageBtn').addEventListener('click', function() { - @if(!$customers->onFirstPage()) - window.location.href = '{{ $customers->previousPageUrl() }}'; - @endif - }); - - document.getElementById('nextPageBtn').addEventListener('click', function() { - @if($customers->hasMorePages()) - window.location.href = '{{ $customers->nextPageUrl() }}'; - @endif - }); - }); - - -@endsection \ No newline at end of file + @endsection \ No newline at end of file diff --git a/resources/views/admin/customers_add.blade.php b/resources/views/admin/customers_add.blade.php index 5fad95e..c058910 100644 --- a/resources/views/admin/customers_add.blade.php +++ b/resources/views/admin/customers_add.blade.php @@ -6,48 +6,58 @@ @@ -701,7 +878,7 @@ select {
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@error('address') @@ -820,7 +997,7 @@ select {
-
+
+ Cancel + + + + + Download Invoice + +
@include('admin.popup_invoice', [ @@ -468,6 +519,89 @@ body {
+ +
+
+

+ Amount Breakdown +

+
+
+
+ @php + $totalPaid = $invoice->installments->sum('amount'); + $remaining = $invoice->final_amount_with_gst - $totalPaid; + + // Calculate GST/IGST percentage dynamically + $taxPercentage = $invoice->tax_type === 'gst' + ? ($invoice->cgst_percent + $invoice->sgst_percent) + : $invoice->igst_percent; + @endphp + +
+ Total Amount (Before Tax): + ₹{{ number_format($invoice->final_amount, 2) }} +
+ +
+ + @if($invoice->tax_type === 'gst') + GST ({{ number_format($taxPercentage, 2) }}%) + @else + IGST ({{ number_format($taxPercentage, 2) }}%) + @endif: + + ₹{{ number_format($invoice->gst_amount, 2) }} +
+ +
+ Total Invoice Amount (Including GST): + ₹{{ number_format($invoice->final_amount_with_gst, 2) }} +
+ +
+ Total Paid: + ₹{{ number_format($totalPaid, 2) }} +
+ +
+ Remaining: + ₹{{ number_format($remaining, 2) }} +
+ + +
+ + Total Amount Due (Including Tax): + + + + + ₹{{ number_format($customerTotalDue, 2) }} + +
+ + +
+ + +
+
+
₹{{ number_format($invoice->final_amount_with_gst, 2) }}
+
Total Amount
+
+ +
+
₹{{ number_format($remaining, 2) }}
+
Remaining
+
+
+
+
+
@@ -577,81 +711,6 @@ body {
- @php - $totalPaid = $invoice->installments->sum('amount'); - $remaining = $invoice->final_amount_with_gst - $totalPaid; - @endphp - - -
-
- Amount Breakdown -
- -
- Total Amount (Before Tax): - ₹{{ number_format($invoice->final_amount, 2) }} -
- -
- Tax Type: - - @if($invoice->tax_type === 'gst') - GST (CGST + SGST) - @else - IGST - @endif - -
- -
- Tax Percentage: - - @if($invoice->tax_type === 'gst') - {{ $invoice->cgst_percent + $invoice->sgst_percent }}% - @else - {{ $invoice->igst_percent }}% - @endif - -
- -
- GST Amount: - ₹{{ number_format($invoice->gst_amount, 2) }} -
- -
- Total Invoice Amount (Including GST): - ₹{{ number_format($invoice->final_amount_with_gst, 2) }} -
- -
- Total Paid: - ₹{{ number_format($totalPaid, 2) }} -
- -
- Remaining: - ₹{{ number_format($remaining, 2) }} -
-
- - -
-
-
₹{{ number_format($invoice->final_amount_with_gst, 2) }}
-
Total Amount
-
- -
-
₹{{ number_format($remaining, 2) }}
-
Remaining
-
-
-
@@ -736,6 +795,7 @@ body {
Installment History
+ @if($invoice->installments->count() > 0)
@@ -776,24 +836,87 @@ body {
+ @else +
+ No installments found. Click "Add Installment" to create one. +
+ @endif
- -
- No installments found. Click "Add Installment" to create one. -
- - - @foreach($invoice->installments as $i) - ... - @endforeach - -
- - - @endsection \ No newline at end of file diff --git a/resources/views/admin/orders_show.blade.php b/resources/views/admin/orders_show.blade.php index e7ca23f..ca2b532 100644 --- a/resources/views/admin/orders_show.blade.php +++ b/resources/views/admin/orders_show.blade.php @@ -3,209 +3,203 @@ @section('page-title', 'Order Details') @section('content') -{{-- FULL-WIDTH FLUID CONTAINER --}} -
-
+
- {{-- MAIN CARD --}} -
-
+ {{-- HEADER --}} +
+
- {{-- HEADER SECTION --}} -
-
-

Order Details

- @php - $status = strtolower($order->status ?? ''); - @endphp -

Detailed view of this shipment order

-
+ {{-- TOP BAR --}} +
+
+

Order Details

+ @php + $status = strtolower($order->status ?? ''); + @endphp -
- {{-- ADD ITEM BUTTON --}} - @can('order.create') + Detailed view of this shipment order +
+ + {{-- ADD ITEM --}} + @can('order.create') + @if($status === 'pending') + + @endif + @endcan + + + +
+ + + + +
+ {{-- Edit Order --}} @if($status === 'pending') - @endif - @endcan - - - + {{-- Delete Order --}} + @if($status === 'pending') +
+ @csrf + @method('DELETE') + +
+ @endif +
+ + + +
+ + {{-- EDIT ORDER FORM --}} + + + {{-- CUSTOMER INFO --}} +
+
+
+
+ {{ strtoupper(substr($user->customer_name ?? 'U', 0, 1)) }} +
+
+ +
+
{{ $user->customer_name ?? 'Unknown Customer' }}
+

{{ $user->company_name ?? 'N/A' }}

+

{{ $user->email ?? '' }}

+

{{ $user->mobile_no ?? '' }}

- {{-- ACTION BUTTONS --}} -
- @if($status === 'pending') - - -
- @csrf - @method('DELETE') - -
- @endif +
+

{{ $user->address ?? '' }}

+ {{ $user->pincode ?? '' }}
+
- {{-- EDIT ORDER FORM (Hidden by default) --}} - - -
- - {{-- CUSTOMER INFO --}} -
-
-
-
-
- {{ strtoupper(substr($user->customer_name ?? 'U', 0, 1)) }} -
-
-
-
{{ $user->customer_name ?? 'Unknown Customer' }}
-

{{ $user->company_name ?? 'N/A' }}

-

{{ $user->email ?? '' }}

-

{{ $user->mobile_no ?? '' }}

-
-
+ {{-- ORDER SUMMARY --}} +
+
+
+

Order ID

+
{{ $order->order_id }}
-
-
-

{{ $user->address ?? '' }}

- {{ $user->pincode ?? '' }} -
+ +
+

Mark No

+
{{ $order->mark_no }}
+
+ +
+

Total Items

+
{{ $order->items->count() }}
+
+ +
+

Status

+ {{ ucfirst($order->status) }}
+
- {{-- ORDER SUMMARY --}} -
-
-
-

Order ID

-
{{ $order->order_id }}
-
-
-
-
-

Mark No

-
{{ $order->mark_no }}
-
-
-
-
-

Total Items

-
{{ $order->items->count() }}
-
-
-
-
-

Status

- {{ ucfirst($order->status) }} -
-
+ {{-- ORIGIN / DESTINATION --}} +
+
+

Origin

+
{{ $order->origin }}
- - {{-- ORIGIN / DESTINATION --}} -
-
-
-

Origin

-
{{ $order->origin }}
-
-
-
-
-

Destination

-
{{ $order->destination }}
-
-
+
+

Destination

+
{{ $order->destination }}
+
- {{-- ITEMS TABLE --}} -
-
- - - - - - - - - - - - - - - - - - - - - @foreach($order->items as $index => $item) - - - - - - - - - - - - - - - - {{-- TOTALS --}} -
-
-
{{ $order->ctn }}
- Total CTN -
-
-
{{ $order->qty }}
- Total QTY -
-
-
{{ $order->ttl_kg }}
- Total KG -
-
-
₹{{ number_format($order->ttl_amount, 2) }}
- Total Amount -
-
+ + @endforeach + +
#DescriptionCTNQTYTTL/QTYUnitPriceTotal AmountCBMTTL CBMKGTTL KGShop NoActions
{{ $index + 1 }}{{ $item->description }}{{ $item->ctn }}{{ $item->qty }}{{ $item->ttl_qty }}{{ $item->unit }}{{ number_format($item->price, 2) }}{{ number_format($item->ttl_amount, 2) }}{{ $item->cbm }}{{ $item->ttl_cbm }}{{ $item->kg }}{{ $item->ttl_kg }}{{ $item->shop_no }} -
- @if($status === 'pending') + {{-- ITEMS TABLE --}} +
+ + + + + + + + + + + + + + + + + + + + + + @foreach($order->items as $index => $item) + + + + + + + + + + + + + + + + - - @endforeach - -
#DescriptionCTNQTYTTL/QTYUnitPriceTotal AmountCBMTTL CBMKGTTL KGShop NoActions
{{ $index + 1 }}{{ $item->description }}{{ $item->ctn }}{{ $item->qty }}{{ $item->ttl_qty }}{{ $item->unit }}{{ number_format($item->price, 2) }}{{ number_format($item->ttl_amount, 2) }}{{ $item->cbm }}{{ $item->ttl_cbm }}{{ $item->kg }}{{ $item->ttl_kg }}{{ $item->shop_no }} + @if($status === 'pending') + {{-- EDIT BUTTON --}} @can('order.edit') @endcan - + + {{-- DELETE BUTTON --}} @can('order.delete')
@endcan - @endif - -
-
-
+ @endif +
+ + + @foreach($order->items as $item) + + @endforeach + + + {{-- TOTALS --}} +
+
+
{{ $order->ctn }}
+ Total CTN +
+ +
+
{{ $order->qty }}
+ Total QTY +
+ +
+
{{ $order->ttl_kg }}
+ Total KG +
+ +
+
₹{{ number_format($order->ttl_amount, 2) }}
+ Total Amount +
+
+
-{{-- EDIT ITEM MODALS --}} -@foreach($order->items as $item) - -@endforeach - {{-- ADD ITEM MODAL --}} -