feat: enhance inner pages header with back button functionality and emit event on back click
fix: update total price info handling in correction form and ensure accurate calculations refactor: streamline sale invoice single view component by extracting info card into a separate component style: adjust button sizes in payment forms for better UI consistency feat: implement season picker navigation controls to prevent out-of-bounds selection fix: improve price formatting utility to handle undefined values gracefully chore: update environment configuration for API base URL feat: add navigation service to manage routing history and back navigation
This commit is contained in:
@@ -18,7 +18,7 @@ interface SeasonItem {
|
||||
imports: [CommonModule, Button, SeasonPickerDialogComponent],
|
||||
})
|
||||
export class SeasonPickerComponent implements OnInit {
|
||||
@Input() minYear = 1390;
|
||||
@Input() minYear = 1404;
|
||||
@Input() maxYear = Number(nowJalali(JALALI_DATE_FORMATS.YEAR));
|
||||
@Input() value!: Date;
|
||||
|
||||
@@ -66,13 +66,29 @@ export class SeasonPickerComponent implements OnInit {
|
||||
this.isOpen.set(false);
|
||||
}
|
||||
|
||||
canGoPrev(): boolean {
|
||||
const index = this.selectedSeason();
|
||||
const currentYear = this.selectedYear();
|
||||
const nextSeason = index === 0 ? 3 : ((index - 1) as SeasonKey);
|
||||
const nextYear = index === 0 ? currentYear - 1 : currentYear;
|
||||
return this.isWithinBounds(nextYear, nextSeason);
|
||||
}
|
||||
|
||||
canGoNext(): boolean {
|
||||
const index = this.selectedSeason();
|
||||
const currentYear = this.selectedYear();
|
||||
const nextSeason = index === 3 ? 0 : ((index + 1) as SeasonKey);
|
||||
const nextYear = index === 3 ? currentYear + 1 : currentYear;
|
||||
return this.isWithinBounds(nextYear, nextSeason);
|
||||
}
|
||||
|
||||
prevSeason(): void {
|
||||
const index = this.selectedSeason();
|
||||
const currentYear = this.selectedYear();
|
||||
const nextSeason = index === 0 ? 3 : ((index - 1) as SeasonKey);
|
||||
const nextYear = index === 0 ? currentYear - 1 : currentYear;
|
||||
|
||||
// if (!this.isWithinBounds(nextYear, nextSeason)) return;
|
||||
if (!this.isWithinBounds(nextYear, nextSeason)) return;
|
||||
|
||||
this.selectedYear.set(nextYear);
|
||||
this.selectedSeason.set(nextSeason);
|
||||
@@ -85,14 +101,19 @@ export class SeasonPickerComponent implements OnInit {
|
||||
const nextSeason = index === 3 ? 0 : ((index + 1) as SeasonKey);
|
||||
const nextYear = index === 3 ? currentYear + 1 : currentYear;
|
||||
|
||||
if (!this.isWithinBounds(nextYear, nextSeason)) return;
|
||||
|
||||
this.selectedYear.set(nextYear);
|
||||
this.selectedSeason.set(nextSeason);
|
||||
this.emitValue();
|
||||
}
|
||||
|
||||
submitPicker(value: { year: number; season: number }): void {
|
||||
const season = value.season as SeasonKey;
|
||||
if (!this.isWithinBounds(value.year, season)) return;
|
||||
|
||||
this.selectedYear.set(value.year);
|
||||
this.selectedSeason.set(value.season as SeasonKey);
|
||||
this.selectedSeason.set(season);
|
||||
this.emitValue();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user