Save Bill Works

This commit is contained in:
Amritanshu
2019-07-13 21:32:18 +05:30
parent bcad4cdae3
commit 7d06a2f961
43 changed files with 660 additions and 349 deletions

View File

@ -0,0 +1,17 @@
<div mat-dialog-content>
<form [formGroup]="form">
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<mat-form-field fxFlex>
<mat-label>Quantity</mat-label>
<input type="text" matInput #quantity placeholder="Quantity" formControlName="quantity" autocomplete="off"
(focus)="quantity.select()" cdkFocusInitial>
</mat-form-field>
</div>
</form>
</div>
<div mat-dialog-actions>
<button mat-button [mat-dialog-close]="false">Cancel</button>
<button mat-button (click)="accept()" color="primary">Ok</button>
</div>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { QuantityComponent } from './quantity.component';
describe('QuantityComponent', () => {
let component: QuantityComponent;
let fixture: ComponentFixture<QuantityComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ QuantityComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(QuantityComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View 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);
}
}