diff --git a/src/app/features/components/products/product-form/product-form.component.css b/src/app/features/components/products/product-form/product-form.component.css index 25ca13b..ebd9b32 100644 --- a/src/app/features/components/products/product-form/product-form.component.css +++ b/src/app/features/components/products/product-form/product-form.component.css @@ -18,7 +18,8 @@ h4[card-header] { margin-bottom: 0; } .form-label { font-weight: 500; color: #334155; } .required-indicator { color: var(--color-danger); margin-left: 4px; } .form-hint { font-size: 0.875rem; color: var(--text-color-secondary); margin-top: -0.75rem; } -.input-with-button { display: flex; gap: 0.5rem; } +.input-with-button { display: flex; flex-direction: row; gap: 0.5rem; } +.sku-input {width: 100%;} .input-with-button .form-input { flex-grow: 1; } .price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--grid-gap); } diff --git a/src/app/features/components/products/product-form/product-form.component.html b/src/app/features/components/products/product-form/product-form.component.html index 5d455b4..b276925 100644 --- a/src/app/features/components/products/product-form/product-form.component.html +++ b/src/app/features/components/products/product-form/product-form.component.html @@ -75,40 +75,38 @@ - -

Organisation

-
+
- +
+ -
-
-
- -

Kategorien

-
-
-
- - {{ getCategoryName(catId) }} - - - Keine ausgewählt -
-
- -
+ + +
+
+ + + Keine ausgewählt +
+
+ +
-
- + + +
diff --git a/src/app/features/components/products/product-form/product-form.component.ts b/src/app/features/components/products/product-form/product-form.component.ts index 7f34caa..38be0ac 100644 --- a/src/app/features/components/products/product-form/product-form.component.ts +++ b/src/app/features/components/products/product-form/product-form.component.ts @@ -24,6 +24,7 @@ import { FormTextareaComponent } from '../../../../shared/components/form/form-t import { SlideToggleComponent } from '../../../../shared/components/form/slide-toggle/slide-toggle.component'; import { SnackbarService } from '../../../../shared/services/snackbar.service'; import { FormGroupComponent } from '../../../../shared/components/form/form-group/form-group.component'; +import { StatusPillComponent } from '../../../../shared/components/ui/status-pill/status-pill.component'; // Interface für eine einheitliche Bild-Datenstruktur, die von der Elternkomponente kommt export interface ImagePreview { @@ -47,6 +48,7 @@ export interface ImagePreview { FormTextareaComponent, SlideToggleComponent, FormGroupComponent, + StatusPillComponent ], templateUrl: './product-form.component.html', styleUrls: ['./product-form.component.css'], diff --git a/src/app/shared/components/ui/status-pill/status-pill.component.css b/src/app/shared/components/ui/status-pill/status-pill.component.css index ac41598..1170b8b 100644 --- a/src/app/shared/components/ui/status-pill/status-pill.component.css +++ b/src/app/shared/components/ui/status-pill/status-pill.component.css @@ -48,4 +48,6 @@ :host-context(body.dark-theme) .pill-active { color: #a7f3d0; background-color: #166534; border-color: #22c55e; } .pill-inactive { color: rgb(168, 168, 168); background-color: #ececec; border-color: #777777; } -:host-context(body.dark-theme) .pill-inactive { color: rgb(168, 168, 168); background-color: #ececec; border-color: #777777; } \ No newline at end of file +:host-context(body.dark-theme) .pill-inactive { color: rgb(168, 168, 168); background-color: #ececec; border-color: #777777; } + + diff --git a/src/app/shared/components/ui/status-pill/status-pill.component.html b/src/app/shared/components/ui/status-pill/status-pill.component.html index 30e8bcb..e0aea3f 100644 --- a/src/app/shared/components/ui/status-pill/status-pill.component.html +++ b/src/app/shared/components/ui/status-pill/status-pill.component.html @@ -1,3 +1,5 @@ + +
- {{ displayText }} + {{ displayText }}
\ No newline at end of file diff --git a/src/app/shared/components/ui/status-pill/status-pill.component.ts b/src/app/shared/components/ui/status-pill/status-pill.component.ts index 95b72b5..f78888b 100644 --- a/src/app/shared/components/ui/status-pill/status-pill.component.ts +++ b/src/app/shared/components/ui/status-pill/status-pill.component.ts @@ -1,24 +1,36 @@ -import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; +// /src/app/shared/components/ui/status-pill/status-pill.component.ts + +import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges } from '@angular/core'; import { CommonModule, NgClass } from '@angular/common'; -// import { OrderStatus } from '../../../../core/types/order'; +import { IconComponent } from '../icon/icon.component'; // IconComponent importieren @Component({ selector: 'app-status-pill', standalone: true, - imports: [CommonModule, NgClass], + imports: [CommonModule, NgClass, IconComponent], // IconComponent hinzufügen templateUrl: './status-pill.component.html', - styleUrl: './status-pill.component.css' + styleUrls: ['./status-pill.component.css'] }) export class StatusPillComponent implements OnChanges { - // Nimmt jetzt den neuen, sprechenden Status entgegen - @Input() status: string | boolean = 'info'; + // --- INPUTS --- + // Nimmt den Status für die Farbe entgegen + @Input() status: string | boolean = 'info'; - // Diese Eigenschaften werden vom Template verwendet + // NEU: Nimmt einen expliziten Text entgegen. Hat Vorrang vor dem Status-Text. + @Input() text?: string; + + // NEU: Steuert, ob der "Entfernen"-Button angezeigt wird + @Input() removable = false; + + // --- OUTPUT --- + // NEU: Wird ausgelöst, wenn der Entfernen-Button geklickt wird + @Output() remove = new EventEmitter(); + + // --- Interne Eigenschaften für das Template --- public displayText = ''; public cssClass = ''; - // Eine Map, die Statusnamen auf Text und CSS-Klasse abbildet - private statusMap = new Map([ + private statusMap = new Map([ ['completed', { text: 'Abgeschlossen', css: 'pill-success' }], ['processing', { text: 'In Bearbeitung', css: 'pill-warning' }], ['cancelled', { text: 'Storniert', css: 'pill-danger' }], @@ -27,17 +39,25 @@ export class StatusPillComponent implements OnChanges { ['inactive', { text: 'Nein', css: 'pill-inactive' }] ]); - ngOnChanges(changes: SimpleChanges): void { - if (changes['status']) { + ngOnChanges(changes: SimpleChanges): void { + if (changes['status'] || changes['text']) { let statusKey = this.status; + // Konvertiere boolean in einen String-Key if (typeof statusKey === 'boolean') { statusKey = statusKey ? 'active' : 'inactive'; } - const details = this.statusMap.get(statusKey as string) || { text: statusKey.toString(), css: 'pill-secondary' }; - this.displayText = details.text; + const details = this.statusMap.get(statusKey as string) || { text: 'Info', css: 'pill-secondary' }; + + // NEUE LOGIK: Wenn ein expliziter Text übergeben wird, hat dieser Vorrang + this.displayText = this.text ?? details.text; this.cssClass = details.css; } } + + // Methode, die das Event auslöst + onRemove(): void { + this.remove.emit(); + } } \ No newline at end of file