Skip to content

Commit

Permalink
Move guard clause to populateDropdowns function
Browse files Browse the repository at this point in the history
  • Loading branch information
coalest committed Nov 24, 2024
1 parent 71698f4 commit 9456925
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/javascript/utils/distributions_and_transfers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ function newOption(item, selectedValue, includeQuantity) {
};

function populateDropdowns(objects, inventory) {
if (!inventory) return;

const includeQuantity = $("select.storage-location-source").attr("id") !== "audit_storage_location_id";

objects.each(function(_, element) {
Expand Down Expand Up @@ -75,12 +77,10 @@ $(function() {
"form.storage-location-required",
function(e) {
const insertedItem = $(e.detail);
populateDropdowns($("select", insertedItem), dropdownOptions);
insertedItem
.find("input.__barcode_item_lookup")
.attr("id", `_barcode-lookup-${$(".nested-fields").length - 1}`);
if (dropdownOptions) {
populateDropdowns($("select", insertedItem), dropdownOptions);
}
}
);

Expand Down

0 comments on commit 9456925

Please sign in to comment.