Dodanie 3 szkoleń wspólnych dla wszystkich jednostek, wymaganych by brać udział w wyjazdach w roli strażaka/kierowcy/dowódcy

This commit is contained in:
Krzysztof Strzelecki 2020-02-27 15:32:33 +01:00
parent 1b0c7bc916
commit 7a9272b865
3 changed files with 40 additions and 1 deletions

View File

@ -15,7 +15,7 @@ class trainingsController extends Controller
public function create(){
if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
$trainings = DB::table('trainings')->where("fireStationID", '=', auth()->user()->fireStationID)
$trainings = DB::table('trainings')->where("fireStationID", '=', auth()->user()->fireStationID)->orWhere("fireStationID", '=', 0)
->whereNull('deleted_at')
->paginate(10);

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddTrainingsNecessaryForOperations extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('trainings', function (Blueprint $table) {
});
//szkolenia niezbędne w każdej jednostce, określają kto może uczestniczyć w wyjazdach w jakie roli
DB::table('trainings')->insert([ 'id' => '1', 'fireStationID' => '0', 'trainingName' => 'szkolenie podstawowe' ]);
DB::table('trainings')->insert([ 'id' => '2', 'fireStationID' => '0', 'trainingName' => 'dowódca' ]);
DB::table('trainings')->insert([ 'id' => '3', 'fireStationID' => '0', 'trainingName' => 'kierowca-mechanik' ]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('trainings', function (Blueprint $table) {
//
});
}
}

View File

@ -60,9 +60,13 @@
<td id="name{{ $training->id }}">{{ $training->trainingName }}</td>
<td id="amount{{ $training->id }}">{{$howMuch[$training->id]}}</td>
<td>
@if($training->fireStationID != 0)
<button class="btn btn-success " type="submit" onclick="renameTraining('{{$training->id}}')" id="{{$training->id}}">Zmień nazwę</button>
@endif
<a href="{{ URL::asset('szkolenia/addTrainingsFireFighters/'.$training->id) }}" class="btn btn-secondary" role="button">Zarządzaj</a>
@if($training->fireStationID != 0)
<button class="btn btn-danger" type="submit" id="{{$training->id}}" onclick="deleteButton('{{$training->id}}')">Usuń</button>
@endif
<form action="{{ route('trainings.pdfSingle') }}" method="post" style="display:inline;">
{{ csrf_field() }}
<input type="hidden" class="form-control" name="trainingID" value="{{$training->id}}">