From 85a2a3fafe0e488f42ebde6f2c6958cd05a2db65 Mon Sep 17 00:00:00 2001 From: Denis Durepos Date: Wed, 23 Jul 2025 21:01:01 -0400 Subject: [PATCH] feat: refactor portal player detail view with comprehensive tabs and status card - Add comprehensive tabbed player detail view with full parity to internal view - Implement four organized tabs: Injuries, Patient Info, Team Info, Emergency Contacts - Add prominent status card above tabs showing match/practice status and allergies - Add email field to emergency contacts model and forms - Fix QWeb template errors by replacing t-field date widgets with t-esc in td elements - Convert HTML fields to Text fields to resolve tracking compatibility issues - Maintain role-based access control throughout all tabs - Add missing fields: injured_since, active_injury_count for complete parity - Improve UI/UX with color-coded status badges and responsive design --- .../controllers/player_management_portal.py | 7 + .../models/patient_contact.py | 2 +- bemade_sports_clinic/models/patient_injury.py | 4 +- .../player_management_portal_templates.xml | 6 +- .../views/sports_clinic_portal_views.xml | 259 +++++++++++++++--- 5 files changed, 239 insertions(+), 39 deletions(-) diff --git a/bemade_sports_clinic/controllers/player_management_portal.py b/bemade_sports_clinic/controllers/player_management_portal.py index 052ed38..0273a62 100644 --- a/bemade_sports_clinic/controllers/player_management_portal.py +++ b/bemade_sports_clinic/controllers/player_management_portal.py @@ -230,6 +230,8 @@ class PlayerManagementPortal(CustomerPortal): # Optional fields if post.get('mobile'): vals['mobile'] = post.get('mobile') + if post.get('email'): + vals['email'] = post.get('email') # Create the contact request.env['sports.patient.contact'].sudo().create(vals) @@ -318,6 +320,11 @@ class PlayerManagementPortal(CustomerPortal): else: vals['mobile'] = False + if post.get('email'): + vals['email'] = post.get('email') + else: + vals['email'] = False + # Update the contact contact.sudo().write(vals) diff --git a/bemade_sports_clinic/models/patient_contact.py b/bemade_sports_clinic/models/patient_contact.py index a6a6d2f..527f14e 100644 --- a/bemade_sports_clinic/models/patient_contact.py +++ b/bemade_sports_clinic/models/patient_contact.py @@ -19,7 +19,7 @@ class PatientContact(models.Model): ('other', 'Other'), ], required=True) mobile = fields.Char(unaccent=False) - # TODO: add email here and on views + email = fields.Char(string='Email') patient_id = fields.Many2one(comodel_name='sports.patient', string='Patient') @api.onchange('mobile') diff --git a/bemade_sports_clinic/models/patient_injury.py b/bemade_sports_clinic/models/patient_injury.py index 7e34025..fe321eb 100644 --- a/bemade_sports_clinic/models/patient_injury.py +++ b/bemade_sports_clinic/models/patient_injury.py @@ -55,8 +55,8 @@ class PatientInjury(models.Model): default=_today, ) injury_date_na = fields.Boolean(string="N/A", default=False) - internal_notes = fields.Html(tracking=True) - external_notes = fields.Html(tracking=True) + internal_notes = fields.Text(tracking=True) + external_notes = fields.Text(tracking=True) treatment_professional_ids = fields.Many2many( comodel_name="res.users", relation="patient_injury_treatment_pro_rel", diff --git a/bemade_sports_clinic/views/player_management_portal_templates.xml b/bemade_sports_clinic/views/player_management_portal_templates.xml index 2a49d43..7028d72 100644 --- a/bemade_sports_clinic/views/player_management_portal_templates.xml +++ b/bemade_sports_clinic/views/player_management_portal_templates.xml @@ -266,7 +266,11 @@
- +
+ + +
diff --git a/bemade_sports_clinic/views/sports_clinic_portal_views.xml b/bemade_sports_clinic/views/sports_clinic_portal_views.xml index 165a308..63bee9b 100644 --- a/bemade_sports_clinic/views/sports_clinic_portal_views.xml +++ b/bemade_sports_clinic/views/sports_clinic_portal_views.xml @@ -129,10 +129,10 @@ - + - + @@ -256,10 +256,10 @@ else 'text-warning') if stage != 'healthy' else '' }}"> - + - +