From c0b84cbc8da012b20301f1b8dc7eac7328855ecb Mon Sep 17 00:00:00 2001 From: Kat Tipton Date: Wed, 17 Jul 2024 18:14:02 -0400 Subject: [PATCH 1/2] Revert Patient Dashboard to non-react --- .../patients/_patient_dashboard.html.erb | 85 ++++++++++++++++--- 1 file changed, 73 insertions(+), 12 deletions(-) diff --git a/app/views/patients/_patient_dashboard.html.erb b/app/views/patients/_patient_dashboard.html.erb index 0114d865d..b279ce529 100644 --- a/app/views/patients/_patient_dashboard.html.erb +++ b/app/views/patients/_patient_dashboard.html.erb @@ -1,16 +1,77 @@
- - + <%= bootstrap_form_with model: patient, + html: { id: 'patient_dashboard_form' }, + local: false, + method: 'patch', + class: 'edit_patient' do |f| %> +
- <%= render ReactComponent.new("PatientDashboardForm", raw_props: { - patient: patient.as_json, - weeksOptions: weeks_options.map { |opt| { label: opt[0], value: opt[1] } }, - daysOptions: days_options.map { |opt| { label: opt[0], value: opt[1] } }, - initialCallDate: patient.initial_call_date.strftime("%m/%d/%Y"), - statusHelpText: status_help_text(patient), - isAdmin: current_user.admin?, - patientPath: patient_path(patient), - formAuthenticityToken: form_authenticity_token - }) %> +
+ <%= f.text_field :name, + label: t('patient.shared.name'), + autocomplete: 'off' %> +
+ +
+ <%= f.select :last_menstrual_period_weeks, + options_for_select(weeks_options, patient.last_menstrual_period_weeks ), + label: t('patient.dashboard.weeks_along'), + autocomplete: 'off', + help: t('patient.dashboard.currently', weeks: patient.last_menstrual_period_now_weeks, days: patient.last_menstrual_period_now_days) %> +
+
+ <%= f.select :last_menstrual_period_days, + options_for_select(days_options, patient.last_menstrual_period_days), + autocomplete: 'off', + skip_label: true, + help: t('patient.dashboard.called_on', date: patient.initial_call_date.strftime("%m/%d/%Y")) %> + <%= f.label :last_menstrual_period_days, t('common.days_along'), class: "sr-only" %> +
+ +
+ <%= f.date_field :appointment_date, + label: t('patient.shared.appt_date'), + autocomplete: 'off', + help: t('patient.dashboard.approx_gestation', weeks: patient.last_menstrual_period_at_appt_weeks, days: patient.last_menstrual_period_at_appt_days) %> +
+
+ +
+
+ <%= f.text_field :primary_phone, + value: patient.primary_phone_display, + label: t('patient.dashboard.phone'), + autocomplete: 'off' %> +
+ +
+ <%= f.text_field :pronouns, + value: patient.pronouns, + autocomplete: 'off' %> +
+ +
+
+ + +
+
+ +
+ <% if current_user.admin? %> +
+ +
+ <%= link_to t('patient.dashboard.delete'), + patient_path(patient), + class: 'btn btn-danger', + method: :delete, + data: { confirm: t('patient.dashboard.confirm_del', name: patient.name) } %> +
+
+ <% end %> +
+
+ <% end %>
From 169ba6aaf2d4a685fbb444eafd172fa148746f02 Mon Sep 17 00:00:00 2001 From: Kat Tipton Date: Wed, 17 Jul 2024 18:43:35 -0400 Subject: [PATCH 2/2] Revert "fix one failing test (our js is so fast now)" This reverts commit a8627591cd0203db47b72a05c4e9449dee983c34. --- test/system/update_patient_info_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/system/update_patient_info_test.rb b/test/system/update_patient_info_test.rb index 5735ee3cc..03d6306ee 100644 --- a/test/system/update_patient_info_test.rb +++ b/test/system/update_patient_info_test.rb @@ -293,7 +293,8 @@ class UpdatePatientInfoTest < ApplicationSystemTestCase it 'should flash failure on a bad field change' do fill_in 'Phone number', with: '111-222-3333445' - assert has_text? 'Primary phone is invalid' + click_away_from_field + assert has_text? 'Primary phone is the wrong length' end end