mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: portal pms templates
This commit is contained in:
@@ -673,14 +673,16 @@ class PortalAccount(PortalAccount):
|
||||
invoice, access_token, **kwargs
|
||||
)
|
||||
acquirers = values.get("acquirers")
|
||||
for acquirer in acquirers:
|
||||
if (
|
||||
acquirer.pms_property_ids
|
||||
and invoice.pms_property_id.id not in acquirer.pms_property_ids.ids
|
||||
):
|
||||
values["acquirers"] -= acquirer
|
||||
if acquirers:
|
||||
for acquirer in acquirers:
|
||||
if (
|
||||
acquirer.pms_property_ids
|
||||
and invoice.pms_property_id.id not in acquirer.pms_property_ids.ids
|
||||
):
|
||||
values["acquirers"] -= acquirer
|
||||
payment_tokens = values.get("payment_tokens")
|
||||
for pms in payment_tokens:
|
||||
if pms.acquirer_id not in values["acquirers"].ids:
|
||||
values["pms"] -= pms
|
||||
if payment_tokens:
|
||||
for pms in payment_tokens:
|
||||
if pms.acquirer_id not in values["acquirers"].ids:
|
||||
values["pms"] -= pms
|
||||
return values
|
||||
|
||||
74
pms/static/src/js/folio_portal_sidebar.js
Normal file
74
pms/static/src/js/folio_portal_sidebar.js
Normal file
@@ -0,0 +1,74 @@
|
||||
odoo.define("account.FolioPortalSidebar", function (require) {
|
||||
"use strict";
|
||||
|
||||
const dom = require("web.dom");
|
||||
var publicWidget = require("web.public.widget");
|
||||
var PortalSidebar = require("portal.PortalSidebar");
|
||||
var utils = require("web.utils");
|
||||
|
||||
publicWidget.registry.FolioPortalSidebar = PortalSidebar.extend({
|
||||
selector: ".o_portal_folio_sidebar",
|
||||
events: {
|
||||
"click .o_portal_folio_print": "_onPrintFolio",
|
||||
},
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
start: function () {
|
||||
var def = this._super.apply(this, arguments);
|
||||
|
||||
var $folioHtml = this.$el.find("iframe#folio_html");
|
||||
var updateIframeSize = this._updateIframeSize.bind(this, $folioHtml);
|
||||
|
||||
$(window).on("resize", updateIframeSize);
|
||||
|
||||
var iframeDoc =
|
||||
$folioHtml[0].contentDocument || $folioHtml[0].contentWindow.document;
|
||||
if (iframeDoc.readyState === "complete") {
|
||||
updateIframeSize();
|
||||
} else {
|
||||
$folioHtml.on("load", updateIframeSize);
|
||||
}
|
||||
|
||||
return def;
|
||||
},
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Handlers
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Called when the iframe is loaded or the window is resized on customer portal.
|
||||
* The goal is to expand the iframe height to display the full report without scrollbar.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} $el: the iframe
|
||||
*/
|
||||
_updateIframeSize: function ($el) {
|
||||
var $wrapwrap = $el.contents().find("div#wrapwrap");
|
||||
// Set it to 0 first to handle the case where scrollHeight is too big for its content.
|
||||
$el.height(0);
|
||||
$el.height($wrapwrap[0].scrollHeight);
|
||||
|
||||
// Scroll to the right place after iframe resize
|
||||
if (!utils.isValidAnchor(window.location.hash)) {
|
||||
return;
|
||||
}
|
||||
var $target = $(window.location.hash);
|
||||
if (!$target.length) {
|
||||
return;
|
||||
}
|
||||
dom.scrollTo($target[0], {duration: 0});
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @param {MouseEvent} ev
|
||||
*/
|
||||
_onPrintFolio: function (ev) {
|
||||
ev.preventDefault();
|
||||
var href = $(ev.currentTarget).attr("href");
|
||||
this._printIframeContent(href);
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -2,11 +2,13 @@
|
||||
<odoo>
|
||||
|
||||
<template id="assets_frontend" inherit_id="portal.assets_frontend">
|
||||
<xpath expr="//script[last()]" position="after">
|
||||
<xpath expr="." position="inside">
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/pms/static/src/js/send_invitation_data.js"
|
||||
/>
|
||||
<script type="text/javascript" src="/pms/static/src/js/folio_portal_sidebar.js">
|
||||
</script>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
>
|
||||
<xpath expr="//div[hasclass('o_portal_sidebar')]" position="inside">
|
||||
|
||||
<div class="row mt16 o_portal_sale_sidebar">
|
||||
<div class="row mt16 o_portal_folio_sidebar">
|
||||
<!-- Sidebar -->
|
||||
<t t-call="portal.portal_record_sidebar">
|
||||
<t t-set="classes" t-value="'col-lg-auto d-print-none'" />
|
||||
@@ -209,16 +209,16 @@
|
||||
<div t-call="pms.portal_folio_page_payment" />
|
||||
</div>
|
||||
<div class="o_download_pdf btn-toolbar flex-sm-nowrap">
|
||||
<div class="btn-group mr-1 mb-1">
|
||||
<div class="btn-group flex-grow-1 mr-1 mb-1">
|
||||
<a
|
||||
class="btn btn-secondary btn-block o_download_btn"
|
||||
t-att-href="folio.get_portal_url(report_type='pdf', download=True)"
|
||||
title="Download"
|
||||
><i class="fa fa-download" /> Download</a>
|
||||
</div>
|
||||
<div class="btn-group mb-1">
|
||||
<div class="btn-group flex-grow-1 mb-1">
|
||||
<a
|
||||
class="btn btn-secondary btn-block o_print_btn o_portal_invoice_print"
|
||||
class="btn btn-secondary btn-block o_print_btn o_portal_folio_print"
|
||||
t-att-href="folio.get_portal_url(report_type='pdf')"
|
||||
id="print_folio_report"
|
||||
title="Print"
|
||||
@@ -226,47 +226,56 @@
|
||||
><i class="fa fa-print" /> Print</a>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<a
|
||||
class="btn btn-secondary btn-block "
|
||||
<t
|
||||
t-set="rooms_to_checkin"
|
||||
t-value="len(folio.checkin_partner_ids.filtered(lambda r: r.state in ['draft','dummy']))"
|
||||
/>
|
||||
<div t-if="rooms_to_checkin">
|
||||
<a
|
||||
class="btn btn-primary btn-block "
|
||||
t-att-href="folio.get_portal_url(suffix='/precheckin')"
|
||||
t-att-title="Precheckin"
|
||||
>
|
||||
Precheckin
|
||||
</a>
|
||||
</div>
|
||||
<t
|
||||
t-esc="rooms_to_checkin"
|
||||
/> Guests to Precheckin
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li
|
||||
t-if="folio.user_id.name"
|
||||
class="list-group-item flex-grow-1"
|
||||
>
|
||||
<div class="small mb-1"><strong
|
||||
class="text-muted"
|
||||
>Salesperson</strong></div>
|
||||
<div class="row flex-nowrap">
|
||||
<div class="small mb-1">
|
||||
<strong class="text-muted">
|
||||
Salesperson
|
||||
</strong>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col flex-grow-0 pr-2">
|
||||
<img
|
||||
class="rounded-circle mr4 float-left o_portal_contact_img"
|
||||
t-if="folio.user_id.image_1024"
|
||||
class="rounded-circle mt-1 o_portal_contact_img"
|
||||
t-att-src="image_data_uri(folio.user_id.image_1024)"
|
||||
alt="Contact"
|
||||
/>
|
||||
<img
|
||||
class="rounded-circle mr4 float-left o_portal_contact_img"
|
||||
t-if="not folio.user_id.image_1024"
|
||||
src="/web/static/src/img/placeholder.png"
|
||||
t-else=""
|
||||
class="rounded-circle mt-1 o_portal_contact_img"
|
||||
src="/web/static/src/img/user_menu_avatar.png"
|
||||
alt="Contact"
|
||||
/>
|
||||
</div>
|
||||
<div class="col pl-0" style="min-width: 150px">
|
||||
<div class="col pl-0">
|
||||
<span
|
||||
t-field="folio.user_id"
|
||||
t-options='{"widget": "contact", "fields": ["name", "phone"], "no_marker": True}'
|
||||
/>
|
||||
<a href="#discussion" class="small"><i
|
||||
class="fa fa-comment"
|
||||
/> Send message</a>
|
||||
class="fa fa-fw fa-comments"
|
||||
/><b>Send message</b></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@@ -274,7 +283,13 @@
|
||||
</t>
|
||||
</t>
|
||||
<!-- main content-->
|
||||
<div t-attf-class="card col-8 p-3" id="portal_folio_content">
|
||||
<div id="folio_content" class="col-12 col-lg">
|
||||
<t t-if="error or warning" t-call="pms.folio_invoice_error" />
|
||||
<t
|
||||
t-if="success and (not error and not warning)"
|
||||
t-call="pms.portal_folio_success"
|
||||
/>
|
||||
|
||||
<div class="o_portal_html_view shadow p-3">
|
||||
<div class="o_portal_html_loader text-center">
|
||||
<i
|
||||
@@ -282,25 +297,61 @@
|
||||
/>
|
||||
</div>
|
||||
<iframe
|
||||
id="report_html"
|
||||
id="folio_html"
|
||||
class="mt8 mb8"
|
||||
width="100%"
|
||||
height="1000px"
|
||||
height="100%"
|
||||
frameborder="0"
|
||||
scrolling="yes"
|
||||
scrolling="no"
|
||||
t-att-src="folio.get_portal_url(report_type='html')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- chatter -->
|
||||
<div class="col-3" />
|
||||
<div id="folio_communication" class="mt-4 col-8">
|
||||
<h2>History</h2>
|
||||
<t t-call="portal.message_thread">
|
||||
<t t-set="object" t-value="folio" />
|
||||
</t>
|
||||
<!-- chatter -->
|
||||
<div id="folio_communication" class="mt-4">
|
||||
<h2>History</h2>
|
||||
<t t-call="portal.message_thread">
|
||||
<t t-set="object" t-value="folio" />
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="folio_invoice_error" name="Folio error/warning display">
|
||||
<div class="row mr16">
|
||||
<div
|
||||
t-attf-class="'col-lg-12 mr16 ml16 alert alert-dismissable' #{'alert-danger' if error else 'alert-warning'}"
|
||||
role="alert"
|
||||
>
|
||||
<a
|
||||
href="#"
|
||||
class="close"
|
||||
data-dismiss="alert"
|
||||
aria-label="close"
|
||||
title="close"
|
||||
>×</a>
|
||||
<t t-if="error == 'generic'" name="generic">
|
||||
There was an error processing this page.
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="portal_folio_success" name="Invoice success display">
|
||||
<div class="row mr16">
|
||||
<div
|
||||
class="col-lg-12 mr16 ml16 alert alert-dismissable alert-success"
|
||||
role="status"
|
||||
>
|
||||
<a
|
||||
href="#"
|
||||
class="close"
|
||||
data-dismiss="alert"
|
||||
aria-label="close"
|
||||
title="close"
|
||||
>×</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</odoo>
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
/></h4>
|
||||
</center>
|
||||
</div>
|
||||
<div class="form-group col-xl-6">
|
||||
<div class="form-group col-xl-12">
|
||||
<center>
|
||||
<h5
|
||||
class="font-weight-bold mr-5 mt-2"
|
||||
class="font-weight-bold mt-2"
|
||||
t-esc="'Room: '+checkin_partner_id.reservation_id.sudo().room_type_id.name if checkin_partner_id.reservation_id else ''"
|
||||
/>
|
||||
</center>
|
||||
@@ -41,16 +41,18 @@
|
||||
/>
|
||||
</div>
|
||||
<t t-if="checkin_pos >= 0">
|
||||
<div class="col-4 mt-2">
|
||||
<h5 class="float-right font-weight-bold">
|
||||
Covering <span
|
||||
t-esc="int(checkin_pos) + 1"
|
||||
/> partner <br />
|
||||
<span
|
||||
t-esc="len(folio.checkin_partner_ids.filtered(lambda c: c.state in ['dummy','draft']))-int(checkin_pos)"
|
||||
/>
|
||||
partner data to remain to be covered
|
||||
</h5>
|
||||
<div class="form-group col-xl-12">
|
||||
<center>
|
||||
<h5 class="font-weight-bold">
|
||||
Covering <span
|
||||
t-esc="int(checkin_pos) + 1"
|
||||
/> partner <br />
|
||||
<span
|
||||
t-esc="len(folio.checkin_partner_ids.filtered(lambda c: c.state in ['dummy','draft']))-int(checkin_pos)"
|
||||
/>
|
||||
partner data to remain to be covered
|
||||
</h5>
|
||||
</center>
|
||||
</div>
|
||||
</t>
|
||||
<div class="row justify-content-center">
|
||||
@@ -608,21 +610,32 @@
|
||||
> your passage through reception will be much faster</strong>, being able to enjoy the comfort of your room right away.
|
||||
</center>
|
||||
<div class="col-12" style="margin-top:40px;">
|
||||
<a
|
||||
role="button"
|
||||
class="col-6 float-left"
|
||||
<form
|
||||
class="col-6 float-right"
|
||||
style="margin-bottom:50px"
|
||||
t-att-href="folio.get_portal_url()"
|
||||
t-att-action="folio.get_portal_url()"
|
||||
method="get"
|
||||
>
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary"
|
||||
style="margin-left:360px"
|
||||
style="width:-webkit-fill-available"
|
||||
>
|
||||
<span class="fa fa-info" />
|
||||
Reservation Info
|
||||
</button>
|
||||
</a>
|
||||
<input
|
||||
type="text"
|
||||
name="access_token"
|
||||
t-attf-class="d-none"
|
||||
t-att-value="folio.access_token"
|
||||
/>
|
||||
<input
|
||||
name="folio_id"
|
||||
t-attf-class="d-none"
|
||||
t-att-value="folio.id"
|
||||
/>
|
||||
</form>
|
||||
<form
|
||||
class="col-6 float-right"
|
||||
style="margin-bottom:50px"
|
||||
@@ -652,7 +665,11 @@
|
||||
t-attf-class="form-control d-none"
|
||||
value="1"
|
||||
/>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary"
|
||||
style="width:-webkit-fill-available"
|
||||
>
|
||||
<span class="fa fa-wpforms" />
|
||||
CHECK IN NOW!
|
||||
</button>
|
||||
@@ -967,6 +984,38 @@
|
||||
Your check-in has been successful.
|
||||
</h5>
|
||||
<br />
|
||||
<form
|
||||
style="margin-bottom:50px"
|
||||
t-att-action="folio.get_portal_url()"
|
||||
method="get"
|
||||
>
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary"
|
||||
style="width:-webkit-fill-available"
|
||||
>
|
||||
<span
|
||||
t-if="folio.payment_state in ['paid','nothing_to_pay','overpayment']"
|
||||
class="fa fa-info"
|
||||
>
|
||||
Reservation Info
|
||||
</span>
|
||||
<span t-else="" class="fa fa-money">
|
||||
Pay Now
|
||||
</span>
|
||||
</button>
|
||||
<input
|
||||
type="text"
|
||||
name="access_token"
|
||||
t-attf-class="d-none"
|
||||
t-att-value="folio.access_token"
|
||||
/>
|
||||
<input
|
||||
name="folio_id"
|
||||
t-attf-class="d-none"
|
||||
t-att-value="folio.id"
|
||||
/>
|
||||
</form>
|
||||
</center>
|
||||
</t>
|
||||
<style />
|
||||
|
||||
Reference in New Issue
Block a user