1
0
forked from s421507/eOSP2

Dodanie drukowania widoków - naprawa konfliktów przy merge

This commit is contained in:
czup 2020-02-01 01:18:26 +01:00
commit b85769b644
39 changed files with 420 additions and 232 deletions

View File

@ -21,7 +21,7 @@ function formatDate($date)
class DecorationsController extends Controller class DecorationsController extends Controller
{ {
public function create($id){ public function create($id){
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
$awardedDecorations = DB::table('decorationsFirefighters')->where("decorationsFirefighters.firefighterID", '=', $id) $awardedDecorations = DB::table('decorationsFirefighters')->where("decorationsFirefighters.firefighterID", '=', $id)
->whereNull('decorationsFirefighters.deleted_at') ->whereNull('decorationsFirefighters.deleted_at')
->leftJoin('decorations', 'decorationsFirefighters.decorationID', '=', 'decorations.id') ->leftJoin('decorations', 'decorationsFirefighters.decorationID', '=', 'decorations.id')
@ -39,7 +39,7 @@ class DecorationsController extends Controller
->with(compact('decoration')); ->with(compact('decoration'));
} else{ } else{
return "Brak dostepu"; return redirect()->to('/strazacy');
} }
} }
@ -67,6 +67,8 @@ class DecorationsController extends Controller
{ {
decorationsFirefighters::where('id',$id)->delete(); decorationsFirefighters::where('id',$id)->delete();
return back(); return response()->json([
'success' => 'Record deleted successfully!'
]);
} }
} }

View File

@ -21,15 +21,15 @@ class EquipmentController extends Controller
} }
public function addForm(){ public function addForm(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
return view('equipmentAdd'); return view('equipmentAdd');
} else return view("login"); } else return redirect()->to('/sprzet');
} }
public function editForm($id) public function editForm($id)
{ {
if(auth()->user() != null && auth()->user()->fireStationID != null ) if(auth()->user() != null && auth()->user()->accessLevel() == 50 ) //prezes,naczelnik
{ {
$equipment = DB::table('equipment')->where("id", $id)->first(); $equipment = DB::table('equipment')->where("id", $id)->first();
@ -37,19 +37,24 @@ class EquipmentController extends Controller
return view('equipmentEdit', ["equipment" => $equipment]); return view('equipmentEdit', ["equipment" => $equipment]);
} }
else else
return view("login"); return redirect()->to('/sprzet');
} }
public function store(){ public function store(){
$this->validate(request(), [ $this->validate(request(), [
'name' => 'required', 'name' => 'required|max:45',
'amount' => 'required|numeric', 'amount' => 'required|numeric|digits_between:1,10',
'parameter' => 'max:45|nullable',
], ],
[ [
'required' => ':attribute jest wymagany(a).', 'required' => ':attribute jest wymagany(a).',
'name.required' => 'nazwa jest wymagany(a).',
'name.max' => 'nazwa musi mieć nie więcej niż :max znaków.',
'max' => ':attribute musi mieć nie więcej niż :max znaków.',
'numeric' => ':attribute powinna zawierać tylko cyfry.', 'numeric' => ':attribute powinna zawierać tylko cyfry.',
'digits_between' => ':attribute jest za duży(a)'
]); ]);
@ -67,12 +72,17 @@ class EquipmentController extends Controller
public function update(){ public function update(){
$this->validate(request(), [ $this->validate(request(), [
'name' => 'required', 'name' => 'required|max:45',
'amount' => 'required|numeric', 'amount' => 'required|numeric|digits_between:1,10',
'parameter' => 'max:45|nullable',
], ],
[ [
'required' => ':attribute jest wymagany(a).', 'required' => ':attribute jest wymagany(a).',
'numeric' => ':attribute powinna zawierać tylko cyfry.' 'name.required' => 'nazwa jest wymagany(a).',
'name.max' => 'nazwa musi mieć nie więcej niż :max znaków.',
'max' => ':attribute musi mieć nie więcej niż :max znaków.',
'numeric' => ':attribute powinna zawierać tylko cyfry.',
'digits_between' => ':attribute jest za duży(a)'
]); ]);

View File

@ -8,7 +8,6 @@ use App\User;
use Mail; use Mail;
use App\Rules\Pesel; use App\Rules\Pesel;
/* 'phoneNumber' => 'required|regex:/^([0-9\s\-\+\(\)]*)$/|min:9' */
class RegistrationController extends Controller class RegistrationController extends Controller
{ {
public function create() public function create()
@ -20,19 +19,18 @@ class RegistrationController extends Controller
{ {
$this->validate(request(), [ $this->validate(request(), [
'name' => 'required|alpha|min:3|max:45', 'name' => 'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/',
'surname' => 'required|alpha|min:3|max:45', 'surname' => 'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/',
'PESEL' => new Pesel, 'PESEL' => new Pesel,
'phoneNumber' => 'required|digits:9', 'phoneNumber' => 'required|digits:9',
'email' => 'required|email|unique:users', 'email' => 'required|email|unique:users',
'password' => 'required|confirmed|min:6', 'password' => 'required|confirmed|min:6|max:45',
], ],
[ [
'required' => ':attribute jest wymagany(e).', 'required' => ':attribute jest wymagany(e).',
'min' => ':attribute musi mieć przynajmniej :min znaki.', 'min' => ':attribute musi mieć przynajmniej :min znaki.',
'max' => ':attribute musi mieć nie więcej niż :max znaków.', 'max' => ':attribute musi mieć nie więcej niż :max znaków.',
'alpha' => ':attribute może zawierać tylko litery.', 'regex' => ':attribute może zawierać tylko litery, spacje, myślniki i apostrofy',
'alpha_num' => ':attribute może zawierać tylko litery i cyfry.',
'digits' => ':attribute musi składać się z :digits cyfr.', 'digits' => ':attribute musi składać się z :digits cyfr.',
'unique' =>':attribute jest już zajęty.', 'unique' =>':attribute jest już zajęty.',
'confirmed' =>':attribute się nie zgadza.', 'confirmed' =>':attribute się nie zgadza.',

View File

@ -15,9 +15,16 @@ class SessionsController extends Controller
{ {
if (auth()->attempt(request(['email', 'password'])) == false) { if (auth()->attempt(request(['email', 'password'])) == false) {
return back()->withErrors([ return back()->withErrors([
'message' => 'The email or password is incorrect, please try again' 'message' => 'Podany adres email lub hasło jest nieprawidłowe, proszę spróbować ponownie.'
]); ]);
} }
elseif(auth()->user()->statusID == 1)
{
auth()->logout();
return back()->withErrors([
'message' => 'Twoje konto zostało zawieszone.'
]);
}
return redirect()->to('/jednostka'); return redirect()->to('/jednostka');
} }

View File

@ -31,46 +31,60 @@ class VehiclesController extends Controller
} }
public function addForm(){ public function addForm(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
return view('vehiclesAdd'); return view('vehiclesAdd');
} else return view("login"); } else return redirect()->to('/pojazdy');
} }
public function editForm($id) public function editForm($id)
{ {
if(auth()->user() != null && auth()->user()->fireStationID != null ) if(auth()->user() != null && auth()->user()->accessLevel() == 50 ) //prezes,naczelnik
{ {
$vehicle = DB::table('vehicles')->where("id", $id)->first(); $vehicle = DB::table('vehicles')->where("id", $id)->first();
return view('vehiclesEdit', ["vehicle" => $vehicle]); return view('vehiclesEdit', ["vehicle" => $vehicle]);
} }
else else
return "Brak dostepu"; redirect()->to('/pojazdy');
} }
public function store(){ public function store(){
$this->validate(request(), [ $this->validate(request(), [
'name' => 'required', 'vehicleName' => 'required|max:45',
'codename' => 'required', 'codename' => 'required|max:45',
'brand' => 'max:45',
'registrationNumber' => 'max:15',
'productionYear' => 'digits:4|nullable', 'productionYear' => 'digits:4|nullable',
'foamAgent' => 'numeric|nullable', 'driveType' => 'max:45',
'enginePower' => 'numeric|nullable', 'chassisType' => 'max:45',
'crewNumber' => 'numeric|nullable', 'bodyProducer' => 'max:45',
'mass' => 'numeric|nullable', 'crewNumber' => 'numeric|nullable|digits_between:1,2',
'chassisPoductionYear' => 'numeric|nullable', 'foamAgent' => 'numeric|nullable|digits_between:1,10',
'enginePower' => 'numeric|nullable|digits_between:1,10',
'mass' => 'numeric|nullable|digits_between:1,10',
'chassisNumber' => 'max:45',
'engineNumber' => 'max:45',
'fuelType' => 'max:45',
'chassisPoductionYear' => 'digits:4|nullable',
'fireEnginePumpDescription' => 'max:250',
], ],
[ [
'name' => 'nazwa',
'required' => ':attribute jest wymagany(e).', 'required' => ':attribute jest wymagany(e).',
'numeric' => ':attribute zawiera tylko cyfry.', 'numeric' => ':attribute może zawierać tylko cyfry.',
'digits' => ':attribute musi składać się z :digits cyfr.', 'digits' => ':attribute musi składać się z :digits cyfr.',
'max' => ':attribute musi mieć nie więcej niż :max znaków.',
'digits_between' => ':attribute jest za duży(a)'
]); ]);
$request = request(); $request = request();
$vehicle = vehicle::create([ $vehicle = vehicle::create([
'fireStationID' => auth()->user()->fireStationID, 'fireStationID' => auth()->user()->fireStationID,
'name' => $request-> name, 'name' => $request-> vehicleName,
'codename' => $request-> codename, 'codename' => $request-> codename,
'brand' => $request-> brand, 'brand' => $request-> brand,
'registrationNumber' => $request-> registrationNumber, 'registrationNumber' => $request-> registrationNumber,
@ -100,25 +114,39 @@ class VehiclesController extends Controller
public function update(){ public function update(){
$this->validate(request(), [ $this->validate(request(), [
'name' => 'required', 'vehicleName' => 'required|max:45',
'codename' => 'required', 'codename' => 'required|max:45',
'brand' => 'max:45',
'registrationNumber' => 'max:15',
'productionYear' => 'digits:4|nullable', 'productionYear' => 'digits:4|nullable',
'foamAgent' => 'numeric|nullable', 'driveType' => 'max:45',
'enginePower' => 'numeric|nullable', 'chassisType' => 'max:45',
'crewNumber' => 'numeric|nullable', 'bodyProducer' => 'max:45',
'mass' => 'numeric|nullable', 'crewNumber' => 'numeric|nullable|digits_between:1,2',
'chassisPoductionYear' => 'numeric|nullable', 'foamAgent' => 'numeric|nullable|digits_between:1,10',
'enginePower' => 'numeric|nullable|digits_between:1,10',
'mass' => 'numeric|nullable|digits_between:1,10',
'chassisNumber' => 'max:45',
'engineNumber' => 'max:45',
'fuelType' => 'max:45',
'chassisPoductionYear' => 'digits:4|nullable',
'fireEnginePumpDescription' => 'max:250',
], ],
[ [
'name' => 'nazwa',
'required' => ':attribute jest wymagany(e).', 'required' => ':attribute jest wymagany(e).',
'numeric' => ':attribute zawiera tylko cyfry.', 'numeric' => ':attribute może zawierać tylko cyfry.',
'digits' => ':attribute musi składać się z :digits cyfr.', 'digits' => ':attribute musi składać się z :digits cyfr.',
'max' => ':attribute musi mieć nie więcej niż :max znaków.',
'digits_between' => ':attribute jest za duży(a)'
]); ]);
$request = request(); $request = request();
$vehicle = vehicle::find( $request->vehicleID); $vehicle = vehicle::find( $request->vehicleID);
$vehicle-> name = $request-> name; $vehicle-> name = $request-> vehicleName;
$vehicle-> codename = $request-> codename; $vehicle-> codename = $request-> codename;
$vehicle-> brand = $request-> brand; $vehicle-> brand = $request-> brand;
$vehicle-> registrationNumber = $request-> registrationNumber; $vehicle-> registrationNumber = $request-> registrationNumber;
@ -147,7 +175,9 @@ class VehiclesController extends Controller
public function destroy($id) public function destroy($id)
{ {
vehicle::where('id',$id)->delete(); vehicle::where('id',$id)->delete();
return redirect()->to('/pojazdy'); return response()->json([
'success' => 'Record deleted successfully!'
]);
} }
public function activate() public function activate()

View File

@ -15,55 +15,55 @@ class fireFightersController extends Controller
{ {
public function create(){ public function create(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->accessLevel() >= 20) //prezes,naczelnik,sekretarz
{
// $users = user::where("fireStationID", auth()->user()->fireStationID)->get(); // $users = user::where("fireStationID", auth()->user()->fireStationID)->get();
// $users = DB::table('users')->where("fireStationID", '=', auth()->user()->fireStationID)->get(); // $users = DB::table('users')->where("fireStationID", '=', auth()->user()->fireStationID)->get();
$users = DB::table('users')->where("fireStationID", '=', auth()->user()->fireStationID) $users = DB::table('users')->where("fireStationID", '=', auth()->user()->fireStationID)
->leftJoin('ranks', 'users.degreeID', '=', 'ranks.id') ->leftJoin('ranks', 'users.degreeID', '=', 'ranks.id')
->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id') ->leftJoin('unitFunctions', 'users.functionID', '=', 'unitFunctions.id')
->select('users.id','users.name', 'users.surname', 'users.PESEL', 'users.email', 'users.statusID', 'ranks.rank', 'unitFunctions.unitFunction') ->select('users.id','users.name', 'users.surname', 'users.PESEL', 'users.email', 'users.statusID', 'ranks.rank', 'unitFunctions.unitFunction')
->paginate(10); ->paginate(10);
return view("fireFighters", ["users" => $users]); return view("fireFighters", ["users" => $users]);
} else{ } else {
return view('fireFighters'); return redirect()->to('/userprofile');
} }
} }
public function addForm(){ public function addForm(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
$fireStation = fireStation::find(auth()->user()->fireStationID); $fireStation = fireStation::find(auth()->user()->fireStationID);
if($fireStation-> creatorID == auth()->user()->id){ if($fireStation-> creatorID == auth()->user()->id){ //if do usunięcia w pzyszłości
//return view('fireFightersAdd');
$ranks = DB::table('ranks')->pluck("rank","id"); $ranks = DB::table('ranks')->pluck("rank","id");
$unitFunctions = DB::table('unitFunctions')->pluck("unitFunction","id"); $unitFunctions = DB::table('unitFunctions')->pluck("unitFunction","id");
return view('fireFightersAdd',compact('ranks'), compact('unitFunctions')); return view('fireFightersAdd',compact('ranks'), compact('unitFunctions'));
} else return fireFightersController::create(); } else return fireFightersController::create(); // ???
} else return view("unit"); } else return redirect()->to('/strazacy');
} }
public function editForm($id){ public function editForm($id){
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
$userFireStation = auth()->user()->fireStationID; $userFireStation = auth()->user()->fireStationID;
$fireFighterFireStation = DB::table('users')->where("id", $id)->value('fireStationID'); $fireFighterFireStation = DB::table('users')->where("id", $id)->value('fireStationID');
$fireStationCreatorId = DB::table('fireStations')->where("id", $userFireStation)->value('creatorID'); $fireStationCreatorId = DB::table('fireStations')->where("id", $userFireStation)->value('creatorID');
$fireFighter = DB::table('users')->where("id", $id)->first(); $fireFighter = DB::table('users')->where("id", $id)->first();
if($userFireStation == $fireFighterFireStation && auth()->user()->id == $fireStationCreatorId) { if($userFireStation == $fireFighterFireStation && auth()->user()->id == $fireStationCreatorId) { // if do usunięcia w pzyszłości
return view('fireFightersEdit', ["fireFighter" => $fireFighter]); return view('fireFightersEdit', ["fireFighter" => $fireFighter]);
} else{ } else{
return "Brak dostepu"; return "Brak dostepu";
} }
}else{ }else{
return view('unit'); return redirect()->to('/strazacy');
} }
} }
public function store(){ public function store(){
$this->validate(request(), [ $this->validate(request(), [
'name' => 'required|alpha|min:3|max:45', 'name' =>'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/',
'surname' => 'required|alpha|min:3|max:45', 'surname' =>'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/',
'PESEL' => new Pesel, 'PESEL' => new Pesel,
'phoneNumber' => 'required|digits:9', 'phoneNumber' => 'required|digits:9',
'email' => 'required|email|unique:users', 'email' => 'required|email|unique:users',
@ -74,8 +74,7 @@ class fireFightersController extends Controller
'required' => ':attribute jest wymagany(e).', 'required' => ':attribute jest wymagany(e).',
'min' => ':attribute musi mieć przynajmniej :min znaki.', 'min' => ':attribute musi mieć przynajmniej :min znaki.',
'max' => ':attribute musi mieć nie więcej niż :max znaków.', 'max' => ':attribute musi mieć nie więcej niż :max znaków.',
'alpha' => ':attribute może zawierać tylko litery.', 'regex' => ':attribute może zawierać tylko litery, spacje, myślniki i apostrofy',
'alpha_num' => ':attribute może zawierać tylko litery i cyfry.',
'digits' => ':attribute musi składać się z :digits cyfr.', 'digits' => ':attribute musi składać się z :digits cyfr.',
'unique' =>':attribute jest już zajęty.', 'unique' =>':attribute jest już zajęty.',
'confirmed' =>':attribute się nie zgadza.', 'confirmed' =>':attribute się nie zgadza.',
@ -112,8 +111,8 @@ class fireFightersController extends Controller
public function update(){ public function update(){
$this->validate(request(), [ $this->validate(request(), [
'name' => 'required|alpha|min:3|max:45', 'name' =>'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/',
'surname' => 'required|alpha|min:3|max:45', 'surname' =>'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/',
'PESEL' => new Pesel, 'PESEL' => new Pesel,
'phoneNumber' => 'required|digits:9', 'phoneNumber' => 'required|digits:9',
], ],
@ -121,8 +120,7 @@ class fireFightersController extends Controller
'required' => ':attribute jest wymagany(e).', 'required' => ':attribute jest wymagany(e).',
'min' => ':attribute musi mieć przynajmniej :min znaki.', 'min' => ':attribute musi mieć przynajmniej :min znaki.',
'max' => ':attribute musi mieć nie więcej niż :max znaków.', 'max' => ':attribute musi mieć nie więcej niż :max znaków.',
'alpha' => ':attribute może zawierać tylko litery.', 'regex' => ':attribute może zawierać tylko litery, spacje, myślniki i apostrofy',
'alpha_num' => ':attribute może zawierać tylko litery i cyfry.',
'digits' => ':attribute musi składać się z :digits cyfr.', 'digits' => ':attribute musi składać się z :digits cyfr.',
'unique' =>':attribute jest już zajęty.', 'unique' =>':attribute jest już zajęty.',
'confirmed' =>':attribute się nie zgadza.', 'confirmed' =>':attribute się nie zgadza.',
@ -140,6 +138,7 @@ class fireFightersController extends Controller
return fireFightersController::create(); return fireFightersController::create();
} }
public function createSingleFireFighterPDF(){ public function createSingleFireFighterPDF(){
if (auth()->user() != null && auth()->user()->fireStationID != null) { if (auth()->user() != null && auth()->user()->fireStationID != null) {
$request = request(); $request = request();
@ -156,5 +155,23 @@ class fireFightersController extends Controller
} }
} }
public function activate()
{
$request = request();
$user = User::find( $request-> userID);
$user-> statusID = 0;
$user->save();
return redirect()->to('/strazacy');
}
public function deactivate()
{
$request = request();
$user = User::find( $request-> userID);
$user-> statusID = 1;
$user->save();
return redirect()->to('/strazacy');
}
} }

View File

@ -26,7 +26,7 @@ class fireStationController extends Controller
public function editForm() public function editForm()
{ {
if(auth()->user() != null && auth()->user()->fireStationID != null ) if(auth()->user() != null && auth()->user()->accessLevel() == 50) //prezes/naczelnik
{ {
$id = auth()->user()->fireStationID; $id = auth()->user()->fireStationID;
$fireStation = DB::table('fireStations')->where("id", $id)->first(); $fireStation = DB::table('fireStations')->where("id", $id)->first();
@ -34,7 +34,7 @@ class fireStationController extends Controller
return view('fireStationEdit', ["fireStation" => $fireStation], compact('voivodeships')); return view('fireStationEdit', ["fireStation" => $fireStation], compact('voivodeships'));
} }
else else
return "Brak dostępu"; return redirect()->to('/jednostka');
} }
public function store() public function store()

View File

@ -60,7 +60,7 @@ class operationsController extends Controller
} }
public function addForm(){ public function addForm(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
$fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get(); $fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get();
$vehicles = DB::table('vehicles')->where([ $vehicles = DB::table('vehicles')->where([
["fireStationID", '=', auth()->user()->fireStationID], ["fireStationID", '=', auth()->user()->fireStationID],
@ -69,13 +69,13 @@ class operationsController extends Controller
]) ])
->get(); ->get();
return view("operationAdd", ["fireFighters" => $fireFighters], ["vehicles" => $vehicles]); return view("operationAdd", ["fireFighters" => $fireFighters], ["vehicles" => $vehicles]);
} else return view("unit"); } else return redirect()->to('/wyjazdy');
} }
public function editForm($id){ public function editForm($id){
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
// $fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get(); // $fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )->get();
$vehicles = DB::table('vehicles')->where([ $vehicles = DB::table('vehicles')->where([
@ -120,17 +120,17 @@ class operationsController extends Controller
// return "Brak dostepu"; // return "Brak dostepu";
// } // }
} else{ } else{
return view('unit'); return redirect()->to('/wyjazdy');
} }
} }
public function store(){ public function store(){
$this->validate(request(),[ $this->validate(request(),[
'operationDate' => 'required', 'operationDate' => 'required',
'operationLocation' => 'required', 'operationLocation' => 'required|max:100',
'operationTarget' => 'required', 'operationTarget' => 'required|max:100',
'operationDangerType' => 'required', 'operationDangerType' => 'required|max:100',
'operationDescription' => 'required', 'operationDescription' => 'required|max:250',
'operationLeader' => 'required', 'operationLeader' => 'required',
'operationDriver.*' => 'required', 'operationDriver.*' => 'required',
'operationVehicle.*' => 'required', 'operationVehicle.*' => 'required',
@ -138,7 +138,8 @@ class operationsController extends Controller
'transport.*' => 'required', 'transport.*' => 'required',
], ],
[ [
'required' => ':attribute jest wymagany(e)' 'required' => ':attribute jest wymagany(e)',
'max' => ':attribute musi mieć nie więcej niż :max znaków.'
]); ]);
// //
@ -197,10 +198,10 @@ class operationsController extends Controller
public function update(){ public function update(){
$this->validate(request(),[ $this->validate(request(),[
'operationDate' => 'required', 'operationDate' => 'required',
'operationLocation' => 'required', 'operationLocation' => 'required|max:100',
'operationTarget' => 'required', 'operationTarget' => 'required|max:100',
'operationDangerType' => 'required', 'operationDangerType' => 'required|max:100',
'operationDescription' => 'required', 'operationDescription' => 'required|max:250',
'operationLeader' => 'required', 'operationLeader' => 'required',
'operationDriver.*' => 'required', 'operationDriver.*' => 'required',
'operationVehicle.*' => 'required', 'operationVehicle.*' => 'required',
@ -209,7 +210,7 @@ class operationsController extends Controller
], ],
[ [
'required' => ':attribute jest wymagany(e)', 'required' => ':attribute jest wymagany(e)',
'operationTarget.required' => 'Cel jest wyma gany' 'max' => ':attribute musi mieć nie więcej niż :max znaków.'
]); ]);

View File

@ -34,9 +34,7 @@ class resetPasswordController extends Controller
if($user){ if($user){
$password = str_random(10); $password = str_random(10);
User::where('email', '=', $request->email) User::where('email', '=', $request->email)
->update(['password' => Hash::make($password)]); // this will also update the record ->update(['password' => Hash::make($password)]);
//$user->password = $password;
//$user->save();
Mail::send('emails.passwordReset', compact('password'), function($message) { Mail::send('emails.passwordReset', compact('password'), function($message) {
$message->to(Input::get('email'))->subject('Zmiana hasła'); $message->to(Input::get('email'))->subject('Zmiana hasła');
}); });

View File

@ -14,7 +14,7 @@ class trainingsController extends Controller
{ {
public function create(){ public function create(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){ 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)
->whereNull('deleted_at') ->whereNull('deleted_at')
->paginate(10); ->paginate(10);
@ -32,16 +32,17 @@ class trainingsController extends Controller
} }
return View::make("trainings")->with(compact( "trainings", "fireFighters")); return View::make("trainings")->with(compact( "trainings", "fireFighters"));
} else{ } else{
return view('trainings'); return redirect()->to('/strazacy');
} }
} }
public function store(){ public function store(){
$this->validate(request(), [ $this->validate(request(), [
'name' => 'required', 'name' => 'required|max:45',
], ],
[ [
'required' => ':attribute jest wymagany(a).', 'required' => 'Nazwa jest wymagana.',
'max' => 'Nazwa musi mieć nie więcej niż :max znaków.',
]); ]);
@ -60,7 +61,7 @@ class trainingsController extends Controller
public function addTrainingsFireFighters($id){ public function addTrainingsFireFighters($id){
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->accessLevel() == 50 ){ //prezes,naczelnik
$fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID ) $fireFighters = DB::table('users')->where("fireStationID", "=", auth()->user()->fireStationID )
->leftJoin('trainingsFirefighters', function ($join) use($id){ ->leftJoin('trainingsFirefighters', function ($join) use($id){
$join->on('users.id', '=', 'trainingsFirefighters.firefighterID'); $join->on('users.id', '=', 'trainingsFirefighters.firefighterID');
@ -73,7 +74,7 @@ class trainingsController extends Controller
->whereNull('deleted_at')->first(); ->whereNull('deleted_at')->first();
return View::make("trainingsAddFireFighters")->with(compact( "training", "fireFighters")); return View::make("trainingsAddFireFighters")->with(compact( "training", "fireFighters"));
} else{ } else{
return view('trainings'); return redirect()->to('/strazacy');
} }
} }

View File

@ -39,8 +39,8 @@ class userProfileController extends Controller
public function update(){ public function update(){
$this->validate(request(), [ $this->validate(request(), [
'name' => 'required|alpha|min:3|max:45', 'name' =>'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/',
'surname' => 'required|alpha|min:3|max:45', 'surname' =>'required|min:2|max:45|regex:/^[\p{L}\040\x27-]+$/',
'PESEL' => new Pesel, 'PESEL' => new Pesel,
'phoneNumber' => 'required|digits:9', 'phoneNumber' => 'required|digits:9',
'email' => 'required|email|unique:users,email,'.auth()->user()->id, //wymagaj unikalnego adresu email ale pozwól na zachowanie starego adresu 'email' => 'required|email|unique:users,email,'.auth()->user()->id, //wymagaj unikalnego adresu email ale pozwól na zachowanie starego adresu
@ -49,8 +49,7 @@ class userProfileController extends Controller
'required' => ':attribute jest wymagany(e).', 'required' => ':attribute jest wymagany(e).',
'min' => ':attribute musi mieć przynajmniej :min znaki.', 'min' => ':attribute musi mieć przynajmniej :min znaki.',
'max' => ':attribute musi mieć nie więcej niż :max znaków.', 'max' => ':attribute musi mieć nie więcej niż :max znaków.',
'alpha' => ':attribute może zawierać tylko litery.', 'regex' => ':attribute może zawierać tylko litery, spacje, myślniki i apostrofy',
'alpha_num' => ':attribute może zawierać tylko litery i cyfry.',
'digits' => ':attribute musi składać się z :digits cyfr.', 'digits' => ':attribute musi składać się z :digits cyfr.',
'unique' =>':attribute jest już zajęty.', 'unique' =>':attribute jest już zajęty.',
'confirmed' =>':attribute się nie zgadza.', 'confirmed' =>':attribute się nie zgadza.',

View File

@ -43,4 +43,20 @@ class User extends Authenticatable
{ {
$this->attributes['password'] = bcrypt($password); $this->attributes['password'] = bcrypt($password);
} }
public function accessLevel()
{
if (auth()->user() != null && auth()->user()->fireStationID != null)
if ($this->functionID == 1 or $this->functionID == 5) //prezes lub naczelnik
return 50;
elseif ($this->functionID == 3) //skarbnik
return 30;
elseif($this->functionID == 4) //sekretarz
return 20;
else
return 0; //brak specjalnych uprawnień
else
return -1; //jednostka nie istnieje
}
} }

View File

@ -1,33 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddSoftDeleteToVehiclesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('vehicles', function (Blueprint $table) {
//
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('vehicles', function (Blueprint $table) {
//
});
}
}

View File

@ -2913,5 +2913,19 @@ class DatabaseSeeder extends Seeder
DB::table('gminy')->insert([ 'id' => '1326101', 'wojewodztwo_id' => '1320000', 'powiat_id' => '1326100', 'name' => 'm. Koszalin' ]); DB::table('gminy')->insert([ 'id' => '1326101', 'wojewodztwo_id' => '1320000', 'powiat_id' => '1326100', 'name' => 'm. Koszalin' ]);
DB::table('gminy')->insert([ 'id' => '1326201', 'wojewodztwo_id' => '1320000', 'powiat_id' => '1326200', 'name' => 'm. Szczecin' ]); DB::table('gminy')->insert([ 'id' => '1326201', 'wojewodztwo_id' => '1320000', 'powiat_id' => '1326200', 'name' => 'm. Szczecin' ]);
DB::table('gminy')->insert([ 'id' => '1326301', 'wojewodztwo_id' => '1320000', 'powiat_id' => '1326300', 'name' => 'm. Świnoujście' ]); DB::table('gminy')->insert([ 'id' => '1326301', 'wojewodztwo_id' => '1320000', 'powiat_id' => '1326300', 'name' => 'm. Świnoujście' ]);
//jednostki
DB::table('fireStations')->insert(['id'=>'1100','name'=>'Kębłowo','number'=>'1100','voivodeship'=>'wielkopolskie','county'=>'wolsztyński','community'=>'gm. Wolsztyn','postOffice'=>'Kębłowo','zipCode'=>'64223','address'=>'ul. Nowa 8a','latitude'=>'52.0485042','longitude'=>'16.1052983','KRS'=>'0000232331','NIP'=>'9231571641','phoneNumber'=>'501234567','email'=>'straz@keblowo.pl','deleted'=>'0','creatorID'=>'1101','changingID'=>'1101','remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]);
DB::table('fireStations')->insert(['id'=>'1200','name'=>'Obra','number'=>'1200','voivodeship'=>'wielkopolskie','county'=>'wolsztyński','community'=>'gm. Wolsztyn','postOffice'=>'Obra','zipCode'=>'64211','address'=>'ul. Cmentarna 5a','latitude'=>'52.0768963','longitude'=>'16.0427013','KRS'=>'0000096776','NIP'=>'9231571629','phoneNumber'=>'501234567','email'=>'osp.obra@wp.pl','deleted'=>'0','creatorID'=>'1201','changingID'=>'1201','remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]);
//użytkownicy
DB::table('users')->insert(['id'=>'1101','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Szymon','surname'=>'Tomys','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'szymon.tomys@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'1','degreeID'=>'1','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]);
DB::table('users')->insert(['id'=>'1102','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Hanna Nowacka','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'hanna.nowacka@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'2','degreeID'=>'2','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]);
DB::table('users')->insert(['id'=>'1103','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Dominik Klupsz','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'dominik.klupsz@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'3','degreeID'=>'3','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]);
DB::table('users')->insert(['id'=>'1104','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Kamila Prządka','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'kamila.przadka@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'4','degreeID'=>'4','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]);
DB::table('users')->insert(['id'=>'1105','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Rafał Smerdka','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'rafal.smerdka@eosp.projektstudencki.pl','fireStationID'=>'1100','functionID'=>'5','degreeID'=>'5','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]);
DB::table('users')->insert(['id'=>'1201','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Damian Kotlarski','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'damian.kotlarski@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'1','degreeID'=>'1','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]);
DB::table('users')->insert(['id'=>'1202','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Artur Orwat','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'artur.orwat@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'2','degreeID'=>'2','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]);
DB::table('users')->insert(['id'=>'1203','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Michał Rogozinski','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'michal.rogozinski@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'3','degreeID'=>'3','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]);
DB::table('users')->insert(['id'=>'1204','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Lidia Kaczmarek','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'lidia.kaczmarek@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'4','degreeID'=>'4','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]);
DB::table('users')->insert(['id'=>'1205','password'=>'$2y$10$hSeo4pAvQLmV8KzQWoOEXuMEiN7dqOb4jEU80g.xsUS6W5.sh5I4m','name'=>'Michał Nowak','surname'=>'','PESEL'=>'74073147926','phoneNumber'=>'501234567','email'=>'michal.nowak@eosp.projektstudencki.pl','fireStationID'=>'1200','functionID'=>'5','degreeID'=>'5','number'=>'ABC123','statusID'=>'0','deleted'=>'0','creatorID'=>NULL,'changingID'=>NULL,'confirmed'=>'0','confirmation_code'=>NULL,'email_verified_at'=>NULL,'remember_token'=>NULL,'created_at'=>now(),'updated_at'=>now()]);
} }
} }

View File

@ -163,9 +163,32 @@ return [
'latitude' => 'szerokość geograficzna', 'latitude' => 'szerokość geograficzna',
'amount' => 'ilość', 'amount' => 'ilość',
'decoration' => 'odznaczenie', 'decoration' => 'odznaczenie',
'dateOfAward' => 'data przyznania' 'dateOfAward' => 'data przyznania',
'brand' => 'marka',
'vehicleName' => 'nazwa pojazdu',
'registrationNumber' => 'numer rejestracyjny',
'productionYear' => 'rok produkcji',
'driveType' => 'układ napędowy',
'chassisType' => 'typ podwozia',
'bodyProducer' => 'producent nadwozia',
'crewNumber' => 'ilość osób w załodze',
'mass' => 'masa',
'chassisNumber' => 'numer podwozia',
'engineNumber' => 'numer silnika',
'fuelType' => 'rodzaj paliwa',
'chassisPoductionYear' => 'rok produkcji podwozia',
'fireEnginePumpDescription' => 'opis autopompy',
'operationDate' =>'data wyjazdu',
'operationLocation' =>'miejsce akcji',
'operationTarget' =>'cel wyjazdu',
'operationDangerType' =>'rodzaj zagrożenia',
'operationDescription' =>'opis akcji',
'operationLeader' =>'dowodzący',
'operationDriver.*' =>'kierowca',
'operationVehicle.*' =>'pojazd',
'parameter' =>'parametr charakterystyczny',
], ],
]; ];

View File

@ -1,5 +1,7 @@
@extends('layout.app') @extends('layout.app')
<meta name="csrf-token" content="{{ csrf_token() }}">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
@section('left-menu') @section('left-menu')
@parent @parent
<ul> <ul>
@ -7,6 +9,7 @@
</ul> </ul>
@stop @stop
@section('center-area') @section('center-area')
<meta name="csrf-token" content="{{ csrf_token() }}">
@parent @parent
@if( auth()->check()) @if( auth()->check())
@ -28,15 +31,11 @@
<th>Operacja</th> <th>Operacja</th>
@foreach($awardedDecorations as $awardedDecoration) @foreach($awardedDecorations as $awardedDecoration)
<tr> <tr>
<form action="{{ route('decorations.destroy', $awardedDecoration->decorationsFirefightersID)}}" method="post">
<td id="decorationName{{ $awardedDecoration->decorationsFirefightersID }}">{{ $awardedDecoration->decorationName }}</td> <td id="decorationName{{ $awardedDecoration->decorationsFirefightersID }}">{{ $awardedDecoration->decorationName }}</td>
<td id="dateOfAward{{ $awardedDecoration->decorationsFirefightersID }}">{{ $awardedDecoration->dateOfAward }}</td> <td id="dateOfAward{{ $awardedDecoration->decorationsFirefightersID }}">{{ $awardedDecoration->dateOfAward }}</td>
<td> <td>
{{ csrf_field() }} <button class="btn btn-danger" type="submit" id="{{$awardedDecoration->decorationsFirefightersID}}" onclick="deleteButton('{{$awardedDecoration->decorationsFirefightersID}}')">Usuń</button>
@method('DELETE')
<button class="btn btn-danger" type="submit">Usuń</button>
</td> </td>
</form>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
@ -54,7 +53,11 @@
<select name="decoration" class="form-control" style="width:300px"> <select name="decoration" class="form-control" style="width:300px">
<option value="">--- Wybierz odznaczenie ---</option> <option value="">--- Wybierz odznaczenie ---</option>
@foreach ($decoration as $key => $value) @foreach ($decoration as $key => $value)
<option value="{{ $key }}">{{ $value }}</option> @if(Illuminate\Support\Facades\Input::old('decoration') == $key)
<option value="{{ $key }}" selected >{{ $value }}</option>
@else
<option value="{{ $key }}">{{ $value }}</option>
@endif
@endforeach @endforeach
</select> </select>
</div> </div>
@ -73,3 +76,38 @@
@endif @endif
@stop @stop
<script>
function deleteButton(decorationID){
swal.fire({
title: "Czy chcesz usunąć odznaczenie?",
width: 'auto',
confirmButtonText: 'Tak',
cancelButtonText: 'Nie',
showCancelButton: true,
}).then((result) => {
if(result.value){
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
url: "delete/"+decorationID,
type: 'DELETE',
data: {
"id": decorationID,
},
success: function (){
console.log("it Works");
location.reload();
}
});
}
})
}
</script>

View File

@ -4,16 +4,12 @@
@parent @parent
<ul> <ul>
<a href="/sprzet"><li>Sprzęt<img src="img/left_menu_icon/more.png"></li></a> <a href="/sprzet"><li>Sprzęt<img src="img/left_menu_icon/more.png"></li></a>
<a href="/szkolenia"><li>Badania/Szkolenia<img src="img/left_menu_icon/more.png"></li></a>
{{-- <li>Edytuj<img src="img/left_menu_icon/edit.png"></li> --}}
{{-- <li>Usuń<img src="img/left_menu_icon/delete.png"></li> --}}
</ul> </ul>
@stop @stop
@section('center-area') @section('center-area')
@parent @parent
Strona w budowie Strona w budowie
<p>Zawarte będą tutaj informacje o umundurowaniu oraz sprzęcie jaki jest na wyposażeniu strażnicy oraz informacje gdzie umundurowanie się znajduje(druhowie mundury koszarowe oraz galowe mają w w domach, informacja ta pozwoli na sprawdzenie np jakie braki w umundurowaniu).</p> <p>Zawarte tutaj informacje o sprzęcie jaki jest na wyposażeniu strażnicy. W przyszłej wersji eOSP do strażnicy dodane zostaną informacje o posiadanym umundurowaniu oraz gdzie umundurowanie się znajduje(druhowie mundury koszarowe oraz galowe miewają w domach, informacja ta pozwoli na sprawdzenie np jakie braki w umundurowaniu).</p>
@stop @stop

View File

@ -1,13 +1,18 @@
@extends('layout.app') @extends('layout.app')
<meta name="csrf-token" content="{{ csrf_token() }}"> <meta name="csrf-token" content="{{ csrf_token() }}">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
@section('left-menu') @section('left-menu')
@parent @parent
@if( auth()->check() )
@if( auth()->user()->fireStationID != NULL)
@if(auth()->user()->accessLevel() == 50)
<ul> <ul>
<a href="sprzet/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a> <a href="sprzet/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a>
<li>Edytuj<img src="/img/left_menu_icon/edit.png"></li>
<li>Usuń<img src="/img/left_menu_icon/delete.png"></li>
</ul> </ul>
@endif
@endif
@endif
@stop @stop
@section('center-area') @section('center-area')
@ -26,7 +31,9 @@
<th>Nazwa</th> <th>Nazwa</th>
<th>Ilość</th> <th>Ilość</th>
<th>Param. charakterystyczny</th> <th>Param. charakterystyczny</th>
@if(auth()->user()->accessLevel() == 50)
<th>Operacja</th> <th>Operacja</th>
@endif
</tr> </tr>
</thead> </thead>
@ -39,10 +46,12 @@
<td id="name{{ $item->id }}">{{ $item->name }}</td> <td id="name{{ $item->id }}">{{ $item->name }}</td>
<td id="amount{{ $item->id }}">{{ $item->amount }}</td> <td id="amount{{ $item->id }}">{{ $item->amount }}</td>
<td id="parameter{{ $item->id }}">{{ $item->parameter }}</td> <td id="parameter{{ $item->id }}">{{ $item->parameter }}</td>
@if(auth()->user()->accessLevel() == 50)
<td> <td>
<a href="{{ URL::asset('sprzet/edit/'.$item->id) }}" class="btn btn-secondary" role="button">Edytuj</a> <a href="{{ URL::asset('sprzet/edit/'.$item->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
<button class="btn btn-danger" type="submit" id="{{$item->id}}" onclick="deleteButton('{{$item->id}}')">Usuń</button> <button class="btn btn-danger" type="submit" id="{{$item->id}}" onclick="deleteButton('{{$item->id}}')">Usuń</button>
</td> </td>
@endif
</tr> </tr>
@php @php

View File

@ -3,9 +3,7 @@
@section('left-menu') @section('left-menu')
@parent @parent
<ul> <ul>
<a href="/sprzet/add"><li>Dodaj<img src="/./img/left_menu_icon/add.png"></li></a> <a href="/sprzet"><li>Przeglądaj<img src="/img/left_menu_icon/more.png"></li></a>
<li>Edytuj<img src="/img/left_menu_icon/edit.png"></li>
<li>Usuń<img src="/img/left_menu_icon/delete.png"></li>
</ul> </ul>
@stop @stop
@ -29,7 +27,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Zatwierdź</button> <button style="cursor:pointer" type="submit" class="btn btn-primary">Utwórz</button>
</div> </div>
@include('inc.formerrors') @include('inc.formerrors')
</form> </form>

View File

@ -4,8 +4,7 @@
@parent @parent
<ul> <ul>
<a href="/sprzet/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a> <a href="/sprzet/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a>
<li>Edytuj<img src="/img/left_menu_icon/edit.png"></li> <a href="/sprzet"><li>Przeglądaj<img src="/img/left_menu_icon/more.png"></li></a>
<li>Usuń<img src="/img/left_menu_icon/delete.png"></li>
</ul> </ul>
@stop @stop
@ -31,7 +30,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Zatwierdź</button> <button style="cursor:pointer" type="submit" class="btn btn-primary">Zapisz</button>
</div> </div>
@include('inc.formerrors') @include('inc.formerrors')
</form> </form>

View File

@ -2,12 +2,16 @@
@section('left-menu') @section('left-menu')
@parent @parent
@if( auth()->check() )
@if( auth()->user()->fireStationID != NULL)
@if(auth()->user()->accessLevel() == 50)
<ul> <ul>
<a href="/strazacy/add"><li>Dodaj<img src="img/left_menu_icon/add.png"></li></a> <a href="/strazacy/add"><li>Dodaj<img src="img/left_menu_icon/add.png"></li></a>
<li>Wyklucz<img src="img/left_menu_icon/delete.png"></li> <a href="/szkolenia"><li><font size="-2">Badania/Szkolenia</font><img src="/img/left_menu_icon/more.png"></li></a>
<li>Zawieś<img src="img/left_menu_icon/suspended.png"></li>
<li>Więcej<img src="img/left_menu_icon/more.png"></li>
</ul> </ul>
@endif
@endif
@endif
@stop @stop
<head> <head>
@ -70,14 +74,16 @@
<thead> <thead>
<tr> <tr>
<th>#</th> <th>#</th>
<th>Imie</th> <th>Imię</th>
<th>Nazwisko</th> <th>Nazwisko</th>
<th>PESEL</th> <th>PESEL</th>
<th>E-mail</th> <th>E-mail</th>
<th>Funkcja</th> <th>Funkcja</th>
<th>Stopień</th> <th>Stopień</th>
<th>Status</th> <th>Status</th>
<th>Operacje</th> @if(auth()->user()->accessLevel() == 50)
<th>Operacja</th>
@endif
</tr> </tr>
</thead> </thead>
@ -95,25 +101,36 @@
<td id="userFunction{{ $user->id }}"> {{$user->unitFunction}} </td> <td id="userFunction{{ $user->id }}"> {{$user->unitFunction}} </td>
<td id="userDegree{{ $user->id }}"> {{$user->rank}}</td> <td id="userDegree{{ $user->id }}"> {{$user->rank}}</td>
<td id="userStatus{{ $user->id }}">@if( $user->statusID == 0) Czynny @else Wyłączony @endif</td> <td id="userStatus{{ $user->id }}">@if( $user->statusID == 0) Czynny @else Wyłączony @endif</td>
@if(auth()->user()->accessLevel() == 50)
<td> <td>
<a href="{{ URL::asset('strazacy/edit/'.$user->id) }}" class="btn btn-secondary" role="button">Edytuj</a> <a href="{{ URL::asset('strazacy/edit/'.$user->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
<a href="{{ URL::asset('strazacy/odznaczenia/'.$user->id) }}" class="btn btn-success" role="button">Odznaczenia</a> <a href="{{ URL::asset('strazacy/odznaczenia/'.$user->id) }}" class="btn btn-success" role="button">Odznaczenia</a>
<form action="strazacy/pdf/single/" method="post" style="display:inline;"> <form action="strazacy/pdf/single/" method="post" style="display:inline;">
{{ csrf_field() }} {{ csrf_field() }}
<input type="hidden" class="form-control" name="userID" value="{{$user->id}}"> <input type="hidden" class="form-control" name="userID" value="{{$user->id}}">
<button class="btn btn-dark" type="submit">Drukuj</button> <button class="btn btn-dark" type="submit">Drukuj</button>
</form> </form>
@if( auth()->user()->id != $user->id)
@if ($user->statusID == 0)
<form method="POST" action="/strazacy/deactivate" style="display:inline;">
{{ csrf_field() }}
<input type="hidden" class="form-control" name="userID" value="{{ $user->id }}">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Zawieś</button>
</form>
@elseif ($user->statusID == 1)
<form method="POST" action="/strazacy/activate" style="display:inline;" >
{{ csrf_field() }}
<input type="hidden" class="form-control" name="userID" value="{{ $user->id }}">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Przywróć do służby</button>
</form>
@endif
@endif
</td> </td>
@endif
</tr> </tr>
{{-- <tr>--}}
{{-- <form id="editForm{{$user->id}}" method="POST" action="/strazacy">--}}
{{-- {{ csrf_field() }}--}}
{{-- <div class="form-group">--}}
{{-- <label for="name">Imię:</label>--}}
{{-- <input type="text" class="form-control" id="name" name="name" value="{{ old('name') }} ">--}}
{{-- </div>--}}
{{-- </form>--}}
{{-- </tr>--}}
@php @php
$i++; $i++;
@endphp @endphp

View File

@ -3,11 +3,8 @@
@section('left-menu') @section('left-menu')
@parent @parent
<ul> <ul>
<a href="/strazacy/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a> <a href="/strazacy"><li>Przeglądaj<img src="/img/left_menu_icon/more.png"></li></a>
<li>Edytuj<img src="/img/left_menu_icon/edit.png"></li> <a href="/szkolenia"><li><font size="-2">Badania/Szkolenia</font><img src="/img/left_menu_icon/more.png"></li></a>
<li>Wyklucz<img src="/img/left_menu_icon/delete.png"></li>
<li>Zawieś<img src="/img/left_menu_icon/suspended.png"></li>
<li>Więcej<img src="/img/left_menu_icon/more.png"></li>
</ul> </ul>
@stop @stop
@ -62,7 +59,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Submit</button> <button style="cursor:pointer" type="submit" class="btn btn-primary">Utwórz</button>
</div> </div>
@include('inc.formerrors') @include('inc.formerrors')
</form> </form>

View File

@ -3,11 +3,8 @@
@section('left-menu') @section('left-menu')
@parent @parent
<ul> <ul>
<a href="/strazacy/add"><li>Dodaj<img src="img/left_menu_icon/add.png"></li></a> <a href="/strazacy"><li>Przeglądaj<img src="/img/left_menu_icon/more.png"></li></a>
<li>Edytuj<img src="img/left_menu_icon/edit.png"></li> <a href="/szkolenia"><li><font size="-2">Badania/Szkolenia</font><img src="/img/left_menu_icon/more.png"></li></a>
<li>Wyklucz<img src="img/left_menu_icon/delete.png"></li>
<li>Zawieś<img src="img/left_menu_icon/suspended.png"></li>
<li>Więcej<img src="img/left_menu_icon/more.png"></li>
</ul> </ul>
@stop @stop
@ -39,7 +36,7 @@
<div class="form-group"> <div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Edytuj</button> <button style="cursor:pointer" type="submit" class="btn btn-primary">Zapisz</button>
</div> </div>
@include('inc.formerrors') @include('inc.formerrors')
</form> </form>

View File

@ -95,7 +95,7 @@
<div class="form-group"> <div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Submit</button> <button style="cursor:pointer" type="submit" class="btn btn-primary">Zapisz</button>
</div> </div>
@include('inc.formerrors') @include('inc.formerrors')
</form> </form>

View File

@ -94,7 +94,7 @@
<div class="form-group"> <div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Submit</button> <button style="cursor:pointer" type="submit" class="btn btn-primary">Utwórz</button>
</div> </div>
@include('inc.formerrors') @include('inc.formerrors')
</form> </form>

View File

@ -11,6 +11,9 @@
</div> </div>
@endif @endif
@if( auth()->check())
Jesteś już zalogowany.
@else
<h2>Zaloguj się</h2> <h2>Zaloguj się</h2>
<form method="POST" action="/login"> <form method="POST" action="/login">
@ -21,7 +24,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="password">Password:</label> <label for="password">Hasło:</label>
<input type="password" class="form-control" id="password" name="password"> <input type="password" class="form-control" id="password" name="password">
</div> </div>
@ -32,5 +35,5 @@
</form> </form>
<a href="/forgottenPassword">Nie pamiętam hasła<a> <a href="/forgottenPassword">Nie pamiętam hasła<a>
@endif
@endsection @endsection

View File

@ -3,9 +3,16 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
@section('left-menu') @section('left-menu')
@parent<ul> @parent
@if( auth()->check() )
@if( auth()->user()->fireStationID != NULL)
@if(auth()->user()->accessLevel() == 50)
<ul>
<a href="/wyjazdy/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a> <a href="/wyjazdy/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a>
</ul> </ul>
@endif
@endif
@endif
@stop @stop
@section('center-area') @section('center-area')
@ -33,8 +40,12 @@
<th>Cel</th> <th>Cel</th>
<th>Rodzaj zagrożenia</th> <th>Rodzaj zagrożenia</th>
<th>Dowódca</th> <th>Dowódca</th>
@if(auth()->user()->accessLevel() == 50)
<th>Operacja</th> <th>Operacja</th>
<th>Szczegóły</th> <th>Szczegóły</th>
@endif
<th>Szczegóły</th>
</tr> </tr>
</thead> </thead>
@ -50,6 +61,7 @@
<td id="operationTarget{{ $operation->id }}">{{ $operation->target }}</td> <td id="operationTarget{{ $operation->id }}">{{ $operation->target }}</td>
<td id="operationDangerType{{ $operation->id }}">{{ $operation->dangerType }}</td> <td id="operationDangerType{{ $operation->id }}">{{ $operation->dangerType }}</td>
<td id="operationCommander{{ $operation->id }}">{{$operation->name}} {{$operation->surname}}</td> <td id="operationCommander{{ $operation->id }}">{{$operation->name}} {{$operation->surname}}</td>
@if(auth()->user()->accessLevel() == 50)
<td> <td>
<a href="{{ URL::asset('wyjazdy/edit/'.$operation->id) }}" class="btn btn-secondary" role="button">Edytuj</a> <a href="{{ URL::asset('wyjazdy/edit/'.$operation->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
<button class="btn btn-danger" type="submit" id="{{$operation->id}}" onclick="deleteButton('{{$operation->id}}')">Usuń</button> <button class="btn btn-danger" type="submit" id="{{$operation->id}}" onclick="deleteButton('{{$operation->id}}')">Usuń</button>
@ -59,6 +71,7 @@
<button class="btn btn-dark" type="submit">Drukuj</button> <button class="btn btn-dark" type="submit">Drukuj</button>
</form> </form>
</td> </td>
@endif
<td> <td>
<button class="btn btn-info" type="button" id="more{{$operation->id}}" onclick="showMoreInformation('{{$operation->id}}')">Więcej</button> <button class="btn btn-info" type="button" id="more{{$operation->id}}" onclick="showMoreInformation('{{$operation->id}}')">Więcej</button>
</td> </td>

View File

@ -3,7 +3,7 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
@section('left-menu') @section('left-menu')
@parent<ul> @parent<ul>
<a href="/wyjazdy/"><li>Wróć<img src="/img/left_menu_icon/add.png"></li></a> <a href="/wyjazdy"><li>Przeglądaj<img src="/img/left_menu_icon/more.png"></li></a>
</ul> </ul>
@stop @stop
@ -44,7 +44,11 @@
<select name="operationLeader" class="form-control"> <select name="operationLeader" class="form-control">
<option value="">--- Wybierz dowódcę ---</option> <option value="">--- Wybierz dowódcę ---</option>
@foreach ($fireFighters as $fireFighter) @foreach ($fireFighters as $fireFighter)
<option value="{{$fireFighter->id}}">{{ $fireFighter->name }} {{$fireFighter->surname }}</option> @if(Illuminate\Support\Facades\Input::old('operationLeader') == $fireFighter->id)
<option value="{{$fireFighter->id}}" selected>{{ $fireFighter->name }} {{$fireFighter->surname }}</option>
@else
<option value="{{$fireFighter->id}}">{{ $fireFighter->name }} {{$fireFighter->surname }}</option>
@endif
@endforeach @endforeach
</select> </select>
</div> </div>
@ -162,6 +166,4 @@
}); });
</script> </script>

View File

@ -3,7 +3,8 @@
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
@section('left-menu') @section('left-menu')
@parent<ul> @parent<ul>
<a href="/wyjazdy/"><li>Wróc<img src="/img/left_menu_icon/add.png"></li></a> <a href="/wyjazdy/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a>
<a href="/wyjazdy"><li>Przeglądaj<img src="/img/left_menu_icon/more.png"></li></a>
</ul> </ul>
@stop @stop

View File

@ -3,7 +3,7 @@
@section('center-area') @section('center-area')
@parent @parent
<h2>Register</h2> <h2>Rejestracja</h2>
<form method="POST" action="/register"> <form method="POST" action="/register">
{{ csrf_field() }} {{ csrf_field() }}
<div class="form-group"> <div class="form-group">
@ -45,7 +45,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Submit</button> <button style="cursor:pointer" type="submit" class="btn btn-primary">Zarejestruj</button>
</div> </div>
@include('inc.formerrors') @include('inc.formerrors')
</form> </form>

View File

@ -8,9 +8,7 @@
@section('left-menu') @section('left-menu')
@parent @parent
<ul> <ul>
<a href="sprzet/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a> <a href="/strazacy"><li>Strażacy<img src="/img/left_menu_icon/more.png"></li></a>
<li>Edytuj<img src="/img/left_menu_icon/edit.png"></li>
<li>Usuń<img src="/img/left_menu_icon/delete.png"></li>
</ul> </ul>
@stop @stop
@ -25,7 +23,7 @@
<form method="POST" action="/szkolenia"> <form method="POST" action="/szkolenia">
{{ csrf_field() }} {{ csrf_field() }}
<div class="form-group"> <div class="form-group">
<label for="name">Nazwa Szkolenia/Badana:</label> <label for="name">Nazwa nowego szkolenia/badania:</label>
<input type="text" class="form-control" id="name" name="name" value="{{ old('name') }} "> <input type="text" class="form-control" id="name" name="name" value="{{ old('name') }} ">
</div> </div>
@ -122,7 +120,7 @@
title: "Podaj nową nazwę", title: "Podaj nową nazwę",
width: 'auto', width: 'auto',
input: 'text', input: 'text',
confirmButtonText: 'Tak', confirmButtonText: 'Zapisz',
cancelButtonText: 'Anuluj', cancelButtonText: 'Anuluj',
showCancelButton: true, showCancelButton: true,
inputValidator: (value) => { inputValidator: (value) => {
@ -157,7 +155,7 @@
function deleteButton(trainingID){ function deleteButton(trainingID){
swal.fire({ swal.fire({
title: "Czy chcesz usunąć wyjazd?", title: "Czy chcesz usunąć badanie/szkolenie?",
width: 'auto', width: 'auto',
confirmButtonText: 'Tak', confirmButtonText: 'Tak',
cancelButtonText: 'Nie', cancelButtonText: 'Nie',

View File

@ -7,9 +7,8 @@
@section('left-menu') @section('left-menu')
@parent @parent
<ul> <ul>
<a href="sprzet/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a> <a href="/strazacy"><li>Strażacy<img src="/img/left_menu_icon/more.png"></li></a>
<li>Edytuj<img src="/img/left_menu_icon/edit.png"></li> <a href="/szkolenia"><li><font size="-2">Badania/Szkolenia</font><img src="/img/left_menu_icon/more.png"></li></a>
<li>Usuń<img src="/img/left_menu_icon/delete.png"></li>
</ul> </ul>
@stop @stop

View File

@ -2,11 +2,15 @@
@section('left-menu') @section('left-menu')
@parent @parent
@if( auth()->check() )
@if( auth()->user()->fireStationID != NULL)
@if(auth()->user()->accessLevel() == 50)
<ul> <ul>
<a href="/jednostka/edit"><li>Edytuj<img src="img/left_menu_icon/edit.png"></li></a> <a href="/jednostka/edit"><li>Edytuj<img src="img/left_menu_icon/edit.png"></li></a>
</ul> </ul>
@endif
@endif
@endif
@stop @stop
@section('center-area') @section('center-area')
@ -75,21 +79,7 @@
<div> <div>
@endif @endif
@else @else
<div> Witamy na stronie eOSP! <a href="/login">Zaloguj się</a> lub <a href="/register">Zarejestruj nową jednostkę</a>.
<p><b>Nazwa:</b> Ochotnicza Straż Pożarna w Łuszczewie</p>
<p><b>Województwo:</b> Wielkopolskie</p>
<p><b>Powiat:</b> Koniński</p>
<p><b>Gmina i numer ewidencyjny:</b> Skulsk 3010092</p>
<p><b>Kod pocztowy, Miejscowość:</b> 62-560 Skulsk</p>
<p><b>Ulica i numer:</b> Łuszczewo 81</p>
<p><b>Szerokość i długość geograficzna:</b> 523113.08 | 182155.88</p>
<p><b>KRS:</b> 0000003716</p>
<p><b>NIP:</b> 665 524 497 69 </p>
<p><b>Telefon:</b> ??? - ??? - ???</p>
<p><b>E-mail:</b> twojanazwa@domena.com</p>
<hr>
<p><b>Liczba członków:</b> 40</p>
</div>
<div> <div>
@endif @endif
</div> </div>

View File

@ -41,10 +41,10 @@
<th>Adres e-mail:</th> <th>Adres e-mail:</th>
<td>{{ $userData->email}}</td> <td>{{ $userData->email}}</td>
</tr> </tr>
<tr> {{-- <tr> --}}
<th>Numer ewidencyjny:</th> {{-- <th>Numer ewidencyjny:</th> --}}
<td>{{ $userData->number}}</td> {{-- <td>{{ $userData->number}}</td> --}}
</tr> {{-- </tr> --}}
<tr> <tr>
<th>Stopień:</th> <th>Stopień:</th>
<td>{{ $userData->rank}}</td> <td>{{ $userData->rank}}</td>

View File

@ -41,7 +41,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Zatwierdź</button> <button style="cursor:pointer" type="submit" class="btn btn-primary">Zapisz</button>
</div> </div>
@include('inc.formerrors') @include('inc.formerrors')
</form> </form>

View File

@ -1,13 +1,22 @@
@extends('layout.app') @extends('layout.app')
<meta name="csrf-token" content="{{ csrf_token() }}">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
@section('left-menu') @section('left-menu')
@parent @parent
@if( auth()->check() )
@if( auth()->user()->fireStationID != NULL)
@if(auth()->user()->accessLevel() == 50)
<ul> <ul>
<a href="/pojazdy/add"><li>Dodaj<img src="img/left_menu_icon/add.png"></li></a> <a href="/pojazdy/add"><li>Dodaj<img src="img/left_menu_icon/add.png"></li></a>
</ul> </ul>
@endif
@endif
@endif
@stop @stop
@section('center-area') @section('center-area')
<meta name="csrf-token" content="{{ csrf_token() }}">
@parent @parent
@if( auth()->check()) @if( auth()->check())
@if( auth()->user()->fireStationID == NULL) @if( auth()->user()->fireStationID == NULL)
@ -26,7 +35,9 @@
<th>Rodzaj napędu</th> <th>Rodzaj napędu</th>
<th>Przegląd</th> <th>Przegląd</th>
<th>OC</th> <th>OC</th>
@if(auth()->user()->accessLevel() == 50)
<th>Operacja</th> <th>Operacja</th>
@endif
</tr> </tr>
</thead> </thead>
@ -39,7 +50,6 @@
@endphp @endphp
<tr> <tr>
<form action="{{ route('vehicles.destroy', $vehicle->id)}}" method="post">
<td>{{ $lp }}</td> <td>{{ $lp }}</td>
<td id="name{{ $vehicle->id }}">{{ $vehicle->name }}</td> <td id="name{{ $vehicle->id }}">{{ $vehicle->name }}</td>
<td id="brand{{ $vehicle->id }}">{{ $vehicle->brand }}</td> <td id="brand{{ $vehicle->id }}">{{ $vehicle->brand }}</td>
@ -49,12 +59,10 @@
<td id="driveType{{ $vehicle->id }}">{{ $vehicle->driveType }}</td> <td id="driveType{{ $vehicle->id }}">{{ $vehicle->driveType }}</td>
<td id="examExpirationDate{{ $vehicle->id }}">{{ $vehicle->examExpirationDate }}</td> <td id="examExpirationDate{{ $vehicle->id }}">{{ $vehicle->examExpirationDate }}</td>
<td id="insuranceExpirationDate{{ $vehicle->id }}">{{ $vehicle->insuranceExpirationDate }}</td> <td id="insuranceExpirationDate{{ $vehicle->id }}">{{ $vehicle->insuranceExpirationDate }}</td>
@if(auth()->user()->accessLevel() == 50)
<td style="display:inline;"> <td style="display:inline;">
<a href="{{ URL::asset('pojazdy/edit/'.$vehicle->id) }}" class="btn btn-secondary" role="button">Edytuj</a> <a href="{{ URL::asset('pojazdy/edit/'.$vehicle->id) }}" class="btn btn-secondary" role="button">Edytuj</a>
{{ csrf_field() }} <button class="btn btn-danger" type="submit" id="{{$vehicle->id}}" onclick="deleteButton('{{$vehicle->id}}')">Usuń</button>
@method('DELETE')
<button class="btn btn-danger" type="submit">Usuń</button>
</form>
@if ($vehicle->status == 1) @if ($vehicle->status == 1)
<form method="POST" action="/pojazdy/deactivate" style="display:inline;"> <form method="POST" action="/pojazdy/deactivate" style="display:inline;">
{{ csrf_field() }} {{ csrf_field() }}
@ -70,6 +78,7 @@
@endif @endif
</td> </td>
@endif
</tr> </tr>
@endforeach @endforeach
</table> </table>
@ -79,3 +88,39 @@
Brak autoryzacji Brak autoryzacji
@endif @endif
@stop @stop
<script>
function deleteButton(vehicleID){
swal.fire({
title: "Czy chcesz usunąć pojazd?",
width: 'auto',
confirmButtonText: 'Tak',
cancelButtonText: 'Nie',
showCancelButton: true,
}).then((result) => {
if(result.value){
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
url: "pojazdy/"+vehicleID,
type: 'DELETE',
data: {
"id": vehicleID,
},
success: function (){
console.log("it Works");
location.reload();
}
});
}
})
}
</script>

View File

@ -3,7 +3,7 @@
@section('left-menu') @section('left-menu')
@parent @parent
<ul> <ul>
<a href="/pojazdy"><li>Przeglądaj<img src="img/left_menu_icon/add.png"></li></a> <a href="/pojazdy"><li>Przeglądaj<img src="/img/left_menu_icon/more.png"></li></a>
</ul> </ul>
@stop @stop
@ -12,8 +12,8 @@
<form method="POST" action="/pojazdy"> <form method="POST" action="/pojazdy">
{{ csrf_field() }} {{ csrf_field() }}
<div class="form-group"> <div class="form-group">
<label for="name">Nazwa:</label> <label for="vehicleName">Nazwa:</label>
<input type="text" class="form-control" id="name" name="name" value="{{ old('name') }} "> <input type="text" class="form-control" id="vehicleName" name="vehicleName" value="{{ old('vehicleName') }} ">
</div> </div>
<div class="form-group"> <div class="form-group">
@ -120,7 +120,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Zatwierdź</button> <button style="cursor:pointer" type="submit" class="btn btn-primary">Utwórz</button>
</div> </div>
@include('inc.formerrors') @include('inc.formerrors')
</form> </form>

View File

@ -3,10 +3,8 @@
@section('left-menu') @section('left-menu')
@parent @parent
<ul> <ul>
<a href="/pojazdy/add"><li>Dodaj<img src="img/left_menu_icon/add.png"></li></a> <a href="/pojazdy/add"><li>Dodaj<img src="/img/left_menu_icon/add.png"></li></a>
<li>Edytuj<img src="img/left_menu_icon/edit.png"></li> <a href="/pojazdy"><li>Przeglądaj<img src="/img/left_menu_icon/more.png"></li></a>
<li>Usuń<img src="img/left_menu_icon/delete.png"></li>
<li>Zawieś<img src="img/left_menu_icon/suspended.png"></li>
</ul> </ul>
@stop @stop
@ -17,8 +15,8 @@
<input type="hidden" class="form-control" name="vehicleID" value="{{ $vehicle->id }}"> <input type="hidden" class="form-control" name="vehicleID" value="{{ $vehicle->id }}">
<div class="form-group"> <div class="form-group">
<label for="name">Nazwa:</label> <label for="vehicleName">Nazwa:</label>
<input type="text" class="form-control" id="name" name="name" value="{{ $vehicle->name }} "> <input type="text" class="form-control" id="vehicleName" name="vehicleName" value="{{ $vehicle->name }} ">
</div> </div>
<div class="form-group"> <div class="form-group">
@ -125,7 +123,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Zatwierdź zmiany</button> <button style="cursor:pointer" type="submit" class="btn btn-primary">Zapisz</button>
</div> </div>
@include('inc.formerrors') @include('inc.formerrors')
</form> </form>

View File

@ -57,10 +57,14 @@ Route::post('/strazacy', 'fireFightersController@store');
Route::get('/strazacy/edit/{id}', 'fireFightersController@editForm'); Route::get('/strazacy/edit/{id}', 'fireFightersController@editForm');
Route::post('/strazacy/edit', 'fireFightersController@update'); Route::post('/strazacy/edit', 'fireFightersController@update');
Route::post('/strazacy/pdf/single/', 'fireFightersController@createSingleFireFighterPDF'); Route::post('/strazacy/pdf/single/', 'fireFightersController@createSingleFireFighterPDF');
Route::post('strazacy/activate', 'fireFightersController@activate');
Route::post('strazacy/deactivate', 'fireFightersController@deactivate');
Route::get('/strazacy/odznaczenia/{id}', 'DecorationsController@create'); Route::get('/strazacy/odznaczenia/{id}', 'DecorationsController@create');
Route::post('/strazacy/odznaczenia/{id}', 'DecorationsController@store'); Route::post('/strazacy/odznaczenia/{id}', 'DecorationsController@store');
Route::resource('decorations', 'DecorationsController'); Route::resource('decorations', 'DecorationsController');
Route::delete('/strazacy/odznaczenia/delete/{id}', 'DecorationsController@destroy')->name('DecorationsController.destroy');
Route::get('/jednostka', 'fireStationController@create'); Route::get('/jednostka', 'fireStationController@create');
Route::post('/jednostka', 'fireStationController@store'); Route::post('/jednostka', 'fireStationController@store');
@ -79,6 +83,7 @@ Route::post('/pojazdy/edit', 'VehiclesController@update');
Route::resource('vehicles', 'VehiclesController'); Route::resource('vehicles', 'VehiclesController');
Route::post('pojazdy/activate', 'VehiclesController@activate'); Route::post('pojazdy/activate', 'VehiclesController@activate');
Route::post('pojazdy/deactivate', 'VehiclesController@deactivate'); Route::post('pojazdy/deactivate', 'VehiclesController@deactivate');
Route::delete('pojazdy/{id}', 'VehiclesController@destroy')->name('VehiclesController.destroy');
Route::get('/sprzet', 'EquipmentController@create'); Route::get('/sprzet', 'EquipmentController@create');
Route::get('/sprzet/add', 'EquipmentController@addForm'); Route::get('/sprzet/add', 'EquipmentController@addForm');