Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

NMRL-125 New Analysis Request Add form outside the client and patient #7

Merged
merged 1 commit into from
Mar 10, 2017
Merged
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
Filters in JS when Client/Patient selected.
  • Loading branch information
nihadness committed Mar 9, 2017
commit 947d6b4cfd9f3840e0003babce4e958c93226c04
22 changes: 22 additions & 0 deletions bika/health/static/js/bika.health.analysisrequest.add.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function HealthAnalysisRequestAddView() {
datafilled = false;
frombatch = window.location.href.search('/batches/') >= 0;
frompatient = document.referrer.search('/patients/') >= 0;
fromars = window.location.href.search('/analysisrequests/') >=0;

if (frombatch) {
// The current AR add View comes from a batch. Automatically fill
Expand All @@ -25,6 +26,15 @@ function HealthAnalysisRequestAddView() {
// as readonly.
pid = document.referrer.split("/patients/")[1].split("/")[0];
datafilled = fillDataFromPatient(pid);
} else if(fromars){
$('input[id^="Client-"]').bind("selected paste blur change", function () {
colposition = get_arnum(this);
if (colposition == undefined){
// we are on the specific health template
colposition = 0}
resetPatientData(colposition)
filterComboSearches();
});
}

if (!datafilled) {
Expand Down Expand Up @@ -110,6 +120,13 @@ function HealthAnalysisRequestAddView() {
.attr('uid', 'anonymous');
$("#Patient-" + colposition + "_uid").val('anonymous');
}
if (data['ClientUID'] != '') {
$("#Client-" + colposition)
.val(data['ClientTitle'])
.attr('uid', data['ClientUID'])
.combogrid("option", "disabled", false);
$("#Client-" + colposition + "_uid").val(data['ClientUID']);
}
}
});
} else {
Expand Down Expand Up @@ -144,6 +161,11 @@ function HealthAnalysisRequestAddView() {
$("#ClientPatientID-" + colposition).val(data['ClientPatientID']);
$("#ClientPatientID-" + colposition).attr('uid', uid);
$("#ClientPatientID-" + colposition + "_uid").val(uid);
$("#Client-" + colposition)
.val(data['ClientTitle'])
.attr('uid', data['ClientUID'])
.combogrid("option", "disabled", false);
$("#Client-" + colposition + "_uid").val(data['ClientUID']);
}
});
} else {
Expand Down