mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-22 11:52:21 +01:00
Merge branch 'dev' into staging
This commit is contained in:
commit
7c703433ef
@ -5,6 +5,15 @@
|
||||
- Fix a bug: for project categories, if there is no category : do not show categories panel in show view, do not show categories input field in edit view
|
||||
- Fix a bug: unable to update status to paid for latest payment schedule item
|
||||
- Fix a bug: unable to generate statistic
|
||||
- Feature: add a filter in members list (admin) to show only "not validated" members
|
||||
- Concerning statistics:
|
||||
- removes age and type column from all statistics tabs (only in web, not in xlsx export file)
|
||||
- index:
|
||||
- renames user column header for projects tab and projects xlsx export
|
||||
- adds group name of user for every tab except projects tab
|
||||
- adds status and project users names for projects tab
|
||||
- [TODO DEPLOY] `rails db:seed`
|
||||
- [TODO DEPLOY] `rails fablab:es:build_stats`
|
||||
- [TODO DEPLOY] `rails fablab:maintenance:regenerate_statistics[2014,1]`
|
||||
|
||||
## v6.0.13 2023 August 28
|
||||
|
@ -6,7 +6,9 @@ class API::NotificationTypesController < API::APIController
|
||||
|
||||
def index
|
||||
@notification_types = if params[:is_configurable] == 'true'
|
||||
NotificationType.where(is_configurable: true)
|
||||
role = 'admin' if current_user.admin?
|
||||
role ||= 'manager' if current_user.manager?
|
||||
NotificationType.where(is_configurable: true).for_role(role)
|
||||
else
|
||||
NotificationType.all
|
||||
end
|
||||
|
@ -30,7 +30,7 @@ export const NotificationsCenter: React.FC<NotificationsCenterProps> = ({ onErro
|
||||
|
||||
return (
|
||||
<>
|
||||
{role === 'admin' && <FabTabs defaultTab='notifications-list' tabs={[
|
||||
{(role === 'admin' || role === 'manager') && <FabTabs defaultTab='notifications-list' tabs={[
|
||||
{
|
||||
id: 'notifications_settings',
|
||||
title: t('app.logged.notifications_center.notifications_settings'),
|
||||
@ -42,7 +42,7 @@ export const NotificationsCenter: React.FC<NotificationsCenterProps> = ({ onErro
|
||||
content: <NotificationsList onError={onError}/>
|
||||
}
|
||||
]} />}
|
||||
{role !== 'admin' && <NotificationsList onError={onError}/>}
|
||||
{role === 'member' && <NotificationsList onError={onError}/>}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
@ -163,6 +163,8 @@ Application.Controllers.controller('AdminMembersController', ['$scope', '$sce',
|
||||
// is user validation required
|
||||
$scope.enableUserValidationRequired = (settingsPromise.user_validation_required === 'true');
|
||||
|
||||
if ($scope.enableUserValidationRequired) { $scope.member.memberFilters.push('not_validated'); }
|
||||
|
||||
// should we display the username in the list?
|
||||
$scope.displayUsername = (settingsPromise.show_username_in_admin_list === 'true');
|
||||
|
||||
|
@ -256,12 +256,11 @@
|
||||
<tr>
|
||||
<th ng-if="['booking', 'hour'].includes(type.active.key)" translate>{{ 'app.admin.statistics.reservation_date' }}</th>
|
||||
<th ng-if="!['booking', 'hour'].includes(type.active.key)" translate>{{ 'app.admin.statistics.date' }}</th>
|
||||
<th translate>{{ 'app.admin.statistics.user' }}</th>
|
||||
<th ng-if="['project'].includes(type.active.key)" translate>{{ 'app.admin.statistics.project_author' }}</th>
|
||||
<th ng-if="!['project'].includes(type.active.key)" translate>{{ 'app.admin.statistics.user' }}</th>
|
||||
<th ng-if="reservationContextFeatureEnabled && reservationContextIsApplicable(selectedIndex.es_type_key)">
|
||||
{{ 'app.admin.statistics.reservation_context' | translate }}
|
||||
</th>
|
||||
<th translate>{{ 'app.admin.statistics.age' }}</th>
|
||||
<th translate>{{ 'app.admin.statistics.type' }}</th>
|
||||
<th ng-if="!type.active.simple">{{type.active.label}}</th>
|
||||
<th ng-repeat="field in selectedIndex.additional_fields">{{field.label}}</th>
|
||||
<th ng-if="selectedIndex.ca">{{ 'app.admin.statistics.revenue' | translate }}
|
||||
@ -285,11 +284,6 @@
|
||||
<td ng-if="reservationContextFeatureEnabled && reservationContextIsApplicable(selectedIndex.es_type_key)">
|
||||
{{ formatReservationContext(datum._source.reservationContextId) }}
|
||||
</td>
|
||||
<td>
|
||||
<span ng-if="datum._source.age">{{datum._source.age}} {{ 'app.admin.statistics.years_old' | translate }}</span>
|
||||
<span ng-if="!datum._source.age" translate>{{ 'app.admin.statistics.unknown' }}</span>
|
||||
</td>
|
||||
<td>{{formatSubtype(datum._source.subType)}}</td>
|
||||
<td ng-if="!type.active.simple">{{datum._source.stat}}</td>
|
||||
<td ng-repeat="field in selectedIndex.additional_fields">
|
||||
<ng-switch on="field.data_type">
|
||||
|
@ -13,6 +13,7 @@ module StatConcern
|
||||
attribute :gender, String
|
||||
attribute :age, Integer
|
||||
attribute :group, String
|
||||
attribute :groupName, String
|
||||
|
||||
# has include Elasticsearch::Persistence::Model
|
||||
index_name 'stats'
|
||||
|
@ -18,4 +18,14 @@ class NotificationType < ApplicationRecord
|
||||
validates :category, presence: true, inclusion: { in: %w[subscriptions user projects deprecated exports agenda trainings accountings
|
||||
app_management wallet payments users_accounts supporting_documents shop] }
|
||||
validates :is_configurable, inclusion: { in: [true, false] }
|
||||
|
||||
validate :validate_roles
|
||||
|
||||
scope :for_role, ->(role) { where("roles @> ?", "{#{role}}") }
|
||||
|
||||
private
|
||||
|
||||
def validate_roles
|
||||
errors.add(:roles, :invalid) if roles.any? { |r| !r.in?(%w(admin manager)) }
|
||||
end
|
||||
end
|
||||
|
@ -12,4 +12,6 @@ class Stats::Project
|
||||
attribute :components, Array
|
||||
attribute :machines, Array
|
||||
attribute :users, Integer
|
||||
attribute :status, String
|
||||
attribute :projectUserNames, Array
|
||||
end
|
||||
|
@ -92,6 +92,7 @@ class User < ApplicationRecord
|
||||
scope :with_subscription, -> { joins(statistic_profile: [:subscriptions]) }
|
||||
scope :not_confirmed, -> { where(confirmed_at: nil) }
|
||||
scope :inactive_for_3_years, -> { where('users.last_sign_in_at < ?', 3.years.ago) }
|
||||
scope :not_validated, -> { where(validated_at: nil) }
|
||||
|
||||
def to_json(*)
|
||||
ApplicationController.new.view_context.render(
|
||||
|
@ -3,10 +3,10 @@
|
||||
# Check the access policies for API::NotificationPreferencesController
|
||||
class NotificationPreferencePolicy < ApplicationPolicy
|
||||
def update?
|
||||
user.admin?
|
||||
user.admin? || user.manager?
|
||||
end
|
||||
|
||||
def bulk_update?
|
||||
user.admin?
|
||||
user.admin? || user.manager?
|
||||
end
|
||||
end
|
||||
|
@ -35,7 +35,7 @@ class Members::ListService
|
||||
'plans.base_name ILIKE :search', search: "%#{params[:search]}%")
|
||||
end
|
||||
|
||||
filter = params[:filter].presence_in(%w[inactive_for_3_years not_confirmed]) || nil
|
||||
filter = params[:filter].presence_in(%w[inactive_for_3_years not_confirmed not_validated]) || nil
|
||||
@query = @query.send(filter) if filter
|
||||
|
||||
@query
|
||||
|
@ -11,7 +11,8 @@ class Statistics::Builders::MembersBuilderService
|
||||
Stats::Account.create({ date: format_date(m[:date]),
|
||||
type: 'member',
|
||||
subType: 'created',
|
||||
stat: 1 }.merge(user_info_stat(m)))
|
||||
stat: 1,
|
||||
groupName: m[:groupName] }.merge(user_info_stat(m)))
|
||||
end
|
||||
|
||||
# member ca list
|
||||
@ -19,7 +20,8 @@ class Statistics::Builders::MembersBuilderService
|
||||
Stats::User.create({ date: format_date(m[:date]),
|
||||
type: 'revenue',
|
||||
subType: m[:group],
|
||||
stat: m[:ca] }.merge(user_info_stat(m)))
|
||||
stat: m[:ca],
|
||||
groupName: m[:groupName] }.merge(user_info_stat(m)))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -19,7 +19,8 @@ class Statistics::Builders::ReservationsBuilderService
|
||||
name: r["#{category}_name".to_sym],
|
||||
reservationId: r[:reservation_id],
|
||||
reservationContextId: r[:reservation_context_id],
|
||||
coupon: r[:coupon]
|
||||
coupon: r[:coupon],
|
||||
groupName: r[:groupName],
|
||||
}.merge(user_info_stat(r)))
|
||||
stat[:stat] = (type == 'booking' ? 1 : r[:nb_hours])
|
||||
stat["#{category}Id".to_sym] = r["#{category}_id".to_sym]
|
||||
|
@ -23,6 +23,7 @@ class Statistics::Builders::StoreOrdersBuilderService
|
||||
orderId: o[:order_id],
|
||||
state: o[:order_state],
|
||||
coupon: o[:coupon],
|
||||
groupName: o[:groupName],
|
||||
stat: 1 }.merge(user_info_stat(o)))
|
||||
end
|
||||
end
|
||||
|
@ -31,6 +31,12 @@ module Statistics::Concerns::ProjectsConcern
|
||||
sum
|
||||
end
|
||||
|
||||
def get_project_user_names(project)
|
||||
project.project_users.map do |project_user|
|
||||
{ id: project_user.user.id, name: project_user.user.profile.full_name }
|
||||
end
|
||||
end
|
||||
|
||||
def project_info(project)
|
||||
{
|
||||
project_id: project.id,
|
||||
@ -41,7 +47,9 @@ module Statistics::Concerns::ProjectsConcern
|
||||
project_themes: get_project_themes(project),
|
||||
project_components: get_projects_components(project),
|
||||
project_machines: get_projects_machines(project),
|
||||
project_users: get_project_users(project)
|
||||
project_users: get_project_users(project),
|
||||
project_status: project.status&.name,
|
||||
project_user_names: get_project_user_names(project),
|
||||
}
|
||||
end
|
||||
|
||||
@ -53,7 +61,9 @@ module Statistics::Concerns::ProjectsConcern
|
||||
themes: project[:project_themes],
|
||||
components: project[:project_components],
|
||||
machines: project[:project_machines],
|
||||
users: project[:project_users]
|
||||
users: project[:project_users],
|
||||
status: project[:project_status],
|
||||
projectUserNames: project[:project_user_names],
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -207,7 +207,7 @@ class Statistics::FetcherService
|
||||
# @yieldparam [Hash]
|
||||
def each_project(options = default_options)
|
||||
Project.where('projects.published_at >= :start_date AND projects.published_at <= :end_date', options)
|
||||
.eager_load(:licence, :themes, :components, :machines, :project_users, author: [:group])
|
||||
.eager_load(:licence, :themes, :components, :machines, :status, project_users: [{ user: :profile }], author: [:group])
|
||||
.find_each do |p|
|
||||
result = { date: p.created_at.to_date }.merge(user_info(p.author)).merge(project_info(p))
|
||||
yield result
|
||||
@ -261,7 +261,8 @@ class Statistics::FetcherService
|
||||
user_id: statistic_profile.user_id,
|
||||
gender: statistic_profile.str_gender,
|
||||
age: statistic_profile.age,
|
||||
group: statistic_profile.group ? statistic_profile.group.slug : nil
|
||||
group: statistic_profile.group ? statistic_profile.group.slug : nil,
|
||||
groupName: statistic_profile.group ? statistic_profile.group.name : nil,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -20,7 +20,8 @@ wb.add_worksheet(name: ExcelService.name_safe(index.label)) do |sheet|
|
||||
|
||||
## data table
|
||||
# heading labels
|
||||
columns = [t('export.date'), t('export.user'), t('export.email'), t('export.phone'), t('export.gender'), t('export.age'),
|
||||
user_heading_text = index.es_type_key == "project" ? t('export.project_author') : t('export.user')
|
||||
columns = [t('export.date'), user_heading_text, t('export.email'), t('export.phone'), t('export.gender'), t('export.age'),
|
||||
t('export.type')]
|
||||
columns.push type.label unless type.simple
|
||||
fields.each do |f|
|
||||
|
@ -12,7 +12,8 @@ indices.each do |index|
|
||||
wb.add_worksheet(name: ExcelService.statistic_type_sheet_name(type, wb)) do |sheet|
|
||||
## data table
|
||||
# heading labels
|
||||
columns = [t('export.date'), t('export.user'), t('export.email'), t('export.phone'), t('export.gender'), t('export.age'),
|
||||
user_heading_text = index.es_type_key == "project" ? t('export.project_author') : t('export.user')
|
||||
columns = [t('export.date'), user_heading_text, t('export.email'), t('export.phone'), t('export.gender'), t('export.age'),
|
||||
t('export.type')]
|
||||
columns.push type.label unless type.simple
|
||||
index.statistic_fields.each do |f|
|
||||
|
@ -1192,6 +1192,7 @@ de:
|
||||
member_filter_all: "Alle"
|
||||
member_filter_not_confirmed: "Nicht bestätigt"
|
||||
member_filter_inactive_for_3_years: "Seit 3 Jahren inaktiv"
|
||||
member_filter_not_validated: "Not validated"
|
||||
#add a member
|
||||
members_new:
|
||||
add_a_member: "Mitglied hinzufügen"
|
||||
@ -1537,6 +1538,7 @@ de:
|
||||
click_here: "Klicken Sie hier, um die erste zu erstellen."
|
||||
average_cart: "Average cart:"
|
||||
reservation_context: Reservation context
|
||||
project_author: Author
|
||||
#statistics graphs
|
||||
stats_graphs:
|
||||
statistics: "Statistiken"
|
||||
|
@ -1245,6 +1245,7 @@ en:
|
||||
member_filter_all: "All"
|
||||
member_filter_not_confirmed: "Unconfirmed"
|
||||
member_filter_inactive_for_3_years: "Inactive for 3 years"
|
||||
member_filter_not_validated: "Not validated"
|
||||
members_list_item:
|
||||
item_type: "member"
|
||||
surname: "Surname"
|
||||
@ -1604,6 +1605,7 @@ en:
|
||||
click_here: "Click here to create your first one."
|
||||
average_cart: "Average cart:"
|
||||
reservation_context: Reservation context
|
||||
project_author: Author
|
||||
#statistics graphs
|
||||
stats_graphs:
|
||||
statistics: "Statistics"
|
||||
|
@ -1192,6 +1192,7 @@ es:
|
||||
member_filter_all: "Todos"
|
||||
member_filter_not_confirmed: "No confirmado"
|
||||
member_filter_inactive_for_3_years: "Inactivo por 3 años"
|
||||
member_filter_not_validated: "Not validated"
|
||||
#add a member
|
||||
members_new:
|
||||
add_a_member: "Agregar un miembro"
|
||||
@ -1537,6 +1538,7 @@ es:
|
||||
click_here: "Haga clic aquí para crear su primero."
|
||||
average_cart: "Carrito medio:"
|
||||
reservation_context: Contexto de la reserva
|
||||
project_author: Author
|
||||
#statistics graphs
|
||||
stats_graphs:
|
||||
statistics: "Estadísticas"
|
||||
|
@ -1245,6 +1245,7 @@ fr:
|
||||
member_filter_all: "Tous"
|
||||
member_filter_not_confirmed: "Non confirmés"
|
||||
member_filter_inactive_for_3_years: "Inactifs depuis 3 ans"
|
||||
member_filter_not_validated: "Non validés"
|
||||
#add a member
|
||||
members_new:
|
||||
add_a_member: "Ajouter un membre"
|
||||
@ -1596,6 +1597,7 @@ fr:
|
||||
click_here: "Cliquez ici pour créer votre première formule."
|
||||
average_cart: "Panier moyen :"
|
||||
reservation_context: Nature de la réservation
|
||||
project_author: Auteur
|
||||
#statistics graphs
|
||||
stats_graphs:
|
||||
statistics: "Statistiques"
|
||||
|
@ -1192,6 +1192,7 @@ it:
|
||||
member_filter_all: "Tutti"
|
||||
member_filter_not_confirmed: "Non confermati"
|
||||
member_filter_inactive_for_3_years: "Inattivo per 3 anni"
|
||||
member_filter_not_validated: "Not validated"
|
||||
#add a member
|
||||
members_new:
|
||||
add_a_member: "Aggiungi un utente"
|
||||
@ -1537,6 +1538,7 @@ it:
|
||||
click_here: "Clicca qui per creare il tuo primo."
|
||||
average_cart: "Media carrello:"
|
||||
reservation_context: Reservation context
|
||||
project_author: Author
|
||||
#statistics graphs
|
||||
stats_graphs:
|
||||
statistics: "Statistiche"
|
||||
|
@ -1192,6 +1192,7 @@
|
||||
member_filter_all: "Alle"
|
||||
member_filter_not_confirmed: "Ubekreftet"
|
||||
member_filter_inactive_for_3_years: "Inaktiv i 3 år"
|
||||
member_filter_not_validated: "Not validated"
|
||||
#add a member
|
||||
members_new:
|
||||
add_a_member: "Legg til medlem"
|
||||
@ -1537,6 +1538,7 @@
|
||||
click_here: "Klikk her for å opprette din første."
|
||||
average_cart: "Average cart:"
|
||||
reservation_context: Reservation context
|
||||
project_author: Author
|
||||
#statistics graphs
|
||||
stats_graphs:
|
||||
statistics: "Statistikk"
|
||||
|
@ -1192,6 +1192,7 @@ pt:
|
||||
member_filter_all: "Tudo"
|
||||
member_filter_not_confirmed: "Não Confirmado"
|
||||
member_filter_inactive_for_3_years: "Inativo por 3 anos"
|
||||
member_filter_not_validated: "Not validated"
|
||||
#add a member
|
||||
members_new:
|
||||
add_a_member: "Adicionar membro"
|
||||
@ -1537,6 +1538,7 @@ pt:
|
||||
click_here: "Clique aqui para criar o seu primeiro."
|
||||
average_cart: "Average cart:"
|
||||
reservation_context: Reservation context
|
||||
project_author: Author
|
||||
#statistics graphs
|
||||
stats_graphs:
|
||||
statistics: "Estatísticas"
|
||||
|
@ -1192,6 +1192,7 @@ zu:
|
||||
member_filter_all: "crwdns25726:0crwdne25726:0"
|
||||
member_filter_not_confirmed: "crwdns25728:0crwdne25728:0"
|
||||
member_filter_inactive_for_3_years: "crwdns25730:0crwdne25730:0"
|
||||
member_filter_not_validated: "crwdns37713:0crwdne37713:0"
|
||||
#add a member
|
||||
members_new:
|
||||
add_a_member: "crwdns25732:0crwdne25732:0"
|
||||
@ -1537,6 +1538,7 @@ zu:
|
||||
click_here: "crwdns26302:0crwdne26302:0"
|
||||
average_cart: "crwdns31248:0crwdne31248:0"
|
||||
reservation_context: crwdns37675:0crwdne37675:0
|
||||
project_author: crwdns37715:0crwdne37715:0
|
||||
#statistics graphs
|
||||
stats_graphs:
|
||||
statistics: "crwdns26304:0crwdne26304:0"
|
||||
|
@ -489,6 +489,9 @@ de:
|
||||
store: "Shop"
|
||||
paid-processed: "Bezahlt und/oder bearbeitet"
|
||||
aborted: "Abgebrochen"
|
||||
project_status: Status
|
||||
project_name: Name
|
||||
project_user_names: Collaborators
|
||||
#statistics exports to the Excel file format
|
||||
export:
|
||||
entries: "Einträge"
|
||||
@ -507,6 +510,7 @@ de:
|
||||
deleted_user: "Gelöschte Benutzer"
|
||||
reservation_context: "Reservation context"
|
||||
coupon: "Coupon"
|
||||
project_author: Author
|
||||
#initial price's category for events, created to replace the old "reduced amount" property
|
||||
price_category:
|
||||
reduced_fare: "Ermäßigter Tarif"
|
||||
|
@ -519,6 +519,9 @@ en:
|
||||
store: "Store"
|
||||
paid-processed: "Paid and/or processed"
|
||||
aborted: "Aborted"
|
||||
project_status: Status
|
||||
project_name: Name
|
||||
project_user_names: Collaborators
|
||||
#statistics exports to the Excel file format
|
||||
export:
|
||||
entries: "Entries"
|
||||
@ -537,6 +540,7 @@ en:
|
||||
deleted_user: "Deleted user"
|
||||
reservation_context: "Reservation context"
|
||||
coupon: "Coupon"
|
||||
project_author: Author
|
||||
#initial price's category for events, created to replace the old "reduced amount" property
|
||||
price_category:
|
||||
reduced_fare: "Reduced fare"
|
||||
|
@ -489,6 +489,9 @@ es:
|
||||
store: "Tienda"
|
||||
paid-processed: "Pagado y/o procesado"
|
||||
aborted: "Abortado"
|
||||
project_status: Status
|
||||
project_name: Name
|
||||
project_user_names: Collaborators
|
||||
#statistics exports to the Excel file format
|
||||
export:
|
||||
entries: "Entradas"
|
||||
@ -507,6 +510,7 @@ es:
|
||||
deleted_user: "Usuario suprimido"
|
||||
reservation_context: "Contexto de la reserva"
|
||||
coupon: "Cupón"
|
||||
project_author: Author
|
||||
#initial price's category for events, created to replace the old "reduced amount" property
|
||||
price_category:
|
||||
reduced_fare: "Tarifa reducida"
|
||||
|
@ -519,6 +519,9 @@ fr:
|
||||
store: "Boutique"
|
||||
paid-processed: "Payée et/ou traitée"
|
||||
aborted: "Interrompue"
|
||||
project_status: Statut
|
||||
project_name: Nom
|
||||
project_user_names: Collaborateurs
|
||||
#statistics exports to the Excel file format
|
||||
export:
|
||||
entries: "Entrées"
|
||||
@ -537,6 +540,7 @@ fr:
|
||||
deleted_user: "Utilisateur supprimé"
|
||||
reservation_context: "Nature de la réservation"
|
||||
coupon: "Code promo"
|
||||
project_author: Auteur
|
||||
#initial price's category for events, created to replace the old "reduced amount" property
|
||||
price_category:
|
||||
reduced_fare: "Tarif réduit"
|
||||
|
@ -489,6 +489,9 @@ it:
|
||||
store: "Negozio"
|
||||
paid-processed: "Pagato e/o processato"
|
||||
aborted: "Interruzione"
|
||||
project_status: Status
|
||||
project_name: Name
|
||||
project_user_names: Collaborators
|
||||
#statistics exports to the Excel file format
|
||||
export:
|
||||
entries: "Voci"
|
||||
@ -507,6 +510,7 @@ it:
|
||||
deleted_user: "Utente eliminato"
|
||||
reservation_context: "Reservation context"
|
||||
coupon: "Coupon"
|
||||
project_author: Author
|
||||
#initial price's category for events, created to replace the old "reduced amount" property
|
||||
price_category:
|
||||
reduced_fare: "Tariffa ridotta"
|
||||
|
@ -489,6 +489,9 @@
|
||||
store: "Store"
|
||||
paid-processed: "Paid and/or processed"
|
||||
aborted: "Aborted"
|
||||
project_status: Status
|
||||
project_name: Name
|
||||
project_user_names: Collaborators
|
||||
#statistics exports to the Excel file format
|
||||
export:
|
||||
entries: "Oppføringer"
|
||||
@ -507,6 +510,7 @@
|
||||
deleted_user: "Deleted user"
|
||||
reservation_context: "Reservation context"
|
||||
coupon: "Coupon"
|
||||
project_author: Author
|
||||
#initial price's category for events, created to replace the old "reduced amount" property
|
||||
price_category:
|
||||
reduced_fare: "Redusert avgift"
|
||||
|
@ -489,6 +489,9 @@ pt:
|
||||
store: "Store"
|
||||
paid-processed: "Paid and/or processed"
|
||||
aborted: "Aborted"
|
||||
project_status: Status
|
||||
project_name: Name
|
||||
project_user_names: Collaborators
|
||||
#statistics exports to the Excel file format
|
||||
export:
|
||||
entries: "Entradas"
|
||||
@ -507,6 +510,7 @@ pt:
|
||||
deleted_user: "Deleted user"
|
||||
reservation_context: "Reservation context"
|
||||
coupon: "Coupon"
|
||||
project_author: Author
|
||||
#initial price's category for events, created to replace the old "reduced amount" property
|
||||
price_category:
|
||||
reduced_fare: "Tarifa reduzida"
|
||||
|
@ -489,6 +489,9 @@ zu:
|
||||
store: "crwdns31715:0crwdne31715:0"
|
||||
paid-processed: "crwdns31717:0crwdne31717:0"
|
||||
aborted: "crwdns31719:0crwdne31719:0"
|
||||
project_status: crwdns37717:0crwdne37717:0
|
||||
project_name: crwdns37719:0crwdne37719:0
|
||||
project_user_names: crwdns37721:0crwdne37721:0
|
||||
#statistics exports to the Excel file format
|
||||
export:
|
||||
entries: "crwdns3739:0crwdne3739:0"
|
||||
@ -507,6 +510,7 @@ zu:
|
||||
deleted_user: "crwdns31747:0crwdne31747:0"
|
||||
reservation_context: "crwdns37707:0crwdne37707:0"
|
||||
coupon: "crwdns37709:0crwdne37709:0"
|
||||
project_author: crwdns37723:0crwdne37723:0
|
||||
#initial price's category for events, created to replace the old "reduced amount" property
|
||||
price_category:
|
||||
reduced_fare: "crwdns3765:0crwdne3765:0"
|
||||
|
@ -0,0 +1,7 @@
|
||||
class AddRolesToNotificationTypes < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
add_column :notification_types, :roles, :string, array: true, default: []
|
||||
add_index :notification_types, :roles
|
||||
load Rails.root.join('db/seeds/notification_types.rb')
|
||||
end
|
||||
end
|
@ -1,109 +1,110 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
NOTIFICATIONS_TYPES = [
|
||||
{ name: 'notify_admin_when_project_published', category: 'projects', is_configurable: true },
|
||||
{ name: 'notify_admin_when_project_published', category: 'projects', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_project_collaborator_to_valid', category: 'projects', is_configurable: false },
|
||||
{ name: 'notify_project_author_when_collaborator_valid', category: 'projects', is_configurable: true },
|
||||
{ name: 'notify_project_author_when_collaborator_valid', category: 'projects', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_user_training_valid', category: 'trainings', is_configurable: false },
|
||||
{ name: 'notify_member_subscribed_plan', category: 'subscriptions', is_configurable: false },
|
||||
{ name: 'notify_member_create_reservation', category: 'agenda', is_configurable: false },
|
||||
{ name: 'notify_member_subscribed_plan_is_changed', category: 'deprecated', is_configurable: false },
|
||||
{ name: 'notify_admin_member_create_reservation', category: 'agenda', is_configurable: true },
|
||||
{ name: 'notify_admin_member_create_reservation', category: 'agenda', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_member_slot_is_modified', category: 'agenda', is_configurable: false },
|
||||
{ name: 'notify_admin_slot_is_modified', category: 'agenda', is_configurable: true },
|
||||
{ name: 'notify_admin_slot_is_modified', category: 'agenda', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
|
||||
{ name: 'notify_admin_when_user_is_created', category: 'users_accounts', is_configurable: true },
|
||||
{ name: 'notify_admin_subscribed_plan', category: 'subscriptions', is_configurable: true },
|
||||
{ name: 'notify_user_when_invoice_ready', category: 'payments', is_configurable: true },
|
||||
{ name: 'notify_admin_when_user_is_created', category: 'users_accounts', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_admin_subscribed_plan', category: 'subscriptions', is_configurable: true, roles: ['admin'] },
|
||||
{ name: 'notify_user_when_invoice_ready', category: 'payments', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_member_subscription_will_expire_in_7_days', category: 'subscriptions', is_configurable: false },
|
||||
{ name: 'notify_member_subscription_is_expired', category: 'subscriptions', is_configurable: false },
|
||||
{ name: 'notify_admin_subscription_will_expire_in_7_days', category: 'subscriptions', is_configurable: true },
|
||||
{ name: 'notify_admin_subscription_is_expired', category: 'subscriptions', is_configurable: true },
|
||||
{ name: 'notify_admin_subscription_canceled', category: 'subscriptions', is_configurable: true },
|
||||
{ name: 'notify_admin_subscription_will_expire_in_7_days', category: 'subscriptions', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_admin_subscription_is_expired', category: 'subscriptions', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_admin_subscription_canceled', category: 'subscriptions', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_member_subscription_canceled', category: 'subscriptions', is_configurable: false },
|
||||
{ name: 'notify_user_when_avoir_ready', category: 'wallet', is_configurable: false },
|
||||
|
||||
{ name: 'notify_member_slot_is_canceled', category: 'agenda', is_configurable: false },
|
||||
{ name: 'notify_admin_slot_is_canceled', category: 'agenda', is_configurable: true },
|
||||
{ name: 'notify_admin_slot_is_canceled', category: 'agenda', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_partner_subscribed_plan', category: 'subscriptions', is_configurable: false },
|
||||
{ name: 'notify_member_subscription_extended', category: 'subscriptions', is_configurable: false },
|
||||
{ name: 'notify_admin_subscription_extended', category: 'subscriptions', is_configurable: true },
|
||||
{ name: 'notify_admin_user_group_changed', category: 'users_accounts', is_configurable: true },
|
||||
{ name: 'notify_admin_subscription_extended', category: 'subscriptions', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_admin_user_group_changed', category: 'users_accounts', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_user_user_group_changed', category: 'users_accounts', is_configurable: false },
|
||||
{ name: 'notify_admin_when_user_is_imported', category: 'users_accounts', is_configurable: true },
|
||||
{ name: 'notify_admin_when_user_is_imported', category: 'users_accounts', is_configurable: true, roles: ['admin'] },
|
||||
{ name: 'notify_user_profile_complete', category: 'users_accounts', is_configurable: false },
|
||||
{ name: 'notify_user_auth_migration', category: 'user', is_configurable: false },
|
||||
|
||||
{ name: 'notify_admin_user_merged', category: 'users_accounts', is_configurable: true },
|
||||
{ name: 'notify_admin_profile_complete', category: 'users_accounts', is_configurable: true },
|
||||
{ name: 'notify_admin_abuse_reported', category: 'projects', is_configurable: true },
|
||||
{ name: 'notify_admin_user_merged', category: 'users_accounts', is_configurable: true, roles: ['admin'] },
|
||||
{ name: 'notify_admin_profile_complete', category: 'users_accounts', is_configurable: true, roles: ['admin'] },
|
||||
{ name: 'notify_admin_abuse_reported', category: 'projects', is_configurable: true, roles: ['admin'] },
|
||||
{ name: 'notify_admin_invoicing_changed', category: 'deprecated', is_configurable: false },
|
||||
{ name: 'notify_user_wallet_is_credited', category: 'wallet', is_configurable: false },
|
||||
{ name: 'notify_admin_user_wallet_is_credited', category: 'wallet', is_configurable: true },
|
||||
{ name: 'notify_admin_user_wallet_is_credited', category: 'wallet', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_admin_export_complete', category: 'exports', is_configurable: false },
|
||||
{ name: 'notify_member_about_coupon', category: 'agenda', is_configurable: false },
|
||||
{ name: 'notify_member_reservation_reminder', category: 'agenda', is_configurable: false },
|
||||
|
||||
{ name: 'notify_admin_free_disk_space', category: 'app_management', is_configurable: false },
|
||||
{ name: 'notify_admin_close_period_reminder', category: 'accountings', is_configurable: true },
|
||||
{ name: 'notify_admin_archive_complete', category: 'accountings', is_configurable: true },
|
||||
{ name: 'notify_admin_close_period_reminder', category: 'accountings', is_configurable: true, roles: ['admin'] },
|
||||
{ name: 'notify_admin_archive_complete', category: 'accountings', is_configurable: true, roles: ['admin'] },
|
||||
{ name: 'notify_privacy_policy_changed', category: 'app_management', is_configurable: false },
|
||||
{ name: 'notify_admin_import_complete', category: 'app_management', is_configurable: false },
|
||||
{ name: 'notify_admin_refund_created', category: 'wallet', is_configurable: true },
|
||||
{ name: 'notify_admins_role_update', category: 'users_accounts', is_configurable: true },
|
||||
{ name: 'notify_admin_refund_created', category: 'wallet', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_admins_role_update', category: 'users_accounts', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_user_role_update', category: 'users_accounts', is_configurable: false },
|
||||
{ name: 'notify_admin_objects_stripe_sync', category: 'payments', is_configurable: false },
|
||||
{ name: 'notify_user_when_payment_schedule_ready', category: 'payments', is_configurable: false },
|
||||
|
||||
{ name: 'notify_admin_payment_schedule_failed', category: 'payments', is_configurable: true },
|
||||
{ name: 'notify_admin_payment_schedule_failed', category: 'payments', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_member_payment_schedule_failed', category: 'payments', is_configurable: false },
|
||||
{ name: 'notify_admin_payment_schedule_check_deadline', category: 'payments', is_configurable: true },
|
||||
{ name: 'notify_admin_payment_schedule_transfer_deadline', category: 'payments', is_configurable: true },
|
||||
{ name: 'notify_admin_payment_schedule_error', category: 'payments', is_configurable: true },
|
||||
{ name: 'notify_admin_payment_schedule_check_deadline', category: 'payments', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_admin_payment_schedule_transfer_deadline', category: 'payments', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_admin_payment_schedule_error', category: 'payments', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_member_payment_schedule_error', category: 'payments', is_configurable: false },
|
||||
{ name: 'notify_admin_payment_schedule_gateway_canceled', category: 'payments', is_configurable: true },
|
||||
{ name: 'notify_admin_payment_schedule_gateway_canceled', category: 'payments', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_member_payment_schedule_gateway_canceled', category: 'payments', is_configurable: false },
|
||||
{ name: 'notify_admin_user_supporting_document_files_created', category: 'supporting_documents', is_configurable: true },
|
||||
{ name: 'notify_admin_user_supporting_document_files_updated', category: 'supporting_documents', is_configurable: true },
|
||||
{ name: 'notify_admin_user_supporting_document_files_created', category: 'supporting_documents', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_admin_user_supporting_document_files_updated', category: 'supporting_documents', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
|
||||
{ name: 'notify_user_is_validated', category: 'users_accounts', is_configurable: false },
|
||||
{ name: 'notify_user_is_invalidated', category: 'users_accounts', is_configurable: false },
|
||||
{ name: 'notify_user_supporting_document_refusal', category: 'supporting_documents', is_configurable: false },
|
||||
{ name: 'notify_admin_user_supporting_document_refusal', category: 'supporting_documents', is_configurable: true },
|
||||
{ name: 'notify_admin_user_supporting_document_refusal', category: 'supporting_documents', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_admin_order_is_paid', category: 'shop', is_configurable: false },
|
||||
{ name: 'notify_user_order_is_ready', category: 'shop', is_configurable: false },
|
||||
{ name: 'notify_user_order_is_canceled', category: 'shop', is_configurable: false },
|
||||
{ name: 'notify_user_order_is_refunded', category: 'shop', is_configurable: false },
|
||||
{ name: 'notify_admin_low_stock_threshold', category: 'shop', is_configurable: true },
|
||||
{ name: 'notify_admin_training_auto_cancelled', category: 'trainings', is_configurable: true },
|
||||
{ name: 'notify_admin_low_stock_threshold', category: 'shop', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_admin_training_auto_cancelled', category: 'trainings', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_member_training_auto_cancelled', category: 'trainings', is_configurable: false },
|
||||
|
||||
{ name: 'notify_member_training_authorization_expired', category: 'trainings', is_configurable: false },
|
||||
{ name: 'notify_member_training_invalidated', category: 'trainings', is_configurable: false },
|
||||
{ name: 'notify_admin_order_is_paid', category: 'shop', is_configurable: true },
|
||||
{ name: 'notify_member_reservation_limit_reached', category: 'agenda', is_configurable: false },
|
||||
{ name: 'notify_admin_user_child_supporting_document_refusal', category: 'supporting_documents', is_configurable: true },
|
||||
{ name: 'notify_admin_user_child_supporting_document_refusal', category: 'supporting_documents', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_user_child_supporting_document_refusal', category: 'supporting_documents', is_configurable: false },
|
||||
{ name: 'notify_admin_child_created', category: 'users_accounts', is_configurable: true },
|
||||
{ name: 'notify_admin_child_created', category: 'users_accounts', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_user_child_is_validated', category: 'users_accounts', is_configurable: false },
|
||||
{ name: 'notify_user_child_is_invalidated', category: 'users_accounts', is_configurable: false },
|
||||
{ name: 'notify_admin_user_child_supporting_document_files_updated', category: 'supporting_documents', is_configurable: true },
|
||||
{ name: 'notify_admin_user_child_supporting_document_files_created', category: 'supporting_documents', is_configurable: true },
|
||||
{ name: 'notify_admin_user_child_supporting_document_files_updated', category: 'supporting_documents', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_admin_user_child_supporting_document_files_created', category: 'supporting_documents', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
|
||||
{ name: 'notify_member_reservation_validated', category: 'agenda', is_configurable: false },
|
||||
{ name: 'notify_admin_reservation_validated', category: 'agenda', is_configurable: true },
|
||||
{ name: 'notify_admin_reservation_validated', category: 'agenda', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_member_pre_booked_reservation', category: 'agenda', is_configurable: false },
|
||||
{ name: 'notify_admin_member_pre_booked_reservation', category: 'agenda', is_configurable: true },
|
||||
{ name: 'notify_admin_member_pre_booked_reservation', category: 'agenda', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_member_reservation_invalidated', category: 'agenda', is_configurable: false },
|
||||
{ name: 'notify_admin_reservation_invalidated', category: 'agenda', is_configurable: true },
|
||||
{ name: 'notify_user_when_child_age_will_be_18', category: 'users_accounts', is_configurable: false },
|
||||
{ name: 'notify_admin_reservation_invalidated', category: 'agenda', is_configurable: true, roles: ['admin', 'manager'] },
|
||||
{ name: 'notify_user_when_child_age_will_be_18', category: 'users_accounts', is_configurable: false }
|
||||
|
||||
].freeze
|
||||
|
||||
NOTIFICATIONS_TYPES.each do |notification_type|
|
||||
next if NotificationType.find_by(name: notification_type[:name])
|
||||
NOTIFICATIONS_TYPES.each do |notification_type_attrs|
|
||||
notification_type = NotificationType.find_by(name: notification_type_attrs[:name])
|
||||
|
||||
NotificationType.create!(
|
||||
name: notification_type[:name],
|
||||
category: notification_type[:category],
|
||||
is_configurable: notification_type[:is_configurable]
|
||||
)
|
||||
if notification_type
|
||||
notification_type.update!(notification_type_attrs)
|
||||
else
|
||||
NotificationType.create!(notification_type_attrs)
|
||||
end
|
||||
end
|
||||
|
@ -30,49 +30,76 @@ statistic_index_space = StatisticIndex.find_by(es_type_key: 'space')
|
||||
statistic_index_order = StatisticIndex.find_by(es_type_key: 'order')
|
||||
|
||||
# statistic_fields
|
||||
unless StatisticField.find_by(key: 'spaceDates')
|
||||
unless StatisticField.find_by(key: 'spaceDates', statistic_index_id: statistic_index_space.id)
|
||||
StatisticField.create!({ key: 'spaceDates', label: I18n.t('statistics.space_dates'),
|
||||
statistic_index_id: statistic_index_space.id, data_type: 'list' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'machineDates')
|
||||
unless StatisticField.find_by(key: 'groupName', statistic_index_id: statistic_index_space.id)
|
||||
StatisticField.create!({ key: 'groupName', label: I18n.t('statistics.group'), statistic_index_id: statistic_index_space.id, data_type: 'text' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'machineDates', statistic_index_id: 2)
|
||||
StatisticField.create!({ key: 'machineDates', label: I18n.t('statistics.machine_dates'), statistic_index_id: 2, data_type: 'list' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'trainingId')
|
||||
unless StatisticField.find_by(key: 'groupName', statistic_index_id: 2)
|
||||
StatisticField.create!({ key: 'groupName', label: I18n.t('statistics.group'), statistic_index_id: 2, data_type: 'text' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'trainingId', statistic_index_id: 3)
|
||||
StatisticField.create!({ key: 'trainingId', label: I18n.t('statistics.training_id'), statistic_index_id: 3, data_type: 'index' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'trainingDate')
|
||||
unless StatisticField.find_by(key: 'trainingDate', statistic_index_id: 3)
|
||||
StatisticField.create!({ key: 'trainingDate', label: I18n.t('statistics.training_date'), statistic_index_id: 3, data_type: 'date' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'eventId')
|
||||
unless StatisticField.find_by(key: 'groupName', statistic_index_id: 3)
|
||||
StatisticField.create!({ key: 'groupName', label: I18n.t('statistics.group'), statistic_index_id: 3, data_type: 'text' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'eventId', statistic_index_id: 4)
|
||||
StatisticField.create!({ key: 'eventId', label: I18n.t('statistics.event_id'), statistic_index_id: 4, data_type: 'index' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'eventDate')
|
||||
unless StatisticField.find_by(key: 'eventDate', statistic_index_id: 4)
|
||||
StatisticField.create!({ key: 'eventDate', label: I18n.t('statistics.event_date'), statistic_index_id: 4, data_type: 'date' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'themes')
|
||||
unless StatisticField.find_by(key: 'groupName', statistic_index_id: 4)
|
||||
StatisticField.create!({ key: 'groupName', label: I18n.t('statistics.group'), statistic_index_id: 4, data_type: 'text' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'groupName', statistic_index_id: 5)
|
||||
StatisticField.create!({ key: 'groupName', label: I18n.t('statistics.group'), statistic_index_id: 5, data_type: 'text' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'themes', statistic_index_id: 6)
|
||||
StatisticField.create!({ key: 'themes', label: I18n.t('statistics.themes'), statistic_index_id: 6, data_type: 'list' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'components')
|
||||
unless StatisticField.find_by(key: 'components', statistic_index_id: 6)
|
||||
StatisticField.create!({ key: 'components', label: I18n.t('statistics.components'), statistic_index_id: 6, data_type: 'list' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'machines')
|
||||
unless StatisticField.find_by(key: 'machines', statistic_index_id: 6)
|
||||
StatisticField.create!({ key: 'machines', label: I18n.t('statistics.machines'), statistic_index_id: 6, data_type: 'list' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'name')
|
||||
unless StatisticField.find_by(key: 'status', statistic_index_id: 6)
|
||||
StatisticField.create!({ key: 'status', label: I18n.t('statistics.project_status'), statistic_index_id: 6, data_type: 'text' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'name', statistic_index_id: 6)
|
||||
StatisticField.create!({ key: 'name', label: I18n.t('statistics.project_name'), statistic_index_id: 6, data_type: 'text' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'projectUserNames', statistic_index_id: 6)
|
||||
StatisticField.create!({ key: 'projectUserNames', label: I18n.t('statistics.project_user_names'), statistic_index_id: 6, data_type: 'list' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'name', statistic_index_id: 4)
|
||||
StatisticField.create!({ key: 'name', label: I18n.t('statistics.event_name'), statistic_index_id: 4, data_type: 'text' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'userId')
|
||||
unless StatisticField.find_by(key: 'userId', statistic_index_id: 7)
|
||||
StatisticField.create!({ key: 'userId', label: I18n.t('statistics.user_id'), statistic_index_id: 7, data_type: 'index' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'eventTheme')
|
||||
unless StatisticField.find_by(key: 'eventTheme', statistic_index_id: 4)
|
||||
StatisticField.create!({ key: 'eventTheme', label: I18n.t('statistics.event_theme'), statistic_index_id: 4, data_type: 'text' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'ageRange')
|
||||
unless StatisticField.find_by(key: 'ageRange', statistic_index_id: 4)
|
||||
StatisticField.create!({ key: 'ageRange', label: I18n.t('statistics.age_range'), statistic_index_id: 4, data_type: 'text' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'groupName')
|
||||
unless StatisticField.find_by(key: 'groupName', statistic_index_id: 1)
|
||||
StatisticField.create!({ key: 'groupName', label: I18n.t('statistics.group'), statistic_index_id: 1, data_type: 'text' })
|
||||
end
|
||||
unless StatisticField.find_by(key: 'groupName', statistic_index_id: statistic_index_order.id)
|
||||
StatisticField.create!({ key: 'groupName', label: I18n.t('statistics.group'), statistic_index_id: statistic_index_order.id, data_type: 'text' })
|
||||
end
|
||||
|
||||
# statistic_types
|
||||
unless StatisticType.find_by(key: 'booking', statistic_index_id: 2)
|
||||
|
@ -1844,7 +1844,8 @@ CREATE TABLE public.notification_types (
|
||||
category character varying NOT NULL,
|
||||
is_configurable boolean NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
roles character varying[] DEFAULT '{}'::character varying[]
|
||||
);
|
||||
|
||||
|
||||
@ -6935,6 +6936,13 @@ CREATE UNIQUE INDEX index_notification_preferences_on_user_and_notification_type
|
||||
CREATE UNIQUE INDEX index_notification_types_on_name ON public.notification_types USING btree (name);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_notification_types_on_roles; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_notification_types_on_roles ON public.notification_types USING btree (roles);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_notifications_on_notification_type_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
@ -9252,6 +9260,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||
('20230728072726'),
|
||||
('20230728090257'),
|
||||
('20230825101952'),
|
||||
('20230828073428'),
|
||||
('20230831103208');
|
||||
|
||||
|
||||
|
44
test/fixtures/notification_types.yml
vendored
44
test/fixtures/notification_types.yml
vendored
@ -3,6 +3,7 @@ notification_type_1:
|
||||
name: notify_admin_when_project_published
|
||||
category: projects
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.353635000 Z
|
||||
updated_at: 2023-02-02 08:25:33.353635000 Z
|
||||
|
||||
@ -10,7 +11,7 @@ notification_type_2:
|
||||
id: 2
|
||||
name: notify_project_collaborator_to_valid
|
||||
category: projects
|
||||
is_configurable: true
|
||||
is_configurable: false
|
||||
created_at: 2023-02-02 08:25:33.355650000 Z
|
||||
updated_at: 2023-02-02 08:25:33.355650000 Z
|
||||
|
||||
@ -19,6 +20,7 @@ notification_type_3:
|
||||
name: notify_project_author_when_collaborator_valid
|
||||
category: projects
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.357169000 Z
|
||||
updated_at: 2023-02-02 08:25:33.357169000 Z
|
||||
|
||||
@ -59,6 +61,7 @@ notification_type_8:
|
||||
name: notify_admin_member_create_reservation
|
||||
category: agenda
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.366800000 Z
|
||||
updated_at: 2023-02-02 08:25:33.366800000 Z
|
||||
|
||||
@ -75,6 +78,7 @@ notification_type_10:
|
||||
name: notify_admin_slot_is_modified
|
||||
category: agenda
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.369576000 Z
|
||||
updated_at: 2023-02-02 08:25:33.369576000 Z
|
||||
|
||||
@ -83,6 +87,7 @@ notification_type_11:
|
||||
name: notify_admin_when_user_is_created
|
||||
category: users_accounts
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.370910000 Z
|
||||
updated_at: 2023-02-02 08:25:33.370910000 Z
|
||||
|
||||
@ -91,6 +96,7 @@ notification_type_12:
|
||||
name: notify_admin_subscribed_plan
|
||||
category: subscriptions
|
||||
is_configurable: true
|
||||
roles: ['admin']
|
||||
created_at: 2023-02-02 08:25:33.372202000 Z
|
||||
updated_at: 2023-02-02 08:25:33.372202000 Z
|
||||
|
||||
@ -99,6 +105,7 @@ notification_type_13:
|
||||
name: notify_user_when_invoice_ready
|
||||
category: payments
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.373802000 Z
|
||||
updated_at: 2023-02-02 08:25:33.373802000 Z
|
||||
|
||||
@ -123,6 +130,7 @@ notification_type_16:
|
||||
name: notify_admin_subscription_will_expire_in_7_days
|
||||
category: subscriptions
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.377294000 Z
|
||||
updated_at: 2023-02-02 08:25:33.377294000 Z
|
||||
|
||||
@ -131,6 +139,7 @@ notification_type_17:
|
||||
name: notify_admin_subscription_is_expired
|
||||
category: subscriptions
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.385681000 Z
|
||||
updated_at: 2023-02-02 08:25:33.385681000 Z
|
||||
|
||||
@ -139,6 +148,7 @@ notification_type_18:
|
||||
name: notify_admin_subscription_canceled
|
||||
category: subscriptions
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.386650000 Z
|
||||
updated_at: 2023-02-02 08:25:33.386650000 Z
|
||||
|
||||
@ -171,6 +181,7 @@ notification_type_22:
|
||||
name: notify_admin_slot_is_canceled
|
||||
category: agenda
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.389610000 Z
|
||||
updated_at: 2023-02-02 08:25:33.389610000 Z
|
||||
|
||||
@ -195,6 +206,7 @@ notification_type_25:
|
||||
name: notify_admin_subscription_extended
|
||||
category: subscriptions
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.392302000 Z
|
||||
updated_at: 2023-02-02 08:25:33.392302000 Z
|
||||
|
||||
@ -203,6 +215,7 @@ notification_type_26:
|
||||
name: notify_admin_user_group_changed
|
||||
category: users_accounts
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.393157000 Z
|
||||
updated_at: 2023-02-02 08:25:33.393157000 Z
|
||||
|
||||
@ -219,6 +232,7 @@ notification_type_28:
|
||||
name: notify_admin_when_user_is_imported
|
||||
category: users_accounts
|
||||
is_configurable: true
|
||||
roles: ['admin']
|
||||
created_at: 2023-02-02 08:25:33.394864000 Z
|
||||
updated_at: 2023-02-02 08:25:33.394864000 Z
|
||||
|
||||
@ -243,6 +257,7 @@ notification_type_31:
|
||||
name: notify_admin_user_merged
|
||||
category: users_accounts
|
||||
is_configurable: true
|
||||
roles: ['admin']
|
||||
created_at: 2023-02-02 08:25:33.397530000 Z
|
||||
updated_at: 2023-02-02 08:25:33.397530000 Z
|
||||
|
||||
@ -251,6 +266,7 @@ notification_type_32:
|
||||
name: notify_admin_profile_complete
|
||||
category: users_accounts
|
||||
is_configurable: true
|
||||
roles: ['admin']
|
||||
created_at: 2023-02-02 08:25:33.398364000 Z
|
||||
updated_at: 2023-02-02 08:25:33.398364000 Z
|
||||
|
||||
@ -259,6 +275,7 @@ notification_type_33:
|
||||
name: notify_admin_abuse_reported
|
||||
category: projects
|
||||
is_configurable: true
|
||||
roles: ['admin']
|
||||
created_at: 2023-02-02 08:25:33.399230000 Z
|
||||
updated_at: 2023-02-02 08:25:33.399230000 Z
|
||||
|
||||
@ -283,6 +300,7 @@ notification_type_36:
|
||||
name: notify_admin_user_wallet_is_credited
|
||||
category: wallet
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.402912000 Z
|
||||
updated_at: 2023-02-02 08:25:33.402912000 Z
|
||||
|
||||
@ -307,6 +325,7 @@ notification_type_39:
|
||||
name: notify_member_reservation_reminder
|
||||
category: agenda
|
||||
is_configurable: false
|
||||
roles: ['admin']
|
||||
created_at: 2023-02-02 08:25:33.414402000 Z
|
||||
updated_at: 2023-02-02 08:25:33.414402000 Z
|
||||
|
||||
@ -323,6 +342,7 @@ notification_type_41:
|
||||
name: notify_admin_close_period_reminder
|
||||
category: accountings
|
||||
is_configurable: true
|
||||
roles: ['admin']
|
||||
created_at: 2023-02-02 08:25:33.420521000 Z
|
||||
updated_at: 2023-02-02 08:25:33.420521000 Z
|
||||
|
||||
@ -331,6 +351,7 @@ notification_type_42:
|
||||
name: notify_admin_archive_complete
|
||||
category: accountings
|
||||
is_configurable: true
|
||||
roles: ['admin']
|
||||
created_at: 2023-02-02 08:25:33.423553000 Z
|
||||
updated_at: 2023-02-02 08:25:33.423553000 Z
|
||||
|
||||
@ -355,6 +376,7 @@ notification_type_45:
|
||||
name: notify_admin_refund_created
|
||||
category: wallet
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.426178000 Z
|
||||
updated_at: 2023-02-02 08:25:33.426178000 Z
|
||||
|
||||
@ -363,6 +385,7 @@ notification_type_46:
|
||||
name: notify_admins_role_update
|
||||
category: users_accounts
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.426875000 Z
|
||||
updated_at: 2023-02-02 08:25:33.426875000 Z
|
||||
|
||||
@ -395,6 +418,7 @@ notification_type_50:
|
||||
name: notify_admin_payment_schedule_failed
|
||||
category: payments
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.429758000 Z
|
||||
updated_at: 2023-02-02 08:25:33.429758000 Z
|
||||
|
||||
@ -411,6 +435,7 @@ notification_type_52:
|
||||
name: notify_admin_payment_schedule_check_deadline
|
||||
category: payments
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.431174000 Z
|
||||
updated_at: 2023-02-02 08:25:33.431174000 Z
|
||||
|
||||
@ -419,6 +444,7 @@ notification_type_53:
|
||||
name: notify_admin_payment_schedule_transfer_deadline
|
||||
category: payments
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.431950000 Z
|
||||
updated_at: 2023-02-02 08:25:33.431950000 Z
|
||||
|
||||
@ -427,6 +453,7 @@ notification_type_54:
|
||||
name: notify_admin_payment_schedule_error
|
||||
category: payments
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.432809000 Z
|
||||
updated_at: 2023-02-02 08:25:33.432809000 Z
|
||||
|
||||
@ -443,6 +470,7 @@ notification_type_56:
|
||||
name: notify_admin_payment_schedule_gateway_canceled
|
||||
category: payments
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.434479000 Z
|
||||
updated_at: 2023-02-02 08:25:33.434479000 Z
|
||||
|
||||
@ -459,6 +487,7 @@ notification_type_58:
|
||||
name: notify_admin_user_supporting_document_files_created
|
||||
category: supporting_documents
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.435886000 Z
|
||||
updated_at: 2023-02-02 08:25:33.435886000 Z
|
||||
|
||||
@ -467,6 +496,7 @@ notification_type_59:
|
||||
name: notify_admin_user_supporting_document_files_updated
|
||||
category: supporting_documents
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.436627000 Z
|
||||
updated_at: 2023-02-02 08:25:33.436627000 Z
|
||||
|
||||
@ -491,6 +521,7 @@ notification_type_62:
|
||||
name: notify_user_supporting_document_refusal
|
||||
category: supporting_documents
|
||||
is_configurable: false
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.439078000 Z
|
||||
updated_at: 2023-02-02 08:25:33.439078000 Z
|
||||
|
||||
@ -499,6 +530,7 @@ notification_type_63:
|
||||
name: notify_admin_user_supporting_document_refusal
|
||||
category: supporting_documents
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.439926000 Z
|
||||
updated_at: 2023-02-02 08:25:33.439926000 Z
|
||||
|
||||
@ -506,7 +538,7 @@ notification_type_64:
|
||||
id: 64
|
||||
name: notify_user_order_is_ready
|
||||
category: shop
|
||||
is_configurable: true
|
||||
is_configurable: false
|
||||
created_at: 2023-02-02 08:25:33.440769000 Z
|
||||
updated_at: 2023-02-02 08:25:33.440769000 Z
|
||||
|
||||
@ -514,7 +546,7 @@ notification_type_65:
|
||||
id: 65
|
||||
name: notify_user_order_is_canceled
|
||||
category: shop
|
||||
is_configurable: true
|
||||
is_configurable: false
|
||||
created_at: 2023-02-02 08:25:33.441630000 Z
|
||||
updated_at: 2023-02-02 08:25:33.441630000 Z
|
||||
|
||||
@ -522,7 +554,7 @@ notification_type_66:
|
||||
id: 66
|
||||
name: notify_user_order_is_refunded
|
||||
category: shop
|
||||
is_configurable: true
|
||||
is_configurable: false
|
||||
created_at: 2023-02-02 08:25:33.442370000 Z
|
||||
updated_at: 2023-02-02 08:25:33.442370000 Z
|
||||
|
||||
@ -531,6 +563,7 @@ notification_type_67:
|
||||
name: notify_admin_low_stock_threshold
|
||||
category: shop
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.443101000 Z
|
||||
updated_at: 2023-02-02 08:25:33.443101000 Z
|
||||
|
||||
@ -539,6 +572,7 @@ notification_type_68:
|
||||
name: notify_admin_training_auto_cancelled
|
||||
category: trainings
|
||||
is_configurable: true
|
||||
roles: ['admin', 'manager']
|
||||
created_at: 2023-02-02 08:25:33.443888000 Z
|
||||
updated_at: 2023-02-02 08:25:33.443888000 Z
|
||||
|
||||
@ -570,6 +604,6 @@ notification_type_72:
|
||||
id: 72
|
||||
name: notify_admin_order_is_paid
|
||||
category: shop
|
||||
is_configurable: true
|
||||
is_configurable: false
|
||||
created_at: 2023-02-16 10:42:39.143888000 Z
|
||||
updated_at: 2023-02-16 10:42:39.143888000 Z
|
||||
|
Loading…
x
Reference in New Issue
Block a user