|
@@ -191,17 +191,26 @@ function(el,formList,roleAndSite,formId=null,idLabel=null,elError=null){
|
|
|
|
|
|
let table=crfHTML.createTable(null,el);
|
|
|
let row=table.insertRow();
|
|
|
- let n=formList.length;
|
|
|
let that=this;
|
|
|
|
|
|
- for (let i=0;i<n;i++){
|
|
|
+ let n=0;
|
|
|
+ let deletedForms=new Array();
|
|
|
+
|
|
|
+ for (let i=0;i<formList.length;i++){
|
|
|
let entry=formList[i];
|
|
|
+ let stat=entry['FormStatus'];
|
|
|
+ let formStatus=crfSetup.getMap('formStatus')[stat];
|
|
|
+ //skip deleted forms
|
|
|
+ if (formStatus=='Deleted'){
|
|
|
+ deletedForms.push(entry);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ n+=1;
|
|
|
let cell=row.insertCell(i);
|
|
|
crfHTML.addStyle(cell,'stretch');
|
|
|
|
|
|
let fbox=crfHTML.createBox(null,cell);
|
|
|
//colormap of formStatus to colors
|
|
|
- let stat=entry['FormStatus'];
|
|
|
|
|
|
let style=crfSetup.getEntryMap('formStatus')[stat]['color'];
|
|
|
if (!style) style='gold';
|
|
@@ -210,7 +219,6 @@ function(el,formList,roleAndSite,formId=null,idLabel=null,elError=null){
|
|
|
|
|
|
let user=crfSetup.getMap('users')[entry['UserId']];
|
|
|
let idLabel=crfSetup.getParticipantLabel(entry);
|
|
|
- let formStatus=crfSetup.getMap('formStatus')[stat];
|
|
|
let text=[entry['entryId'],user,idLabel,formStatus];
|
|
|
fbox.onclick=function(){that.openForm(entry,roleAndSite,elError);};
|
|
|
|
|
@@ -218,9 +226,12 @@ function(el,formList,roleAndSite,formId=null,idLabel=null,elError=null){
|
|
|
crfHTML.createParagraph(text[j],null,fbox);
|
|
|
}
|
|
|
}
|
|
|
+ //formId=0 reserverd for forms created when new patients are added
|
|
|
if (!formId) return table;
|
|
|
let formEntry=crfSetup.getEntryMap('dataForms')[formId];
|
|
|
this.print(fName+' unique '+formEntry['unique']);
|
|
|
+
|
|
|
+ this.addDeletedForms(row,deletedForms);
|
|
|
|
|
|
if (n>0 && formEntry['unique']=='TRUE') return table;
|
|
|
|
|
@@ -239,6 +250,41 @@ function(el,formList,roleAndSite,formId=null,idLabel=null,elError=null){
|
|
|
|
|
|
}
|
|
|
|
|
|
+formPortal.addDeletedForms=
|
|
|
+function(row,deletedForms){
|
|
|
+ //display deleted forms
|
|
|
+
|
|
|
+ let fName="[addDeletedForms]";
|
|
|
+ this.print(fName+": "+deletedForms.length);
|
|
|
+ for (let i=0;i<deletedForms.length;i++){
|
|
|
+ let entry=deletedForms[i];
|
|
|
+ let stat=entry['FormStatus'];
|
|
|
+ let formStatus=crfSetup.getMap('formStatus')[stat];
|
|
|
+
|
|
|
+ let cell=row.insertCell(i);
|
|
|
+ crfHTML.addStyle(cell,'stretch');
|
|
|
+
|
|
|
+ let fbox=crfHTML.createBox(null,cell);
|
|
|
+ //colormap of formStatus to colors
|
|
|
+
|
|
|
+ let style=crfSetup.getEntryMap('formStatus')[stat]['color'];
|
|
|
+ if (!style) style='gold';
|
|
|
+ crfHTML.addStyle(fbox,style);
|
|
|
+ this.print(fName+' setting style ['+i+'] '+style);
|
|
|
+
|
|
|
+ let user=crfSetup.getMap('users')[entry['UserId']];
|
|
|
+ let idLabel=crfSetup.getParticipantLabel(entry);
|
|
|
+ let text=[entry['entryId'],user,idLabel,formStatus];
|
|
|
+ //fbox.onclick=function(){that.openForm(entry,roleAndSite,elError);};
|
|
|
+
|
|
|
+ for (let j=0;j<text.length;j++){
|
|
|
+ crfHTML.createParagraph(text[j],null,fbox);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
formPortal.openForm=
|
|
|
function(crfEntry,roleAndSite,elError=null){
|
|
|
let fName="[openForm]";
|