1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

improved tag management in cart

This commit is contained in:
Sylvain 2017-02-22 11:23:32 +01:00
parent 4bb9728502
commit c2c400107d
4 changed files with 19 additions and 7 deletions

View File

@ -180,6 +180,7 @@ Application.Directives.directive 'cart', [ '$rootScope', '$uibModal', 'dialogs',
# @returns {boolean} true in case of incompatibility
##
$scope.tagMissmatch = ->
return false if $scope.events.placable.tag_ids.length == 0
for tag in $scope.events.modifiable.tags
if tag.id not in $scope.events.placable.tag_ids
return true
@ -208,6 +209,7 @@ Application.Directives.directive 'cart', [ '$rootScope', '$uibModal', 'dialogs',
slotSelectionChanged()
$scope.$watch 'user', (newValue, oldValue) ->
if newValue != oldValue
$scope.events.paid = []
slotSelectionChanged()
$scope.$watch 'planSelectionTime', (newValue, oldValue) ->
if newValue != oldValue
@ -536,9 +538,11 @@ Application.Directives.directive 'cart', [ '$rootScope', '$uibModal', 'dialogs',
$scope.events.paid = $scope.events.reserved
# we call the external callback if present
$scope.afterPayment(reservation) if typeof $scope.afterPayment == 'function'
# we reset the coupon and the cart content
# we reset the coupon and the cart content and we unselect the slot
$scope.events.reserved = []
$scope.coupon.applied = null
$scope.slot = null
$scope.selectedPlan = null

View File

@ -114,19 +114,25 @@
<div class="clear"><a class="pull-right m-b-sm text-u-l ng-scope m-r-sm" href="#" ng-click="removeSlotToPlace($event)" translate>{{ 'cart.cancel_my_selection' }}</a></div>
</div>
<div ng-if="events.placable && events.modifiable.tags.length > 0 && events.placable.tags.length > 0" ng-class="{'panel panel-danger bg-red': tagMissmatch()}">
<div ng-if="events.placable && (events.modifiable.tags.length > 0 || events.placable.tags.length > 0)" ng-class="{'panel panel-danger bg-red': tagMissmatch()}">
<div class="panel-body">
<div id="fromTags">
{{ 'cart.tags_of_the_original_slot' | translate }}<br/>
<span ng-repeat="tag in events.modifiable.tags">
<span class='label label-success text-white' title="{{tag.name}}">{{tag.name}}</span>
</span>
<span class='label label-success text-white' title="{{tag.name}}">{{tag.name}}</span>
</span>
<span ng-show="events.modifiable.tags.length == 0">
<span class='label label-warning text-white' title="{{ 'cart.none' | translate }}" translate>{{ 'cart.none' }}</span>
</span>
</div><br/>
<div id="toTags">
{{ 'cart.tags_of_the_destination_slot' | translate }}<br/>
<span ng-repeat="tag in events.placable.tags">
<span class='label label-success text-white' title="{{tag.name}}">{{tag.name}}</span>
</span>
<span class='label label-success text-white' title="{{tag.name}}">{{tag.name}}</span>
</span>
<span ng-show="events.placable.tags.length == 0">
<span class='label label-warning text-white' title="{{ 'cart.none' | translate }}" translate>{{ 'cart.none' }}</span>
</span>
</div>
</div>
</div>

View File

@ -445,4 +445,5 @@ en:
reservation_was_cancelled_successfully: "Reservation was cancelled successfully."
cancellation_failed: "Cancellation failed."
confirm_payment_of_html: "{ROLE, select, admin{Payment on site} other{Pay}}: {AMOUNT}" # messageFormat interpolation (context: confirm my payment of $20.00)
a_problem_occured_during_the_payment_process_please_try_again_later: "A problem occurred during the payment process. Please try again later."
a_problem_occured_during_the_payment_process_please_try_again_later: "A problem occurred during the payment process. Please try again later."
none: "None"

View File

@ -446,3 +446,4 @@ fr:
cancellation_failed: "L'annulation a échouée."
confirm_payment_of_html: "{ROLE, select, admin{Paiement sur place} other{Payer}} : {AMOUNT}" # messageFormat interpolation (contexte : valider mon paiement de 20,00 €)
a_problem_occured_during_the_payment_process_please_try_again_later: "Il y a eu un problème lors de la procédure de paiement. Veuillez réessayer plus tard."
none: "Aucune"