context = window SchoolStore = context.SchoolStore @InviteSchoolUserDialog = React.createClass({ mixins: [Reflux.listenTo(@AppStore, "onAppInit"), Reflux.listenTo(SchoolStore, "onSchoolChanged")] teacher: false beforeShow: (args) -> logger.debug("InviteSchoolUserDialog.beforeShow", args.d1) @firstName = '' @lastName = '' @email = '' @setState({inviteErrors: null, teacher: args.d1}) afterHide: () -> onSchoolChanged: (schoolState) -> @setState(schoolState) onAppInit: (@app) -> dialogBindings = { 'beforeShow': @beforeShow, 'afterHide': @afterHide }; @app.bindDialog('invite-school-user', dialogBindings); componentDidMount: () -> @root = $(@getDOMNode()) getInitialState: () -> {inviteErrors: null, school: null, sending: false} doCancel: (e) -> e.preventDefault() @app.layout.closeDialog('invite-school-user', true); doInvite: (e) -> e.preventDefault() if this.state.sending console.log("sending already") return email = @root.find('input[name="email"]').val() lastName = @root.find('input[name="last_name"]').val() firstName = @root.find('input[name="first_name"]').val() school = context.SchoolStore.getState().school @setState({inviteErrors: null, sending: true}) rest.createSchoolInvitation({ id: school.id, as_teacher: this.state.teacher, email: email, last_name: lastName, first_name: firstName }).done((response) => @createDone(response)).fail((jqXHR) => @createFail(jqXHR)) createDone: (response) -> console.log("invitation added", response) @setState({inviteErrors:null, sending: false}) context.SchoolActions.addInvitation(this.state.teacher, response) context.JK.Banner.showNotice("invitation sent", "Your invitation has been sent!") @app.layout.closeDialog('invite-school-user') createFail: (jqXHR) -> handled = false if jqXHR.status == 422 errors = JSON.parse(jqXHR.responseText) @setState({inviteErrors: errors, sending: false}) handled = true if !handled @app.ajaxError(jqXHR, null, null) renderEducation: () -> `
Please copy and paste the text below into the email application you use to communicate with students and parents in your music program. This is a suggested starting point, but you may edit the message as you prefer. Please make sure the web page link in this message is included in the email you send and is unchanged because students must use this specific link to sign up so that they will be properly associated with your school.
Send invitations to teachers who teach through your music school. Teachers who accept your invitation will be associated with your music school. Any revenues we collect for lessons delivered by these teachers will be processed such that we remit your school's share of these revenues to you, and you will then be responsible to distribute the teacher's share of these revenues, per the JamKazam terms of service. You will also have the option to manage scheduling of lessons for students sourced to the teacher from the JamKazam marketplace.
` else title = 'invite student' help = `Send invitations to students who you have acquired through your own marketing initiatives (versus students JamKazam has brought to you). We will not bill these students for lessons, or will we withhold portions of such billings. All billing and management of your own students remains yours to manage, per the JamKazam terms of service.
` `