質問編集履歴

3

show/index/controllerの追加

2019/08/21 16:24

投稿

KOO_
KOO_

スコア58

test CHANGED
File without changes
test CHANGED
@@ -277,3 +277,89 @@
277
277
  </table>
278
278
 
279
279
  ```
280
+
281
+
282
+
283
+
284
+
285
+ 追加修正
286
+
287
+ ```show
288
+
289
+ <% if prev_customer = @customer.prev_customer %>
290
+
291
+ <%= link_to "前へ", customer_path(@prev_customer, q: params[:q]), class: "prev btn btn-danger" %>
292
+
293
+ <% end %>
294
+
295
+ <% if next_customer = @customer.next_customer %>
296
+
297
+ <%= link_to "次へ", customer_path(@next_customer, q: params[:q]), class: "next btn btn-danger" %>
298
+
299
+ <% end %>
300
+
301
+ ```
302
+
303
+
304
+
305
+ ```index
306
+
307
+ <% @customers.each do |customer| %>
308
+
309
+ <tr>
310
+
311
+ <td><%= link_to customer.company, customer_path(customer, q: params[:q]) %></td>
312
+
313
+ <td><%= link_to customer.first_name, customer_path(customer, q: params[:q]) %></td>
314
+
315
+ <td><%= customer.tel %></td>
316
+
317
+ <td><%= customer.mail %></td>
318
+
319
+ <td><%= link_to '編集', edit_customer_path(customer), class: 'command'%>
320
+
321
+ <%= link_to '削除',
322
+
323
+ customer_path(customer),
324
+
325
+ method: :delete,
326
+
327
+ class: 'command',
328
+
329
+ data: { confirm: '本当に削除しますか?'} %></td>
330
+
331
+ <% end %>
332
+
333
+ ```
334
+
335
+
336
+
337
+ ```controller
338
+
339
+ def before
340
+
341
+ @before_customer = Customer.where("id > ?", id).first
342
+
343
+ end
344
+
345
+
346
+
347
+ def next
348
+
349
+ @next_customer = Customer.where("id < ?", id).last
350
+
351
+ end
352
+
353
+
354
+
355
+ def show
356
+
357
+ @q = Customer.ransack(params[:q])
358
+
359
+ @customer = @q.result.find(params[:id])
360
+
361
+ end
362
+
363
+
364
+
365
+ ```

2

indexのsearchを追加

2019/08/21 16:24

投稿

KOO_
KOO_

スコア58

test CHANGED
File without changes
test CHANGED
@@ -108,6 +108,12 @@
108
108
 
109
109
  ```
110
110
 
111
+ <div class="heading"><h2>リスト検索</h2></div>
112
+
113
+
114
+
115
+ <!--検索機能実装-->
116
+
111
117
  <%= search_form_for @q do |f| %>
112
118
 
113
119
  <table width = "90%">
@@ -144,11 +150,11 @@
144
150
 
145
151
  <th>代表者</th>
146
152
 
147
- <td><%= f.search_field :owner_cont, type: "text" %></td>
153
+ <td><%= f.search_field :first_name_cont, type: "text" %></td>
148
154
 
149
155
  <th>ダイヒョウ</th>
150
156
 
151
- <td><%= f.search_field :kana_cont, type: "text" %></td>
157
+ <td><%= f.search_field :first_kana_cont, type: "text" %></td>
152
158
 
153
159
  </tr>
154
160
 
@@ -206,7 +212,7 @@
206
212
 
207
213
  <th>最終コール状態</th>
208
214
 
209
- <td><!-- %= select_tag "last_detail[statu]", options_for_select( [""] + Detail.StatuItems, @last_detail_params[:statu] ) %>--></td>
215
+ <td><%= select_tag "last_call[statu]", options_for_select( [""] + Call.StatuItems, @last_call_params[:statu] ) %></td>
210
216
 
211
217
  <th>再コール日時</th>
212
218
 
@@ -222,7 +228,7 @@
222
228
 
223
229
  <div class='input-group date' id='created_at_from_datetimepicker'>
224
230
 
225
- <%= text_field_tag "last_detail[created_at_from]", @last_detail_params[:created_at_from], class: "form-control" %>
231
+ <%= text_field_tag "last_call[created_at_from]", @last_call_params[:created_at_from], class: "form-control" %>
226
232
 
227
233
  <span class="input-group-addon">
228
234
 
@@ -240,7 +246,7 @@
240
246
 
241
247
  <div class='input-group date' id='created_at_to_datetimepicker'>
242
248
 
243
- <%= text_field_tag "last_detail[created_at_to]", @last_detail_params[:created_at_to], class: "form-control" %>
249
+ <%= text_field_tag "last_call[created_at_to]", @last_call_params[:created_at_to], class: "form-control" %>
244
250
 
245
251
  <span class="input-group-addon">
246
252
 
@@ -270,8 +276,4 @@
270
276
 
271
277
  </table>
272
278
 
273
-
274
-
275
- <script>
276
-
277
- ```
279
+ ```

1

indexのsearchを追加

2019/08/21 16:11

投稿

KOO_
KOO_

スコア58

test CHANGED
File without changes
test CHANGED
@@ -99,3 +99,179 @@
99
99
  end
100
100
 
101
101
  ```
102
+
103
+
104
+
105
+
106
+
107
+ indexの検索条件は以下のようになります。
108
+
109
+ ```
110
+
111
+ <%= search_form_for @q do |f| %>
112
+
113
+ <table width = "90%">
114
+
115
+ <col width="20%">
116
+
117
+ <col width="30%">
118
+
119
+ <col width="20%">
120
+
121
+ <col width="30%">
122
+
123
+ <tbody>
124
+
125
+ <tr>
126
+
127
+ <th colspan = "4">検索</th>
128
+
129
+ </tr>
130
+
131
+ <tr>
132
+
133
+ <th>会社名</th>
134
+
135
+ <td><%= f.search_field :company_cont, type: "text" %></td>
136
+
137
+ <th>店舗名</th>
138
+
139
+ <td><%= f.search_field :store_cont, type: "text" %> </td>
140
+
141
+ </tr>
142
+
143
+ <tr>
144
+
145
+ <th>代表者</th>
146
+
147
+ <td><%= f.search_field :owner_cont, type: "text" %></td>
148
+
149
+ <th>ダイヒョウ</th>
150
+
151
+ <td><%= f.search_field :kana_cont, type: "text" %></td>
152
+
153
+ </tr>
154
+
155
+ <tr>
156
+
157
+ <th>電話番号1</th>
158
+
159
+ <td><%= f.search_field :tel_cont, type: "text" %></td>
160
+
161
+ <th>電話番号2</th>
162
+
163
+ <td><%= f.search_field :tel2_cont, type: "text" %></td>
164
+
165
+ </tr>
166
+
167
+ <tr>
168
+
169
+ <th>FAX番号</th>
170
+
171
+ <td><%= f.search_field :fax_cont, type: "text" %></td>
172
+
173
+ <th>業種</th>
174
+
175
+ <td><%= f.search_field :industry_cont, type: "text" %></td>
176
+
177
+ </tr>
178
+
179
+ <tr>
180
+
181
+ <th>メール</th>
182
+
183
+ <td><%= f.search_field :mail_cont, type: "text" %></td>
184
+
185
+ <th>URL</th>
186
+
187
+ <td><%= f.search_field :url_cont, type: "text" %></td>
188
+
189
+ </tr>
190
+
191
+ <tr>
192
+
193
+ <th>人数</th>
194
+
195
+ <td><%= f.search_field :people_cont, type: "text" %></td>
196
+
197
+ <th>住所</th>
198
+
199
+ <td><%= f.search_field :address_cont, type: "text" %></td>
200
+
201
+ </tr>
202
+
203
+ <!-- #TPD #2018.12.14 -->
204
+
205
+ <tr>
206
+
207
+ <th>最終コール状態</th>
208
+
209
+ <td><!-- %= select_tag "last_detail[statu]", options_for_select( [""] + Detail.StatuItems, @last_detail_params[:statu] ) %>--></td>
210
+
211
+ <th>再コール日時</th>
212
+
213
+ <td></td>
214
+
215
+ </th>
216
+
217
+ <tr>
218
+
219
+ <th>最終コール日時(最初)</th>
220
+
221
+ <td>
222
+
223
+ <div class='input-group date' id='created_at_from_datetimepicker'>
224
+
225
+ <%= text_field_tag "last_detail[created_at_from]", @last_detail_params[:created_at_from], class: "form-control" %>
226
+
227
+ <span class="input-group-addon">
228
+
229
+ <span class="glyphicon glyphicon-calendar"></span>
230
+
231
+ </span>
232
+
233
+ </div>
234
+
235
+ </td>
236
+
237
+ <th>最終コール日時(最後)</th>
238
+
239
+ <td>
240
+
241
+ <div class='input-group date' id='created_at_to_datetimepicker'>
242
+
243
+ <%= text_field_tag "last_detail[created_at_to]", @last_detail_params[:created_at_to], class: "form-control" %>
244
+
245
+ <span class="input-group-addon">
246
+
247
+ <span class="glyphicon glyphicon-calendar"></span>
248
+
249
+ </span>
250
+
251
+ </div>
252
+
253
+ <%# text_field_tag "last_detail[created_at_from]", @last_detail_params[:created_at_from], class: "datetimepicker" %>
254
+
255
+ <%# text_field_tag "last_detail[created_at_to]", @last_detail_params[:created_at_to], class: "datetimepicker" %>
256
+
257
+ </td>
258
+
259
+ </tr>
260
+
261
+ <tr>
262
+
263
+ <th colspan = "4" ><%= f.submit '検索' %></th>
264
+
265
+ </tr>
266
+
267
+ <% end %>
268
+
269
+ </tbody>
270
+
271
+ </table>
272
+
273
+
274
+
275
+ <script>
276
+
277
+ ```