Invoices can be uploaded

This commit is contained in:
2026-02-11 15:40:06 +01:00
parent bccfc11687
commit ee7fc637f1
47 changed files with 1751 additions and 67 deletions

View File

@@ -2,9 +2,13 @@
namespace App\Providers;
use App\Enumerations\InvoiceType;
use App\Enumerations\UserRole;
use App\Models\User;
use App\Repositories\PageTextRepository;
use App\Resources\UserResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class GlobalDataProvider {
private ?User $user;
@@ -20,6 +24,57 @@ class GlobalDataProvider {
]);
}
public function getInvoiceTypes() : JsonResponse {
$invoiceTypes = [];
foreach (InvoiceType::all() as $invoiceType) {
if (
$invoiceType->slug === InvoiceType::INVOICE_TYPE_TRAVELLING ||
$invoiceType->slug === InvoiceType::INVOICE_TYPE_OTHER
) {
continue;
}
$invoiceTypes[] = [
'slug' => $invoiceType->slug,
'name' => $invoiceType->name
];
}
$invoiceTypes[] = ['slug' => InvoiceType::INVOICE_TYPE_OTHER, 'name' => 'Sonstige Kosten'];
return response()->json([
'invoiceTypes' => $invoiceTypes
]);
}
public function getMessages() : JsonResponse {
$messageContainer = [
'message' => '',
'type' => ''
];
$message = session()->get('message');
if (null !== $message) {
$message = session()->get('message');
session()->forget('message');
if('' !== $message ) {
$messageContainer = unserialize($message);
}
}
return response()->json($messageContainer);
}
public function getTextResourceText(string $textResource) : JsonResponse {
$pageTextRepository = new PageTextRepository();
return response()->json([
'content' => $pageTextRepository->getPageText( $textResource)
]);
}
private function generateNavbar() : array {
$navigation = [
'personal' => [],
@@ -42,7 +97,7 @@ class GlobalDataProvider {
}
}
$navigation['common'][] = ['url' => '/capture-invoice', 'display' => 'Neue Abrechnung'];
$navigation['common'][] = ['url' => '/invoice/new', 'display' => 'Neue Abrechnung'];
$navigation['common'][] = ['url' => '/available-events', 'display' => 'Verfügbare Veranstaltungen'];
return $navigation;