1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/discourse/components/modal/next-session-scheduled.js

33 Zeilen
815 B
JavaScript

2023-09-14 20:14:44 +02:00
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
2023-09-14 20:19:20 +02:00
import I18n from "I18n";
2023-09-14 20:14:44 +02:00
export default class NextSessionScheduledComponent extends Component {
@tracked bufferedDateTime;
title = I18n.t("admin.wizard.after_time_modal.title");
constructor() {
super(...arguments);
this.bufferedDateTime = this.args.model.dateTime
? moment(this.args.model.dateTime)
: moment(Date.now());
}
get submitDisabled() {
return moment().isAfter(this.bufferedDateTime);
}
2023-09-24 13:16:41 +02:00
@action
submit() {
2023-09-14 20:14:44 +02:00
const dateTime = this.bufferedDateTime;
this.args.model.update(moment(dateTime).utc().toISOString());
this.args.closeModal();
}
2023-09-24 13:16:41 +02:00
@action
dateTimeChanged(dateTime) {
2023-09-14 20:14:44 +02:00
this.bufferedDateTime = dateTime;
}
}