diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts
index c978050..0ad4627 100644
--- a/src/app/app.routes.ts
+++ b/src/app/app.routes.ts
@@ -88,6 +88,13 @@ export const routes: Routes = [
'./features/components/shipping-methods/shipping-methods.routes'
).then((r) => r.SHIPPING_METHODS_ROUTES),
},
+ {
+ path: 'shop-info',
+ loadChildren: () =>
+ import(
+ './features/components/shop-info/shop-info.routes'
+ ).then((r) => r.SHOP_INFO_ROUTES),
+ },
],
},
{
diff --git a/src/app/features/components/shop-info/shop-info.routes.ts b/src/app/features/components/shop-info/shop-info.routes.ts
new file mode 100644
index 0000000..6db80a6
--- /dev/null
+++ b/src/app/features/components/shop-info/shop-info.routes.ts
@@ -0,0 +1,11 @@
+import { Routes } from '@angular/router';
+import { ShopInfoComponent } from './shop-info/shop-info.component';
+
+
+export const SHOP_INFO_ROUTES: Routes = [
+ {
+ path: '',
+ component: ShopInfoComponent,
+ title: '',
+ },
+];
diff --git a/src/app/features/components/shop-info/shop-info/shop-info.component.html b/src/app/features/components/shop-info/shop-info/shop-info.component.html
index 592c5d2..90c5138 100644
--- a/src/app/features/components/shop-info/shop-info/shop-info.component.html
+++ b/src/app/features/components/shop-info/shop-info/shop-info.component.html
@@ -1,15 +1,87 @@
Shop-Stammdaten verwalten
+
\ No newline at end of file
diff --git a/src/app/features/components/shop-info/shop-info/shop-info.component.ts b/src/app/features/components/shop-info/shop-info/shop-info.component.ts
index 395f97b..ab1a8d1 100644
--- a/src/app/features/components/shop-info/shop-info/shop-info.component.ts
+++ b/src/app/features/components/shop-info/shop-info/shop-info.component.ts
@@ -17,26 +17,53 @@ export class ShopInfoComponent implements OnInit {
shopInfoForm!: FormGroup;
ngOnInit(): void {
+ // --- FORMULAR UM ALLE FELDER ERWEITERT ---
this.shopInfoForm = this.fb.group({
+ // Basis-Daten
shopName: ['', Validators.required],
slogan: [''],
contactEmail: ['', [Validators.required, Validators.email]],
phoneNumber: [''],
+ // Adresse
street: [''],
city: [''],
postalCode: [''],
- country: ['']
+ country: [''],
+ // Rechtliches
+ vatNumber: [''],
+ companyRegistrationNumber: [''],
+ // Social Media
+ facebookUrl: [''],
+ instagramUrl: [''],
+ twitterUrl: ['']
});
+ // --- ENDE ERWEITERUNG ---
+ this.loadShopInfo();
+ }
+
+ loadShopInfo(): void {
this.shopInfoService.get().subscribe(data => {
- this.shopInfoForm.patchValue(data);
+ if (data) {
+ this.shopInfoForm.patchValue(data);
+ }
});
}
onSubmit(): void {
- if (this.shopInfoForm.invalid) return;
- this.shopInfoService.update(this.shopInfoForm.value).subscribe(() => {
- alert('Shop-Informationen gespeichert!');
+ if (this.shopInfoForm.invalid) {
+ this.shopInfoForm.markAllAsTouched(); // Zeigt alle Validierungsfehler an
+ return;
+ }
+
+ this.shopInfoService.update(this.shopInfoForm.value).subscribe({
+ next: () => {
+ alert('Shop-Informationen erfolgreich gespeichert!');
+ },
+ error: (err) => {
+ alert('Fehler beim Speichern der Informationen.');
+ console.error('Failed to update shop info', err);
+ }
});
}
}
\ No newline at end of file
diff --git a/src/app/shared/components/layout/sidebar/sidebar.component.html b/src/app/shared/components/layout/sidebar/sidebar.component.html
index 3855c10..20cabb7 100644
--- a/src/app/shared/components/layout/sidebar/sidebar.component.html
+++ b/src/app/shared/components/layout/sidebar/sidebar.component.html
@@ -35,15 +35,59 @@
discounts
-
+
+
+
+
+