[IMP]pms: added precheckin invitation email

This commit is contained in:
braisab
2021-10-13 20:45:19 +02:00
parent f050f7f932
commit 596015c188
5 changed files with 110 additions and 111 deletions

View File

@@ -36,6 +36,7 @@
"data/pms_confirmed_reservation_email_template.xml",
"data/pms_modified_reservation_email_template.xml",
"data/pms_cancelled_reservation_email_template.xml",
"data/pms_precheckin_invitation_email_template.xml",
"data/pms_data.xml",
"data/traveller_report_paperformat.xml",
"report/pms_folio.xml",

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record id="precheckin_invitation_email" model="mail.template">
<field name="name">Precheckin Invitation</field>
<field name="model_id" ref="pms.model_pms_checkin_partner" />
<field
name="subject"
>${object.pms_property_id.company_id.name} has confirmed your reservation in ${object.pms_property_id.name}</field>
<field
name="email_from"
>${object.pms_property_id.partner_id.email | safe}</field>
<field
name="email_to"
>${(object.email and '"%s" &lt;%s&gt;' % (object.name, object.email) or object.partner_id.email_formatted or '') | safe}</field>
<field name="body_html" type="html">
<div>
Do your check-in now and save time.
<br />
Access our<strong
> quick registration system</strong>. In a few steps you will be able to register your data in an agile, simple and secure way,<strong
> avoiding queues at reception</strong>.
If you register your data in our system, <strong
> your passage through reception will be much faster</strong>, being able to enjoy the comfort of your room right away.
<table align="center">
<tr>
<td align="center" style="padding: 20px 0 0px 0; ">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<p>
<a
href="${object.url}"
target="_blank"
style="text-decoration: none; color: #FFFFFF; font-size: 2em; padding: 10px 20px 10px 20px;"
>
<div
style="padding: 0.5em; background-color: #45C2B1; border-color: #45C2B1; border-width: 2px;border-style:solid; border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-style: solid;-webkit-border-radius: 10; -moz-border-radius: 10; border-radius: 10px;font-size: 12px;"
>Check-in
</div>
<center><img
src="https://www.aldahotels.es/firma/email/llegada/check-in.png"
alt="Hacer check-in"
width="80px"
height="80px"
href="${object.url}"
/></center></a>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</field>
</record>
</data>
</odoo>

View File

@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record>
<field id="precheckin_invitation_email" model="mail.template">
<field name="name">Precheckin </field>
<field name="model_id" ref="pms.model_pms_reservation" />
<field
name="subject"
>${object.company_id.name} has confirmed your reservation in ${object.pms_property_id.name}</field>
<field
name="email_from"
>${object.pms_property_id.partner_id.email | safe}</field>
<field
name="email_to"
>${(object.email and '"%s" &lt;%s&gt;' % (object.name, object.email) or object.partner_id.email_formatted or '') | safe}</field>
<field name="body_html" type="html">
<p style="font-size: 2em; line_height=0px; color: #45C2B1;">__</p>
Make your check-in now and save time
<br/>
Access our<strong>quick registration system</strong>. In a few steps you will be able to register your data in an agile, simple and secure way,<strong>avoiding queues at reception</strong>.
If you register your data in our system, <strong>your passage through reception will be much faster</strong>, being able to enjoy the comfort of your room right away.
<table>
<tr>
<td align="center" style="padding: 20px 0 0px 0; ">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<p>
<a href="${object.room_lines[0].fc_url}" target="_blank" style="text-decoration: none; color: #FFFFFF; font-size: 2em; padding: 10px 20px 10px 20px;">
<div style="padding: 0.5em; background-color: #45C2B1; border-color: #45C2B1; border-width: 2px;border-style:solid; border-bottom-style: solid;border-left-style: solid;border-right-style: solid;border-top-style: solid;-webkit-border-radius: 10; -moz-border-radius: 10; border-radius: 10px;font-size: 12px;">Check-in
</div>
<center><img src="https://www.aldahotels.es/firma/email/llegada/check-in.png" alt="Hacer check-in" width="80px" height="80px" href="${object.room_lines[0].fc_url}"/></center></a>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</field>
</record>
</data>
</odoo>

View File

@@ -1,68 +1,48 @@
odoo.define('pms', function (require) {
'use strict';
odoo.define("pms.SendInvitationData", function (require) {
"use strict";
var core = require('web.core');
var _t = core._t;
var utils = require('web.utils');
var publicWidget = require('web.public.widget');
publicWidget.registry.SendInvitationData = publicWidget.Widget.extend({
selector: '.o_send_invitation_js',
events: {
'click': '_onReminderToggleClick',
},
/**
* @override
*/
// init: function () {
// this._super.apply(this, arguments);
// this._onReminderToggleClick = _.debounce(this._onReminderToggleClick, 500, true);
// },
//--------------------------------------------------------------------------
// Handlers
//-------------------------------------------------------------------------
/**
* @private
* @param {Event} ev
*/
_onReminderToggleClick: function (ev) {
// var self = this;
// var $checkinPartner = $(ev.currentTarget).find('i');
this._rpc({
route: '/my/precheckin/send_invitation',
params: {
checkin_partner_id: $checkinPartner.data('checkin_partner_id'),
},
})/*.then(function (result) {*/
// if (result.error && result.error === 'ignored') {
// self.displayNotification({
// type: 'info',
// title: _t('Error'),
// message: _.str.sprintf(_t('Talk already in your Favorites')),
// });
// } else {
// self.reminderOn = reminderOnValue;
// var reminderText = self.reminderOn ? _t('Favorite On') : _t('Set Favorite');
// self.$('.o_wetrack_js_reminder_text').text(reminderText);
// self._updateDisplay();
// var message = self.reminderOn ? _t('Talk added to your Favorites') : _t('Talk removed from your Favorites');
// self.displayNotification({
// type: 'info',
// title: message
// });
// }
// if (result.visitor_uuid) {
// utils.set_cookie('visitor_uuid', result.visitor_uuid);
// }
// });
},
require("web.dom_ready");
var publicWidget = require("web.public.widget");
publicWidget.registry.SendInvitationData = publicWidget.Widget.extend({
selector: ".o_send_invitation_js",
events: {
click: "_onReminderToggleClick",
},
});
return publicWidget.registry.SendInvitationData;
_onReminderToggleClick: function (ev) {
ev.preventDefault();
var checkinPartnerId = $(ev.currentTarget)
.parent()
.parent()
.find("input[name=checkin_partner_id]")
.val();
var firstname = $(ev.currentTarget)
.parent()
.parent()
.find("input[name=invitation_firstname]")
.val();
var email = $(ev.currentTarget)
.parent()
.parent()
.find("input[name=invitation_email]")
.val();
var urlAccessToken = $(ev.currentTarget)
.parent()
.parent()
.parent()
.find("a[name=url_acess_token]")
.attr("href");
this._rpc({
route: "/my/precheckin/send_invitation",
params: {
checkin_partner_id: checkinPartnerId,
firstname: firstname,
email: email,
url_access_token: urlAccessToken,
},
});
},
});
return publicWidget.registry.SendInvitationData;
});

View File

@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="assets_frontend">
<template id="assets_frontend" inherit_id="portal.assets_frontend">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/pms/static/src/js/send_invitation_data.js"></script>
<script
type="text/javascript"
src="/pms/static/src/js/send_invitation_data.js"
/>
</xpath>
</template>