mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
event custom prices: various fixes and removed artifacts
This commit is contained in:
parent
63a9f8bf95
commit
4f41aa6554
@ -45,7 +45,6 @@ Application.Controllers.controller "SettingsController", ["$scope", 'Setting', '
|
||||
$scope.trainingExplicationsAlert = { name: 'training_explications_alert', value: settingsPromise.training_explications_alert }
|
||||
$scope.trainingInformationMessage = { name: 'training_information_message', value: settingsPromise.training_information_message}
|
||||
$scope.subscriptionExplicationsAlert = { name: 'subscription_explications_alert', value: settingsPromise.subscription_explications_alert }
|
||||
$scope.eventReducedAmountAlert = { name: 'event_reduced_amount_alert', value: settingsPromise.event_reduced_amount_alert }
|
||||
$scope.windowStart = { name: 'booking_window_start', value: settingsPromise.booking_window_start }
|
||||
$scope.windowEnd = { name: 'booking_window_end', value: settingsPromise.booking_window_end }
|
||||
$scope.mainColorSetting = { name: 'main_color', value: settingsPromise.main_color }
|
||||
|
@ -376,7 +376,7 @@ Application.Controllers.controller "ShowEventController", ["$scope", "$state", "
|
||||
$scope.reservationCanModify = (reservation)->
|
||||
isAble = false
|
||||
angular.forEach $scope.event.recurrence_events, (e)->
|
||||
isAble = true if e.nb_free_places > reservation.total_booked_seats
|
||||
isAble = true if e.nb_free_places >= reservation.total_booked_seats
|
||||
isAble
|
||||
|
||||
|
||||
|
@ -1028,7 +1028,6 @@ angular.module('application.router', ['ui.router']).
|
||||
'training_explications_alert',
|
||||
'training_information_message',
|
||||
'subscription_explications_alert',
|
||||
'event_reduced_amount_alert',
|
||||
'booking_window_start',
|
||||
'booking_window_end',
|
||||
'booking_move_enable',
|
||||
|
@ -78,17 +78,6 @@
|
||||
<button name="button" class="btn btn-warning" ng-click="save(subscriptionExplicationsAlert)" translate>{{ 'save' }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<h4 translate>{{ 'message_of_the_event_page_relative_to_the_reduced_rate_availability_conditions' }}</h4>
|
||||
<div ng-model="eventReducedAmountAlert.value" medium-editor options='{"placeholder": "{{ "type_the_message_content" | translate }}",
|
||||
"buttons": ["bold", "italic", "unorderedlist", "header2" ]
|
||||
}'>
|
||||
</div>
|
||||
<button name="button" class="btn btn-warning" ng-click="save(eventReducedAmountAlert)" translate>{{ 'save' }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -251,8 +251,7 @@
|
||||
<input ng-model="price.amount"
|
||||
type="number"
|
||||
name="event[event_price_categories_attributes][][amount]"
|
||||
class="form-control"
|
||||
id="event_reduced_amount">
|
||||
class="form-control">
|
||||
<div class="input-group-addon">{{currencySymbol}}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<div class="modal-body">
|
||||
<p translate>{{ 'you_can_shift_this_reservation_on_the_following_slots' }}</p>
|
||||
<select ng-model="reservation.reservable_id" class="form-control">
|
||||
<option value="{{e.id}}" ng-repeat="e in event.recurrence_events" ng-if="e.nb_free_places >= (reservation.nb_reserve_places + reservation.nb_reserve_reduced_places)">{{e.start_date | amDateFormat:'L'}}</option>
|
||||
<option value="{{e.id}}" ng-repeat="e in event.recurrence_events" ng-if="e.nb_free_places >= reservation.total_booked_seats">{{e.start_date | amDateFormat:'L'}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
@ -105,7 +105,7 @@ class Event < ActiveRecord::Base
|
||||
if nb_total_places.nil?
|
||||
self.nb_free_places = nil
|
||||
else
|
||||
reserved_places = reservations.map{|r| r.nb_reserve_places + r.nb_reserve_reduced_places}.inject(0){|sum, t| sum + t }
|
||||
reserved_places = reservations.map(&:total_booked_seats).inject(0){|sum, t| sum + t }
|
||||
self.nb_free_places = (nb_total_places - reserved_places)
|
||||
end
|
||||
end
|
||||
|
@ -366,16 +366,10 @@ class Reservation < ActiveRecord::Base
|
||||
def update_event_nb_free_places
|
||||
if reservable_id_was.blank?
|
||||
# simple reservation creation, we subtract the number of booked seats from the previous number
|
||||
nb_free_places = reservable.nb_free_places - nb_reserve_places
|
||||
tickets.each do |ticket|
|
||||
nb_free_places -= ticket.booked
|
||||
end
|
||||
nb_free_places = reservable.nb_free_places - total_booked_seats
|
||||
else
|
||||
# reservation moved from another date (for recurring events)
|
||||
seats = nb_reserve_places
|
||||
tickets.each do |ticket|
|
||||
seats += ticket.booked
|
||||
end
|
||||
seats = total_booked_seats
|
||||
|
||||
reservable_was = Event.find(reservable_id_was)
|
||||
nb_free_places = reservable_was.nb_free_places + seats
|
||||
|
@ -9,7 +9,6 @@ class Setting < ActiveRecord::Base
|
||||
training_explications_alert
|
||||
training_information_message
|
||||
subscription_explications_alert
|
||||
event_reduced_amount_alert
|
||||
invoice_logo
|
||||
invoice_reference
|
||||
invoice_code-active
|
||||
|
@ -489,7 +489,6 @@ en:
|
||||
warning_message_of_the_training_booking_page: "Warning message of the training booking page:"
|
||||
information_message_of_the_training_reservation_page: "Information message of the training reservation page:"
|
||||
message_of_the_subscriptions_page: "Message of the subscriptions page:"
|
||||
message_of_the_event_page_relative_to_the_reduced_rate_availability_conditions: "Message of the event page, relative to the reduced rate availability conditions:"
|
||||
legal_documents: "Legal documents"
|
||||
if_these_documents_are_not_filled_no_consent_about_them_will_be_asked_to_the_user: "If these documents are not filled, no consent about them will be asked."
|
||||
general_terms_and_conditions_(T&C): "General terms and conditions (T&C)"
|
||||
@ -540,7 +539,6 @@ en:
|
||||
training_explications_alert: "explanation message on the training reservation page"
|
||||
training_information_message: "information message on the machine reservation page"
|
||||
subscription_explications_alert: "explanation message on the subscription page"
|
||||
event_reduced_amount_alert: "information message concerning the reduced prices of an event"
|
||||
main_color: "main colour"
|
||||
secondary_color: "secondary colour"
|
||||
home_blogpost: "homepage's brief"
|
||||
|
@ -489,7 +489,6 @@ fr:
|
||||
warning_message_of_the_training_booking_page: "Message d'avertissement sur la page de réservation d'une formation :"
|
||||
information_message_of_the_training_reservation_page: "Message d'information sur la page de réservation d'une formation :"
|
||||
message_of_the_subscriptions_page: "Message sur la page des abonnements :"
|
||||
message_of_the_event_page_relative_to_the_reduced_rate_availability_conditions: "Message sur la page d'un évènement, relatif aux conditions d'application du tarif réduit :"
|
||||
legal_documents: "Documents légaux"
|
||||
if_these_documents_are_not_filled_no_consent_about_them_will_be_asked_to_the_user: "Si ces documents ne sont pas renseignés, aucun consentement à leur sujet ne sera demandé à l'utilisateur."
|
||||
general_terms_and_conditions_(T&C): "Conditions générales de vente (CGV)"
|
||||
@ -540,7 +539,6 @@ fr:
|
||||
training_explications_alert: "l'explication sur la page de réservation d'une formation"
|
||||
training_information_message: "l'information sur la page de réservation d'une formation"
|
||||
subscription_explications_alert: "l'explication sur la page de souscription à un abonnement"
|
||||
event_reduced_amount_alert: "l'information relative aux tarifs réduits d'un évènement"
|
||||
main_color: "la couleur principale"
|
||||
secondary_color: "la couleur secondaire"
|
||||
home_blogpost: "la brève de la page d'accueil"
|
||||
|
@ -44,7 +44,6 @@ en:
|
||||
title: "Title"
|
||||
total_: "TOTAL :"
|
||||
full_price_: "Full price:"
|
||||
reduced_rate_: "Reduced rate:"
|
||||
rough_draft: "Rough draft"
|
||||
machines_and_materials: "Machines and materials"
|
||||
collaborators: "Collaborators"
|
||||
|
@ -44,7 +44,6 @@ fr:
|
||||
title: "Titre"
|
||||
total_: "TOTAL :"
|
||||
full_price_: "Plein tarif :"
|
||||
reduced_rate_: "Tarif réduit :"
|
||||
rough_draft: "Brouillon"
|
||||
machines_and_materials: "Machines et matériaux"
|
||||
collaborators: "Les collaborateurs"
|
||||
|
File diff suppressed because one or more lines are too long
3
test/fixtures/events.yml
vendored
3
test/fixtures/events.yml
vendored
@ -8,7 +8,6 @@ event_2:
|
||||
updated_at: 2016-04-04 15:44:03.161942000 Z
|
||||
availability_id: 10
|
||||
amount: 2000
|
||||
reduced_amount: 1500
|
||||
nb_total_places: 10
|
||||
nb_free_places: 10
|
||||
recurrence_id: 1
|
||||
@ -24,7 +23,6 @@ event_3:
|
||||
updated_at: 2016-04-04 15:44:04.028290000 Z
|
||||
availability_id: 11
|
||||
amount: 2000
|
||||
reduced_amount: 1500
|
||||
nb_total_places: 10
|
||||
nb_free_places: 10
|
||||
recurrence_id: 1
|
||||
@ -39,7 +37,6 @@ event_1:
|
||||
updated_at: 2016-04-04 15:44:02.236165000 Z
|
||||
availability_id: 9
|
||||
amount: 2000
|
||||
reduced_amount: 1500
|
||||
nb_total_places: 10
|
||||
nb_free_places: 10
|
||||
recurrence_id: 1
|
||||
|
3
test/fixtures/reservations.yml
vendored
3
test/fixtures/reservations.yml
vendored
@ -8,5 +8,4 @@ reservation_1:
|
||||
reservable_id: 2
|
||||
reservable_type: Training
|
||||
stp_invoice_id:
|
||||
nb_reserve_places:
|
||||
nb_reserve_reduced_places:
|
||||
nb_reserve_places:
|
8
test/fixtures/settings.yml
vendored
8
test/fixtures/settings.yml
vendored
@ -75,14 +75,6 @@ setting_7:
|
||||
created_at: 2016-04-04 14:11:34.588478000 Z
|
||||
updated_at: 2016-04-04 14:11:34.588478000 Z
|
||||
|
||||
setting_8:
|
||||
id: 8
|
||||
name: event_reduced_amount_alert
|
||||
value: "* Tarif réduit si vous avez moins de 25 ans, que vous êtes étudiant ou demandeur
|
||||
d'emploi."
|
||||
created_at: 2016-04-04 14:11:34.592250000 Z
|
||||
updated_at: 2016-04-04 14:11:34.592250000 Z
|
||||
|
||||
setting_9:
|
||||
id: 9
|
||||
name: invoice_logo
|
||||
|
@ -68,7 +68,6 @@ class EventsTest < ActionDispatch::IntegrationTest
|
||||
reservable_id: e.id,
|
||||
reservable_type: 'Event',
|
||||
nb_reserve_places: 2,
|
||||
nb_reserve_reduced_places: 0,
|
||||
slots_attributes: [
|
||||
{
|
||||
start_at: e.availability.start_at,
|
||||
|
Loading…
x
Reference in New Issue
Block a user