diff --git a/src-ui/src/app/components/common/dates-dropdown/dates-dropdown.component.html b/src-ui/src/app/components/common/dates-dropdown/dates-dropdown.component.html
index c3ff61ba8..e80bedc1d 100644
--- a/src-ui/src/app/components/common/dates-dropdown/dates-dropdown.component.html
+++ b/src-ui/src/app/components/common/dates-dropdown/dates-dropdown.component.html
@@ -40,17 +40,8 @@
@@ -66,20 +57,16 @@
+
+
+
+
+
@@ -143,21 +121,29 @@
+
+
+
+
+
+
+
+ {{ date.day }}
+
+
diff --git a/src-ui/src/app/components/common/dates-dropdown/dates-dropdown.component.scss b/src-ui/src/app/components/common/dates-dropdown/dates-dropdown.component.scss
index ebd34b29a..ba4180ba2 100644
--- a/src-ui/src/app/components/common/dates-dropdown/dates-dropdown.component.scss
+++ b/src-ui/src/app/components/common/dates-dropdown/dates-dropdown.component.scss
@@ -2,7 +2,7 @@
white-space: nowrap;
@media(min-width: 768px) {
- --bs-dropdown-min-width: 40rem;
+ --bs-dropdown-min-width: 38rem;
}
@media screen and (max-width: 767px) {
@@ -47,3 +47,8 @@
border-radius: 0.15rem;
}
}
+
+::ng-deep .ngb-dp-day, .day {
+ height: 2.3rem !important;
+ width: 2.3rem !important;
+}
diff --git a/src-ui/src/app/components/common/dates-dropdown/dates-dropdown.component.ts b/src-ui/src/app/components/common/dates-dropdown/dates-dropdown.component.ts
index e7d506d18..25fbeee83 100644
--- a/src-ui/src/app/components/common/dates-dropdown/dates-dropdown.component.ts
+++ b/src-ui/src/app/components/common/dates-dropdown/dates-dropdown.component.ts
@@ -9,6 +9,7 @@ import {
} from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import {
+ NgbDate,
NgbDateAdapter,
NgbDatepickerModule,
NgbDropdownModule,
@@ -57,7 +58,10 @@ export enum RelativeDate {
export class DatesDropdownComponent implements OnInit, OnDestroy {
public popperOptions = popperOptionsReenablePreventOverflow
- constructor(settings: SettingsService) {
+ constructor(
+ settings: SettingsService,
+ private isoDateAdapter: NgbDateAdapter
+ ) {
this.datePlaceHolder = settings.getLocalizedDateInputFormat()
}
@@ -96,6 +100,10 @@ export class DatesDropdownComponent implements OnInit, OnDestroy {
@Input()
createdDateFrom: string
+ createdDate: string
+ addedDate: string
+ hoveredDate: NgbDate
+
@Output()
createdDateFromChange = new EventEmitter()
@@ -186,6 +194,52 @@ export class DatesDropdownComponent implements OnInit, OnDestroy {
this.onChange()
}
+ isHovered(date: NgbDate) {
+ const createdDateFromNgbDate = this.createdDateFrom
+ ? NgbDate.from({
+ year: new Date(this.createdDateFrom).getFullYear(),
+ month: new Date(this.createdDateFrom).getMonth() + 1,
+ day: new Date(this.createdDateFrom).getDate(),
+ })
+ : null
+ return (
+ this.createdDateFrom &&
+ !this.createdDateTo &&
+ this.hoveredDate &&
+ date.after(createdDateFromNgbDate) &&
+ date.before(this.hoveredDate)
+ )
+ }
+
+ isInside(date: NgbDate) {
+ const createdDateFromNgbDate = this.createdDateFrom
+ ? NgbDate.from(this.isoDateAdapter.fromModel(this.createdDateFrom))
+ : null
+ const createdDateToNgbDate = this.createdDateTo
+ ? NgbDate.from(this.isoDateAdapter.fromModel(this.createdDateTo))
+ : null
+ return (
+ this.createdDateTo &&
+ date.after(createdDateFromNgbDate) &&
+ date.before(createdDateToNgbDate)
+ )
+ }
+
+ isRange(date: NgbDate) {
+ const createdDateFromNgbDate = this.createdDateFrom
+ ? NgbDate.from(this.isoDateAdapter.fromModel(this.createdDateFrom))
+ : null
+ const createdDateToNgbDate = this.createdDateTo
+ ? NgbDate.from(this.isoDateAdapter.fromModel(this.createdDateTo))
+ : null
+ return (
+ date.equals(createdDateFromNgbDate) ||
+ (this.createdDateTo && date.equals(createdDateToNgbDate)) ||
+ this.isInside(date) ||
+ this.isHovered(date)
+ )
+ }
+
onChange() {
this.createdDateToChange.emit(this.createdDateTo)
this.createdDateFromChange.emit(this.createdDateFrom)
@@ -203,6 +257,50 @@ export class DatesDropdownComponent implements OnInit, OnDestroy {
})
}
+ onCreatedChange() {
+ const createdNgbDate = NgbDate.from(
+ this.isoDateAdapter.fromModel(this.createdDate)
+ )
+
+ if (!this.createdDateFrom && !this.createdDateTo) {
+ this.createdDateFrom = this.isoDateAdapter.toModel(createdNgbDate)
+ } else if (
+ this.createdDateFrom &&
+ !this.createdDateTo &&
+ createdNgbDate.after(
+ NgbDate.from(this.isoDateAdapter.fromModel(this.createdDateFrom))
+ )
+ ) {
+ this.createdDateTo = this.isoDateAdapter.toModel(createdNgbDate)
+ } else {
+ this.createdDateTo = null
+ this.createdDateFrom = this.isoDateAdapter.toModel(createdNgbDate)
+ }
+ this.onChangeDebounce()
+ }
+
+ onAddedChange() {
+ const addedNgbDate = NgbDate.from(
+ this.isoDateAdapter.fromModel(this.createdDate)
+ )
+
+ if (!this.addedDateFrom && !this.addedDateTo) {
+ this.addedDateFrom = this.isoDateAdapter.toModel(addedNgbDate)
+ } else if (
+ this.addedDateFrom &&
+ !this.addedDateTo &&
+ addedNgbDate.after(
+ NgbDate.from(this.isoDateAdapter.fromModel(this.addedDateFrom))
+ )
+ ) {
+ this.addedDateTo = this.isoDateAdapter.toModel(addedNgbDate)
+ } else {
+ this.addedDateTo = null
+ this.addedDateFrom = this.isoDateAdapter.toModel(addedNgbDate)
+ }
+ this.onChangeDebounce()
+ }
+
onChangeDebounce() {
this.createdRelativeDate = null
this.addedRelativeDate = null