mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Merged in bugfix/HIMA-1200 (pull request #1236)
[HIMA-1200] fixed error ViewDestroyError
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
ViewChild,
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorRef,
|
||||
OnDestroy,
|
||||
OnDestroy
|
||||
} from '@angular/core';
|
||||
import { ModalService } from '@libs/ui';
|
||||
import { Store, Select } from '@ngxs/store';
|
||||
@@ -30,6 +30,7 @@ import { CheckoutService } from 'apps/sales/src/app/core/services/checkout.servi
|
||||
import { SearchDropdownComponent } from '@libs/ui/lib/search-dropdown';
|
||||
import { ItemDTO } from 'swagger';
|
||||
import { allowedAvailabilityStatusCodes } from '../../../../core/utils/product.util';
|
||||
import { ViewRef_ } from '@angular/core/src/view';
|
||||
|
||||
export interface ProcessAvailibilityMapper {
|
||||
branchId: number;
|
||||
@@ -41,7 +42,7 @@ export interface ProcessAvailibilityMapper {
|
||||
selector: 'app-change-order-type',
|
||||
templateUrl: './change-order-type.component.html',
|
||||
styleUrls: ['./change-order-type.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class ChangeOrderTypeComponent implements OnInit, OnDestroy {
|
||||
@Select(BranchSelectors.getBranches) branches$: Observable<{ [key: number]: BranchDTO }>;
|
||||
@@ -62,7 +63,7 @@ export class ChangeOrderTypeComponent implements OnInit, OnDestroy {
|
||||
deliveryOptions = {
|
||||
delivery: DeliveryOption.DELIVERY,
|
||||
now: DeliveryOption.TAKE_NOW,
|
||||
pick_up: DeliveryOption.PICK_UP,
|
||||
pick_up: DeliveryOption.PICK_UP
|
||||
};
|
||||
|
||||
branches: string[] = [];
|
||||
@@ -95,7 +96,8 @@ export class ChangeOrderTypeComponent implements OnInit, OnDestroy {
|
||||
get storeAvailable() {
|
||||
if (
|
||||
this.availability.filter(
|
||||
t => t.type === CheckoutType.store &&
|
||||
t =>
|
||||
t.type === CheckoutType.store &&
|
||||
(allowedAvailabilityStatusCodes(t.status) || (t.av && t.av.ssc === '830' && t.av.supplier === 'G'))
|
||||
).length > 0
|
||||
) {
|
||||
@@ -213,7 +215,7 @@ export class ChangeOrderTypeComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
this.loaded.emit(true);
|
||||
this.cdr.detectChanges();
|
||||
this.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -276,7 +278,7 @@ export class ChangeOrderTypeComponent implements OnInit, OnDestroy {
|
||||
qty: +quantity,
|
||||
ssc: '999',
|
||||
price: this._item.book.catalogAvailability.price,
|
||||
supplierId: this.takeNowSuplierId,
|
||||
supplierId: this.takeNowSuplierId
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -285,7 +287,7 @@ export class ChangeOrderTypeComponent implements OnInit, OnDestroy {
|
||||
return {
|
||||
branchId: userBranch.id,
|
||||
type: CheckoutType.takeNow,
|
||||
av: takeNowAv,
|
||||
av: takeNowAv
|
||||
};
|
||||
})
|
||||
);
|
||||
@@ -325,7 +327,7 @@ export class ChangeOrderTypeComponent implements OnInit, OnDestroy {
|
||||
quantity: item.av.length,
|
||||
type: item.type,
|
||||
av: preferredAvailability,
|
||||
status: av.status,
|
||||
status: av.status
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -391,13 +393,13 @@ export class ChangeOrderTypeComponent implements OnInit, OnDestroy {
|
||||
quantity: response.av.length,
|
||||
type: CheckoutType.store,
|
||||
av: preferedAv ? preferedAv : response.av[0],
|
||||
status: t.status,
|
||||
status: t.status
|
||||
});
|
||||
});
|
||||
}
|
||||
this.branchesdd.stopLoading();
|
||||
this.branchLoad = false;
|
||||
this.cdr.detectChanges();
|
||||
this.detectChanges();
|
||||
this.searchingNewBranch = false;
|
||||
});
|
||||
}
|
||||
@@ -459,4 +461,12 @@ export class ChangeOrderTypeComponent implements OnInit, OnDestroy {
|
||||
ngOnDestroy() {
|
||||
this.destroy$.next();
|
||||
}
|
||||
|
||||
detectChanges() {
|
||||
setTimeout(() => {
|
||||
if (this.cdr !== null && this.cdr !== undefined && !(this.cdr as ViewRef_).destroyed) {
|
||||
this.cdr.detectChanges();
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import { Address } from '../../../../core/models/user.model';
|
||||
import { isArrayMinLength } from '../../../../core/utils/app.utils';
|
||||
import { DeleteProductFromCart } from 'apps/sales/src/app/core/store/actions/cart.actions';
|
||||
import { cartItem } from 'apps/sales/src/app/shared/animations/cart-item.animation';
|
||||
import { ViewRef_ } from '@angular/core/src/view';
|
||||
|
||||
@Component({
|
||||
selector: 'app-delivery-cart',
|
||||
@@ -74,7 +75,7 @@ export class DeliveryCartComponent implements OnInit, OnDestroy {
|
||||
const { first_name, last_name, street, streetNo, zip, city } = customer.delivery_addres;
|
||||
this.deliveryAddress = `${first_name} ${last_name} | ${street} ${streetNo}, ${zip} ${city}`;
|
||||
}
|
||||
this.cdr.detectChanges();
|
||||
this.detectChanges();
|
||||
}
|
||||
|
||||
redirectToBilling() {
|
||||
@@ -161,4 +162,12 @@ export class DeliveryCartComponent implements OnInit, OnDestroy {
|
||||
this.store.dispatch(new DeleteProductFromCart(item.cartId, item.cartEntryId));
|
||||
}
|
||||
}
|
||||
|
||||
detectChanges() {
|
||||
setTimeout(() => {
|
||||
if (this.cdr !== null && this.cdr !== undefined && !(this.cdr as ViewRef_).destroyed) {
|
||||
this.cdr.detectChanges();
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { SetUserDetails } from '../../../../core/store/actions/customer.actions'
|
||||
import { CustomValidators } from '../../../../shared/validation/custom-validation';
|
||||
import { SharedSelectors } from '../../../../core/store/selectors/shared.selectors';
|
||||
import { User } from '../../../../core/models/user.model';
|
||||
import { ViewRef_ } from '@angular/core/src/view';
|
||||
|
||||
@Component({
|
||||
selector: 'app-notification-settings',
|
||||
@@ -36,7 +37,7 @@ export class NotificationSettingsComponent implements OnInit, OnDestroy {
|
||||
this.setEmailNotification();
|
||||
}
|
||||
|
||||
this.cdr.detectChanges();
|
||||
this.detectChanges();
|
||||
}
|
||||
|
||||
get isDelivery() {
|
||||
@@ -72,7 +73,7 @@ export class NotificationSettingsComponent implements OnInit, OnDestroy {
|
||||
) {
|
||||
this.store.dispatch(new SetUserDetails(updateUserData, false));
|
||||
}
|
||||
this.cdr.detectChanges();
|
||||
this.detectChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,4 +268,12 @@ export class NotificationSettingsComponent implements OnInit, OnDestroy {
|
||||
this.editMode = mode;
|
||||
this.notificationInEditMode.emit(mode);
|
||||
}
|
||||
|
||||
detectChanges() {
|
||||
setTimeout(() => {
|
||||
if (this.cdr !== null && this.cdr !== undefined && !(this.cdr as ViewRef_).destroyed) {
|
||||
this.cdr.detectChanges();
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1041,7 +1041,7 @@ export class CreateCustomerCardComponent implements OnInit, OnDestroy {
|
||||
|
||||
openSuggestions() {
|
||||
if (this.addressSuggestions && this.addressSuggestions.length > 0) {
|
||||
this.cdrf.detectChanges();
|
||||
this.detectChanges();
|
||||
this.suggestions.openDialog();
|
||||
}
|
||||
this.postBtn.stopLoading();
|
||||
|
||||
Reference in New Issue
Block a user