1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

define spaces prices for non-subscribers

This commit is contained in:
Sylvain 2017-02-14 15:25:28 +01:00
parent 334201e551
commit 93bceb5517
6 changed files with 48 additions and 2 deletions

View File

@ -3,8 +3,8 @@
##
# Controller used in the prices edition page
##
Application.Controllers.controller "EditPricingController", ["$scope", "$state", '$uibModal', '$filter', 'TrainingsPricing', 'Credit', 'Pricing', 'Plan', 'Coupon', 'plans', 'groups', 'growl', 'machinesPricesPromise', 'Price', 'dialogs', 'trainingsPricingsPromise', 'trainingsPromise', 'machineCreditsPromise', 'machinesPromise', 'trainingCreditsPromise', 'couponsPromise', '_t'
, ($scope, $state, $uibModal, $filter, TrainingsPricing, Credit, Pricing, Plan, Coupon, plans, groups, growl, machinesPricesPromise, Price, dialogs, trainingsPricingsPromise, trainingsPromise, machineCreditsPromise, machinesPromise, trainingCreditsPromise, couponsPromise, _t) ->
Application.Controllers.controller "EditPricingController", ["$scope", "$state", '$uibModal', '$filter', 'TrainingsPricing', 'Credit', 'Pricing', 'Plan', 'Coupon', 'plans', 'groups', 'growl', 'machinesPricesPromise', 'Price', 'dialogs', 'trainingsPricingsPromise', 'trainingsPromise', 'machineCreditsPromise', 'machinesPromise', 'trainingCreditsPromise', 'couponsPromise', 'spacesPromise', 'spacesPricesPromise', '_t'
, ($scope, $state, $uibModal, $filter, TrainingsPricing, Credit, Pricing, Plan, Coupon, plans, groups, growl, machinesPricesPromise, Price, dialogs, trainingsPricingsPromise, trainingsPromise, machineCreditsPromise, machinesPromise, trainingCreditsPromise, couponsPromise, spacesPromise, spacesPricesPromise, _t) ->
### PUBLIC SCOPE ###
## List of machines prices (not considering any plan)
@ -37,6 +37,12 @@ Application.Controllers.controller "EditPricingController", ["$scope", "$state",
## List of coupons
$scope.coupons = couponsPromise
## List of spaces
$scope.spaces = spacesPromise
## List of spaces prices (not considering any plan)
$scope.spacesPrices = spacesPricesPromise
## The plans list ordering. Default: by group
$scope.orderPlans = 'group_id'

View File

@ -824,6 +824,12 @@ angular.module('application.router', ['ui.router']).
couponsPromise: ['Coupon', (Coupon) ->
Coupon.query().$promise
]
spacesPromise: ['Space', (Space) ->
Space.query().$promise
]
spacesPricesPromise: ['Price', (Price)->
Price.query(priceable_type: 'Space', plan_id: 'null').$promise
]
# plans
.state 'app.admin.plans',

View File

@ -33,6 +33,10 @@
<ng-include src="'<%= asset_path 'admin/pricing/machine_hours.html' %>'"></ng-include>
</uib-tab>
<uib-tab heading="{{ 'pricing.spaces' | translate }}">
<ng-include src="'<%= asset_path 'admin/pricing/spaces.html' %>'"></ng-include>
</uib-tab>
<uib-tab heading="{{ 'pricing.credits' | translate }}">
<ng-include src="'<%= asset_path 'admin/pricing/credits.html' %>'"></ng-include>
</uib-tab>

View File

@ -0,0 +1,26 @@
<div class="alert alert-warning m-t">
{{ 'pricing.these_prices_match_space_hours_rates_' | translate }} <span class="font-bold" translate>{{ 'pricing._without_subscriptions' }}</span>.
</div>
<table class="table">
<thead>
<tr>
<th style="width:20%" translate>{{ 'pricing.spaces' }}</th>
<th style="width:20%" ng-repeat="group in groups">
<span class="text-u-c text-sm">{{group.name}}</span>
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="space in spaces">
<td>
{{ space.name }}
</td>
<td ng-repeat="group in groups">
<span editable-number="findPriceBy(spacesPrices, space.id, group.id).amount"
onbeforesave="updatePrice($data, findPriceBy(spacesPrices, space.id, group.id))">
{{ findPriceBy(spacesPrices, space.id, group.id).amount | currency}}
</span>
</td>
</tr>
</tbody>
</table>

View File

@ -199,6 +199,8 @@ en:
once: "Just once"
forever: "Each use"
valid_until: "Valid until (included)"
spaces: "Spaces"
these_prices_match_space_hours_rates_: "These prices match space hours rates"
coupons_new:
# ajouter un code promotionnel

View File

@ -199,6 +199,8 @@ fr:
once: "Une seule fois"
forever: "À chaque utilisation"
valid_until: "Valable jusqu'au (inclus)"
spaces: "Espaces"
these_prices_match_space_hours_rates_: "Ces tarifs correspondent au prix d'une heure espace"
coupons_new:
# ajouter un code promotionnel