Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions website_event_portal_listing/controllers/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from odoo import http, _
from odoo.addons.portal.controllers.portal import CustomerPortal, pager as portal_pager
from odoo.addons.website_event.controllers.main import WebsiteEventController
from odoo.exceptions import AccessError, MissingError
from collections import OrderedDict
from odoo.http import request
Expand Down Expand Up @@ -82,3 +83,18 @@ def portal_my_events(self, page=1, date_open=None, date_closed=None, sortby=None
'filterby': filterby,
})
return request.render("website_event_portal_listing.portal_my_events", values)


class WebsiteEventControllerExtended(WebsiteEventController):
@http.route(['''/my/event/<int:event_id>'''], type='http', auth="public", website=True)
def event_details(self, event_id, **post):
event = request.env['event.event'].sudo().browse(event_id)
if not event.can_access_from_current_website():
raise werkzeug.exceptions.NotFound()

attendees_sudo = request.env['event.registration'].sudo().search([
('event_id', '=', event.id), ('email', '=', request.env.user.partner_id.email)
])

return request.render("website_event_portal_listing.event_info",
self._get_registration_confirm_values(event, attendees_sudo))
65 changes: 65 additions & 0 deletions website_event_portal_listing/views/event_portal_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,69 @@
</t>
</t>
</template>

<template id="event_info" name="My Event">
<t t-call="website_event.layout">
<div class="container my-5 o_wereg_confirmed">
<div class="row mb-3">
<div class="col-12">
<span class="h4 text-muted" t-esc="event.name"/>
</div>
</div>
<div class="row mb-3 o_wereg_confirmed_attendees">
<div class="col-md-4 col-xs-12 mt-3" t-foreach="attendees" t-as="attendee">
<div class="d-flex flex-column">
<span class="font-weight-bold">
<t t-if="attendee.name" t-esc="attendee.name"/>
<t t-else="">N/A</t>
</span>
<span>
<i class="fa fa-envelope mr-2 "></i>
<t t-if="attendee.email" t-esc="attendee.email"/>
<t t-else="">N/A</t>
</span>
<span>
<i class="fa fa-phone mr-2"></i>
<t t-if="attendee.phone" t-esc="attendee.phone"/>
<t t-else="">N/A</t>
</span>
<span>
<i class="fa fa-ticket mr-2"></i>
<t t-if="attendee.event_ticket_id" t-esc="attendee.event_ticket_id.name"/>
<t t-else="">N/A</t>
(ref: <t t-esc="attendee.id"/>)
</span>
</div>
</div>
</div>
<div class="row mb-3">
<div class="col">
<p><b>Start</b> <span itemprop="startDate" t-esc="event.date_begin_located"/><br/> <b>End</b> <span itemprop="endDate" t-esc="event.date_end_located"/></p>
<div class="mt-4">
<h5 t-field="event.address_id" class="text-secondary font-weight-bold" t-options='{
"widget": "contact",
"fields": ["name"]
}'/>
<a itemprop="location" t-att-href="event.google_map_link()" target="_BLANK" temprop="location" t-field="event.address_id" t-options='{
"widget": "contact",
"fields": ["address"]
}'/>
<div itemprop="location" t-field="event.address_id" t-options='{
"widget": "contact",
"fields": ["phone", "mobile", "email"]
}'/>
</div>
<div id="add_to_calendar" class="mt-4 d-flex flex-column flex-md-row">
<a role="button" class="btn btn-primary" t-att-href="iCal_url">
<i class="fa fa-fw fa-calendar"/> Add to iCal/Outlook
</a>
<a role="button" class="btn btn-primary ml-md-2 mt-2 mt-md-0" t-att-href="google_url" target='_blank'>
<i class="fa fa-fw fa-calendar"/> Add to Google Calendar
</a>
</div>
</div>
</div>
</div>
</t>
</template>
</odoo>