36 lines
1009 B
PHP
36 lines
1009 B
PHP
<?php
|
|
|
|
namespace Modules\Tms\Http\Controllers;
|
|
|
|
use Illuminate\Routing\Controller;
|
|
use Modules\Tms\Http\Controllers\Concerns\AuthorizesTms;
|
|
use Modules\Tms\Services\TmsDashboardService;
|
|
use Modules\Tms\Utils\TmsUtil;
|
|
|
|
class DashboardController extends Controller
|
|
{
|
|
use AuthorizesTms;
|
|
|
|
public function __construct(
|
|
protected TmsDashboardService $dashboardService,
|
|
protected TmsUtil $tmsUtil
|
|
) {}
|
|
|
|
public function index()
|
|
{
|
|
$this->authorizeTmsAccess('tms.view');
|
|
|
|
$business = $this->tmsUtil->getBusiness();
|
|
if (! $business) {
|
|
abort(404);
|
|
}
|
|
|
|
$stats = $this->dashboardService->getStats($business);
|
|
$recent_shipments = $this->dashboardService->getRecentShipments($business);
|
|
$statuses = $this->tmsUtil->shipmentStatuses();
|
|
$customs_statuses = $this->tmsUtil->customsStatuses();
|
|
|
|
return view('tms::dashboard.index', compact('stats', 'recent_shipments', 'statuses', 'customs_statuses'));
|
|
}
|
|
}
|