bemade-addons/bemade_sports_clinic/views/portal_messages_template.xml
Denis Durepos 14fa714fe8 feat: Add assignee display and reassignment functionality to activity views
- Implement context-sensitive assignee column display in activity views
- Show assignee column only when viewing specific records (teams, patients, injuries)
- Hide assignee column in general 'My Activities' view (users only see their own activities)
- Add reassignment modal with dropdown to select new treatment professional
- Implement /my/activity/reassign controller route with proper access control
- Add team-based security validation for reassignment operations
- Fix template variable passing issue where show_assignee wasn't reaching activity_list_table
- Add success feedback and proper return URL handling after reassignment
- Maintain context-sensitive activity filtering for optimal user experience
- All tests passing (76 tests, 0 failed, 0 errors)

This enhancement improves team coordination by providing clear visibility of activity
assignments and easy reassignment capabilities while maintaining proper security boundaries.
2025-07-29 15:44:09 -04:00

152 lines
10 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="portal_my_messages" name="Portal My Messages">
<t t-call="portal.portal_layout">
<t t-set="breadcrumbs_searchbar" t-value="True"/>
<t t-call="portal.portal_searchbar">
<t t-set="title">Messages</t>
</t>
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h4>My Messages</h4>
<p class="text-muted">Messages related to your assigned teams, patients, and injuries</p>
</div>
<div class="card-body">
<t t-if="not messages">
<div class="alert alert-info">
<i class="fa fa-info-circle"/> No messages found.
</div>
</t>
<t t-else="">
<!-- Patient Messages -->
<t t-if="patient_messages">
<h5 class="mt-3 mb-2">
<i class="fa fa-user-injured"/> Patient Messages
<span class="badge badge-primary"><t t-esc="len(patient_messages)"/></span>
</h5>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Date</th>
<th>Patient</th>
<th>Subject</th>
<th>Author</th>
<th>Message Type</th>
</tr>
</thead>
<tbody>
<t t-foreach="patient_messages" t-as="message">
<tr>
<td><t t-esc="message.date.strftime('%Y-%m-%d %H:%M') if message.date else ''"/></td>
<td>
<t t-if="message.record_name">
<t t-esc="message.record_name"/>
</t>
<t t-else="">
Patient #<t t-esc="message.res_id"/>
</t>
</td>
<td><t t-esc="message.subject or 'No Subject'"/></td>
<td><t t-esc="message.author_id.name if message.author_id else 'System'"/></td>
<td><t t-esc="message.message_type.title() if message.message_type else 'Message'"/></td>
</tr>
</t>
</tbody>
</table>
</div>
</t>
<!-- Injury Messages -->
<t t-if="injury_messages">
<h5 class="mt-4 mb-2">
<i class="fa fa-bandage"/> Injury Messages
<span class="badge badge-warning"><t t-esc="len(injury_messages)"/></span>
</h5>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Date</th>
<th>Injury</th>
<th>Subject</th>
<th>Author</th>
<th>Message Type</th>
</tr>
</thead>
<tbody>
<t t-foreach="injury_messages" t-as="message">
<tr>
<td><t t-esc="message.date.strftime('%Y-%m-%d %H:%M') if message.date else ''"/></td>
<td>
<t t-if="message.record_name">
<t t-esc="message.record_name"/>
</t>
<t t-else="">
Injury #<t t-esc="message.res_id"/>
</t>
</td>
<td><t t-esc="message.subject or 'No Subject'"/></td>
<td><t t-esc="message.author_id.name if message.author_id else 'System'"/></td>
<td><t t-esc="message.message_type.title() if message.message_type else 'Message'"/></td>
</tr>
</t>
</tbody>
</table>
</div>
</t>
<!-- Team Messages -->
<t t-if="team_messages">
<h5 class="mt-4 mb-2">
<i class="fa fa-users"/> Team Messages
<span class="badge badge-success"><t t-esc="len(team_messages)"/></span>
</h5>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Date</th>
<th>Team</th>
<th>Subject</th>
<th>Author</th>
<th>Message Type</th>
</tr>
</thead>
<tbody>
<t t-foreach="team_messages" t-as="message">
<tr>
<td><t t-esc="message.date.strftime('%Y-%m-%d %H:%M') if message.date else ''"/></td>
<td>
<t t-if="message.record_name">
<t t-esc="message.record_name"/>
</t>
<t t-else="">
Team #<t t-esc="message.res_id"/>
</t>
</td>
<td><t t-esc="message.subject or 'No Subject'"/></td>
<td><t t-esc="message.author_id.name if message.author_id else 'System'"/></td>
<td><t t-esc="message.message_type.title() if message.message_type else 'Message'"/></td>
</tr>
</t>
</tbody>
</table>
</div>
</t>
</t>
</div>
</div>
</div>
</div>
</div>
</t>
</template>
</data>
</odoo>