Skip to content

Commit

Permalink
Merge f44e039 into fe8a182
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewJakubowicz committed Jul 26, 2018
2 parents fe8a182 + f44e039 commit 6b62fd6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
55 changes: 29 additions & 26 deletions app/templates/teachers/edit-student-modal.jade
Expand Up @@ -7,33 +7,36 @@ block modal-header-content

block modal-body-content

.text-center
//- TODO: enable after fixing expired license bug
//- .license-details
//- strong(data-i18n="teacher.license_status")
//- span.spr :
//- if view.user.prepaidStatus() !== 'enrolled'
//- .small-details
//- span(data-i18n="teacher.status_not_enrolled")
//- .small-details
//- if view.prepaids.totalAvailable() == 0
//- button.enroll-student-btn.btn.btn-navy.disabled(data-i18n="teacher.apply_license")
//- .small-details.not-enough-enrollments
//- span(data-i18n='teacher.not_enough_enrollments')
//- else
//- button.enroll-student-btn.btn.btn-navy(data-i18n="teacher.apply_license")
//- else
//- .small-details
//- if view.user.prepaidType() === 'course'
//- span.spr(data-i18n="teacher.full_license")
//- else if view.user.prepaidType() === 'starter_license'
//- span.spr(data-i18n="teacher.starter_license")
//- span (
//- span= view.studentStatusString(view.user)
//- span )
//- .small-details
//- button.revoke-student-btn.btn.btn-burgundy-alt(data-i18n="teacher.revoke_license")
- var status = view.user.prepaidStatus()
- var prepaidType = view.user.prepaidType()

.text-center
.license-details
strong(data-i18n="teacher.license_status")
span.spr :
if status == "not-enrolled"
.small-details
span(data-i18n="teacher.status_not_enrolled")
else
.small-details
if prepaidType === 'course'
span.spr(data-i18n="teacher.full_license")
else if prepaidType === 'starter_license'
span.spr(data-i18n="teacher.starter_license")
span (
span(class= status === 'expired' ? 'text-danger' : '')= view.studentStatusString()
span )
if status !== 'enrolled'
.small-details
if view.prepaids.totalAvailable() == 0
button.enroll-student-btn.btn.btn-navy.disabled(data-i18n="teacher.apply_license")
.small-details.not-enough-enrollments
span(data-i18n='teacher.not_enough_enrollments')
else
button.enroll-student-btn.btn.btn-navy(data-i18n="teacher.apply_license")
else
.small-details
button.revoke-student-btn.btn.btn-burgundy-alt(data-i18n="teacher.revoke_license")
.edit-student-details
strong(data-i18n="teacher.student_details")
span.spr :
Expand Down
10 changes: 7 additions & 3 deletions app/views/teachers/EditStudentModal.coffee
Expand Up @@ -36,6 +36,10 @@ module.exports = class EditStudentModal extends ModalView
@state.set({ errorMessage: error.message })
# TODO: Show an error. (password too short)

onLoaded: ->
@prepaids.reset(@prepaids.filter((prepaid) -> prepaid.status() is "available"))
super()

onClickSendRecoveryEmail: ->
email = @user.get('email')
auth.sendRecoveryEmail(email).then =>
Expand All @@ -56,9 +60,9 @@ module.exports = class EditStudentModal extends ModalView
noty text: msg, layout: 'center', type: 'error', killer: true, timeout: 3000
})

studentStatusString: (student) ->
status = student.prepaidStatus()
expires = student.get('coursePrepaid')?.endDate
studentStatusString: ->
status = @user.prepaidStatus()
expires = @user.get('coursePrepaid')?.endDate
date = if expires? then moment(expires).utc().format('ll') else ''
utils.formatStudentLicenseStatusDate(status, date)

Expand Down

0 comments on commit 6b62fd6

Please sign in to comment.