1: <?php
2:
3: namespace LaravelUi5\Core;
4:
5: use Illuminate\Support\Facades\File;
6: use LaravelUi5\Core\Enums\ArtifactType;
7: use LaravelUi5\Core\Ui5\Contracts\LaravelUi5ManifestInterface;
8: use LaravelUi5\Core\Ui5\Contracts\Ui5AppInterface;
9: use LaravelUi5\Core\Ui5\Contracts\Ui5ModuleInterface;
10:
11: class ReportApp implements Ui5AppInterface
12: {
13:
14: public function __construct(protected Ui5ModuleInterface $module)
15: {
16: }
17:
18: public function getModule(): ?Ui5ModuleInterface
19: {
20: return $this->module;
21: }
22:
23: public function getSlug(): string
24: {
25: return $this->module->getSlug();
26: }
27:
28: public function getType(): ArtifactType
29: {
30: return ArtifactType::Application;
31: }
32:
33: public function getNamespace(): string
34: {
35: return 'com.laravelui5.report';
36: }
37:
38: public function getVersion(): string
39: {
40: return '1.0.0';
41: }
42:
43: public function getTitle(): string
44: {
45: return 'Report';
46: }
47:
48: public function getDescription(): string
49: {
50: return 'Generic Ui5 Report Application';
51: }
52:
53: public function getUi5BootstrapAttributes(): array
54: {
55: return array (
56: 'theme' => 'sap_horizon',
57: 'oninit' => 'module:com/laravelui5/report/Component',
58: 'async' => 'true',
59: 'compatversion' => 'edge',
60: 'frameoptions' => 'trusted',
61: 'xx-waitfortheme' => 'true',
62: 'xx-supportedlanguages' => 'en,de',
63: );
64: }
65:
66: public function getResourceNamespaces(): array
67: {
68: return [
69: ];
70: }
71:
72: public function getAdditionalHeadScript(): ?string
73: {
74: return <<<JS
75: sap.ui.getCore().attachInit(function () {
76: sap.ui.core.Component.create({
77: name: "com.laravelui5.report",
78: manifest: true,
79: async: true
80: }).then(function (oComponent) {
81: new sap.ui.core.ComponentContainer({
82: component: oComponent,
83: height: "100%"
84: }).placeAt("content");
85: }).catch(function (err) {
86: console.error("Component load failed:", err);
87: });
88: });
89: JS;
90: }
91:
92: public function getAdditionalInlineCss(): ?string
93: {
94: return <<<CSS
95:
96: CSS;
97: }
98:
99: public function getAssetPath(string $filename): ?string
100: {
101: $path = __DIR__ . '/../resources/report-app/' . ltrim($filename, '/');
102: return File::exists($path) ? $path : null;
103: }
104:
105: public function getVendor(): string
106: {
107: return 'Pragmatiqu IT GmbH';
108: }
109:
110: public function getManifestPath(): string
111: {
112: return __DIR__ . '/../resources/report-app/manifest.json';
113: }
114:
115: public function getLaravelUiManifest(): LaravelUi5ManifestInterface
116: {
117: return app(CoreManifest::class);
118: }
119: }
120: