mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX]pms: fixed individual precheckin
This commit is contained in:
@@ -347,13 +347,16 @@ class PortalPrecheckin(CustomerPortal):
|
||||
)
|
||||
def portal_precheckin_submit(self, folio_id, checkin_partner_id, **kw):
|
||||
error, error_message = {}, {}
|
||||
checkin_pos = int(kw.get("checkin_pos"))
|
||||
if kw.get("checkin_pos"):
|
||||
checkin_pos = int(kw.get("checkin_pos"))
|
||||
else:
|
||||
checkin_pos = -2
|
||||
folio_id = request.env["pms.folio"].browse(folio_id)
|
||||
country_ids = request.env["res.country"].search([])
|
||||
state_ids = request.env["res.country.state"].search([])
|
||||
doc_type_ids = request.env["res.partner.id_category"].sudo().search([])
|
||||
values = kw
|
||||
if not kw.get("first"):
|
||||
if not kw.get("first") and kw.get("checkin_pos"):
|
||||
error, error_message = self.form_validate(kw, None)
|
||||
if not kw.get("first") and not error:
|
||||
kw.update({"checkin_partner_id": checkin_partner_id})
|
||||
@@ -378,13 +381,21 @@ class PortalPrecheckin(CustomerPortal):
|
||||
"checkin_pos": checkin_pos,
|
||||
}
|
||||
)
|
||||
checkin_partner_id = folio_id.checkin_partner_ids[checkin_pos]
|
||||
if checkin_pos >= 0:
|
||||
checkin_partner_id = folio_id.checkin_partner_ids[checkin_pos]
|
||||
elif checkin_pos == -2:
|
||||
checkin_partner_id = request.env["pms.checkin.partner"].browse(
|
||||
checkin_partner_id
|
||||
)
|
||||
elif checkin_pos == -1:
|
||||
return
|
||||
access_token = checkin_partner_id.access_token
|
||||
if not checkin_partner_id.access_token:
|
||||
access_token = PortalMixin._portal_ensure_token(checkin_partner_id)
|
||||
values.update(
|
||||
self._precheckin_get_page_view_values(checkin_partner_id.id, access_token)
|
||||
)
|
||||
|
||||
values.update({"no_breadcrumbs": True})
|
||||
return request.render("pms.portal_my_precheckin_detail", values)
|
||||
|
||||
|
||||
@@ -117,9 +117,13 @@
|
||||
class="col-form-label"
|
||||
for="document_type"
|
||||
>Doc. Type</label>
|
||||
<div class="d-none"><p id="docTypeId"><t
|
||||
t-esc="checkin_partner_id.document_type"
|
||||
/></p></div>
|
||||
<select
|
||||
class="form-control #{error.get('document_type') and 'is-invalid' or ''}"
|
||||
name='document_type'
|
||||
id="doc_type"
|
||||
>
|
||||
<option value="">Select an option</option>
|
||||
<t t-foreach="doc_type_ids" t-as='doc_type'>
|
||||
@@ -269,26 +273,26 @@
|
||||
/>
|
||||
</t>
|
||||
</div>
|
||||
<!-- <t t-if="checkin_pos">-->
|
||||
<t t-if="checkin_pos >= 0">
|
||||
<div class="col-4">
|
||||
<t t-if="not error">
|
||||
<button
|
||||
class="btn btn-primary"
|
||||
type="button"
|
||||
onclick="history.go(-1)"
|
||||
>
|
||||
class="btn btn-primary"
|
||||
type="button"
|
||||
onclick="history.go(-2)"
|
||||
>
|
||||
<span class="fa fa-long-arrow-left" />
|
||||
Previous
|
||||
Prev
|
||||
</button>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<button
|
||||
class="btn btn-primary"
|
||||
type="button"
|
||||
onclick="history.go(-2)"
|
||||
>
|
||||
class="btn btn-primary"
|
||||
type="button"
|
||||
onclick="history.go(-3)"
|
||||
>
|
||||
<span class="fa fa-long-arrow-left" />
|
||||
Previous
|
||||
Prev
|
||||
</button>
|
||||
</t>
|
||||
</div>
|
||||
@@ -303,40 +307,99 @@
|
||||
</div>
|
||||
<t t-set="checkin_pos" t-value="checkin_pos+1" />
|
||||
<input
|
||||
type="number"
|
||||
name="checkin_pos"
|
||||
class="d-none"
|
||||
t-att-value="checkin_pos"
|
||||
/>
|
||||
type="number"
|
||||
name="checkin_pos"
|
||||
id="input_checkin_pos"
|
||||
class="d-none"
|
||||
t-att-value="checkin_pos"
|
||||
/>
|
||||
<div class="col-4">
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary float-right"
|
||||
>
|
||||
type="submit"
|
||||
class="btn btn-primary float-right"
|
||||
>
|
||||
Next
|
||||
<span class="fa fa-long-arrow-right" />
|
||||
</button>
|
||||
</div>
|
||||
<!-- </t>-->
|
||||
<!-- <t t-else="">-->
|
||||
<!-- <div class="col-12 mt-4">-->
|
||||
<!-- <button-->
|
||||
<!-- id="btnSave"-->
|
||||
<!-- onclick="launchSnackBar(this)"-->
|
||||
<!-- type="submit"-->
|
||||
<!-- class="btn btn-primary float-right"-->
|
||||
<!-- >-->
|
||||
<!-- Save-->
|
||||
<!-- </button>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div id="snackbar">Data Saved Successfully </div>-->
|
||||
<!-- </t>-->
|
||||
</t>
|
||||
<t t-else="">
|
||||
<div class="col-12 mt-4">
|
||||
<button
|
||||
id="btnSave"
|
||||
onclick="launchSnackBar(this)"
|
||||
type="submit"
|
||||
class="btn btn-primary float-right"
|
||||
>
|
||||
Save
|
||||
</button>
|
||||
<input
|
||||
type="number"
|
||||
name="checkin_pos"
|
||||
id="input_checkin_pos"
|
||||
class="d-none"
|
||||
t-att-value="-1"
|
||||
/>
|
||||
</div>
|
||||
<div id="snackbar">Data Saved Successfully </div>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</t>
|
||||
<style>
|
||||
#snackbar {
|
||||
visibility: hidden;
|
||||
min-width: 250px;
|
||||
margin-left: -125px;
|
||||
background-color: #6c757d;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 2px;
|
||||
padding: 16px;
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
left: 50%;
|
||||
top: 100px;
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
#snackbar.show {
|
||||
visibility: visible;
|
||||
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
|
||||
animation: fadein 0.5s, fadeout 0.5s 2.5s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadein {
|
||||
from {top: 0; opacity: 0;}
|
||||
to {top: 100px; opacity: 1;}
|
||||
}
|
||||
|
||||
@keyframes fadein {
|
||||
from {top: 0; opacity: 0;}
|
||||
to {top: 100px; opacity: 1;}
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeout {
|
||||
from {top: 100px; opacity: 1;}
|
||||
to {top: 0; opacity: 0;}
|
||||
}
|
||||
|
||||
@keyframes fadeout {
|
||||
from {top: 100px; opacity: 1;}
|
||||
to {top: 0; opacity: 0;}
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function launchSnackBar(element) {
|
||||
var checkin_pos = document.getElementById("input_checkin_pos").value;
|
||||
var x = document.getElementById("snackbar");
|
||||
if (checkin_pos == -1){
|
||||
x.className = "show";
|
||||
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
|
||||
}
|
||||
}
|
||||
var folio_id = document.getElementById("folio").value
|
||||
var checkin_partner_id = document.getElementById("checkin").value
|
||||
var access_token = document.getElementById("input_access_token").value
|
||||
@@ -355,7 +418,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
var select_doc_type = document.getElementById("doc_type_id")
|
||||
var select_doc_type = document.getElementById("doc_type")
|
||||
var document_type_value = document.getElementById("docTypeId").textContent
|
||||
for (let i=0;i<select_doc_type.length;i++){
|
||||
if (select_doc_type[i].value == document_type_value){
|
||||
@@ -363,13 +426,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
var select_gender = document.getElementById("gender")
|
||||
var gender_value = document.getElementById("genderId").textContent
|
||||
for (let i=0;i<select_gender.length;i++){
|
||||
if(select_gender[i].value==gender_value){
|
||||
select_gender[i].setAttribute("selected","True")
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</template>
|
||||
<template id="portal_my_reservation_precheckin" name="Precheckin Reservation">
|
||||
|
||||
Reference in New Issue
Block a user