Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
354 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2024, Schweizer Alpen-Club. This file is part of | ||
# hitobito_sac_cas and licensed under the Affero General Public License version 3 | ||
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_sac_cas | ||
|
||
class SacMembershipConfigsController < CrudController | ||
self.nesting = Group | ||
|
||
decorates :sac_membership_config | ||
|
||
def index | ||
redirect_to latest_config_entry_path | ||
end | ||
|
||
private | ||
|
||
def find_entry | ||
SacMembershipConfig.find(params[:id]) | ||
end | ||
|
||
def latest_config_entry_path | ||
latest_config = SacMembershipConfig.all.order(valid_from: :desc).limit(1).first | ||
helpers.edit_group_sac_membership_config_path(group_id: Group.root.id, id: latest_config.id) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2024, Schweizer Alpen-Club. This file is part of | ||
# hitobito_sac_cas and licensed under the Affero General Public License version 3 | ||
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_sac_cas. | ||
|
||
class SacMembershipConfigDecorator < ApplicationDecorator | ||
decorates SacMembershipConfig | ||
|
||
def to_s | ||
"#{@object.class.model_name.human} (#{valid_from})" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2024, Schweizer Alpen-Club. This file is part of | ||
# hitobito_sac_cas and licensed under the Affero General Public License version 3 | ||
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_sac_cas | ||
|
||
module SacCas::Dropdown::GroupEdit | ||
def initialize(template, group) | ||
super(template, group) | ||
if group.root? | ||
add_item(translate(:sac_membership_configs), | ||
template.group_sac_membership_configs_path( | ||
group_id: Group.root.id)) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2024, Schweizer Alpen-Club. This file is part of | ||
# hitobito_sac_cas and licensed under the Affero General Public License version 3 | ||
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_sac_cas | ||
|
||
module Sheet | ||
class SacMembershipConfig < Base | ||
self.parent_sheet = Sheet::Group | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2024, Schweizer Alpen-Club. This file is part of | ||
# hitobito_sac_cas and licensed under the Affero General Public License version 3 | ||
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_sac_cas | ||
|
||
class SacMembershipConfig < ApplicationRecord | ||
attr_readonly :valid_from | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
-# Copyright (c) 2024, Schweizer Alpen-Club. This file is part of | ||
-# hitobito_sac_cas and licensed under the Affero General Public License version 3 | ||
-# or later. See the COPYING file at the top-level directory or at | ||
-# https://github.com/hitobito/hitobito_sac_cas. | ||
= entry_form do |f| | ||
= field_set_tag do | ||
- if entry.new_record? | ||
= f.labeled_input_field :sac_fee_adult | ||
|
||
= field_set_tag(t('sac_membership_configs.form.fees')) do | ||
.sac-field-container | ||
.sac-field-row | ||
.sac-field-column | ||
.sac-field-column | ||
= t('sac_membership_configs.form.membership_adult') | ||
.sac-field-column | ||
= t('sac_membership_configs.form.membership_family') | ||
.sac-field-column | ||
= t('sac_membership_configs.form.membership_youth') | ||
.sac-field-row | ||
.sac-field-column | ||
= t('sac_membership_configs.form.sac_fee') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :sac_fee_adult | ||
%span.input-group-text | ||
= t('global.currency') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :sac_fee_family | ||
%span.input-group-text | ||
= t('global.currency') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :sac_fee_youth | ||
%span.input-group-text | ||
= t('global.currency') | ||
.sac-field-row | ||
.sac-field-column | ||
= t('sac_membership_configs.form.entry_fee') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :entry_fee_adult | ||
%span.input-group-text | ||
= t('global.currency') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :entry_fee_family | ||
%span.input-group-text | ||
= t('global.currency') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :entry_fee_youth | ||
%span.input-group-text | ||
= t('global.currency') | ||
.sac-field-row | ||
.sac-field-column | ||
= t('sac_membership_configs.form.hut_solidarity_fee_without_hut') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :hut_solidarity_fee_without_hut_adult | ||
%span.input-group-text | ||
= t('global.currency') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :hut_solidarity_fee_without_hut_family | ||
%span.input-group-text | ||
= t('global.currency') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :hut_solidarity_fee_without_hut_youth | ||
%span.input-group-text | ||
= t('global.currency') | ||
.sac-field-row | ||
.sac-field-column | ||
= t('sac_membership_configs.form.hut_solidarity_fee_with_hut') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :hut_solidarity_fee_with_hut_adult | ||
%span.input-group-text | ||
= t('global.currency') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :hut_solidarity_fee_with_hut_family | ||
%span.input-group-text | ||
= t('global.currency') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :hut_solidarity_fee_with_hut_youth | ||
%span.input-group-text | ||
= t('global.currency') | ||
.sac-field-row | ||
.sac-field-column | ||
= t('sac_membership_configs.form.magazine_fee') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :magazine_fee_adult | ||
%span.input-group-text | ||
= t('global.currency') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :magazine_fee_family | ||
%span.input-group-text | ||
= t('global.currency') | ||
.sac-field-column | ||
.input-group.input-group-sm | ||
= f.input_field :magazine_fee_youth | ||
%span.input-group-text | ||
= t('global.currency') | ||
|
||
= field_set_tag(t('sac_membership_configs.form.article_numbers')) do | ||
hasdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
db/migrate/20240502124158_create_sac_membership_configs.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2012-2024, Schweizer Alpen-Club. This file is part of | ||
# hitobito_sac_cas and licensed under the Affero General Public License version 3 | ||
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_sac_cas. | ||
|
||
class CreateSacMembershipConfigs < ActiveRecord::Migration[6.1] | ||
|
||
def change | ||
create_table :sac_membership_configs do |t| | ||
t.integer :valid_from, null: false, length: 4, index: { unique: true } | ||
t.decimal :sac_fee_adult, precision: 5, scale: 2, null: false | ||
t.decimal :sac_fee_family, precision: 5, scale: 2, null: false | ||
t.decimal :sac_fee_youth, precision: 5, scale: 2, null: false | ||
t.decimal :entry_fee_adult, precision: 5, scale: 2, null: false | ||
t.decimal :entry_fee_family, precision: 5, scale: 2, null: false | ||
t.decimal :entry_fee_youth, precision: 5, scale: 2, null: false | ||
t.decimal :hut_solidarity_fee_with_hut_adult, precision: 5, scale: 2, null: false | ||
t.decimal :hut_solidarity_fee_with_hut_family, precision: 5, scale: 2, null: false | ||
t.decimal :hut_solidarity_fee_with_hut_youth, precision: 5, scale: 2, null: false | ||
t.decimal :hut_solidarity_fee_without_hut_adult, precision: 5, scale: 2, null: false | ||
t.decimal :hut_solidarity_fee_without_hut_family, precision: 5, scale: 2, null: false | ||
t.decimal :hut_solidarity_fee_without_hut_youth, precision: 5, scale: 2, null: false | ||
t.decimal :magazine_fee_adult, precision: 5, scale: 2, null: false | ||
t.decimal :magazine_fee_family, precision: 5, scale: 2, null: false | ||
t.decimal :magazine_fee_youth, precision: 5, scale: 2, null: false | ||
t.decimal :service_fee, precision: 5, scale: 2, null: false | ||
t.decimal :magazine_postage_abroad, precision: 5, scale: 2, null: false | ||
t.decimal :reduction_amount, precision: 5, scale: 2, null: false | ||
t.integer :reduction_required_membership_years, null: true | ||
t.string :sac_fee_article_number, null: false | ||
t.string :sac_entry_fee_article_number, null: false | ||
t.string :hut_solidarity_fee_article_number, null: false | ||
t.string :magazine_fee_article_number, null: false | ||
t.string :section_bulletin_postage_abroad_article_number, null: false | ||
t.string :service_fee_article_number, null: false | ||
t.string :balancing_payment_article_number, null: false | ||
t.string :course_fee_article_number, null: false | ||
t.string :discount_date_1, null: true | ||
t.integer :discount_percent_1, null: true, length: 2 | ||
t.string :discount_date_2, null: true | ||
t.integer :discount_percent_2, null: true, length: 2 | ||
t.string :discount_date_3, null: true | ||
t.integer :discount_percent_3, null: true, length: 2 | ||
end | ||
end | ||
|
||
end |
Oops, something went wrong.