refactor: fixed the accidentally removed code in RequestInvite

This commit is contained in:
Anand Chitipothu
2021-05-06 21:05:08 +05:30
parent 358724bf1c
commit 92c4a86e8b

View File

@@ -3,30 +3,44 @@
<div class="col-md"> <div class="col-md">
<input class="form-control w-100 mr-5 mb-5 mt-2" id="invite_email" type="email" placeholder="Email Address"> <input class="form-control w-100 mr-5 mb-5 mt-2" id="invite_email" type="email" placeholder="Email Address">
</div> </div>
<div class="col-md"> <div class="col-md">
<a type="submit" id="submit-invite-request" class="btn btn-primary btn-lg" href="#" role="button">Request Invite</a> <a type="submit" id="submit-invite-request" class="btn btn-primary btn-lg" href="#" role="button">Request Invite</a>
</div>
</div> </div>
</div>
</form> </form>
<script> <script>
frappe.ready(() => { frappe.ready(() => {
$("#submit-invite-request").click(function () { $("#submit-invite-request").click(function () {
frappe.call({ var invite_email = $("#invite_email").val()
method: "community.lms.doctype.invite_request.invite_request.create_invite_request", frappe.call({
args: { method: "community.lms.doctype.invite_request.invite_request.create_invite_request",
invite_email: $("#invite_email").val() args: {
}, invite_email: invite_email
callback: (data) => { },
if (data.message == "OK") { callback: (data) => {
$("#invite-request-form").hide(); $("#invite-request-form").hide();
var message = `<div>
<p class="lead alert alert-message">Thanks for your interest in Mon School. We have recorded your interest and we will get back to you shortly.</p> if (data.message == "OK") {
</div>`; var message = `<div>
<p class="lead alert alert-secondary">Thanks for your interest in Mon School. We have recorded your interest and we will get back to you shortly.</p>
</div>`;
}
else if (data.message == "invite") {
var message = `<div>
<p class="lead alert alert-secondary">Email ${invite_email} has already been used to request an invitation.</p>
</div>`;
}
else if (data.message == "user") {
var message = `<div>
<p class="lead alert alert-secondary">Looks like there is already an account with email ${invite_email}. Would you like to <a href="/login">login</a>?</p>
</div>`;
}
$(".jumbotron").append(message); $(".jumbotron").append(message);
} }
} })
}) })
}) })
})
</script> </script>