Skip to content

Commit 9afc325

Browse files
committed
CU-868a5nz1n Fixing error in ViewCallEx call.
1 parent a82c606 commit 9afc325

File tree

2 files changed

+35
-18
lines changed

2 files changed

+35
-18
lines changed

Web/Resgrid.Web/Areas/User/Controllers/DispatchController.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,12 +1371,12 @@ public async Task<IActionResult> CallExportEx(string query)
13711371
var model = new CallExportView();
13721372
model.Call = await _callsService.PopulateCallData(call, true, true, true, true, true, true, true, true, true);
13731373
model.CallLogs = await _workLogsService.GetCallLogsForCallAsync(call.CallId);
1374-
model.Department = await _departmentsService.GetDepartmentByIdAsync(model.Call.DepartmentId, false);
1375-
model.UnitStates = (await _unitsService.GetUnitStatesForCallAsync(model.Call.DepartmentId, call.CallId)).OrderBy(x => x.UnitId).OrderBy(y => y.Timestamp).ToList();
1376-
model.ActionLogs = (await _actionLogsService.GetActionLogsForCallAsync(model.Call.DepartmentId, call.CallId)).OrderBy(x => x.UserId).OrderBy(y => y.Timestamp).ToList();
1377-
model.Groups = await _departmentGroupsService.GetAllGroupsForDepartmentAsync(model.Call.DepartmentId);
1378-
model.Units = await _unitsService.GetUnitsForDepartmentAsync(DepartmentId);
1379-
model.Names = await _departmentsService.GetAllPersonnelNamesForDepartmentAsync(DepartmentId);
1374+
model.Department = await _departmentsService.GetDepartmentByIdAsync(call.DepartmentId, false);
1375+
model.UnitStates = (await _unitsService.GetUnitStatesForCallAsync(call.DepartmentId, call.CallId)).OrderBy(x => x.UnitId).OrderBy(y => y.Timestamp).ToList();
1376+
model.ActionLogs = (await _actionLogsService.GetActionLogsForCallAsync(call.DepartmentId, call.CallId)).OrderBy(x => x.UserId).OrderBy(y => y.Timestamp).ToList();
1377+
model.Groups = await _departmentGroupsService.GetAllGroupsForDepartmentAsync(call.DepartmentId);
1378+
model.Units = await _unitsService.GetUnitsForDepartmentAsync(call.DepartmentId);
1379+
model.Names = await _departmentsService.GetAllPersonnelNamesForDepartmentAsync(call.DepartmentId);
13801380
model.ChildCalls = await _callsService.GetChildCallsForCallAsync(call.CallId);
13811381
model.Contacts = await _contactsService.GetAllContactsForDepartmentAsync(DepartmentId);
13821382

@@ -1400,11 +1400,14 @@ public async Task<IActionResult> CallExportEx(string query)
14001400
var model = new CallExportView();
14011401
model.Call = await _callsService.PopulateCallData(call, true, true, true, true, true, true, true, true, true);
14021402
model.CallLogs = await _workLogsService.GetCallLogsForCallAsync(call.CallId);
1403-
model.Department = await _departmentsService.GetDepartmentByIdAsync(model.Call.DepartmentId, false);
1404-
model.UnitStates = (await _unitsService.GetUnitStatesForCallAsync(model.Call.DepartmentId, call.CallId)).OrderBy(x => x.UnitId).OrderBy(y => y.Timestamp).ToList();
1405-
model.ActionLogs = (await _actionLogsService.GetActionLogsForCallAsync(model.Call.DepartmentId, call.CallId)).OrderBy(x => x.UserId).OrderBy(y => y.Timestamp).ToList();
1406-
model.Groups = await _departmentGroupsService.GetAllGroupsForDepartmentAsync(model.Call.DepartmentId);
1407-
model.Units = await _unitsService.GetUnitsForDepartmentAsync(model.Call.DepartmentId);
1403+
model.Department = await _departmentsService.GetDepartmentByIdAsync(call.DepartmentId, false);
1404+
model.UnitStates = (await _unitsService.GetUnitStatesForCallAsync(call.DepartmentId, call.CallId)).OrderBy(x => x.UnitId).OrderBy(y => y.Timestamp).ToList();
1405+
model.ActionLogs = (await _actionLogsService.GetActionLogsForCallAsync(call.DepartmentId, call.CallId)).OrderBy(x => x.UserId).OrderBy(y => y.Timestamp).ToList();
1406+
model.Groups = await _departmentGroupsService.GetAllGroupsForDepartmentAsync(call.DepartmentId);
1407+
model.Units = await _unitsService.GetUnitsForDepartmentAsync(call.DepartmentId);
1408+
model.Names = await _departmentsService.GetAllPersonnelNamesForDepartmentAsync(call.DepartmentId);
1409+
model.ChildCalls = await _callsService.GetChildCallsForCallAsync(call.CallId);
1410+
model.Contacts = await _contactsService.GetAllContactsForDepartmentAsync(DepartmentId);
14081411

14091412
if (!String.IsNullOrWhiteSpace(items[2]) && items[2] != "0")
14101413
{

Web/Resgrid.Web/Areas/User/Views/Dispatch/CallExportEx.cshtml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@
311311
<div style="border: 1px solid #ddd; padding: 10px;">@Html.Raw(Model.Call.CompletedNotes)</div>
312312
</div>
313313
</div>
314-
<div class="row">
314+
<div class="row">
315315
<div class="col-xs-12">
316316
<strong><small>@commonLocalizer["Notes"]</small></strong>
317317
<table class="table table-condensed table-bordered">
@@ -323,15 +323,29 @@
323323
</tr>
324324
</thead>
325325
<tbody>
326-
@foreach (var note in Model.Call.CallNotes)
326+
@if (Model.Call.CallNotes == null || !Model.Call.CallNotes.Any() || Model.Names == null || !Model.Names.Any())
327327
{
328-
var name = Model.Names.FirstOrDefault(x => x.UserId == note.UserId);
329328
<tr>
330-
<td>@note.Timestamp.TimeConverterToString(Model.Department)</td>
331-
<td>@name.FirstName @name.LastName</td>
332-
<td>@note.Note</td>
329+
<td colspan="3">@localizer["NoCallNotes"]</td>
333330
</tr>
331+
}
332+
else
333+
{
334+
@foreach (var note in Model.Call.CallNotes)
335+
{
336+
PersonName personName = null;
337+
personName = Model.Names.FirstOrDefault(x => x.UserId == note.UserId);
338+
339+
if (personName == null)
340+
personName = new PersonName() { UserId = note.UserId, FirstName = "", LastName = "" };
334341

342+
<tr>
343+
<td>@note.Timestamp.TimeConverterToString(Model.Department)</td>
344+
<td>@personName.FirstName @personName.LastName</td>
345+
<td>@note.Note</td>
346+
</tr>
347+
348+
}
335349
}
336350
</tbody>
337351
</table>
@@ -518,7 +532,7 @@
518532
</tr>
519533
</tbody>
520534
</table>
521-
<img style="max-width:600px;" src="@Url.Action("GetCallImage", "Dispatch", new {Area = "User", callId = img.CallId, attachmentId = img.CallAttachmentId})" />
535+
<img style="max-width:600px;" src="@Url.Action("GetCallImage", "Dispatch", new { Area = "User", callId = img.CallId, attachmentId = img.CallAttachmentId })" />
522536
</div>
523537
</div>
524538
}

0 commit comments

Comments
 (0)