aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-02-18 16:26:45 -0600
committerFrederick Muriuki Muriithi2025-02-18 16:26:45 -0600
commitafad2ae40f32ea677b77b28176ac07268f6fa594 (patch)
tree871725fdd73573f41bfc3feaadfad82f0b3c74ab
parent75add682a8d63a30e947b6bcd8d2e5dfee06c297 (diff)
downloadgn-uploader-afad2ae40f32ea677b77b28176ac07268f6fa594.tar.gz
Add missing scripts.rework-species-selection
-rw-r--r--uploader/static/js/populations.js40
-rw-r--r--uploader/static/js/species.js39
2 files changed, 79 insertions, 0 deletions
diff --git a/uploader/static/js/populations.js b/uploader/static/js/populations.js
new file mode 100644
index 0000000..ded9b10
--- /dev/null
+++ b/uploader/static/js/populations.js
@@ -0,0 +1,40 @@
+var populationDataTable = (populationdata) => {
+ var lengthMenu = [10, 25, 50, 100, 1000];
+ if(populationdata.length > 1000) {
+ lengthMenu.push(populationdata.length)
+ }
+ $("#tbl-select-population").DataTable({
+ responsive: true,
+ lengthMenu: lengthMenu,
+ language: {
+ processing: "Processing… Please wait.",
+ loadingRecords: "Loading population — Please wait.",
+ lengthMenu: "Show _MENU_ populations",
+ info: "Showing _START_ to _END_ of _TOTAL_ populations"
+ },
+ data: populationdata,
+ columns: [
+ {
+ data: (apopulation) => {
+ return `<input type="radio" name="population_id"`
+ + `id="rdo_population_id_${apopulation.InbredSetId}" `
+ + `value="${apopulation.InbredSetId}">`;
+ }
+ },
+ {
+ data: (apopulation) => {
+ return `<label for="rdo_population_id_${apopulation.InbredSetId}" `
+ + `class="control-label" style="font-weight: 1;">`
+ + `${apopulation.FullName} (${apopulation.InbredSetName})`
+ + `</label>`;
+ }
+ }
+ ]
+ });
+};
+
+
+$(() => {
+ populationDataTable(JSON.parse(
+ $("#tbl-select-population").attr("data-populations-list")));
+});
diff --git a/uploader/static/js/species.js b/uploader/static/js/species.js
new file mode 100644
index 0000000..b070725
--- /dev/null
+++ b/uploader/static/js/species.js
@@ -0,0 +1,39 @@
+var speciesDataTable = (speciesdata) => {
+ var lengthMenu = [10, 25, 50, 100, 1000];
+ if(speciesdata.length > 1000) {
+ lengthMenu.push(speciesdata.length)
+ }
+ $("#tbl-select-species").DataTable({
+ responsive: true,
+ lengthMenu: lengthMenu,
+ language: {
+ processing: "Processing… Please wait.",
+ loadingRecords: "Loading species — Please wait.",
+ lengthMenu: "Show _MENU_ species",
+ info: "Showing _START_ to _END_ of _TOTAL_ species"
+ },
+ data: speciesdata,
+ columns: [
+ {
+ data: (aspecies) => {
+ return `<input type="radio" name="species_id"`
+ + `id="rdo_species_id_${aspecies.SpeciesId}" `
+ + `value="${aspecies.SpeciesId}">`;
+ }
+ },
+ {
+ data: (aspecies) => {
+ return `<label for="rdo_species_id_${aspecies.SpeciesId}" `
+ + `class="control-label" style="font-weight: 1;">`
+ + `${aspecies.FullName} (${aspecies.SpeciesName})`
+ + `</label>`;
+ }
+ }
+ ]
+ });
+};
+
+$(() => {
+ speciesDataTable(JSON.parse(
+ $("#tbl-select-species").attr("data-species-list")));
+});