mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: added error handling in precheckin send invitation
This commit is contained in:
@@ -634,6 +634,6 @@ class PortalPrecheckin(CustomerPortal):
|
||||
)
|
||||
firstname = kw["firstname"]
|
||||
email = kw["email"]
|
||||
checkin_partner.write({"firstname": firstname, "email": email})
|
||||
checkin_partner.send_portal_invitation_email(firstname, email)
|
||||
# request.portal_my_folio_precheckin(kw)
|
||||
if firstname and email:
|
||||
checkin_partner.write({"firstname": firstname, "email": email})
|
||||
checkin_partner.send_portal_invitation_email(firstname, email)
|
||||
|
||||
@@ -28,14 +28,40 @@ odoo.define("pms.SendInvitationData", function (require) {
|
||||
.parent()
|
||||
.find("input[name=invitation_email]")
|
||||
.val();
|
||||
this._rpc({
|
||||
route: "/my/precheckin/send_invitation",
|
||||
params: {
|
||||
checkin_partner_id: checkinPartnerId,
|
||||
firstname: firstname,
|
||||
email: email,
|
||||
},
|
||||
});
|
||||
var error_firstname = $(ev.currentTarget)
|
||||
.parent()
|
||||
.parent()
|
||||
.find("span:first");
|
||||
var error_email = $(ev.currentTarget)
|
||||
.parent()
|
||||
.parent()
|
||||
.find("input[name=invitation_email]")
|
||||
.siblings("span");
|
||||
console.log(error_firstname);
|
||||
console.log(error_email);
|
||||
if (firstname === "" || email === "") {
|
||||
if (firstname === "") {
|
||||
error_firstname.removeClass("d-none");
|
||||
} else {
|
||||
error_firstname.addClass("d-none");
|
||||
}
|
||||
if (email === "") {
|
||||
error_email.removeClass("d-none");
|
||||
} else {
|
||||
error_email.addClass("d-none");
|
||||
}
|
||||
} else {
|
||||
error_firstname.addClass("d-none");
|
||||
error_email.addClass("d-none");
|
||||
this._rpc({
|
||||
route: "/my/precheckin/send_invitation",
|
||||
params: {
|
||||
checkin_partner_id: checkinPartnerId,
|
||||
firstname: firstname,
|
||||
email: email,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
return publicWidget.registry.SendInvitationData;
|
||||
|
||||
@@ -927,6 +927,11 @@
|
||||
t-attf-class="form-control"
|
||||
t-att-value="firstname or (checkin_partner.firstname)"
|
||||
/>
|
||||
<span
|
||||
style="color:red"
|
||||
class="d-none"
|
||||
t-att-id="error_inv_firstname"
|
||||
>Mandatory Firstname</span>
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-4 p-2"
|
||||
@@ -939,12 +944,16 @@
|
||||
Email
|
||||
</label>
|
||||
<input
|
||||
id="invitation_email"
|
||||
t-att-id="'invitation_email'+str(checkin_partner.id)"
|
||||
type="email"
|
||||
t-att-name="'invitation_email'"
|
||||
t-attf-class="form-control "
|
||||
t-att-value="invitation_email or checkin_partner.email"
|
||||
/>
|
||||
<span
|
||||
style="color:red"
|
||||
class="d-none error_inv_email"
|
||||
>Mandatory Email</span>
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-4 p-3"
|
||||
@@ -1366,19 +1375,19 @@
|
||||
</style>
|
||||
<script>
|
||||
function launchSnackBar(element) {
|
||||
var x = document.getElementById("snackbar");
|
||||
x.className = "show";
|
||||
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
|
||||
|
||||
|
||||
|
||||
var checkin_partner_id = element.firstChild.nextSibling.innerText
|
||||
|
||||
var inputEmailId = "invitation_email" + checkin_partner_id;
|
||||
|
||||
var email = document.getElementById(inputEmailId).value;
|
||||
var nameId = "invitation_firstname" + checkin_partner_id;
|
||||
var hostId = "host_name" + checkin_partner_id;
|
||||
var host = document.getElementById(hostId);
|
||||
var name = document.getElementById(nameId).value;
|
||||
host.innerHTML = name;
|
||||
if(email){
|
||||
if(name){
|
||||
console.log("non ten email");
|
||||
host.innerHTML = name;
|
||||
|
||||
var divId = "invitation_group" + checkin_partner_id;
|
||||
var btnId = "btnResendInvitation" + checkin_partner_id;
|
||||
@@ -1386,6 +1395,11 @@
|
||||
var btn_show_invitation = document.getElementById(btnId);
|
||||
div_invitation.classList.add("d-none");
|
||||
btn_show_invitation.classList.remove("d-none");
|
||||
var x = document.getElementById("snackbar");
|
||||
x.className = "show";
|
||||
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function show_invitation(element) {
|
||||
|
||||
Reference in New Issue
Block a user