Skip to content

Instantly share code, notes, and snippets.

@pavelgordon
Created July 14, 2016 12:39
Show Gist options
  • Save pavelgordon/b8096103582505a64abf89cb5f171f0d to your computer and use it in GitHub Desktop.
Save pavelgordon/b8096103582505a64abf89cb5f171f0d to your computer and use it in GitHub Desktop.
init_cell = (row_number, col_number, prop) ->
if row_number == undefined || col_number == undefined
return
day_number = col_number + 1
row = table_data.get_row_by_index row_number
if row == undefined
return
day = row.get_day day_number
cellProperties = {}
# if col_number is last column( with total hours)
if col_number == columns.length - 1
if row.type == 'project' #TODO replace by IS_PROJECT
cellProperties.renderer = Extra.projectHighlight.renderer
cellProperties.readOnly = true
else
cellProperties.renderer = Extra.totalHours.renderer table_data
return cellProperties
if (row['end_day'] != undefined && col_number >= row['end_day']) ||
(row['start_day'] != undefined && col_number + 2 <= row['start_day'])
return {
renderer: Extra.fired.renderer
editor: false
readOnly: true
}
cellProperties.comment = day.comment
cellProperties.renderer = switch day.event_id
when m_events.BUSINESS_TRIP then Extra.businesstrip.renderer
when m_events.ON_CALL_DUTY then Extra.oncallduty.renderer
when m_events.OVERTIME_WORK then Extra.overtimework.renderer
when m_events.SICK_LEAVE then Extra.sickleave.renderer
when m_events.VACATION then Extra.vacation.renderer
when m_events.UNPAID_LEAVE then Extra.unpaidleave.renderer
when m_events.HOME_OFFICE then Extra.homeoffice.renderer
if day.event_id == undefined || day.event_id == null
if day_number in getWeekends(currentYear, currentMonth)
cellProperties.renderer = Extra.highlightWeekends.renderer
if day_number in Extradata.holidays
cellProperties.renderer = Extra.highlightHolidays.renderer
if row.type == 'project' #TODO replace by IS_PROJECT
cellProperties.renderer = Extra.projectHighlight.renderer
cellProperties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment