@@ -4,11 +4,11 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\SupplyRecord;
|
||||
use App\Models\User;
|
||||
use App\Services\ImportEvidence;
|
||||
use App\Services\ImportLandedCosts;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Inertia\Inertia;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
@@ -35,7 +35,7 @@ class ImportLandedCostController extends Controller
|
||||
/** @param array<string,mixed>|null $preview */
|
||||
private function page(Request $request, SupplyRecord $import, ImportLandedCosts $service, ?array $preview = null): Response
|
||||
{
|
||||
$search = $request->validate(['invoice_search' => 'nullable|string|max:100'])['invoice_search'] ?? '';
|
||||
$search = $request->validate(['invoice_search' => 'nullable|string|max:100', 'estimates_page' => 'nullable|integer|min:1|max:1000000'])['invoice_search'] ?? '';
|
||||
Inertia::encryptHistory();
|
||||
$response = Inertia::render('supply/import-costs', [...$service->workspace($this->actor($request), $import, $search), 'preview' => $preview])->toResponse($request);
|
||||
$response->headers->set('Cache-Control', 'private, no-store, max-age=0');
|
||||
@@ -72,7 +72,8 @@ class ImportLandedCostController extends Controller
|
||||
$source = $service->evidence($this->actor($request), $import, $document);
|
||||
$evidence = $source->snapshot['evidence'];
|
||||
|
||||
return Storage::disk('local')->download($evidence['path'], 'documento-importacao-'.$source->id.'.'.pathinfo($evidence['path'], PATHINFO_EXTENSION),
|
||||
['Cache-Control' => 'private, no-store, max-age=0', 'X-Content-Type-Options' => 'nosniff']);
|
||||
return response(app(ImportEvidence::class)->bytes($source), 200, [
|
||||
'Content-Type' => 'application/octet-stream', 'Content-Disposition' => 'attachment; filename="documento-importacao-'.$source->id.'.'.pathinfo($evidence['path'], PATHINFO_EXTENSION).'"',
|
||||
'Cache-Control' => 'private, no-store, max-age=0', 'X-Content-Type-Options' => 'nosniff']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user