Files
mareike/app/Domains/Admin/Controllers/ManagedTenantTaxGetController.php
T

34 lines
1.2 KiB
PHP

<?php
namespace App\Domains\Admin\Controllers;
use App\Enumerations\TaxExemptionReason;
use App\Enumerations\VatPricingMode;
use App\Scopes\CommonController;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ManagedTenantTaxGetController extends CommonController
{
public function __invoke(string $slug, Request $request): JsonResponse
{
$tenant = $this->adminTenants->findBySlug($slug);
return response()->json([
'tax_liable' => $tenant->tax_liable,
'vat_rate' => $tenant->vat_rate,
'tax_exemption_reason' => $tenant->tax_exemption_reason,
'tax_exemption_note' => $tenant->tax_exemption_note,
'vat_pricing_mode' => $tenant->vat_pricing_mode,
'tax_number' => $tenant->tax_number,
'vat_id' => $tenant->vat_id,
'invoice_prefix' => $tenant->invoice_prefix,
// In der Mandanten-Verwaltung ist der Nummernkreis änderbar.
'can_edit_invoice_prefix' => true,
'exemption_reasons' => TaxExemptionReason::options(),
'pricing_modes' => VatPricingMode::options(),
'saveEndpoint' => '/api/v1/admin/tenants/' . $slug . '/tax',
]);
}
}