| {% macro hero(title, description, has_access, back) %} |
| <div class='container pb-5'> |
| <a href="{{ back.url }}" class="text-muted"> |
| {{_('Back to')}} {{ _(back.name) }} |
| <p class='lead' style="max-width: 100%;">{{ description or ''}}</p> |
| {% if frappe.session.user == 'Guest' %} |
| <a id="signup" class="btn btn-primary btn-lg" href="/login#signup">{{_('Sign Up')}}</a> |
| {% elif not has_access %} |
| <button id="enroll" class="btn btn-primary btn-lg" onclick="enroll()" disabled>{{_('Enroll')}}</button> |
| <script type="text/javascript"> |
| btn = document.getElementById('enroll'); |
| if (btn) btn.disabled = false; |
| let params = frappe.utils.get_query_params() |
| let btn = document.getElementById('enroll'); |
| btn.innerText = __('Enrolling...') |
| method: 'erpnext.education.utils.enroll_in_program', |
| program_name: params.program |
| frappe.call(opts).then(res => { |
| let success_dialog = new frappe.ui.Dialog({ |
| secondary_action: function() { |
| success_dialog.set_message(__('You have successfully enrolled for the program ')); |
| success_dialog.$message.show() |