質問するログイン新規登録

質問編集履歴

3

show/index/controllerの追加

2019/08/21 16:24

投稿

KOO_
KOO_

スコア58

title CHANGED
File without changes
body CHANGED
@@ -137,4 +137,47 @@
137
137
  <% end %>
138
138
  </tbody>
139
139
  </table>
140
+ ```
141
+
142
+
143
+ 追加修正
144
+ ```show
145
+ <% if prev_customer = @customer.prev_customer %>
146
+ <%= link_to "前へ", customer_path(@prev_customer, q: params[:q]), class: "prev btn btn-danger" %>
147
+ <% end %>
148
+ <% if next_customer = @customer.next_customer %>
149
+ <%= link_to "次へ", customer_path(@next_customer, q: params[:q]), class: "next btn btn-danger" %>
150
+ <% end %>
151
+ ```
152
+
153
+ ```index
154
+ <% @customers.each do |customer| %>
155
+ <tr>
156
+ <td><%= link_to customer.company, customer_path(customer, q: params[:q]) %></td>
157
+ <td><%= link_to customer.first_name, customer_path(customer, q: params[:q]) %></td>
158
+ <td><%= customer.tel %></td>
159
+ <td><%= customer.mail %></td>
160
+ <td><%= link_to '編集', edit_customer_path(customer), class: 'command'%>
161
+ <%= link_to '削除',
162
+ customer_path(customer),
163
+ method: :delete,
164
+ class: 'command',
165
+ data: { confirm: '本当に削除しますか?'} %></td>
166
+ <% end %>
167
+ ```
168
+
169
+ ```controller
170
+ def before
171
+ @before_customer = Customer.where("id > ?", id).first
172
+ end
173
+
174
+ def next
175
+ @next_customer = Customer.where("id < ?", id).last
176
+ end
177
+
178
+ def show
179
+ @q = Customer.ransack(params[:q])
180
+ @customer = @q.result.find(params[:id])
181
+ end
182
+
140
183
  ```

2

indexのsearchを追加

2019/08/21 16:24

投稿

KOO_
KOO_

スコア58

title CHANGED
File without changes
body CHANGED
@@ -53,6 +53,9 @@
53
53
 
54
54
  indexの検索条件は以下のようになります。
55
55
  ```
56
+ <div class="heading"><h2>リスト検索</h2></div>
57
+
58
+ <!--検索機能実装-->
56
59
  <%= search_form_for @q do |f| %>
57
60
  <table width = "90%">
58
61
  <col width="20%">
@@ -71,9 +74,9 @@
71
74
  </tr>
72
75
  <tr>
73
76
  <th>代表者</th>
74
- <td><%= f.search_field :owner_cont, type: "text" %></td>
77
+ <td><%= f.search_field :first_name_cont, type: "text" %></td>
75
78
  <th>ダイヒョウ</th>
76
- <td><%= f.search_field :kana_cont, type: "text" %></td>
79
+ <td><%= f.search_field :first_kana_cont, type: "text" %></td>
77
80
  </tr>
78
81
  <tr>
79
82
  <th>電話番号1</th>
@@ -102,7 +105,7 @@
102
105
  <!-- #TPD #2018.12.14 -->
103
106
  <tr>
104
107
  <th>最終コール状態</th>
105
- <td><!-- %= select_tag "last_detail[statu]", options_for_select( [""] + Detail.StatuItems, @last_detail_params[:statu] ) %>--></td>
108
+ <td><%= select_tag "last_call[statu]", options_for_select( [""] + Call.StatuItems, @last_call_params[:statu] ) %></td>
106
109
  <th>再コール日時</th>
107
110
  <td></td>
108
111
  </th>
@@ -110,7 +113,7 @@
110
113
  <th>最終コール日時(最初)</th>
111
114
  <td>
112
115
  <div class='input-group date' id='created_at_from_datetimepicker'>
113
- <%= text_field_tag "last_detail[created_at_from]", @last_detail_params[:created_at_from], class: "form-control" %>
116
+ <%= text_field_tag "last_call[created_at_from]", @last_call_params[:created_at_from], class: "form-control" %>
114
117
  <span class="input-group-addon">
115
118
  <span class="glyphicon glyphicon-calendar"></span>
116
119
  </span>
@@ -119,7 +122,7 @@
119
122
  <th>最終コール日時(最後)</th>
120
123
  <td>
121
124
  <div class='input-group date' id='created_at_to_datetimepicker'>
122
- <%= text_field_tag "last_detail[created_at_to]", @last_detail_params[:created_at_to], class: "form-control" %>
125
+ <%= text_field_tag "last_call[created_at_to]", @last_call_params[:created_at_to], class: "form-control" %>
123
126
  <span class="input-group-addon">
124
127
  <span class="glyphicon glyphicon-calendar"></span>
125
128
  </span>
@@ -134,6 +137,4 @@
134
137
  <% end %>
135
138
  </tbody>
136
139
  </table>
137
-
138
- <script>
139
140
  ```

1

indexのsearchを追加

2019/08/21 16:11

投稿

KOO_
KOO_

スコア58

title CHANGED
File without changes
body CHANGED
@@ -48,4 +48,92 @@
48
48
  @q = Customer.ransack(params[:q])
49
49
  @customer = @q.result.find(params[:id])
50
50
  end
51
+ ```
52
+
53
+
54
+ indexの検索条件は以下のようになります。
55
+ ```
56
+ <%= search_form_for @q do |f| %>
57
+ <table width = "90%">
58
+ <col width="20%">
59
+ <col width="30%">
60
+ <col width="20%">
61
+ <col width="30%">
62
+ <tbody>
63
+ <tr>
64
+ <th colspan = "4">検索</th>
65
+ </tr>
66
+ <tr>
67
+ <th>会社名</th>
68
+ <td><%= f.search_field :company_cont, type: "text" %></td>
69
+ <th>店舗名</th>
70
+ <td><%= f.search_field :store_cont, type: "text" %> </td>
71
+ </tr>
72
+ <tr>
73
+ <th>代表者</th>
74
+ <td><%= f.search_field :owner_cont, type: "text" %></td>
75
+ <th>ダイヒョウ</th>
76
+ <td><%= f.search_field :kana_cont, type: "text" %></td>
77
+ </tr>
78
+ <tr>
79
+ <th>電話番号1</th>
80
+ <td><%= f.search_field :tel_cont, type: "text" %></td>
81
+ <th>電話番号2</th>
82
+ <td><%= f.search_field :tel2_cont, type: "text" %></td>
83
+ </tr>
84
+ <tr>
85
+ <th>FAX番号</th>
86
+ <td><%= f.search_field :fax_cont, type: "text" %></td>
87
+ <th>業種</th>
88
+ <td><%= f.search_field :industry_cont, type: "text" %></td>
89
+ </tr>
90
+ <tr>
91
+ <th>メール</th>
92
+ <td><%= f.search_field :mail_cont, type: "text" %></td>
93
+ <th>URL</th>
94
+ <td><%= f.search_field :url_cont, type: "text" %></td>
95
+ </tr>
96
+ <tr>
97
+ <th>人数</th>
98
+ <td><%= f.search_field :people_cont, type: "text" %></td>
99
+ <th>住所</th>
100
+ <td><%= f.search_field :address_cont, type: "text" %></td>
101
+ </tr>
102
+ <!-- #TPD #2018.12.14 -->
103
+ <tr>
104
+ <th>最終コール状態</th>
105
+ <td><!-- %= select_tag "last_detail[statu]", options_for_select( [""] + Detail.StatuItems, @last_detail_params[:statu] ) %>--></td>
106
+ <th>再コール日時</th>
107
+ <td></td>
108
+ </th>
109
+ <tr>
110
+ <th>最終コール日時(最初)</th>
111
+ <td>
112
+ <div class='input-group date' id='created_at_from_datetimepicker'>
113
+ <%= text_field_tag "last_detail[created_at_from]", @last_detail_params[:created_at_from], class: "form-control" %>
114
+ <span class="input-group-addon">
115
+ <span class="glyphicon glyphicon-calendar"></span>
116
+ </span>
117
+ </div>
118
+ </td>
119
+ <th>最終コール日時(最後)</th>
120
+ <td>
121
+ <div class='input-group date' id='created_at_to_datetimepicker'>
122
+ <%= text_field_tag "last_detail[created_at_to]", @last_detail_params[:created_at_to], class: "form-control" %>
123
+ <span class="input-group-addon">
124
+ <span class="glyphicon glyphicon-calendar"></span>
125
+ </span>
126
+ </div>
127
+ <%# text_field_tag "last_detail[created_at_from]", @last_detail_params[:created_at_from], class: "datetimepicker" %>
128
+ <%# text_field_tag "last_detail[created_at_to]", @last_detail_params[:created_at_to], class: "datetimepicker" %>
129
+ </td>
130
+ </tr>
131
+ <tr>
132
+ <th colspan = "4" ><%= f.submit '検索' %></th>
133
+ </tr>
134
+ <% end %>
135
+ </tbody>
136
+ </table>
137
+
138
+ <script>
51
139
  ```