Save Bill Works
This commit is contained in:
37
bookie/src/app/sales/quantity/quantity.component.ts
Normal file
37
bookie/src/app/sales/quantity/quantity.component.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-quantity',
|
||||
templateUrl: './quantity.component.html',
|
||||
styleUrls: ['./quantity.component.css']
|
||||
})
|
||||
export class QuantityComponent implements OnInit {
|
||||
form: FormGroup;
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<QuantityComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: number,
|
||||
private fb: FormBuilder,
|
||||
) {
|
||||
this.createForm();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.form.setValue({
|
||||
quantity: this.data
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
quantity: ''
|
||||
});
|
||||
}
|
||||
|
||||
accept(): void {
|
||||
const quantity = this.form.value.quantity;
|
||||
this.dialogRef.close(quantity);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user