From 596015c1883c728aa94b1a5a52cc0a83a2f43fdf Mon Sep 17 00:00:00 2001 From: braisab Date: Wed, 13 Oct 2021 20:45:19 +0200 Subject: [PATCH] [IMP]pms: added precheckin invitation email --- pms/__manifest__.py | 1 + ...s_precheckin_invitation_email_template.xml | 59 ++++++++++ .../precheckin_invitation_email_template.xml | 44 ------- pms/static/src/js/send_invitation_data.js | 108 +++++++----------- pms/views/assets.xml | 9 +- 5 files changed, 110 insertions(+), 111 deletions(-) create mode 100644 pms/data/pms_precheckin_invitation_email_template.xml delete mode 100644 pms/data/precheckin_invitation_email_template.xml diff --git a/pms/__manifest__.py b/pms/__manifest__.py index 54732196d..9963101f8 100644 --- a/pms/__manifest__.py +++ b/pms/__manifest__.py @@ -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", diff --git a/pms/data/pms_precheckin_invitation_email_template.xml b/pms/data/pms_precheckin_invitation_email_template.xml new file mode 100644 index 000000000..b01b95eb0 --- /dev/null +++ b/pms/data/pms_precheckin_invitation_email_template.xml @@ -0,0 +1,59 @@ + + + + + Precheckin Invitation + + ${object.pms_property_id.company_id.name} has confirmed your reservation in ${object.pms_property_id.name} + ${object.pms_property_id.partner_id.email | safe} + ${(object.email and '"%s" <%s>' % (object.name, object.email) or object.partner_id.email_formatted or '') | safe} + +
+ Do your check-in now and save time. +
+ Access our quick registration system. In a few steps you will be able to register your data in an agile, simple and secure way, avoiding queues at reception. + If you register your data in our system, your passage through reception will be much faster, being able to enjoy the comfort of your room right away. + + + + +
+ + + + +
+

+ +

+
Hacer check-in
+

+
+
+
+
+
+
+
diff --git a/pms/data/precheckin_invitation_email_template.xml b/pms/data/precheckin_invitation_email_template.xml deleted file mode 100644 index 3575837cb..000000000 --- a/pms/data/precheckin_invitation_email_template.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - Precheckin - - ${object.company_id.name} has confirmed your reservation in ${object.pms_property_id.name} - ${object.pms_property_id.partner_id.email | safe} - ${(object.email and '"%s" <%s>' % (object.name, object.email) or object.partner_id.email_formatted or '') | safe} - -

__

- Make your check-in now and save time -
- Access ourquick registration system. In a few steps you will be able to register your data in an agile, simple and secure way,avoiding queues at reception. - If you register your data in our system, your passage through reception will be much faster, being able to enjoy the comfort of your room right away. - - - - -
- - - - -
-

- -

-
Hacer check-in
-

-
-
-
-
-
-
diff --git a/pms/static/src/js/send_invitation_data.js b/pms/static/src/js/send_invitation_data.js index 8fdd1ab99..d3c8c3eca 100644 --- a/pms/static/src/js/send_invitation_data.js +++ b/pms/static/src/js/send_invitation_data.js @@ -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; }); diff --git a/pms/views/assets.xml b/pms/views/assets.xml index a24bf9b72..0ff4d6887 100644 --- a/pms/views/assets.xml +++ b/pms/views/assets.xml @@ -1,9 +1,12 @@ - + -