mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
#4687 Changes to View, Added Organisation Input Field
This commit is contained in:
@@ -215,12 +215,14 @@ export class DomainOmsService {
|
||||
communicationDetails,
|
||||
firstName,
|
||||
lastName,
|
||||
organisation,
|
||||
}: {
|
||||
orderId: number;
|
||||
notificationChannels?: NotificationChannel;
|
||||
communicationDetails?: { email?: string; mobile?: string };
|
||||
lastName?: string;
|
||||
firstName?: string;
|
||||
organisation?: string;
|
||||
}) {
|
||||
const buyer: BuyerDTO = {};
|
||||
|
||||
@@ -229,8 +231,12 @@ export class DomainOmsService {
|
||||
}
|
||||
|
||||
if (!!lastName || !!firstName) {
|
||||
buyer.firstName = firstName;
|
||||
buyer.lastName = lastName;
|
||||
buyer.firstName = firstName;
|
||||
}
|
||||
|
||||
if (!!organisation && !!buyer.organisation) {
|
||||
buyer.organisation.name = organisation;
|
||||
}
|
||||
|
||||
return this.orderService
|
||||
|
||||
@@ -29,13 +29,19 @@
|
||||
<input uiInput formControlName="buyerNumber" />
|
||||
</ui-form-control>
|
||||
|
||||
<ui-form-control label="Name" variant="inline">
|
||||
<input uiInput formControlName="firstName" />
|
||||
</ui-form-control>
|
||||
<ng-container *ngIf="showNameFields">
|
||||
<ui-form-control label="Name" variant="inline" [statusLabel]="canEditNameFields ? '' : 'Nicht Änderbar'">
|
||||
<input uiInput formControlName="firstName" />
|
||||
</ui-form-control>
|
||||
|
||||
<ui-form-control label="Vorname" variant="inline">
|
||||
<input uiInput formControlName="lastName" />
|
||||
</ui-form-control>
|
||||
<ui-form-control label="Vorname" variant="inline" [statusLabel]="canEditNameFields ? '' : 'Nicht Änderbar'">
|
||||
<input uiInput formControlName="lastName" />
|
||||
</ui-form-control>
|
||||
|
||||
<ui-form-control *ngIf="isB2B" label="Firmenname" variant="inline" [statusLabel]="canEditNameFields ? '' : 'Nicht Änderbar'">
|
||||
<input uiInput formControlName="organisation" />
|
||||
</ui-form-control>
|
||||
</ng-container>
|
||||
|
||||
<div formArrayName="items">
|
||||
<div *ngFor="let item of itemsControl.controls; index as i" [formGroupName]="i">
|
||||
|
||||
@@ -82,6 +82,20 @@ export class SharedGoodsInOutOrderEditComponent implements OnChanges, OnDestroy
|
||||
return Array.from(ProcessingStatusNameMap.keys());
|
||||
}
|
||||
|
||||
get showNameFields(): boolean {
|
||||
// orderType 1 === Abholung / Rücklage
|
||||
return this.items[0]?.orderType === 1; // Felder nur bei "Rücklage" oder "Abholung" anzeigen #4687
|
||||
}
|
||||
|
||||
get canEditNameFields(): boolean {
|
||||
return this.items[0]?.processingStatus === 16; // Felder nur im Status bestellt bearbeitbar #4687
|
||||
}
|
||||
|
||||
// #4687 Ungenauer B2B-Check, da Customer Features nicht am OrderItemListItemDTO hängen
|
||||
get isB2B(): boolean {
|
||||
return !!this.items[0]?.organisation;
|
||||
}
|
||||
|
||||
constructor(
|
||||
private fb: UntypedFormBuilder,
|
||||
private processingStatusPipe: ProcessingStatusPipe,
|
||||
@@ -115,6 +129,7 @@ export class SharedGoodsInOutOrderEditComponent implements OnChanges, OnDestroy
|
||||
if (items.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const fb = this.fb;
|
||||
this.control = fb.group({
|
||||
orderId: fb.control({ value: items[0].orderId, disabled: true }),
|
||||
@@ -122,8 +137,9 @@ export class SharedGoodsInOutOrderEditComponent implements OnChanges, OnDestroy
|
||||
orderDate: fb.control({ value: this.datePipe.transform(items[0].orderDate), disabled: true }),
|
||||
clientChannel: fb.control({ value: (await this.getOrderSource()) ?? items[0].features?.orderSource, disabled: true }),
|
||||
buyerNumber: fb.control({ value: items[0].buyerNumber, disabled: true }),
|
||||
firstName: fb.control({ value: items[0].firstName, disabled: false }),
|
||||
lastName: fb.control({ value: items[0].lastName, disabled: false }),
|
||||
firstName: fb.control({ value: items[0].firstName, disabled: !this.canEditNameFields }),
|
||||
lastName: fb.control({ value: items[0].lastName, disabled: !this.canEditNameFields }),
|
||||
organisation: fb.control({ value: items[0].organisation, disabled: !this.canEditNameFields }),
|
||||
items: fb.array([]),
|
||||
notificationChannel: this.notificationsGroup,
|
||||
});
|
||||
@@ -273,6 +289,7 @@ export class SharedGoodsInOutOrderEditComponent implements OnChanges, OnDestroy
|
||||
const orderId = control.orderId;
|
||||
const firstName = control.firstName;
|
||||
const lastName = control.lastName;
|
||||
const organisation = control.organisation;
|
||||
|
||||
if (this.notificationsGroup.dirty) {
|
||||
try {
|
||||
@@ -309,8 +326,8 @@ export class SharedGoodsInOutOrderEditComponent implements OnChanges, OnDestroy
|
||||
}
|
||||
|
||||
try {
|
||||
if (this.firstOrLastNameChanged()) {
|
||||
await this.omsService.updateOrder({ orderId, firstName, lastName }).pipe(first()).toPromise();
|
||||
if (this.firstOrLastNameOrOrganisationChanged()) {
|
||||
await this.omsService.updateOrder({ orderId, firstName, lastName, organisation }).pipe(first()).toPromise();
|
||||
}
|
||||
} catch (error) {
|
||||
this._modal.open({
|
||||
@@ -398,8 +415,8 @@ export class SharedGoodsInOutOrderEditComponent implements OnChanges, OnDestroy
|
||||
}
|
||||
}
|
||||
|
||||
firstOrLastNameChanged() {
|
||||
return this.control.get('firstName').dirty || this.control.get('lastName').dirty;
|
||||
firstOrLastNameOrOrganisationChanged() {
|
||||
return this.control.get('firstName').dirty || this.control.get('lastName').dirty || this.control.get('organisation').dirty;
|
||||
}
|
||||
|
||||
getFormGroupByOrderItemSubsetId(orderItemSubsetId: number): UntypedFormGroup {
|
||||
|
||||
Reference in New Issue
Block a user