2020-05-28 10:32:57 -05:00
|
|
|
import Controller from "@ember/controller";
|
2024-11-29 15:42:50 +00:00
|
|
|
import { action } from "@ember/object";
|
2024-11-19 10:31:14 +00:00
|
|
|
import { service } from "@ember/service";
|
2024-01-16 17:51:44 +01:00
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
2019-10-15 09:40:49 +11:00
|
|
|
|
2024-11-29 15:42:50 +00:00
|
|
|
export default class AdminPluginsDiscourseSubscriptionsProductsShowController extends Controller {
|
|
|
|
|
@service router;
|
2023-12-01 18:30:36 +00:00
|
|
|
|
2024-11-29 15:42:50 +00:00
|
|
|
@action
|
|
|
|
|
cancelProduct() {
|
|
|
|
|
this.router.transitionTo("adminPlugins.discourse-subscriptions.products");
|
|
|
|
|
}
|
2019-10-22 16:35:41 +11:00
|
|
|
|
2024-11-29 15:42:50 +00:00
|
|
|
@action
|
|
|
|
|
createProduct() {
|
|
|
|
|
this.get("model.product")
|
|
|
|
|
.save()
|
|
|
|
|
.then((product) => {
|
|
|
|
|
this.router.transitionTo(
|
|
|
|
|
"adminPlugins.discourse-subscriptions.products.show",
|
|
|
|
|
product.id
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
.catch(popupAjaxError);
|
|
|
|
|
}
|
2019-10-16 14:15:01 +11:00
|
|
|
|
2024-11-29 15:42:50 +00:00
|
|
|
@action
|
|
|
|
|
updateProduct() {
|
|
|
|
|
this.get("model.product")
|
|
|
|
|
.update()
|
|
|
|
|
.then(() => {
|
|
|
|
|
this.router.transitionTo(
|
|
|
|
|
"adminPlugins.discourse-subscriptions.products"
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
.catch(popupAjaxError);
|
|
|
|
|
}
|
|
|
|
|
}
|