+ {organizationNotificationChannels.length === 0 ? (
+
+ No alerts policy in organization
+
+ ) : fields.length === 0 ? (
+
+ No alert policy, create one
+
+ ) : (
+ fields.map((field, index) => (
+
+
+
+ {
+
+
+ const selectedIds = form
+ .watch("alertPolicies")
+ .map((a: AlertPolicyType) => a.notificationChannelId)
+ .filter(Boolean);
+
+ const availableNotificationChannels = notificationChannels.filter(
+ (channel) =>
+ channel.id.toString() === field.value?.toString() ||
+ !selectedIds.includes(channel.id.toString())
+ );
+
+ return (
+
+
+
+
+ );
+ }}
+ />
+
+ (
+
+
+
+
+
+ )}
+ />
+
+
+
+
+
+
+
+ {index + 1 < fields.length &&
}
+
+ ))
+ )}
+