##= require_self
##= require ./Popover
##= require ./WeekSummary
##= require ./Entries
##= require ./Header
class Skr.Screens.TimeTracking extends Skr.Screens.Base
dataObjects:
entries: ->
new Skr.Screens.TimeTracking.Entries
onDayClick: (ev, date) ->
@showPopup(ev, date)
showPopup: (ev, date, eventEditing = false) ->
rect = _.dom(this).el.getBoundingClientRect()
@entries.editing = {
event: eventEditing,
date: date, bounds: rect,
position: {x: ev.clientX - rect.left, y: ev.clientY - rect.top}
}
onEventClick: (ev, event) ->
@showPopup(ev, event.start(), event)
stopEdit: ->
@entries.editing = false
onEventResize: (ev, event) ->
entry = event.get('entry')
entry.setTimeFromCalEvent(event)
entry.save() unless entry.isNew()
renderSummaryDays: ->
return null unless @entries.isMonth
for week in [1..5]