mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
ability to delete a price category
This commit is contained in:
parent
77db2b2326
commit
bca77559ed
@ -288,6 +288,31 @@ Application.Controllers.controller "AdminEventsController", ["$scope", "$state",
|
||||
|
||||
|
||||
|
||||
##
|
||||
# Delete the given price category from the API
|
||||
# @param index {number} index of the caterory in the $scope.priceCategories array
|
||||
# @param id {number} price category ID, must match the ID of the category at the index specified above
|
||||
##
|
||||
$scope.removePriceCategory = (id, index) ->
|
||||
if $scope.priceCategories[index].id != id
|
||||
growl.error(_t('unexpected_error_occurred_please_refresh'))
|
||||
else if $scope.priceCategories[index].events > 0
|
||||
growl.error(_t('unable_to_delete_this_price_category_because_it_is_already_used'))
|
||||
else
|
||||
dialogs.confirm
|
||||
resolve:
|
||||
object: ->
|
||||
title: _t('confirmation_required')
|
||||
msg: _t('do_you_really_want_to_delete_this_price_category')
|
||||
, -> # delete confirmed
|
||||
PriceCategory.remove {id: id}, -> # successfully deleted
|
||||
growl.success _t('price_category_successfully_deleted')
|
||||
$scope.priceCategories.splice(index, 1)
|
||||
, ->
|
||||
growl.error _t('price_category_deletion_failed')
|
||||
|
||||
|
||||
|
||||
### PRIVATE SCOPE ###
|
||||
|
||||
##
|
||||
|
@ -104,6 +104,10 @@ en:
|
||||
unexpected_error_occurred_please_refresh: "An unexpected error occurred, please refresh the page."
|
||||
price_category_successfully_updated: "Price category successfully updated."
|
||||
unable_to_update_the_price_category: "Unable to update the price category."
|
||||
unable_to_delete_this_price_category_because_it_is_already_used: "Unable to delete this price category because it is already used."
|
||||
do_you_really_want_to_delete_this_price_category: "Do you really want to delete this price category?"
|
||||
price_category_successfully_deleted: "Price category successfully deleted."
|
||||
price_category_deletion_failed: "Price category deletion failed."
|
||||
|
||||
events_new:
|
||||
# add a new event
|
||||
|
@ -104,6 +104,10 @@ fr:
|
||||
unexpected_error_occurred_please_refresh: "Une erreur inattendue est survenue, merci de rafraîchir la page."
|
||||
price_category_successfully_updated: "La catégorie tarifaire a bien été mise à jour."
|
||||
unable_to_update_the_price_category: "Impossible de mettre à jour la catégorie tarifaire."
|
||||
unable_to_delete_this_price_category_because_it_is_already_used: "Impossible de supprimer cette catégorie tarifaire car elle déjà utilisée."
|
||||
do_you_really_want_to_delete_this_price_category: "Êtes vous sur de vouloir supprimer cette catégorie tarifaire ?"
|
||||
price_category_successfully_deleted: "Catégorie tarifaire supprimée avec succès."
|
||||
price_category_deletion_failed: "Échec de la suppression de la catégorie tarifaire."
|
||||
|
||||
events_new:
|
||||
# ajouter un nouvel évènement
|
||||
|
Loading…
Reference in New Issue
Block a user