>$scope.matrixAttributesChanged = function (rowId, columnId) { > log.debug("matrixAttributesChanged - rowId=" + rowId + " columnId=" + columnId); > let inventoryMatrix = undefined; > let index = undefined; > > if (rowId && columnId) { > let key = rowId.toString() + "|" + columnId.toString(); > if (changedInventoryObjects.length > 0) { > log.debug("changedInventoryObjects contains changed inventory objects already"); > > // Search for that object already in the array > index = changedInventoryObjects.findIndex(x => x.index == key); > if (index >= 0) { > inventoryMatrix = Object.assign({}, changedInventoryObjects[index].inventoryObject); > } > } > > if (inventorySaveCheck()) { > $scope.form.editRetailForm.editRetailMatrixForm.$setPristine(); > let clone = Object.assign({}, $scope.currentIitem); > > changedInventoryObjects.push({ > index: key, > inventoryObject: clone > }); // make collection of changed matrix inventory objects > } > > > if (inventoryMatrix) { > $scope.currentIitem = inventoryMatrix; > } > else { > log.debug("Getting inventory row..."); > services.IItem.getByItemIdAndAttributes($scope.currentItem.itemId, rowId, columnId). > then(function (results) { > > $scope.currentIitem = results; > $scope.currentIitem.rowValueId = rowId; > $scope.currentIitem.columnValueId = columnId; > if ($scope.currentIitem.inventId == 0) { > $scope.currentIitem.itemId = $scope.currentItem.itemId; > $scope.currentIitem.department = $scope.currentItem.department; > $scope.currentIitem.category = $scope.currentItem.category; > $scope.currentIitem.item = $scope.currentItem.item; > $scope.currentIitem.descrip = getMatrixDescription(rowId, columnId); > } > > // log.debug($scope.currentIitem); > > }); > } > } > }>