Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! fixup! [ADD] portal_event_t…
Browse files Browse the repository at this point in the history
…ickets
  • Loading branch information
em230418 committed Oct 14, 2024
1 parent 540c3cc commit ec6e833
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 36 deletions.
3 changes: 2 additions & 1 deletion portal_event_tickets/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"views/event_registration.xml",
"views/event_event.xml",
"data/mail_template_data.xml",
"views/assets.xml"
],
"qweb": [],
"demo": ["views/assets_demo.xml", "data/res_users_demo.xml"],
"demo": ["data/res_users_demo.xml"],
}
35 changes: 35 additions & 0 deletions portal_event_tickets/static/src/js/portal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
odoo.define('portal_event_tickets.portal', function (require) {
'use strict';

var publicWidget = require('web.public.widget');

publicWidget.registry.transferTicketWidget = publicWidget.Widget.extend({
selector: '#transfer_ticket',

start: function () {
var def = this._super.apply(this, arguments);

var event_name = this.$el.data("event-name");
var $modal = $('#modal_attendees_registration');

/* show form inline */
$modal.find('form').attr('action', '/my/tickets/transfer/receive');
$modal.removeClass('modal fade');

/* remove Cancel button; update title */
var $submit = $modal.find('[type=submit]');
$submit.parent().empty().append($submit);
$submit.text('Confirm');

/* remove Close button */
$modal.find('.close').remove();

/* make email non-editable */
$modal.find('[name=1-email]').attr('disabled', '1');

/* update title */
$modal.find('h4.modal-title').html('Receive the ticket for <b>' + event_name + '</b>');
return def;
},
});
});
2 changes: 1 addition & 1 deletion portal_event_tickets/static/src/js/ticket_transfer.tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ odoo.define("portal_event_tickets.ticket_transfer_tour", function (require) {
var tour = require("web_tour.tour");

var options = {
// Test: true,
test: true,
url: "/my/tickets/transfer/receive",
};

Expand Down
1 change: 1 addition & 0 deletions portal_event_tickets/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def _create_ticket(self, ticket_type, partner, event):
"order_id": sale_order.id,
"name": "sale order line",
"event_id": event.id,
"event_ticket_id": ticket_type.id,
}
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="assets_frontend" inherit_id="website.assets_frontend" name="Tours">
<template id="assets_frontend" inherit_id="website.assets_frontend">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/portal_event_tickets/static/src/js/portal.js"></script>
</xpath>
</template>

<template id="assets_tests" inherit_id="website.assets_tests">
<xpath expr="." position="inside">
<script
type="text/javascript"
Expand Down
42 changes: 9 additions & 33 deletions portal_event_tickets/views/portal_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -330,39 +330,15 @@
<template id="portal_ticket_transfer_receive" name="Ticket">
<t t-call="website.layout">
<t t-set="autofill_user" t-value="env.user" />
<t t-call="website_event.registration_attendee_details">
<input
name="transfer_ticket"
t-att-value="transfer_ticket.id"
type="hidden"
/>
</t>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
var event_name = '<t t-esc="event.name" />';
$modal = $('#modal_attendees_registration');

/* show form inline */
$modal.find('form').attr('action', '/my/tickets/transfer/receive');
$modal.removeClass('modal fade');
//$modal.find('.modal-dialog.modal-lg').removeClass('modal-dialog modal-lg');

/* remove Cancel button; update title */
var $submit = $modal.find('[type=submit]');
$submit.parent().empty().append($submit);
$submit.text('Confirm');

/* remove Close button */
$modal.find('.close').remove();

/* make email non-editable */
$modal.find('[name=1-email]').attr('disabled', '1');

/* update title */
$modal.find('h4.modal-title').html('Receive the ticket for <b
>' + event_name + '</b>');
});
</script>
<div id="transfer_ticket" t-att-data-event-name="event.name">
<t t-call="website_event.registration_attendee_details">
<input
name="transfer_ticket"
t-att-value="transfer_ticket.id"
type="hidden"
/>
</t>
</div>
</t>
</template>
<template id="message_origin_link">
Expand Down

0 comments on commit ec6e833

Please sign in to comment.