Feature: In the Beer Sale Report, you can choose the type of consumption
Chore: Sorted the product sale report by name Fix: Voided bills now also include the old bill number
This commit is contained in:
@ -14,6 +14,10 @@ export class BeerSaleReportResolver implements Resolve<BeerSaleReport> {
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<BeerSaleReport> {
|
||||
const startDate = route.queryParamMap.get('startDate') || null;
|
||||
const finishDate = route.queryParamMap.get('finishDate') || null;
|
||||
return this.ser.get(startDate, finishDate);
|
||||
const regular = route.queryParamMap.get('regular') !== 'false';
|
||||
const happy = route.queryParamMap.get('happy') !== 'false';
|
||||
const staff = route.queryParamMap.get('staff') !== 'false';
|
||||
const nc = route.queryParamMap.get('nc') !== 'false';
|
||||
return this.ser.get(startDate, finishDate, regular, happy, staff, nc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,3 +2,6 @@
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.example-margin {
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
@ -40,6 +40,14 @@
|
||||
</mat-form-field>
|
||||
<button fxFlex="20" mat-raised-button color="primary" (click)="show()">Show</button>
|
||||
</div>
|
||||
<div>
|
||||
<mat-checkbox class="example-margin" formControlName="regular">Regular</mat-checkbox>
|
||||
<mat-checkbox class="example-margin" formControlName="happy">Happy Hour</mat-checkbox>
|
||||
<mat-checkbox class="example-margin" formControlName="staff"
|
||||
>Staff Consumption</mat-checkbox
|
||||
>
|
||||
<mat-checkbox class="example-margin" formControlName="nc">No Charge</mat-checkbox>
|
||||
</div>
|
||||
</form>
|
||||
<mat-table #table [dataSource]="dataSource" aria-label="Elements">
|
||||
<!-- Date Column -->
|
||||
|
||||
@ -32,6 +32,10 @@ export class BeerSaleReportComponent implements OnInit {
|
||||
this.form = this.fb.group({
|
||||
startDate: '',
|
||||
finishDate: '',
|
||||
regular: true,
|
||||
happy: true,
|
||||
staff: true,
|
||||
nc: true,
|
||||
});
|
||||
}
|
||||
|
||||
@ -43,6 +47,10 @@ export class BeerSaleReportComponent implements OnInit {
|
||||
this.form.setValue({
|
||||
startDate: moment(this.info.startDate, 'DD-MMM-YYYY').toDate(),
|
||||
finishDate: moment(this.info.finishDate, 'DD-MMM-YYYY').toDate(),
|
||||
regular: this.info.regular,
|
||||
happy: this.info.happy,
|
||||
staff: this.info.staff,
|
||||
nc: this.info.nc,
|
||||
});
|
||||
this.dataSource = new BeerSaleReportDataSource(this.info.data);
|
||||
});
|
||||
@ -54,6 +62,10 @@ export class BeerSaleReportComponent implements OnInit {
|
||||
queryParams: {
|
||||
startDate: info.startDate,
|
||||
finishDate: info.finishDate,
|
||||
regular: info.regular,
|
||||
happy: info.happy,
|
||||
staff: info.staff,
|
||||
nc: info.nc,
|
||||
},
|
||||
});
|
||||
}
|
||||
@ -64,6 +76,10 @@ export class BeerSaleReportComponent implements OnInit {
|
||||
return new BeerSaleReport({
|
||||
startDate: moment(formModel.startDate).format('DD-MMM-YYYY'),
|
||||
finishDate: moment(formModel.finishDate).format('DD-MMM-YYYY'),
|
||||
regular: formModel.regular,
|
||||
happy: formModel.happy,
|
||||
staff: formModel.staff,
|
||||
nc: formModel.nc,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ import { MomentDateAdapter } from '@angular/material-moment-adapter';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import {
|
||||
DateAdapter,
|
||||
MAT_DATE_FORMATS,
|
||||
@ -55,6 +56,7 @@ export const MY_FORMATS = {
|
||||
ReactiveFormsModule,
|
||||
SharedModule,
|
||||
BeerSaleReportRoutingModule,
|
||||
MatCheckboxModule,
|
||||
],
|
||||
declarations: [BeerSaleReportComponent],
|
||||
providers: [
|
||||
|
||||
@ -16,7 +16,14 @@ const serviceName = 'BeerSaleReportService';
|
||||
export class BeerSaleReportService {
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
|
||||
|
||||
get(startDate: string | null, finishDate: string | null): Observable<BeerSaleReport> {
|
||||
get(
|
||||
startDate: string | null,
|
||||
finishDate: string | null,
|
||||
regular: boolean,
|
||||
happy: boolean,
|
||||
staff: boolean,
|
||||
nc: boolean,
|
||||
): Observable<BeerSaleReport> {
|
||||
const options = { params: new HttpParams() };
|
||||
if (startDate !== null) {
|
||||
options.params = options.params.set('s', startDate);
|
||||
@ -24,6 +31,10 @@ export class BeerSaleReportService {
|
||||
if (finishDate !== null) {
|
||||
options.params = options.params.set('f', finishDate);
|
||||
}
|
||||
options.params = options.params.set('r', regular);
|
||||
options.params = options.params.set('h', happy);
|
||||
options.params = options.params.set('st', staff);
|
||||
options.params = options.params.set('n', nc);
|
||||
return this.http
|
||||
.get<BeerSaleReport>(url, options)
|
||||
.pipe(catchError(this.log.handleError(serviceName, 'get'))) as Observable<BeerSaleReport>;
|
||||
|
||||
@ -3,12 +3,20 @@ import { BeerSaleReportItem } from './beer-sale-report-item';
|
||||
export class BeerSaleReport {
|
||||
startDate: string;
|
||||
finishDate: string;
|
||||
regular: boolean;
|
||||
happy: boolean;
|
||||
staff: boolean;
|
||||
nc: boolean;
|
||||
headers: string[];
|
||||
data: BeerSaleReportItem[];
|
||||
|
||||
public constructor(init?: Partial<BeerSaleReport>) {
|
||||
this.startDate = '';
|
||||
this.finishDate = '';
|
||||
this.regular = true;
|
||||
this.happy = true;
|
||||
this.staff = true;
|
||||
this.nc = true;
|
||||
this.data = [];
|
||||
this.headers = [];
|
||||
Object.assign(this, init);
|
||||
|
||||
Reference in New Issue
Block a user