   formatFields: ->
     dateFormat = I18n.t('datepicker.pformat')
     timeFormat = I18n.t('timepicker.pformat')
-    timeType = @$('#work_job_time_type').val()
-    slotType = @$('#work_job_slot_type').val()
 
-    @toggleHoursPerShift(timeType == 'date_only' && slotType == 'full_multiple')
-    @togglePickers(timeType != 'full_period')
-    @toggleUnlimitedSlots(slotType != 'fixed')
+    @toggleHoursPerShift(@timeType() == 'date_only' && @slotType() == 'full_multiple')
+    @togglePickers(@timeType() != 'full_period')
+    @toggleUnlimitedSlots(@slotType() != 'fixed')
+    @computeHours()
 
-    # Set picker format depending on timeType
-    switch timeType
+    # Set picker format depending on @timeType()
+    switch @timeType()
       when 'date_time' then @setPickerFormat("#{dateFormat} #{timeFormat}")
       when 'date_only' then @setPickerFormat(dateFormat)
 

      @$('.shift-slots').map ->
        if parseInt($(this).val()) >= 1000000
          $(this).val('')

    'cocoon:after-insert': 'shiftInserted'
    'change #work_job_time_type': 'formatFields'
    'change #work_job_slot_type': 'formatFields'
    'change #work_job_hours': 'computeHours'
    'change #work_job_hours_per_shift': 'computeHours'
    'dp.change .input-group.datetimepicker': 'computeHours'

  shiftInserted: (event, inserted) ->
    @initDatePickers(inserted)
