shop info
This commit is contained in:
@@ -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),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
11
src/app/features/components/shop-info/shop-info.routes.ts
Normal file
11
src/app/features/components/shop-info/shop-info.routes.ts
Normal file
@@ -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: '',
|
||||
},
|
||||
];
|
||||
@@ -1,15 +1,87 @@
|
||||
<div>
|
||||
<h1>Shop-Stammdaten verwalten</h1>
|
||||
|
||||
<form *ngIf="shopInfoForm" [formGroup]="shopInfoForm" (ngSubmit)="onSubmit()">
|
||||
<input type="text" formControlName="shopName" placeholder="Shop-Name">
|
||||
<input type="text" formControlName="slogan" placeholder="Slogan">
|
||||
<input type="email" formControlName="contactEmail" placeholder="Kontakt E-Mail">
|
||||
<input type="tel" formControlName="phoneNumber" placeholder="Telefonnummer">
|
||||
<hr>
|
||||
<input type="text" formControlName="street" placeholder="Straße & Hausnummer">
|
||||
<input type="text" formControlName="city" placeholder="Stadt">
|
||||
<input type="text" formControlName="postalCode" placeholder="PLZ">
|
||||
<input type="text" formControlName="country" placeholder="Land">
|
||||
|
||||
<!-- Basis-Informationen -->
|
||||
<fieldset>
|
||||
<legend>Basis-Informationen</legend>
|
||||
<div>
|
||||
<label for="shopName">Shop-Name:</label>
|
||||
<input id="shopName" type="text" formControlName="shopName">
|
||||
</div>
|
||||
<div>
|
||||
<label for="slogan">Slogan:</label>
|
||||
<input id="slogan" type="text" formControlName="slogan">
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<!-- Kontaktdaten -->
|
||||
<fieldset>
|
||||
<legend>Kontaktdaten</legend>
|
||||
<div>
|
||||
<label for="contactEmail">Kontakt E-Mail:</label>
|
||||
<input id="contactEmail" type="email" formControlName="contactEmail">
|
||||
</div>
|
||||
<div>
|
||||
<label for="phoneNumber">Telefonnummer:</label>
|
||||
<input id="phoneNumber" type="tel" formControlName="phoneNumber">
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<!-- Adresse -->
|
||||
<fieldset>
|
||||
<legend>Firmenadresse</legend>
|
||||
<div>
|
||||
<label for="street">Straße & Hausnummer:</label>
|
||||
<input id="street" type="text" formControlName="street">
|
||||
</div>
|
||||
<div>
|
||||
<label for="city">Stadt:</label>
|
||||
<input id="city" type="text" formControlName="city">
|
||||
</div>
|
||||
<div>
|
||||
<label for="postalCode">PLZ:</label>
|
||||
<input id="postalCode" type="text" formControlName="postalCode">
|
||||
</div>
|
||||
<div>
|
||||
<label for="country">Land:</label>
|
||||
<input id="country" type="text" formControlName="country">
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<!-- Rechtliche Informationen -->
|
||||
<fieldset>
|
||||
<legend>Rechtliche Informationen</legend>
|
||||
<div>
|
||||
<label for="vatNumber">Umsatzsteuer-ID:</label>
|
||||
<input id="vatNumber" type="text" formControlName="vatNumber">
|
||||
</div>
|
||||
<div>
|
||||
<label for="regNumber">Handelsregisternummer:</label>
|
||||
<input id="regNumber" type="text" formControlName="companyRegistrationNumber">
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<!-- Social Media -->
|
||||
<fieldset>
|
||||
<legend>Social Media Links</legend>
|
||||
<div>
|
||||
<label for="fbUrl">Facebook URL:</label>
|
||||
<input id="fbUrl" type="url" formControlName="facebookUrl" placeholder="https://facebook.com/deinshop">
|
||||
</div>
|
||||
<div>
|
||||
<label for="igUrl">Instagram URL:</label>
|
||||
<input id="igUrl" type="url" formControlName="instagramUrl" placeholder="https://instagram.com/deinshop">
|
||||
</div>
|
||||
<div>
|
||||
<label for="twUrl">Twitter/X URL:</label>
|
||||
<input id="twUrl" type="url" formControlName="twitterUrl" placeholder="https://x.com/deinshop">
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<br>
|
||||
|
||||
<button type="submit" [disabled]="shopInfoForm.invalid">Speichern</button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -35,15 +35,59 @@
|
||||
|
||||
<span>discounts</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="nav-item"
|
||||
[class.active]="activeRoute === 'uebersicht'"
|
||||
(click)="setActive('uebersicht')"
|
||||
[class.active]="activeRoute === 'orders'"
|
||||
(click)="setActive('orders')"
|
||||
>
|
||||
<app-icon [iconName]="'placeholder'" [svgColor]="'#8e44ad'"></app-icon>
|
||||
|
||||
<span>Übersicht</span>
|
||||
<span>orders</span>
|
||||
</div>
|
||||
<div
|
||||
class="nav-item"
|
||||
[class.active]="activeRoute === 'payment-methods'"
|
||||
(click)="setActive('payment-methods')"
|
||||
>
|
||||
<app-icon [iconName]="'placeholder'" [svgColor]="'#8e44ad'"></app-icon>
|
||||
|
||||
<span>payment-methods</span>
|
||||
</div>
|
||||
<div
|
||||
class="nav-item"
|
||||
[class.active]="activeRoute === 'products'"
|
||||
(click)="setActive('products')"
|
||||
>
|
||||
<app-icon [iconName]="'placeholder'" [svgColor]="'#8e44ad'"></app-icon>
|
||||
|
||||
<span>products</span>
|
||||
</div>
|
||||
<div
|
||||
class="nav-item"
|
||||
[class.active]="activeRoute === 'reviews'"
|
||||
(click)="setActive('reviews')"
|
||||
>
|
||||
<app-icon [iconName]="'placeholder'" [svgColor]="'#8e44ad'"></app-icon>
|
||||
|
||||
<span>reviews</span>
|
||||
</div>
|
||||
<div
|
||||
class="nav-item"
|
||||
[class.active]="activeRoute === 'shipping-methods'"
|
||||
(click)="setActive('shipping-methods')"
|
||||
>
|
||||
<app-icon [iconName]="'placeholder'" [svgColor]="'#8e44ad'"></app-icon>
|
||||
|
||||
<span>shipping-methods</span>
|
||||
</div>
|
||||
<div
|
||||
class="nav-item"
|
||||
[class.active]="activeRoute === 'shop-info'"
|
||||
(click)="setActive('shop-info')"
|
||||
>
|
||||
<app-icon [iconName]="'placeholder'" [svgColor]="'#8e44ad'"></app-icon>
|
||||
|
||||
<span>shop-info</span>
|
||||
</div>
|
||||
</nav>
|
||||
</aside>
|
||||
|
||||
Reference in New Issue
Block a user