import Component, { Input } from "@ember/component"; import { fn } from "@ember/helper"; import { action } from "@ember/object"; import DButton from "discourse/components/d-button"; import discourseComputed from "discourse/lib/decorators"; import { i18n } from "discourse-i18n"; import ComboBox from "select-kit/components/combo-box"; export default class CreateCouponForm extends Component { discountType = "amount"; discount = null; promoCode = null; active = false; @discourseComputed discountTypes() { return [ { id: "amount", name: "Amount" }, { id: "percent", name: "Percent" }, ]; } @action createNewCoupon() { const createParams = { promo: this.promoCode, discount_type: this.discountType, discount: this.discount, active: this.active, }; this.create(createParams); } @action cancelCreate() { this.cancel(); } }