Skip to content

Commit 16d4c36

Browse files
authored
Merge pull request #297 from dbarzin/dev
Dev
2 parents 7374102 + 6dd4746 commit 16d4c36

File tree

2 files changed

+87
-1
lines changed

2 files changed

+87
-1
lines changed

app/Http/Controllers/MeasureController.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,17 @@ public function show(int $id)
195195
// not found
196196
abort_if($measure === null, Response::HTTP_NOT_FOUND, '404 Not Found');
197197

198+
// Get associate controls
199+
$controls = DB::table('controls')
200+
->select('controls.id','controls.name','controls.scope','score','controls.status','realisation_date','plan_date')
201+
->join('control_measure', 'control_measure.control_id', '=', 'controls.id')
202+
->leftjoin('actions', 'actions.control_id', '=', 'controls.id')
203+
->where('control_measure.measure_id', $id)
204+
->get();
205+
198206
return view('measures.show')
199-
->with('measure', $measure);
207+
->with('measure', $measure)
208+
->with('controls', $controls);
200209
}
201210

202211
/**

resources/views/measures/show.blade.php

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,83 @@
163163
</form>
164164
@endif
165165
</div>
166+
<div>
167+
<br><br>
168+
</div>
169+
<div>
170+
<table class="table striped row-hover cell-border"
171+
data-role="table"
172+
data-show-search="false"
173+
data-show-pagination="false"
174+
data-show-rows-steps="false"
175+
>
176+
<thead>
177+
<tr class="row-hover">
178+
<th class="sortable-column sort-asc" width="65%">{{ trans("cruds.welcome.controls") }}</th>
179+
<th class="sortable-column sort-asc" width="65%">{{ trans("cruds.control.fields.scope") }}</th>
180+
<th class="sortable-column sort-asc" width="5%">{{ trans("cruds.control.fields.score") }}</th>
181+
<th class="sortable-column sort-asc" width="15%">{{ trans("cruds.control.fields.plan_date") }}</th>
182+
<th class="sortable-column sort-asc" width="15%">{{ trans("cruds.control.fields.realisation_date") }}</th>
183+
</tr>
184+
</thead>
185+
<tbody>
186+
@foreach($controls as $control)
187+
<tr>
188+
<td>
189+
{{ $control->name }}
190+
</td>
191+
<td>
192+
<a id="{{ $control->scope }}" href="/bob/show/{{$control->id}}">
193+
{{ $control->scope }}
194+
</a>
195+
</td>
196+
<td>
197+
<center id="{{ $control->score }}">
198+
@if ($control->score==1)
199+
&#128545;
200+
@elseif ($control->score==2)
201+
&#128528;
202+
@elseif ($control->score==3)
203+
<span style="filter: sepia(1) saturate(5) hue-rotate(70deg)">&#128512;</span>
204+
@else
205+
&#9675; <!-- &#9899; -->
206+
@endif
207+
</center>
208+
</td>
209+
<td>
210+
<!-- format in red when month passed -->
211+
@if (($control->status === 0)||($control->status === 1))
212+
<a id="{{ $control->plan_date }}" href="/bob/show/{{$control->id}}">
213+
<b> @if (today()->lte($control->plan_date))
214+
<font color="green">{{ $control->plan_date }}</font>
215+
@else
216+
<font color="red">{{ $control->plan_date }}</font>
217+
@endif
218+
</b>
219+
</a>
220+
@else
221+
{{ $control->plan_date }}
222+
@endif
223+
</td>
224+
<td>
225+
<b id="{{ $control->realisation_date }}">
226+
<a href="/bob/show/{{$control->id}}">
227+
{{ $control->realisation_date }}
228+
</a>
229+
@if ( ($control->status===1 )&& ((Auth::User()->role===1)||(Auth::User()->role===2)))
230+
&nbsp;
231+
<a href="/bob/make/{{ $control->id }}">&#8987;</a>
232+
@endif
233+
</b>
234+
</td>
235+
</tr>
236+
@endforeach
237+
</tbody>
238+
</table>
239+
</div>
240+
<div>
241+
<br><br>
242+
</div>
166243
</div>
167244
</div>
168245
@endsection

0 commit comments

Comments
 (0)