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/
Project.Zap/appsettings.Development.json
/Project.Zap/.config

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -6,51 +6,22 @@
@model Project.Zap.Models.OrganizationViewModel
<div id="accordion">
<div class="card">
<div class="card-header" id="storeHeader">
<h3>
<button class="btn" data-toggle="collapse" data-target="#stores" aria-expanded="true" aria-controls="stores">@Localizer["StoresTitle"]</button>
</h3>
</div>
<div id="stores" class="collapse show" data-parent="#accordion" aria-labelledby="storeHeader">
<div class="card-body">
<table class="table">
<tr>
<th>@Localizer["ColumnTitleName"]</th>
<th>@Localizer["ColumnTitleCity"]</th>
<th>@Localizer["ColumnTitleZipOrPostCode"]</th>
<th>@Localizer["ColumnTitleEdit"]</th>
<th>@Localizer["ColumnTitleDelete"]</th>
</tr>
@foreach (var store in Model.Stores)
{
<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>
<h3>@Localizer["StoresTitle"]</h3>
<table class="table">
<tr>
<th>@Localizer["ColumnTitleName"]</th>
<th>@Localizer["ColumnTitleCity"]</th>
<th>@Localizer["ColumnTitleZipOrPostCode"]</th>
<th>@Localizer["ColumnTitleEdit"]</th>
<th>@Localizer["ColumnTitleDelete"]</th>
</tr>
@foreach (var store in Model.Stores)
{
<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>

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

@ -6,50 +6,21 @@
@model IEnumerable<Project.Zap.Models.PartnerOrganizationViewModel>
<div id="accordion">
<div class="card">
<div class="card-header" id="partnerHeader">
<h3>
<button class="btn" data-toggle="collapse" data-target="#partners" aria-expanded="true" aria-controls="partners">@Localizer["Title"]</button>
</h3>
</div>
<h3>@Localizer["Title"]</h3>
<table class="table">
<tr>
<th>@Localizer["TableName"]</th>
<th>@Localizer["TableRegCode"]</th>
<th>@Localizer["TableDelete"]</th>
</tr>
<div id="partners" class="collapse show" data-parent="#accordion" aria-labelledby="partnerHeader">
<div class="card-body">
<table class="table">
<tr>
<th>@Localizer["TableName"]</th>
<th>@Localizer["TableRegCode"]</th>
<th>@Localizer["TableDelete"]</th>
</tr>
@if (Model != null && Model.Any())
{
@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>
@if (Model != null && Model.Any())
{
@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>

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

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