mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
#1223 if status is paid, collection period should not be extended
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
<h2 class="isa-flex isa-justify-content-space-between isa-mb-10">
|
||||
<span>{{ orderDetails?.firstName }} {{ orderDetails?.lastName }}</span>
|
||||
<span
|
||||
>{{ orderDetails?.compartmentCode
|
||||
}}{{
|
||||
orderDetails?.compartmentInfo && '_' + orderDetails?.compartmentInfo
|
||||
}}</span
|
||||
>
|
||||
<span>{{ orderDetails?.compartmentCode }}{{ orderDetails?.compartmentInfo && '_' + orderDetails?.compartmentInfo }}</span>
|
||||
</h2>
|
||||
<h3
|
||||
*ngIf="orderDetails?.features?.paid || orderDetails?.features?.code"
|
||||
@@ -20,18 +15,14 @@
|
||||
</div>
|
||||
</h3>
|
||||
<div class="isa-flex isa-justify-content-space-between">
|
||||
<div
|
||||
class="isa-flex isa-flex-direction-column isa-container-width-380 isa-flex-grow-2"
|
||||
>
|
||||
<div class="isa-flex isa-flex-direction-column isa-container-width-380 isa-flex-grow-2">
|
||||
<div class="detail">
|
||||
<div class="name">Vorgang-ID</div>
|
||||
<div class="value">{{ orderDetails?.orderNumber }}</div>
|
||||
</div>
|
||||
<div class="detail">
|
||||
<div class="name">Bestelldatum</div>
|
||||
<div class="value">
|
||||
{{ orderDetails?.orderDate | date: 'dd.MM.yy | HH:mm' }} Uhr
|
||||
</div>
|
||||
<div class="value">{{ orderDetails?.orderDate | date: 'dd.MM.yy | HH:mm' }} Uhr</div>
|
||||
</div>
|
||||
<div class="detail">
|
||||
<div class="name">Bestellkanal</div>
|
||||
@@ -48,23 +39,15 @@
|
||||
<div class="detail">
|
||||
<div class="name">Status</div>
|
||||
<div class="value">
|
||||
<button
|
||||
class="isa-btn isa-p-0 isa-btn-block isa-text-right isa-white-space-nowrap"
|
||||
(click)="statusDropdown.toggle()"
|
||||
>
|
||||
<button class="isa-btn isa-p-0 isa-btn-block isa-text-right isa-white-space-nowrap" (click)="statusDropdown.toggle()">
|
||||
<lib-icon
|
||||
class="isa-mr-8"
|
||||
[ngClass]="icon"
|
||||
*ngIf="
|
||||
orderDetails?.processingStatus | processingStatus: 'icon';
|
||||
let icon
|
||||
"
|
||||
*ngIf="orderDetails?.processingStatus | processingStatus: 'icon'; let icon"
|
||||
[name]="icon"
|
||||
>
|
||||
</lib-icon>
|
||||
<strong>{{
|
||||
orderDetails?.processingStatus | processingStatus
|
||||
}}</strong>
|
||||
<strong>{{ orderDetails?.processingStatus | processingStatus }}</strong>
|
||||
<lib-icon
|
||||
class="dp-button-icon"
|
||||
[class.up]="statusDropdown.visible"
|
||||
@@ -73,18 +56,8 @@
|
||||
[height]="'16px'"
|
||||
></lib-icon>
|
||||
</button>
|
||||
<app-ui-dropdown
|
||||
#statusDropdown
|
||||
[value]="orderDetails?.processingStatus"
|
||||
(valueChange)="changeProcessingStatus.emit($event)"
|
||||
>
|
||||
<ng-container
|
||||
*ngFor="
|
||||
let status of processingKeys
|
||||
| keyvalue
|
||||
| processingStatusOptionsKeyValuePipe
|
||||
"
|
||||
>
|
||||
<app-ui-dropdown #statusDropdown [value]="orderDetails?.processingStatus" (valueChange)="changeProcessingStatus.emit($event)">
|
||||
<ng-container *ngFor="let status of processingKeys | keyvalue | processingStatusOptionsKeyValuePipe">
|
||||
<button
|
||||
appUiDropdownItem
|
||||
class="isa-btn isa-text-left isa-p-16"
|
||||
@@ -122,10 +95,7 @@
|
||||
<div class="detail">
|
||||
<div class="name">vsl. Lieferdatum</div>
|
||||
<div class="value">
|
||||
<button
|
||||
class="isa-btn isa-p-0 isa-btn-block isa-text-right"
|
||||
(click)="uiDatepicker.toggle()"
|
||||
>
|
||||
<button class="isa-btn isa-p-0 isa-btn-block isa-text-right" (click)="uiDatepicker.toggle()">
|
||||
<strong>
|
||||
{{ orderDetails?.estimatedShippingDate | date: 'dd.MM.yy' }}
|
||||
</strong>
|
||||
@@ -155,6 +125,7 @@
|
||||
<div class="name">Abholfrist</div>
|
||||
<div class="value">
|
||||
<button
|
||||
[disabled]="!!orderDetails?.features?.paid"
|
||||
class="isa-btn isa-p-0 isa-btn-block isa-text-right"
|
||||
(click)="deadlineDropdown.toggle()"
|
||||
>
|
||||
@@ -169,17 +140,9 @@
|
||||
[height]="'16px'"
|
||||
></lib-icon>
|
||||
</button>
|
||||
<app-ui-dropdown
|
||||
#deadlineDropdown
|
||||
[value]="orderDetails?.pickUpDeadline"
|
||||
(valueChange)="changePickUpDeadline.emit($event)"
|
||||
>
|
||||
<app-ui-dropdown #deadlineDropdown [value]="orderDetails?.pickUpDeadline" (valueChange)="changePickUpDeadline.emit($event)">
|
||||
<ng-container *ngFor="let dl of pickupDeadlines | keyvalue">
|
||||
<button
|
||||
appUiDropdownItem
|
||||
class="isa-btn isa-text-left isa-p-16"
|
||||
[value]="dl.value"
|
||||
>
|
||||
<button appUiDropdownItem class="isa-btn isa-text-left isa-p-16" [value]="dl.value">
|
||||
{{ dl.key }}
|
||||
</button>
|
||||
</ng-container>
|
||||
|
||||
@@ -44,3 +44,9 @@
|
||||
.dp-button-icon.down {
|
||||
transform: rotate(-270deg);
|
||||
}
|
||||
|
||||
button:disabled.isa-btn {
|
||||
background: white !important;
|
||||
border: none !important;
|
||||
color: #567290 !important;
|
||||
}
|
||||
|
||||
@@ -7,59 +7,35 @@
|
||||
<div class="layout-content">
|
||||
<ng-container *ngIf="form">
|
||||
<form [formGroup]="form">
|
||||
<app-ui-text-input
|
||||
formControlName="compartmentCode"
|
||||
label="Abholfachnummer"
|
||||
></app-ui-text-input>
|
||||
<app-ui-text-input formControlName="compartmentCode" label="Abholfachnummer"></app-ui-text-input>
|
||||
<hr class="isa-content-spacer" />
|
||||
|
||||
<app-ui-text-input
|
||||
formControlName="orderNumber"
|
||||
label="Vorgang-ID"
|
||||
></app-ui-text-input>
|
||||
<app-ui-text-input formControlName="orderNumber" label="Vorgang-ID"></app-ui-text-input>
|
||||
<hr class="isa-content-spacer" />
|
||||
|
||||
<app-ui-text-input
|
||||
formControlName="orderDate"
|
||||
label="Bestelldatum"
|
||||
></app-ui-text-input>
|
||||
<app-ui-text-input formControlName="orderDate" label="Bestelldatum"></app-ui-text-input>
|
||||
<hr class="isa-content-spacer" />
|
||||
|
||||
<app-ui-text-input
|
||||
formControlName="clientChannel"
|
||||
label="Bestellkanal"
|
||||
></app-ui-text-input>
|
||||
<app-ui-text-input formControlName="clientChannel" label="Bestellkanal"></app-ui-text-input>
|
||||
<hr class="isa-content-spacer" />
|
||||
|
||||
<app-ui-text-input
|
||||
formControlName="buyerNumber"
|
||||
label="Kundennummer"
|
||||
></app-ui-text-input>
|
||||
<app-ui-text-input formControlName="buyerNumber" label="Kundennummer"></app-ui-text-input>
|
||||
<hr class="isa-content-spacer" />
|
||||
|
||||
<app-ui-select-input
|
||||
formControlName="processingStatus"
|
||||
label="Status"
|
||||
[options]="
|
||||
formService.processingStatus | processingStatusOptionsPipe
|
||||
"
|
||||
[options]="formService.processingStatus | processingStatusOptionsPipe"
|
||||
[labelPipe]="processingStatusPipe"
|
||||
[optionsPipe]="processingStatusPipe"
|
||||
></app-ui-select-input>
|
||||
<hr class="isa-content-spacer" />
|
||||
|
||||
<ng-container
|
||||
*ngIf="
|
||||
+form.get('processingStatus').value === 16 ||
|
||||
+form.get('processingStatus').value === 8192
|
||||
"
|
||||
>
|
||||
<ng-container *ngIf="+form.get('processingStatus').value === 16 || +form.get('processingStatus').value === 8192">
|
||||
<app-ui-select-input
|
||||
formControlName="estimatedShippingDate"
|
||||
label="Vsl. Lieferdatum"
|
||||
[options]="
|
||||
form.get('estimatedShippingDate').value | getExtendPickUpOptions
|
||||
"
|
||||
[options]="form.get('estimatedShippingDate').value | getExtendPickUpOptions"
|
||||
[labelPipe]="datePipe"
|
||||
[optionsPipe]="dateOptionsPipe"
|
||||
></app-ui-select-input>
|
||||
@@ -68,31 +44,31 @@
|
||||
|
||||
<ng-container *ngIf="+form.get('processingStatus').value === 128">
|
||||
<app-ui-select-input
|
||||
*ngIf="!(isPaid$ | async)"
|
||||
formControlName="pickUpDeadline"
|
||||
label="Abholfrist"
|
||||
[options]="
|
||||
form.get('pickUpDeadline').value | getExtendPickUpOptions
|
||||
"
|
||||
[options]="form.get('pickUpDeadline').value | getExtendPickUpOptions"
|
||||
[labelPipe]="datePipe"
|
||||
[optionsPipe]="dateOptionsPipe"
|
||||
></app-ui-select-input>
|
||||
<app-ui-select-input
|
||||
style="color: #567290;"
|
||||
*ngIf="isPaid$ | async"
|
||||
formControlName="pickUpDeadline"
|
||||
label="Abholfrist"
|
||||
[labelPipe]="datePipe"
|
||||
></app-ui-select-input>
|
||||
<hr class="isa-content-spacer" />
|
||||
</ng-container>
|
||||
|
||||
<div formArrayName="items">
|
||||
<ng-container
|
||||
*ngFor="let item of items.controls; let index = index"
|
||||
>
|
||||
<ng-container *ngFor="let item of items.controls; let index = index">
|
||||
<app-shelf-edit-order-item
|
||||
[orderItemForm]="item"
|
||||
[onlyChild]="items.controls.length === 1"
|
||||
[firstChild]="index === 0"
|
||||
[vatOptions]="formService.vats$ | async"
|
||||
[sscText]="
|
||||
item?.get('ssc')?.value
|
||||
| sscToSscText: item?.get('supplierId')?.value
|
||||
| async
|
||||
"
|
||||
[sscText]="item?.get('ssc')?.value | sscToSscText: item?.get('supplierId')?.value | async"
|
||||
></app-shelf-edit-order-item>
|
||||
</ng-container>
|
||||
</div>
|
||||
@@ -101,10 +77,5 @@
|
||||
</div>
|
||||
<div class="spacing"></div>
|
||||
</div>
|
||||
<app-shelf-edit-actions
|
||||
[disabled]="!form || !form.valid"
|
||||
(cancel)="onAbortEdit()"
|
||||
(save)="onSubmit()"
|
||||
>
|
||||
</app-shelf-edit-actions>
|
||||
<app-shelf-edit-actions [disabled]="!form || !form.valid" (cancel)="onAbortEdit()" (save)="onSubmit()"> </app-shelf-edit-actions>
|
||||
</div>
|
||||
|
||||
@@ -1,32 +1,16 @@
|
||||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorRef,
|
||||
} from '@angular/core';
|
||||
import { Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import {
|
||||
filter,
|
||||
map,
|
||||
distinctUntilChanged,
|
||||
shareReplay,
|
||||
take,
|
||||
withLatestFrom,
|
||||
first,
|
||||
} from 'rxjs/operators';
|
||||
import { filter, map, distinctUntilChanged, shareReplay, take, withLatestFrom, first } from 'rxjs/operators';
|
||||
import { isNullOrUndefined } from 'util';
|
||||
import { ShelfEditFormService } from '../../services';
|
||||
import { FormGroup, FormArray } from '@angular/forms';
|
||||
import {
|
||||
ProcessingStatusPipe,
|
||||
PickUpDateOptionsToDisplayValuesPipe,
|
||||
ProcessingStatusOptionsPipe,
|
||||
} from '../../pipes';
|
||||
import { ProcessingStatusPipe, PickUpDateOptionsToDisplayValuesPipe, ProcessingStatusOptionsPipe } from '../../pipes';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { ShelfNavigationService } from '../../shared/services';
|
||||
import { OrderItemProcessingStatusValue } from '@swagger/oms';
|
||||
import { ErrorService } from 'apps/sales/src/app/core/error/component/error.service';
|
||||
import { DetailsFacade } from '@shelf-store/details';
|
||||
|
||||
@Component({
|
||||
selector: 'app-shelf-edit-compartment',
|
||||
@@ -46,12 +30,15 @@ export class ShelfEditCompartmentComponent implements OnInit {
|
||||
dateOptionsPipe = new PickUpDateOptionsToDisplayValuesPipe();
|
||||
datePipe = new DatePipe('de');
|
||||
|
||||
isPaid$: Observable<boolean>;
|
||||
|
||||
constructor(
|
||||
private activatedRoute: ActivatedRoute,
|
||||
protected formService: ShelfEditFormService,
|
||||
private shelfNavigationService: ShelfNavigationService,
|
||||
private errorService: ErrorService,
|
||||
private cdr: ChangeDetectorRef
|
||||
private cdr: ChangeDetectorRef,
|
||||
private detailsFacade: DetailsFacade
|
||||
) {}
|
||||
|
||||
get compartmentCode$(): Observable<string> {
|
||||
@@ -66,10 +53,7 @@ export class ShelfEditCompartmentComponent implements OnInit {
|
||||
|
||||
get processingStatus$() {
|
||||
return this.activatedRoute.params.pipe(
|
||||
map(
|
||||
(params) =>
|
||||
Number(params.processingStatus) as OrderItemProcessingStatusValue
|
||||
),
|
||||
map((params) => Number(params.processingStatus) as OrderItemProcessingStatusValue),
|
||||
distinctUntilChanged(),
|
||||
shareReplay()
|
||||
);
|
||||
@@ -80,27 +64,16 @@ export class ShelfEditCompartmentComponent implements OnInit {
|
||||
}
|
||||
|
||||
async loadCompartmentAndInitForm() {
|
||||
const compartmentCode = await this.compartmentCode$
|
||||
.pipe(take(1))
|
||||
.toPromise();
|
||||
const processingStatus = await this.processingStatus$
|
||||
.pipe(take(1))
|
||||
.toPromise();
|
||||
const compartmentCode = await this.compartmentCode$.pipe(take(1)).toPromise();
|
||||
const processingStatus = await this.processingStatus$.pipe(take(1)).toPromise();
|
||||
|
||||
this.populateFormData(compartmentCode, processingStatus);
|
||||
}
|
||||
|
||||
async onSubmit() {
|
||||
const compartmentCode = await this.compartmentCode$
|
||||
.pipe(first())
|
||||
.toPromise();
|
||||
const processingStatus = await this.processingStatus$
|
||||
.pipe(first())
|
||||
.toPromise();
|
||||
const submitResult = await this.formService.submit(
|
||||
this.form,
|
||||
processingStatus
|
||||
);
|
||||
const compartmentCode = await this.compartmentCode$.pipe(first()).toPromise();
|
||||
const processingStatus = await this.processingStatus$.pipe(first()).toPromise();
|
||||
const submitResult = await this.formService.submit(this.form, processingStatus);
|
||||
|
||||
let newValues: {
|
||||
orderNumber?: string;
|
||||
@@ -109,10 +82,8 @@ export class ShelfEditCompartmentComponent implements OnInit {
|
||||
};
|
||||
if (submitResult.result) {
|
||||
newValues = {
|
||||
compartmentCode:
|
||||
this.form.get('compartmentCode').value || compartmentCode,
|
||||
processingStatus:
|
||||
this.form.get('processingStatus').value || processingStatus,
|
||||
compartmentCode: this.form.get('compartmentCode').value || compartmentCode,
|
||||
processingStatus: this.form.get('processingStatus').value || processingStatus,
|
||||
};
|
||||
|
||||
this.shelfNavigationService.navigateBackToDetails(newValues, {
|
||||
@@ -131,36 +102,27 @@ export class ShelfEditCompartmentComponent implements OnInit {
|
||||
}
|
||||
|
||||
onAbortEdit() {
|
||||
return this.compartmentCode$
|
||||
.pipe(take(1), withLatestFrom(this.processingStatus$))
|
||||
.subscribe(([compartmentCode, processingStatus]) =>
|
||||
this.shelfNavigationService.navigateBackToDetails({
|
||||
compartmentCode,
|
||||
processingStatus,
|
||||
})
|
||||
);
|
||||
return this.compartmentCode$.pipe(take(1), withLatestFrom(this.processingStatus$)).subscribe(([compartmentCode, processingStatus]) =>
|
||||
this.shelfNavigationService.navigateBackToDetails({
|
||||
compartmentCode,
|
||||
processingStatus,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private async populateFormData(
|
||||
compartmentCode: string,
|
||||
processingStatus: OrderItemProcessingStatusValue
|
||||
) {
|
||||
this.form = await this.formService.createFormByCompartmentCode(
|
||||
compartmentCode,
|
||||
processingStatus
|
||||
);
|
||||
private async populateFormData(compartmentCode: string, processingStatus: OrderItemProcessingStatusValue) {
|
||||
this.form = await this.formService.createFormByCompartmentCode(compartmentCode, processingStatus);
|
||||
const orderNumber = this.form?.get('orderNumber')?.value;
|
||||
this.isPaid$ = this.detailsFacade
|
||||
.getOrderItemsByOrderNumber$(orderNumber)
|
||||
.pipe(map((orderItems) => !!orderItems?.find((orderItem) => !!orderItem?.features?.paid)));
|
||||
this.items = this.formService.getItemsForm(compartmentCode);
|
||||
this.customerName = this.formService.getCustomerName(compartmentCode);
|
||||
this.cdr.detectChanges();
|
||||
}
|
||||
|
||||
private showSubmitError(error: {
|
||||
message: string;
|
||||
code: number;
|
||||
invalidProperties: { [key: string]: string };
|
||||
}) {
|
||||
const invalidProperties =
|
||||
Object.values(error.invalidProperties).join(', ') || undefined;
|
||||
private showSubmitError(error: { message: string; code: number; invalidProperties: { [key: string]: string } }) {
|
||||
const invalidProperties = Object.values(error.invalidProperties).join(', ') || undefined;
|
||||
|
||||
this.errorService.addErrors(error.code, error.message, invalidProperties);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user