Skip to content

Commit 40dd28f

Browse files
authored
Merge pull request #41 from DurkaTechnologies/develop
Release 1.1 built successfully
2 parents adce5b5 + 622ad02 commit 40dd28f

1,726 files changed

Lines changed: 136910 additions & 102 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/.classpath
2+
**/.dockerignore
3+
**/.env
4+
**/.git
5+
**/.gitignore
6+
**/.project
7+
**/.settings
8+
**/.toolstarget
9+
**/.vs
10+
**/.vscode
11+
**/*.*proj.user
12+
**/*.dbmdl
13+
**/*.jfm
14+
**/azds.yaml
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/Dockerfile*
19+
**/node_modules
20+
**/npm-debug.log
21+
**/obj
22+
**/secrets.dev.yaml
23+
**/values.dev.yaml
24+
LICENSE
25+
README.md

WebUI/Abstractions/IViewRenderService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.ViewFeatures;
23
using System.Threading.Tasks;
34

45
namespace WebUI.Abstractions
56
{
67
public interface IViewRenderService
78
{
8-
Task<string> RenderViewToStringAsync<TModel>(string viewName, TModel model);
9+
Task<string> RenderViewToStringAsync<TModel>(string viewName, TModel model, ITempDataDictionary data = null);
910

1011
string RenderRazorViewToString(Controller controller, string viewName, object model = null);
1112

WebUI/Areas/Admin/Controllers/UserController.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public async Task<IActionResult> OnGetCreate()
7878
{
7979
isValid = true,
8080
html = await _viewRenderer.RenderViewToStringAsync("_Create",
81-
new UserViewModel() { CommunitiesList = freeCommunities })
81+
new UserViewModel() { CommunitiesList = freeCommunities }, TempData)
8282
});
8383
}
8484

@@ -90,7 +90,7 @@ public async Task<IActionResult> OnGetCreate()
9090
[Authorize(Roles = "SuperAdmin")]
9191
public async Task<IActionResult> OnPostCreate(UserViewModel userModel, string fileName, IFormFile blob)
9292
{
93-
if (ModelState.IsValid)
93+
if (ModelState.IsValid && !String.IsNullOrEmpty(fileName) && blob != null)
9494
{
9595
string imagePath;
9696
userModel.Password ??= "1";
@@ -144,7 +144,7 @@ public async Task<IActionResult> OnPostCreate(UserViewModel userModel, string fi
144144

145145
await _mediator.Send(new AddLogCommand() { Log = log });
146146

147-
var htmlData = await _viewRenderer.RenderViewToStringAsync("_ViewAll", await GetUsersExceptCurrentAsync());
147+
var htmlData = await _viewRenderer.RenderViewToStringAsync("_ViewAll", await GetUsersExceptCurrentAsync(), TempData);
148148
return new JsonResult(new { isValid = true, html = htmlData });
149149
}
150150

@@ -154,7 +154,9 @@ public async Task<IActionResult> OnPostCreate(UserViewModel userModel, string fi
154154
ImageService.RemoveImageFromServer(imagePath);
155155
}
156156

157-
var html = await _viewRenderer.RenderViewToStringAsync("_Create", userModel);
157+
_notify.Success($"Фото профілю не вибрано");
158+
159+
var html = await _viewRenderer.RenderViewToStringAsync("_Create", userModel, TempData);
158160
return new JsonResult(new { isValid = false, html = html });
159161
}
160162

WebUI/Areas/Admin/Views/Profile/Edit.cshtml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@
3030
<!-- Dropdown - User Information -->
3131
<div class="dropdown-menu dropdown-menu-left shadow animated--grow-in" aria-labelledby="userDropdown">
3232
<div class="dropdown-item p-0">
33-
<input accept=".png,.jpg,.jpeg,.gif,.tif"
33+
<input accept=".png,.jpg,.jpeg,.gif"
3434
asp-for="@Model.ProfilePicture"
3535
type="file" class="custom-file-input"
36-
onchange="jQueryModalGet('/admin/profile/ChangeProfileImage?id=@Model.Id', 'Обріжте нове зображення профілю')"
3736
id="customFile">
3837
<label class="my-file-label" for="customFile"><i class="fas fa-upload"></i> Завантажити</label>
3938
</div>
@@ -125,11 +124,21 @@
125124
minimumResultsForSearch: 5,
126125
placeholder: "Виберіть громади"
127126
});
128-
//registerSummernote('#summernote', 5000, function (max) {
129-
// $('#lenghtContentPost').text(max)
130-
//}, 400, 400);d
131127
132-
//document.getElementById("summernote").hidden = true;
128+
$("#customFile").on("change", function (e) {
129+
var noInvalidFiles = true;
130+
if (this.files.length == 1) {
131+
var file = this.files[0];
132+
var array = this.getAttribute("accept").split(",");
133+
var extension = file.name.substring(file.name.lastIndexOf('.'));
134+
noInvalidFiles = array.includes(extension);
135+
136+
if (!noInvalidFiles)
137+
alert("Вибрано не підримуваний файл.");
138+
else
139+
jQueryModalGet('/admin/profile/ChangeProfileImage?id=@Model.Id', 'Обріжте нове зображення профілю')
140+
}
141+
});
133142
134143
$('.ukrainephone').mask("(999) 999-9999");
135144
});

WebUI/Areas/Admin/Views/Profile/Index.cshtml

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -73,41 +73,43 @@
7373
</div>
7474
</div>
7575
</div>
76-
@if (!String.IsNullOrEmpty(Model.Description))
77-
{
78-
<div class="col-xl-7 col-lg-6 p-2">
79-
<div class="card p-4 m-0">
76+
77+
<div class="col-xl-7 col-lg-6 p-2">
78+
@if (!String.IsNullOrEmpty(Model.Description))
79+
{
80+
<div class="card p-4 m-0 mb-3">
8081
<h4 class="text-center d-block">Опис</h4>
8182

8283
@Html.Raw(Model.Description)
8384
</div>
84-
@if (CheckEdit)
85-
{
86-
<div class="d-flex justify-content-end my-3">
87-
<a class="btn btn-secondary btn-icon-split" href="#" data-toggle="modal" data-target="#logoutModal">
88-
<span class="icon text-white-50">
89-
<i class="fas fa-sign-out-alt"></i>
90-
</span>
91-
<span class="text">Вийти</span>
92-
</a>
85+
}
86+
@if (CheckEdit)
87+
{
88+
<div class="d-flex justify-content-end mb-3">
89+
<a class="btn btn-secondary btn-icon-split" href="#" data-toggle="modal" data-target="#logoutModal">
90+
<span class="icon text-white-50">
91+
<i class="fas fa-sign-out-alt"></i>
92+
</span>
93+
<span class="text">Вийти</span>
94+
</a>
9395

94-
<a asp-area="Identity" asp-page="/Account/AuditLog" asp-route-id="current" class="btn btn-primary btn-icon-split ml-3">
95-
<span class="icon text-white-50">
96-
<i class="fas fa-list"></i>
97-
</span>
98-
<span class="text">Історія дій</span>
99-
</a>
96+
<a asp-area="Identity" asp-page="/Account/AuditLog" asp-route-id="current" class="btn btn-primary btn-icon-split ml-3">
97+
<span class="icon text-white-50">
98+
<i class="fas fa-list"></i>
99+
</span>
100+
<span class="text">Історія дій</span>
101+
</a>
100102

101-
<a asp-controller="Profile" asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-success btn-icon-split ml-3">
102-
<span class="icon text-white-50">
103-
<i class="fas fa-pen"></i>
104-
</span>
105-
<span class="text">Редагувати</span>
106-
</a>
107-
</div>
108-
}
109-
</div>
110-
}
103+
<a asp-controller="Profile" asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-success btn-icon-split ml-3">
104+
<span class="icon text-white-50">
105+
<i class="fas fa-pen"></i>
106+
</span>
107+
<span class="text">Редагувати</span>
108+
</a>
109+
</div>
110+
}
111+
</div>
112+
111113
</div>
112114

113115
</div>

WebUI/Areas/Admin/Views/User/_Create.cshtml

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@using WebUI.Areas.Admin.Models
22
@using Application.Constants
3+
@using AspNetCoreHero.ToastNotification.Abstractions
4+
@using AspNetCoreHero.ToastNotification.Notyf
35

46
@model UserViewModel
57

@@ -60,9 +62,10 @@
6062
<label class="col-md-3 col-form-label">Фото</label>
6163
<div class="col-md-9">
6264
<div class="custom-file form-image">
63-
<input accept=".png,.jpg,.jpeg,.gif,.tif"
65+
<input accept=".png,.jpg,.jpeg,.gif"
6466
type="file" class="custom-file-input"
6567
id="customFile">
68+
6669
<label class="custom-file-label" for="customFile">Виберіть картинку</label>
6770
</div>
6871
</div>
@@ -133,21 +136,25 @@
133136
134137
var $uploadCrop;
135138
var $blob;
136-
137-
$uploadCrop = $('#cropper').croppie({
138-
viewport: {
139-
width: 300,
140-
height: 300,
141-
type: 'square'
142-
},
143-
boundary: {
144-
width: 400,
145-
height: 400
146-
},
147-
showZoomer: false,
148-
enforceBoundary: true,
149-
enableExif: true
150-
});
139+
var fileName = null;
140+
141+
function InitCropper() {
142+
$uploadCrop = $('#cropper').croppie({
143+
viewport: {
144+
width: 300,
145+
height: 300,
146+
type: 'square'
147+
},
148+
boundary: {
149+
width: 400,
150+
height: 400
151+
},
152+
showZoomer: false,
153+
enforceBoundary: true,
154+
enableExif: true
155+
});
156+
}
157+
InitCropper();
151158
152159
function readFile(e) {
153160
var reader = new FileReader();
@@ -166,7 +173,28 @@
166173
$("#profilePicture").addClass("d-none");
167174
}
168175
169-
document.getElementById("customFile").addEventListener("change", readFile);
176+
$("#customFile").on("change", function (e) {
177+
var noInvalidFiles = true;
178+
if (this.files.length == 1) {
179+
180+
var file = this.files[0];
181+
var array = this.getAttribute("accept").split(",");
182+
var extension = file.name.substring(file.name.lastIndexOf('.'));
183+
noInvalidFiles = array.includes(extension);
184+
185+
if (!noInvalidFiles) {
186+
fileName = null;
187+
$blob = null;
188+
$('#cropper').croppie('destroy');
189+
$("#imageBox").addClass("d-none");
190+
InitCropper();
191+
$("#mainForm").toggleClass("col-xl-7 col-lg-5");
192+
alert("Вибрано не підримуваний файл.");
193+
}
194+
else
195+
readFile(e);
196+
}
197+
});
170198
171199
$("#croppImage").on('click', function () {
172200
$uploadCrop.croppie('result', {
@@ -179,17 +207,17 @@
179207
$blob = blob;
180208
var urlCreator = window.URL || window.webkitURL;
181209
var imageUrl = urlCreator.createObjectURL(blob);
210+
fileName = $('#customFile').val();
182211
$("#profilePicture").attr('src', imageUrl);
183212
$("#cropperBox").addClass("d-none");
184213
$("#profilePicture").removeClass("d-none");
185214
});
186215
});
187216
188217
$("#create-form").submit(function (f) {
189-
//$("#create-form").css('visibility', 'hidden');
190218
191219
var formData = new FormData(this);
192-
formData.append('fileName', $('#customFile').val());
220+
formData.append('fileName', fileName);
193221
formData.append('blob', $blob);
194222
195223
try {

WebUI/Areas/Admin/Views/User/_ViewAll.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
}
5050
</a>
5151
<div class="col-sm">
52-
<a asp-area="Admin" asp-controller="Profile" asp-action="Index" asp-route-id="@user.Id" class="font-weight-bolder text-dark">
53-
@user.FirstName @user.LastName
52+
<a asp-area="Admin" asp-controller="Profile" asp-action="Index" asp-route-id="@user.Id" class="font-weight-bolder text-black text-dark worker-name">
53+
@user.MiddleName @user.FirstName @user.LastName
5454
</a>
5555
<br>
5656
<small>
Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
11
@using MarkdownSharpAdapted
2-
@using System.IO
2+
@using System.Net
33

44
<div class="container">
5-
@{
6-
string text = File.ReadAllText("../README.md");
5+
@{
6+
string text;
7+
try
8+
{
9+
Uri url = new Uri("https://raw.githubusercontent.com/DurkaTechnologies/AdminPanel/master/README.md");
10+
using (WebClient client = new WebClient())
11+
{
12+
text = client.DownloadString(url);
13+
}
14+
Markdown markdown = new Markdown();
15+
text = markdown.Transform(text);
16+
}
17+
catch (Exception ex)
18+
{
19+
text = "Файл з інстуркуцією не знайдено";
20+
}
21+
}
22+
@if (!String.IsNullOrEmpty(text))
23+
{
24+
@Html.Raw(text)
25+
}
726

8-
Markdown markdown = new Markdown();
9-
string html = markdown.Transform(text);
10-
}
11-
12-
@Html.Raw(html)
13-
14-
<a id="reload" class="btn text-white" href="~/ReadmeFiles/unknown.png" target="_blank"></a>
15-
<a id="reload" class="btn text-white" href="~/ReadmeFiles/giphy.mp4" target="_blank"></a>
16-
<a id="reload" class="btn text-white" href="~/ReadmeFiles/nesalo.jpeg" target="_blank"></a>
27+
<a id="reload" class="btn text-white" href="~/ReadmeFiles/unknown.png" target="_blank"></a>
28+
<a id="reload" class="btn text-white" href="~/ReadmeFiles/giphy.mp4" target="_blank"></a>
29+
<a id="reload" class="btn text-white" href="~/ReadmeFiles/nesalo.jpeg" target="_blank"></a>
1730
</div>

WebUI/Areas/Entities/Controllers/CommunityController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,10 @@ private async Task<List<GetAllCommunitiesCachedResponse>> FillUserName(List<GetA
190190
if (user == null)
191191
el.ApplicationUserName = "Громада вільна";
192192
else
193-
el.ApplicationUserName = user.LastName + " " + user.FirstName;
193+
el.ApplicationUserName = user.MiddleName + " " + user.FirstName + " " + user.LastName;
194194
}
195195
return list;
196196
}
197197
}
198198
}
199+

WebUI/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2+
3+
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
4+
WORKDIR /app
5+
EXPOSE 80
6+
EXPOSE 443
7+
8+
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
9+
WORKDIR /src
10+
COPY ["WebUI/WebUI.csproj", "WebUI/"]
11+
COPY ["Infrastructure/Infrastructure.csproj", "Infrastructure/"]
12+
COPY ["Domain/Domain.csproj", "Domain/"]
13+
COPY ["Application/Application.csproj", "Application/"]
14+
RUN dotnet restore "WebUI/WebUI.csproj"
15+
COPY . .
16+
WORKDIR "/src/WebUI"
17+
RUN dotnet build "WebUI.csproj" -c Release -o /app/build
18+
19+
FROM build AS publish
20+
RUN dotnet publish "WebUI.csproj" -c Release -o /app/publish
21+
22+
FROM base AS final
23+
WORKDIR /app
24+
COPY --from=publish /app/publish .
25+
ENTRYPOINT ["dotnet", "WebUI.dll"]

0 commit comments

Comments
 (0)