File

feature-libs/order/components/amend-order/returns/return-order-confirmation/return-order-confirmation.component.ts

Metadata

changeDetection ChangeDetectionStrategy.OnPush
selector cx-return-order-confirmation
templateUrl ./return-order-confirmation.component.html

Index

Properties
Methods

Constructor

constructor(orderAmendService: OrderAmendService)
Parameters :
Name Type Optional
orderAmendService OrderAmendService No

Methods

submit
submit(form: FormGroup)
Parameters :
Name Type Optional
form FormGroup No
Returns : void

Properties

entries$
Type : Observable<OrderEntry[]>
Default value : this.orderAmendService.getAmendedEntries()
form$
Default value : this.orderAmendService .getForm() .pipe(tap((form) => (this.orderCode = form.value.orderCode)))
orderCode
Type : string
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { OrderEntry } from '@spartacus/core';
import { Observable } from 'rxjs';
import { tap } from 'rxjs/operators';
import { OrderAmendService } from '../../amend-order.service';

@Component({
  selector: 'cx-return-order-confirmation',
  templateUrl: './return-order-confirmation.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ReturnOrderConfirmationComponent {
  orderCode: string;

  form$ = this.orderAmendService
    .getForm()
    .pipe(tap((form) => (this.orderCode = form.value.orderCode)));

  entries$: Observable<OrderEntry[]> =
    this.orderAmendService.getAmendedEntries();

  constructor(protected orderAmendService: OrderAmendService) {}

  submit(form: FormGroup): void {
    form.disable();
    this.orderAmendService.save();
  }
}
<form
  *ngIf="form$ | async as form"
  [formGroup]="form"
  (ngSubmit)="submit(form)"
>
  <ng-container *ngTemplateOutlet="actions"></ng-container>

  <cx-amend-order-items
    *ngIf="entries$ | async as entries"
    [entries]="entries"
    [isConfirmation]="true"
  >
  </cx-amend-order-items>

  <ng-container *ngTemplateOutlet="actions"></ng-container>

  <ng-template #actions>
    <cx-amend-order-actions
      *ngIf="orderCode"
      [orderCode]="orderCode"
      [amendOrderForm]="form"
      backRoute="orderReturn"
    ></cx-amend-order-actions>
  </ng-template>
</form>
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""