Merge pull request #8 from JimPaine/master

Removed edit user and improved shift view
This commit is contained in:
biancacorsatea 2020-04-15 11:39:27 +01:00 коммит произвёл GitHub
Родитель 86c801d862 9746a593cd
Коммит aa2dcf8f40
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 67 добавлений и 94 удалений

Просмотреть файл

@ -15,20 +15,9 @@
<ul class="navbar-nav">
@if (User.Identity.IsAuthenticated)
{
@if (!string.IsNullOrEmpty(options.EditProfilePolicyId))
{
<li class="nav-item">
<a class="nav-link text-dark" asp-area="AzureADB2C" asp-controller="Account" asp-action="EditProfile">
<span class="text-dark">@Localizer["WelcomeText"] @User.Identity.Name!</span>
</a>
</li>
}
else
{
<li class="nav-item">
<span class="navbar-text text-dark">@Localizer["WelcomeText"] @User.Identity.Name!</span>
</li>
}
<li class="nav-item">
<span class="navbar-text text-dark">@Localizer["WelcomeText"] @User.Identity.Name!</span>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="AzureADB2C" asp-controller="Account" asp-action="SignOut">@Localizer["SignOut"]</a>
</li>

Просмотреть файл

@ -28,53 +28,43 @@
<partial name="Search" model="new Project.Zap.Models.SearchShiftViewModel { StoreNames = Model.StoreNames, NewShift = new Project.Zap.Models.ShiftViewModel() }" />
<h3>@Localizer["ResultsTitle"]</h3>
<table class="table">
<thead>
<tr>
<th>@Localizer["TableStore"]</th>
<th>@Localizer["TableStart"]</th>
<th>@Localizer["TableEnd"]</th>
<th>@Localizer["TableWorkType"]</th>
<th>@Localizer["TableQuantity"]</th>
<th>@Localizer["TableAvailable"]</th>
@if ((await AuthorizationService.AuthorizeAsync(User, "OrgAManager")).Succeeded)
{
<th>@Localizer["TableView"]</th>
<th>@Localizer["TableDelete"]</th>
}
@if ((await AuthorizationService.AuthorizeAsync(User, "OrgBEmployee")).Succeeded)
{
<th>@Localizer["TableBook"]</th>
}
</tr>
</thead>
<tbody>
@foreach (var shift in Model.Result)
<div class="container">
<div class="row">
<div class="d-none d-xs-block d-sm-block col-md-4 font-weight-bold">@Localizer["TableStore"]</div>
<div class="d-none d-xs-block d-sm-block col-md-4 font-weight-bold">@Localizer["TableStart"] - @Localizer["TableEnd"]</div>
<div class="d-none d-xs-block d-sm-block col-md-2 font-weight-bold">@Localizer["TableWorkType"]</div>
<div class="d-none d-xs-block d-sm-block col-md-1 font-weight-bold">@Localizer["TableAvailable"]</div>
@if ((await AuthorizationService.AuthorizeAsync(User, "OrgAManager")).Succeeded)
{
<tr>
<td>@shift.StoreName</td>
<td>@shift.Start</td>
<td>@shift.End</td>
<td>@shift.WorkType</td>
<td>@shift.Quantity</td>
<td>@shift.Available</td>
@if ((await AuthorizationService.AuthorizeAsync(User, "OrgAManager")).Succeeded)
{
<td><a asp-controller="Shift" asp-action="ViewShift" asp-route-StoreName="@shift.StoreName" asp-route-Start="@shift.Start.ToString("yyyy-MM-ddTHH:mm")" asp-route-End="@shift.End.ToString("yyyy-MM-ddTHH:mm")" asp-route-WorkType="@shift.WorkType" asp-route-Quantity="@shift.Quantity" asp-route-Available="@shift.Available">@Localizer["LinkView"]</a></td>
<td><a asp-controller="Shift" asp-action="Delete" asp-route-StoreName="@shift.StoreName" asp-route-Start="@shift.Start.ToString("yyyy-MM-ddTHH:mm")" asp-route-End="@shift.End.ToString("yyyy-MM-ddTHH:mm")" asp-route-WorkType="@shift.WorkType">@Localizer["LinkDelete"]</a></td>
}
@if ((await AuthorizationService.AuthorizeAsync(User, "OrgBEmployee")).Succeeded)
{
<td>
<a asp-controller="Shift" asp-action="Book" asp-route-StoreName="@shift.StoreName" asp-route-Start="@shift.Start.ToString("yyyy-MM-ddTHH:mm")" asp-route-End="@shift.End.ToString("yyyy-MM-ddTHH:mm")" asp-route-WorkType="@shift.WorkType">@Localizer["LinkBook"]</a>
</td>
}
</tr>
<div class="d-none d-xs-block d-sm-block col-md-1 font-weight-bold">@Localizer["TableView"]</div>
}
</tbody>
</table>
@if ((await AuthorizationService.AuthorizeAsync(User, "OrgBEmployee")).Succeeded)
{
<div class="d-none d-xs-block d-sm-block col-md-1 font-weight-bold">@Localizer["TableBook"]</div>
}
</div>
@foreach (var shift in Model.Result)
{
<div class="row">
<div class="d-block d-xs-none d-sm-none col-xs-6 col-sm-6 font-weight-bold">@Localizer["TableStore"]</div>
<div class="col-xs-6 col-sm-6 col-md-4">@shift.StoreName</div>
<div class="d-block d-xs-none d-sm-none col-xs-6 col-sm-6 font-weight-bold">@Localizer["TableStart"]</div>
<div class="col-xs-6 col-sm-6 col-md-4">@shift.Start.ToString("yyyy-MM-ddTHH:MM") - @shift.End.ToString("yyyy-MM-ddTHH:MM")</div>
<div class="d-block d-xs-none d-sm-none col-xs-6 col-sm-6 font-weight-bold">@Localizer["TableWorkType"]</div>
<div class="col-xs-6 col-sm-6 col-md-2">@shift.WorkType</div>
<div class="d-block d-xs-none d-sm-none col-xs-6 col-sm-6 font-weight-bold">@Localizer["TableAvailable"]</div>
<div class="col-xs-6 col-sm-6 col-md-1">@shift.Available / @shift.Quantity</div>
@if ((await AuthorizationService.AuthorizeAsync(User, "OrgAManager")).Succeeded)
{
<a class="btn btn-primary col-xs-6 col-sm-6 col-md-1" asp-controller="Shift" asp-action="ViewShift" asp-route-StoreName="@shift.StoreName" asp-route-Start="@shift.Start.ToString("yyyy-MM-ddTHH:mm")" asp-route-End="@shift.End.ToString("yyyy-MM-ddTHH:mm")" asp-route-WorkType="@shift.WorkType" asp-route-Quantity="@shift.Quantity" asp-route-Available="@shift.Available">@Localizer["LinkView"]</a>
}
@if ((await AuthorizationService.AuthorizeAsync(User, "OrgBEmployee")).Succeeded)
{
<a class="btn btn-primary col-xs-6 col-sm-6 col-md-1" asp-controller="Shift" asp-action="Book" asp-route-StoreName="@shift.StoreName" asp-route-Start="@shift.Start.ToString("yyyy-MM-ddTHH:mm")" asp-route-End="@shift.End.ToString("yyyy-MM-ddTHH:mm")" asp-route-WorkType="@shift.WorkType">@Localizer["LinkBook"]</a>
}
</div>
}
</div>

Просмотреть файл

@ -1,49 +1,43 @@
@{
@using Microsoft.AspNetCore.Mvc.Localization
@using Microsoft.AspNetCore.Mvc.Localization
@inject IViewLocalizer Localizer
@inject IViewLocalizer Localizer
}
@model IEnumerable<Project.Zap.Models.ShiftViewModel>
@{
ViewData["Title"] = @Localizer["Title"];
}
@{ ViewData["Title"] = @Localizer["Title"]; }
<h1>@Localizer["Title"]</h1>
@if (ViewData.ContainsKey("NoShifts"))
{
<div class="alert alert-info">
<strong>@Localizer["ErrorTitle"]</strong> @ViewData["NoShifts"]
<div class="alert alert-info">
<strong>@Localizer["ErrorTitle"]</strong> @ViewData["NoShifts"]
</div>}
<div class="container">
<div class="row">
<div class="d-none d-xs-block d-sm-block col-md-4 font-weight-bold">@Localizer["TableStoreName"]</div>
<div class="d-none d-xs-block d-sm-block col-md-4 font-weight-bold">@Localizer["TableStart"] - @Localizer["TableEnd"]</div>
<div class="d-none d-xs-block d-sm-block col-md-2 font-weight-bold">@Localizer["TableWorkType"]</div>
<div class="d-none d-xs-block d-sm-block col-md-2 font-weight-bold">@Localizer["TableCancel"]</div>
</div>
}
@foreach (var shift in Model)
{
<div class="row">
<div class="d-block d-xs-none d-sm-none col-xs-6 col-sm-6 font-weight-bold">@Localizer["TableStoreName"]</div>
<div class="col-xs-6 col-sm-6 col-md-4">@shift.StoreName</div>
<table class="table">
<thead>
<tr>
<th>@Localizer["TableStoreName"]</th>
<th>@Localizer["TableStart"]</th>
<th>@Localizer["TableEnd"]</th>
<th>@Localizer["TableWorkType"]</th>
<th>@Localizer["TableCancel"]</th>
</tr>
</thead>
<tbody>
<div class="d-block d-xs-none d-sm-none col-xs-6 col-sm-6 font-weight-bold">@Localizer["TableStart"]</div>
<div class="col-xs-6 col-sm-6 col-md-4">@shift.Start.ToString("yyyy-MM-ddTHH:MM") - @shift.End.ToString("yyyy-MM-ddTHH:MM")</div>
@foreach (var shift in Model)
{
<tr>
<td>@shift.StoreName</td>
<td>@shift.Start</td>
<td>@shift.End</td>
<td>@shift.WorkType</td>
<td>
<a asp-controller="Shift" asp-action="CancelShift" asp-route-StoreName="@shift.StoreName" asp-route-Start="@shift.Start.ToString("yyyy-MM-ddTHH:mm")" asp-route-End="@shift.End.ToString("yyyy-MM-ddTHH:mm")" asp-route-WorkType="@shift.WorkType">@Localizer["CancelButton"]</a>
</td>
</tr>
}
</tbody>
</table>
<div class="d-block d-xs-none d-sm-none col-xs-6 col-sm-6 font-weight-bold">@Localizer["TableWorkType"]</div>
<div class="col-xs-6 col-sm-6 col-md-2">@shift.WorkType</div>
<a class="btn btn-danger col-xs-6 col-sm-6 col-md-2" asp-controller="Shift" asp-action="CancelShift" asp-route-StoreName="@shift.StoreName" asp-route-Start="@shift.Start.ToString("yyyy-MM-ddTHH:mm")" asp-route-End="@shift.End.ToString("yyyy-MM-ddTHH:mm")" asp-route-WorkType="@shift.WorkType">@Localizer["CancelButton"]</a>
</div>
}
</div>