This commit is contained in:
Jim Paine 2020-04-14 22:35:22 +01:00
Родитель 58aca4eb46
Коммит 261eb18753
13 изменённых файлов: 103 добавлений и 123 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -349,3 +349,4 @@ MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder # Ionide (cross platform F# VS Code tools) working folder
.ionide/ .ionide/
Project.Zap/appsettings.Development.json Project.Zap/appsettings.Development.json
/Project.Zap/.config

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

@ -33,6 +33,12 @@ namespace Project.Zap.Controllers
return View("Index", this.organization.Map()); return View("Index", this.organization.Map());
} }
[HttpGet]
public IActionResult Add()
{
return View();
}
[HttpPost] [HttpPost]
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public async Task<IActionResult> AddStore(StoreViewModel viewModel) public async Task<IActionResult> AddStore(StoreViewModel viewModel)

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

@ -31,6 +31,11 @@ namespace Project.Zap.Controllers
return View("Index", partners.Map()); return View("Index", partners.Map());
} }
[HttpGet]
public IActionResult Add()
{
return View();
}
[HttpPost] [HttpPost]

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

@ -8,7 +8,6 @@ namespace Project.Zap.Models
{ {
public class SearchShiftViewModel public class SearchShiftViewModel
{ {
[BindProperty]
[Display(Name = "StoreNames")] [Display(Name = "StoreNames")]
public SelectList StoreNames { get; set; } public SelectList StoreNames { get; set; }

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

@ -120,4 +120,7 @@
<data name="Add" xml:space="preserve"> <data name="Add" xml:space="preserve">
<value>Add</value> <value>Add</value>
</data> </data>
<data name="NewStoreTitle" xml:space="preserve">
<value>New Location</value>
</data>
</root> </root>

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

@ -120,4 +120,7 @@
<data name="Add" xml:space="preserve"> <data name="Add" xml:space="preserve">
<value>Ajouter</value> <value>Ajouter</value>
</data> </data>
<data name="NewStoreTitle" xml:space="preserve">
<value>Lieu</value>
</data>
</root> </root>

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

@ -6,6 +6,8 @@
@model Project.Zap.Models.StoreViewModel @model Project.Zap.Models.StoreViewModel
<h3>@Localizer["NewStoreTitle"]</h3>
<form asp-controller="Organization" asp-action="AddStore" method="Post"> <form asp-controller="Organization" asp-action="AddStore" method="Post">
<div class="form-group"> <div class="form-group">
<label asp-for="@Model.Name"></label> <label asp-for="@Model.Name"></label>

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

@ -6,51 +6,22 @@
@model Project.Zap.Models.OrganizationViewModel @model Project.Zap.Models.OrganizationViewModel
<div id="accordion"> <h3>@Localizer["StoresTitle"]</h3>
<div class="card"> <table class="table">
<div class="card-header" id="storeHeader"> <tr>
<h3> <th>@Localizer["ColumnTitleName"]</th>
<button class="btn" data-toggle="collapse" data-target="#stores" aria-expanded="true" aria-controls="stores">@Localizer["StoresTitle"]</button> <th>@Localizer["ColumnTitleCity"]</th>
</h3> <th>@Localizer["ColumnTitleZipOrPostCode"]</th>
</div> <th>@Localizer["ColumnTitleEdit"]</th>
<th>@Localizer["ColumnTitleDelete"]</th>
<div id="stores" class="collapse show" data-parent="#accordion" aria-labelledby="storeHeader"> </tr>
<div class="card-body"> @foreach (var store in Model.Stores)
<table class="table"> {
<tr> <tr>
<th>@Localizer["ColumnTitleName"]</th> <td>@store.Name</td>
<th>@Localizer["ColumnTitleCity"]</th> <td>@store.Address.City</td>
<th>@Localizer["ColumnTitleZipOrPostCode"]</th> <td>@store.Address.ZipOrPostCode</td>
<th>@Localizer["ColumnTitleEdit"]</th> <th><a asp-controller="Organization" asp-action="EditStore" asp-route-id="@store.Name">@Localizer["Edit"]</a></th>
<th>@Localizer["ColumnTitleDelete"]</th> <th><a asp-controller="Organization" asp-action="DeleteStore" asp-route-id="@store.Name">@Localizer["Delete"]</a></th>
</tr> </tr>}
@foreach (var store in Model.Stores) </table>
{
<tr>
<td>@store.Name</td>
<td>@store.Address.City</td>
<td>@store.Address.ZipOrPostCode</td>
<th><a asp-controller="Organization" asp-action="EditStore" asp-route-id="@store.Name">@Localizer["Edit"]</a></th>
<th><a asp-controller="Organization" asp-action="DeleteStore" asp-route-id="@store.Name">@Localizer["Delete"]</a></th>
</tr>
}
</table>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="newStoreHeader">
<h3>
<button class="btn" data-toggle="collapse" data-target="#newStore" aria-expanded="false" aria-controls="newStore">@Localizer["NewStoreTitle"]</button>
</h3>
</div>
<div id="newStore" class="collapse" data-parent="#accordion" aria-labelledby="newStoreHeader">
<div class="card-body">
<partial name="AddStore" model="new Project.Zap.Models.StoreViewModel()" />
</div>
</div>
</div>
</div>

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

@ -6,50 +6,21 @@
@model IEnumerable<Project.Zap.Models.PartnerOrganizationViewModel> @model IEnumerable<Project.Zap.Models.PartnerOrganizationViewModel>
<div id="accordion"> <h3>@Localizer["Title"]</h3>
<div class="card"> <table class="table">
<div class="card-header" id="partnerHeader"> <tr>
<h3> <th>@Localizer["TableName"]</th>
<button class="btn" data-toggle="collapse" data-target="#partners" aria-expanded="true" aria-controls="partners">@Localizer["Title"]</button> <th>@Localizer["TableRegCode"]</th>
</h3> <th>@Localizer["TableDelete"]</th>
</div> </tr>
<div id="partners" class="collapse show" data-parent="#accordion" aria-labelledby="partnerHeader"> @if (Model != null && Model.Any())
<div class="card-body"> {
<table class="table"> @foreach (var org in Model)
<tr> {
<th>@Localizer["TableName"]</th> <tr>
<th>@Localizer["TableRegCode"]</th> <td>@org.Name</td>
<th>@Localizer["TableDelete"]</th> <td>@org.RegistrationCode</td>
</tr> <th><a asp-controller="PartnerOrganization" asp-action="DeletePartner" asp-route-id="@org.Name">@Localizer["DeleteButton"]</a></th>
</tr>}}
@if (Model != null && Model.Any()) </table>
{
@foreach (var org in Model)
{
<tr>
<td>@org.Name</td>
<td>@org.RegistrationCode</td>
<th><a asp-controller="PartnerOrganization" asp-action="DeletePartner" asp-route-id="@org.Name">@Localizer["DeleteButton"]</a></th>
</tr>
}
}
</table>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="newPartnerHeader">
<h3>
<button class="btn" data-toggle="collapse" data-target="#newPartner" aria-expanded="false" aria-controls="newPartner">@Localizer["NewTitle"]</button>
</h3>
</div>
<div id="newPartner" class="collapse" data-parent="#accordion" aria-labelledby="newPartnerHeader">
<div class="card-body">
<partial name="AddPartner" model="new Project.Zap.Models.PartnerOrganizationViewModel()" />
</div>
</div>
</div>
</div>

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

@ -27,46 +27,65 @@
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse"> <div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
<partial name="_LoginPartial" /> <partial name="_LoginPartial" />
<ul class="navbar-nav flex-grow-1"> <ul class="navbar-nav flex-grow-1">
@if (!User.Identity.IsAuthenticated)
{
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">@Localizer["Home"]</a> <a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">@Localizer["Home"]</a>
</li> </li>
}
@if ((await AuthorizationService.AuthorizeAsync(User, "OrgAManager")).Succeeded) @if ((await AuthorizationService.AuthorizeAsync(User, "OrgAManager")).Succeeded)
{ {
<li class="nav-item"> <li class="dropdown">
<a class="nav-link text-dark" asp-area="" asp-controller="Organization" asp-action="Index">@Localizer["ManageOrganization"]</a> <a class="dropdown-toggle nav-link text-dark" data-toggle="dropdown" href="#">@Localizer["ManageOrganization"]<b class="caret"></b></a>
</li> <ul class="dropdown-menu">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="PartnerOrganization" asp-action="Index">@Localizer["PartnerOrganizations"]</a> <a class="nav-link text-dark" asp-area="" asp-controller="Organization" asp-action="Index">@Localizer["View"]</a>
</li> </li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Organization" asp-action="Add">@Localizer["Add"]</a>
</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle nav-link text-dark" data-toggle="dropdown" href="#">@Localizer["PartnerOrganizations"]<b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="PartnerOrganization" asp-action="Index">@Localizer["View"]</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="PartnerOrganization" asp-action="Add">@Localizer["Add"]</a>
</li>
</ul>
</li>
} }
@if (User.Identity.IsAuthenticated) @if (User.Identity.IsAuthenticated)
{ {
<li class="dropdown"> <li class="dropdown">
<a class="dropdown-toggle nav-link text-dark" data-toggle="dropdown" href="#">@Localizer["Shifts"]<b class="caret"></b></a> <a class="dropdown-toggle nav-link text-dark" data-toggle="dropdown" href="#">@Localizer["Shifts"]<b class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
@if ((await AuthorizationService.AuthorizeAsync(User, "OrgAManager")).Succeeded) @if ((await AuthorizationService.AuthorizeAsync(User, "OrgAManager")).Succeeded)
{ {
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Shift" asp-action="Index">@Localizer["Search"]</a> <a class="nav-link text-dark" asp-area="" asp-controller="Shift" asp-action="Index">@Localizer["Search"]</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Shift" asp-action="Add">@Localizer["Add"]</a> <a class="nav-link text-dark" asp-area="" asp-controller="Shift" asp-action="Add">@Localizer["Add"]</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Shift" asp-action="Upload">@Localizer["Upload"]</a> <a class="nav-link text-dark" asp-area="" asp-controller="Shift" asp-action="Upload">@Localizer["Upload"]</a>
</li> </li>
} }
@if ((await AuthorizationService.AuthorizeAsync(User, "OrgBEmployee")).Succeeded) @if ((await AuthorizationService.AuthorizeAsync(User, "OrgBEmployee")).Succeeded)
{ {
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Shift" asp-action="ViewShifts">@Localizer["MyShifts"]</a> <a class="nav-link text-dark" asp-area="" asp-controller="Shift" asp-action="ViewShifts">@Localizer["MyShifts"]</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Shift" asp-action="Index">@Localizer["BookShifts"]</a> <a class="nav-link text-dark" asp-area="" asp-controller="Shift" asp-action="Index">@Localizer["BookShifts"]</a>
</li> </li>
} }
</ul> </ul>
</li> </li>
} }
</ul> </ul>
</div> </div>