diff --git a/.idea/php.xml b/.idea/php.xml index ffcd053..8afe83c 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -97,12 +97,16 @@ + + + + - + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 3248633..2538e00 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,32 +1,29 @@ - - - + $PROJECT_DIR$/composer.json - - - - - - @@ -124,53 +121,41 @@ + + + + - - - - - - - - - - - - - - - - - - - - - + + @@ -187,40 +172,38 @@ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/Http/Controllers/operationsController.php b/app/Http/Controllers/operationsController.php index 7994efc..478a0e6 100644 --- a/app/Http/Controllers/operationsController.php +++ b/app/Http/Controllers/operationsController.php @@ -87,12 +87,18 @@ class operationsController extends Controller ->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') +// $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(); + + $operationsTrucks = DB::table('operationsTrucks')->where("operationsTrucks.operationID", "=", $id) + ->join('users', 'operationsTrucks.driverID', '=', 'users.ID') + ->join('vehicles', 'operationsTrucks.truckID', '=', 'vehicles.ID') ->select('vehicles.*', 'operationsTrucks.truckID', 'operationsTrucks.driverID', 'users.name as driverName', 'users.surname as driverSurname') ->get(); @@ -191,7 +197,8 @@ class operationsController extends Controller 'transport.*' => 'required', ], [ - 'required' => ':attribute jest wymagany(e)' + 'required' => ':attribute jest wymagany(e)', + 'operationTarget.required' => 'Cel jest wyma gany' ]); diff --git a/resources/views/layout/app.blade.php b/resources/views/layout/app.blade.php index 58b4381..6ef26fe 100644 --- a/resources/views/layout/app.blade.php +++ b/resources/views/layout/app.blade.php @@ -8,10 +8,10 @@ {{-- --}} - . + {{-- --}} {{-- --}} - + diff --git a/resources/views/operation.blade.php b/resources/views/operation.blade.php index 869a659..63911c3 100644 --- a/resources/views/operation.blade.php +++ b/resources/views/operation.blade.php @@ -3,10 +3,7 @@ @section('left-menu') @parent @stop @@ -16,72 +13,102 @@ @if( auth()->user()->fireStationID == NULL) Jednostka nie istnieje @else - - - - - - - - - - @foreach($operations as $operation) +
DataMiejsceCelRodzaj zagrożeniaDowódca
+ - - - - - - - + + + + + + + + - + - + + + @php + $i++; + @endphp + @endforeach +
{{ $operation->operationDate }}{{ $operation->location }}{{ $operation->target }}{{ $operation->dangerType }}{{$operation->name}} {{$operation->surname}} #DataMiejsceCelRodzaj zagrożeniaDowódcaOperacjaSzczegóły
-
- - - - - - - - - - - - - - - @foreach($trucks[$operation->id] as $truck) - @if($truck->truckID != null) + + @php + $i=1; + @endphp + @foreach($operations as $operation) + + + + + + + + + + + + {{-- bgcolor="#C0C0C0"--}} + - - @endforeach + + + + + + + + + @foreach($trucks[$operation->id] as $truck) + @if($truck->truckID != null) + + + + + @endif + @endforeach + + + + + + + + + + + + @foreach($fireFighters[$operation->id] as $fireFighter) + @if($fireFighter->memberID != null) + + + + + @endif + @endforeach + + + + + + +
Opis Akcji
{{$operation->description}}
PojazdyKierowcy
{{$i}}{{ $operation->operationDate }}{{ $operation->location }}{{ $operation->target }}{{ $operation->dangerType }}{{$operation->name}} {{$operation->surname}}
+
+ + - - + - @endif - @endforeach + - - - - - - - @foreach($fireFighters[$operation->id] as $fireFighter) - @if($fireFighter->memberID != null) + - - + - @endif - @endforeach -
{{$truck->name}} {{$truck->codename }} {{$truck->brand}} {{$truck->registrationNumber}}{{$truck->driverName }} {{ $truck->driverSurname}}
Opis Akcji
Członkowie AkcjiTransport Własny
{{$fireFighter->name}} {{$fireFighter->surname }}{{($fireFighter->privateTransport == 1) ? "Tak" : "Nie"}}{{$operation->description}}
-
-
Pojazdy
Kierowcy
{{$truck->name}} {{$truck->codename }} {{$truck->brand}} {{$truck->registrationNumber}}{{$truck->driverName }} {{ $truck->driverSurname}}
Członkowie Akcji
Transport Własny
{{$fireFighter->name}} {{$fireFighter->surname }}{{($fireFighter->privateTransport == 1) ? "Tak" : "Nie"}}
+
+
@endif @@ -103,3 +130,5 @@ } + + diff --git a/resources/views/operationAdd.blade.php b/resources/views/operationAdd.blade.php index eb2d8ad..d1e1a5b 100644 --- a/resources/views/operationAdd.blade.php +++ b/resources/views/operationAdd.blade.php @@ -3,10 +3,7 @@ @section('left-menu') @parent @stop @@ -14,9 +11,11 @@ @parent
{{ csrf_field() }} -
- - +
+
+ + +
@@ -39,14 +38,16 @@
-
- - +
+
+ + +
@@ -67,24 +68,39 @@ {{-- @endforeach--}} {{-- --}}
+
+
+
+
- - - - - @php - $i = 0; - @endphp - @foreach($fireFighters as $fireFighterChecklist) +
Imię i nazwisko: Obecność:Transport własny:
+ - + + + + + + + @php - $i++; + $i = 0; @endphp - @endforeach + @foreach($fireFighters as $fireFighterChecklist) + + + + + + + @php + $i++; + @endphp + @endforeach +
{{ $fireFighterChecklist->name }} {{$fireFighterChecklist->surname }}
#Imię i NazwiskoObecnośćTransport własny
{{$i+1}}{{ $fireFighterChecklist->name }} {{$fireFighterChecklist->surname }}
@@ -106,13 +122,18 @@ function dynamic_field(number) { - html = '
'; + html = '
'; + html += '
'; + html += '
'; + html += ''; html += ''; + html += '
'; + html += '
'; html += ''; html += ''; + html += '
'; + html += '
'; + html += ''; + html += '
'; + html += '
'; + html += '
'; + + $('#drivers').append(html); - if(number > 1) - { - html += '
'; - $('#drivers').append(html); - } - else - { - html += '
'; - $('#drivers').html(html); - } } $(document).on('click', '#add', function(){ @@ -140,7 +159,18 @@ $(document).on('click', '.remove', function(){ count--; - $(this).closest("#singleDriver").remove(); + + swal.fire({ + html: "Czy na pewno chcesz usunąć pojazd?",// this will output "Error 422: Unprocessable Entity" + width: 'auto', + confirmButtonText: 'Tak', + cancelButtonText: 'Nie', + showCancelButton: true, + }).then((result) => { + if (result.value) { + $(this).closest("#singleDriver").remove(); + } + }); }); {{--$('#dynamic_form').on('submit', function(event){--}} diff --git a/resources/views/operationEdit.blade.php b/resources/views/operationEdit.blade.php index 51a1246..62be720 100644 --- a/resources/views/operationEdit.blade.php +++ b/resources/views/operationEdit.blade.php @@ -3,31 +3,31 @@ @section('left-menu') @parent @stop @section('center-area') @parent - + {{ csrf_field() }} -
- - +
+
+ + +
+
- +
@@ -41,65 +41,85 @@
-
- - +
+
+ + +
- @foreach($operationsTrucks as $operationTruck) - {{$operationTruck->driverName}} - @endforeach -
@foreach($operationsTrucks as $operationTruck)
- {{$operationTruck->driverName}} - - - - +
+
+ + +
+
+ + +
+
+ +
+
@endforeach +
+
+
+
+
- - - - - @php - $i = 0; - @endphp - @foreach($fireFighters as $fireFighterChecklist) +
Imię i nazwisko: Obecność:Transport własny:
+ - + + + + + + + @php - $i++; + $i = 0; @endphp - @endforeach + @foreach($fireFighters as $fireFighterChecklist) + + + + + + + @php + $i++; + @endphp + @endforeach +
{{ $fireFighterChecklist->name }} {{$fireFighterChecklist->surname }}
memberID != null ? 'checked' : ''}} >
privateTransport == 1 ? 'checked' : ''}}>
#Imię i NazwiskoObecnośćTransport własny
{{$i+1}}{{ $fireFighterChecklist->name }} {{$fireFighterChecklist->surname }}memberID != null ? 'checked' : ''}} >privateTransport == 1 ? 'checked' : ''}}>
- -
@@ -114,18 +134,21 @@ var count = 1; - dynamic_field(count); function dynamic_field(number) { - - html = '
'; + html = '
'; + html += '
'; + html += '
'; + html += ''; html += ''; + html += '
'; + html += '
'; html += ''; html += ''; + html += '
'; + html += '
'; + html += ''; + html += '
'; + html += '
'; + html += '
'; - if(number > 1) - { - html += '
'; - $('#drivers').append(html); - } - else - { - html += '
'; - $('#drivers').html(html); - } + $('#drivers').append(html); } $(document).on('click', '#add', function(){ @@ -153,39 +173,19 @@ $(document).on('click', '.remove', function(){ count--; - $(this).closest("#singleDriver").remove(); - }); - {{--$('#dynamic_form').on('submit', function(event){--}} - {{-- event.preventDefault();--}} - {{-- $.ajax({--}} - {{-- url:'{{ route("operationController.store") }}',--}} - {{-- method:'post',--}} - {{-- data:$(this).serialize(),--}} - {{-- dataType:'json',--}} - {{-- beforeSend:function(){--}} - {{-- $('#save').attr('disabled','disabled');--}} - {{-- },--}} - {{-- success:function(data)--}} - {{-- {--}} - {{-- if(data.error)--}} - {{-- {--}} - {{-- var error_html = '';--}} - {{-- for(var count = 0; count < data.error.length; count++)--}} - {{-- {--}} - {{-- error_html += '

'+data.error[count]+'

';--}} - {{-- }--}} - {{-- $('#result').html('
'+error_html+'
');--}} - {{-- }--}} - {{-- else--}} - {{-- {--}} - {{-- dynamic_field(1);--}} - {{-- $('#result').html('
'+data.success+'
');--}} - {{-- }--}} - {{-- $('#save').attr('disabled', false);--}} - {{-- }--}} - {{-- })--}} - {{--});--}} + swal.fire({ + html: "Czy na pewno chcesz usunąć pojazd?",// this will output "Error 422: Unprocessable Entity" + width: 'auto', + confirmButtonText: 'Tak', + cancelButtonText: 'Nie', + showCancelButton: true, + }).then((result) => { + if (result.value) { + $(this).closest("#singleDriver").remove(); + } + }); + }); });