質問編集履歴
1
解決策の記載
test
CHANGED
File without changes
|
test
CHANGED
@@ -48,58 +48,16 @@
|
|
48
48
|
|
49
49
|
|
50
50
|
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
##解決に至ったコード
|
56
|
+
|
51
57
|
●items.blade.php
|
52
58
|
|
53
59
|
```php
|
54
60
|
|
55
|
-
@extends('layouts.layout')
|
56
|
-
|
57
|
-
@section('title','案件一覧')
|
58
|
-
|
59
|
-
@section('body')
|
60
|
-
|
61
|
-
<!--サイドメニューここから-->
|
62
|
-
|
63
|
-
<div class="row">
|
64
|
-
|
65
|
-
<div class="col s0 l2">
|
66
|
-
|
67
|
-
<ul id="slide-out" class="sidenav sidenav-fixed ">
|
68
|
-
|
69
|
-
<li><a href="{{url('/user')}}">クライアント一覧<i class="material-icons left">person</i></a></li>
|
70
|
-
|
71
|
-
<li><a href="#">案件カレンダー<i class="material-icons left">date_range</i></a></li>
|
72
|
-
|
73
|
-
<li><a href="{{url('/addClient')}}">クライアント追加<i class="material-icons left">add</i></a></li>
|
74
|
-
|
75
|
-
<li><a href="{{url('addItem')}}">案件追加<i class="material-icons left">add</i></a></li>
|
76
|
-
|
77
|
-
</ul>
|
78
|
-
|
79
|
-
</div>
|
80
|
-
|
81
|
-
<!--サイドメニューここまで-->
|
82
|
-
|
83
|
-
<div class="col s12 offset-l1 l8">
|
84
|
-
|
85
|
-
<nav class="header">
|
86
|
-
|
87
|
-
<a href="#" data-target="slide-out" class="sidenav-trigger btn-floating"><i class="medium z-depth-1 material-icons">add</i></a>
|
88
|
-
|
89
|
-
<h2 class="center-align">案件一覧</h2>
|
90
|
-
|
91
|
-
</nav>
|
92
|
-
|
93
|
-
@foreach($clientList as $val)
|
94
|
-
|
95
|
-
@if($id == $val->id)
|
96
|
-
|
97
|
-
<h3>{{$val->client_name}}</h3>
|
98
|
-
|
99
|
-
@endif
|
100
|
-
|
101
|
-
@endforeach
|
102
|
-
|
103
61
|
<table class="highlight centered">
|
104
62
|
|
105
63
|
<thead>
|
@@ -124,10 +82,12 @@
|
|
124
82
|
|
125
83
|
<tbody>
|
126
84
|
|
85
|
+
<!--変数化して、formsのindex番号を割り振るための$index-->
|
86
|
+
|
87
|
+
<?php $index = 0; ?>
|
88
|
+
|
127
89
|
@foreach($list as $val)
|
128
90
|
|
129
|
-
@if($id == $val->client_id)
|
130
|
-
|
131
91
|
<tr>
|
132
92
|
|
133
93
|
<th>{{$val->item_name}}</th>
|
@@ -138,13 +98,13 @@
|
|
138
98
|
|
139
99
|
<th>
|
140
100
|
|
141
|
-
<form method="POST" action="/updateItemStates/{{$val->id}}" id="states_form"
|
101
|
+
<form method="POST" action="/updateItemStates/{{$val->id}}" id="states_form">
|
142
102
|
|
143
103
|
{{csrf_field()}}
|
144
104
|
|
145
105
|
<div class="input-field col s12">
|
146
106
|
|
147
|
-
<select id="states" class="select" name="states">
|
107
|
+
<select id="states" class="select" name="states" onchange="modalOpen{{$val->id}}()">
|
148
108
|
|
149
109
|
<option value="1" {{$val->states == '1' ? 'selected' : ""}}>未執筆</option>
|
150
110
|
|
@@ -158,6 +118,28 @@
|
|
158
118
|
|
159
119
|
</form>
|
160
120
|
|
121
|
+
<script>
|
122
|
+
|
123
|
+
function modalOpen{{$val->id}}() {
|
124
|
+
|
125
|
+
//alert(document.forms[{{$loop->index - 1}}].states.selectedIndex);
|
126
|
+
|
127
|
+
if(document.forms[{{$index}}].states.selectedIndex==1){
|
128
|
+
|
129
|
+
//document.getElementById('states').selectedIndex
|
130
|
+
|
131
|
+
document.modal_form.item_id.value = '{{$val->id}}';
|
132
|
+
|
133
|
+
$('#modal01').modal('open');
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
}
|
138
|
+
|
139
|
+
</script>
|
140
|
+
|
141
|
+
<?php $index ++; ?>
|
142
|
+
|
161
143
|
</th>
|
162
144
|
|
163
145
|
<th>{{$val->memo}}</th>
|
@@ -166,8 +148,6 @@
|
|
166
148
|
|
167
149
|
</tr>
|
168
150
|
|
169
|
-
@endif
|
170
|
-
|
171
151
|
@endforeach
|
172
152
|
|
173
153
|
</tbody>
|
@@ -178,7 +158,9 @@
|
|
178
158
|
|
179
159
|
</div>
|
180
160
|
|
161
|
+
|
162
|
+
|
181
|
-
|
163
|
+
<!--請求書選択モーダル-->
|
182
164
|
|
183
165
|
<div class="modal" id="modal01">
|
184
166
|
|
@@ -186,11 +168,11 @@
|
|
186
168
|
|
187
169
|
<div class="inner">
|
188
170
|
|
189
|
-
{{Form::open(['url' => '
|
171
|
+
{{Form::open(['url' => 'addInvoice', 'id' => 'modal_select', 'name' => 'modal_form' ])}}
|
190
172
|
|
191
173
|
{{ csrf_field() }}
|
192
174
|
|
193
|
-
<select class="select" onchange="submit(this.form)">
|
175
|
+
<select name="invoice_id" class="select" onchange="submit(this.form)">
|
194
176
|
|
195
177
|
@foreach($invoiceList as $val)
|
196
178
|
|
@@ -202,180 +184,28 @@
|
|
202
184
|
|
203
185
|
<label for="client_id">登録先の請求書</label>
|
204
186
|
|
187
|
+
<button type="submit" class="btn btn-primary">請求書へ挿入</button>
|
188
|
+
|
189
|
+
{{Form::hidden('item_id', '')}}
|
190
|
+
|
191
|
+
{{Form::hidden('states', '2')}}
|
192
|
+
|
193
|
+
{{Form::hidden('client_id', $client->id)}}
|
194
|
+
|
195
|
+
@foreach($list as $val)
|
196
|
+
|
197
|
+
{{Form::hidden('item_name', $val->item_name)}}
|
198
|
+
|
199
|
+
{{Form::hidden('bill_unit_price', $val->unit_price)}}
|
200
|
+
|
201
|
+
@endforeach
|
202
|
+
|
205
203
|
{{Form::close()}}
|
206
204
|
|
207
|
-
<button type="submit" class="btn btn-primary">請求書へ挿入</button>
|
208
|
-
|
209
205
|
<a href="" class="modalClose">Close</a>
|
210
206
|
|
211
207
|
</div>
|
212
208
|
|
213
209
|
</div>
|
214
210
|
|
215
|
-
<script type="text/javascript">
|
216
|
-
|
217
|
-
// モーダルウィンドウの開閉処理
|
218
|
-
|
219
|
-
$(function(){
|
220
|
-
|
221
|
-
// モーダルウィンドウが開くときの処理
|
222
|
-
|
223
|
-
$(".select").change(function(){
|
224
|
-
|
225
|
-
// モーダルが開く処理を書く
|
226
|
-
|
227
|
-
var navClass = $(this).attr("class"),
|
228
|
-
|
229
|
-
href = $(this).attr("href");
|
230
|
-
|
231
|
-
$(href).fadeIn();
|
232
|
-
|
233
|
-
$(this).addClass("open");
|
234
|
-
|
235
|
-
return false;
|
236
|
-
|
237
|
-
});
|
238
|
-
|
239
|
-
// モーダルウィンドウが閉じるときの処理
|
240
|
-
|
241
|
-
$(".modalClose").click(function(){
|
242
|
-
|
243
|
-
$(this).parents(".modal").fadeOut();
|
244
|
-
|
245
|
-
$(".modalOpen").removeClass("open");
|
246
|
-
|
247
|
-
return false;
|
248
|
-
|
249
|
-
});
|
250
|
-
|
251
|
-
});
|
252
|
-
|
253
|
-
</script>
|
254
|
-
|
255
|
-
@endsection
|
256
|
-
|
257
211
|
```
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
●layout.blade.php
|
262
|
-
|
263
|
-
```php
|
264
|
-
|
265
|
-
<!DOCTYPE html>
|
266
|
-
|
267
|
-
<html lang="ja" dir="ltr">
|
268
|
-
|
269
|
-
<head>
|
270
|
-
|
271
|
-
<meta charset="utf-8">
|
272
|
-
|
273
|
-
<!--MaterializeCSS-->
|
274
|
-
|
275
|
-
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
276
|
-
|
277
|
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
|
278
|
-
|
279
|
-
<!--Google Web Font-->
|
280
|
-
|
281
|
-
<link href="https://fonts.googleapis.com/css?family=Kosugi+Maru&display=swap" rel="stylesheet">
|
282
|
-
|
283
|
-
<!--CSS-->
|
284
|
-
|
285
|
-
<link rel="stylesheet" href="css/styles.css" type="text/css" />
|
286
|
-
|
287
|
-
<title>@yield('title')</title>
|
288
|
-
|
289
|
-
</head>
|
290
|
-
|
291
|
-
<body>
|
292
|
-
|
293
|
-
@yield('body')
|
294
|
-
|
295
|
-
<script src="{{ secure_asset('js/main.js') }}" defer></script>
|
296
|
-
|
297
|
-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
|
298
|
-
|
299
|
-
<script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script>
|
300
|
-
|
301
|
-
<!--Materialize JS-->
|
302
|
-
|
303
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
|
304
|
-
|
305
|
-
<!-- タブボタンのJS -->
|
306
|
-
|
307
|
-
<script>
|
308
|
-
|
309
|
-
$(function() {
|
310
|
-
|
311
|
-
/*クリックイベント*/
|
312
|
-
|
313
|
-
$('.tab_btn').on('click', function() {
|
314
|
-
|
315
|
-
$('.tab_item').removeClass("is-active-item");
|
316
|
-
|
317
|
-
$($(this).attr("href")).addClass("is-active-item");
|
318
|
-
|
319
|
-
$('.tab_btn').removeClass('is-active-btn');
|
320
|
-
|
321
|
-
$(this).addClass('is-active-btn');
|
322
|
-
|
323
|
-
});
|
324
|
-
|
325
|
-
});
|
326
|
-
|
327
|
-
</script>
|
328
|
-
|
329
|
-
<!-- サイドバーの初期化用JS -->
|
330
|
-
|
331
|
-
<script>
|
332
|
-
|
333
|
-
document.addEventListener('DOMContentLoaded', function() {
|
334
|
-
|
335
|
-
var elems = document.querySelectorAll('.sidenav');
|
336
|
-
|
337
|
-
var instances = M.Sidenav.init(elems, {});
|
338
|
-
|
339
|
-
});
|
340
|
-
|
341
|
-
</script>
|
342
|
-
|
343
|
-
<!-- select optionの初期化用JS -->
|
344
|
-
|
345
|
-
<script>
|
346
|
-
|
347
|
-
const Selector = document.querySelectorAll('.select');
|
348
|
-
|
349
|
-
M.FormSelect.init(Selector,{});
|
350
|
-
|
351
|
-
</script>
|
352
|
-
|
353
|
-
<!--datepickerの初期化用JS-->
|
354
|
-
|
355
|
-
<script>
|
356
|
-
|
357
|
-
const Calendar = document.querySelector('.datepicker');
|
358
|
-
|
359
|
-
M.Datepicker.init(Calendar,{});
|
360
|
-
|
361
|
-
</script>
|
362
|
-
|
363
|
-
<!--datepickerのフォーマットを変える-->
|
364
|
-
|
365
|
-
<script>
|
366
|
-
|
367
|
-
$( function() {
|
368
|
-
|
369
|
-
$( ".datepicker" ).datepicker({format: 'yyyy-mm-dd'});
|
370
|
-
|
371
|
-
} );
|
372
|
-
|
373
|
-
</script>
|
374
|
-
|
375
|
-
@stack('scripts')
|
376
|
-
|
377
|
-
</body>
|
378
|
-
|
379
|
-
</html>
|
380
|
-
|
381
|
-
```
|