Fix employee loading and schedule stuff for supplier

This commit is contained in:
2015-10-07 18:25:31 +02:00
parent 546e1fe10d
commit ec323746fd
6 changed files with 8 additions and 10 deletions
@@ -5,13 +5,12 @@ App.EmployeeShift = DS.Model.extend
description: attr('string') description: attr('string')
employee: DS.belongsTo 'employee', async: false employee: DS.belongsTo 'employee', async: false
supplier: DS.belongsTo 'supplier', async: false supplier: DS.belongsTo 'supplier', async: false
calendar_event: (-> calendar_event: Ember.computed 'start_from', 'end_on', 'title', 'employee.color', ->
id: @id id: @id
title: @get('title') title: @get('title')
start: @get('start_from') start: @get('start_from')
end: @get('end_on') end: @get('end_on')
color: @get('employee.color') color: @get('employee.color')
).property('start_from', 'end_on', 'title')
title: Ember.computed 'employee.name', 'description', -> title: Ember.computed 'employee.name', 'description', ->
if @get('description') if @get('description')
@@ -1,2 +1,2 @@
App.EmployeesRoute = Ember.Route.extend App.EmployeeActionsMixin, App.EmployeesRoute = Ember.Route.extend App.EmployeeActionsMixin,
model: -> @store.findAll 'employee' model: -> @store.findAll 'employee', reload: false
@@ -1,2 +1,4 @@
App.ScheduleRoute = Ember.Route.extend App.ScheduleRoute = Ember.Route.extend
beforeModel: ->
@store.findAll 'employee', reload: false
model: -> @store.findAll 'employee-shift' model: -> @store.findAll 'employee-shift'
@@ -2,19 +2,19 @@ module Suppliers
class EmployeeShiftsController < Suppliers::ApplicationController class EmployeeShiftsController < Suppliers::ApplicationController
def index def index
@employee_shifts = EmployeeShift.for_supplier(current_supplier, relevant_from: 1.week.ago) @employee_shifts = EmployeeShift.for_supplier(current_supplier, relevant_from: 1.week.ago)
@employee_shifts.include_relations(:employee, :supplier) #@employee_shifts.include_relations(:employee, :supplier)
# Only select shifts from currently linked and employees # Only select shifts from currently linked and employees
@employee_shifts.select! do |shift| @employee_shifts.select! do |shift|
return false unless current_supplier.employee_ids.include?(shift.employee.try(:id)) return false unless current_supplier.employee_ids.include?(shift.employee.try(:id))
shift.employee.enrich_with_settings current_supplier.settings_for(shift.employee) shift.employee.enrich_with_settings current_supplier.settings_for(shift.employee)
true true
end end
render json: @employee_shifts, include: %w[employee] render json: @employee_shifts
end end
def create def create
@employee_shift.supplier = current_supplier @employee_shift.supplier = current_supplier
@employee_shift.save @employee_shift.save
render json: @employee_shift, include: %w[employee] render json: @employee_shift
end end
def update def update
+1 -4
View File
@@ -3,15 +3,12 @@ Release
Release todos: Release todos:
-------------- --------------
- Drag drop on tablet persisting
- Release android version of MozoUser
- Printer paperclip 5 minute setup story - Printer paperclip 5 minute setup story
- Maybe responsive supplier dashboard
- facebook api integration on homepage share picture and js - facebook api integration on homepage share picture and js
- Signup explanation better and link to current supplier when already - Signup explanation better and link to current supplier when already
signed in signed in
- Add got it button to bottom of supplier User info modal - Add got it button to bottom of supplier User info modal
- User move table alert flash_message - User move table alert flash_message for suppliers
- When an employee schedule is added the color is not immediate taken - When an employee schedule is added the color is not immediate taken
from the selected employee from the selected employee
- User app authorizations - User app authorizations