- Implemented dashboard view with vehicle stats, active services, recent activity, and upcoming appointments. - Created estimates view with filtering options and a list of service estimates. - Developed invoices view to manage service invoices and payment history with filtering. - Added vehicles view to display registered vehicles and their details. - Built work orders view to track the progress of vehicle services with filtering and detailed information.
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\CustomerPortal;
|
|
|
|
use App\Models\Estimate;
|
|
use App\Models\Customer;
|
|
use Livewire\Component;
|
|
use Livewire\WithPagination;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class Estimates extends Component
|
|
{
|
|
use WithPagination;
|
|
|
|
public $filterStatus = '';
|
|
|
|
public function updatingFilterStatus()
|
|
{
|
|
$this->resetPage();
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
$user = Auth::user();
|
|
$customer = Customer::where('email', $user->email)->first();
|
|
|
|
$estimates = collect();
|
|
|
|
if ($customer) {
|
|
$estimates = Estimate::whereHas('jobCard', function($query) use ($customer) {
|
|
$query->where('customer_id', $customer->id);
|
|
})
|
|
->when($this->filterStatus, function ($query) {
|
|
$query->where('status', $this->filterStatus);
|
|
})
|
|
->with(['jobCard.vehicle'])
|
|
->orderBy('created_at', 'desc')
|
|
->paginate(10);
|
|
}
|
|
|
|
return view('livewire.customer-portal.estimates', compact('estimates'))
|
|
->layout('layouts.customer-portal-app');
|
|
}
|
|
}
|