1
0
forked from s421507/eOSP2
This commit is contained in:
czup 2019-12-07 14:50:58 +01:00
commit d8a7b998ec
20 changed files with 1078 additions and 58 deletions

View File

@ -0,0 +1,95 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\equipment;
use DB;
class EquipmentController extends Controller
{
public function create(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){
$equipment = DB::table('equipment')->where("fireStationID", '=', auth()->user()->fireStationID)
->whereNull('deleted_at')->get();
return view("equipment", ["equipment" => $equipment]);
} else{
return view('equipment');
}
}
public function addForm(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){
return view('equipmentAdd');
} else return view("login");
}
public function editForm($id)
{
if(auth()->user() != null && auth()->user()->fireStationID != null )
{
$equipment = DB::table('equipment')->where("id", $id)->first();
return view('equipmentEdit', ["equipment" => $equipment]);
}
else
return view("login");
}
public function store(){
$this->validate(request(), [
'name' => 'required',
'amount' => 'required|numeric',
],
[
'required' => ':attribute jest wymagany(a).',
'numeric' => ':attribute powinna zawierać tylko cyfry.',
]);
$request = request();
$equipment = equipment::create([
'fireStationID' => auth()->user()->fireStationID,
'name' => $request-> name,
'amount' => $request-> amount,
'parameter' => $request-> parameter,
]);
return redirect()->to('/sprzet');
}
public function update(){
$this->validate(request(), [
'name' => 'required',
'amount' => 'required|numeric',
],
[
'required' => ':attribute jest wymagany(a).',
'numeric' => ':attribute powinna zawierać tylko cyfry.'
]);
$request = request();
$equipment = equipment::find( $request->equipmentID);
$equipment-> name = $request-> name;
$equipment-> amount = $request-> amount;
$equipment-> parameter = $request-> parameter;
$equipment->save();
return redirect()->to('/sprzet');
}
public function destroy($id)
{
equipment::where('id',$id)->delete();
return redirect()->to('/sprzet');
}
}

View File

@ -9,8 +9,11 @@ use Carbon\Carbon; // formatowanie daty
function formatDate($date) function formatDate($date)
{ {
$fdate = Carbon::parse($date); if ($date == null)
return $fdate; return $date;
else
$fdate = Carbon::parse($date);
return $fdate;
} }
class VehiclesController extends Controller class VehiclesController extends Controller
@ -19,7 +22,7 @@ class VehiclesController extends Controller
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->fireStationID != null ){
$vehicles = DB::table('vehicles')->where("fireStationID", '=', auth()->user()->fireStationID) $vehicles = DB::table('vehicles')->where("fireStationID", '=', auth()->user()->fireStationID)
->get(); ->whereNull('deleted_at')->get();
return view("vehicles", ["vehicles" => $vehicles]); return view("vehicles", ["vehicles" => $vehicles]);
} else{ } else{
return view('vehicles'); return view('vehicles');
@ -30,7 +33,6 @@ class VehiclesController extends Controller
public function addForm(){ public function addForm(){
if(auth()->user() != null && auth()->user()->fireStationID != null ){ if(auth()->user() != null && auth()->user()->fireStationID != null ){
return view('vehiclesAdd'); return view('vehiclesAdd');
} else return view("login"); } else return view("login");
} }
@ -38,32 +40,25 @@ class VehiclesController extends Controller
{ {
if(auth()->user() != null && auth()->user()->fireStationID != null ) if(auth()->user() != null && auth()->user()->fireStationID != null )
{ {
//$userFireStation = auth()->user()->fireStationID;
//$fireFighterFireStation = DB::table('users')->where("id", $id)->value('fireStationID');
//$fireStationCreatorId = DB::table('fireStations')->where("id", $userFireStation)->value('creatorID');
$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"; return "Brak dostepu";
} }
public function store(){ public function store(){
$this->validate(request(), [ $this->validate(request(), [
'name' => 'required', 'name' => 'required',
'productionYear' => 'digits:4', 'codename' => 'required',
'foamAgent' => 'numeric', 'productionYear' => 'digits:4|nullable',
'enginePower' => 'numeric', 'foamAgent' => 'numeric|nullable',
'crewNumber' => 'numeric', 'enginePower' => 'numeric|nullable',
'mass' => 'numeric', 'crewNumber' => 'numeric|nullable',
'chassisPoductionYear' => 'numeric', 'mass' => 'numeric|nullable',
//dokończyć! Wypytać Adriana które mają być required 'chassisPoductionYear' => 'numeric|nullable',
], ],
[ [
'required' => ':attribute jest wymagany(e).', 'required' => ':attribute jest wymagany(e).',
@ -105,13 +100,13 @@ class VehiclesController extends Controller
$this->validate(request(), [ $this->validate(request(), [
'name' => 'required', 'name' => 'required',
'productionYear' => 'digits:4', 'codename' => 'required',
'foamAgent' => 'numeric', 'productionYear' => 'digits:4|nullable',
'enginePower' => 'numeric', 'foamAgent' => 'numeric|nullable',
'crewNumber' => 'numeric', 'enginePower' => 'numeric|nullable',
'mass' => 'numeric', 'crewNumber' => 'numeric|nullable',
'chassisPoductionYear' => 'numeric', 'mass' => 'numeric|nullable',
//dokończyć! Wypytać Adriana które mają być required 'chassisPoductionYear' => 'numeric|nullable',
], ],
[ [
'required' => ':attribute jest wymagany(e).', 'required' => ':attribute jest wymagany(e).',
@ -144,6 +139,12 @@ class VehiclesController extends Controller
$vehicle-> fireEnginePumpDescription = $request-> fireEnginePumpDescription; $vehicle-> fireEnginePumpDescription = $request-> fireEnginePumpDescription;
$vehicle->save(); $vehicle->save();
return VehiclesController::create(); return redirect()->to('/pojazdy');;
}
public function destroy($id)
{
vehicle::where('id',$id)->delete();
return redirect()->to('/pojazdy');
} }
} }

View File

@ -15,14 +15,27 @@ class fireStationController extends Controller
return view('unit', ["fireStation" => $fireStation]); return view('unit', ["fireStation" => $fireStation]);
} else{ } else{
$voivodeships = DB::table('wojewodztwa')->pluck("name","id"); $voivodeships = DB::table('wojewodztwa')->pluck("name","id");
return view('unit',compact('voivodeships')); return view('unit',compact('voivodeships'));
//return view('unit');
} }
} }
public function editForm()
{
if(auth()->user() != null && auth()->user()->fireStationID != null )
{
$id = auth()->user()->fireStationID;
$fireStation = DB::table('firestations')->where("id", $id)->first();
$voivodeships = DB::table('wojewodztwa')->pluck("name","id");
return view('fireStationEdit', ["fireStation" => $fireStation], compact('voivodeships'));
}
else
return "Brak dostępu";
}
public function store() public function store()
{ {
$this->validate(request(),[ $this->validate(request(),[
'unitName' => 'required|min:3|max:45', 'fireStationName' => 'required|min:3|max:45',
'number' => 'required|numeric', 'number' => 'required|numeric',
'voivodeship' => 'required', 'voivodeship' => 'required',
'county' => 'required', 'county' => 'required',
@ -57,7 +70,7 @@ class fireStationController extends Controller
$community = DB::table('gminy')->select('name')->where('id', $request -> community)->first(); $community = DB::table('gminy')->select('name')->where('id', $request -> community)->first();
$jednostka = fireStation::create([ $jednostka = fireStation::create([
'name' => $request -> unitName, 'name' => $request -> fireStationName,
'number' => $request -> number, 'number' => $request -> number,
'voivodeship' => $voivodeship -> name, 'voivodeship' => $voivodeship -> name,
'county' => $county -> name, 'county' => $county -> name,
@ -81,4 +94,60 @@ class fireStationController extends Controller
return redirect()->to('/jednostka'); return redirect()->to('/jednostka');
} }
public function update(){
$this->validate(request(),[
'fireStationName' => 'required|min:3|max:45',
'number' => 'required|numeric',
'voivodeship' => 'required',
'county' => 'required',
'community' => 'required',
'postOffice' => 'required|min:3|max:45',
'zipCode' => 'required|digits:5',
'latitude' => ['required', 'regex:/^[-]?(([0-8]?[0-9])\.(\d+))|(90(\.0+)?)$/'],
'longitude' => ['required', 'regex:/^[-]?((((1[0-7][0-9])|([0-9]?[0-9]))\.(\d+))|180(\.0+)?)$/'],
'address' => 'required|min:3|max:45',
'KRS' => 'required|digits:10',
'NIP' => 'required|digits:10',
'phoneNumber' => 'required|digits:9',
'email' => 'required|email|unique:fireStations,email,'.auth()->user()->fireStationID, //wymagaj unikalnego adresu email ale pozwól na zachowanie starego adresu
],
[
'required' => ':attribute jest wymagany(e).',
'min' => ':attribute musi mieć przynajmniej :min znaki.',
'max' => ':attribute musi mieć nie więcej niż :max znaków.',
'numeric' => ':attribute może zawierać tylko cyfry.',
'digits' => ':attribute musi składać się z :digits cyfr.',
'unique' =>':attribute jest już zajęty.',
'email' => 'Niepoprawny adres e-mail.',
'latitude.regex' =>':attribute ma zakres od -90.0 do 90.0',
'longitude.regex' =>':attribute ma zakres od -180.0 do 180.0'
]);
$request = request();
$voivodeship = DB::table('wojewodztwa')->select('name')->where('id', $request -> voivodeship)->first();
$county = DB::table('powiaty')->select('name')->where('id', $request -> county)->first();
$community = DB::table('gminy')->select('name')->where('id', $request -> community)->first();
$fireStation = fireStation::find($request->fireStationID);
$fireStation-> name = $request-> fireStationName;
$fireStation-> number = $request-> number;
$fireStation-> voivodeship = $voivodeship-> name;
$fireStation-> county = $county-> name;
$fireStation-> community = $community-> name;
$fireStation-> postOffice = $request-> postOffice;
$fireStation-> zipCode = $request-> zipCode;
$fireStation-> address = $request-> address;
$fireStation-> latitude = $request-> latitude;
$fireStation-> longitude = $request-> longitude;
$fireStation-> KRS = $request-> KRS;
$fireStation-> NIP = $request-> NIP;
$fireStation-> phoneNumber = $request-> phoneNumber;
$fireStation-> email = $request-> email;
$fireStation-> changingID = auth()->user()->id;
$fireStation->save();
return redirect()->to('/jednostka');;
}
} }

18
app/equipment.php Normal file
View File

@ -0,0 +1,18 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class equipment extends Model
{
use SoftDeletes;
protected $primaryKey = 'id';
protected $table = 'equipment';
protected $fillable = [
'fireStationID','name', 'amount', 'parameter',
];
}

View File

@ -3,9 +3,11 @@
namespace App; namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class vehicle extends Model class vehicle extends Model
{ {
use SoftDeletes;
protected $primaryKey = 'id'; protected $primaryKey = 'id';
protected $table = 'vehicles'; protected $table = 'vehicles';

494
database/db/eOSP.sql Normal file
View File

@ -0,0 +1,494 @@
-- MySQL Script generated by MySQL Workbench
-- Sun Nov 24 02:38:19 2019
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema osp
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema osp
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `osp` DEFAULT CHARACTER SET utf16 COLLATE utf16_polish_ci ;
USE `osp` ;
-- -----------------------------------------------------
-- Table `osp`.`uzytkownik`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `osp`.`uzytkownik` (
`Id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`login` VARCHAR(45) NOT NULL,
`haslo` VARCHAR(45) NOT NULL,
`imie` VARCHAR(45) NOT NULL,
`nazwisko` VARCHAR(45) NOT NULL,
`data_urodzenia` DATE NOT NULL,
`pesel` INT NOT NULL,
`adres` VARCHAR(45) NULL,
`funkcja` VARCHAR(45) NOT NULL,
`stopien` VARCHAR(45) NOT NULL,
`aktywny` TINYINT NOT NULL DEFAULT 1,
`edytor_id` INT UNSIGNED NOT NULL,
`data_edycji` DATETIME NOT NULL,
PRIMARY KEY (`Id`),
CONSTRAINT `edytor`
FOREIGN KEY (`edytor_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE UNIQUE INDEX `Id_UNIQUE` ON `osp`.`uzytkownik` (`Id` ASC) VISIBLE;
CREATE INDEX `edytor_idx` ON `osp`.`uzytkownik` (`edytor_id` ASC) VISIBLE;
CREATE UNIQUE INDEX `login_UNIQUE` ON `osp`.`uzytkownik` (`login` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `osp`.`typ_szkolenia`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `osp`.`typ_szkolenia` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`nazwa` VARCHAR(45) NOT NULL,
`szkolenie_kpp` TINYINT NOT NULL DEFAULT 0,
`usuniety` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`edytor_id` INT UNSIGNED NOT NULL,
`data_edycji` DATETIME NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `edytor`
FOREIGN KEY (`edytor_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`typ_szkolenia` (`id` ASC) VISIBLE;
CREATE INDEX `edytor_idx` ON `osp`.`typ_szkolenia` (`edytor_id` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `osp`.`szkolenie_uzytkownika`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `osp`.`szkolenie_uzytkownika` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`typ_szkolenia_id` INT UNSIGNED NOT NULL,
`uzytkownik_id` INT UNSIGNED NOT NULL,
`data_szkolenia` DATE NOT NULL,
`data_waznosci` DATE NULL,
`usuniety` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`edytor_id` INT UNSIGNED NOT NULL,
`data_edycji` DATETIME NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `typ_szkolenia`
FOREIGN KEY (`typ_szkolenia_id`)
REFERENCES `osp`.`typ_szkolenia` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `uzytkownik`
FOREIGN KEY (`uzytkownik_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `edytor`
FOREIGN KEY (`edytor_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`szkolenie_uzytkownika` (`id` ASC) VISIBLE;
CREATE INDEX `typ_szkolenia_idx` ON `osp`.`szkolenie_uzytkownika` (`typ_szkolenia_id` ASC) VISIBLE;
CREATE INDEX `uzytkownik_idx` ON `osp`.`szkolenie_uzytkownika` (`uzytkownik_id` ASC) VISIBLE;
CREATE INDEX `edytor_idx` ON `osp`.`szkolenie_uzytkownika` (`edytor_id` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `osp`.`badanie`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `osp`.`badanie` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`uzytkownik_id` INT UNSIGNED NOT NULL,
`data_badania` DATE NOT NULL,
`waznosc_badania` DATE NOT NULL,
`lekarz` VARCHAR(45) NOT NULL,
`edytor_id` INT UNSIGNED NOT NULL,
`data_edycji` DATETIME NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `uzytkownik0`
FOREIGN KEY (`uzytkownik_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `edytor0`
FOREIGN KEY (`edytor_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`badanie` (`id` ASC) VISIBLE;
CREATE INDEX `uzytkownik_idx` ON `osp`.`badanie` (`uzytkownik_id` ASC) VISIBLE;
CREATE INDEX `edytor_idx` ON `osp`.`badanie` (`edytor_id` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `osp`.`uzytkownik_historia`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `osp`.`uzytkownik_historia` (
`Id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`uzytkownik_id` INT UNSIGNED NOT NULL,
`login` VARCHAR(45) NOT NULL,
`haslo` VARCHAR(45) NOT NULL,
`imie` VARCHAR(45) NOT NULL,
`nazwisko` VARCHAR(45) NOT NULL,
`data_urodzenia` DATE NOT NULL,
`pesel` INT NOT NULL,
`adres` VARCHAR(45) NULL,
`funkcja` VARCHAR(45) NOT NULL,
`stopien` VARCHAR(45) NOT NULL,
`aktywny` TINYINT NOT NULL DEFAULT 1,
`edytor_id` INT UNSIGNED NOT NULL,
`data_edycji` DATETIME NOT NULL,
PRIMARY KEY (`Id`),
CONSTRAINT `edytor1`
FOREIGN KEY (`edytor_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `uzytkownik`
FOREIGN KEY (`uzytkownik_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE UNIQUE INDEX `Id_UNIQUE` ON `osp`.`uzytkownik_historia` (`Id` ASC) VISIBLE;
CREATE UNIQUE INDEX `login_UNIQUE` ON `osp`.`uzytkownik_historia` (`login` ASC) VISIBLE;
CREATE INDEX `edytor1_idx` ON `osp`.`uzytkownik_historia` (`edytor_id` ASC) VISIBLE;
CREATE INDEX `uzytkownik_idx` ON `osp`.`uzytkownik_historia` (`uzytkownik_id` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `osp`.`zastep`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `osp`.`zastep` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`pojazd_id` INT UNSIGNED NOT NULL,
`kierowca` INT UNSIGNED NOT NULL,
`dowodca` INT UNSIGNED NOT NULL,
`przod_roty_1` INT UNSIGNED NOT NULL,
`pom_przod_roty_1` INT UNSIGNED NOT NULL,
`przod_roty_2` INT UNSIGNED NOT NULL,
`pom_przod_roty_2` INT UNSIGNED NOT NULL,
`edytor_id` INT UNSIGNED NOT NULL,
`data_edycji` DATETIME NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `edytor`
FOREIGN KEY (`edytor_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`zastep` (`id` ASC) VISIBLE;
CREATE INDEX `edytor_idx` ON `osp`.`zastep` (`edytor_id` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `osp`.`zastep_historia`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `osp`.`zastep_historia` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`zastep_id` INT UNSIGNED NOT NULL,
`pojazd_id` INT UNSIGNED NOT NULL,
`kierowca` INT UNSIGNED NOT NULL,
`dowodca` INT UNSIGNED NOT NULL,
`przod_roty_1` INT UNSIGNED NOT NULL,
`pom_przod_roty_1` INT UNSIGNED NOT NULL,
`przod_roty_2` INT UNSIGNED NOT NULL,
`pom_przod_roty_2` INT UNSIGNED NOT NULL,
`edytor_id` INT UNSIGNED NOT NULL,
`data_edycji` DATETIME NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `edytor2`
FOREIGN KEY (`edytor_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `zastep`
FOREIGN KEY (`zastep_id`)
REFERENCES `osp`.`zastep` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`zastep_historia` (`id` ASC) VISIBLE;
CREATE INDEX `edytor_idx` ON `osp`.`zastep_historia` (`edytor_id` ASC) VISIBLE;
CREATE INDEX `zastep_idx` ON `osp`.`zastep_historia` (`zastep_id` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `osp`.`wyjazd`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `osp`.`wyjazd` (
`id` INT NOT NULL,
`zastep_id` INT UNSIGNED NOT NULL,
`adres` VARCHAR(45) NOT NULL,
`opis` VARCHAR(45) NOT NULL,
`godzina_wyjazdu` DATETIME NOT NULL,
`godzina_powrotu` DATETIME NOT NULL,
`edytor_id` INT UNSIGNED NOT NULL,
`data_edycji` DATETIME NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `zastep`
FOREIGN KEY (`zastep_id`)
REFERENCES `osp`.`zastep_historia` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `edytor`
FOREIGN KEY (`edytor_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE INDEX `zastep_idx` ON `osp`.`wyjazd` (`zastep_id` ASC) VISIBLE;
CREATE INDEX `edytor_idx` ON `osp`.`wyjazd` (`edytor_id` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `osp`.`pojazdy`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `osp`.`pojazdy` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`nazwa` VARCHAR(45) NOT NULL,
`numer_rejestracyjny` VARCHAR(45) NULL,
`marka_pojazdu` VARCHAR(45) NULL,
`typ_model_podwozia` VARCHAR(45) NULL,
`producent_podwozia` VARCHAR(45) NULL,
`układ_napedowy` VARCHAR(45) NULL,
`ilosc_osob_w_zalodze` INT NULL,
`ilosc_srodka_pianotworczego` FLOAT NULL,
`moc_silnika` FLOAT NULL,
`masa_calkowita` FLOAT NULL,
`numer_podwozia` VARCHAR(45) NULL,
`numer_silnika` VARCHAR(45) NULL,
`rodzaj_paliwa` VARCHAR(45) NULL,
`rok_produkcji_podwozia` INT NULL,
`data_wprowadzenia_do_eksploatacji` DATE NULL,
`opis_autopompy` VARCHAR(45) NULL,
`data_waznosci_przegladu_technicznego` DATE NULL,
`termin_waznosci_ubezpieczenia_OC` DATE NULL,
`usuniety` TINYINT NOT NULL DEFAULT 0,
`edytor_id` INT UNSIGNED NOT NULL,
`data_edycji` DATETIME NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `edytor_id`
FOREIGN KEY (`edytor_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE UNIQUE INDEX `idpojazdy_UNIQUE` ON `osp`.`pojazdy` (`id` ASC) INVISIBLE;
CREATE INDEX `edytor_id_idx` ON `osp`.`pojazdy` (`edytor_id` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `osp`.`pojazdy_historia`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `osp`.`pojazdy_historia` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`pojazdy_id` INT UNSIGNED NOT NULL,
`nazwa` VARCHAR(45) NOT NULL,
`numer_rejestracyjny` VARCHAR(45) NULL,
`marka_pojazdu` VARCHAR(45) NULL,
`typ_model_podwozia` VARCHAR(45) NULL,
`producent_podwozia` VARCHAR(45) NULL,
`układ_napedowy` VARCHAR(45) NULL,
`ilosc_osob_w_zalodze` INT NULL,
`ilosc_srodka_pianotworczego` FLOAT NULL,
`moc_silnika` FLOAT NULL,
`masa_calkowita` FLOAT NULL,
`numer_podwozia` VARCHAR(45) NULL,
`numer_silnika` VARCHAR(45) NULL,
`rodzaj_paliwa` VARCHAR(45) NULL,
`rok_produkcji_podwozia` INT NULL,
`data_wprowadzenia_do_eksploatacji` DATE NULL,
`opis_autopompy` VARCHAR(45) NULL,
`data_waznosci_przegladu_technicznego` DATE NULL,
`termin_waznosci_ubezpieczenia_OC` DATE NULL,
`usuniety` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`edytor_id` INT UNSIGNED NOT NULL,
`data_edycji` DATETIME NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `edytor_id`
FOREIGN KEY (`edytor_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `pojazdy_id`
FOREIGN KEY (`pojazdy_id`)
REFERENCES `osp`.`pojazdy` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE UNIQUE INDEX `idpojazdy_UNIQUE` ON `osp`.`pojazdy_historia` (`id` ASC) VISIBLE;
CREATE INDEX `pojazdy_id_idx` ON `osp`.`pojazdy_historia` (`pojazdy_id` ASC) VISIBLE;
CREATE INDEX `edytor_id_idx` ON `osp`.`pojazdy_historia` (`edytor_id` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `osp`.`typ_szkolenia_historia`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `osp`.`typ_szkolenia_historia` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`typ_szkolenia_id` INT UNSIGNED NOT NULL,
`nazwa` VARCHAR(45) NOT NULL,
`szkolenie_kpp` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`usuniety` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`edytor_id` INT UNSIGNED NOT NULL,
`data_edycji` DATETIME NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `edytor`
FOREIGN KEY (`edytor_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `typ_szkolenia_id`
FOREIGN KEY (`typ_szkolenia_id`)
REFERENCES `osp`.`typ_szkolenia` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`typ_szkolenia_historia` (`id` ASC) VISIBLE;
CREATE INDEX `edytor_idx` ON `osp`.`typ_szkolenia_historia` (`edytor_id` ASC) VISIBLE;
CREATE INDEX `typ_szkolenia_id_idx` ON `osp`.`typ_szkolenia_historia` (`typ_szkolenia_id` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `osp`.`szkolenie_uzytkownika_historia`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `osp`.`szkolenie_uzytkownika_historia` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`szkolenie_uzytkownika_id` INT UNSIGNED NOT NULL,
`typ_szkolenia_id` INT UNSIGNED NOT NULL,
`uzytkownik_id` INT UNSIGNED NOT NULL,
`data_szkolenia` DATE NOT NULL,
`data_waznosci` DATE NULL,
`usuniety` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`edytor_id` INT UNSIGNED NOT NULL,
`data_edycji` DATETIME NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `typ_szkolenia`
FOREIGN KEY (`typ_szkolenia_id`)
REFERENCES `osp`.`typ_szkolenia` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `uzytkownik`
FOREIGN KEY (`uzytkownik_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `edytor`
FOREIGN KEY (`edytor_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`szkolenie_uzytkownika_historia` (`id` ASC) VISIBLE;
CREATE INDEX `typ_szkolenia_idx` ON `osp`.`szkolenie_uzytkownika_historia` (`typ_szkolenia_id` ASC) VISIBLE;
CREATE INDEX `uzytkownik_idx` ON `osp`.`szkolenie_uzytkownika_historia` (`uzytkownik_id` ASC) VISIBLE;
CREATE INDEX `edytor_idx` ON `osp`.`szkolenie_uzytkownika_historia` (`edytor_id` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `osp`.`sprzet`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `osp`.`sprzet` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`nazwa` VARCHAR(45) NOT NULL,
`ilosc` INT NOT NULL DEFAULT 0,
`parametr_charakterystyczny` VARCHAR(45) NULL,
`rodzaj_sprzetu` VARCHAR(45) NOT NULL,
`usuniety` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`edytor_id` INT UNSIGNED NOT NULL,
`data_edycji` DATETIME NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `edytor_id`
FOREIGN KEY (`edytor_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`sprzet` (`id` ASC) VISIBLE;
CREATE INDEX `edytor_id_idx` ON `osp`.`sprzet` (`edytor_id` ASC) VISIBLE;
-- -----------------------------------------------------
-- Table `osp`.`sprzet_historia`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `osp`.`sprzet_historia` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`sprzet_id` INT UNSIGNED NOT NULL,
`nazwa` VARCHAR(45) NOT NULL,
`ilosc` INT NOT NULL,
`parametr_charakterystyczny` VARCHAR(45) NULL,
`rodzaj_sprzetu` VARCHAR(45) NOT NULL,
`usuniety` TINYINT UNSIGNED NOT NULL DEFAULT 0,
`edytor_id` INT UNSIGNED NOT NULL,
`data_edycji` DATETIME NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `edytor_id`
FOREIGN KEY (`edytor_id`)
REFERENCES `osp`.`uzytkownik` (`Id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `sprzet_id`
FOREIGN KEY (`sprzet_id`)
REFERENCES `osp`.`sprzet` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
CREATE UNIQUE INDEX `id_UNIQUE` ON `osp`.`sprzet_historia` (`id` ASC) VISIBLE;
CREATE INDEX `edytor_id_idx` ON `osp`.`sprzet_historia` (`edytor_id` ASC) VISIBLE;
CREATE INDEX `sprzet_id_idx` ON `osp`.`sprzet_historia` (`sprzet_id` ASC) VISIBLE;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

BIN
database/db/osp.mwb Normal file

Binary file not shown.

BIN
database/db/osp.mwb.bak Normal file

Binary file not shown.

View File

@ -18,24 +18,25 @@ class CreateVehiclesTable extends Migration
$table->integer('fireStationID'); $table->integer('fireStationID');
$table->string('name', 45); $table->string('name', 45);
$table->string('codename', 45); $table->string('codename', 45);
$table->string('brand',45); $table->string('brand',45)->nullable();
$table->string('registrationNumber', 15); $table->string('registrationNumber', 15)->nullable();
$table->integer('productionYear'); $table->integer('productionYear')->nullable();
$table->date('examExpirationDate'); //Data ważności przegladu $table->date('examExpirationDate')->nullable(); //Data ważności przegladu
$table->date('insuranceExpirationDate'); $table->date('insuranceExpirationDate')->nullable();
$table->string('driveType',45); //układ napędowy $table->string('driveType',45)->nullable(); //układ napędowy
$table->string('chassisType',45); //typ podwozia $table->string('chassisType',45)->nullable(); //typ podwozia
$table->string('bodyProducer',45); //producent nadwozia $table->string('bodyProducer',45)->nullable(); //producent nadwozia
$table->integer('crewNumber'); $table->integer('crewNumber')->nullable();
$table->integer('foamAgent'); //Ilość środka pianotwórczego w litrach $table->integer('foamAgent')->nullable(); //Ilość środka pianotwórczego w litrach
$table->integer('enginePower'); //Moc silnika w kW $table->integer('enginePower')->nullable(); //Moc silnika w kW
$table->integer('mass'); //Masa całkowita pojazdu $table->integer('mass')->nullable(); //Masa całkowita pojazdu
$table->string('chassisNumber'); $table->string('chassisNumber')->nullable();
$table->string('engineNumber'); $table->string('engineNumber')->nullable();
$table->string('fuelType',45); $table->string('fuelType',45)->nullable();
$table->integer('chassisPoductionYear'); $table->integer('chassisPoductionYear')->nullable();
$table->date('entryIntoServiceDate'); $table->date('entryIntoServiceDate')->nullable();
$table->string('fireEnginePumpDescription');// Opis autopompy $table->string('fireEnginePumpDescription')->nullable();// Opis autopompy
$table->softDeletes();
$table->timestamps(); $table->timestamps();
}); });
} }

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEquipmentTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('equipment', function (Blueprint $table) {
$table->increments('id');
$table->integer('fireStationID');
$table->string('name', 45);
$table->integer('amount');
$table->string('parameter', 45)->nullable();
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('equipment');
}
}

View File

@ -161,6 +161,7 @@ return [
'unitName' => 'nazwa jednostki', 'unitName' => 'nazwa jednostki',
'longitude' => 'długość geograficzna', 'longitude' => 'długość geograficzna',
'latitude' => 'szerokość geograficzna', 'latitude' => 'szerokość geograficzna',
'amount' => 'ilość'
], ],

View File

@ -3,14 +3,16 @@
@section('left-menu') @section('left-menu')
@parent @parent
<ul> <ul>
<li>Dodaj<img src="img/left_menu_icon/add.png"></li> <a href="/sprzet"><li>Sprzęt<img src="img/left_menu_icon/more.png"></li></a>
<li>Edytuj<img src="img/left_menu_icon/edit.png"></li> {{-- <li>Edytuj<img src="img/left_menu_icon/edit.png"></li> --}}
<li>Usuń<img src="img/left_menu_icon/delete.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 informację o umundurowaniu oraz sprzęcie jaki jest na wyposarzeniu 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 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>
@stop @stop

View File

@ -0,0 +1,47 @@
@extends('layout.app')
@section('left-menu')
@parent
<ul>
<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>
@stop
@section('center-area')
@parent
@if( auth()->check())
@if( auth()->user()->fireStationID == NULL)
Jednostka nie istnieje
@else
<p align='center'>
<table class='firefighterViewTable'>
<tr class='table-header'>
<td>Nazwa</td>
<td>Ilość</td>
<td>Param. charakterystyczny</td>
@foreach($equipment as $item)
<tr>
<form action="{{ route('equipment.destroy', $item->id)}}" method="post">
<td id="name{{ $item->id }}">{{ $item->name }}</td>
<td id="amount{{ $item->id }}">{{ $item->amount }}</td>
<td id="parameter{{ $item->id }}">{{ $item->parameter }}</td>
<td><a href="{{ URL::asset('sprzet/edit/'.$item->id) }}"><input type="button" onclick="" value="Edytuj"> </a></td>
<td>
{{ csrf_field() }}
@method('DELETE')
<button class="btn btn-danger" type="submit">Usuń</button>
</form></td>
</tr>
@endforeach
</table>
</p>
@endif
@else
Brak autoryzacji
@endif
@stop

View File

@ -0,0 +1,36 @@
@extends('layout.app')
@section('left-menu')
@parent
<ul>
<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>
@stop
@section('center-area')
@parent
<form method="POST" action="/sprzet">
{{ csrf_field() }}
<div class="form-group">
<label for="name">Nazwa:</label>
<input type="text" class="form-control" id="name" name="name" value="{{ old('name') }} ">
</div>
<div class="form-group">
<label for="amount">Ilość:</label>
<input type="text" class="form-control" id="amount" name="amount" value="{{ old('amount') }}">
</div>
<div class="form-group">
<label for="parameter">Parametr charakterystyczny:</label>
<input type="text" class="form-control" id="parameter" name="parameter" value="{{ old('parameter') }}">
</div>
<div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Zatwierdź</button>
</div>
@include('inc.formerrors')
</form>
@stop

View File

@ -0,0 +1,38 @@
@extends('layout.app')
@section('left-menu')
@parent
<ul>
<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>
@stop
@section('center-area')
@parent
<form method="POST" action="/sprzet/edit">
{{ csrf_field() }}
<input type="hidden" class="form-control" name="equipmentID" value="{{ $equipment->id }}">
<div class="form-group">
<label for="name">Nazwa:</label>
<input type="text" class="form-control" id="name" name="name" value="{{ $equipment->name }} ">
</div>
<div class="form-group">
<label for="amount">Ilość:</label>
<input type="text" class="form-control" id="amount" name="amount" value="{{ $equipment->amount }}">
</div>
<div class="form-group">
<label for="parameter">Parametr charakterystyczny:</label>
<input type="text" class="form-control" id="parameter" name="parameter" value="{{ $equipment->parameter }}">
</div>
<div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Zatwierdź</button>
</div>
@include('inc.formerrors')
</form>
@stop

View File

@ -0,0 +1,165 @@
@extends('layout.app')
@section('center-area')
@parent
<head>
<title>Edycja jednostki straży pożarnej</title>
<link rel="stylesheet" href="{{asset('css/app.css')}}">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
</head>
<h2>Edytuj jednostkę</h2>
<form method="POST" action="/jednostka/edit">
{{ csrf_field() }}
<input type="hidden" class="form-control" name="fireStationID" value="{{ $fireStation->id }}">
<div class="form-group">
<label for="name">Nazwa Jednostki:</label>
<input type="text" class="form-control" id="fireStationName" name="fireStationName" value="{{ $fireStation->name }} ">
</div>
<div class="form-group">
<label for="name">Numer Jednostki:</label>
<input type="text" class="form-control" id="number" name="number" value="{{ $fireStation->number }}">
</div>
<div class="form-group">
<label for="voivodeship">Województwo:</label>
<select name="voivodeship" class="form-control" style="width:250px">
<option value="">--- Wybierz województwo ---</option>
@foreach ($voivodeships as $key => $value)
<option value="{{ $key }}">{{ $value }}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label for="county">Powiat:</label>
<select name="county" class="form-control"style="width:250px">
<option>--Wybierz powiat--</option>
</select>
</div>
<div class="form-group">
<label for="community">Gmina:</label>
<select name="community" class="form-control"style="width:250px">
<option>--Wybierz gminę--</option>
</select>
</div>
<div class="form-group">
<label for="name">Urząd Pocztowy:</label>
<input type="text" class="form-control" id="postOffice" name="postOffice" value="{{ $fireStation->postOffice }}">
</div>
<div class="form-group">
<label for="name">Kod Pocztowy:</label>
<input type="text" class="form-control" id="zipCode" name="zipCode" value="{{ $fireStation->zipCode }}">
</div>
<div class="form-group">
<label for="name">Ulica:</label>
<input type="text" class="form-control" id="address" name="address" value="{{ $fireStation->address }}">
</div>
<div class="form-group">
<label for="name">Szerokość Geograficzna:</label>
<input type="text" class="form-control" id="latitude" name="latitude" value="{{ $fireStation->latitude }}">
</div>
<div class="form-group">
<label for="name">Długość Geograficzna:</label>
<input type="text" class="form-control" id="longitude" name="longitude" value="{{ $fireStation->longitude }}">
</div>
<div class="form-group">
<label for="name">KRS:</label>
<input type="text" class="form-control" id="KRS" name="KRS" value="{{ $fireStation->KRS }}">
</div>
<div class="form-group">
<label for="name">NIP:</label>
<input type="text" class="form-control" id="NIP" name="NIP" value="{{ $fireStation->NIP }}">
</div>
<div class="form-group">
<label for="name">Numer telefonu:</label>
<input type="text" class="form-control" id="phoneNumber" name="phoneNumber" value="{{ $fireStation->phoneNumber }}">
</div>
<div class="form-group">
<label for="name">Email:</label>
<input type="email" class="form-control" id="email" name="email" value="{{ $fireStation->email }}">
</div>
<div class="form-group">
<button style="cursor:pointer" type="submit" class="btn btn-primary">Submit</button>
</div>
@include('inc.formerrors')
</form>
<script type="text/javascript">
jQuery(document).ready(function ()
{
jQuery('select[name="voivodeship"]').on('change',function(){
var voivodeshipID = jQuery(this).val();
if(voivodeshipID)
{
jQuery.ajax({
url : '/./jednostka/getcounties/' +voivodeshipID,
type : "GET",
dataType : "json",
success:function(data)
{
//console.log(data);
jQuery('select[name="county"]').empty();
jQuery('select[name="county"]').append(new Option('--Wybierz powiat--', ''));
jQuery('select[name="community"]').empty();
jQuery.each(data, function(key,value){
$('select[name="county"]').append('<option value="'+ key +'">'+ value +'</option>');
});
}
});
}
else
{
$('select[name="county"]').empty();
$('select[name="community"]').empty();
}
});
jQuery('select[name="county"]').on('change',function(){
var countyID = jQuery(this).val();
if(countyID)
{
jQuery.ajax({
url : '/./jednostka/getcommunities/' +countyID,
type : "GET",
dataType : "json",
success:function(data)
{
//console.log(data);
jQuery('select[name="community"]').empty();
jQuery.each(data, function(key,value){
$('select[name="community"]').append('<option value="'+ key +'">'+ value +'</option>');
});
}
});
}
else
{
$('select[name="community"]').empty();
}
});
});
</script>
@stop

View File

@ -4,7 +4,7 @@
@parent @parent
<head> <head>
<title>Laravel Dependent Dropdown Tutorial With Example</title> <title>Dodawanie jednostki straży pożarnej</title>
<link rel="stylesheet" href="{{asset('css/app.css')}}"> <link rel="stylesheet" href="{{asset('css/app.css')}}">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
@ -16,7 +16,7 @@
{{ csrf_field() }} {{ csrf_field() }}
<div class="form-group"> <div class="form-group">
<label for="name">Nazwa Jednostki:</label> <label for="name">Nazwa Jednostki:</label>
<input type="text" class="form-control" id="unitName" name="unitName" value="{{ old('unitName') }} "> <input type="text" class="form-control" id="fireStationName" name="fireStationName" value="{{ old('fireStationName') }} ">
</div> </div>
<div class="form-group"> <div class="form-group">

View File

@ -4,7 +4,7 @@
@parent @parent
<ul> <ul>
<li>Edytuj<img src="img/left_menu_icon/edit.png"></li> <a href="/jednostka/edit"><li>Edytuj<img src="img/left_menu_icon/edit.png"></li></a>
</ul> </ul>
@stop @stop

View File

@ -36,6 +36,7 @@
$lp = $lp + 1 $lp = $lp + 1
@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>
@ -46,6 +47,11 @@
<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>
<td><a href="{{ URL::asset('pojazdy/edit/'.$vehicle->id) }}"><input type="button" onclick="" value="Edytuj"> </a></td> <td><a href="{{ URL::asset('pojazdy/edit/'.$vehicle->id) }}"><input type="button" onclick="" value="Edytuj"> </a></td>
<td>
{{ csrf_field() }}
@method('DELETE')
<button class="btn btn-danger" type="submit">Usuń</button>
</form></td>
</tr> </tr>
@endforeach @endforeach
</table> </table>

View File

@ -54,6 +54,8 @@ Route::post('/strazacy/edit', 'fireFightersController@update');
Route::get('/jednostka', 'fireStationController@create'); Route::get('/jednostka', 'fireStationController@create');
Route::post('/jednostka', 'fireStationController@store'); Route::post('/jednostka', 'fireStationController@store');
Route::get('/jednostka/edit', 'fireStationController@editForm');
Route::post('/jednostka/edit', 'fireStationController@update');
Route::get('/jednostka/getcounties/{id}','DataController@getCounties'); Route::get('/jednostka/getcounties/{id}','DataController@getCounties');
Route::get('/jednostka/getcommunities/{id}','DataController@getCommunities'); Route::get('/jednostka/getcommunities/{id}','DataController@getCommunities');
@ -63,7 +65,14 @@ Route::get('/pojazdy/add', 'VehiclesController@addForm');
Route::post('/pojazdy', 'VehiclesController@store'); Route::post('/pojazdy', 'VehiclesController@store');
Route::get('/pojazdy/edit/{id}', 'VehiclesController@editForm'); Route::get('/pojazdy/edit/{id}', 'VehiclesController@editForm');
Route::post('/pojazdy/edit', 'VehiclesController@update'); Route::post('/pojazdy/edit', 'VehiclesController@update');
Route::resource('vehicles', 'VehiclesController');
Route::get('/sprzet', 'EquipmentController@create');
Route::get('/sprzet/add', 'EquipmentController@addForm');
Route::post('/sprzet', 'EquipmentController@store');
Route::get('/sprzet/edit/{id}', 'EquipmentController@editForm');
Route::post('/sprzet/edit', 'EquipmentController@update');
Route::resource('equipment', 'EquipmentController');
Route::get('register/verify/{confirmationCode}', [ Route::get('register/verify/{confirmationCode}', [
'as' => 'confirmation_path', 'as' => 'confirmation_path',