From 3da10a16d9a6283cfb1016e60fece7525df80bb6 Mon Sep 17 00:00:00 2001 From: temi Date: Fri, 9 Feb 2024 17:10:46 +1100 Subject: [PATCH] - delete downloaded species of a survey --- grails-app/assets/javascripts/entities.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/grails-app/assets/javascripts/entities.js b/grails-app/assets/javascripts/entities.js index 9aca165..b378a2d 100644 --- a/grails-app/assets/javascripts/entities.js +++ b/grails-app/assets/javascripts/entities.js @@ -428,6 +428,25 @@ var entities = (function () { return $.when.apply($, promises); } + function deleteSpeciesForProjectActivity(pa) { + var promises = []; + pa.speciesFields && pa.speciesFields.forEach(function (field) { + var config = field.config, type = config.type; + console.log("fetching species"); + switch (type) { + case GROUP: + case SINGLE: + promises.push(deleteSpeciesEntries(pa.projectActivityId, field.dataFieldName, field.output)); + break; + case ALL: + promises.push(deleteAllSpecies()); + break; + } + }); + + return $.when.apply($, promises); + } + function onlineGetSpeciesForProjectActivityAndFieldInOutput(offset, projectActivityId, dataFieldName, outputName, limit) { return $.ajax({ url: fcConfig.fetchSpeciesUrl, data: { @@ -833,6 +852,7 @@ var entities = (function () { countAllSpecies: countAllSpecies, offlineGetDocument: offlineGetDocument, getProjectActivityMetadata: getProjectActivityMetadata, + deleteSpeciesForProjectActivity: deleteSpeciesForProjectActivity, getSpeciesForProjectActivity: getSpeciesForProjectActivity, bulkDeleteDocuments: bulkDeleteDocuments, deleteSites: deleteSites,