Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Core/Resgrid.Model/Services/IDepartmentGroupsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Task<DepartmentGroup> SaveAsync(DepartmentGroup departmentGroup,
/// Invalidates the group in cache.
/// </summary>
/// <param name="groupId">The group identifier.</param>
void InvalidateGroupInCache(int groupId);
Task InvalidateGroupInCache(int groupId);

/// <summary>
/// Gets all groups for department unlimited asynchronous.
Expand Down Expand Up @@ -141,7 +141,7 @@ Task<bool> DeleteUserFromGroupsAsync(string userId, int departmentId,
/// <param name="depMember">The dep member.</param>
/// <param name="cancellationToken">The cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>DepartmentGroupMember.</returns>
DepartmentGroupMember SaveGroupMember(DepartmentGroupMember depMember,
Task<DepartmentGroupMember> SaveGroupMember(DepartmentGroupMember depMember,
CancellationToken cancellationToken = default(CancellationToken));

/// <summary>
Expand Down
24 changes: 12 additions & 12 deletions Core/Resgrid.Services/DepartmentGroupsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public async Task<List<DepartmentGroup>> GetAllAsync()
}

var saved = await _departmentGroupsRepository.SaveOrUpdateAsync(departmentGroup, cancellationToken);
InvalidateGroupInCache(departmentGroup.DepartmentGroupId);
await InvalidateGroupInCache(departmentGroup.DepartmentGroupId);

return saved;
}
Expand Down Expand Up @@ -115,9 +115,9 @@ public async Task<List<DepartmentGroup>> GetAllGroupsForDepartmentAsync(int depa
return departmentGroups;
}

public void InvalidateGroupInCache(int groupId)
public async Task InvalidateGroupInCache(int groupId)
{
_cacheProvider.Remove(string.Format(CacheKey, groupId));
await _cacheProvider.RemoveAsync(string.Format(CacheKey, groupId));
}

public async Task<List<DepartmentGroup>> GetAllGroupsForDepartmentUnlimitedAsync(int departmentId)
Expand Down Expand Up @@ -165,7 +165,7 @@ async Task<DepartmentGroup> getDepartmentGroup()

if (group1.ParentDepartmentGroupId.HasValue)
{
group1.Parent = await GetGroupByIdAsync(group1.ParentDepartmentGroupId.Value);
group1.Parent = await GetGroupByIdAsync(group1.ParentDepartmentGroupId.Value, true);
}

var childGroups = await _departmentGroupsRepository.GetAllGroupsByParentGroupIdAsync(group1.DepartmentGroupId);
Expand Down Expand Up @@ -198,7 +198,7 @@ async Task<DepartmentGroup> getDepartmentGroup()
}

await _departmentGroupsRepository.DeleteAsync(group, cancellationToken);
InvalidateGroupInCache(groupId);
await InvalidateGroupInCache(groupId);

return true;
}
Expand Down Expand Up @@ -240,7 +240,7 @@ await _departmentGroupMembersRepository.GetAllGroupMembersByGroupIdAsync(departm

var saved = await _departmentGroupsRepository.SaveOrUpdateAsync(departmentGroup, cancellationToken, true);

InvalidateGroupInCache(departmentGroup.DepartmentGroupId);
await InvalidateGroupInCache(departmentGroup.DepartmentGroupId);

return saved;
}
Expand All @@ -256,7 +256,7 @@ await _departmentGroupMembersRepository.GetAllGroupMembersByGroupIdAsync(departm
await _departmentGroupMembersRepository.DeleteAsync(departmentGroupMember, cancellationToken);
}

InvalidateGroupInCache(departmentGroup.DepartmentGroupId);
await InvalidateGroupInCache(departmentGroup.DepartmentGroupId);

return true;
}
Expand Down Expand Up @@ -306,7 +306,7 @@ await _departmentGroupMembersRepository
foreach (var membership in groupMemberships)
{
await _departmentGroupMembersRepository.DeleteAsync(membership, cancellationToken);
InvalidateGroupInCache(membership.DepartmentGroupId);
await InvalidateGroupInCache(membership.DepartmentGroupId);
}

return true;
Expand Down Expand Up @@ -346,11 +346,11 @@ public async Task<DepartmentGroupMember> GetGroupMemberForUserAsync(string userI
return depMember;
}

public DepartmentGroupMember SaveGroupMember(DepartmentGroupMember depMember, CancellationToken cancellationToken = default(CancellationToken))
public async Task<DepartmentGroupMember> SaveGroupMember(DepartmentGroupMember depMember, CancellationToken cancellationToken = default(CancellationToken))
{
_departmentGroupMembersRepository.SaveOrUpdateAsync(depMember, cancellationToken);
await _departmentGroupMembersRepository.SaveOrUpdateAsync(depMember, cancellationToken);

InvalidateGroupInCache(depMember.DepartmentGroupId);
await InvalidateGroupInCache(depMember.DepartmentGroupId);

return depMember;
}
Expand Down Expand Up @@ -440,7 +440,7 @@ public async Task<Coordinates> GetMapCenterCoordinatesForGroupAsync(int departme
depMember.UserId = userId;

var saved = await _departmentGroupMembersRepository.SaveOrUpdateAsync(depMember, cancellationToken);
InvalidateGroupInCache(groupId);
await InvalidateGroupInCache(groupId);

_eventAggregator.SendMessage<UserAssignedToGroupEvent>(new UserAssignedToGroupEvent() { DepartmentId = departmentGroup.DepartmentId, UserId = userId, Group = departmentGroup });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ public async Task<IEnumerable<ScheduledTask>> GetAllActiveTasksForTypesAsync(Lis
{
using (IDbConnection db = new NpgsqlConnection(DataConfig.CoreConnectionString))
{
var knownDepartments = await db.QueryAsync<ScheduledTask>($@"SELECT st.*, d.departmentid as 'DepartmentId', d.timezone as 'DepartmentTimeZone'
var knownDepartments = await db.QueryAsync<ScheduledTask>($@"SELECT st.*, d.departmentid as departmentid, d.timezone as departmenttimezone
FROM scheduledtasks st
INNER JOIN departments d ON d.departmentid = st.departmentid
WHERE st.departmentid > 0 AND st.active = 1 AND st.tasktype IN @types", new { types = types });

var unknownDepartments = await db.QueryAsync<ScheduledTask>($@"SELECT st.*, d.departmentid as 'DepartmentId', d.timezone as 'DepartmentTimeZone'
var unknownDepartments = await db.QueryAsync<ScheduledTask>($@"SELECT st.*, d.departmentid as departmentid, d.timezone as departmenttimezone
FROM scheduledtasks st
INNER JOIN departmentmembers dm ON dm.userid = st.userid
INNER JOIN departments d ON d.departmentid = dm.departmentid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ SELECT DISTINCT YEAR(c.LoggedOn)
SELECT c.*
FROM %SCHEMA%.%CALLSTABLE% c
INNER JOIN %SCHEMA%.%CALLCONTACTSTABLE% cc ON cc.CallId = c.CallId
WHERE cc.ContactId = %CONTACTID% AND c.IsDeleted = false AND c.DepartmentId = %DID%";
WHERE cc.ContactId = %CONTACTID% AND c.IsDeleted = 0 AND c.DepartmentId = %DID%";

#endregion Calls

Expand Down
6 changes: 5 additions & 1 deletion Web/Resgrid.Web/Areas/User/Controllers/DispatchController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1794,7 +1794,11 @@ public async Task<IActionResult> CallsStatesInRange(string startDate, string end

if (!String.IsNullOrWhiteSpace(startDate) && !String.IsNullOrWhiteSpace(endDate))
{
var calls = await _callsService.GetAllCallsByDepartmentDateRangeAsync(DepartmentId, DateTime.Parse(System.Net.WebUtility.UrlDecode((startDate))), DateTime.Parse(System.Net.WebUtility.UrlDecode(endDate)));
// Temp fix, trying to locate where &#x202F; is coming from and why it's not properly urlencoded instead. -SJ
var startDateTime = DateTime.Parse(System.Net.WebUtility.UrlDecode(startDate.Replace("&#x202F;", " ")));
var endDateTime = DateTime.Parse(System.Net.WebUtility.UrlDecode(endDate.Replace("&#x202F;", " ")));

var calls = await _callsService.GetAllCallsByDepartmentDateRangeAsync(DepartmentId, startDateTime, endDateTime);

var groupedCallStates = calls.GroupBy(x => x.State);
foreach (var grouppedCall in groupedCallStates)
Expand Down
15 changes: 12 additions & 3 deletions Web/Resgrid.Web/Areas/User/Controllers/GroupsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public async Task<IActionResult> NewGroup(NewGroupView model, IFormCollection co
public async Task<IActionResult> DeleteGroup(int departmentGroupId)
{
DeleteGroupView model = new DeleteGroupView();
model.Group = await _departmentGroupsService.GetGroupByIdAsync(departmentGroupId);
model.Group = await _departmentGroupsService.GetGroupByIdAsync(departmentGroupId, true);

if (model.Group == null || model.Group.DepartmentId != DepartmentId || !await _authorizationService.CanUserEditDepartmentGroupAsync(UserId, departmentGroupId))
Unauthorized();
Expand Down Expand Up @@ -297,7 +297,13 @@ public async Task<IActionResult> DeleteGroup(DeleteGroupView model, Cancellation
if (!await _authorizationService.CanUserEditDepartmentGroupAsync(UserId, model.Group.DepartmentGroupId))
Unauthorized();

var group = await _departmentGroupsService.GetGroupByIdAsync(model.Group.DepartmentGroupId);
var group = await _departmentGroupsService.GetGroupByIdAsync(model.Group.DepartmentGroupId, true);

if (group == null)
return RedirectToAction("Index", "Groups", new { Area = "User" });

if (group.DepartmentId != DepartmentId)
Unauthorized();

var users = _departmentGroupsService.GetAllUsersForGroup(model.Group.DepartmentGroupId);
var childGroups = await _departmentGroupsService.GetAllChildDepartmentGroupsAsync(model.Group.DepartmentGroupId);
Expand Down Expand Up @@ -586,7 +592,10 @@ public async Task<IActionResult> EditGroup(EditGroupView model, IFormCollection
public async Task<IActionResult> Geofence(int departmentGroupId)
{
var model = new GeofenceView();
model.Group = await _departmentGroupsService.GetGroupByIdAsync(departmentGroupId);
model.Group = await _departmentGroupsService.GetGroupByIdAsync(departmentGroupId, true);

if (model.Group == null)
Unauthorized();

if (model.Group.DepartmentId != DepartmentId)
Unauthorized();
Expand Down
5 changes: 1 addition & 4 deletions Web/Resgrid.Web/Areas/User/Views/Contacts/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
}

<form id="editContactForm" class="form-horizontal" role="form" asp-controller="Contacts" asp-action="Edit" asp-route-area="User" method="post">

@Html.AntiForgeryToken()
@Html.HiddenFor(m => m.Contact.ContactId)

<div class="row wrapper border-bottom white-bg page-heading">
<div class="col-sm-4">
Expand All @@ -36,9 +36,6 @@
<div class="ibox">
<div class="ibox-content">
@{
@Html.AntiForgeryToken()
@Html.HiddenFor(m => m.Contact.ContactId)

var validationErrors = ViewData.ModelState.Values.Where(E => E.Errors.Count > 0)
.SelectMany(E => E.Errors)
.Select(E => E.ErrorMessage)
Expand Down
41 changes: 22 additions & 19 deletions Web/Resgrid.Web/Areas/User/Views/Contacts/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -74,32 +74,35 @@
}

@{
for (var i = 0; i < Model.ContactCategories.Count(); i++)
if (Model.ContactCategories != null && Model.ContactCategories.Any())
{
var categoryContacts = Model.Contacts.Where(x => x.ContactCategoryId == Model.ContactCategories[i].ContactCategoryId).ToList();

if (categoryContacts != null && categoryContacts.Any())
for (var i = 0; i < Model.ContactCategories.Count; i++)
{
@Html.Raw("<div id='contactsTab" + Model.Contacts[i].ContactCategoryId + "' class='contactsTabPannel' style='display: none;'>")
var categoryContacts = Model.Contacts.Where(x => x.ContactCategoryId == Model.ContactCategories[i].ContactCategoryId).ToList();

@Html.Raw($"<div class='table-responsive'><table class='table table-striped' data-page-length='100' width='100%'><thead><tr><th class='span1'></th><th>{@commonLocalizer["Name"]}</th><th>{@commonLocalizer["Type"]}</th><th>{@commonLocalizer["Category"]}</th><th>{@localizer["LastUpdated"]}</th><th data-searchable='false' data-orderable='false'></th></tr></thead><tbody id='contactsCategory_{Model.Contacts[i].ContactCategoryId}'>")
if (categoryContacts != null && categoryContacts.Any())
{
@Html.Raw("<div id='contactsTab" + Model.Contacts[i].ContactCategoryId + "' class='contactsTabPannel' style='display: none;'>")

@Html.Raw($"<div class='table-responsive'><table class='table table-striped' data-page-length='100' width='100%'><thead><tr><th class='span1'></th><th>{@commonLocalizer["Name"]}</th><th>{@commonLocalizer["Type"]}</th><th>{@commonLocalizer["Category"]}</th><th>{@localizer["LastUpdated"]}</th><th data-searchable='false' data-orderable='false'></th></tr></thead><tbody id='contactsCategory_{Model.Contacts[i].ContactCategoryId}'>")

foreach (var c in categoryContacts)
{
ContactsTableButtonTemplate(c);

@Html.Raw("</td>")
@Html.Raw("</tr>")
}
foreach (var c in categoryContacts)
{
ContactsTableButtonTemplate(c);

@Html.Raw("</tbody></table></div></div>")
}
else
{
@Html.Raw("<div id='contactsTab" + Model.Contacts[i].ContactCategoryId + "' class='contactsTabPannel' style='display: none;'>")
@Html.Raw($"<div style='text-align:center;'><h3>{@localizer["NoContactsInThisCategory"]}</h3></div>")
@Html.Raw("</div>")
@Html.Raw("</td>")
@Html.Raw("</tr>")
}

@Html.Raw("</tbody></table></div></div>")
}
else
{
@Html.Raw("<div id='contactsTab' class='contactsTabPannel' style='display: none;'>")
@Html.Raw($"<div style='text-align:center;'><h3>{@localizer["NoContactsInThisCategory"]}</h3></div>")
@Html.Raw("</div>")
}
}
}
}
Expand Down
10 changes: 4 additions & 6 deletions Web/Resgrid.Web/Areas/User/Views/Department/TextSettings.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@

<div class="row">
<div class="col-md-8 col-md-offset-1">
<p>Here you can configure how Resgrid will handle text messages to you department. Resgrid can import dispatches sent via Text Messages and personnel can control Resgrid via text messages as well. Fields in <span class="required">blue italics</span> are required.</p>
@Html.AntiForgeryToken()
@Html.HiddenFor(m => m.TextCallType)
<div asp-validation-summary="All" class="text-danger"></div>

Expand All @@ -41,7 +39,7 @@
}
</div>
</div>

@*
@if (!Model.CanProvisionNumber)
{
<div class="row">
Expand All @@ -58,7 +56,7 @@
</div>
}

@* <div class="form-group">
<div class="form-group">
<label class="col-sm-2 control-label">Enable Text to Call</label>
<div class="col-sm-10">
<div class="checkbox checkbox-primary">
Expand All @@ -77,7 +75,7 @@
</div>
<span class="help-block m-b-none">This enables the ability of personnel to control Resgrid via text messages</span>
</div>
</div>*@
</div>
<div class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-10">
Expand Down Expand Up @@ -106,7 +104,7 @@
</div>
</div>
</div>
</div>
</div>*@
<div class="form-group">
<label class="col-sm-2 control-label">
Inbound Dispatch Numbers
Expand Down
18 changes: 9 additions & 9 deletions Web/Resgrid.Web/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Resgrid.WebCore": {
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/",
"publishAllPorts": true,
"useSSL": true
},
"Resgrid.Web": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
Expand All @@ -17,13 +24,6 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"nativeDebugging": false
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/",
"publishAllPorts": true,
"useSSL": true
}
},
"iisSettings": {
Expand All @@ -38,4 +38,4 @@
"sslPort": 44318
}
}
}
}
6 changes: 3 additions & 3 deletions Web/Resgrid.Web/libman.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@
"destination": "wwwroot/lib/bootstrapvalidator/"
},
{
"provider": "unpkg",
"library": "twitter-[email protected]",
"provider": "jsdelivr",
"library": "bootstrap-wizard@1.4.2",
"destination": "wwwroot/lib/twitter-bootstrap-wizard/"
},
{
Expand Down Expand Up @@ -275,7 +275,7 @@
"destination": "wwwroot/lib/jquery-ui-multidatespicker/"
},
{
"provider": "unpkg",
"provider": "jsdelivr",
"library": "[email protected]",
"destination": "wwwroot/lib/jquery-datetimepicker/"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This Twitter Bootstrap plugin builds a wizard using a formatted tabbable structu
##### Note
We will not longer be updating the bower version of bootstrap wizard or any other package manager. See <a href="https://github.com/VinceG/twitter-bootstrap-wizard/issues/81#issuecomment-42909528">#81</a> for the reason why. Please use 'master' branch instead.

<a href="http://vadimg.com/twitter-bootstrap-wizard-example/" target="_blank">Website & Demo</a>
<a href="http://vinceg.github.io/twitter-bootstrap-wizard" target="_blank">Website & Demo</a>

<a href='https://twitter.com/gabrielva' target='_blank'>Follow @gabrielva</a>

Expand All @@ -20,6 +20,7 @@ Install
-------------
```
bower install twitter-bootstrap-wizard --save
bower install twitter-bootstrap-wizard#1.4.2 --save
```

Code Examples
Expand Down Expand Up @@ -60,6 +61,11 @@ Options
</tr>
</thead>
<tbody>
<tr>
<td>withVisible</td>
<td>true</td>
<td>Find only visible li step elements. Set to `false` if your steps display is hidden.</td>
</tr>
<tr>
<td>tabClass</td>
<td>'nav nav-pills'</td>
Expand Down
Loading
Loading