2024-01-18 20:06:42 +08:00
|
|
|
import Component from "@glimmer/component";
|
|
|
|
import { action } from "@ember/object";
|
2024-03-07 01:05:11 +08:00
|
|
|
import { service } from "@ember/service";
|
2024-01-18 20:06:42 +08:00
|
|
|
import DButton from "discourse/components/d-button";
|
|
|
|
import PeriodChooser from "select-kit/components/period-chooser";
|
|
|
|
import CustomDateRangeModal from "../components/modal/custom-date-range";
|
|
|
|
|
|
|
|
export default class DashboardPeriodSelector extends Component {
|
|
|
|
@service modal;
|
|
|
|
|
|
|
|
availablePeriods = ["yearly", "quarterly", "monthly", "weekly"];
|
|
|
|
|
|
|
|
@action
|
|
|
|
openCustomDateRangeModal() {
|
|
|
|
this.modal.show(CustomDateRangeModal, {
|
|
|
|
model: {
|
|
|
|
startDate: this.args.startDate,
|
|
|
|
endDate: this.args.endDate,
|
|
|
|
setCustomDateRange: this.args.setCustomDateRange,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<PeriodChooser
|
|
|
|
@period={{@period}}
|
|
|
|
@action={{@setPeriod}}
|
|
|
|
@content={{this.availablePeriods}}
|
|
|
|
@fullDay={{false}}
|
|
|
|
/>
|
|
|
|
<DButton
|
2024-09-13 23:50:52 +08:00
|
|
|
@icon="gear"
|
2024-01-18 20:06:42 +08:00
|
|
|
@action={{this.openCustomDateRangeModal}}
|
|
|
|
@title="admin.dashboard.custom_date_range"
|
|
|
|
class="custom-date-range-button"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
}
|