Skip to content

Commit eaa7bb3

Browse files
committed
rework from review
1 parent a2bd919 commit eaa7bb3

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

Diff for: integration-libs/punchout/components/punchout-requisition/punchout-requisition.component.html

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
[formGroup]="punchoutFormGroup"
88
#punchoutFormElement
99
>
10-
<input name="orderAsCXML" formControlName="order" type="hidden" value="" />
10+
<input
11+
name="orderAsCXML"
12+
formControlName="{{ FORM_CONTROL_NAME.ORDER }}"
13+
type="hidden"
14+
value=""
15+
/>
1116
</form>
1217
</ng-container>

Diff for: integration-libs/punchout/components/punchout-requisition/punchout-requisition.component.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { filter, map, Observable, switchMap, take, tap, timer } from 'rxjs';
2424
@Component({
2525
selector: 'cx-punchout-requsition',
2626
templateUrl: './punchout-requisition.component.html',
27-
changeDetection: ChangeDetectionStrategy.Default,
27+
changeDetection: ChangeDetectionStrategy.OnPush,
2828
standalone: false,
2929
})
3030
export class PunchoutRequisitionComponent implements OnInit {
@@ -36,6 +36,10 @@ export class PunchoutRequisitionComponent implements OnInit {
3636

3737
protected formBuilder = inject(FormBuilder);
3838

39+
readonly FORM_CONTROL_NAME = {
40+
ORDER: 'order',
41+
} as const;
42+
3943
punchoutRequisition$: Observable<PunchoutRequisition | undefined> =
4044
this.punchoutFacade.getPunchoutSessionRequisition().pipe(
4145
take(1),
@@ -56,14 +60,16 @@ export class PunchoutRequisitionComponent implements OnInit {
5660

5761
ngOnInit(): void {
5862
this.punchoutFormGroup = this.formBuilder.group({
59-
order: [''],
63+
[this.FORM_CONTROL_NAME.ORDER]: [''],
6064
});
6165
}
6266

6367
protected listenAndSubmitForm(
6468
req: PunchoutRequisition | undefined
6569
): Observable<boolean> {
66-
return this.punchoutFormGroup.controls['order'].valueChanges.pipe(
70+
return this.punchoutFormGroup.controls[
71+
this.FORM_CONTROL_NAME.ORDER
72+
].valueChanges.pipe(
6773
filter((value: string) => value === req?.orderAsCXML),
6874
take(1),
6975
switchMap(() => {

0 commit comments

Comments
 (0)