wtf again
This commit is contained in:
parent
553759039f
commit
10a9a186a1
|
|
@ -1,9 +1,20 @@
|
|||
namespace TIAMMobileApp
|
||||
using Microsoft.AspNetCore.Components.WebView.Maui;
|
||||
|
||||
namespace TIAMMobileApp
|
||||
{
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
|
||||
|
||||
public MainPage()
|
||||
{
|
||||
BlazorWebViewHandler.BlazorWebViewMapper.AppendToMapping("CustomBlazorWebViewMapper", (handler, view) =>
|
||||
{
|
||||
#if IOS
|
||||
var configs = handler.PlatformView.Configuration;
|
||||
configs.AllowsInlineMediaPlayback = true;
|
||||
#endif
|
||||
});
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ namespace TIAMMobileApp
|
|||
#if DEBUG
|
||||
builder.Services.AddBlazorWebViewDeveloperTools();
|
||||
builder.Logging.AddDebug();
|
||||
builder.Services.AddLocalization();
|
||||
#endif
|
||||
builder.Services.AddLocalization();
|
||||
var handler = new HttpClientHandler();
|
||||
handler.ServerCertificateCustomValidationCallback = (message, certificate, chain, sslPolicyErrors) => true;
|
||||
var client = new HttpClient(handler);
|
||||
|
|
@ -54,7 +54,9 @@ namespace TIAMMobileApp
|
|||
builder.Services.AddScoped<ISessionService, SessionServiceMobile>();
|
||||
builder.Services.AddSingleton<IComponentUpdateService, ComponentUpdateServiceMobile>();
|
||||
builder.Services.AddScoped<IServiceProviderDataService, ServiceProviderDataService>();
|
||||
builder.Services.AddScoped<IClientNoticeSenderService, ClientNoticeSenderService>();
|
||||
builder.Services.AddScoped<IWizardProcessor, WizardProcessor>();
|
||||
builder.Services.AddScoped<IImageDataService, ImageDataService>();
|
||||
builder.Services.AddSingleton(x => new ResourceManager("TIAMWebApp.Shared.Application.Resources", typeof(Main).Assembly));
|
||||
|
||||
builder.Services.Configure<AnimationOptions>(Guid.NewGuid().ToString(), c => { });
|
||||
|
|
|
|||
|
|
@ -28,5 +28,9 @@
|
|||
</array>
|
||||
<key>XSAppIconAssets</key>
|
||||
<string>Assets.xcassets/appicon.appiconset</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>This app uses camera for...</string>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>This app uses microphone to record videos for...</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,288 @@
|
|||
|
||||
|
||||
/******* Common Element CSS Start ******/
|
||||
|
||||
|
||||
body {
|
||||
font-family: "Roboto", sans-serif;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
ul,
|
||||
ol {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
outline: none;
|
||||
transition: all 0.4s ease-in-out;
|
||||
-webkit-transition: all 0.4s ease-in-out;
|
||||
}
|
||||
|
||||
a:focus,
|
||||
a:active,
|
||||
a:visited,
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #e73700;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-bottom: 48px;
|
||||
padding-bottom: 16px;
|
||||
font-size: 20px;
|
||||
line-height: 28px;
|
||||
font-weight: 700;
|
||||
position: relative;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0 0 10px;
|
||||
font-size: 28px;
|
||||
line-height: 36px;
|
||||
}
|
||||
|
||||
button {
|
||||
outline: none !important;
|
||||
}
|
||||
/******* Common Element CSS End *********/
|
||||
|
||||
/* -------- title style ------- */
|
||||
.line-title {
|
||||
position: relative;
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.line-title::before,
|
||||
.line-title::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
height: 4px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.line-title::before {
|
||||
width: 100%;
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
.line-title::after {
|
||||
width: 32px;
|
||||
background: #e73700;
|
||||
}
|
||||
|
||||
/******* Middle section CSS Start ******/
|
||||
/* -------- Landing page ------- */
|
||||
.game-section {
|
||||
/*padding: 5px 50px;*/
|
||||
}
|
||||
|
||||
.game-section .owl-stage {
|
||||
margin: 15px 0;
|
||||
display: flex;
|
||||
display: -webkit-flex;
|
||||
}
|
||||
|
||||
.game-section .item {
|
||||
margin: 0 15px 60px;
|
||||
width: 320px;
|
||||
height: 400px;
|
||||
display: flex;
|
||||
display: -webkit-flex;
|
||||
align-items: flex-end;
|
||||
-webkit-align-items: flex-end;
|
||||
background: #343434 no-repeat center center / cover;
|
||||
border-radius: 16px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
transition: all 0.4s ease-in-out;
|
||||
-webkit-transition: all 0.4s ease-in-out;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.57 );
|
||||
}
|
||||
|
||||
.game-section .item.active {
|
||||
width: 500px;
|
||||
box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.57 );
|
||||
-webkit-box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.57 );
|
||||
}
|
||||
|
||||
.game-section .item:after {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 1));
|
||||
}
|
||||
|
||||
.game-section .item-desc {
|
||||
padding: 0 24px 12px;
|
||||
color: #fff;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
overflow: hidden;
|
||||
transform: translateY(calc(100% - 54px));
|
||||
-webkit-transform: translateY(calc(100% - 54px));
|
||||
transition: all 0.4s ease-in-out;
|
||||
-webkit-transition: all 0.4s ease-in-out;
|
||||
}
|
||||
|
||||
.game-section .item.active .item-desc {
|
||||
transform: none;
|
||||
-webkit-transform: none;
|
||||
}
|
||||
|
||||
.game-section .item-desc p {
|
||||
opacity: 0;
|
||||
-webkit-transform: translateY(32px);
|
||||
transform: translateY(32px);
|
||||
transition: all 0.4s ease-in-out 0.2s;
|
||||
-webkit-transition: all 0.4s ease-in-out 0.2s;
|
||||
}
|
||||
|
||||
.game-section .item.active .item-desc p {
|
||||
opacity: 1;
|
||||
-webkit-transform: translateY(0);
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.game-section .owl-theme.custom-carousel .owl-dots {
|
||||
margin-top: -20px;
|
||||
position: relative;
|
||||
z-index: 5;
|
||||
}
|
||||
/******** Middle section CSS End *******/
|
||||
|
||||
/***** responsive css Start ******/
|
||||
|
||||
@media (min-width: 992px) and (max-width: 1199px) {
|
||||
h2 {
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 24px;
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
/* -------- Landing page ------- */
|
||||
.game-section {
|
||||
/*padding: 50px 5px;*/
|
||||
}
|
||||
|
||||
.game-section .item {
|
||||
margin: 0 12px 60px;
|
||||
width: 260px;
|
||||
height: 360px;
|
||||
}
|
||||
|
||||
.game-section .item.active {
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.game-section .item-desc {
|
||||
transform: translateY(calc(100% - 46px));
|
||||
-webkit-transform: translateY(calc(100% - 46px));
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) and (max-width: 991px) {
|
||||
h2 {
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 24px;
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
.line-title {
|
||||
width: 330px;
|
||||
}
|
||||
|
||||
/* -------- Landing page ------- */
|
||||
.game-section {
|
||||
/*padding: 50px 5px 40px;*/
|
||||
}
|
||||
|
||||
.game-section .item {
|
||||
margin: 0 12px 60px;
|
||||
width: 240px;
|
||||
height: 330px;
|
||||
}
|
||||
|
||||
.game-section .item.active {
|
||||
width: 360px;
|
||||
}
|
||||
|
||||
.game-section .item-desc {
|
||||
transform: translateY(calc(100% - 42px));
|
||||
-webkit-transform: translateY(calc(100% - 42px));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
body {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 19px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.line-title {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
/* -------- Landing page ------- */
|
||||
.game-section {
|
||||
padding: 30px 15px 20px;
|
||||
}
|
||||
|
||||
.game-section .item {
|
||||
margin: 0 10px 40px;
|
||||
width: 200px;
|
||||
height: 280px;
|
||||
}
|
||||
|
||||
.game-section .item.active {
|
||||
width: 270px;
|
||||
box-shadow: 6px 10px 10px rgba(0, 0, 0, 0.25);
|
||||
-webkit-box-shadow: 6px 10px 10px rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.game-section .item-desc {
|
||||
padding: 0 14px 5px;
|
||||
transform: translateY(calc(100% - 42px));
|
||||
-webkit-transform: translateY(calc(100% - 42px));
|
||||
}
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ button {
|
|||
transition: all 0.4s ease-in-out;
|
||||
-webkit-transition: all 0.4s ease-in-out;
|
||||
cursor: pointer;
|
||||
box-shadow: 3px 3px 3px #b1b1b1, -3px -3px 3px #fff;
|
||||
/*box-shadow: 3px 3px 3px #b1b1b1, -3px -3px 3px #141414;*/
|
||||
}
|
||||
|
||||
.game-section .item.active {
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<EventsComponent ItemType="0"></EventsComponent>
|
||||
<FeaturedItems ItemType="0"></FeaturedItems>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -116,13 +116,13 @@ button {
|
|||
transition: all 0.4s ease-in-out;
|
||||
-webkit-transition: all 0.4s ease-in-out;
|
||||
cursor: pointer;
|
||||
box-shadow: 3px 3px 3px #b1b1b1, -3px -3px 3px #fff;
|
||||
box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.57 );
|
||||
}
|
||||
|
||||
.game-section .item.active {
|
||||
width: 500px;
|
||||
box-shadow: 12px 40px 40px rgba(0, 0, 0, 0.25);
|
||||
-webkit-box-shadow: 12px 40px 40px rgba(0, 0, 0, 0.25);
|
||||
box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.57 );
|
||||
-webkit-box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.57 );
|
||||
}
|
||||
|
||||
.game-section .item:after {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,175 @@
|
|||
@*@using TIAMWebApp.Shared.Application.Models
|
||||
@page "/user/media"
|
||||
@using TIAMSharedUI.Shared @using TIAMWebApp.Shared.Application.Interfaces
|
||||
@layout AdminLayout
|
||||
|
||||
@inject NavigationManager NavigationManager
|
||||
<div class="upload-container">
|
||||
<div style="@(SelectedFilesCount > 0 ? "display: none" : string.Empty)">
|
||||
<span class="drop-file-icon mb-3"></span>
|
||||
<span class="mb-3">Click the Select Files button to select a file</span>
|
||||
</div>
|
||||
<DxUpload Name="myFile"
|
||||
UploadMode="@UploadMode.OnButtonClick"
|
||||
AllowMultiFileUpload="true"
|
||||
UploadUrl="@GetUploadUrl(APIUrls.UploadImage)"
|
||||
SelectedFilesChanged="@SelectedFilesChanged"
|
||||
MaxFileSize="15000000"
|
||||
CssClass="@(SelectedFilesCount > 0 ? "w-100" : string.Empty)">
|
||||
</DxUpload>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
int SelectedFilesCount { get; set; }
|
||||
protected void SelectedFilesChanged(IEnumerable<UploadFileInfo> files)
|
||||
{
|
||||
SelectedFilesCount = files.ToList().Count;
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
protected string GetUploadUrl(string url)
|
||||
{
|
||||
return NavigationManager.ToAbsoluteUri(url).AbsoluteUri;
|
||||
}
|
||||
} *@
|
||||
|
||||
|
||||
@rendermode RenderMode.InteractiveWebAssembly
|
||||
@page "/user/media"
|
||||
@using System.Net.Http.Headers
|
||||
@using TIAMSharedUI.Shared
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Models
|
||||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@layout AdminLayout
|
||||
@inject IJSRuntime JSRuntime;
|
||||
@inject IImageDataService imageDataService;
|
||||
@inject LogToBrowserConsole logToBrowserConsole;
|
||||
@implements IAsyncDisposable
|
||||
|
||||
<h3>File Upload</h3>
|
||||
|
||||
<div @ref="fileDropContainer" class="file-drop-zone @HoverClass glass" @ondragenter="OnDragEnter" @ondragleave="OnDragLeave" @ondragover="OnDragEnter">
|
||||
<InputFile OnChange="@OnChange" @ref="inputFile" multiple />
|
||||
</div>
|
||||
<div class="error-message-container">
|
||||
<p>@ErrorMessage</p>
|
||||
</div>
|
||||
<div class="image-container">
|
||||
@foreach (var imageSource in imageSources)
|
||||
{
|
||||
<img src="@imageSource" />
|
||||
}
|
||||
</div>
|
||||
<DxButton Text="Upload" Click="@UploadFiles" />
|
||||
|
||||
@code {
|
||||
ElementReference fileDropContainer;
|
||||
InputFile inputFile;
|
||||
|
||||
IJSObjectReference _filePasteModule;
|
||||
IJSObjectReference _filePasteFunctionReference;
|
||||
|
||||
private string HoverClass;
|
||||
private List<string> imageSources = new();
|
||||
private const int maxAllowedFiles = 2;
|
||||
private string ErrorMessage;
|
||||
|
||||
private MultipartFormDataContent multipartFormData = new MultipartFormDataContent();
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
_filePasteModule = await JSRuntime.InvokeAsync<IJSObjectReference>("import", "./_content/TIAMSharedUI/filePaste.js");
|
||||
|
||||
_filePasteFunctionReference = await _filePasteModule.InvokeAsync<IJSObjectReference>("initializeFilePaste", fileDropContainer, inputFile.Element);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDragEnter(DragEventArgs e) => HoverClass = "hover";
|
||||
|
||||
void OnDragLeave(DragEventArgs e) => HoverClass = string.Empty;
|
||||
|
||||
async Task OnChange(InputFileChangeEventArgs e)
|
||||
{
|
||||
imageSources.Clear();
|
||||
ErrorMessage = string.Empty;
|
||||
|
||||
if (e.FileCount > maxAllowedFiles)
|
||||
{
|
||||
ErrorMessage = $"Only {maxAllowedFiles} files can be uploaded";
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var file in e.GetMultipleFiles(maxAllowedFiles))
|
||||
{
|
||||
// using var stream = file.OpenReadStream();
|
||||
// using var ms = new MemoryStream();
|
||||
// await stream.CopyToAsync(ms);
|
||||
// imageSources.Add(Convert.ToBase64String(ms.ToArray()));
|
||||
//imageSources.Add($"data:{file.ContentType};base64,{Convert.ToBase64String(ms.ToArray())}");
|
||||
//send the file to the server through an API
|
||||
|
||||
var fileContent = new StreamContent(file.OpenReadStream());
|
||||
fileContent.Headers.ContentType = new MediaTypeHeaderValue(file.ContentType);
|
||||
multipartFormData.Add(fileContent, "file", file.Name);
|
||||
}
|
||||
|
||||
HoverClass = string.Empty;
|
||||
}
|
||||
|
||||
async Task UploadFiles()
|
||||
{
|
||||
if (multipartFormData.Headers.Count() == 0)
|
||||
{
|
||||
ErrorMessage = "No files to upload";
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
//send the files to the server through an API
|
||||
|
||||
|
||||
// List<StreamContent> streamContents = new List<StreamContent>();
|
||||
// foreach (var base64Image in imageSources)
|
||||
// {
|
||||
// byte[] imageBytes = Convert.FromBase64String(base64Image);
|
||||
// var streamContent = new StreamContent(new MemoryStream(imageBytes));
|
||||
// streamContents.Add(streamContent);
|
||||
// }
|
||||
|
||||
// var multipartContent = new MultipartFormDataContent();
|
||||
// for (int i = 0; i < streamContents.Count; i++)
|
||||
// {
|
||||
// multipartContent.Add(streamContents[i], $"file{i}", $"file{i}.jpg");
|
||||
// }
|
||||
|
||||
//send the multipartcontent to ImageData service
|
||||
|
||||
await imageDataService.UploadImageAsync(multipartFormData);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrorMessage = ex.Message;
|
||||
|
||||
logToBrowserConsole.LogToBC(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
if (_filePasteFunctionReference != null)
|
||||
{
|
||||
await _filePasteFunctionReference.InvokeVoidAsync("dispose");
|
||||
await _filePasteFunctionReference.DisposeAsync();
|
||||
}
|
||||
|
||||
if (_filePasteModule != null)
|
||||
{
|
||||
await _filePasteModule.DisposeAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
.file-drop-zone {
|
||||
width: 100%;
|
||||
border: 3px dotted #fb275d;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 2px;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
.hover {
|
||||
border-style: solid;
|
||||
background-color: #00ca71;
|
||||
}
|
||||
|
||||
.image-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.image-container img {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
::deep input[type=file] {
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.error-message-container {
|
||||
color: red;
|
||||
text-align: center;
|
||||
}
|
||||
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
<div class="row py-3">
|
||||
<div class=" col-12 col-xl-3 col-lg-6">
|
||||
<Animation Effect="@Effect.FadeInUp" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<Animation Effect="@Effect.FadeInUp" Class="glass" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<div class="card card-admin" style="border-radius: 16px;">
|
||||
<div class="card-header py-2 px-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
|
|
@ -49,8 +49,8 @@
|
|||
|
||||
</div>
|
||||
<div class=" col-12 col-xl-3 col-lg-6">
|
||||
<Animation Effect="@Effect.FadeInUp" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<Animation Effect="@Effect.FadeInUp" Class="glass" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card card-admin" style="border-radius: 16px;">
|
||||
<div class="card-header py-2 px-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
|
|
@ -87,8 +87,8 @@
|
|||
</Animation>
|
||||
</div>
|
||||
<div class=" col-12 col-xl-3 col-lg-6">
|
||||
<Animation Effect="@Effect.FadeInUp" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<Animation Effect="@Effect.FadeInUp" Class="glass" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card card-admin" style="border-radius: 16px;">
|
||||
<div class="card-header py-2 px-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
|
|
@ -125,8 +125,8 @@
|
|||
</Animation>
|
||||
</div>
|
||||
<div class=" col-12 col-xl-3 col-lg-6">
|
||||
<Animation Effect="@Effect.FadeInUp" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<Animation Effect="@Effect.FadeInUp" Class="glass" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card card-admin" style="border-radius: 16px;">
|
||||
<div class="card-header py-2 px-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
|
|
@ -165,8 +165,8 @@
|
|||
</Animation>
|
||||
</div>
|
||||
<div class="col-12 col-xl-6">
|
||||
<Animation Effect="@Effect.FadeInUp" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<Animation Effect="@Effect.FadeInUp" Class="glass" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card card-admin" style="border-radius: 16px;">
|
||||
<div class="card-header py-2 px-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
|
|
@ -208,8 +208,8 @@
|
|||
</Animation>
|
||||
</div>
|
||||
<div class="col-12 col-xl-6">
|
||||
<Animation Effect="@Effect.FadeInUp" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<Animation Effect="@Effect.FadeInUp" Class="glass" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card card-admin" style="border-radius: 16px;">
|
||||
<div class="card-header py-2 px-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
@page "/user/destinations"
|
||||
@using AyCode.Models.Messages
|
||||
@using BlazorAnimation
|
||||
@using TIAM.Entities.ServiceProviders
|
||||
@using TIAM.Resources
|
||||
@using TIAMSharedUI.Pages.Components
|
||||
|
|
@ -23,7 +24,7 @@
|
|||
<div class="col-12">
|
||||
<h3>@localizer.GetString("TransferDestination")</h3>
|
||||
|
||||
|
||||
<Animation Effect="@Effect.FadeInUp" Class="glass" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="d-flex flex-column mb-4 pb-2">
|
||||
<div class="align-self-end pl-2 pb-2">
|
||||
<DxButton Text="Column Chooser"
|
||||
|
|
@ -92,7 +93,7 @@
|
|||
|
||||
|
||||
</div>
|
||||
|
||||
</Animation>
|
||||
</div>
|
||||
|
||||
<div class=" col-12 col-xl-6">
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
@page "/user/transfers"
|
||||
@using AyCode.Models.Messages
|
||||
@using BlazorAnimation
|
||||
@using TIAM.Entities.ServiceProviders
|
||||
@using TIAM.Resources
|
||||
@using TIAMSharedUI.Pages.Components
|
||||
@using TIAMSharedUI.Shared
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Models
|
||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.Messages
|
||||
|
|
@ -11,6 +13,7 @@
|
|||
@layout AdminLayout
|
||||
@inject LogToBrowserConsole logToBrowserConsole
|
||||
@inject IStringLocalizer<TIAMResources> localizer
|
||||
@inject IWizardProcessor wizardProcessor
|
||||
<PageTitle>Transfers</PageTitle>
|
||||
|
||||
<div class="text-center m-5">
|
||||
|
|
@ -21,7 +24,8 @@
|
|||
<div class="container">
|
||||
<div class="row">
|
||||
<div class=" col-12">
|
||||
<div class="card glass">
|
||||
<Animation Effect="@Effect.FadeInUp" Class="glass" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card">
|
||||
|
||||
<DxPopup CssClass="popup-demo-events"
|
||||
@bind-Visible="@PopupVisible"
|
||||
|
|
@ -89,8 +93,9 @@
|
|||
<CellDisplayTemplate>
|
||||
@{
|
||||
var keyField = context.Value;
|
||||
var keyItem = (TransferWizardModel)context.DataItem;
|
||||
string buttonText = "Contact";
|
||||
<DxButton Click="() => SendMail(keyField)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary" />
|
||||
<DxButton Click="() => SendMail(keyItem)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary" />
|
||||
}
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
|
|
@ -158,6 +163,7 @@
|
|||
|
||||
|
||||
</div>
|
||||
</Animation>
|
||||
</div>
|
||||
|
||||
<div class=" col-12 col-xl-6">
|
||||
|
|
@ -177,7 +183,11 @@
|
|||
bool PopupVisible { get; set; }
|
||||
public List<string> ignoreList = new List<string>
|
||||
{
|
||||
"ReceiverId"
|
||||
"ReceiverEmailAddress",
|
||||
"ReceiverId",
|
||||
"SenderEmailAddress",
|
||||
"SenderId",
|
||||
"ContextId"
|
||||
};
|
||||
|
||||
public MessageWizardModel messageWizardModel = new MessageWizardModel();
|
||||
|
|
@ -203,9 +213,9 @@
|
|||
|
||||
};
|
||||
|
||||
void SendMail(object emailAddress)
|
||||
void SendMail(TransferWizardModel Item)
|
||||
{
|
||||
logToBrowserConsole.LogToBC($"Sending mail to {emailAddress}");
|
||||
logToBrowserConsole.LogToBC($"Sending mail to {Item.EmailAddress}");
|
||||
PopupVisible = true;
|
||||
}
|
||||
|
||||
|
|
@ -231,7 +241,8 @@
|
|||
|
||||
public async Task SubmitForm(object Result)
|
||||
{
|
||||
//await WizardProcessor.ProcessWizardAsync(Result.GetType(), Result);
|
||||
var email = await wizardProcessor.ProcessWizardAsync<MessageWizardModel>(Result.GetType(), Result);
|
||||
|
||||
logToBrowserConsole.LogToBC($"Submitted nested form: {Result.GetType().FullName}");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -177,6 +177,15 @@ namespace TIAMSharedUI.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Events.
|
||||
/// </summary>
|
||||
public static string NavMenu_Events {
|
||||
get {
|
||||
return ResourceManager.GetString("NavMenu.Events", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Home.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -156,6 +156,9 @@
|
|||
<data name="NavMenu.Admin" xml:space="preserve">
|
||||
<value>Adminisztráció</value>
|
||||
</data>
|
||||
<data name="NavMenu.Events" xml:space="preserve">
|
||||
<value>Események</value>
|
||||
</data>
|
||||
<data name="NavMenu.Home" xml:space="preserve">
|
||||
<value>Főoldal</value>
|
||||
</data>
|
||||
|
|
|
|||
|
|
@ -156,6 +156,9 @@
|
|||
<data name="NavMenu.Admin" xml:space="preserve">
|
||||
<value>Admin</value>
|
||||
</data>
|
||||
<data name="NavMenu.Events" xml:space="preserve">
|
||||
<value>Events</value>
|
||||
</data>
|
||||
<data name="NavMenu.Home" xml:space="preserve">
|
||||
<value>Home</value>
|
||||
</data>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,13 @@
|
|||
<NavLink class="nav-link" href="transfer">
|
||||
@localizer.GetString("NavMenu.Transfer")
|
||||
</NavLink>
|
||||
</li><li class="nav-item">
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="events">
|
||||
@localizer.GetString("NavMenu.Events")
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="swagger">
|
||||
API
|
||||
</NavLink>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -42,6 +42,12 @@
|
|||
</NavLink>
|
||||
</div>
|
||||
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="user/media">
|
||||
Media
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="user/cards">
|
||||
Cards
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ select {
|
|||
|
||||
.card {
|
||||
border-radius: 16px;
|
||||
/*box-shadow: 3px 3px 3px #b1b1b1, -3px -3px 3px #fff;*/
|
||||
box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.57 );
|
||||
-webkit-box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.57 );
|
||||
overflow: hidden;
|
||||
background-color: rgba( 255, 255, 255, 0.15 );
|
||||
/*color: #58457b;*/
|
||||
|
|
@ -67,22 +68,20 @@ select {
|
|||
}
|
||||
|
||||
.glass {
|
||||
border-radius: 16px;
|
||||
/*box-shadow: 3px 3px 3px #b1b1b1, -3px -3px 3px #fff;*/
|
||||
overflow: hidden;
|
||||
background: rgba( 255, 255, 255, 0.55 );
|
||||
box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.57 );
|
||||
|
||||
background: rgba( 255, 255, 255, 0.25 );
|
||||
|
||||
backdrop-filter: blur( 8px );
|
||||
-webkit-backdrop-filter: blur( 8px );
|
||||
border-radius: 10px;
|
||||
border: 1px solid rgba( 255, 255, 255, 0.18 );
|
||||
/*color: #58457b;*/
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.card .card-body {
|
||||
padding: 10px;
|
||||
|
||||
border: 1px solid rgba( 255, 255, 255, 0.18 );
|
||||
|
||||
}
|
||||
|
||||
.inputwizardwrapper {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
export function initializeFilePaste(fileDropContainer, inputFile) {
|
||||
|
||||
function onPaste(e) {
|
||||
inputFile.files = e.clipboardData.files;
|
||||
const event = new Event('change', { bubbles: true });
|
||||
inputFile.dispatchEvent(event);
|
||||
}
|
||||
|
||||
fileDropContainer.addEventListener('paste', onPaste);
|
||||
|
||||
return {
|
||||
dispose: () => {
|
||||
fileDropContainer.removeEventListener('paste', onPaste);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -28,7 +28,9 @@ builder.Services.AddBlazoredLocalStorage();
|
|||
builder.Services.AddSingleton<ISessionService, SessionServiceWeb>();
|
||||
builder.Services.AddSingleton<IComponentUpdateService, ComponentUpdateServiceWeb>();
|
||||
builder.Services.AddScoped<IServiceProviderDataService, ServiceProviderDataService>();
|
||||
builder.Services.AddScoped<IClientNoticeSenderService, ClientNoticeSenderService>();
|
||||
builder.Services.AddScoped<IWizardProcessor, WizardProcessor>();
|
||||
builder.Services.AddScoped<IImageDataService, ImageDataService>();
|
||||
//WebSpecific
|
||||
builder.Services.AddScoped<SessionStorageAccessor>();
|
||||
builder.Services.AddSingleton(x => new ResourceManager("TIAMWebApp.Client.Resources.MyResources", typeof(Program).Assembly));
|
||||
|
|
|
|||
|
|
@ -1,19 +1,26 @@
|
|||
using TIAM.Entities.TransferDestinations;
|
||||
using AyCode.Interfaces.Enums;
|
||||
using AyCode.Interfaces.Messages;
|
||||
using AyCode.Models.Messages;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAMWebApp.Shared.Application.Interfaces;
|
||||
using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
|
||||
using static AyCode.Interfaces.Enums.IMessageTypes;
|
||||
|
||||
namespace TIAMWebApp.Client.Services
|
||||
{
|
||||
public class WizardProcessor : IWizardProcessor
|
||||
{
|
||||
|
||||
public ITransferDataService transferDataService { get; set; }
|
||||
public IUserDataService userDataService { get; set; }
|
||||
public ITransferDataService TransferDataService { get; set; }
|
||||
public IUserDataService UserDataService { get; set; }
|
||||
|
||||
public WizardProcessor(ITransferDataService transferDataService, IUserDataService userDataService)
|
||||
public IClientNoticeSenderService MessageSenderService { get; set; }
|
||||
|
||||
public WizardProcessor(ITransferDataService transferDataService, IUserDataService userDataService, IClientNoticeSenderService messageSenderService)
|
||||
{
|
||||
this.transferDataService = transferDataService;
|
||||
this.userDataService = userDataService;
|
||||
this.TransferDataService = transferDataService;
|
||||
this.UserDataService = userDataService;
|
||||
this.MessageSenderService = messageSenderService;
|
||||
}
|
||||
|
||||
public async Task<TModelType?> ProcessWizardAsync<TModelType>(Type type, object data) where TModelType: class
|
||||
|
|
@ -21,13 +28,17 @@ namespace TIAMWebApp.Client.Services
|
|||
switch (type.Name)
|
||||
{
|
||||
case "TransferDestinationWizardModel":
|
||||
var result = await transferDataService.CreateTransferDestination((TransferDestination)data);
|
||||
var result = await TransferDataService.CreateTransferDestination((TransferDestination)data);
|
||||
return result as TModelType;
|
||||
|
||||
case "TransferWizardModel":
|
||||
var transferResult = await transferDataService.CreateTransfer((TransferWizardModel)data);
|
||||
var transferResult = await TransferDataService.CreateTransfer((TransferWizardModel)data);
|
||||
return transferResult as TModelType;
|
||||
|
||||
case "MessageWizardModel":
|
||||
var messageResult = await MessageSenderService.SendNoticeAsync((EmailMessage)data, 1);
|
||||
return messageResult as TModelType;
|
||||
|
||||
case "ServiceProvider":
|
||||
return null;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<WasmEnableSIMD>false</WasmEnableSIMD>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.4.0" />
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ using AyCode.Entities.Messages;
|
|||
using TIAMWebApp.Shared.Application.Models.ClientSide.Messages;
|
||||
using AyCode.Models.Messages;
|
||||
using AyCode.Models.Enums;
|
||||
using TIAM.Database.DataLayers.Admins;
|
||||
|
||||
namespace TIAMWebApp.Server.Controllers
|
||||
{
|
||||
|
|
@ -35,6 +36,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
[Route("api/v1/[controller]")]
|
||||
public class MessageAPIController : ControllerBase
|
||||
{
|
||||
private AdminDal _adminDal;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private IMessageSenderService _messageSenderService;
|
||||
|
|
@ -42,8 +44,9 @@ namespace TIAMWebApp.Server.Controllers
|
|||
|
||||
private readonly ILogger<MessageAPIController> _logger;
|
||||
|
||||
public MessageAPIController(ILogger<MessageAPIController> logger, IConfiguration configuration, IWebHostEnvironment webHostEnvironment, IMessageSenderService messageSenderService)
|
||||
public MessageAPIController(ILogger<MessageAPIController> logger, IConfiguration configuration, IWebHostEnvironment webHostEnvironment, IMessageSenderService messageSenderService, AdminDal adminDal)
|
||||
{
|
||||
_adminDal = adminDal;
|
||||
_logger = logger;
|
||||
_configuration = configuration;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
|
|
@ -66,6 +69,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
Console.WriteLine($"EmailMessage!!!");
|
||||
|
||||
var result = await _messageSenderService.SendMessageAsync(SerializedMessageSenderModel.Message, (int)SerializedMessageSenderModel.MessageType);
|
||||
//_adminDal.AddEmailMessageAsync((TIAM.Entities.Emails.EmailMessage)SerializedMessageSenderModel.Message);
|
||||
Console.WriteLine("SendEmail result: " + result);
|
||||
return Ok(result);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,120 @@
|
|||
using AyCode.Core.Logger;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Cors;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Drawing;
|
||||
using TIAM.Database.DataLayers.Admins;
|
||||
using TIAM.Database.DataLayers.Auctions;
|
||||
using TIAM.Entities.Auctions;
|
||||
using TIAMWebApp.Shared.Application.Models;
|
||||
|
||||
namespace TIAMWebApp.Server.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
[EnableCors("_myAllowSpecificOrigins")]
|
||||
[Route("api/v1/[controller]")]
|
||||
public class FileAPIController : ControllerBase
|
||||
{
|
||||
private AdminDal _adminDal;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
|
||||
|
||||
private readonly ILogger<FileAPIController> _logger;
|
||||
|
||||
public FileAPIController(ILogger<FileAPIController> logger, IConfiguration configuration, IWebHostEnvironment webHostEnvironment, AdminDal adminDal)
|
||||
{
|
||||
_logger = logger;
|
||||
_configuration = configuration;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_adminDal = adminDal;
|
||||
}
|
||||
|
||||
|
||||
const long MaxFileSize = 4_000_000;
|
||||
readonly string[] imageExtensions = { ".JPG", ".JPEG", ".GIF", ".PNG" };
|
||||
|
||||
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[Route(APIUrls.UploadImageRouteName)]
|
||||
public ActionResult UploadImage([FromForm] IFormFile file)
|
||||
{
|
||||
Console.WriteLine($"Upload file called: {file.FileName}");
|
||||
if (file == null || file.Length == 0)
|
||||
return BadRequest("File not selected");
|
||||
|
||||
string folderPath = @"C:\CDN";
|
||||
string fileName = Path.GetFileNameWithoutExtension(file.FileName);
|
||||
string extension = Path.GetExtension(file.FileName).ToUpper();
|
||||
Console.WriteLine(extension);
|
||||
var isValidExtenstion = imageExtensions.Contains(extension);
|
||||
var isValidSize = file.Length <= MaxFileSize;
|
||||
if (!isValidExtenstion || !isValidSize)
|
||||
{
|
||||
return BadRequest("Invalid file");
|
||||
}
|
||||
|
||||
string filePath = Path.Combine(folderPath, file.FileName);
|
||||
|
||||
if (!Directory.Exists(folderPath))
|
||||
{
|
||||
Directory.CreateDirectory(folderPath);
|
||||
}
|
||||
|
||||
int count = 1;
|
||||
while (System.IO.File.Exists(filePath))
|
||||
{
|
||||
string tempFileName = string.Format("{0}({1})", fileName, count++);
|
||||
filePath = Path.Combine(folderPath, tempFileName + extension);
|
||||
}
|
||||
|
||||
using (var stream = new FileStream(filePath, FileMode.Create))
|
||||
{
|
||||
file.CopyTo(stream);
|
||||
}
|
||||
|
||||
return Ok(new { filePath });
|
||||
}
|
||||
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpGet]
|
||||
[Route(APIUrls.GetImagesRouteName)]
|
||||
public IActionResult GetAllMedia()
|
||||
{
|
||||
string folderPath = @"C:\CDN";
|
||||
|
||||
if (!Directory.Exists(folderPath))
|
||||
{
|
||||
return NotFound("Directory not found");
|
||||
}
|
||||
|
||||
var files = Directory.GetFiles(folderPath)
|
||||
.Select(Path.GetFileName)
|
||||
.ToList();
|
||||
|
||||
return Ok(files);
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
//[HttpGet("Image/{name}")]
|
||||
[HttpGet("{APIUrls.GetImageRouteName}/{name}")]
|
||||
public IActionResult GetImage(string name)
|
||||
{
|
||||
string folderPath = @"C:\CDN";
|
||||
string filePath = Path.Combine(folderPath, name);
|
||||
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
{
|
||||
return NotFound("Image not found");
|
||||
}
|
||||
|
||||
var image = System.IO.File.OpenRead(filePath);
|
||||
return File(image, "image/jpeg");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[Route("AuthenticateUser")]
|
||||
[Route(APIUrls.AuthenticateUserRouteName)]
|
||||
public async Task<IActionResult> AuthenticateUser([FromBody] JsonElement SerializedLoginModel)
|
||||
{
|
||||
Console.WriteLine("AuthenticateUser called");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using AyCode.Interfaces.Messages;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using System.Text;
|
||||
|
|
@ -12,6 +13,8 @@ using TIAMWebApp.Server.Services;
|
|||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
string MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
|
@ -20,9 +23,15 @@ builder.Services.AddRazorPages();
|
|||
builder.Services.AddScoped<UserDal>();
|
||||
builder.Services.AddScoped<AdminDal>();
|
||||
builder.Services.AddScoped<AuctionDal>();
|
||||
//builder.Services.AddScoped<ServiceProviderDal>();
|
||||
builder.Services.AddScoped<TransferDestinationDal>();
|
||||
|
||||
builder.Services.AddCors(options => {
|
||||
options.AddPolicy(MyAllowSpecificOrigins,
|
||||
builder => {
|
||||
builder.AllowAnyOrigin();
|
||||
});
|
||||
});
|
||||
|
||||
builder.Services.AddSwaggerGen(swagger =>
|
||||
{
|
||||
swagger.SwaggerDoc("v1",
|
||||
|
|
@ -74,7 +83,10 @@ builder.Services.AddAuthentication(f =>
|
|||
};
|
||||
|
||||
});
|
||||
|
||||
builder.Services.Configure<FormOptions>(options =>
|
||||
{
|
||||
options.MultipartBodyLengthLimit = 200000000; // Increase the limit to 200MB
|
||||
});
|
||||
|
||||
builder.Services.AddScoped<IMessageSenderService, NoticeSenderService>();
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
|
|
@ -90,6 +102,8 @@ builder.Services.ConfigureApplicationCookie(options =>
|
|||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
|
|
@ -116,6 +130,8 @@ app.UseStaticFiles();
|
|||
|
||||
app.UseAuthentication();
|
||||
app.UseRouting();
|
||||
//cors
|
||||
app.UseCors(MyAllowSpecificOrigins);
|
||||
app.UseAuthorization();
|
||||
app.UsePathBase("/");
|
||||
app.MapRazorPages();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<WasmEnableSIMD>false</WasmEnableSIMD>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GoogleApi" Version="5.3.1" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
using AyCode.Interfaces.Messages;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static AyCode.Interfaces.Enums.IMessageTypes;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Interfaces
|
||||
{
|
||||
public interface IClientNoticeSenderService
|
||||
{
|
||||
public Task<string> SendNoticeAsync<TNotice>(TNotice message, int messageType) where TNotice : class, INoticeBase;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Interfaces
|
||||
{
|
||||
public interface IImageDataService
|
||||
{
|
||||
Task<string> UploadImageAsync(MultipartContent image);
|
||||
Task<Stream> GetImageAsync(string name);
|
||||
Task<List<string>> GetImagesAsync(string userId);
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ namespace TIAMWebApp.Shared.Application.Models
|
|||
public const string TransferDataAPI = BaseUrlWithSlashAndVersion + "TransferDataAPI/";
|
||||
public const string ServiceProviderAPI = BaseUrlWithSlashAndVersion + "ServiceProviderAPI/";
|
||||
public const string UserPermissionAPI = BaseUrlWithSlashAndVersion + "UserPermissionAPI/";
|
||||
public const string FileAPI = BaseUrlWithSlashAndVersion + "FileAPI/";
|
||||
|
||||
//userdata
|
||||
public const string UserTestRouteName = "test1";
|
||||
|
|
@ -108,5 +109,16 @@ namespace TIAMWebApp.Shared.Application.Models
|
|||
//12
|
||||
public const string GetPermissionGroupsForContextByContextIdRouteName = "GetPermissionGroupsForContextByContextId";
|
||||
public const string GetPermissionGroupsForContextByContextId = ServiceProviderAPI+GetPermissionGroupsForContextByContextIdRouteName;
|
||||
|
||||
//file upload
|
||||
public const string UploadImageRouteName = "UploadImage";
|
||||
public const string UploadImage = FileAPI+UploadImageRouteName;
|
||||
//get images
|
||||
public const string GetImagesRouteName = "GetAllMedia";
|
||||
public const string GetImages = FileAPI+GetImagesRouteName;
|
||||
//get image by name
|
||||
public const string GetImageRouteName = "GetImage";
|
||||
public const string GetImage = FileAPI+GetImageRouteName;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using TIAM.Entities.Emails;
|
||||
using TIAM.Resources;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||
|
|
@ -12,9 +14,11 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|||
public class MessageWizardModel
|
||||
{
|
||||
|
||||
[DataType(DataType.Text)]
|
||||
[Display(Name = "ReceiverId", ResourceType = typeof(TIAMResources))]
|
||||
public string ReceiverId { get; set; }
|
||||
public string ReceiverEmailAddress { get; set; }
|
||||
public Guid ReceiverId { get; set; }
|
||||
public string SenderEmailAddress { get; set; }
|
||||
public Guid SenderId { get; set; }
|
||||
public Guid ContextId { get; set; }
|
||||
[Required(ErrorMessage = "The subject value should be specified.")]
|
||||
[DataType(DataType.Text)]
|
||||
[Display(Name = "Subject", ResourceType = typeof(TIAMResources))]
|
||||
|
|
@ -25,11 +29,32 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|||
public string Content { get; set; }
|
||||
|
||||
public MessageWizardModel() { }
|
||||
public MessageWizardModel(string receiverId, string subject, string content)
|
||||
public MessageWizardModel(string receiverEmailAddress, Guid receiverId, string senderEmailAddress, Guid senderId, string subject, string content)
|
||||
{
|
||||
ReceiverEmailAddress = receiverEmailAddress;
|
||||
ReceiverId = receiverId;
|
||||
SenderEmailAddress = senderEmailAddress;
|
||||
SenderId = senderId;
|
||||
Subject = subject;
|
||||
Content = content;
|
||||
}
|
||||
|
||||
public static EmailMessage ConvertToNewEmailMessage(MessageWizardModel message)
|
||||
{
|
||||
var id = Guid.NewGuid();
|
||||
|
||||
|
||||
return new EmailMessage
|
||||
{
|
||||
Id = id,
|
||||
SenderId = message.SenderId,
|
||||
ContextId = message.ContextId,
|
||||
Subject = message.Subject,
|
||||
Text = message.Content,
|
||||
SenderEmailAddress = message.SenderEmailAddress,
|
||||
Recipients = new List<EmailRecipient> { new EmailRecipient(
|
||||
Guid.NewGuid(), message.ReceiverId, id) }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Models
|
||||
{
|
||||
public class Event
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string DateAndTime { get; set; }
|
||||
|
||||
public string Location { get; set; }
|
||||
public string ImageUrl { get; set; }
|
||||
|
||||
public Event()
|
||||
{
|
||||
}
|
||||
|
||||
public Event(string name, string description, string dateAndTime, string location, string imageUrl)
|
||||
{
|
||||
Name = name;
|
||||
Description = description;
|
||||
DateAndTime = dateAndTime;
|
||||
Location = location;
|
||||
ImageUrl = imageUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TIAMWebApp.Shared.Application.Interfaces;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Services
|
||||
{
|
||||
public class ClientNoticeSenderService : IClientNoticeSenderService
|
||||
{
|
||||
Task<string> IClientNoticeSenderService.SendNoticeAsync<TNotice>(TNotice message, int messageType)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
using Azure;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Microsoft.SqlServer.Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAMWebApp.Shared.Application.Interfaces;
|
||||
using TIAMWebApp.Shared.Application.Models.ClientSide;
|
||||
using TIAMWebApp.Shared.Application.Models;
|
||||
using static System.Net.WebRequestMethods;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Services
|
||||
{
|
||||
public class ImageDataService : IImageDataService
|
||||
{
|
||||
private readonly HttpClient _http;
|
||||
|
||||
public ImageDataService(HttpClient httpClient)
|
||||
{
|
||||
_http = httpClient;
|
||||
}
|
||||
|
||||
public async Task<List<string>> GetImagesAsync(string userId)
|
||||
{
|
||||
var response = await _http.GetAsync("images");
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var fileNames = await response.Content.ReadFromJsonAsync<List<string>>();
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
throw new ApplicationException($"Status code: {response.StatusCode}, Error: {response.ReasonPhrase}");
|
||||
}
|
||||
|
||||
public async Task<Stream> GetImageAsync(string name)
|
||||
{
|
||||
var response = await _http.GetAsync($"image/{name}");
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var stream = await response.Content.ReadAsStreamAsync();
|
||||
return stream;
|
||||
}
|
||||
|
||||
throw new ApplicationException($"Status code: {response.StatusCode}, Error: {response.ReasonPhrase}");
|
||||
}
|
||||
|
||||
public async Task<string> UploadImageAsync(MultipartContent image)
|
||||
{
|
||||
var url = $"{Setting.BaseUrl}/{APIUrls.UploadImage}";
|
||||
var response = await _http.PostAsync(url, image);
|
||||
|
||||
//var result = new WizardProcessorResult();
|
||||
|
||||
//if (response.IsSuccessStatusCode)
|
||||
//{
|
||||
// result.IsSucces = true;
|
||||
// result.ResultJson = await response.Content.ReadAsStringAsync();
|
||||
//}
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
return "Oops, something wrong";
|
||||
|
||||
var result = await response.Content.ReadAsStringAsync();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="5.0.17" />
|
||||
<PackageReference Include="Microsoft.JSInterop" Version="8.0.1" />
|
||||
<PackageReference Include="SkiaSharp" Version="2.88.7" />
|
||||
<PackageReference Include="SkiaSharp.Views.Desktop.Common" Version="2.88.7" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue