added edit function
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { Component } from '@angular/core';
|
||||
import {Component, effect, input} from '@angular/core';
|
||||
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms";
|
||||
import {NzColDirective} from "ng-zorro-antd/grid";
|
||||
import {NzFlexDirective} from "ng-zorro-antd/flex";
|
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
|
||||
import {NzInputDirective} from "ng-zorro-antd/input";
|
||||
import {GetPurchaseOrderDto, GetQuotationDto} from "../../services/api";
|
||||
|
||||
@Component({
|
||||
selector: 'app-purchase-order-form',
|
||||
@@ -23,6 +24,17 @@ import {NzInputDirective} from "ng-zorro-antd/input";
|
||||
})
|
||||
export class PurchaseOrderForm {
|
||||
purchaseOrderForm: FormGroup = new FormGroup({
|
||||
purchaseCondition: new FormControl<string>(null,[Validators.required])
|
||||
purchaseConditions: new FormControl<string>(null,[Validators.required])
|
||||
})
|
||||
|
||||
purchaseOrder= input<GetPurchaseOrderDto>();
|
||||
constructor() {
|
||||
effect(() => {
|
||||
if (this.purchaseOrder()) {
|
||||
this.purchaseOrderForm.patchValue({
|
||||
purchaseConditions: this.purchaseOrder().purchaseConditions,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user