shop info
This commit is contained in:
@@ -88,6 +88,13 @@ export const routes: Routes = [
|
|||||||
'./features/components/shipping-methods/shipping-methods.routes'
|
'./features/components/shipping-methods/shipping-methods.routes'
|
||||||
).then((r) => r.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>
|
<div>
|
||||||
<h1>Shop-Stammdaten verwalten</h1>
|
<h1>Shop-Stammdaten verwalten</h1>
|
||||||
|
|
||||||
<form *ngIf="shopInfoForm" [formGroup]="shopInfoForm" (ngSubmit)="onSubmit()">
|
<form *ngIf="shopInfoForm" [formGroup]="shopInfoForm" (ngSubmit)="onSubmit()">
|
||||||
<input type="text" formControlName="shopName" placeholder="Shop-Name">
|
|
||||||
<input type="text" formControlName="slogan" placeholder="Slogan">
|
<!-- Basis-Informationen -->
|
||||||
<input type="email" formControlName="contactEmail" placeholder="Kontakt E-Mail">
|
<fieldset>
|
||||||
<input type="tel" formControlName="phoneNumber" placeholder="Telefonnummer">
|
<legend>Basis-Informationen</legend>
|
||||||
<hr>
|
<div>
|
||||||
<input type="text" formControlName="street" placeholder="Straße & Hausnummer">
|
<label for="shopName">Shop-Name:</label>
|
||||||
<input type="text" formControlName="city" placeholder="Stadt">
|
<input id="shopName" type="text" formControlName="shopName">
|
||||||
<input type="text" formControlName="postalCode" placeholder="PLZ">
|
</div>
|
||||||
<input type="text" formControlName="country" placeholder="Land">
|
<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>
|
<button type="submit" [disabled]="shopInfoForm.invalid">Speichern</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@@ -17,26 +17,53 @@ export class ShopInfoComponent implements OnInit {
|
|||||||
shopInfoForm!: FormGroup;
|
shopInfoForm!: FormGroup;
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
// --- FORMULAR UM ALLE FELDER ERWEITERT ---
|
||||||
this.shopInfoForm = this.fb.group({
|
this.shopInfoForm = this.fb.group({
|
||||||
|
// Basis-Daten
|
||||||
shopName: ['', Validators.required],
|
shopName: ['', Validators.required],
|
||||||
slogan: [''],
|
slogan: [''],
|
||||||
contactEmail: ['', [Validators.required, Validators.email]],
|
contactEmail: ['', [Validators.required, Validators.email]],
|
||||||
phoneNumber: [''],
|
phoneNumber: [''],
|
||||||
|
// Adresse
|
||||||
street: [''],
|
street: [''],
|
||||||
city: [''],
|
city: [''],
|
||||||
postalCode: [''],
|
postalCode: [''],
|
||||||
country: ['']
|
country: [''],
|
||||||
|
// Rechtliches
|
||||||
|
vatNumber: [''],
|
||||||
|
companyRegistrationNumber: [''],
|
||||||
|
// Social Media
|
||||||
|
facebookUrl: [''],
|
||||||
|
instagramUrl: [''],
|
||||||
|
twitterUrl: ['']
|
||||||
});
|
});
|
||||||
|
// --- ENDE ERWEITERUNG ---
|
||||||
|
|
||||||
|
this.loadShopInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
loadShopInfo(): void {
|
||||||
this.shopInfoService.get().subscribe(data => {
|
this.shopInfoService.get().subscribe(data => {
|
||||||
|
if (data) {
|
||||||
this.shopInfoForm.patchValue(data);
|
this.shopInfoForm.patchValue(data);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(): void {
|
onSubmit(): void {
|
||||||
if (this.shopInfoForm.invalid) return;
|
if (this.shopInfoForm.invalid) {
|
||||||
this.shopInfoService.update(this.shopInfoForm.value).subscribe(() => {
|
this.shopInfoForm.markAllAsTouched(); // Zeigt alle Validierungsfehler an
|
||||||
alert('Shop-Informationen gespeichert!');
|
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>
|
<span>discounts</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="nav-item"
|
class="nav-item"
|
||||||
[class.active]="activeRoute === 'uebersicht'"
|
[class.active]="activeRoute === 'orders'"
|
||||||
(click)="setActive('uebersicht')"
|
(click)="setActive('orders')"
|
||||||
>
|
>
|
||||||
<app-icon [iconName]="'placeholder'" [svgColor]="'#8e44ad'"></app-icon>
|
<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>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
Reference in New Issue
Block a user