-
Notifications
You must be signed in to change notification settings - Fork 0
/
formsale.html
116 lines (96 loc) · 3.87 KB
/
formsale.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- Angular -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<!-- Address autocomplete -->
<link rel="stylesheet" href="bower_components/jquery-ui/themes/start/jquery-ui.css">
<link rel="stylesheet" href="bower_components/jquery-ui/themes/start/theme.css">
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/jquery-ui/jquery-ui.js"></script>
<script src="bower_components/jquery-ui/ui/autocomplete.js"></script>
<script src="bower_components/dawa-autocomplete/dawa-autocomplete.js"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- Mapbox -->
<script src='https://api.mapbox.com/mapbox.js/v2.4.0/mapbox.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v2.4.0/mapbox.css' rel='stylesheet' />
<style media="screen">
#map {
margin-top: 25px;
height: 600px;
width: 100%;
border-radius: 5px;
z-index: 0;
}
</style>
</head>
<body>
<div class="container" ng-app="lokalmad" ng-controller="ExampleController">
<div class="col-md-6">
<form novalidate class="simple-form">
<div class="form-group">
<label for="name">Navn:</label>
<input type="text" class="form-control" ng-model="user.name" placeholder="Fulde navn" />
</div>
<div class="form-group">
<label for="address">Adresse:</label>
<input type="text" class="form-control" id="address" ng-model="user.address" placeholder="Fulde adresse" />
</div>
<div class="form-group">
<label for="email">Mail:</label>
<input type="email" class="form-control" ng-model="user.mail" placeholder="Skriv din mail" />
</div>
<div class="form-group">
<input type="button" class="btn btn-default" ng-click="reset()" value="Reset" />
<input type="submit" class="btn btn-default" ng-click="update(user)" value="Save" />
</div>
</form>
<pre>user = {{user | json}}</pre>
<pre>master = {{master | json}}</pre>
</div>
<div class="col-md-6">
<div id="map"></div>
</div>
</div>
<script>
angular.module('lokalmad', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.master = {};
$scope.update = function(user) {
$scope.master = angular.copy(user);
};
$scope.reset = function() {
$scope.user = angular.copy($scope.master);
};
$scope.reset();
}]);
//DAWA-autocomplete tilføjes adressefeltet
$('#address').dawaautocomplete({
select: function(event, data) {
//adressen tilføjes kortet
$.getJSON(data.data.href, function(data) {
var koordinater = data.adgangsadresse.adgangspunkt.koordinater;
var marker = L.marker([koordinater[1], koordinater[0]]).addTo(map);
//panorerer hen til adressen
map.setView({
lat: koordinater[1],
lng: koordinater[0]
}, 17)
});
}
});
var map = L.map('map').setView([55.5, 12.1], 6);
L.mapbox.accessToken = 'pk.eyJ1IjoiYmFmZmlvc28iLCJhIjoiT1JTS1lIMCJ9.f5ubY91Bi42yPnTrgiq-Gw';
//add tilelayer
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
maxZoom: 18,
id: 'baffioso.ie1ok8lg',
accessToken: L.mapbox.accessToken
}).addTo(this.map);
</script>
</body>
</html>