App.MenuProductCategoriesComponent = Ember.Component.extend
  orderProducts: false
  #minute_of_day: 0 # invalidation param
  active_product_categories: (->
    console.log "Reevaluate product categories"
    list = @get('product_categories')
    return [] unless list
    now = new Date()
    list = list.filter (product_category) =>
      return false unless product_category.get("active_on_#{$day_names[now.getDay()]}")
      return true if product_category.get('full_day')
      product_category.get('start_from') <= @get('clock.minute_of_day') and @get('clock.minute_of_day') <= product_category.get('end_on')
    list.sortBy('position')
  ).property('product_categories.[]', 'clock.minute_of_day')

  actions:
    toggleProductCategory: (product_category) -> product_category.toggleProperty('collapsed')
