General functionality improvement
This commit is contained in:
@@ -14,7 +14,7 @@ Qsupplier.App.List = DS.Model.extend
|
||||
price: attr 'number'
|
||||
closed_at: DS.attr('date')
|
||||
#table_number: attr 'number'
|
||||
#table: DS.belongsTo('table', inverse: 'active_list')
|
||||
table: DS.belongsTo('table', inverse: 'active_list')
|
||||
#users: DS.hasMany('user', inverse: 'active_list')
|
||||
orders: DS.hasMany('order')
|
||||
section: DS.belongsTo('section')
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
.display-row
|
||||
.display-label=t 'attributes.list.created_at'
|
||||
.display-field=time list.created_at
|
||||
.display-row
|
||||
.display-label=t 'attributes.list.state'
|
||||
.display-field=state 'list' list.state
|
||||
each user in list.users
|
||||
img.facebook-image src="http://graph.facebook.com/#{unbound user.facebook_id}/picture?type=square" alt="f"
|
||||
if list.orders
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.row
|
||||
h2=t 'models.list'
|
||||
partial "list_content"
|
||||
link-to 'lists'
|
||||
span Go to lists
|
||||
link-to 'lists' class="button"
|
||||
span=t 'list.go_to_lists'
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
App.ApplicationController = Ember.Controller.extend
|
||||
join_request_sent: false
|
||||
notice: ''
|
||||
actions:
|
||||
confirmCancel: ->
|
||||
@@ -39,11 +40,22 @@ App.ApplicationController = Ember.Controller.extend
|
||||
join_request = @store.createRecord 'join_request', data.join_request
|
||||
@transitionToRoute 'join_requests'
|
||||
join_request_rejected: (data)->
|
||||
# Remove join request from connected users
|
||||
join_request = @store.all('join_request').findBy 'id', data.id
|
||||
join_request.eraseRecord() if join_request
|
||||
|
||||
# Notify requestor in a proper manner
|
||||
# NOTE data.id is in the form of: jr-:user_id
|
||||
requestor_id = data.id.substr(3)
|
||||
if requestor_id is Qstorage.getItem('user_id')
|
||||
@set 'notice', t('join_request.requestor.join_request_rejected')
|
||||
@set 'join_request_sent', false
|
||||
|
||||
join_request_approved: ->
|
||||
@setCurrentList ->
|
||||
@transitionToRoute 'active_list'
|
||||
@transitionToRoute('active_list').then =>
|
||||
@set 'notice', t('join_request.requestor.join_request_approved')
|
||||
|
||||
list_changed_table: ->
|
||||
@setCurrentList()
|
||||
|
||||
@@ -69,4 +81,4 @@ App.ApplicationController = Ember.Controller.extend
|
||||
@set 'list', null
|
||||
@store.find('list', 'current').then(success, error)
|
||||
didInsertElement: (e)->
|
||||
debugger
|
||||
#debugger
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
App.TableController = Ember.ObjectController.extend
|
||||
join_request_sent: false
|
||||
join_request_sent: (-> @get('controllers.application.join_request_sent')).property('controllers.application.join_request_sent')
|
||||
tableCanTakeOrders: (->
|
||||
return false unless @get('supplier.can_take_orders')
|
||||
list = @get('controllers.application.list')
|
||||
@@ -14,7 +14,7 @@ App.TableController = Ember.ObjectController.extend
|
||||
showJoinButton: (->
|
||||
return false unless @get('supplier.can_take_orders')
|
||||
return false if @get('controllers.application.list') # if you already have an active list, do not join another
|
||||
if @get('model.occupied') then true else false
|
||||
if @get('model.occupied') then true else false # no point in joining tables that are not occupied
|
||||
).property('controllers.application.list.id', 'supplier.can_take_orders', 'model.occupied', 'model.id', 'controllers.application.list.table.id')
|
||||
actions:
|
||||
addProduct: (product)->
|
||||
@@ -25,7 +25,7 @@ App.TableController = Ember.ObjectController.extend
|
||||
joinOccupiedTable: ->
|
||||
#@secured =>
|
||||
Ember.$.post('/user/join_occupied_table.json', table_id: @get('model.id'))
|
||||
@set 'join_request_sent', true # keeps the button deactivated
|
||||
@set 'controllers.application.join_request_sent', true # keeps the button deactivated
|
||||
toggleProductCategory: (product_category)->
|
||||
product_category.set 'collapsed', not product_category.get('collapsed')
|
||||
showProductDescription: (product)->
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
.lists-overview-entry
|
||||
+grid-column(12)
|
||||
cursor: pointer
|
||||
@media #{$medium-only}
|
||||
+grid-column(6)
|
||||
@media #{$large-up}
|
||||
|
||||
@@ -3,7 +3,9 @@ module Suppliers
|
||||
# GET /lists
|
||||
# GET /lists.json
|
||||
def index
|
||||
if params[:date].present?
|
||||
if params[:state] == 'active'
|
||||
@lists = List.active_for_supplier(current_supplier, page: params[:page], per_page: params[:per_page] || 25)
|
||||
elsif params[:date].present?
|
||||
@date = params[:date].present? ? (Date.parse(params[:date]) rescue Date.today) : Date.today
|
||||
@time = @date.to_time(:utc)
|
||||
@start_time = @time.beginning_of_day
|
||||
|
||||
@@ -99,6 +99,7 @@ class List
|
||||
end
|
||||
|
||||
def self.active_for_supplier(supplier_id, options = {})
|
||||
supplier_id = supplier_id.id if supplier_id.is_a?(Supplier)
|
||||
database.view(active_by_supplier_id_view(key: supplier_id, reduce: false, include_docs: true))
|
||||
end
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
/jQuery(function(){
|
||||
/Qsupplier.load_list('#{@list.id}');
|
||||
/})
|
||||
.test-div
|
||||
/.test-div
|
||||
span.fa.fa-square-o.fa-2x
|
||||
span.fa-stack
|
||||
i.fa.fa-square-o.fa-stack-2x
|
||||
|
||||
Reference in New Issue
Block a user