mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-29 18:52:22 +01:00
[bug] unable to select no category in plan creation/edition after a category selection
Also: Display the category in the plans list instead of the plan type
This commit is contained in:
parent
569be57a1f
commit
72be638869
@ -1,6 +1,9 @@
|
||||
# Changelog Fab-manager
|
||||
|
||||
- Display the category in the plans list
|
||||
- Do not display the type in the plans list
|
||||
- Fix a bug: a message tells that creating a new plan fails, but it worked
|
||||
- Fix a bug: unable to select no category in plan creation/edition after a category selection
|
||||
|
||||
## v5.0.3 2021 June 14
|
||||
|
||||
|
2
Procfile
2
Procfile
@ -1,4 +1,4 @@
|
||||
#web: bundle exec rails server puma -p $PORT
|
||||
web: bundle exec rails server puma -p $PORT
|
||||
worker: bundle exec sidekiq -C ./config/sidekiq.yml
|
||||
wp-client: bin/webpack-dev-server
|
||||
wp-server: SERVER_BUNDLE_ONLY=yes bin/webpack --watch
|
||||
|
@ -87,6 +87,8 @@ Application.Controllers.controller('NewPlanController', ['$scope', '$uibModal',
|
||||
|
||||
// list of all plan categories
|
||||
$scope.planCategories = planCategories;
|
||||
// we add an empty element to let the user select 'no category'
|
||||
$scope.planCategories.unshift({ id: null, name: '' });
|
||||
|
||||
// prices bindings
|
||||
$scope.prices = {
|
||||
@ -239,6 +241,8 @@ Application.Controllers.controller('EditPlanController', ['$scope', 'groups', 'p
|
||||
|
||||
// list of all plan categories
|
||||
$scope.planCategories = planCategories;
|
||||
// we add an empty element to let the user select 'no category'
|
||||
$scope.planCategories.unshift({ id: null, name: '' });
|
||||
|
||||
// current form is used for edition mode
|
||||
$scope.mode = 'edition';
|
||||
|
@ -18,8 +18,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', 'spacesPromise', 'spacesPricesPromise', 'spacesCreditsPromise', 'settingsPromise', '_t', 'Member', 'uiTourService',
|
||||
function ($scope, $state, $uibModal, $filter, TrainingsPricing, Credit, Pricing, Plan, Coupon, plans, groups, growl, machinesPricesPromise, Price, dialogs, trainingsPricingsPromise, trainingsPromise, machineCreditsPromise, machinesPromise, trainingCreditsPromise, couponsPromise, spacesPromise, spacesPricesPromise, spacesCreditsPromise, settingsPromise, _t, Member, uiTourService) {
|
||||
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', 'spacesCreditsPromise', 'settingsPromise', '_t', 'Member', 'uiTourService', 'planCategories',
|
||||
function ($scope, $state, $uibModal, $filter, TrainingsPricing, Credit, Pricing, Plan, Coupon, plans, groups, growl, machinesPricesPromise, Price, dialogs, trainingsPricingsPromise, trainingsPromise, machineCreditsPromise, machinesPromise, trainingCreditsPromise, couponsPromise, spacesPromise, spacesPricesPromise, spacesCreditsPromise, settingsPromise, _t, Member, uiTourService, planCategories) {
|
||||
/* PUBLIC SCOPE */
|
||||
|
||||
// List of machines prices (not considering any plan)
|
||||
@ -36,6 +36,9 @@ Application.Controllers.controller('EditPricingController', ['$scope', '$state',
|
||||
$scope.groups = groups.filter(function (g) { return g.slug !== 'admins'; });
|
||||
$scope.enabledGroups = groups.filter(function (g) { return (g.slug !== 'admins') && !g.disabled; });
|
||||
|
||||
// List of all plan-categories
|
||||
$scope.planCategories = planCategories;
|
||||
|
||||
// Associate free machine hours with subscriptions
|
||||
$scope.machineCredits = machineCreditsPromise;
|
||||
|
||||
@ -433,14 +436,15 @@ Application.Controllers.controller('EditPricingController', ['$scope', '$state',
|
||||
};
|
||||
|
||||
/**
|
||||
* If the plan does not have a type, return a default value for display purposes
|
||||
* @param type {string|undefined|null} plan's type (eg. 'partner')
|
||||
* @returns {string}
|
||||
* Return the name of the plan-category, from its ID
|
||||
* @param id {number|undefined} plan-category's id
|
||||
* @returns {string} the name
|
||||
*/
|
||||
$scope.getPlanType = function (type) {
|
||||
if (type === 'PartnerPlan') {
|
||||
return _t('app.admin.pricing.partner');
|
||||
} else { return _t('app.admin.pricing.standard'); }
|
||||
$scope.getPlanCategory = function (id) {
|
||||
const cat = $scope.planCategories.find(c => c.id === id);
|
||||
if (cat) {
|
||||
return cat.name;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -780,7 +780,8 @@ angular.module('application.router', ['ui.router'])
|
||||
spacesPromise: ['Space', function (Space) { return Space.query().$promise; }],
|
||||
spacesPricesPromise: ['Price', function (Price) { return Price.query({ priceable_type: 'Space', plan_id: 'null' }).$promise; }],
|
||||
spacesCreditsPromise: ['Credit', function (Credit) { return Credit.query({ creditable_type: 'Space' }).$promise; }],
|
||||
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['feature_tour_display', 'slot_duration']" }).$promise; }]
|
||||
settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['feature_tour_display', 'slot_duration']" }).$promise; }],
|
||||
planCategories: ['PlanCategory', function (PlanCategory) { return PlanCategory.query().$promise; }]
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -23,10 +23,10 @@
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><a href="" ng-click="setOrderPlans('type')">{{ 'app.admin.pricing.type' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': orderPlans=='type', 'fa fa-sort-alpha-desc': orderPlans=='-type', 'fa fa-arrows-v': orderPlans }"></i></a></th>
|
||||
<th><a href="" ng-click="setOrderPlans('name')">{{ 'app.admin.pricing.name' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': orderPlans=='name', 'fa fa-sort-alpha-desc': orderPlans=='-name', 'fa fa-arrows-v': orderPlans }"></i></a></th>
|
||||
<th><a href="" ng-click="setOrderPlans('interval')">{{ 'app.admin.pricing.duration' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-amount-asc': orderPlans=='interval', 'fa fa-sort-amount-desc': orderPlans=='-interval', 'fa fa-arrows-v': orderPlans }"></i></a></th>
|
||||
<th><a href="" ng-click="setOrderPlans('group_id')">{{ 'app.admin.pricing.group' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': orderPlans=='group_id', 'fa fa-sort-alpha-desc': orderPlans=='-group_id', 'fa fa-arrows-v': orderPlans }"></i></a></th>
|
||||
<th><a href="" ng-click="setOrderPlans('plan_category_id')">{{ 'app.admin.pricing.category' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': orderPlans=='plan_category_id', 'fa fa-sort-alpha-desc': orderPlans=='-plan_category_id', 'fa fa-arrows-v': orderPlans }"></i></a></th>
|
||||
<th class="hidden-xs"><a href="" ng-click="setOrderPlans('app.admin.pricing.ui_weight')">{{ 'app.admin.pricing.prominence' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-numeric-asc': orderPlans=='ui_weight', 'fa fa-sort-numeric-desc': orderPlans=='-ui_weight', 'fa fa-arrows-v': orderPlans }"></i></a></th>
|
||||
<th><a href="" ng-click="setOrderPlans('amount')">{{ 'app.admin.pricing.price' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-numeric-asc': orderPlans=='amount', 'fa fa-sort-numeric-desc': orderPlans=='-amount', 'fa fa-arrows-v': orderPlans }"></i></a></th>
|
||||
<th></th>
|
||||
@ -36,10 +36,10 @@
|
||||
<tr ng-repeat="plan in plans | filterDisabled:planFiltering | orderBy:orderPlans"
|
||||
ng-class="{'disabled-line' : plan.disabled && planFiltering === 'all'}"
|
||||
ng-init="group = getGroupFromId(groups, plan.group_id)">
|
||||
<td>{{getPlanType(plan.type)}}</td>
|
||||
<td>{{plan.base_name}}</td>
|
||||
<td>{{ plan.interval | planIntervalFilter:plan.interval_count }}</td>
|
||||
<td>{{group.name}}</td>
|
||||
<td>{{getPlanCategory(plan.plan_category_id)}}</td>
|
||||
<td class="hidden-xs">{{plan.ui_weight}}</td>
|
||||
<td>{{plan.amount | currency}}</td>
|
||||
<td><button type="button" class="btn btn-default" ui-sref="app.admin.plans.edit({id:plan.id})"><i class="fa fa-pencil-square-o"></i></button> <button type="button" class="btn btn-danger" ng-click="deletePlan(plans, plan.id)"><i class="fa fa-trash"></i></button></td>
|
||||
|
@ -300,12 +300,10 @@ en:
|
||||
list_of_the_subscription_plans: "List of the subscription plans"
|
||||
disabled_plans_info_html: "<p><strong>Warning:</strong> the subscriptions are disabled on this application.</p><p>You can still create some, but they won't be available until the activation of the plans module, from the « Customization » section.</p>"
|
||||
add_a_new_subscription_plan: "Add a new subscription plan"
|
||||
type: "Type"
|
||||
partner: "Partner"
|
||||
standard: "Standard"
|
||||
name: "Name"
|
||||
duration: "Duration"
|
||||
group: "Group"
|
||||
category: "Category"
|
||||
prominence: "Prominence"
|
||||
price: "Price"
|
||||
machine_hours: "Machine slots"
|
||||
|
@ -300,12 +300,10 @@ fr:
|
||||
list_of_the_subscription_plans: "Liste des formules d'abonnements"
|
||||
disabled_plans_info_html: "<p><strong>Attention :</strong> les abonnements sont désactivés sur cette application.</p><p>Vous pouvez tout de même en créer mais ils ne seront disponibles qu'après l'activation du module abonnements depuis la section « Personnalisation ».</p>"
|
||||
add_a_new_subscription_plan: "Ajouter une nouvelle formule d'abonnement"
|
||||
type: "Type"
|
||||
partner: "Partenaire"
|
||||
standard: "Standard"
|
||||
name: "Nom"
|
||||
duration: "Durée"
|
||||
group: "Groupe"
|
||||
category: "Catégorie"
|
||||
prominence: "Importance"
|
||||
price: "Prix"
|
||||
machine_hours: "Créneaux machines"
|
||||
|
Loading…
x
Reference in New Issue
Block a user