Skip to content

Commit

Permalink
Merge branch 'dev' for release 6.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nflorentin committed Nov 10, 2023
2 parents 75ced8f + 1fa3f37 commit 4979acc
Show file tree
Hide file tree
Showing 34 changed files with 197 additions and 131 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog Fab-manager

## v6.3.1 2023 November 10

- Fix a bug: statistic_sub_type.label of plan was nil
- adds a migrations to fix all statistic_sub_types of plans having label = nil
- Fix a bug: unable to show wallet payment mean for avoir
- updates spanish translations and adds translations
- Fix a bug: avoids crash due to oidc config with scope = nil
- Fix a bug: unable to see value for input group with long label on eventModal
- Improvement: when deleting an event, all reservations are canceled
- Improvement: replace original image by large generated version (event, machine, space, training)

## v6.3.0 2023 November 3

- Fix a bug: fix all failing tasks of rake task file chain.rake
Expand All @@ -13,6 +24,7 @@
- Fix a bug: replaces custom ServerLocale middleware with sidekiq i18n middleware
- adds a rake task to erase all reservations and invoices (fablab:maintenance:delete_all_reservations_and_invoices)
- improvement: dynamic label (i18n) for stats structure tables
- [TODO DEPLOY] upgrade to v6.2.0 BEFORE upgrading to v6.3.0 !!!

## v6.2.0 2023 October 13

Expand All @@ -22,6 +34,7 @@
- Fix a bug: fix members tour (help), a selector was not valid anymore
- Fix a bug: unable to save OpenID extra_authorize_params as json
- Fix machine list bug : when there is no user logged in and access machines list with at least one machine associated to a space
- [TODO DEPLOY] `rails db:seed`

## v6.1.2 2023 October 2

Expand Down
15 changes: 15 additions & 0 deletions app/frontend/src/stylesheets/app.components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@
}
}

.modal-footer.btn-stack {
display: flex;
flex-direction: column;
gap: 1rem;

&::after,
&::before {
content: none;
}

& > * {
margin: 0 !important;
}
}

.modal-backdrop {
height: 100%;
}
Expand Down
16 changes: 8 additions & 8 deletions app/frontend/templates/admin/calendar/eventModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@ <h3 class="text-center red">
<p class="text-center font-sbold" translate>{{ 'app.admin.calendar.divide_this_availability' }}</p>
<div class="row">
<div class="col-md-5">
<div class="input-group">
<input type="number" class="form-control" ng-model="slots_nb" step="1" min="1" required="true" />
<span class="input-group-addon" translate>{{ 'app.admin.calendar.slots' }}</span>
</div>
<div class="form-group">
<input id="slots_nb" type="number" class="form-control" ng-model="slots_nb" step="1" min="1" required="true" />
<label for="slots_nb" translate>{{ 'app.admin.calendar.slots' }}</label>
</div>
</div>
<p class="col-md-2 middle-of-inputs" translate>
{{ 'app.admin.calendar.slots_of' }}
</p>
<div class="col-md-5">
<div class="input-group">
<input type="number" class="form-control" ng-model="availability.slot_duration" min="1" required="true" />
<span class="input-group-addon" translate>{{ 'app.admin.calendar.minutes' }}</span>
<div class="form-group">
<input id="slot_duration" type="number" class="form-control" ng-model="availability.slot_duration" min="1" required="true" />
<label for="slot_duration" translate>{{ 'app.admin.calendar.minutes' }}</label>
</div>
</div>
</div>
Expand Down Expand Up @@ -223,7 +223,7 @@ <h3 class="text-center red">
<p class="text-center font-sbold" translate>{{ 'app.admin.calendar.summary' }}</p>
<div class="row">
<span>{{ 'app.admin.calendar.about_to_create' | translate:{NUMBER:occurrences.length,TYPE:availability.available_type} }}</span>
<ul>
<ul style="max-height: 25vh; overflow: auto;">
<li ng-repeat="slot in occurrences">{{slot.start_at | amDateFormat:'L LT'}} - {{slot.end_at | amDateFormat:'LT'}}</li>
</ul>
<div class="alert alert-info text-xs" ng-show="availability.slot_duration">
Expand Down
56 changes: 28 additions & 28 deletions app/frontend/templates/admin/events/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,37 @@ <h1 translate>{{ 'app.admin.events.fablab_events' }}</h1>
</section>
</div>
</div>
</section>

<section class="m-lg events-management"
ui-tour="events"
ui-tour-backdrop="true"
ui-tour-template-url="'/shared/tour-step-template.html'"
ui-tour-use-hotkeys="true"
ui-tour-scroll-parent-id="content-main"
post-render="setupEventsTour">
<div class="row">
<div class="col-md-12" ng-if="isAuthorized('admin')">
<uib-tabset justified="true" active="tabs.active">
<uib-tab heading="{{ 'app.admin.events.settings' | translate }}" index="0">
<events-settings on-error="onError" on-success="onSuccess" ui-router="uiRouter"></events-settings>
</uib-tab>
<section class="m-lg events-management"
ui-tour="events"
ui-tour-backdrop="true"
ui-tour-template-url="'/shared/tour-step-template.html'"
ui-tour-use-hotkeys="true"
ui-tour-scroll-parent-id="content-main"
post-render="setupEventsTour">
<div class="row">
<div class="col-md-12" ng-if="isAuthorized('admin')">
<uib-tabset justified="true" active="tabs.active">
<uib-tab heading="{{ 'app.admin.events.settings' | translate }}" index="0">
<events-settings on-error="onError" on-success="onSuccess" ui-router="uiRouter"></events-settings>
</uib-tab>

<uib-tab heading="{{ 'app.admin.events.events_monitoring' | translate }}" index="1">
<ng-include src="'/admin/events/monitoring.html'"></ng-include>
</uib-tab>
<uib-tab heading="{{ 'app.admin.events.events_monitoring' | translate }}" index="1">
<ng-include src="'/admin/events/monitoring.html'"></ng-include>
</uib-tab>

<uib-tab heading="{{ 'app.admin.events.manage_filters' | translate }}" index="2">
<ng-include src="'/admin/events/filters.html'"></ng-include>
</uib-tab>
<uib-tab heading="{{ 'app.admin.events.manage_filters' | translate }}" index="2">
<ng-include src="'/admin/events/filters.html'"></ng-include>
</uib-tab>

<uib-tab heading="{{ 'app.admin.events.manage_prices_categories' | translate }}" index="3" class="prices-tab">
<ng-include src="'/admin/events/prices.html'"></ng-include>
</uib-tab>
</uib-tabset>
</div>
<div class="col-md-12" ng-if="isAuthorized('manager')">
<ng-include src="'/admin/events/monitoring.html'"></ng-include>
</div>
<uib-tab heading="{{ 'app.admin.events.manage_prices_categories' | translate }}" index="3" class="prices-tab">
<ng-include src="'/admin/events/prices.html'"></ng-include>
</uib-tab>
</uib-tabset>
</div>
<div class="col-md-12" ng-if="isAuthorized('manager')">
<ng-include src="'/admin/events/monitoring.html'"></ng-include>
</div>
</section>
</div>
</section>
1 change: 1 addition & 0 deletions app/frontend/templates/events/deleteRecurrent.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ <h1 translate>{{ 'app.public.events_show.confirmation_required' }}</h1>
<div class="modal-body">
<p ng-hide="isRecurrent" translate>{{ 'app.public.events_show.do_you_really_want_to_delete_this_event' }}</p>
<p ng-show="isRecurrent" translate>{{ 'app.public.events_show.delete_recurring_event' }}</p>
<p translate>{{ 'app.public.events_show.all_reservations_for_this_event_will_be_canceled' }}</p>
<div ng-show="isRecurrent" class="form-group">
<label class="checkbox">
<input type="radio" name="delete_mode" ng-model="deleteMode" value="single" required/>
Expand Down
85 changes: 42 additions & 43 deletions app/frontend/templates/events/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,61 +17,60 @@ <h1 translate>{{ 'app.public.events_list.the_fablab_s_events' }}</h1>
</section>
</div>
</div>
</section>

<section class="events-list-page">
<events-editorial-block on-error="onError"></events-editorial-block>

<section class="events-list-page">
<events-editorial-block on-error="onError"></events-editorial-block>

<div class="row">
<div class="col-md-3" ng-show="categories.length > 0">
<select ng-model="filters.category_id" ng-change="filterEvents()" class="form-control" ng-options="c.id as c.name for c in categories">
<option value="" translate>{{ 'app.public.events_list.all_categories' }}</option>
</select>
</div>

<div class="col-md-3" ng-show="themes.length > 0">
<select ng-model="filters.theme_id" ng-change="filterEvents()" class="form-control" ng-options="t.id as t.name for t in themes">
<option value="" translate>{{ 'app.public.events_list.all_themes' }}</option>
</select>
</div>
<div class="row">
<div class="col-md-3" ng-show="categories.length > 0">
<select ng-model="filters.category_id" ng-change="filterEvents()" class="form-control" ng-options="c.id as c.name for c in categories">
<option value="" translate>{{ 'app.public.events_list.all_categories' }}</option>
</select>
</div>

<div class="col-md-3" ng-show="ageRanges.length > 0">
<select ng-model="filters.age_range_id" ng-change="filterEvents()" class="form-control" ng-options="a.id as a.name for a in ageRanges">
<option value="" translate>{{ 'app.public.events_list.for_all' }}</option>
</select>
</div>
<div class="col-md-3" ng-show="themes.length > 0">
<select ng-model="filters.theme_id" ng-change="filterEvents()" class="form-control" ng-options="t.id as t.name for t in themes">
<option value="" translate>{{ 'app.public.events_list.all_themes' }}</option>
</select>
</div>

<div class="event-focus" ng-if="featuredEevent && (!currentUser || currentUser.role === 'member')">
<event-card style="display: contents"
event="featuredEevent"
card-type="'lg'"
ui-sref="app.public.events_show({id: featuredEevent.id})">
</event-card>
<div class="col-md-3" ng-show="ageRanges.length > 0">
<select ng-model="filters.age_range_id" ng-change="filterEvents()" class="form-control" ng-options="a.id as a.name for a in ageRanges">
<option value="" translate>{{ 'app.public.events_list.for_all' }}</option>
</select>
</div>
</div>

<div ng-repeat="month in monthOrder">
<h1>{{monthNames[month.split(',')[0] - 1]}}, {{month.split(',')[1]}}</h1>
<div class="event-focus" ng-if="featuredEevent && (!currentUser || currentUser.role === 'member')">
<event-card style="display: contents"
event="featuredEevent"
card-type="'lg'"
ui-sref="app.public.events_show({id: featuredEevent.id})">
</event-card>
</div>

<div class="event-monthList">
<event-card style="display: contents"
event="event"
ng-repeat="event in eventsGroupByMonth[month]"
card-type="'sm'"
ng-if="isAuthorized(['admin', 'manager']) || event.id !== featuredEevent.id"
ng-class="{'featured-event': event.id === featuredEevent.id}"
ui-sref="app.public.events_show({id: event.id})">
</event-card>
</div>
<div ng-repeat="month in monthOrder">
<h1>{{monthNames[month.split(',')[0] - 1]}}, {{month.split(',')[1]}}</h1>

<div class="event-monthList">
<event-card style="display: contents"
event="event"
ng-repeat="event in eventsGroupByMonth[month]"
card-type="'sm'"
ng-if="isAuthorized(['admin', 'manager']) || event.id !== featuredEevent.id"
ng-class="{'featured-event': event.id === featuredEevent.id}"
ui-sref="app.public.events_show({id: event.id})">
</event-card>
</div>

<div class="row">
</div>

<div class="row">

<div class="col-lg-12 text-center m-t-md">
<a class="btn btn-warning" ng-click="loadMoreEvents()" ng-hide="noMoreResults" translate>{{ 'app.public.events_list.load_the_next_events' }}</a>
</div>
<div class="col-lg-12 text-center m-t-md">
<a class="btn btn-warning" ng-click="loadMoreEvents()" ng-hide="noMoreResults" translate>{{ 'app.public.events_list.load_the_next_events' }}</a>
</div>
</div>

</section>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h1 translate>{{ 'app.shared.confirm_modify_slot_modal.change_the_slot' }}</h1>
<p ng-show="object.user && currentUser.id !== object.user.id" translate translate-values="{NAME: object.user.name}">{{ 'app.shared.confirm_modify_slot_modal.do_you_want_to_change_NAME_s_booking_slot_initially_planned_at' }}</p>
<p><strong>{{object.start | amDateFormat: 'LL'}} : {{object.start | amDateFormat:'LT'}} - {{object.end | amDateFormat:'LT'}}</strong></p>
</div>
<div class="modal-footer">
<div class="modal-footer btn-stack">
<button class="btn btn-warning" ng-class="{'m-b':object.cancelable&&object.movable}" ng-click="ok('cancel')" ng-show="object.cancelable" translate>{{ 'app.shared.confirm_modify_slot_modal.cancel_this_reservation' }}</button>
<button class="btn btn-info" ng-click="ok('move')" ng-show="object.movable" translate>{{ 'app.shared.confirm_modify_slot_modal.i_want_to_change_date' }}</button>
<button class="btn btn-default" ng-click="cancel()" translate>{{ 'app.shared.buttons.cancel' }}</button>
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/templates/shared/deviseModal.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="" id="loginModal">
<div class="modal-header">
<img ng-src="{{logoBlack.custom_asset_file_attributes.attachment_url}}" alt="{{logo.custom_asset_file_attributes.attachment}}" class="modal-logo"/>
<img ng-src="{{logoBlack.custom_asset_file_attributes.attachment_url}}" alt="" class="modal-logo"/>
<i class="fa fa-times close-modal-button" ng-click="dismiss()"></i>
<h1 translate translate-default="Login">
{{ 'app.public.common.connection' }}
Expand Down
6 changes: 4 additions & 2 deletions app/models/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ def amount_paid
# return a summary of the payment means used
def payment_means
res = []
res.push(means: :wallet, amount: wallet_amount) if paid_by_wallet?
res.push(means: :wallet, amount: wallet_amount || total) if paid_by_wallet?
return res if is_a?(Avoir)

if paid_by_card?
res.push(means: :card, amount: amount_paid)
else
Expand Down Expand Up @@ -195,7 +197,7 @@ def paid_by_card?
end

def paid_by_wallet?
wallet_transaction && wallet_amount.positive?
(wallet_transaction && wallet_amount.positive?) || payment_method == 'wallet'
end

def render_resource
Expand Down
2 changes: 1 addition & 1 deletion app/models/plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class Plan < ApplicationRecord

after_create :create_machines_prices
after_create :create_spaces_prices
after_create :create_statistic_type
after_create :set_name
after_create :create_statistic_type
after_create :update_gateway_product
after_update :update_gateway_product, if: :saved_change_to_base_name?

Expand Down
11 changes: 10 additions & 1 deletion app/services/event_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,16 @@ def delete(event_id, mode = 'single')
events.each do |e|
method = e.destroyable? ? :destroy : :soft_destroy!
# we use double negation because destroy can return either a boolean (false) or an Event (in case of delete success)
results.push status: !!e.send(method), event: e # rubocop:disable Style/DoubleNegation

ActiveRecord::Base.transaction do
status = !!e.send(method)
if status
e.reservations.preload(:slots_reservations).map(&:slots_reservations).flatten.map do |slots_reservation|
SlotsReservationsService.cancel(slots_reservation)
end
end
results.push status: status, event: e # rubocop:disable Style/DoubleNegation
end
end
results
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/slots_reservations_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class SlotsReservationsService
class << self
def cancel(slot_reservation)
# first we mark ths slot reservation as cancelled in DB, to free a ticket
slot_reservation.update(canceled_at: Time.current)
slot_reservation.update!(canceled_at: Time.current)

# then we try to remove this reservation from ElasticSearch, to keep the statistics up-to-date
model_name = slot_reservation.reservation.reservable.class.name
Expand Down
2 changes: 1 addition & 1 deletion app/views/api/events/_event.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if event.event_image
json.event_image_attributes do
json.id event.event_image.id
json.attachment_name event.event_image.attachment_identifier
json.attachment_url "#{event.event_image.attachment_url}?#{event.event_image.updated_at.to_i}"
json.attachment_url "#{event.event_image.attachment.large.url}?#{event.event_image.updated_at.to_i}"
end
end
json.event_files_attributes event.event_files do |f|
Expand Down
2 changes: 1 addition & 1 deletion app/views/api/machines/_machine.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if machine.machine_image
json.machine_image_attributes do
json.id machine.machine_image.id
json.attachment_name machine.machine_image.attachment_identifier
json.attachment_url machine.machine_image.attachment.url
json.attachment_url machine.machine_image.attachment.large.url
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/api/spaces/_space.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if space.space_image
json.space_image_attributes do
json.id space.space_image.id
json.attachment_name space.space_image.attachment_identifier
json.attachment_url space.space_image.attachment.url
json.attachment_url space.space_image.attachment.large.url
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/api/trainings/_training.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if training.training_image
json.training_image_attributes do
json.id training.training_image.id
json.attachment_name training.training_image.attachment_identifier
json.attachment_url training.training_image.attachment.url
json.attachment_url training.training_image.attachment.large.url
end
end

Expand Down
Loading

0 comments on commit 4979acc

Please sign in to comment.