feat(pos): add shop and statistics modules with components, services, and routing
- Implemented shop module with root component, loading state, and invoice handling. - Created statistics module with invoice type card component, API routes, and data models. - Added season picker component for selecting year and season. - Integrated services for fetching statistics data and managing state. - Established routing for statistics and shop views.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, computed, EventEmitter, Input, Output, signal } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { ButtonDirective, ButtonSeverity } from 'primeng/button';
|
||||
import { SharedLightBottomsheetComponent } from '../dialog/light-bottomsheet.component';
|
||||
import { FormFooterActionsComponent } from '../formFooterActions/form-footer-actions.component';
|
||||
|
||||
type SeasonKey = 0 | 1 | 2 | 3;
|
||||
|
||||
interface SeasonItem {
|
||||
key: SeasonKey;
|
||||
label: string;
|
||||
severity: ButtonSeverity;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'season-picker-dialog',
|
||||
templateUrl: './season-picker-dialog.component.html',
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
SharedLightBottomsheetComponent,
|
||||
FormFooterActionsComponent,
|
||||
ButtonDirective,
|
||||
],
|
||||
})
|
||||
export class SeasonPickerDialogComponent extends AbstractDialog {
|
||||
@Input() years: { year: number; value: number }[] = [];
|
||||
@Input() selectedYear!: number;
|
||||
@Input() selectedSeason!: SeasonKey;
|
||||
@Input() seasons: SeasonItem[] = [];
|
||||
|
||||
@Output() submit = new EventEmitter<{ year: number; season: number }>();
|
||||
|
||||
selectedYearDraft = signal(this.selectedYear);
|
||||
selectedSeasonDraft = signal(this.selectedSeason);
|
||||
|
||||
isSeasonDisabled = computed(() => this.selectedYear >= this.selectedYearDraft());
|
||||
|
||||
onSubmit(): void {
|
||||
this.submit.emit({
|
||||
year: this.selectedYearDraft(),
|
||||
season: this.selectedSeasonDraft(),
|
||||
});
|
||||
this.close();
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
this.selectedYearDraft.set(this.selectedYear);
|
||||
this.selectedSeasonDraft.set(this.selectedSeason);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user