mirror of
https://github.com/hargata/lubelog.git
synced 2025-12-10 00:46:08 -06:00
front end for managing households
This commit is contained in:
parent
a137fbaa52
commit
e30f1def1e
@ -183,7 +183,7 @@ namespace CarCareTracker.Controllers
|
||||
Collaborators = result,
|
||||
CanModifyCollaborators = userCanModify
|
||||
};
|
||||
return PartialView("_Collaborators", result);
|
||||
return PartialView("_Collaborators", viewModel);
|
||||
}
|
||||
[TypeFilter(typeof(CollaboratorFilter))]
|
||||
[HttpPost]
|
||||
|
||||
@ -21,21 +21,27 @@
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr class="d-flex">
|
||||
<th scope="col" class="col-8">@translator.Translate(userLanguage, "Username")</th>
|
||||
<th scope="col" class="col-4">@translator.Translate(userLanguage, "Delete")</th>
|
||||
<th scope="col" class="@(Model.CanModifyCollaborators ? "col-8" : "col-12")">@translator.Translate(userLanguage, "Username")</th>
|
||||
@if (Model.CanModifyCollaborators)
|
||||
{
|
||||
<th scope="col" class="col-4">@translator.Translate(userLanguage, "Delete")</th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (UserCollaborator user in Model.Collaborators)
|
||||
{
|
||||
<tr class="d-flex">
|
||||
<td class="col-8">@user.UserName</td>
|
||||
<td class="col-4">
|
||||
@if(User.Identity.Name != user.UserName && Model.CanModifyCollaborators)
|
||||
{
|
||||
<button onclick="deleteCollaborator(@user.UserVehicle.UserId, @user.UserVehicle.VehicleId)" class="btn btn-outline-danger btn-sm"><i class="bi bi-trash"></i></button>
|
||||
}
|
||||
</td>
|
||||
<td class="@(Model.CanModifyCollaborators ? "col-8" : "col-12")">@user.UserName</td>
|
||||
@if (Model.CanModifyCollaborators)
|
||||
{
|
||||
<td class="col-4">
|
||||
@if (User.Identity.Name != user.UserName && Model.CanModifyCollaborators)
|
||||
{
|
||||
<button onclick="deleteCollaborator(@user.UserVehicle.UserId, @user.UserVehicle.VehicleId)" class="btn btn-outline-danger btn-sm"><i class="bi bi-trash"></i></button>
|
||||
}
|
||||
</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
||||
@ -588,6 +588,7 @@ function hideHouseholdModal() {
|
||||
function removeUserFromHousehold(userId) {
|
||||
$.post('/Home/RemoveUserFromHousehold', { userId: userId }, function (data) {
|
||||
if (data) {
|
||||
successToast('User Removed');
|
||||
showHouseholdModal();
|
||||
} else {
|
||||
errorToast(genericErrorMessage())
|
||||
@ -614,6 +615,7 @@ function addUserToHousehold() {
|
||||
$.post('/Home/AddUserToHousehold', { username: result.value.userName }, function (data) {
|
||||
if (data.success) {
|
||||
showHouseholdModal();
|
||||
successToast('User Added');
|
||||
} else {
|
||||
errorToast(data.message);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user