1+ < h1 > <%= t ( 'organization_alliances.title' ) %> </ h1 >
2+
3+ < div class ="row ">
4+ < div class ="col-12 col-sm-12 col-md-12 col-lg-12 ">
5+ < ul class ="nav nav-pills actions-menu ">
6+ < li class ="nav-item ">
7+ <%= link_to organization_alliances_path ( status : 'pending' ) , class : "nav-link #{ 'active' if @status == 'pending' } " do %>
8+ <%= glyph :time %>
9+ <%= t ( 'organization_alliances.status.pending' ) %>
10+ <% end %>
11+ </ li >
12+ < li class ="nav-item ">
13+ <%= link_to organization_alliances_path ( status : 'accepted' ) , class : "nav-link #{ 'active' if @status == 'accepted' } " do %>
14+ <%= glyph :ok %>
15+ <%= t ( 'organization_alliances.status.accepted' ) %>
16+ <% end %>
17+ </ li >
18+ < li class ="nav-item ">
19+ <%= link_to organization_alliances_path ( status : 'rejected' ) , class : "nav-link #{ 'active' if @status == 'rejected' } " do %>
20+ <%= glyph :remove %>
21+ <%= t ( 'organization_alliances.status.rejected' ) %>
22+ <% end %>
23+ </ li >
24+ < li class ="nav-item ms-auto ">
25+ <%= link_to organizations_path , class : "text-primary" do %>
26+ <%= glyph :search %>
27+ <%= t ( 'organization_alliances.search_organizations' ) %>
28+ <% end %>
29+ </ li >
30+ </ ul >
31+ </ div >
32+ </ div >
33+
34+ < div class ="row ">
35+ < div class ="col-md-12 ">
36+ < div class ="card ">
37+ < div class ="card-body table-responsive ">
38+ < table class ="table table-hover table-sm ">
39+ < thead >
40+ < tr >
41+ < th > <%= t ( 'organization_alliances.organization' ) %> </ th >
42+ < th > <%= t ( 'organization_alliances.city' ) %> </ th >
43+ < th > <%= t ( 'organization_alliances.members' ) %> </ th >
44+ < th > <%= t ( 'organization_alliances.type' ) %> </ th >
45+ <% if @status != 'rejected' %>
46+ < th > <%= t ( 'organization_alliances.actions' ) %> </ th >
47+ <% end %>
48+ </ tr >
49+ </ thead >
50+ < tbody >
51+ <% @alliances . each do |alliance | %>
52+ <% is_sender = ( alliance . source_organization_id == current_organization . id ) %>
53+ <% other_org = is_sender ? alliance . target_organization : alliance . source_organization %>
54+ < tr >
55+ < td > <%= link_to other_org . name , other_org %> </ td >
56+ < td > <%= other_org . city %> </ td >
57+ < td > <%= other_org . members . count %> </ td >
58+ < td >
59+ <% if is_sender %>
60+ <%= t ( 'organization_alliances.sent' ) %>
61+ <% else %>
62+ <%= t ( 'organization_alliances.received' ) %>
63+ <% end %>
64+ </ td >
65+ <% if @status == 'pending' %>
66+ < td >
67+ <% if is_sender %>
68+ <%= link_to t ( 'organization_alliances.cancel_request' ) ,
69+ organization_alliance_path ( alliance ) ,
70+ method : :delete ,
71+ class : 'btn btn-danger' ,
72+ data : { confirm : t ( 'organization_alliances.confirm_cancel' ) } %>
73+ <% else %>
74+ < div class ="btn-group " role ="group " aria-label ="Alliance actions ">
75+ <%= link_to t ( 'organization_alliances.accept' ) ,
76+ organization_alliance_path ( alliance , status : 'accepted' ) ,
77+ method : :put ,
78+ class : 'btn btn-success me-2' %>
79+ <%= link_to t ( 'organization_alliances.reject' ) ,
80+ organization_alliance_path ( alliance , status : 'rejected' ) ,
81+ method : :put ,
82+ class : 'btn btn-danger' %>
83+ </ div >
84+ <% end %>
85+ </ td >
86+ <% elsif @status == 'accepted' %>
87+ < td >
88+ <%= link_to t ( 'organization_alliances.end_alliance' ) ,
89+ organization_alliance_path ( alliance ) ,
90+ method : :delete ,
91+ class : 'btn btn-danger' ,
92+ data : { confirm : t ( 'organization_alliances.confirm_end' ) } %>
93+ </ td >
94+ <% end %>
95+ </ tr >
96+ <% end %>
97+ </ tbody >
98+ </ table >
99+ </ div >
100+ </ div >
101+ </ div >
102+ </ div >
0 commit comments