diff --git a/webapp/src/components/AddToCollectionModal.vue b/webapp/src/components/AddToCollectionModal.vue new file mode 100644 index 000000000..a7a88b96b --- /dev/null +++ b/webapp/src/components/AddToCollectionModal.vue @@ -0,0 +1,95 @@ + + + + Add to collections + + + + Items Selected: + + + + + + + + Insert into collection: + + + + + + + + + + + diff --git a/webapp/src/components/SampleTablePrime.vue b/webapp/src/components/SampleTablePrime.vue index 5e9aa0f1a..9e9b66d30 100644 --- a/webapp/src/components/SampleTablePrime.vue +++ b/webapp/src/components/SampleTablePrime.vue @@ -32,18 +32,27 @@ - + Add an item - + Add batch of samples - + + Add to collection + + Delete selected @@ -111,11 +120,17 @@ + @@ -244,7 +265,8 @@ export default { visibility: visible !important; } -.button-right { +.button-group > * { + display: flex; gap: 0.5em; } diff --git a/webapp/src/server_fetch_utils.js b/webapp/src/server_fetch_utils.js index ee98cd286..2ea5eae62 100644 --- a/webapp/src/server_fetch_utils.js +++ b/webapp/src/server_fetch_utils.js @@ -704,3 +704,22 @@ export function getBlocksInfos() { throw error; }); } + +export function addItemsToCollection(collectionId, refcodes) { + return fetch_post(`${API_URL}/collections/${collectionId}`, { + data: { refcodes }, + }) + .then(function (response_json) { + if (response_json.status === "success") { + console.log("Items added to collection successfully!"); + return response_json; + } else { + console.error("Failed to add items to collection."); + throw new Error("Failed to add items to collection."); + } + }) + .catch(function (error) { + alert("Error adding items to collection: ", error); + throw error; + }); +}