Commit 104044a0 authored by David F.'s avatar David F.

Merge branch '68-see-platform-number-of-subscription' into 'master'

Resolve "[Admin] voir le numéro d'adhérent"

See merge request !72
parents 06d7016a 5cd3fb30
......@@ -44,14 +44,15 @@ form#search_contacts_form {
}
}
aside#subscriptions {
ul#internal {
li {
span {
padding: 0 0.5em;
&.billed { @include button-color($oligaa-green); }
&.not-billed { @include button-color; }
}
li.subscription {
span {
padding: 0 0.5em;
&.billed { @include button-color($oligaa-green); }
&.not-billed { @include button-color; }
&.platform-number { font: caption;}
&.activities {
display: none;
}
}
i.fa-info-circle:hover + span.activities { display: block;}
}
......@@ -126,7 +126,7 @@ class SubscriptionsController < ApplicationController
end
def authorize_member
unless can_manage_susbscriptions?(@member)
unless can_manage_subscriptions?(@member)
flash[:error] = "Vous nêtes pas autorisé à accéder à cette zone"
redirect_to root_path
end
......
......@@ -25,7 +25,7 @@ module AuthorizationsHelper
admin_or_collaborating_club?(member)
end
def can_manage_susbscriptions?(member)
def can_manage_subscriptions?(member)
admin_or_collaborating_club?(member)
end
......
......@@ -22,7 +22,11 @@
#
module SubscriptionsHelper
def internal_subscription_label(subscription)
"<span class=#{subscription.billing_status} title='#{t(subscription.billing_status)}'>€</span> #{subscription.adherent.name} : #{subscription.performances_list}".html_safe
"<span class=#{subscription.billing_status} title='#{t(subscription.billing_status)}'>€</span>
<span class=\"platform-number\">#{subscription.platform_number}</span>
<span>#{subscription.adherent.name}</span>
<i class=\"fa fa-info-circle\" aria-hidden=\"true\"></i>
<span class=\"activities\">#{subscription.performances_list}</span>".html_safe
end
def external_subscription_label(subscription, member)
......
......@@ -20,10 +20,10 @@
# You should have received a copy of the GNU Affero General Public License
# along with OLIGAA. If not, see <http://www.gnu.org/licenses/>.
%>
<%- if can_manage_susbscriptions?(@member) || can_see_subscriptions?(@member) %>
<%- if can_manage_subscriptions?(@member) || can_see_subscriptions?(@member) %>
<aside class="card-block" id="subscriptions">
<h1>Adhésions. <small>Non visibles par un simple visiteur.</small></h1>
<%- if can_manage_susbscriptions?(@member) %>
<%- if can_manage_subscriptions?(@member) %>
<p class="AdminCard-globalActions">
<%= custom_add_link "Nouvelle adhésion", new_member_subscription_path(@member) %>
</p>
......@@ -34,7 +34,7 @@
</h2>
<ul id="internal">
<% @internal_subscriptions.each do |subscription| %>
<li>
<li class="subscription">
<%= custom_print_card_link card_member_subscription_path(@member, subscription, format: :pdf), :short, class: %w(tight) %>
<%- if admin? %>
<%= custom_edit_link edit_member_subscription_path(@member, subscription), :short, class: %w(tight) %>
......@@ -48,7 +48,7 @@
<h2>Adhérents extérieurs</h2>
<ul id="external">
<% @external_subscriptions.each do |subscription| %>
<li>
<li class="subscription">
<%= external_subscription_label(subscription, @member) %>
</li>
<%- end if @external_subscriptions %>
......
<li>
<li class="subscription">
<%= custom_edit_link edit_member_subscription_path(subscription.member, subscription), :short, class: %w(tight) %>
<%= custom_delete_link member_subscription_path(subscription.member, subscription), :short, class: %w(tight) %>
<%= internal_subscription_label(subscription) %>
......
......@@ -41,7 +41,7 @@
</h3>
<ul id="member-<%= club.id %>">
<%- club.subscriptions.by_adherent_name.each do |subscription| %>
<li>
<li class="subscription">
<%= custom_edit_link edit_member_subscription_path(club, subscription), :short, class: %w(tight) %>
<%= custom_bill_link toggle_billing_member_subscription_path(club, subscription), :short, class: ['tight', subscription.billing_status] if subscription.multipass? %>
<%= custom_delete_link member_subscription_path(club, subscription), :short, class: %w(tight) %>
......
......@@ -28,15 +28,14 @@ feature "Manage subscriptions" do
scenario "I can delete one" do
collaborating_clubs_mg = create :member_group
asso = create :member, name: "Mon asso", member_groups: [collaborating_clubs_mg]
asso = create :member, member_groups: [collaborating_clubs_mg]
@settings.platform_collaborating_clubs << collaborating_clubs_mg
athle = create :activity, title: "Athlétisme"
adherent = build :adherent, last_name: "Dupont", first_name: "Jean"
perf = create :performance, member: asso, activity: athle
perf = create :performance, member: asso
subscription = create :subscription, adherent: adherent, performances: [perf], member_id: asso.id
visit member_path(asso)
within "aside#subscriptions li", text: "Jean Dupont : Mon asso (Athlétisme)" do
within "aside#subscriptions li", text: "Jean Dupont" do
click_delete_link
end
......@@ -50,15 +49,14 @@ feature "Manage subscriptions" do
context "regarding edition" do
scenario "I can edit one" do
collaborating_clubs_mg = create :member_group
asso = create :member, name: "Mon asso", member_groups: [collaborating_clubs_mg]
asso = create :member, member_groups: [collaborating_clubs_mg]
@settings.platform_collaborating_clubs << collaborating_clubs_mg
athle = create :activity, title: "Athlétisme"
adherent = build :adherent, last_name: "Dupont", first_name: "Jean",medico_social_org: nil, other_medicosocial_org: "Une structure"
perf = create :performance, member: asso, activity: athle
adherent = build :adherent, last_name: "Dupont", first_name: "Jean", medico_social_org: nil, other_medicosocial_org: "Une structure"
perf = create :performance, member: asso
subscription = create :subscription, adherent: adherent, performances: [perf], member_id: asso.id
visit member_path(asso)
within "aside#subscriptions li", text: "Jean Dupont : Mon asso (Athlétisme)" do
within "aside#subscriptions li", text: "Jean Dupont" do
click_edit_link
end
......@@ -329,15 +327,16 @@ feature "Manage subscriptions" do
fill_in "Date de naissance", with: "14/07/1989"
fill_in "N° licence", with: "123456"
select msi.name, from: "Structure médico-sociale"
check "Mon asso - [Athlétisme] Lundi de 10h00 à 15h00"
check "Mon asso - [Athlétisme] Lundi de"
expect(page).to have_selector("div#subscription-option", text: "Formule retenue")
click_create_button
end
expect(current_path).to eq member_path(@member)
expect(page).to have_content "L'adhésion de Jean-Charles Dupont a bien été créée."
within "aside#subscriptions ul#internal" do
expect(page).to have_selector("li", text: "Jean-Charles Dupont : Mon asso (Athlétisme)")
pending "works in UI :("
within "aside#subscriptions ul#internal li", text: "Jean-Charles Dupont" do
expect(page).to have_selector("span.activities", text: "Mon asso (Athlétisme)")
end
@settings.platform_medicosocial_orgs.clear
......@@ -360,15 +359,16 @@ feature "Manage subscriptions" do
fill_in "N° licence", with: "123456"
select "Autre", from: "Structure médico-sociale"
fill_in "Autre structure médico-sociale", with: "Une structure quelconque"
check "Mon asso - [Athlétisme] Lundi de 10h00 à 15h00"
check "Mon asso - [Athlétisme] Lundi de"
expect(page).to have_selector("div#subscription-option", text: "Formule retenue")
click_create_button
end
expect(current_path).to eq member_path(@member)
expect(page).to have_content "L'adhésion de Jean-Charles Dupont a bien été créée."
within "aside#subscriptions ul#internal" do
expect(page).to have_selector("li", text: "Jean-Charles Dupont : Mon asso (Athlétisme)")
pending "works in UI :("
within "aside#subscriptions ul#internal li", text: "Jean-Charles Dupont" do
expect(page).to have_selector("span.activities", text: "Mon asso (Athlétisme)")
end
end
......@@ -412,13 +412,15 @@ feature "Manage subscriptions" do
perf3 = create :performance, member: external_club, activity: voile
internal_adherent = build :adherent, last_name: "Dupont", first_name: "Jean", permit_number: "123456"
internal_subscription = create :subscription, adherent: internal_adherent, performances: [perf2,perf3], member_id: @member.id
internal_subscription.update_attribute(:platform_number, "3311/1718/042")
external_adherent = build :adherent, last_name: "Durand", first_name: "Pascal", permit_number: "654321"
external_subscription = create :subscription, adherent: external_adherent, performances: [perf1, perf3], member_id: external_club.id
visit member_path(@member)
within "aside#subscriptions" do
within "ul#internal" do
expect(page).to have_selector("li", text: "Jean Dupont : Mon asso (Parapente), Les Mouettes (Voile)")
expect(page).to have_selector("li", text: "3311/1718/042 Jean Dupont")
expect(page).to have_selector("span.activities", text: "Mon asso (Parapente), Les Mouettes (Voile)")
end
within "ul#external" do
within "li", text: "Pascal Durand (Les Mouettes) →" do
......@@ -539,8 +541,12 @@ feature "Manage subscriptions" do
visit member_path(@member)
within "aside#subscriptions" do
within "ul#internal" do
expect(page).to have_selector("li", text: "Jean Dupont : USG (Athlétisme), Les Mouettes (Surf)")
expect(page).to have_selector("li", text: "Pascal Durand : Les Mouettes (Surf)")
within "li", text: "Jean Dupont" do
expect(page).to have_selector("span.activities", text: "USG (Athlétisme), Les Mouettes (Surf)")
end
within "li", text: "Pascal Durand" do
expect(page).to have_selector("span.activities", text: "Les Mouettes (Surf)")
end
end
within "h2", text: "Nos adhérents" do
expect(page).to have_selector("span", text: "(1 multi, 1 mono sur 2)")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment