mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-08 14:04:50 +00:00
* WIP(gotenberg): add pdf generation abstraction and UI * feat(pdf): settings validate(clien+server) & save * fix(gotenberg): Use correct default papersize chore(gotengberg): Remove unused GOTENBERG_MARGINS env from .env * style(gotenberg): fix linter/styling issues * fix(pdf): use pdf config policy * fix: revert accidental capitalization in mail config vue * Update composer, remove whitespace typo * Fix small typos * fix cookie/env issue * Add gotenberg to .dev, move admin menu item up
55 lines
1.3 KiB
PHP
55 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\V1\Admin\Settings;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\PDFConfigurationRequest;
|
|
use App\Space\EnvironmentManager;
|
|
|
|
class PDFConfigurationController extends Controller
|
|
{
|
|
/**
|
|
* @var EnvironmentManager
|
|
*/
|
|
protected $environmentManager;
|
|
|
|
public function __construct(EnvironmentManager $environmentManager)
|
|
{
|
|
$this->environmentManager = $environmentManager;
|
|
}
|
|
|
|
public function getDrivers()
|
|
{
|
|
$this->authorize('manage pdf config');
|
|
|
|
$drivers = [
|
|
'dompdf',
|
|
'gotenberg',
|
|
];
|
|
|
|
return response()->json($drivers);
|
|
}
|
|
|
|
public function getEnvironment()
|
|
{
|
|
$this->authorize('manage pdf config');
|
|
|
|
$config = [
|
|
'pdf_driver' => config('pdf.driver'),
|
|
'gotenberg_host' => config('pdf.gotenberg.host'),
|
|
'gotenberg_margins' => config('pdf.gotenberg.margins'),
|
|
'gotenberg_papersize' => config('pdf.gotenberg.papersize'),
|
|
];
|
|
|
|
return response()->json($config);
|
|
}
|
|
|
|
public function saveEnvironment(PDFConfigurationRequest $request)
|
|
{
|
|
$this->authorize('manage pdf config');
|
|
$results = $this->environmentManager->savePDFVariables($request);
|
|
|
|
return response()->json($results);
|
|
}
|
|
}
|