add some styling on tables view
This commit is contained in:
@@ -15,7 +15,10 @@
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.2 r9819"
|
||||
sodipodi:docname="New document 1">
|
||||
sodipodi:docname="list.svg"
|
||||
inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qrammer/app/assets/images/icons/list.png"
|
||||
inkscape:export-xdpi="21.549999"
|
||||
inkscape:export-ydpi="21.549999">
|
||||
<defs
|
||||
id="defs4">
|
||||
<inkscape:perspective
|
||||
@@ -308,15 +311,6 @@
|
||||
id="linearGradient3924"
|
||||
xlink:href="#linearGradient3871"
|
||||
inkscape:collect="always" />
|
||||
<filter
|
||||
color-interpolation-filters="sRGB"
|
||||
id="filter3895"
|
||||
inkscape:collect="always">
|
||||
<feGaussianBlur
|
||||
id="feGaussianBlur3897"
|
||||
stdDeviation="1.1"
|
||||
inkscape:collect="always" />
|
||||
</filter>
|
||||
<linearGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
y2="2.4637082"
|
||||
@@ -365,16 +359,6 @@
|
||||
offset="1"
|
||||
style="stop-color:#ffffff;stop-opacity:0;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3871"
|
||||
id="linearGradient4130"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.0491242,0,0,1.0491242,2.5076726,905.23429)"
|
||||
x1="8"
|
||||
y1="73.737183"
|
||||
x2="86.24353"
|
||||
y2="2.4637082" />
|
||||
<filter
|
||||
color-interpolation-filters="sRGB"
|
||||
id="filter3895-8"
|
||||
@@ -427,9 +411,9 @@
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.8183506"
|
||||
inkscape:cx="161.95088"
|
||||
inkscape:cy="862.61299"
|
||||
inkscape:zoom="4.7229687"
|
||||
inkscape:cx="263.89128"
|
||||
inkscape:cy="751.15645"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
@@ -455,7 +439,7 @@
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<rect
|
||||
style="fill:none;stroke:#000000;stroke-width:1.04734886;stroke-opacity:1"
|
||||
style="fill:#ffffff;stroke:#000000;stroke-width:1.04734886000000005;stroke-opacity:1;fill-opacity:1"
|
||||
id="rect3051"
|
||||
width="99.144157"
|
||||
height="127.89697"
|
||||
@@ -668,13 +652,6 @@
|
||||
transform="translate(0,-13.399837)"
|
||||
width="744.09448"
|
||||
height="1052.3622" />
|
||||
<path
|
||||
sodipodi:type="inkscape:offset"
|
||||
inkscape:radius="-0.79549515"
|
||||
inkscape:original="M 60 22.375 L 30.25 52.125 C 31.759428 51.832546 33.268641 51.520491 34.78125 51.25 C 38.131586 50.650878 42.292564 50.001114 45.65625 49.5625 C 48.40866 49.203595 50.940177 48.935357 53.59375 48.78125 L 70 32.375 L 60 22.375 z M 20 42.375 L 10 52.375 L 14.03125 56.40625 C 19.237958 54.881463 24.442107 53.235169 29.78125 52.21875 C 29.80132 52.21495 29.82368 52.22255 29.84375 52.21875 L 20 42.375 z "
|
||||
style="fill:url(#linearGradient3859);fill-opacity:1;stroke:url(#linearGradient3861);stroke-width:0.26578051;filter:url(#filter3973)"
|
||||
id="path3949"
|
||||
d="M 60,23.5 32.65625,50.84375 c 0.663739,-0.129711 1.331286,-0.255418 2,-0.375 3.364578,-0.601669 7.526087,-1.246737 10.90625,-1.6875 2.645343,-0.344944 5.103246,-0.59175 7.65625,-0.75 L 68.875,32.375 60,23.5 z m -40,20 -8.875,8.875 3.15625,3.15625 C 18.877656,54.179274 23.499328,52.749738 28.25,51.75 L 20,43.5 z" />
|
||||
<g
|
||||
id="g3883"
|
||||
transform="matrix(0.55568429,0,0,0.55568429,218.60023,-273.39512)"
|
||||
|
||||
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 21 KiB |
@@ -13,8 +13,11 @@
|
||||
height="209.15388"
|
||||
id="svg3264"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.1 r9760"
|
||||
sodipodi:docname="book-grey.svg">
|
||||
inkscape:version="0.48.2 r9819"
|
||||
sodipodi:docname="menu.svg"
|
||||
inkscape:export-filename="/Users/bterkuile/companytools/development/rails/qrammer/app/assets/images/icons/menu.png"
|
||||
inkscape:export-xdpi="9.2299995"
|
||||
inkscape:export-ydpi="9.2299995">
|
||||
<defs
|
||||
id="defs3266" />
|
||||
<sodipodi:namedview
|
||||
@@ -35,9 +38,9 @@
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="525"
|
||||
inkscape:window-height="429"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="456"
|
||||
inkscape:window-height="454"
|
||||
inkscape:window-x="354"
|
||||
inkscape:window-y="313"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata3269">
|
||||
|
||||
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.8 KiB |
@@ -157,3 +157,11 @@ root.Qsupplier=
|
||||
row.append($('<td></td>').text(order_txts.join(', ')))
|
||||
row.append($('<td class="currency"></td>').html(currency(order.total_amount)))
|
||||
foot.append('<tr><td></td><td class="currency"><strong>'+currency(res.total_amount)+'</strong></td></tr>')
|
||||
update_section_tables_view: (section_id)->
|
||||
$.get(data_host + '/supplier/sections/'+section_id+'/tables_view.json', (res)->
|
||||
for table in res.tables
|
||||
to = $('#section-table-'+table._id)
|
||||
if table.occupied then to.addClass('occupied') else to.removeClass('occupied')
|
||||
if table.needs_help then to.addClass('needs_help') else to.removeClass('needs_help')
|
||||
if table.needs_payment then to.addClass('needs_payment') else to.removeClass('needs_payment')
|
||||
)
|
||||
|
||||
@@ -28,6 +28,15 @@
|
||||
.section-table
|
||||
position: absolute
|
||||
cursor: move
|
||||
&.occupied
|
||||
background-color: #ffa
|
||||
&.needs_help
|
||||
background-color: #7f7
|
||||
&.needs_payment
|
||||
background-color: #f77
|
||||
a
|
||||
&:hover
|
||||
text-decoration: none
|
||||
&.section-tables-inactive
|
||||
.section-table
|
||||
margin-top: 10px
|
||||
|
||||
@@ -103,7 +103,9 @@ module Suppliers
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @section }
|
||||
format.json do
|
||||
render json: @section.for_tables_as_json
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,6 +26,12 @@ class List
|
||||
}
|
||||
}|, reduce_function: '_sum'
|
||||
|
||||
view :active_by_section_id_view, type: :custom, map_function: %|function(doc){
|
||||
if(doc.ruby_class == 'List' && doc.state == 'active' && doc.section_id){
|
||||
emit(doc.section_id, 1);
|
||||
}
|
||||
}|, reduce_function: '_sum'
|
||||
|
||||
view :for_user_view, type: :custom, map_function: %|function(doc){
|
||||
if(doc.ruby_class == 'List' && doc.user_ids && doc.user_ids.length){
|
||||
doc.user_ids.forEach(function(uid){
|
||||
@@ -45,6 +51,10 @@ class List
|
||||
list
|
||||
end
|
||||
|
||||
def self.active_for_section(section_id, options = {})
|
||||
database.view(active_by_section_id_view(key: section_id, reduce: false, include_docs: true))
|
||||
end
|
||||
|
||||
def self.for_user(user, options = {})
|
||||
with_pagination_options(options) do |options|
|
||||
database.view(for_user_view({startkey: ["#{user.id}\u9999"], endkey: [user.id], include_docs: true, reduce: false, descending: true}.merge(options)))
|
||||
|
||||
@@ -22,6 +22,19 @@ class Section
|
||||
section
|
||||
end
|
||||
|
||||
def occupied_tables
|
||||
return @occupied_tables if @occupied_tables.present?
|
||||
@active_lists = List.active_for_section(self.id)
|
||||
@active_lists.include_relation(:table)
|
||||
@occupied_tables = @active_lists.map(&:table)
|
||||
end
|
||||
|
||||
def active_lists
|
||||
return @active_lists if @active_lists.present?
|
||||
@active_lists = List.active_for_section(self.id)
|
||||
end
|
||||
|
||||
|
||||
def width
|
||||
self.path.last.try(:first).to_f - self.path.first.try(:first).to_f
|
||||
end
|
||||
@@ -47,4 +60,22 @@ class Section
|
||||
path_will_change!
|
||||
end
|
||||
end
|
||||
|
||||
def as_json
|
||||
super.merge(width: width, height: height)
|
||||
end
|
||||
|
||||
def for_tables_as_json
|
||||
return @for_tables_as_json if @for_tables_as_json.present?
|
||||
h = as_json
|
||||
h[:tables] = []
|
||||
for table in tables
|
||||
ht = table.as_json
|
||||
ht[:occupied] = occupied_tables.include?(table)
|
||||
ht[:needs_help] = ht[:occupied] ? active_lists.find{|l| l.table_id == table.id}.try(:needs_help).present? : false
|
||||
ht[:needs_payment] = ht[:occupied] ? active_lists.find{|l| l.table_id == table.id}.try(:needs_payment).present? : false
|
||||
h[:tables] << ht
|
||||
end
|
||||
@for_tables_as_json = h
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,4 +17,6 @@
|
||||
active_section_container.find('.section-table').each(function(){
|
||||
Qsupplier.position_table_in_active_section(active_section_container, $(this), false);
|
||||
});
|
||||
Qsupplier.update_section_tables_view('#{@section.id}');
|
||||
setInterval("Qsupplier.update_section_tables_view('#{@section.id}')", 7500);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user