mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
[ongoing] prevent disable group with users + [ongoing] hide disabled groups
This commit is contained in:
parent
fb092afc8c
commit
189665e53b
@ -77,11 +77,14 @@ Application.Controllers.controller "GroupsController", ["$scope", 'groupsPromise
|
|||||||
##
|
##
|
||||||
$scope.toggleDisableGroup = (index) ->
|
$scope.toggleDisableGroup = (index) ->
|
||||||
group = $scope.groups[index]
|
group = $scope.groups[index]
|
||||||
Group.update {id: group.id}, { group: { disabled: !group.disabled } }, (response) ->
|
if (!group.disabled && group.users > 0)
|
||||||
$scope.groups[index] = response
|
growl.error(_t('group_form.unable_to_disable_group_with_users', { USERS: group.users }, 'messageformat'))
|
||||||
growl.success(_t('group_form.group_successfully_enabled_disabled', { STATUS: response.disabled }, 'messageformat'))
|
else
|
||||||
, (error) ->
|
Group.update {id: group.id}, { group: { disabled: !group.disabled } }, (response) ->
|
||||||
growl.error(_t('group_form.unable_to_enable_disable_group', { STATUS: !group.disabled }, 'messageformat'))
|
$scope.groups[index] = response
|
||||||
|
growl.success(_t('group_form.group_successfully_enabled_disabled', { STATUS: response.disabled }, 'messageformat'))
|
||||||
|
, (error) ->
|
||||||
|
growl.error(_t('group_form.unable_to_enable_disable_group', { STATUS: !group.disabled }, 'messageformat'))
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -25,7 +25,7 @@ class MembersController
|
|||||||
|
|
||||||
## Retrieve the profiles groups (eg. students ...)
|
## Retrieve the profiles groups (eg. students ...)
|
||||||
Group.query (groups) ->
|
Group.query (groups) ->
|
||||||
$scope.groups = groups.filter (g) -> g.slug != 'admins'
|
$scope.groups = groups.filter (g) -> g.slug != 'admins' && !g.disabled
|
||||||
|
|
||||||
## Retrieve the list the available trainings
|
## Retrieve the list the available trainings
|
||||||
Training.query().$promise.then (data)->
|
Training.query().$promise.then (data)->
|
||||||
|
@ -13,7 +13,7 @@ class PlanController
|
|||||||
|
|
||||||
|
|
||||||
## groups list
|
## groups list
|
||||||
$scope.groups = groups.filter (g) -> g.slug != 'admins'
|
$scope.groups = groups.filter (g) -> g.slug != 'admins' && !g.disabled
|
||||||
|
|
||||||
## users with role 'partner', notifiables for a partner plan
|
## users with role 'partner', notifiables for a partner plan
|
||||||
$scope.partners = partners.users
|
$scope.partners = partners.users
|
||||||
|
@ -19,6 +19,7 @@ Application.Controllers.controller "EditPricingController", ["$scope", "$state",
|
|||||||
|
|
||||||
## List of groups (eg. normal, student ...)
|
## List of groups (eg. normal, student ...)
|
||||||
$scope.groups = groups.filter (g) -> g.slug != 'admins'
|
$scope.groups = groups.filter (g) -> g.slug != 'admins'
|
||||||
|
$scope.enabledGroups = groups.filter (g) -> g.slug != 'admins' && !g.disabled
|
||||||
|
|
||||||
## Associate free machine hours with subscriptions
|
## Associate free machine hours with subscriptions
|
||||||
$scope.machineCredits = machineCreditsPromise
|
$scope.machineCredits = machineCreditsPromise
|
||||||
|
@ -8,7 +8,7 @@ Application.Controllers.controller "PlansIndexController", ["$scope", "$rootScop
|
|||||||
### PUBLIC SCOPE ###
|
### PUBLIC SCOPE ###
|
||||||
|
|
||||||
## list of groups
|
## list of groups
|
||||||
$scope.groups = groupsPromise.filter (g) -> g.slug != 'admins'
|
$scope.groups = groupsPromise.filter (g) -> g.slug != 'admins' & !g.disabled
|
||||||
|
|
||||||
## default : do not show the group changing form
|
## default : do not show the group changing form
|
||||||
## group ID of the current/selected user
|
## group ID of the current/selected user
|
||||||
|
@ -632,7 +632,7 @@ body.container{
|
|||||||
|
|
||||||
& td:first-child:before {
|
& td:first-child:before {
|
||||||
font-family: 'fontawesome' !important;
|
font-family: 'fontawesome' !important;
|
||||||
content: '\f023';
|
content: '\f070';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: -4px;
|
left: -4px;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<td>
|
<td>
|
||||||
{{ machine.name }}
|
{{ machine.name }}
|
||||||
</td>
|
</td>
|
||||||
<td ng-repeat="group in groups">
|
<td ng-repeat="group in enabledGroups">
|
||||||
<span editable-number="findPriceBy(machinesPrices, machine.id, group.id).amount"
|
<span editable-number="findPriceBy(machinesPrices, machine.id, group.id).amount"
|
||||||
onbeforesave="updatePrice($data, findPriceBy(machinesPrices, machine.id, group.id))">
|
onbeforesave="updatePrice($data, findPriceBy(machinesPrices, machine.id, group.id))">
|
||||||
{{ findPriceBy(machinesPrices, machine.id, group.id).amount | currency}}
|
{{ findPriceBy(machinesPrices, machine.id, group.id).amount | currency}}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<td>
|
<td>
|
||||||
{{ space.name }}
|
{{ space.name }}
|
||||||
</td>
|
</td>
|
||||||
<td ng-repeat="group in groups">
|
<td ng-repeat="group in enabledGroups">
|
||||||
<span editable-number="findPriceBy(spacesPrices, space.id, group.id).amount"
|
<span editable-number="findPriceBy(spacesPrices, space.id, group.id).amount"
|
||||||
onbeforesave="updatePrice($data, findPriceBy(spacesPrices, space.id, group.id))">
|
onbeforesave="updatePrice($data, findPriceBy(spacesPrices, space.id, group.id))">
|
||||||
{{ findPriceBy(spacesPrices, space.id, group.id).amount | currency}}
|
{{ findPriceBy(spacesPrices, space.id, group.id).amount | currency}}
|
||||||
|
@ -34,11 +34,14 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="plan in plans | filterDisabled:planFiltering | orderBy:orderPlans" ng-class="{'disabled-line' : plan.disabled && planFiltering === 'all'}">
|
<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)"
|
||||||
|
ng-hide="group.disabled">
|
||||||
<td>{{getPlanType(plan.type)}}</td>
|
<td>{{getPlanType(plan.type)}}</td>
|
||||||
<td>{{plan.base_name}}</td>
|
<td>{{plan.base_name}}</td>
|
||||||
<td>{{ plan.interval | planIntervalFilter:plan.interval_count }}</td>
|
<td>{{ plan.interval | planIntervalFilter:plan.interval_count }}</td>
|
||||||
<td>{{getGroupFromId(groups, plan.group_id).name}}</td>
|
<td>{{group.name}}</td>
|
||||||
<td class="hidden-xs">{{plan.ui_weight}}</td>
|
<td class="hidden-xs">{{plan.ui_weight}}</td>
|
||||||
<td>{{plan.amount | currency}}</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>
|
<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>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<td>
|
<td>
|
||||||
{{ training.name }}
|
{{ training.name }}
|
||||||
</td>
|
</td>
|
||||||
<td ng-repeat="group in groups">
|
<td ng-repeat="group in enabledGroups">
|
||||||
<span editable-number="findTrainingsPricing(trainingsPricings, training.id, group.id).amount"
|
<span editable-number="findTrainingsPricing(trainingsPricings, training.id, group.id).amount"
|
||||||
onbeforesave="updateTrainingsPricing($data, findTrainingsPricing(trainingsPricings, training.id, group.id))">
|
onbeforesave="updateTrainingsPricing($data, findTrainingsPricing(trainingsPricings, training.id, group.id))">
|
||||||
{{ findTrainingsPricing(trainingsPricings, training.id, group.id).amount | currency}}
|
{{ findTrainingsPricing(trainingsPricings, training.id, group.id).amount | currency}}
|
||||||
|
@ -1 +1,2 @@
|
|||||||
json.extract! group, :id, :slug, :name, :disabled
|
json.extract! group, :id, :slug, :name, :disabled
|
||||||
|
json.users group.users.count
|
||||||
|
@ -430,6 +430,7 @@ en:
|
|||||||
unable_to_delete_group_because_some_users_and_or_groups_are_still_linked_to_it: "Unable to delete group because some users and/or groups are still linked to it."
|
unable_to_delete_group_because_some_users_and_or_groups_are_still_linked_to_it: "Unable to delete group because some users and/or groups are still linked to it."
|
||||||
group_successfully_enabled_disabled: "Group successfully {STATUS, select, true{disabled} other{enabled}}." # messageFormat interpolation
|
group_successfully_enabled_disabled: "Group successfully {STATUS, select, true{disabled} other{enabled}}." # messageFormat interpolation
|
||||||
unable_to_enable_disable_group: "Unable to {STATUS, select, true{disable} other{enable}} group." # messageFormat interpolation
|
unable_to_enable_disable_group: "Unable to {STATUS, select, true{disable} other{enable}} group." # messageFormat interpolation
|
||||||
|
unable_to_disable_group_with_users: "Unable to disable group because it still contains {USERS} active {USERS, plural, =1{user} other{users}}." # messageFormat interpolation
|
||||||
status_enabled: "Enabled"
|
status_enabled: "Enabled"
|
||||||
status_disabled: "Disabled"
|
status_disabled: "Disabled"
|
||||||
status_all: "All"
|
status_all: "All"
|
||||||
|
@ -430,6 +430,7 @@ fr:
|
|||||||
unable_to_delete_group_because_some_users_and_or_groups_are_still_linked_to_it: "Le groupe n'a pas pu être supprimé car des utilisateurs et/ou des abonnements sont toujours associés à ce dernier."
|
unable_to_delete_group_because_some_users_and_or_groups_are_still_linked_to_it: "Le groupe n'a pas pu être supprimé car des utilisateurs et/ou des abonnements sont toujours associés à ce dernier."
|
||||||
group_successfully_enabled_disabled: "Le groupe a bien été {STATUS, select, true{désactivé} other{activé}}." # messageFormat interpolation
|
group_successfully_enabled_disabled: "Le groupe a bien été {STATUS, select, true{désactivé} other{activé}}." # messageFormat interpolation
|
||||||
unable_to_enable_disable_group: "Impossible {STATUS, select, true{de désactiver} other{d'activer}} le groupe." # messageFormat interpolation
|
unable_to_enable_disable_group: "Impossible {STATUS, select, true{de désactiver} other{d'activer}} le groupe." # messageFormat interpolation
|
||||||
|
unable_to_disable_group_with_users: "Impossible de désactiver le groupe car il contient encore {USERS} {USERS, plural, =0{personne} =1{utilisateur actif} other{utilisateurs actifs}}." # messageFormat interpolation
|
||||||
status_enabled: "Activés"
|
status_enabled: "Activés"
|
||||||
status_disabled: "Désactivés"
|
status_disabled: "Désactivés"
|
||||||
status_all: "Tous"
|
status_all: "Tous"
|
||||||
|
@ -434,8 +434,9 @@ pt:
|
|||||||
an_error_occurred_when_saving_the_new_group: "Um erro ocorreu ao salvar novo grupo."
|
an_error_occurred_when_saving_the_new_group: "Um erro ocorreu ao salvar novo grupo."
|
||||||
group_successfully_deleted: "Grupo excluido com sucesso."
|
group_successfully_deleted: "Grupo excluido com sucesso."
|
||||||
unable_to_delete_group_because_some_users_and_or_groups_are_still_linked_to_it: "Não é possível excluir o grupo porque alguns usuários e / ou grupos ainda estão vinculados a ele."
|
unable_to_delete_group_because_some_users_and_or_groups_are_still_linked_to_it: "Não é possível excluir o grupo porque alguns usuários e / ou grupos ainda estão vinculados a ele."
|
||||||
group_successfully_enabled_disabled: "Group successfully {STATUS, select, true{disabled} other{enabled}}." # messageFormat interpolation
|
group_successfully_enabled_disabled: "Group successfully {STATUS, select, true{disabled} other{enabled}}." # messageFormat interpolation TODO
|
||||||
unable_to_enable_disable_group: "Unable to {STATUS, select, true{disable} other{enable}} group." # messageFormat interpolation
|
unable_to_enable_disable_group: "Unable to {STATUS, select, true{disable} other{enable}} group." # messageFormat interpolation TODO
|
||||||
|
unable_to_disable_group_with_users: "Unable to disable group because it still contains {USERS} active {USERS, plural, =1{user} other{users}}." # messageFormat interpolation TODO
|
||||||
status_enabled: "Ativos"
|
status_enabled: "Ativos"
|
||||||
status_disabled: "Desabilitados"
|
status_disabled: "Desabilitados"
|
||||||
status_all: "Todos"
|
status_all: "Todos"
|
||||||
|
Loading…
Reference in New Issue
Block a user