feature-libs/order/components/amend-order/amend-order-actions/amend-order-actions.component.ts
| changeDetection | ChangeDetectionStrategy.OnPush |
| selector | cx-amend-order-actions |
| templateUrl | ./amend-order-actions.component.html |
Properties |
Methods |
Inputs |
HostBindings |
constructor(routingService: RoutingService)
|
||||||
|
Parameters :
|
| amendOrderForm | |
Type : FormGroup
|
|
| backRoute | |
Type : string
|
|
| forwardRoute | |
Type : string
|
|
| orderCode | |
Type : string
|
|
| class |
Type : string
|
Default value : 'row'
|
| continue | ||||||
continue(event: Event)
|
||||||
|
Parameters :
Returns :
void
|
| amendOrderForm |
Type : FormGroup
|
Decorators :
@Input()
|
| backRoute |
Type : string
|
Decorators :
@Input()
|
| forwardRoute |
Type : string
|
Decorators :
@Input()
|
| orderCode |
Type : string
|
Decorators :
@Input()
|
| styles |
Type : string
|
Default value : 'row'
|
Decorators :
@HostBinding('class')
|
import {
ChangeDetectionStrategy,
Component,
HostBinding,
Input,
} from '@angular/core';
import { RoutingService } from '@spartacus/core';
import { FormGroup } from '@angular/forms';
@Component({
selector: 'cx-amend-order-actions',
templateUrl: './amend-order-actions.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AmendOrderActionsComponent {
@Input() orderCode: string;
@Input() amendOrderForm: FormGroup;
@Input() backRoute: string;
@Input() forwardRoute: string;
@HostBinding('class') styles = 'row';
constructor(protected routingService: RoutingService) {}
continue(event: Event): void {
if (this.amendOrderForm.valid) {
this.routingService.go({
cxRoute: this.forwardRoute,
params: { code: this.orderCode },
});
} else {
this.amendOrderForm.markAllAsTouched();
event.stopPropagation();
}
}
}
<div class="col-xs-12 col-md-4 col-lg-3">
<a
[routerLink]="
{
cxRoute: backRoute,
params: { code: orderCode }
} | cxUrl
"
class="btn btn-block btn-action"
>
{{ 'common.back' | cxTranslate }}
</a>
</div>
<div class="col-xs-12 col-md-4 col-lg-3">
<button
*ngIf="forwardRoute"
class="btn btn-block btn-primary"
(click)="continue($event)"
>
{{ 'common.continue' | cxTranslate }}
</button>
<button *ngIf="!forwardRoute" class="btn btn-block btn-primary" type="submit">
{{ 'orderDetails.cancellationAndReturn.submit' | cxTranslate }}
</button>
</div>