many important fixes

This commit is contained in:
2020-02-29 11:43:00 -05:00
parent 2149345d3d
commit 73c207c324
28 changed files with 1463 additions and 242 deletions
+2
View File
@@ -12,3 +12,5 @@
//= link supplier/app/application.js
//
//= link qr_sheet/application.css
//
//= link user/foundation/application.css
@@ -12,12 +12,14 @@ $side-menu-width: 222px
border-right: 2px solid black
&.active
left: 0
+animation(sideMenuActive 0.5s)
animation-name: sideMenuActive
animation-duration: 0.5s
.toggle-side-menu
right: 5px
&.closed
&.clicked
+animation(sideMenuClosed 0.3s)
animation-name: sideMenuClosed
animation-duration: 0.3s
> ul
list-style: none
a
@@ -65,12 +67,12 @@ $side-menu-width: 222px
@extend .fa-lg
@extend .fa-bars
+keyframes(sideMenuActive)
@keyframes(sideMenuActive)
from
left: -$side-menu-width
to
left: 0
+keyframes(sideMenuClosed)
@keyframes(sideMenuClosed)
from
left: 0
to
@@ -16,11 +16,12 @@ $scanning-code-height: $scanning-code-width/0.785
position: absolute
height: $scanning-code-height
border-right: 2px solid #f00
+animation(scanning 1s infinite)
+animation-direction(alternate)
+animation-timing-function(linear)
animation-name: scanning
animation-duration: 1s infinite
animation-direction: alternate
animation-timing-function: linear
+keyframes(scanning)
@keyframes(scanning)
from
left: 0
to
+1 -1
View File
@@ -27,7 +27,7 @@ class DashboardController < ApplicationController
if Rails.env.test?
@tables = Table.all
else
@tables = List.active.map(&:table) | Supplier.find_by_name('Mozo').tables.select{|t| t.number.between? 20, 500}.sample(3)
@tables = List.active.map(&:table) | Supplier.find_by_name('Labrador').tables.select{|t| t.number.between? 20, 500}.sample(3)
end
respond_to do |format|
format.html { render layout: 'phone' }
@@ -6,10 +6,12 @@ module Users
private
def user_authentication
if params[:auth_token].present?
user = User.find_by_authentication_token(params[:auth_token])
sign_in user if user
sign_out current_user if current_user && !user # Other token attempt of logged in user
auth_token = params[:auth_token].presence || request.headers['HTTP_AUTH_TOKEN'].presence
if auth_token.present?
user = User.find_by_authentication_token(auth_token)
#sign_out current_user if current_user && !user # Other token attempt of logged in user
bypass_sign_in user if user
elsif request.format.html?
return if Rails.env.test? and action_name == 'index'
authenticate_user!
@@ -39,6 +41,7 @@ module Users
case params[:product_orders]
when String then JSON.parse(params[:product_orders]) rescue []
when Hash then params[:product_orders].values
when Array then params[:product_orders]
else
[]
end
@@ -2,6 +2,7 @@ module Users
class ListsController < Users::ApplicationController
def index
return current if params[:currentList].present?
#lists = current_user.lists.include_relation(:supplier, :table)
lists = List.for_user(current_user, page: params[:page], per_page: params[:per_page].presence || 25)
#lists.include_relation(:supplier)
@@ -25,6 +26,13 @@ module Users
render json: @table
end
def orders
@list = List.find(params[:id])
return render json: {ok: false, status: 403}, status: 403 unless @list.user_ids.include?(current_user.id)
@list.orders.include_relations(:product_orders)
render json: @list.orders, serializer: Users::OrderSerializer, is_collection: true, include: %w[product_orders]
end
def show
@list ||= List.find(params[:id]) if params[:id]
render json: {}, status: :not_found and return unless @list.present? && Array.wrap(@list.user_ids).include?(current_user.id)
+1 -1
View File
@@ -24,7 +24,7 @@ module ApplicationHelper
def user_root_path
case Rails.env
when 'development' then 'http://localhost:4200/'
when 'development' then 'http://localhost:4201/'
else '/user/index.html'
end
end
+1 -1
View File
@@ -6,7 +6,7 @@ class Users::ListSerializer
:is_paid, :price, :closed_at
has_many :users, serializer: Users::UserSerializer
has_many(:orders, serializer: Users::OrderSerializer)
has_many :orders, serializer: Users::OrderSerializer
has_many :join_requests, serializer: Users::JoinRequestSerializer
has_one :supplier, serializer: Users::SupplierSerializer
has_one :table, serializer: Users::TableSerializer
@@ -1,6 +1,6 @@
class Users::ProductOrderSerializer
include Qwaiter::UserBaseSerializer
attributes :quantity, :price, :product_name, :product_variant
# belongs_to :product #DO NOT USE THIS, THIS IS NOT NEEDED
# belongs_to :product #DO NOT USE THIS, THIS IS NOT NEEDED, already included in /tables/:id/supplier
has_one :order, serializer: Users::OrderSerializer
end
+8 -2
View File
@@ -1,5 +1,11 @@
.phone-wrapper
iframe.phone-content-frame src=user_root_path
- if Rails.env.development?
iframe.phone-content-frame src="http://localhost:4201/"
- else
iframe.phone-content-frame src=user_root_path
.tablet-wrapper
iframe.tablet-content-frame src=supplier_root_path
- if Rails.env.development?
iframe.tablet-content-frame src="http://localhost:4202/supplier/"
- else
iframe.tablet-content-frame src=supplier_root_path