supplier improvements
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
$( ->
|
||||
week_days_container = $('#week_days-group')
|
||||
$('.week-day-select').each( (i)->
|
||||
select = $(this)
|
||||
toggle = $('<button type="button" class="btn"></button>')
|
||||
toggle.attr('data-t', 'product_category.week_days.abbreviation.'+select.data('day'))
|
||||
toggle.addClass('active') if select.val() == '1'
|
||||
week_days_container.append(toggle)
|
||||
toggle.click( -> select.val(Math.abs(select.val() - 1)))
|
||||
)
|
||||
$('.week-day-toggle').each ->
|
||||
select = $('#week-day-select-'+$(@).data('day'))
|
||||
$(@).addClass('active') if select.val() == '1'
|
||||
$(@).click( -> select.val(Math.abs(select.val() - 1)))
|
||||
|
||||
$('#full_day-controller').each ->
|
||||
control = $('#product_category_full_day')
|
||||
@@ -24,10 +19,22 @@ $( ->
|
||||
$(@).removeClass 'icon-white'
|
||||
$('#sub-day-container').addClass('hide')
|
||||
|
||||
if Qstorage.getItem('message')
|
||||
container = $('.alert-success');
|
||||
msg_finder = Qstorage.getItem('message');
|
||||
msg_finder = 'messages.'+msg_finder if msg_finder.indexOf('.') == -1
|
||||
container.find('div').text(t(msg_finder))
|
||||
container.show()
|
||||
Qstorage.removeItem('message')
|
||||
|
||||
$('.datepicker').datepicker(window.datepicker_options)
|
||||
|
||||
setTranslations()
|
||||
|
||||
# GOOGLE LOCATION PICKER
|
||||
$("input.location_picker").each( (i)->
|
||||
#return if typeof(google) == 'undefined'
|
||||
iconBase = 'https://maps.google.com/mapfiles/kml/'
|
||||
location_input = $(this)
|
||||
map_div = $('<div>').addClass("location_picker_map")
|
||||
|
||||
@@ -43,7 +50,7 @@ $( ->
|
||||
lng = values[1]
|
||||
center = new google.maps.LatLng(lat,lng)
|
||||
mapOptions =
|
||||
zoom: 13
|
||||
zoom: 15
|
||||
center: center
|
||||
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
||||
zoomControl: true
|
||||
@@ -59,10 +66,54 @@ $( ->
|
||||
position: center
|
||||
map: map
|
||||
title: 'Location'
|
||||
icon: '/assets/icons/maps_location.png'
|
||||
)
|
||||
google.maps.event.addListener(map, 'click', (point)->
|
||||
marker.setPosition(point.latLng)
|
||||
location_input.val point.latLng.lat() + ','+ point.latLng.lng()
|
||||
)
|
||||
|
||||
search_field = $('<input type="text">')
|
||||
search_field.addClass('location_picker_search')
|
||||
autocomplete = new google.maps.places.Autocomplete(search_field.get(0))
|
||||
autocomplete.bindTo('bounds', map)
|
||||
search_field.keypress( (e) ->
|
||||
if e.which == 13
|
||||
e.preventDefault()
|
||||
)
|
||||
window.autocomplete = autocomplete
|
||||
map_div.before(search_field)
|
||||
infowindow = new google.maps.InfoWindow()
|
||||
search_marker = new google.maps.Marker({map: map, icon: iconBase + 'shapes/placemark_circle.png'})
|
||||
google.maps.event.addListener(autocomplete, 'place_changed', ->
|
||||
infowindow.close()
|
||||
search_marker.setVisible(false)
|
||||
place = autocomplete.getPlace()
|
||||
return unless place.geometry
|
||||
#if place.geometry.viewport
|
||||
# map.fitBounds(place.geometry.viewport)
|
||||
#else
|
||||
map.setCenter(place.geometry.location)
|
||||
map.setZoom(17)
|
||||
image =
|
||||
url: place.icon
|
||||
size: new google.maps.Size(71, 71)
|
||||
origin: new google.maps.Point(0, 0)
|
||||
anchor: new google.maps.Point(17, 34)
|
||||
scaledSize: new google.maps.Size(35, 35)
|
||||
#search_marker.setIcon(image)
|
||||
search_marker.setPosition(place.geometry.location)
|
||||
search_marker.setVisible(true)
|
||||
|
||||
address = ''
|
||||
if place.address_components
|
||||
address = [
|
||||
(place.address_components[0] && place.address_components[0].short_name || ''),
|
||||
(place.address_components[1] && place.address_components[1].short_name || ''),
|
||||
(place.address_components[2] && place.address_components[2].short_name || '')
|
||||
].join(' ')
|
||||
infowindow.setContent('<div><strong>' + place.name + '</strong><br>' + address + '</div>')
|
||||
infowindow.open(map, search_marker)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user