forked from s421507/eOSP2
Dodanie widoku
This commit is contained in:
parent
5a840b7819
commit
deea1c22aa
@ -24,7 +24,30 @@ class operationsController extends Controller
|
|||||||
->select('operations.id', 'operations.operationDate', 'operations.location', 'operations.target', 'operations.dangerType', 'operations.description', 'operations.commanderID', 'operations.fireStationID', 'users.name', 'users.surname')
|
->select('operations.id', 'operations.operationDate', 'operations.location', 'operations.target', 'operations.dangerType', 'operations.description', 'operations.commanderID', 'operations.fireStationID', 'users.name', 'users.surname')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return view('operation', ["operations" => $operations]);
|
foreach($operations as $operation){
|
||||||
|
$id =$operation->id;
|
||||||
|
$fireFighters[$id] = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )
|
||||||
|
->leftJoin('operationsMembers', function ($join) use($id){
|
||||||
|
$join->on('users.id', '=', 'operationsMembers.memberID');
|
||||||
|
$join->where('operationsMembers.operationID', '=', $id);
|
||||||
|
})
|
||||||
|
->select('users.*', 'operationsMembers.memberID', 'operationsMembers.privateTransport')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$trucks[$id] = DB::table('vehicles')->where("vehicles.fireStationID", "=", auth()->user()->fireStationID )
|
||||||
|
->leftJoin('operationsTrucks', function ($join) use($id){
|
||||||
|
$join->on('vehicles.id', '=', 'operationsTrucks.truckID');
|
||||||
|
$join->where('operationsTrucks.operationID', '=', $id);
|
||||||
|
})
|
||||||
|
->leftJoin('users', 'operationsTrucks.driverID', '=', 'users.id')
|
||||||
|
->select('vehicles.*', 'operationsTrucks.truckID', 'operationsTrucks.driverID', 'users.name as driverName', 'users.surname as driverSurname')
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// return view('operation', ["operations" => $operations], ["fireFighters" => $fireFighters], ["trucks" => $trucks]);
|
||||||
|
return View::make('/operation')->with(compact('operations', 'fireFighters', 'trucks'));
|
||||||
} else{
|
} else{
|
||||||
return view('operation');
|
return view('operation');
|
||||||
}
|
}
|
||||||
@ -179,8 +202,8 @@ class operationsController extends Controller
|
|||||||
for($count = 0; $count < count($operationDriver); $count++){
|
for($count = 0; $count < count($operationDriver); $count++){
|
||||||
$operationsTrucks = operationsTrucks::create([
|
$operationsTrucks = operationsTrucks::create([
|
||||||
'operationID' => $request->operationID,
|
'operationID' => $request->operationID,
|
||||||
'truckID' => $operationDriver[$count],
|
'truckID' => $operationVehicle[$count],
|
||||||
'driverID' => $operationVehicle[$count]
|
'driverID' => $operationDriver[$count]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,24 +35,54 @@
|
|||||||
<td><a href="{{ URL::asset('wyjazdy/edit/'.$operation->id) }}"><input type="button" onclick="" value="Edytuj"> </a></td>
|
<td><a href="{{ URL::asset('wyjazdy/edit/'.$operation->id) }}"><input type="button" onclick="" value="Edytuj"> </a></td>
|
||||||
<td><input type="button" onclick="showMoreInformation('{{$operation->id}}')" id="more{{$operation->id}}" value="Więcej"></td>
|
<td><input type="button" onclick="showMoreInformation('{{$operation->id}}')" id="more{{$operation->id}}" value="Więcej"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="moreInformation{{$operation->id}}" style="display:none;" bgcolor="#C0C0C0">
|
<tr id="moreInformation{{$operation->id}}" style="visibility:collapse;" bgcolor="#C0C0C0">
|
||||||
|
|
||||||
<td colspan="5">
|
<td colspan="5">
|
||||||
|
<center>
|
||||||
<table>
|
<table>
|
||||||
<tr class='table-header' colspan="5">
|
<tr class='table-header'>
|
||||||
<td colspan="5">Opis {{$operation->id}}</td>
|
<td colspan="8">Opis Akcji</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$operation->description}}</td>
|
<td>{{$operation->description}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class='table-header' colspan="5">
|
|
||||||
|
<tr><td></td></tr>
|
||||||
|
|
||||||
|
<tr class="table-header">
|
||||||
|
<td>Pojazdy</td>
|
||||||
|
<td>Kierowcy</td>
|
||||||
|
</tr>
|
||||||
|
@foreach($trucks[$operation->id] as $truck)
|
||||||
|
@if($truck->truckID != null)
|
||||||
|
<tr>
|
||||||
|
<td>{{$truck->name}} {{$truck->codename }} {{$truck->brand}} {{$truck->registrationNumber}}</td>
|
||||||
|
<td>{{$truck->driverName }} {{ $truck->driverSurname}}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
<tr><td></td></tr>
|
||||||
|
|
||||||
<tr class='table-header' colspan="5">
|
<tr class='table-header' colspan="5">
|
||||||
<td>Członkowie Akcji</td>
|
<td>Członkowie Akcji</td>
|
||||||
|
<td>Transport Własny</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@foreach($fireFighters[$operation->id] as $fireFighter)
|
||||||
|
@if($fireFighter->memberID != null)
|
||||||
|
<tr>
|
||||||
|
<td>{{$fireFighter->name}} {{$fireFighter->surname }}</td>
|
||||||
|
<td>{{($fireFighter->privateTransport == 1) ? "Tak" : "Nie"}}</td>
|
||||||
|
</tr>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
</table>
|
</table>
|
||||||
|
</center>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</table>"
|
</table>
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
@ -66,10 +96,10 @@
|
|||||||
|
|
||||||
if( $('#more'+operationID).val() == "Więcej"){
|
if( $('#more'+operationID).val() == "Więcej"){
|
||||||
$('#more'+operationID).val("Ukryj");
|
$('#more'+operationID).val("Ukryj");
|
||||||
$("#moreInformation"+operationID).css('display', 'block');
|
$("#moreInformation"+operationID).css('visibility', 'visible');
|
||||||
} else{
|
} else{
|
||||||
$('#more'+operationID).val("Więcej");
|
$('#more'+operationID).val("Więcej");
|
||||||
$("#moreInformation"+operationID).css('display', 'none');
|
$("#moreInformation"+operationID).css('visibility', 'collapse');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user