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 DashboardApp 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.dashboard';
36: }
37:
38: public function getVersion(): string
39: {
40: return '1.0.0';
41: }
42:
43: public function getTitle(): string
44: {
45: return 'Dashboard';
46: }
47:
48: public function getDescription(): string
49: {
50: return 'Generic Ui5 Dashboard Application';
51: }
52:
53: public function getUi5BootstrapAttributes(): array
54: {
55: return array(
56: 'theme' => 'sap_horizon',
57: 'oninit' => 'module:com/laravelui5/dashboard/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 array();
69: }
70:
71: public function getAdditionalHeadScript(): ?string
72: {
73: return <<<JS
74: sap.ui.getCore().attachInit(function () {
75: sap.ui.core.Component.create({
76: name: "com.laravelui5.dashboard",
77: manifest: true,
78: async: true
79: }).then(function (oComponent) {
80: new sap.ui.core.ComponentContainer({
81: component: oComponent,
82: height: "100%"
83: }).placeAt("content");
84: }).catch(function (err) {
85: console.error("Component load failed:", err);
86: });
87: });
88: JS;
89: }
90:
91: public function getAdditionalInlineCss(): ?string
92: {
93: return <<<CSS
94:
95: CSS;
96: }
97:
98: public function getAssetPath(string $filename): ?string
99: {
100: $path = __DIR__ . '/../resources/dashboard-app/' . ltrim($filename, '/');
101: return File::exists($path) ? $path : null;
102: }
103:
104: public function getVendor(): string
105: {
106: return 'Pragmatiqu IT GmbH';
107: }
108:
109: public function getManifestPath(): string
110: {
111: return __DIR__ . '/../resources/dashboard-app/manifest.json';
112: }
113:
114: public function getLaravelUiManifest(): LaravelUi5ManifestInterface
115: {
116: return app(CoreManifest::class);
117: }
118: }
119: