Skip to content

Commit 8ee1388

Browse files
committed
feat: Introduce a new login page, lead documents controller, and associated test files and seeding tool.
1 parent 247813c commit 8ee1388

5 files changed

Lines changed: 69 additions & 32 deletions

File tree

LeadManagementPortal.Tests/LeadConversionIntegrityTests.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ public async Task ConvertToCustomerAsync_CreatesCustomerAndMarksLeadConverted_At
4242
var svc = CreateLeadService(context);
4343

4444
var now = DateTime.UtcNow;
45+
context.Users.Add(new ApplicationUser
46+
{
47+
Id = "rep-1",
48+
UserName = "rep-1@example.com",
49+
Email = "rep-1@example.com",
50+
FirstName = "Rep",
51+
LastName = "One",
52+
IsActive = true,
53+
SalesGroupId = "group-1"
54+
});
55+
context.SalesGroups.Add(new SalesGroup { Id = "group-1", Name = "Group 1" });
56+
4557
context.Leads.Add(new Lead
4658
{
4759
Id = "lead-1",
@@ -80,6 +92,18 @@ public async Task ConvertToCustomerAsync_ReturnsFalse_WhenCustomerAlreadyExistsF
8092
var svc = CreateLeadService(context);
8193

8294
var now = DateTime.UtcNow;
95+
context.Users.Add(new ApplicationUser
96+
{
97+
Id = "rep-1",
98+
UserName = "rep-1@example.com",
99+
Email = "rep-1@example.com",
100+
FirstName = "Rep",
101+
LastName = "One",
102+
IsActive = true,
103+
SalesGroupId = "group-1"
104+
});
105+
context.SalesGroups.Add(new SalesGroup { Id = "group-1", Name = "Group 1" });
106+
83107
context.Leads.Add(new Lead
84108
{
85109
Id = "lead-1",
@@ -122,4 +146,3 @@ public async Task ConvertToCustomerAsync_ReturnsFalse_WhenCustomerAlreadyExistsF
122146
}
123147
}
124148
}
125-

LeadManagementPortal.Tests/LeadDocumentsControllerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public async Task List_SalesOrgAdmin_AllowsAccess_ByOrgScope_NotGroupScope()
130130

131131
leadDocs
132132
.Setup(s => s.ListAsync("lead-1", It.IsAny<CancellationToken>()))
133-
.ReturnsAsync(new[] { });
133+
.ReturnsAsync(Array.Empty<LeadDocument>());
134134

135135
var controller = new LeadDocumentsController(leadDocs.Object, leadService.Object, userManager.Object)
136136
{

LeadManagementPortal.Tests/SeedingTool.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@ public async Task SeedDatabase()
2626

2727
// Try to find the real appsettings.json if not in base dir
2828
string projectDir = AppContext.BaseDirectory;
29-
while (!System.IO.File.Exists(System.IO.Path.Combine(projectDir, "appsettings.json")) && System.IO.Directory.GetParent(projectDir) != null)
29+
while (!System.IO.File.Exists(System.IO.Path.Combine(projectDir, "appsettings.json")))
3030
{
31-
projectDir = System.IO.Directory.GetParent(projectDir).FullName;
31+
var parent = System.IO.Directory.GetParent(projectDir);
32+
if (parent == null)
33+
{
34+
break;
35+
}
36+
37+
projectDir = parent.FullName;
3238
}
3339

3440
// If we found the web project dir, use its appsettings

LeadManagementPortal/Controllers/LeadDocumentsController.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ public async Task<IActionResult> Upload(string leadId, IFormFile file, Cancellat
3636
if (!await CanAccessLeadAsync(leadId)) return Forbid();
3737
if (file == null || file.Length == 0)
3838
{
39-
TempData["Error"] = "Please choose a file.";
39+
if (TempData != null)
40+
{
41+
TempData["Error"] = "Please choose a file.";
42+
}
43+
4044
return RedirectToAction("Details", "Leads", new { id = leadId });
4145
}
4246

@@ -59,7 +63,11 @@ await _leadDocs.AddAsync(
5963
uploadedByUserId: uploadedByUserId,
6064
ct: ct);
6165

62-
TempData["Success"] = "Document uploaded.";
66+
if (TempData != null)
67+
{
68+
TempData["Success"] = "Document uploaded.";
69+
}
70+
6371
return RedirectToAction("Details", "Leads", new { id = leadId });
6472
}
6573

LeadManagementPortal/Views/Account/Login.cshtml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
height: min(70vh, 560px);
6262
opacity: 0.94;
6363
filter: blur(4.5px);
64-
animation: stripeDrift 4.8s cubic-bezier(0.38, 0.05, 0.24, 0.98) infinite;
64+
animation: stripeDrift 5.52s cubic-bezier(0.38, 0.05, 0.24, 0.98) infinite;
6565
will-change: transform;
6666
overflow: visible;
6767
}
@@ -79,63 +79,63 @@
7979
stroke-width: 76;
8080
opacity: 0.88;
8181
filter: drop-shadow(0 0 8px rgba(29, 78, 216, 0.36));
82-
animation: stripeWaveOne 2.9s ease-in-out infinite;
82+
animation: stripeWaveOne 3.34s ease-in-out infinite;
8383
}
8484
8585
.stripe-2 {
8686
stroke: url(#stripePurple);
8787
stroke-width: 58;
8888
opacity: 0.8;
8989
filter: drop-shadow(0 0 10px rgba(109, 40, 217, 0.3));
90-
animation: stripeWaveTwo 3.25s ease-in-out infinite;
90+
animation: stripeWaveTwo 3.74s ease-in-out infinite;
9191
}
9292
9393
.stripe-3 {
9494
stroke: url(#stripeSky);
9595
stroke-width: 40;
9696
opacity: 0.68;
9797
filter: drop-shadow(0 0 9px rgba(59, 130, 246, 0.28));
98-
animation: stripeWaveThree 2.6s ease-in-out infinite;
98+
animation: stripeWaveThree 2.99s ease-in-out infinite;
9999
}
100100
101101
.stripe-4 {
102102
stroke: url(#stripeHighlight);
103103
stroke-width: 20;
104104
opacity: 0.58;
105105
filter: drop-shadow(0 0 8px rgba(219, 234, 254, 0.45));
106-
animation: stripeWaveFour 2.2s ease-in-out infinite;
106+
animation: stripeWaveFour 2.53s ease-in-out infinite;
107107
}
108108
109109
.stripe-5 {
110110
stroke: url(#stripeYellow);
111111
stroke-width: 35;
112-
opacity: 0.85;
113-
filter: drop-shadow(0 0 8px rgba(234, 179, 8, 0.36));
114-
animation: stripeWaveOne 3.1s ease-in-out infinite;
112+
opacity: 0.9;
113+
filter: drop-shadow(0 0 10px rgba(255, 220, 0, 0.45));
114+
animation: stripeWaveOne 3.57s ease-in-out infinite;
115115
}
116116
117117
.stripe-6 {
118118
stroke: url(#stripeRed);
119119
stroke-width: 25;
120120
opacity: 0.75;
121-
filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.3));
122-
animation: stripeWaveTwo 2.8s ease-in-out infinite;
121+
filter: drop-shadow(0 0 10px rgba(74, 222, 128, 0.3));
122+
animation: stripeWaveTwo 3.22s ease-in-out infinite;
123123
}
124124
125125
.stripe-7 {
126126
stroke: url(#stripeSky);
127127
stroke-width: 15;
128128
opacity: 0.65;
129129
filter: drop-shadow(0 0 9px rgba(59, 130, 246, 0.28));
130-
animation: stripeWaveThree 3.4s ease-in-out infinite;
130+
animation: stripeWaveThree 3.91s ease-in-out infinite;
131131
}
132132
133133
.stripe-8 {
134134
stroke: url(#stripeHighlight);
135135
stroke-width: 8;
136136
opacity: 0.55;
137137
filter: drop-shadow(0 0 8px rgba(219, 234, 254, 0.45));
138-
animation: stripeWaveFour 2.5s ease-in-out infinite;
138+
animation: stripeWaveFour 2.88s ease-in-out infinite;
139139
}
140140
141141
.corner-glow {
@@ -184,37 +184,37 @@
184184
}
185185
186186
50% {
187-
transform: translate3d(-40px, 28px, 0) scale(1.09);
187+
transform: translate3d(-48px, 34px, 0) scale(1.11);
188188
}
189189
}
190190
191191
@@keyframes stripeWaveOne {
192192
0%, 100% {
193-
transform: rotate(-0.4deg) translateY(0);
193+
transform: rotate(-0.48deg) translateY(0);
194194
}
195195
196196
50% {
197-
transform: rotate(1.35deg) translateY(10px);
197+
transform: rotate(1.62deg) translateY(12px);
198198
}
199199
}
200200
201201
@@keyframes stripeWaveTwo {
202202
0%, 100% {
203-
transform: rotate(0.3deg) translateY(0);
203+
transform: rotate(0.36deg) translateY(0);
204204
}
205205
206206
50% {
207-
transform: rotate(-1.05deg) translateY(-10px);
207+
transform: rotate(-1.26deg) translateY(-12px);
208208
}
209209
}
210210
211211
@@keyframes stripeWaveThree {
212212
0%, 100% {
213-
transform: rotate(-0.25deg) translateY(0);
213+
transform: rotate(-0.3deg) translateY(0);
214214
}
215215
216216
50% {
217-
transform: rotate(1.5deg) translateY(12px);
217+
transform: rotate(1.8deg) translateY(14.4px);
218218
}
219219
}
220220
@@ -224,7 +224,7 @@
224224
}
225225
226226
50% {
227-
transform: rotate(-1.8deg) translateY(-14px);
227+
transform: rotate(-2.16deg) translateY(-16.8px);
228228
}
229229
}
230230
@@ -445,14 +445,14 @@
445445
<stop offset="100%" stop-color="rgba(191, 219, 254, 0.42)" />
446446
</linearGradient>
447447
<linearGradient id="stripeYellow" x1="0%" y1="0%" x2="100%" y2="100%">
448-
<stop offset="0%" stop-color="rgba(253, 224, 71, 0.9)" />
449-
<stop offset="52%" stop-color="rgba(234, 179, 8, 0.9)" />
450-
<stop offset="100%" stop-color="rgba(202, 138, 4, 0.86)" />
448+
<stop offset="0%" stop-color="rgba(255, 245, 0, 1)" />
449+
<stop offset="52%" stop-color="rgba(255, 220, 0, 1)" />
450+
<stop offset="100%" stop-color="rgba(250, 200, 0, 0.95)" />
451451
</linearGradient>
452452
<linearGradient id="stripeRed" x1="6%" y1="8%" x2="100%" y2="92%">
453-
<stop offset="0%" stop-color="rgba(252, 165, 165, 0.82)" />
454-
<stop offset="52%" stop-color="rgba(239, 68, 68, 0.9)" />
455-
<stop offset="100%" stop-color="rgba(185, 28, 28, 0.8)" />
453+
<stop offset="0%" stop-color="rgba(134, 239, 172, 0.9)" />
454+
<stop offset="52%" stop-color="rgba(74, 222, 128, 0.92)" />
455+
<stop offset="100%" stop-color="rgba(34, 197, 94, 0.85)" />
456456
</linearGradient>
457457
</defs>
458458
<path class="stripe stripe-1" d="M 120 -180 C 390 72 470 204 740 510" />

0 commit comments

Comments
 (0)