mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
#1407 Checkout Updated Process Cart Entries Number
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
class="process-cart-icon"
|
||||
></lib-icon>
|
||||
<div [@cartnumber]="cartanimation" class="pt-3 process-cart-number-container">
|
||||
<span class="process-cart-number" [ngClass]="{ 'number-download': cartBackgroundForDownload }">{{ cartCount }}</span>
|
||||
<span class="process-cart-number" [ngClass]="{ 'number-download': cartBackgroundForDownload }">{{ cartCount$ | async }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
@@ -35,6 +35,7 @@ import { ModuleSwitcher } from '../../core/models/app-switcher.enum';
|
||||
import { USER_FORM_STATE_KEY, USER_EXTRAS_FORM_STATE_KEY, USER_ERRORS_FORM_STATE_KEY } from '../../core/utils/app.constants';
|
||||
import { DeleteFormState } from '../../core/store/actions/forms.actions';
|
||||
import { ApplicationService } from '@core/application';
|
||||
import { DomainCheckoutService } from '@domain/checkout';
|
||||
|
||||
@Component({
|
||||
selector: 'app-process-tab',
|
||||
@@ -70,7 +71,7 @@ export class ProcessTabComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
destroy$ = new Subject();
|
||||
@ViewChild('deleteporcessdialog')
|
||||
processDeleteDialogComponent: ProcessDeleteDialogComponent;
|
||||
cartCount = 0;
|
||||
cartCount$: Observable<number>;
|
||||
cartanimation = '';
|
||||
cartBackgroundForDownload = false;
|
||||
|
||||
@@ -79,7 +80,8 @@ export class ProcessTabComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
private router: Router,
|
||||
private cdr: ChangeDetectorRef,
|
||||
private route: ActivatedRoute,
|
||||
private applicationService: ApplicationService
|
||||
private applicationService: ApplicationService,
|
||||
private domainCheckoutService: DomainCheckoutService
|
||||
) {}
|
||||
isProcessFinished = this.router.url === '/cart/confirmation';
|
||||
|
||||
@@ -134,20 +136,30 @@ export class ProcessTabComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.store
|
||||
.select(SharedSelectors.getCartTabData)
|
||||
.pipe(
|
||||
takeUntil(this.destroy$),
|
||||
map((filterFn) => filterFn(this.process.id))
|
||||
)
|
||||
.subscribe((quantity: number) => {
|
||||
if (quantity < this.cartCount) {
|
||||
this.cartanimation = 'delete';
|
||||
this.cartCount$ = this.domainCheckoutService.getShoppingCart({ processId: this.process.id }).pipe(
|
||||
map((response) => {
|
||||
if (response?.items?.length === undefined) {
|
||||
return 0;
|
||||
} else {
|
||||
return response?.items?.length;
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
this.cartCount = quantity;
|
||||
this.cdr.detectChanges();
|
||||
});
|
||||
// this.store
|
||||
// .select(SharedSelectors.getCartTabData)
|
||||
// .pipe(
|
||||
// takeUntil(this.destroy$),
|
||||
// map((filterFn) => filterFn(this.process.id))
|
||||
// )
|
||||
// .subscribe((quantity: number) => {
|
||||
// if (quantity < this.cartCount) {
|
||||
// this.cartanimation = 'delete';
|
||||
// }
|
||||
|
||||
// this.cartCount = quantity;
|
||||
// this.cdr.detectChanges();
|
||||
// });
|
||||
|
||||
this.store
|
||||
.select(ProcessSelectors.getCurrentRoute)
|
||||
|
||||
Reference in New Issue
Block a user