destroy plan
This commit is contained in:
parent
5cce5f2b84
commit
296d5eff1b
|
@ -3,25 +3,5 @@ import AdminPlan from "discourse/plugins/discourse-patrons/discourse/models/admi
|
||||||
export default Discourse.Route.extend({
|
export default Discourse.Route.extend({
|
||||||
model() {
|
model() {
|
||||||
return AdminPlan.findAll();
|
return AdminPlan.findAll();
|
||||||
},
|
|
||||||
|
|
||||||
actions: {
|
|
||||||
destroyPlan(plan) {
|
|
||||||
bootbox.confirm(
|
|
||||||
I18n.t("discourse_patrons.admin.plans.operations.destroy.confirm"),
|
|
||||||
I18n.t("no_value"),
|
|
||||||
I18n.t("yes_value"),
|
|
||||||
confirmed => {
|
|
||||||
if (confirmed) {
|
|
||||||
plan.destroy().then(() => {
|
|
||||||
this.controllerFor("adminPluginsDiscoursePatronsPlansIndex")
|
|
||||||
.get("model")
|
|
||||||
.removeObject(plan);
|
|
||||||
})
|
|
||||||
.catch(data => bootbox.alert(data.jqXHR.responseJSON.errors.join("\n")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,4 +22,24 @@ export default Discourse.Route.extend({
|
||||||
|
|
||||||
return Ember.RSVP.hash({ plans, product, groups });
|
return Ember.RSVP.hash({ plans, product, groups });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
destroyPlan(plan) {
|
||||||
|
bootbox.confirm(
|
||||||
|
I18n.t("discourse_patrons.admin.plans.operations.destroy.confirm"),
|
||||||
|
I18n.t("no_value"),
|
||||||
|
I18n.t("yes_value"),
|
||||||
|
confirmed => {
|
||||||
|
if (confirmed) {
|
||||||
|
plan.destroy().then(() => {
|
||||||
|
this.controllerFor("adminPluginsDiscoursePatronsProductsShow")
|
||||||
|
.get("model.plans")
|
||||||
|
.removeObject(plan);
|
||||||
|
})
|
||||||
|
.catch(data => bootbox.alert(data.jqXHR.responseJSON.errors.join("\n")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
<th>{{i18n 'discourse_patrons.admin.plans.plan.nickname'}}</th>
|
<th>{{i18n 'discourse_patrons.admin.plans.plan.nickname'}}</th>
|
||||||
<th>{{i18n 'discourse_patrons.admin.plans.plan.interval'}}</th>
|
<th>{{i18n 'discourse_patrons.admin.plans.plan.interval'}}</th>
|
||||||
<th>{{i18n 'discourse_patrons.admin.plans.plan.created_at'}}</th>
|
<th>{{i18n 'discourse_patrons.admin.plans.plan.created_at'}}</th>
|
||||||
<th>{{i18n 'discourse_patrons.admin.plans.plan.amount'}}</th>
|
<th class="td-right">{{i18n 'discourse_patrons.admin.plans.plan.amount'}}</th>
|
||||||
<th class="td-right">
|
<th class="td-right">
|
||||||
{{#link-to "adminPlugins.discourse-patrons.products.show.plans.show" model.product.id "new" class="btn"}}
|
{{#link-to "adminPlugins.discourse-patrons.products.show.plans.show" model.product.id "new" class="btn"}}
|
||||||
{{i18n 'discourse_patrons.admin.plans.operations.add'}}
|
{{i18n 'discourse_patrons.admin.plans.operations.add'}}
|
||||||
|
@ -47,20 +47,30 @@
|
||||||
<td>{{plan.nickname}}</td>
|
<td>{{plan.nickname}}</td>
|
||||||
<td>{{plan.interval}}</td>
|
<td>{{plan.interval}}</td>
|
||||||
<td>{{format-date plan.createdFormatted}}</td>
|
<td>{{format-date plan.createdFormatted}}</td>
|
||||||
<td>{{plan.amount}}</td>
|
<td class="td-right">{{plan.amount}}</td>
|
||||||
<td class="td-right">
|
<td class="td-right">
|
||||||
{{#link-to "adminPlugins.discourse-patrons.products.show.plans.show" model.product.id plan.id class="btn no-text btn-icon"}}
|
{{#link-to "adminPlugins.discourse-patrons.products.show.plans.show" model.product.id plan.id class="btn no-text btn-icon"}}
|
||||||
{{d-icon "far-edit"}}
|
{{d-icon "far-edit"}}
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
{{!-- {{d-button
|
{{d-button
|
||||||
action=(route-action "destroyPlan")
|
action=(route-action "destroyPlan")
|
||||||
actionParam=plan
|
actionParam=plan
|
||||||
icon="trash-alt"
|
icon="trash-alt"
|
||||||
class="btn-danger btn no-text btn-icon"}} --}}
|
class="btn-danger btn no-text btn-icon"}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="5">
|
||||||
|
{{#unless model.plans}}
|
||||||
|
<hr>
|
||||||
|
Create a pricing plan to subscribe customers to this product
|
||||||
|
{{/unless}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
@ -69,9 +79,9 @@
|
||||||
<div class="pull-right">
|
<div class="pull-right">
|
||||||
{{d-button label="cancel" action=(action "cancelProduct") icon="times"}}
|
{{d-button label="cancel" action=(action "cancelProduct") icon="times"}}
|
||||||
{{#if model.product.isNew}}
|
{{#if model.product.isNew}}
|
||||||
{{d-button label="discourse_patrons.admin.products.operations.create" action="createProduct" icon="plus"}}
|
{{d-button label="discourse_patrons.admin.products.operations.create" action="createProduct" icon="plus" class="btn btn-primary"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{d-button label="discourse_patrons.admin.products.operations.update" action="updateProduct" icon="check"}}
|
{{d-button label="discourse_patrons.admin.products.operations.update" action="updateProduct" icon="check" class="btn btn-primary"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue