@LessonBookingDecision = React.createClass({ #slot.creatorRole #slot.slotTime # props.initial # props.counter # props.slots # props.is_recurring # props.slot_decision # props.otherRole # props.cancelErrors # props.counterErrors mixins: [ ICheckMixin, ] propTypes: { onSlotDecision: React.PropTypes.func.isRequired onUserCancel: React.PropTypes.func.isRequired onUserDecision: React.PropTypes.func.isRequired } getInitialState: () -> { slot_decision: null } componentWillMount: () -> @days = [] @days.push(``) @days.push(``) @days.push(``) @days.push(``) @days.push(``) @days.push(``) @days.push(``) @days.push(``) @hours = [] for hour in ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] if hour == '12' key = '00' else key = hour @hours.push(``) @minutes = [] for minute in ['00', '15', '30', '45'] @minutes.push(``) @am_pm = [``, ``] componentDidMount: () -> @checkboxes = [{selector: 'input.slot-decision', stateKey: 'slot-decision'}] @root = $(@getDOMNode()) @iCheckify() componentDidUpdate: () -> @iCheckify() @slotDate = @root.find('.date-picker') @slotDate.datepicker({ dateFormat: "D M d yy", onSelect: ((e) => @toggleDate(e)) }) checkboxChanged: (e) -> checked = $(e.target).is(':checked') value = $(e.target).val() @props.onSlotDecision({slot_decision: value}) onUserDecision: (e) -> e.preventDefault() if this.props.disabled return this.props.onUserDecision(this.state.slot_decision) onUserCancel: (e) -> e.preventDefault() if this.props.disabled return this.props.onUserCancel() dayOfWeek: (slot) -> switch slot.day_of_week when 0 then "Sunday" when 1 then "Monday" when 2 then "Tuesday" when 3 then "Wednesday" when 4 then "Thursday" when 5 then "Friday" when 6 then "Saturday" slotLabelText: (index, slot) -> if @props.counter "Accept #{slot.creatorRoleRelative} proposed day/time" else if index == 0 "Accept #{slot.creatorRoleRelative} preferred day/time" else "Accept #{slot.creatorRoleRelative} secondary day/time" showDeclineVerb: () -> this.props.initial && this.props.otherRole == 'student' render: () -> if (!this.props.initial && !this.props.counter) || this.props.selfLastToAct userPromptHeader = `