mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-29 18:52:22 +01:00
hide disabled spaces in admin pricing area
This commit is contained in:
parent
02a155e7af
commit
cc94a19ba6
@ -234,7 +234,7 @@ Application.Controllers.controller 'EditPlanController', ['$scope', 'groups', 'p
|
||||
##
|
||||
# Retrieve the machine from its ID
|
||||
# @param machine_id {number} machine identifier
|
||||
# @returns {object} Machine
|
||||
# @returns {Object} Machine
|
||||
##
|
||||
$scope.getMachine = (machine_id) ->
|
||||
for machine in $scope.machines
|
||||
@ -244,14 +244,14 @@ Application.Controllers.controller 'EditPlanController', ['$scope', 'groups', 'p
|
||||
|
||||
|
||||
##
|
||||
# Retrieve the name of a space from its ID
|
||||
# Retrieve the space from its ID
|
||||
# @param space_id {number} space identifier
|
||||
# @returns {string} Space's name
|
||||
# @returns {Object} Space
|
||||
##
|
||||
$scope.getSpaceName = (space_id) ->
|
||||
$scope.getSpace = (space_id) ->
|
||||
for space in $scope.spaces
|
||||
if space.id == space_id
|
||||
return space.name
|
||||
return space
|
||||
|
||||
|
||||
|
||||
|
@ -35,13 +35,14 @@ Application.Controllers.controller "EditPricingController", ["$scope", "$state",
|
||||
|
||||
## List of machines
|
||||
$scope.machines = machinesPromise
|
||||
$scope.enabledMachines = machinesPromise.filter (t) -> !t.disabled
|
||||
$scope.enabledMachines = machinesPromise.filter (m) -> !m.disabled
|
||||
|
||||
## List of coupons
|
||||
$scope.coupons = couponsPromise
|
||||
|
||||
## List of spaces
|
||||
$scope.spaces = spacesPromise
|
||||
$scope.enabledSpaces = spacesPromise.filter (s) -> !s.disabled
|
||||
|
||||
## Associate free space hours with subscriptions
|
||||
$scope.spaceCredits = spacesCreditsPromise
|
||||
|
@ -83,8 +83,8 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr ng-repeat="price in plan.prices" ng-if="price.priceable_type === 'Space'">
|
||||
<td style="width: 60%;">{{ getSpaceName(price.priceable_id) }} *</td>
|
||||
<tr ng-repeat="price in plan.prices" ng-if="price.priceable_type === 'Space'" ng-hide="getSpace(price.priceable_id).disabled">
|
||||
<td style="width: 60%;">{{ getSpace(price.priceable_id).name }} *</td>
|
||||
<td>
|
||||
<div class="input-group" ng-class="{'has-error': planForm['plan[prices_attributes][][amount]'].$dirty && planForm['plan[prices_attributes][][amount]'].$invalid}">
|
||||
<span class="input-group-addon">{{currencySymbol}}</span>
|
||||
|
@ -60,7 +60,7 @@
|
||||
<tbody>
|
||||
<tr ng-repeat="mc in machineCredits" ng-hide="getPlanFromId(mc.plan_id).disabled || getCreditable(mc).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>
|
||||
<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 enabledMachines" e-required>
|
||||
{{ showCreditableName(mc) }}
|
||||
</span>
|
||||
</td>
|
||||
@ -112,7 +112,7 @@
|
||||
<tbody>
|
||||
<tr ng-repeat="sc in spaceCredits" ng-hide="getPlanFromId(sc.plan_id).disabled || getCreditable(sc).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>
|
||||
<span editable-select="sc.creditable_id" e-name="creditable_id" e-form="rowform" e-ng-options="s.id as s.name for s in enabledSpaces" e-required>
|
||||
{{ showCreditableName(sc) }}
|
||||
</span>
|
||||
</td>
|
||||
|
@ -11,7 +11,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="space in spaces">
|
||||
<tr ng-repeat="space in enabledSpaces">
|
||||
<td>
|
||||
{{ space.name }}
|
||||
</td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user