Skip to content

Commit 5687369

Browse files
committed
[upd] viewの更新
1 parent 9b57c46 commit 5687369

2 files changed

Lines changed: 32 additions & 31 deletions

File tree

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module RepresentativeContactPagesHelper
2-
def size_calibration(str)
3-
if str.length >= 10 then
4-
"10px"
5-
else
6-
"14px"
7-
end
2+
def get_subrep_by_group(group_id)
3+
SubRep.where(group_id:group_id)
4+
end
5+
6+
def get_user_detail_by_group(group_user_id)
7+
UserDetail.where(user_id:group_user_id)
88
end
99
end

app/views/representative_contact_pages/representative_contact_sheet.pdf.erb

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
vertical-align: middle;
99
width: 100%;
1010
table-layout: fixed;
11+
word-wrap:break-word;
1112
}
1213
caption, th, td {
1314
text-align: center;
@@ -20,37 +21,37 @@
2021
page-break-after: always;
2122
}
2223
</style>
24+
2325
<div>
24-
<table>
26+
<table align='center'>
2527
<tbody>
2628
<tr>
27-
<td rowspan="2">グループ名</td>
28-
<td>代表者名</td>
29-
<td>代表者電話番号</td>
30-
<td>代表者メールアドレス</td>
29+
<td width="17%">団体名</td>
30+
<td width="15%">役職</td>
31+
<td width="20%">氏名</td>
32+
<td>電話番号</td>
33+
<td>メールアドレス</td>
3134
</tr>
35+
</tbody>
36+
<%= @groups.each do |group| %>
37+
<%= row_span = get_subrep_by_group(group.id).try(:length) %>
38+
<tbody>
3239
<tr>
33-
<td>副代表者名</td>
34-
<td>副代表者電話番号</td>
35-
<td>副代表者メールアドレス</td>
40+
<td rowspan= "<%= 1 + row_span %>" ><%= group.name %></td>
41+
<td>代表者</td>
42+
<td><%= get_user_detail_by_group(group.user_id).first.name_ja %></td>
43+
<td><%= get_user_detail_by_group(group.user_id).first.tel %></td>
44+
<td><%= User.where(id:group.user_id).first.email %></td>
3645
</tr>
46+
<tr>
47+
<td rowspan="<%= row_span %>">副代表者</td>
48+
<%= get_subrep_by_group(group.id).each do |subrep| %>
49+
<td><%= subrep.name_ja %></td>
50+
<td><%= subrep.tel %></td>
51+
<td><%= subrep.email %></td>
52+
</tr>
53+
<% end %>
3754
</tbody>
38-
<% @groups.each do |group| %>
39-
<tbody>
40-
<tr>
41-
<td rowspan="#{1+SubRep.where(group_id:group_id).length}"></td>
42-
<td><%= UserDetail.where(user_id:group.user_id).first.name_ja %></td>
43-
<td><%= UserDetail.where(user_id:group.user_id).first.tel %></td>
44-
<td><%= User.where(id:group.user_id).first.email %></td>
45-
</tr>
46-
<tr>
47-
<%= SubRep.where(group_id:group.id) do |subrep| %>
48-
<td><%= subrep.name_ja %></td>
49-
<td><%= subrep.tel %></td>
50-
<td><%= subrep.email %></td>
51-
<% end %>
52-
</tr>
53-
<tbody>
5455
<% end %>
55-
</table>
56+
</table>
5657
</div>

0 commit comments

Comments
 (0)