2021-02-24 08:43:35 +01:00
|
|
|
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
2020-04-05 03:37:09 +02:00
|
|
|
import Controller from "@ember/controller";
|
2017-11-01 05:21:14 +01:00
|
|
|
|
2020-04-05 03:37:09 +02:00
|
|
|
export default Controller.extend({
|
2021-02-24 08:43:35 +01:00
|
|
|
title: "admin.wizard.after_time_modal.title",
|
2017-11-01 05:21:14 +01:00
|
|
|
|
|
|
|
setup() {
|
2021-02-24 08:43:35 +01:00
|
|
|
this.set("bufferedDateTime", moment(this.model.dateTime));
|
2017-11-01 05:21:14 +01:00
|
|
|
},
|
|
|
|
|
2021-02-24 08:43:35 +01:00
|
|
|
@discourseComputed("bufferedDateTime")
|
2017-11-01 05:21:14 +01:00
|
|
|
submitDisabled(dateTime) {
|
|
|
|
return moment().isAfter(dateTime);
|
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
submit() {
|
2021-02-24 08:43:35 +01:00
|
|
|
const dateTime = this.get("bufferedDateTime");
|
|
|
|
this.get("model.update")(moment(dateTime).utc().toISOString());
|
2017-11-01 05:21:14 +01:00
|
|
|
this.send("closeModal");
|
2020-05-15 04:06:21 +02:00
|
|
|
},
|
2021-02-24 08:43:35 +01:00
|
|
|
|
2020-05-15 04:06:21 +02:00
|
|
|
dateTimeChanged(dateTime) {
|
2021-02-24 08:43:35 +01:00
|
|
|
this.set("bufferedDateTime", dateTime);
|
|
|
|
},
|
|
|
|
},
|
2017-11-01 05:21:14 +01:00
|
|
|
});
|