update vm ticket

This commit is contained in:
baodev0
2026-07-14 17:03:38 +07:00
parent f035730a44
commit 401dcc8783
24 changed files with 950 additions and 31 deletions
@@ -20,8 +20,10 @@ use App\Services\ActivityLogger;
use App\Services\Api\Order\OrderQueryService;
use App\Services\Api\Order\OrderService;
use App\Services\InvoicePaymentService;
use App\Services\InvoicePdfService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class OrderControllerRefactor extends Controller
{
@@ -225,6 +227,34 @@ class OrderControllerRefactor extends Controller
}
}
public function getClientOrderDetailByOrderNum(Request $request, string $orderNum): JsonResponse
{
$order = $this->orderQueryService->findCustomerInvoiceByOrderNum((int) $request->user()->id, $orderNum);
if (! $order) {
return response()->json(['success' => false, 'message' => 'Đơn hàng không tồn tại.'], 404);
}
return response()->json(['success' => true, 'data' => new OrderDetailResource($order)]);
}
public function downloadInvoicePdfByOrderNum(Request $request, string $orderNum, InvoicePdfService $pdfService): Response
{
$order = $this->orderQueryService->findCustomerInvoiceByOrderNum((int) $request->user()->id, $orderNum);
if (! $order?->invoice) {
abort(404, 'Hóa đơn không tồn tại.');
}
$pdf = $pdfService->generate($order->invoice);
$filename = $pdfService->generateFileName($order->invoice);
return response($pdf, 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="' . $filename . '"',
]);
}
public function getClientServices(Request $request): JsonResponse
{
$services = $this->orderQueryService->getCustomerServices((int) $request->user()->id);