create.blade.php
10.5 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
@extends ('backend.layouts.app')
@section ('title', trans('labels.backend.machine.management') . ' | ' . trans('labels.backend.machine.create'))
@section('page-header')
<h1>
{{ trans('labels.backend.machine.management') }}
<small>{{ trans('labels.backend.machine.create') }}</small>
</h1>
@endsection
@section('content')
{{ Form::open(['route' => 'admin.machine.store', 'class' => 'form-horizontal', 'method' => 'post']) }}
{{ Form::hidden('lat', null, ['id' => 'lat']) }}
{{ Form::hidden('lng', null, ['id' => 'lng']) }}
<div class="box box-success">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('labels.backend.machine.create') }}</h3>
<div class="box-tools pull-right">
@include('backend.machine.includes.partials.machine-header-button')
</div><!--box-tools pull-right-->
</div><!-- /.box-header -->
<div class="box-body">
<div class="form-group">
{{ Form::label('city_name', trans('validation.attributes.backend.machine.city_name'), ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
{{ Form::hidden('ad_code', null, ['id' => 'ad_code']) }}
{{ Form::text('city_name', null, ['id' => 'city_name', 'class' => 'form-control', 'data-toggle'=>'city-picker', 'placeholder' => trans('validation.attributes.backend.machine.city_name')]) }}
</div><!--col-lg-10-->
</div><!--form control-->
<div class="form-group">
{{ Form::label('address', trans('validation.attributes.backend.machine.address').":", ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
{{ Form::text('address', null, ['class' => 'form-control', 'placeholder' => trans('validation.attributes.backend.machine.address')]) }}
</div><!--col-lg-10-->
</div><!--form control-->
<div class="form-group">
{{ Form::label('', '', ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
<button id="getLocation" class="btn btn-primary pull-right" type="button">{{trans('validation.attributes.backend.machine.getLocation')}}</button>
</div><!--col-lg-10-->
</div><!--form control-->
<div class="form-group">
{{ Form::label('map_address', trans('validation.attributes.backend.machine.map_address').":", ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
<div id="container" style="width:100%;height: 400px;"></div>
</div><!--col-lg-10-->
</div><!--form control-->
<div class="form-group">
{{ Form::label('deposit', trans('validation.attributes.backend.machine.deposit').":", ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
{{ Form::number('deposit', null, ['class' => 'form-control', 'placeholder' => trans('validation.attributes.backend.machine.deposit')]) }}
</div><!--col-lg-10-->
</div><!--form control-->
<div class="form-group">
{{ Form::label('one_day_price', trans('validation.attributes.backend.machine.one_day_price').":", ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
{{ Form::number('one_day_price', null, ['class' => 'form-control', 'placeholder' => trans('validation.attributes.backend.machine.one_day_price')]) }}
</div><!--col-lg-10-->
</div><!--form control-->
<div class="form-group">
{{ Form::label('free_time', trans('validation.attributes.backend.machine.free_time').":", ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
{{ Form::number('free_time', null, ['class' => 'form-control', 'placeholder' => trans('validation.attributes.backend.machine.free_time')]) }}
</div><!--col-lg-10-->
</div><!--form control-->
<div class="form-group">
{{ Form::label('business_id', trans('validation.attributes.backend.machine.business_id').":", ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
{{ Form::select('business_id',$business,'all', ['class' => 'form-control', 'placeholder' => trans('validation.attributes.backend.machine.business_id')]) }}
</div><!--col-lg-10-->
</div><!--form control-->
<div class="form-group">
{{ Form::label('spot_id', trans('validation.attributes.backend.machine.spot_id').":", ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
{{ Form::select('spot_id', $spot,'all', ['class' => 'form-control', 'placeholder' => trans('validation.attributes.backend.machine.spot_id')]) }}
</div><!--col-lg-10-->
</div>
<div class="form-group">
{{ Form::label('type', trans('validation.attributes.backend.machine.type').":", ['class' => 'col-lg-2 control-label']) }}
<div class="col-lg-10">
{{ Form::select('type', ['1'=>'大机柜','2'=>'小机柜'],'all', ['class' => 'form-control', 'placeholder' => trans('validation.attributes.backend.machine.type')]) }}
</div><!--col-lg-10-->
</div>
<!--仓口数-->
{{--<div class="form-group">--}}
{{--{{ Form::label('hatch_number', trans('validation.attributes.backend.machine.hatch_number').":", ['class' => 'col-lg-2 control-label']) }}--}}
{{--<div class="col-lg-10">--}}
{{--{{ Form::number('hatch_number', null, ['class' => 'form-control', 'placeholder' => trans('validation.attributes.backend.machine.hatch_number')]) }}--}}
{{--</div><!--col-lg-10-->--}}
{{--</div>--}}
<div class="box box-success">
<div class="box-body">
<div class="pull-left">
{{ link_to_route('admin.machine.index', trans('buttons.general.cancel'), [], ['class' => 'btn btn-danger btn-xs']) }}
</div><!--pull-left-->
<div class="pull-right">
{{ Form::submit(trans('buttons.general.crud.create'), ['class' => 'btn btn-success btn-xs']) }}
</div><!--pull-right-->
<div class="clearfix"></div>
</div><!-- /.box-body -->
</div><!--box-->
</div>
</div>
{{ Form::close() }}
@endsection
@section('after-scripts')
{{ Html::script('js/backend/access/roles/script.js') }}
{{ Html::script('https://webapi.amap.com/maps?v=1.3&key=8ee5d62b79b4e8a1e526bc4095d21fde') }}
{{ Html::script('js/backend/city/city-picker.data.all.js') }}
{{ Html::script('js/backend/city/city-picker.js') }}
{{ Html::script('js/backend/city/script.js') }}
{{ Html::style('css/city-picker.css') }}
<script>
$(function() {
var lng = $('#lng').attr("value");
var lat = $('#lat').attr("value")
var map = new AMap.Map('container');
map.setZoom(14);
AMap.plugin(['AMap.ToolBar','AMap.Scale', 'AMap.Geolocation'],function(){
var toolBar = new AMap.ToolBar();
var scale = new AMap.Scale();
geolocation = new AMap.Geolocation({
enableHighAccuracy: true,//是否使用高精度定位,默认:true
timeout: 10000, //超过10秒后停止定位,默认:无穷大
maximumAge: 0, //定位结果缓存0毫秒,默认:0
convert: true, //自动偏移坐标,偏移后的坐标为高德坐标,默认:true
showButton: true, //显示定位按钮,默认:true
buttonPosition: 'LB', //定位按钮停靠位置,默认:'LB',左下角
buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
showMarker: true, //定位成功后在定位到的位置显示点标记,默认:true
showCircle: true, //定位成功后用圆圈表示定位精度范围,默认:true
panToLocation: true, //定位成功后将定位到的位置作为地图中心点,默认:true
zoomToAccuracy:true //定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
});
geolocation.getCurrentPosition();
map.addControl(toolBar);
map.addControl(scale);
map.addControl(geolocation);
});
var marker = new AMap.Marker();
marker.setMap(map);
marker.setDraggable(true);
$("#getLocation").click(function(e){
var city_name = $('#city_name').val();
city_name = city_name.replace(/\//g, '');
var detail_address = city_name + $('#address').val();
AMap.service('AMap.Geocoder',function(){//回调函数
//实例化Geocoder
geocoder = new AMap.Geocoder({
});
var detailAddress = detail_address;
geocoder.getLocation(detailAddress, function(status, result) {
if (status === 'complete' && result.info === 'OK') {
marker.setPosition(result.geocodes[0].location);
map.setCenter(marker.getPosition());
$('#lat').val(result.geocodes[0].location.lat);
$('#lng').val(result.geocodes[0].location.lng);
}else{
alert("获取经纬度失败");
}
});
})
});
map.on('click', function(e) {
console.log('您在[ '+e.lnglat.getLng()+','+e.lnglat.getLat()+' ]的位置点击了地图!');
marker.setPosition(e.lnglat);
map.setCenter(marker.getPosition());
$('#lat').val(e.lnglat.getLat());
$('#lng').val(e.lnglat.getLng());
});
});
</script>
@endsection