Skip to content

Commit

Permalink
Add registered samples to ajax request
Browse files Browse the repository at this point in the history
  • Loading branch information
kdp-cloud committed Jan 10, 2024
1 parent 4d8f9fa commit 173c82a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/views/single_pages/sample_upload_content.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,20 @@
cells = $j(row).find('td:not(:has(".danger"))').toArray();
samplesObj = {};
cells.map(function(cell){
val = cell.textContent;
key = cell.id.match(/\[.*\]/)[0].replace('[', "").replace("]", '');
const multiInputfields = $j(cell).find('span[class*="badge"]').toArray();
const cvListFields = $j(cell).find('span[class*="label"]').toArray();
const val = cell.textContent;
const key = cell.id.match(/\[.*\]/)[0].replace('[', "").replace("]", '');
const multiInputfields = $j(cell).find('span[data-attr_type="seek-sample-multi"]').toArray();
const cvListFields = $j(cell).find('span[data-attr_type="cv-list"]').toArray();
const seekSample = $j(cell).find('span[data-attr_type="seek-sample"]');

if (multiInputfields.length > 0 ){
const inputIds = multiInputfields.map(is => is.title.split(" ").pop()).join(',');
samplesObj[key] = inputIds;
} else if (cvListFields.length > 0){
cvTerms = cvListFields.map(cvt => cvt.title)
samplesObj[key] = cvTerms;
} else if (seekSample.length > 0) {
samplesObj[key] = seekSample[0].title
} else {
samplesObj[key] = val;
}
Expand Down

0 comments on commit 173c82a

Please sign in to comment.