diff --git a/src/BCards.Web/Controllers/AdminController.cs b/src/BCards.Web/Controllers/AdminController.cs index 11baa2a..a35abde 100644 --- a/src/BCards.Web/Controllers/AdminController.cs +++ b/src/BCards.Web/Controllers/AdminController.cs @@ -558,10 +558,13 @@ public class AdminController : Controller var socialLinks = new List(); if (!string.IsNullOrEmpty(model.WhatsAppNumber)) { + var whatsappDigits = model.WhatsAppNumber + .Replace("https://wa.me/", "").Replace("whatsapp://", "") + .Replace("+", "").Replace(" ", "").Replace("-", "").Replace("(", "").Replace(")", ""); socialLinks.Add(new LinkItem { Title = "WhatsApp", - Url = $"https://wa.me/{model.WhatsAppNumber.Replace("+", "").Replace(" ", "").Replace("-", "").Replace("(", "").Replace(")", "")}", + Url = $"https://wa.me/{whatsappDigits}", Icon = "fab fa-whatsapp", IsActive = true, Order = userPage.Links.Count + socialLinks.Count @@ -837,6 +840,16 @@ public class AdminController : Controller FileSize = d.FileSize, UploadedAt = d.UploadedAt }).ToList() ?? new List(), + // Social media fields — extracted from Links so the edit form pre-fills correctly + WhatsAppNumber = page.Links?.FirstOrDefault(l => l.Icon?.Contains("whatsapp") == true)?.Url + ?.Replace("https://wa.me/", "").Replace("whatsapp://", "") ?? string.Empty, + FacebookUrl = page.Links?.FirstOrDefault(l => l.Icon?.Contains("facebook") == true)?.Url ?? string.Empty, + InstagramUrl = page.Links?.FirstOrDefault(l => l.Icon?.Contains("instagram") == true)?.Url ?? string.Empty, + TwitterUrl = page.Links?.FirstOrDefault(l => l.Icon?.Contains("twitter") == true)?.Url ?? string.Empty, + TiktokUrl = page.Links?.FirstOrDefault(l => l.Icon?.Contains("tiktok") == true)?.Url ?? string.Empty, + PinterestUrl = page.Links?.FirstOrDefault(l => l.Icon?.Contains("pinterest") == true)?.Url ?? string.Empty, + DiscordUrl = page.Links?.FirstOrDefault(l => l.Icon?.Contains("discord") == true)?.Url ?? string.Empty, + KawaiUrl = page.Links?.FirstOrDefault(l => l.Icon?.Contains("kawai") == true)?.Url ?? string.Empty, AvailableCategories = categories, AvailableThemes = themes.Where(t => !t.IsPremium || userPlanType.AllowsCustomThemes()).ToList(), MaxLinksAllowed = userPlanType.GetMaxLinksPerPage(), @@ -892,10 +905,13 @@ public class AdminController : Controller if (!string.IsNullOrEmpty(model.WhatsAppNumber)) { + var whatsappDigits = model.WhatsAppNumber + .Replace("https://wa.me/", "").Replace("whatsapp://", "") + .Replace("+", "").Replace(" ", "").Replace("-", "").Replace("(", "").Replace(")", ""); socialLinks.Add(new LinkItem { Title = "WhatsApp", - Url = $"https://wa.me/{model.WhatsAppNumber.Replace("+", "").Replace(" ", "").Replace("-", "").Replace("(", "").Replace(")", "")}", + Url = $"https://wa.me/{whatsappDigits}", Icon = "fab fa-whatsapp", IsActive = true, Order = currentOrder++ @@ -1241,10 +1257,13 @@ public class AdminController : Controller if (!string.IsNullOrEmpty(model.WhatsAppNumber)) { + var whatsappDigits = model.WhatsAppNumber + .Replace("https://wa.me/", "").Replace("whatsapp://", "") + .Replace("+", "").Replace(" ", "").Replace("-", "").Replace("(", "").Replace(")", ""); socialLinks.Add(new LinkItem { Title = "WhatsApp", - Url = $"https://wa.me/{model.WhatsAppNumber.Replace("+", "").Replace(" ", "").Replace("-", "").Replace("(", "").Replace(")", "")}", + Url = $"https://wa.me/{whatsappDigits}", Icon = "fab fa-whatsapp", IsActive = true, Order = currentOrder++ diff --git a/src/BCards.Web/Views/Admin/CreatePage.cshtml b/src/BCards.Web/Views/Admin/CreatePage.cshtml index 93fa622..a88a0b2 100644 --- a/src/BCards.Web/Views/Admin/CreatePage.cshtml +++ b/src/BCards.Web/Views/Admin/CreatePage.cshtml @@ -82,9 +82,15 @@
- +
+ + + + +
+ -
Máximo 3000 caracteres
+
Máximo 3000 caracteres. Use **negrito**, *itálico*, - item para listas.
@@ -616,4 +622,51 @@ function generatePreview() { @section Scripts { @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} + } \ No newline at end of file diff --git a/src/BCards.Web/Views/Admin/ManagePage.cshtml b/src/BCards.Web/Views/Admin/ManagePage.cshtml index 74f7314..36c302e 100644 --- a/src/BCards.Web/Views/Admin/ManagePage.cshtml +++ b/src/BCards.Web/Views/Admin/ManagePage.cshtml @@ -115,9 +115,15 @@
- +
+ + + + +
+ -
Máximo 3000 caracteres
+
Máximo 3000 caracteres. Use **negrito**, *itálico*, - item para listas.
@@ -1210,7 +1216,6 @@ @section Scripts { @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} -