diff --git a/web/app/assets/javascripts/react-components/TeacherSetupPricing.js.jsx.coffee b/web/app/assets/javascripts/react-components/TeacherSetupPricing.js.jsx.coffee index e41318325..4d8524087 100644 --- a/web/app/assets/javascripts/react-components/TeacherSetupPricing.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/TeacherSetupPricing.js.jsx.coffee @@ -111,8 +111,12 @@ rest = window.JK.Rest() navTo = this.navDestination(e) teacherActions.change.trigger(this.state, {navTo: navTo}) + handleFocus: (e) -> + @pricePerLessonCents=e.target.value + handleTextChange: (e) -> - this.setState({"#{e.target.name}": e.target.value}) + @pricePerLessonCents=e.target.value + this.forceUpdate() handleCheckChange: (e) -> this.setState({"#{e.target.name}": e.target.checked}) @@ -122,13 +126,27 @@ rest = window.JK.Rest() priceRows = [] logger.debug("Current State is", this.state) for minutes in [30, 45, 60, 90, 120] - pricePerLessonCents = context.JK.ProfileUtils.normalizeMoneyForDisplay(this.state["price_per_lesson_"+minutes+"_cents"]) - pricePerMonthCents = context.JK.ProfileUtils.normalizeMoneyForDisplay(this.state["price_per_month_"+minutes+"_cents"]) pricePerLessonName = "price_per_lesson_#{minutes}_cents" pricePerMonthName = "price_per_month_#{minutes}_cents" priceKey = "lesson_duration_#{minutes}" inputName = "#{priceKey}_input" containerName = "#{priceKey}_container" + + # If we are currently editing, don't format; used cache value: + if $("[name='#{pricePerLessonName}']", @root).is(":focus") + pricePerLessonCents = @pricePerLessonCents + else + ppl_fld_name="price_per_lesson_"+minutes+"_cents" + pricePerLessonCents = context.JK.ProfileUtils.normalizeMoneyForDisplay(this.state[ppl_fld_name]) + + + # If we are currently editing, don't format; used cache value: + if $("[name='#{pricePerMonthName}']", @root).is(":focus") + pricePerMonthCents = @pricePerMonthCents + else + pricePerMonthCents = context.JK.ProfileUtils.normalizeMoneyForDisplay(this.state["price_per_month_"+minutes+"_cents"]) + + priceRows.push `
@@ -149,15 +167,37 @@ rest = window.JK.Rest()
-
+
-
- +
+ +
- + +