79 lines
2.5 KiB
CoffeeScript
79 lines
2.5 KiB
CoffeeScript
context = window
|
|
teacherActions = window.JK.Actions.Teacher
|
|
logger = context.JK.logger
|
|
rest = window.JK.Rest()
|
|
|
|
@TeacherSetupPricing = React.createClass({
|
|
mixins: [
|
|
@TeacherSetupMixin,
|
|
Reflux.listenTo(@AppStore,"onAppInit"),
|
|
Reflux.listenTo(TeacherStore, "onTeacherStateChanged")
|
|
]
|
|
|
|
getInitialState: () ->
|
|
{}
|
|
|
|
screenName: () ->
|
|
"pricing"
|
|
|
|
onTeacherStateChanged: (changes) ->
|
|
$root = jQuery(this.getDOMNode())
|
|
logger.debug("onTeacherPricingStateChanged", changes, changes.errors?, changes.errors)
|
|
unless this.handleErrors(changes)
|
|
teacher = changes.teacher
|
|
logger.debug("@teacher", teacher)
|
|
this.setState({
|
|
biography: teacher.biography,
|
|
introductory_video: teacher.introductory_video,
|
|
years_teaching: teacher.years_teaching,
|
|
years_playing: teacher.years_playing,
|
|
validate_pricing: true
|
|
})
|
|
|
|
captureFormState: (changes) ->
|
|
$root = jQuery(this.getDOMNode())
|
|
this.setState({
|
|
biography: $root.find(".teacher-biography").val(),
|
|
introductory_video: $root.find(".teacher-introductory-video").val(),
|
|
years_teaching: $root.find(".years-teaching-experience").val(),
|
|
years_playing: $root.find(".years-playing-experience").val()
|
|
});
|
|
logger.debug("capturedFormState", this.state, changes)
|
|
|
|
navDestination: (instructions) ->
|
|
navTo=null
|
|
if instructions?
|
|
logger.debug("handling instructions", instructions)
|
|
if instructions.direction=="cancel"
|
|
navTo = @teacherSetupSource()
|
|
else if instructions.direction=="back"
|
|
navTo = @teacherSetupDestination("experience")
|
|
else if instructions.direction=="next"
|
|
# We are done:
|
|
navTo = @teacherSetupSource()
|
|
|
|
navTo
|
|
|
|
handleNav: (e) ->
|
|
logger.debug("handleNav #{this.screenName()}: ", this.state, this, e)
|
|
navTo = this.navDestination(e)
|
|
teacherActions.change.trigger(this.state, {navTo: navTo})
|
|
|
|
render: () ->
|
|
logger.debug("RENDERING TeacherSetupPricing", this.props, this.state)
|
|
instrumentsTaughtCheckboxes = []
|
|
#instrumentsTaughtCheckboxes.push(`<input />`)
|
|
|
|
`<div className="TeacherSetupPricing TeacherSetupComponent" >
|
|
<div className="teacher-quarter-column left">
|
|
<div className="teacher-field" name="instruments_taught">
|
|
<label for="teacher-instruments-taught">Instruments Taught:</label>
|
|
<div className="checkbox-scroller">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<TeacherSetupNav handleNav={this.handleNav}/>
|
|
</div>`
|
|
|
|
|
|
}) |