From 98728a03045fbd3b59c9805043e934d413deccf2 Mon Sep 17 00:00:00 2001
From: Dev-Christon <devchriston@gmail.com>
Date: Tue, 18 Feb 2025 17:14:29 +0300
Subject: [PATCH] up invitation status

---
 views/admin/communityMailing.php | 39 +++++++++++++++++---------------
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/views/admin/communityMailing.php b/views/admin/communityMailing.php
index b3e2dbcf9..99d345948 100755
--- a/views/admin/communityMailing.php
+++ b/views/admin/communityMailing.php
@@ -215,7 +215,7 @@ jQuery(document).ready(function() {
 	var emailList = emailMembers.map(function(v){return v[0]});
 	
 	var selectedMailByRole = [];
-	let listInvitation = {}; //"mail@mqdf.com" : "Non lu / accepté / refusé",
+	var listInvitation = {};
 
 
 	for (let index = 0; index < rolesMembers.length; index++){
@@ -274,7 +274,10 @@ jQuery(document).ready(function() {
 			if(valideEmail(email)) {
 				validEmails.push(email);
 				selectedMailByRole = validEmails.join(",");
-				listInvitation[email] = "Non lu";
+				listInvitation["listInvitation."+slugify(email, email)] = {
+					"email": email, 
+					"status": "Non lu"
+				}
 			} else {
 				invalidEmails.push(email);
 			}
@@ -303,22 +306,22 @@ jQuery(document).ready(function() {
 	}
 
 	$(".email-badge.invalid").on("click", function(){
-			//alert("here we go");
-			let emailToEdit = $(this).text();
-			let currentEmails = $("#txtTo").val();
-			let updatedEmails = currentEmails.split(/[\s,;+/]+/).filter( e => e.trim() !== emailToEdit);
-			$("#txtTo").val(updatedEmails+ (updatedEmails?', ': "") + emailToEdit).focus();
-		});
+		//alert("here we go");
+		let emailToEdit = $(this).text();
+		let currentEmails = $("#txtTo").val();
+		let updatedEmails = currentEmails.split(/[\s,;+/]+/).filter( e => e.trim() !== emailToEdit);
+		$("#txtTo").val(updatedEmails+ (updatedEmails?', ': "") + emailToEdit).focus();
+	});
 	
-		function boldText(el) {
-			//alert("here we go"+JSON.stringify($(el).attr("class")));
-			var start = txtarea.selectionStart;
-			var end = txtarea.selectionEnd;
-			var sel = txtarea.value.substring(start, end);
-			var finText = txtarea.value.substring(0, start) + '[b]' + sel + '[/b]' + txtarea.value.substring(end);
-			txtarea.value = finText;
-			txtarea.focus();
-		}
+	function boldText(el) {
+		//alert("here we go"+JSON.stringify($(el).attr("class")));
+		var start = txtarea.selectionStart;
+		var end = txtarea.selectionEnd;
+		var sel = txtarea.value.substring(start, end);
+		var finText = txtarea.value.substring(0, start) + '[b]' + sel + '[/b]' + txtarea.value.substring(end);
+		txtarea.value = finText;
+		txtarea.focus();
+	}
 
 	// Send email
 	$("#btnSend").on("click", function(){
@@ -373,7 +376,7 @@ jQuery(document).ready(function() {
 							{
 								id:costum.contextId,
 								collection:costum.contextType,
-								path:"listInvitation",
+								path:"allToRoot",
 								value:listInvitation,
 								updateCache : true
 							}, function(){});
-- 
GitLab