forked from s421507/eOSP2
Jednostka - pobieranie ilości aktywnych członków
This commit is contained in:
parent
ecb5ab78fe
commit
2513a41e0a
@ -6,13 +6,18 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\fireStation;
|
||||
use DB;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class fireStationController extends Controller
|
||||
{
|
||||
public function create(){
|
||||
if(auth()->user() != null && auth()->user()->fireStationID != null ){
|
||||
$users = DB::table('users')
|
||||
->where('fireStationID', '=', auth()->user()->fireStationID)
|
||||
->count();
|
||||
$fireStation = fireStation::find(auth()->user()->fireStationID);
|
||||
return view('unit', ["fireStation" => $fireStation]);
|
||||
return View::make('unit')->with(compact('fireStation', 'users'));
|
||||
|
||||
} else{
|
||||
$voivodeships = DB::table('wojewodztwa')->pluck("name","id");
|
||||
return view('unit',compact('voivodeships'));
|
||||
|
@ -85,9 +85,20 @@ class operationsController extends Controller
|
||||
})
|
||||
->select('users.*', 'operationsMembers.memberID', 'operationsMembers.privateTransport')
|
||||
->get();
|
||||
|
||||
|
||||
$operationsTrucks = 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();
|
||||
|
||||
// if($userFireStation == $fireFighterFireStation && auth()->user()->id == $fireStationCreatorId) {
|
||||
// return view('operationEdit', ["operation" => $operation], ["fireFighters" => $fireFighters], ["operationMembers" => $operationMembers] );
|
||||
return View::make('/operationEdit')->with(compact('fireFighters','operation', 'operationMembers', 'vehicles'));
|
||||
return View::make('/operationEdit')->with(compact('fireFighters','operation', 'operationMembers', 'vehicles', 'operationsTrucks'));
|
||||
// } else{
|
||||
// return "Brak dostepu";
|
||||
// }
|
||||
|
@ -12,7 +12,4 @@ class operations extends Model
|
||||
|
||||
protected $fillable = ['fireStationID', 'operationDate', 'location', 'target', 'dangerType', 'description', 'commanderID'];
|
||||
|
||||
public function getFromOperationsAttribute($value){
|
||||
return \Carbon\Carbon::parse($value)->format('d-m-Y');
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
{{ csrf_field() }}
|
||||
<div class="form-group">
|
||||
<label for="date">Data wyjazdu: </label>
|
||||
<input type="datetime-local" id="operationDate" name="operationDate" value="1985-04-12T23:20">
|
||||
<input type="datetime-local" id="operationDate" name="operationDate" >
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
@ -51,23 +51,31 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@foreach($operationsTrucks as $operationTruck)
|
||||
{{$operationTruck->driverName}}
|
||||
@endforeach
|
||||
|
||||
<div class=form-group">
|
||||
<div id="drivers">
|
||||
{{-- <label for="location">Kierowca:</label>--}}
|
||||
{{-- <select name="operationDriver" class="form-control">--}}
|
||||
{{-- <option value="">--- Wybierz kierowcę ---</option>--}}
|
||||
{{-- @foreach ($fireFighters as $fireFighter)--}}
|
||||
{{-- <option value="{{$fireFighter->id}}">{{ $fireFighter->name }} {{$fireFighter->surname }}</option>--}}
|
||||
{{-- @endforeach--}}
|
||||
{{-- </select>--}}
|
||||
{{-- <label for="location">Pojazd:</label>--}}
|
||||
{{-- <select name="operationVehicle" class="form-control">--}}
|
||||
{{-- <option value="">--- Wybierz pojazd ---</option>--}}
|
||||
{{-- @foreach ($vehicles as $vehicle)--}}
|
||||
{{-- <option value="{{$vehicle->id}}">{{ $vehicle->name }} {{$vehicle->codename }} {{$vehicle->registrationNumber }}</option>--}}
|
||||
{{-- @endforeach--}}
|
||||
{{-- </select>--}}
|
||||
@foreach($operationsTrucks as $operationTruck)
|
||||
<div id="singleDriver">
|
||||
{{$operationTruck->driverName}}
|
||||
<label for="location">Kierowca:</label>
|
||||
<select name="operationDriver" class="form-control">
|
||||
<option value="">--- Wybierz kierowcę ---</option>
|
||||
@foreach ($fireFighters as $fireFighter)
|
||||
<option value="{{$fireFighter->id}}">{{ $fireFighter->name }} {{$fireFighter->surname }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<label for="location">Pojazd:</label>
|
||||
<select name="operationVehicle" class="form-control">
|
||||
<option value="">--- Wybierz pojazd ---</option>
|
||||
@foreach ($vehicles as $vehicle)
|
||||
<option value="{{$vehicle->id}}">{{ $vehicle->name }} {{$vehicle->codename }} {{$vehicle->registrationNumber }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -104,7 +112,6 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
{{--document.getElementById("operationDate").defaultValue = "{{\Carbon\Carbon::parse($operation->operationDate)->format('d.m.Y H:i')}}";--}}
|
||||
var count = 1;
|
||||
|
||||
dynamic_field(count);
|
||||
|
@ -29,7 +29,7 @@
|
||||
<p><b>Telefon:</b> {{ $fireStation-> phoneNumber }}</p>
|
||||
<p><b>E-mail:</b> {{ $fireStation-> email }}</p>
|
||||
<hr>
|
||||
<p><b>Liczba członków:</b> 40</p>
|
||||
<p><b>Liczba członków:</b> {{$users}}</p>
|
||||
</div>
|
||||
<div>
|
||||
@endif
|
||||
|
Loading…
Reference in New Issue
Block a user