update qr code system and add location setter for suppliers

This commit is contained in:
2012-11-19 19:09:23 +01:00
parent 0036e5da60
commit 633665daaa
13 changed files with 369 additions and 350 deletions
@@ -0,0 +1,40 @@
$( ->
$("input.location_picker").each( (i)->
location_input = $(this)
map_div = $('<div>').addClass("location_picker_map")
location_input.before(map_div)
#this.parentNode.insertBefore(map_div, this)
location_input.hide()
lat = 52.07436798080633
lng = 4.316811561584473
if (this.value.split(',').length == 2)
values = this.value.split(',')
lat = values[0]
lng = values[1]
center = new google.maps.LatLng(lat,lng)
mapOptions =
zoom: 13
center: center
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoomControl: true
zoomControlOptions:
style: google.maps.ZoomControlStyle.SMALL
mapTypeControl: false
panControl: false
scaleControl: false
streetViewControl: false
map = new google.maps.Map(map_div.get(0), mapOptions)
marker = new google.maps.Marker(
position: center
map: map
title: 'Location'
)
google.maps.event.addListener(map, 'click', (point)->
marker.setPosition(point.latLng)
location_input.val point.latLng.lat() + ','+ point.latLng.lng()
)
)
)
@@ -20,3 +20,9 @@ body
.alert
form
margin: 0
.location_picker_map
width: 300px
height: 200px
border: 1px solid black
padding: 2px
display: inline-block
+9 -4
View File
@@ -29,11 +29,12 @@ class DashboardController < ApplicationController
# GET /select_qr_image.svg
def table_qr_image
@table = Table.find(params[:table_id])
code = {table_id: @table.id}.to_json
#code = [get_the_app_url, {table_id: @table.id}.to_json].join('?')
code = "#{scan_url}?json=#{{table_id: @table.id}.to_json}"
respond_to do |format|
format.html
format.svg { render :qrcode => code, :level => :l, :unit => 10, table_number: @table.number, qcontainer: true }
format.png { render qrcode: code, table_number: @table.number, qcontainer: true }
format.png { render qrcode: code, level: :l, table_number: @table.number, qcontainer: true }
end
end
@@ -41,9 +42,13 @@ class DashboardController < ApplicationController
code = 'qwaiter.com'
respond_to do |format|
format.html
format.svg { render :qrcode => code, :level => :l, :unit => 10}
format.png { render qrcode: code}
format.png { render qrcode: code, level: :h, unit: 10, size: 12}
format.svg { render qrcode: code, level: :h, unit: 10, size: 12}
end
end
def scan
end
end
+12
View File
@@ -6,6 +6,8 @@ class Supplier
property :name
property :open, type: :boolean, default: false
property :night_offset, type: Float
property :lat, type: Float, default: 52.08062426379751
property :lng, type: Float, default: 4.312562942504883
#WIFI
property :offer_wifi
@@ -24,6 +26,16 @@ class Supplier
after_create :add_section_on_create
def location=(val)
lat, lng = val.strip.split(/[ ,]+/).map(&:to_f)
self.lat = lat
self.lng = lng
end
def location
[lat, lng].join(',')
end
def active_orders(options = {})
return @active_orders if @active_orders && @active_orders_options == options
@active_orders_options = options
+1 -1
View File
@@ -1,2 +1,2 @@
iframe[ src="https://docs.google.com/spreadsheet/embeddedform?formkey=dEI3NmlWRUFMbnVySWd6SzljYjM3NVE6MQ" width="760" height="2332"
iframe[ src="https://docs.google.com/spreadsheet/embeddedform?formkey=dEI3NmlWRUFMbnVySWd6SzljYjM3NVE6MQ" width="760" height="2432"
frameborder="0" marginheight="0" marginwidth="0"] Loading..
+2
View File
@@ -0,0 +1,2 @@
- title 'Get the mobile app to order drinks'
p Get the mobile app
+1
View File
@@ -17,6 +17,7 @@ html lang="en"
link href="/images/apple-touch-icon-72x72.png" rel="apple-touch-icon-precomposed" sizes="72x72"
link href="/images/apple-touch-icon.png" rel="apple-touch-icon-precomposed"
link href="/favicon.ico" rel="shortcut icon"
= yield :head
body
.navbar.navbar-fixed-top.navbar-inverse
+7
View File
@@ -1,3 +1,6 @@
- content_for :head do
= javascript_include_tag 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false'
= form_for @supplier, url: supplier_update_settings_path, html: {class: 'form-horizontal'} do |f|
= render 'error_messages', target: current_supplier
.control-group class=(@supplier.errors[:name].any? ? 'error' : nil)
@@ -8,6 +11,10 @@
= f.label :email, class: 'control-label'
.controls
= f.text_field :email, class: 'text_field'
.control-group class=(@supplier.errors[:location].any? ? 'error' : nil)
= f.label :location, class: 'control-label'
.controls
= f.text_field :location, class: 'location_picker'
.control-group class=(@supplier.errors[:offer_wifi].any? ? 'error' : nil)
= f.label :offer_wifi, class: 'control-label'
.controls