Adds utility function to determine if a need isEditable or not
@@ -88,6 +88,29 @@ export function isUsableAsTemplate(need) {
);
}
+/**
+ * This checks if the need is allowed to be edited,
+ * it is only allowed if the need exists, and if it is OWNED and not one of the following:
+ * - DirectResponseNeed
+ * - WhatsAroundNeed
+ * - WhatsNewNeed
+ * - SearchNeed
+ * @param need
+ * @returns {*|boolean}
+ */
+export function isEditable(need) {
+ return (
+ need &&
+ isOwned(need) &&
+ !(
+ isDirectResponseNeed(need) ||
+ isWhatsAroundNeed(need) ||
+ isWhatsNewNeed(need) ||
+ isSearchNeed(need)
+ )
+ );
+}
+
/**
* Determines if a given need is a DirectResponse-Need
* @param need
