mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +01:00
plan disabling: hide everywhere + filter in admin filter
This commit is contained in:
parent
26d79e5b12
commit
a9cce55855
@ -15,6 +15,7 @@ Application.Controllers.controller "EditPricingController", ["$scope", "$state",
|
||||
|
||||
## List of available subscriptions plans (eg. student/month, PME/year ...)
|
||||
$scope.plans = plans
|
||||
$scope.enabledPlans = plans.filter (p) -> !p.disabled
|
||||
|
||||
## List of groups (eg. normal, student ...)
|
||||
$scope.groups = groups.filter (g) -> g.slug != 'admins'
|
||||
@ -53,6 +54,16 @@ Application.Controllers.controller "EditPricingController", ["$scope", "$state",
|
||||
$scope.status =
|
||||
isopen: false
|
||||
|
||||
## Default: we show only enabled plans
|
||||
$scope.planFiltering = 'enabled'
|
||||
|
||||
## Available options for filtering plans by status
|
||||
$scope.filterDisabled = [
|
||||
'enabled',
|
||||
'disabled',
|
||||
'all',
|
||||
]
|
||||
|
||||
|
||||
|
||||
$scope.findTrainingsPricing = (trainingsPricings, trainingId, groupId)->
|
||||
|
@ -258,3 +258,14 @@ Application.Filters.filter 'maxCount', [ '_t', (_t) ->
|
||||
max
|
||||
]
|
||||
|
||||
Application.Filters.filter 'filterDisabled', [ ->
|
||||
(list, filter) ->
|
||||
if angular.isArray(list)
|
||||
list.filter (e) ->
|
||||
switch filter
|
||||
when 'disabled' then e.disabled
|
||||
when 'enabled' then !e.disabled
|
||||
else true
|
||||
else
|
||||
list
|
||||
]
|
||||
|
@ -10,7 +10,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr ng-repeat="(planId, trainingIds) in trainingCreditsGroups" ng-init="plan = getPlanFromId(planId)">
|
||||
<tr ng-repeat="(planId, trainingIds) in trainingCreditsGroups" ng-init="plan = getPlanFromId(planId)" ng-hide="plan.disabled">
|
||||
<td>
|
||||
{{ plan | humanReadablePlanName: groups }}
|
||||
</td>
|
||||
@ -58,7 +58,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="mc in machineCredits">
|
||||
<tr ng-repeat="mc in machineCredits" ng-init="plan = getPlanFromId(mc.plan_id)" ng-hide="plan.disabled">
|
||||
<td>
|
||||
<span editable-select="mc.creditable_id" e-name="creditable_id" e-form="rowform" e-ng-options="m.id as m.name+' ( id. '+m.id+' )' for m in machines" e-required>
|
||||
{{ showCreditableName(mc) }}
|
||||
@ -70,8 +70,8 @@
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span editable-select="mc.plan_id" e-ng-options="p.id as humanReadablePlanName(p, groups, 'short') for p in plans" e-name="plan_id" e-form="rowform">
|
||||
{{ getPlanFromId(mc.plan_id) | humanReadablePlanName: groups: 'short' }}
|
||||
<span editable-select="mc.plan_id" e-ng-options="p.id as humanReadablePlanName(p, groups, 'short') for p in enabledPlans" e-name="plan_id" e-form="rowform">
|
||||
{{ plan | humanReadablePlanName: groups: 'short' }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
@ -110,7 +110,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="sc in spaceCredits">
|
||||
<tr ng-repeat="sc in spaceCredits" ng-init="plan = getPlanFromId(sc.plan_id)" ng-hide="plan.disabled">
|
||||
<td>
|
||||
<span editable-select="sc.creditable_id" e-name="creditable_id" e-form="rowform" e-ng-options="s.id as s.name for s in spaces" e-required>
|
||||
{{ showCreditableName(sc) }}
|
||||
@ -122,8 +122,8 @@
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span editable-select="sc.plan_id" e-ng-options="p.id as humanReadablePlanName(p, groups, 'short') for p in plans" e-name="plan_id" e-form="rowform">
|
||||
{{ getPlanFromId(sc.plan_id) | humanReadablePlanName: groups: 'short' }}
|
||||
<span editable-select="sc.plan_id" e-ng-options="p.id as humanReadablePlanName(p, groups, 'short') for p in enabledPlans" e-name="plan_id" e-form="rowform">
|
||||
{{ plan | humanReadablePlanName: groups: 'short' }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
|
@ -6,7 +6,21 @@
|
||||
<br>{{ 'pricing.for_safety_reasons_please_dont_create_subscriptions_if_you_dont_want_intend_to_use_them_later' | translate }}
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-warning m-t-lg m-b" ui-sref="app.admin.plans.new" translate>{{ 'pricing.add_a_new_subscription_plan' }}</button>
|
||||
<div class="m-t-lg">
|
||||
<button type="button" class="btn btn-warning" ui-sref="app.admin.plans.new">
|
||||
<i class="fa fa-plus m-r"></i>
|
||||
<span translate>{{ 'pricing.add_a_new_subscription_plan' }}</span>
|
||||
</button>
|
||||
<div class="form-group pull-right">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><i class="fa fa-filter"></i></span>
|
||||
<select ng-model="planFiltering" class="form-control">
|
||||
<option ng-repeat="status in filterDisabled" value="{{status}}" translate>{{ 'pricing.status_'+status }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -20,7 +34,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="plan in plans | orderBy:orderPlans" ng-class="{'disabled-line' : plan.disabled}">
|
||||
<tr ng-repeat="plan in plans | filterDisabled:planFiltering | orderBy:orderPlans" ng-class="{'disabled-line' : plan.disabled && planFiltering === 'all'}">
|
||||
<td>{{getPlanType(plan.type)}}</td>
|
||||
<td>{{plan.base_name}}</td>
|
||||
<td>{{ plan.interval | planIntervalFilter:plan.interval_count }}</td>
|
||||
|
@ -230,6 +230,9 @@ en:
|
||||
add_a_space_credit: "Add a Space credit"
|
||||
space: "Espace"
|
||||
error_a_credit_linking_this_space_with_that_subscription_already_exists: "Error : a credit linking this space with that subscription already exists."
|
||||
status_enabled: "Enabled"
|
||||
status_disabled: "Disabled"
|
||||
status_all: "All"
|
||||
|
||||
coupons_new:
|
||||
# ajouter un code promotionnel
|
||||
|
@ -230,6 +230,9 @@ fr:
|
||||
add_a_space_credit: "Ajouter un crédit Espace"
|
||||
space: "Espace"
|
||||
error_a_credit_linking_this_space_with_that_subscription_already_exists: "Erreur : un crédit associant cet espace et cet abonnement existe déjà."
|
||||
status_enabled: "Actifs"
|
||||
status_disabled: "Désactivés"
|
||||
status_all: "Tous"
|
||||
|
||||
coupons_new:
|
||||
# ajouter un code promotionnel
|
||||
|
@ -230,6 +230,9 @@ pt:
|
||||
add_a_space_credit: "Adicionar espaço de crédito"
|
||||
space: "Espaço"
|
||||
error_a_credit_linking_this_space_with_that_subscription_already_exists: "Erro: um crédito que vincula esse espaço com essa assinatura já existe."
|
||||
status_enabled: "Ativos"
|
||||
status_disabled: "Desabilitados"
|
||||
status_all: "Todos"
|
||||
|
||||
coupons_new:
|
||||
# ajouter un code promotionnel
|
||||
|
Loading…
x
Reference in New Issue
Block a user