Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHM-8098: update multiple edd elements on the same form #521

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion configuration/pih/htmlforms/covid19Intake.xml
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@
<span id="calculated-edd-label">
<uimessage code="pihcore.calculatedEstimatedDeliveryDate"/>:&#160;
</span><br/>
<span id='calculated-edd' class="calculated-edd value"></span>
<span id='calculated-edd-value' class="calculated-edd value"></span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't insist on using ids @cioan . If you are going to write code that simulates using classes, you might as well use them.

</span>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion configuration/pih/htmlforms/section-history.xml
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@
<span id="calculated-edd-label">
<uimessage code="pihcore.calculatedEstimatedDeliveryDate"/>:&#160;
</span><br/>
<span id='calculated-edd' class="calculated-edd value"></span>
<span id='calculated-edd-value' class="calculated-edd value"></span>
</span>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions configuration/pih/htmlforms/section-obgyn-initial.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@
<span id="calculated-edd-label">
<uimessage code="pihcore.calculatedEstimatedDeliveryDate"/>:&#160;
</span><br/>
<span id='calculated-edd' class="calculated-edd value"></span>
<span id='calculated-edd-value' class="calculated-edd value"></span>
</span>
</div>
</div>
Expand Down Expand Up @@ -1710,7 +1710,7 @@
<span id="calculated-edd-label">
<uimessage code="pihcore.calculatedEstimatedDeliveryDate"/>:&#160;
</span><br/>
<span id='calculated-edd' class="calculated-edd value"></span>
<span id='calculated-edd-value' class="calculated-edd value"></span>
</span>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions configuration/pih/scripts/global/mch.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ function setUpEdd(currentEncounterDate, msgWeeks) {
const gestAgeText = calculateGestationalDays(lastPeriodDate, currentEncounterDate, msgWeeks);
const edd = calculateExpectedDeliveryDate(lastPeriodDate);
const locale = window.sessionContext.locale || navigator.language;
jq("#calculated-edd-and-gestational").show();
jq("div[id^=calculated-edd-and-gestational]").show();
getField("edd.value").datepicker("setDate", edd);
jq("#calculated-edd").text((Intl.DateTimeFormat(locale, { dateStyle: "medium" })).format(edd));
jq("#calculated-gestational-age-value").text(gestAgeText);
jq("span[id^=calculated-edd-value]").text((Intl.DateTimeFormat(locale, { dateStyle: "medium" })).format(edd));
jq("span[id^=calculated-gestational-age-value]").text(gestAgeText);
} else {
jq("#calculated-edd-and-gestational").hide();
jq("div[id^=calculated-edd-and-gestational]").hide();
}
};

jq("#calculated-edd-and-gestational").hide();
jq("div[id^=calculated-edd-and-gestational]").hide();
jq("#lastPeriodDate input[type='hidden']").change(function () {
updateEdd();
});
Expand Down