165 lines
6.2 KiB
PHP
165 lines
6.2 KiB
PHP
@extends('layout.app')
|
|
|
|
@section('center-area')
|
|
@parent
|
|
|
|
<head>
|
|
<title>Laravel Dependent Dropdown Tutorial With Example</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>Dodaj Jednostkę</h2>
|
|
<form method="POST" action="/jednostka">
|
|
{{ csrf_field() }}
|
|
<div class="form-group">
|
|
<label for="name">Nazwa Jednostki:</label>
|
|
<input type="text" class="form-control" id="unitName" name="unitName" value="{{ old('unitName') }} ">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="name">Numer Jednostki:</label>
|
|
<input type="text" class="form-control" id="number" name="number" value="{{ old('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="{{ old('postOffice') }}">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="name">Kod Pocztowy:</label>
|
|
<input type="text" class="form-control" id="zipCode" name="zipCode" value="{{ old('zipCode') }}">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="name">Ulica:</label>
|
|
<input type="text" class="form-control" id="address" name="address" value="{{ old('address') }}">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="name">Szerokość Geograficzna:</label>
|
|
<input type="text" class="form-control" id="latitude" name="latitude" value="{{ old('latitude') }}">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="name">Długość Geograficzna:</label>
|
|
<input type="text" class="form-control" id="longitude" name="longitude" value="{{ old('longitude') }}">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="name">KRS:</label>
|
|
<input type="text" class="form-control" id="KRS" name="KRS" value="{{ old('KRS') }}">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="name">NIP:</label>
|
|
<input type="text" class="form-control" id="NIP" name="NIP" value="{{ old('NIP') }}">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="name">Numer telefonu:</label>
|
|
<input type="text" class="form-control" id="phoneNumber" name="phoneNumber" value="{{ old('phoneNumber') }}">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="name">Email:</label>
|
|
<input type="email" class="form-control" id="email" name="email" value="{{ old('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
|