trasnfer user and product management updates
This commit is contained in:
parent
65a8c19017
commit
7ae59a30db
|
|
@ -37,6 +37,7 @@ namespace TIAM.Database.DataLayers.Users
|
||||||
public Task<UserModelDto?> GetUserModelDtoByIdAsync(Guid userId) => SessionAsync(x => x.GetUserModelDtoById(userId));
|
public Task<UserModelDto?> GetUserModelDtoByIdAsync(Guid userId) => SessionAsync(x => x.GetUserModelDtoById(userId));
|
||||||
public Task<UserModelDto?> GetUserModelDtoByEmailAsync(string email) => SessionAsync(x => x.GetUserModelDtoByEmail(email));
|
public Task<UserModelDto?> GetUserModelDtoByEmailAsync(string email) => SessionAsync(x => x.GetUserModelDtoByEmail(email));
|
||||||
public Task<List<UserModelDto>> GetAllUsersModelDtoAsync() => SessionAsync(x => x.GetAllUsersModelDto().ToList());
|
public Task<List<UserModelDto>> GetAllUsersModelDtoAsync() => SessionAsync(x => x.GetAllUsersModelDto().ToList());
|
||||||
|
public Task<List<UserModelDtoDetail>> GetAllUsersModelDtoDetailAsync() => SessionAsync(x => x.GetAllUsersModelDetailDto().ToList());
|
||||||
|
|
||||||
public Task<User?> GetUserByPhoneNumberAsync(string phoneNumber)
|
public Task<User?> GetUserByPhoneNumberAsync(string phoneNumber)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -147,9 +147,14 @@ namespace TIAMMobileApp.Services
|
||||||
return (isSuccess, user);
|
return (isSuccess, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<UserModelDto>?> GetUsersAsync()
|
public async Task<List<UserModelDto>?> GetUsersAsync()
|
||||||
{
|
{
|
||||||
return await http.GetFromJsonAsync<IEnumerable<UserModelDto>>(APIUrls.GetUsers);
|
return await http.GetFromJsonAsync<List<UserModelDto>>(APIUrls.GetUsers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<UserModelDtoDetail>?> GetUsersWithDetailsAsync()
|
||||||
|
{
|
||||||
|
return await http.GetFromJsonAsync<List<UserModelDtoDetail>>(APIUrls.GetUsersWithDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UserModelDto?> GetUserByEmailAsync(string email)
|
public async Task<UserModelDto?> GetUserByEmailAsync(string email)
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
ShowFilterRow="true">
|
ShowFilterRow="true">
|
||||||
<Columns>
|
<Columns>
|
||||||
|
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" />
|
<DxGridDataColumn FieldName="Id" GroupIndex="0" />
|
||||||
<DxGridDataColumn FieldName="CarId" Width="40%" />
|
<DxGridDataColumn FieldName="CarId" Width="40%" />
|
||||||
<DxGridDataColumn FieldName="LicencePlate" />
|
<DxGridDataColumn FieldName="LicencePlate" />
|
||||||
|
|
@ -35,7 +36,7 @@
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public bool KeyboardNavigationEnabled { get; set; }
|
public bool KeyboardNavigationEnabled { get; set; }
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public TIAM.Entities.Transfers.Transfer Customer { get; set; }
|
public Transfer Customer { get; set; }
|
||||||
|
|
||||||
List<TransferToDriver> DetailGridData { get; set; }
|
List<TransferToDriver> DetailGridData { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
|
@page "/user/products"
|
||||||
@using AyCode.Models.Messages
|
@using AyCode.Models.Messages
|
||||||
@using TIAM.Entities.ServiceProviders
|
@using TIAM.Entities.ServiceProviders
|
||||||
@using TIAM.Resources
|
@using TIAM.Resources
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.Messages
|
@using TIAMWebApp.Shared.Application.Models.ClientSide.Messages
|
||||||
@using TIAMWebApp.Shared.Application.Utility
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
|
@layout AdminLayout
|
||||||
@inject LogToBrowserConsole logToBrowserConsole
|
@inject LogToBrowserConsole logToBrowserConsole
|
||||||
@inject IStringLocalizer<TIAMResources> localizer
|
@inject IStringLocalizer<TIAMResources> localizer
|
||||||
|
|
||||||
|
|
@ -98,4 +99,5 @@
|
||||||
@code {
|
@code {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -11,15 +11,21 @@ using Microsoft.AspNetCore.Components;
|
||||||
using TIAM.Entities.ServiceProviders;
|
using TIAM.Entities.ServiceProviders;
|
||||||
using TIAM.Core.Enums;
|
using TIAM.Core.Enums;
|
||||||
using TIAMWebApp.Shared.Application.Services;
|
using TIAMWebApp.Shared.Application.Services;
|
||||||
|
using TIAMWebApp.Shared.Application.Utility;
|
||||||
|
|
||||||
namespace TIAMSharedUI.Pages.User.SysAdmins
|
namespace TIAMSharedUI.Pages.User.SysAdmins
|
||||||
{
|
{
|
||||||
public partial class Products :ComponentBase
|
public partial class ManageProducts :ComponentBase
|
||||||
{
|
{
|
||||||
|
|
||||||
IGrid Grid { get; set; }
|
IGrid Grid { get; set; }
|
||||||
object? ProductData { get; set; }
|
object? ProductData { get; set; }
|
||||||
|
|
||||||
|
public void ColumnChooserButton_Click()
|
||||||
|
{
|
||||||
|
Grid.ShowColumnChooser();
|
||||||
|
}
|
||||||
|
|
||||||
public ProductWizardModel myModel = new ProductWizardModel();
|
public ProductWizardModel myModel = new ProductWizardModel();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -158,10 +164,5 @@ namespace TIAMSharedUI.Pages.User.SysAdmins
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColumnChooserButton_Click()
|
|
||||||
{
|
|
||||||
Grid.ShowColumnChooser();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -69,6 +69,7 @@
|
||||||
Data="TransferData"
|
Data="TransferData"
|
||||||
AutoCollapseDetailRow="AutoCollapseDetailRow"
|
AutoCollapseDetailRow="AutoCollapseDetailRow"
|
||||||
KeyboardNavigationEnabled="true"
|
KeyboardNavigationEnabled="true"
|
||||||
|
CustomizeElement="Grid_CustomizeElement"
|
||||||
CustomizeEditModel="Grid_CustomizeEditModel"
|
CustomizeEditModel="Grid_CustomizeEditModel"
|
||||||
EditModelSaving="Grid_EditModelSaving"
|
EditModelSaving="Grid_EditModelSaving"
|
||||||
DataItemDeleting="Grid_DataItemDeleting"
|
DataItemDeleting="Grid_DataItemDeleting"
|
||||||
|
|
@ -78,12 +79,13 @@
|
||||||
KeyFieldName="Id">
|
KeyFieldName="Id">
|
||||||
|
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" SortIndex="0" Visible="false" />
|
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="false" SortIndex="0" Visible="false" />
|
||||||
<DxGridDataColumn FieldName="OrderId" />
|
<DxGridDataColumn FieldName="OrderId" />
|
||||||
<DxGridDataColumn FieldName="FromAddress" />
|
<DxGridDataColumn FieldName="FromAddress" />
|
||||||
<DxGridDataColumn FieldName="ToAddress" />
|
<DxGridDataColumn FieldName="ToAddress" />
|
||||||
<DxGridDataColumn FieldName="Appointment" />
|
<DxGridDataColumn FieldName="Appointment" />
|
||||||
|
<DxGridDataColumn FieldName="ContactName" />
|
||||||
<DxGridDataColumn FieldName="ContactPhone" />
|
<DxGridDataColumn FieldName="ContactPhone" />
|
||||||
<DxGridDataColumn FieldName="ContactEmail">
|
<DxGridDataColumn FieldName="ContactEmail">
|
||||||
<CellDisplayTemplate>
|
<CellDisplayTemplate>
|
||||||
|
|
@ -154,7 +156,7 @@
|
||||||
@code {
|
@code {
|
||||||
|
|
||||||
|
|
||||||
public TransferWizardModel myModel = new TransferWizardModel();
|
public Transfer myModel = new Transfer();
|
||||||
|
|
||||||
public List<Transfer> TransferData { get; set; }
|
public List<Transfer> TransferData { get; set; }
|
||||||
|
|
||||||
|
|
@ -207,6 +209,30 @@
|
||||||
logToBrowserConsole.LogToBC($"Submitted nested form: {Result.GetType().FullName}");
|
logToBrowserConsole.LogToBC($"Submitted nested form: {Result.GetType().FullName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.ElementType == GridElementType.DataRow && (System.Byte)e.Grid.GetRowValue(e.VisibleIndex, "TransferStatusType") == 5)
|
||||||
|
{
|
||||||
|
e.CssClass = "bg-important";
|
||||||
|
}
|
||||||
|
else if (e.ElementType == GridElementType.DataRow && (System.Byte)e.Grid.GetRowValue(e.VisibleIndex, "TransferStatusType") > 5 && (System.Byte)e.Grid.GetRowValue(e.VisibleIndex, "TransferStatusType") < 35)
|
||||||
|
{
|
||||||
|
e.CssClass = "bg-attention";
|
||||||
|
}
|
||||||
|
else if (e.ElementType == GridElementType.DataRow && (System.Byte)e.Grid.GetRowValue(e.VisibleIndex, "TransferStatusType") == 35)
|
||||||
|
{
|
||||||
|
e.CssClass = "bg-finished";
|
||||||
|
}
|
||||||
|
else if (e.ElementType == GridElementType.DataRow && (System.Byte)e.Grid.GetRowValue(e.VisibleIndex, "TransferStatusType") > 35)
|
||||||
|
{
|
||||||
|
e.CssClass = "bg-cancel";
|
||||||
|
}
|
||||||
|
if (e.ElementType == GridElementType.HeaderCell)
|
||||||
|
{
|
||||||
|
e.Style = "background-color: rgba(0, 0, 0, 0.08)";
|
||||||
|
e.CssClass = "header-bold";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
|
|
@ -232,6 +258,7 @@
|
||||||
|
|
||||||
async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e)
|
async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e)
|
||||||
{
|
{
|
||||||
|
bool success = false;
|
||||||
if (e.IsNew)
|
if (e.IsNew)
|
||||||
{
|
{
|
||||||
//add new orderData to orderData array
|
//add new orderData to orderData array
|
||||||
|
|
@ -240,25 +267,24 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
logToBrowserConsole.LogToBC("orderData updated at id " + ((TransferWizardModel)e.EditModel).Id);
|
logToBrowserConsole.LogToBC("orderData updated at id " + ((Transfer)e.EditModel).Id);
|
||||||
|
|
||||||
|
success = await transferDataService.UpdateTransferAsync((Transfer)e.EditModel);
|
||||||
|
|
||||||
//await transferDataService.UpdateTransferAsync((TransferWizardModel)e.EditModel);
|
|
||||||
//modify transferData where transferData.Id == e.EditModel.Id
|
|
||||||
}
|
}
|
||||||
//get transfer from TransferData by Id
|
//get transfer from TransferData by Id
|
||||||
|
|
||||||
foreach (var transferToModify in (List<Transfer>)TransferData)
|
// foreach (var transferToModify in (List<Transfer>)TransferData)
|
||||||
{
|
// {
|
||||||
myModel = (TransferWizardModel)e.EditModel;
|
// myModel = (Transfer)e.EditModel;
|
||||||
|
|
||||||
if (transferToModify.Id == myModel.Id)
|
// if (transferToModify.Id == myModel.Id)
|
||||||
{
|
// {
|
||||||
//transferToModify.Driver = myModel.Driver;
|
// //transferToModify.Driver = myModel.Driver;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
if(success)
|
||||||
//await NwindDataService.UpdateEmployeeAsync((EditableEmployee)e.DataItem, (EditableEmployee)e.EditModel);
|
await UpdateDataAsync();
|
||||||
await UpdateDataAsync();
|
|
||||||
}
|
}
|
||||||
async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e)
|
async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
@ -270,7 +296,7 @@
|
||||||
async Task UpdateDataAsync()
|
async Task UpdateDataAsync()
|
||||||
{
|
{
|
||||||
//refresh grid
|
//refresh grid
|
||||||
//DataSource = await NwindDataService.GetEmployeesEditableAsync();
|
TransferData = await transferDataService.GetTransfersAsync();
|
||||||
logToBrowserConsole.LogToBC("orderData grid refreshed");
|
logToBrowserConsole.LogToBC("orderData grid refreshed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,325 @@
|
||||||
|
@page "/user/users"
|
||||||
|
@using AyCode.Models.Messages
|
||||||
|
@using BlazorAnimation
|
||||||
|
@using TIAM.Core.Enums
|
||||||
|
@using TIAM.Entities.Products
|
||||||
|
@using TIAM.Entities.ServiceProviders
|
||||||
|
@using TIAM.Entities.Transfers
|
||||||
|
@using TIAM.Entities.Users
|
||||||
|
@using TIAM.Models.Dtos.Profiles
|
||||||
|
@using TIAM.Models.Dtos.Users
|
||||||
|
@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
|
||||||
|
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||||
|
@using TIAMWebApp.Shared.Application.Models.ClientSide.Messages
|
||||||
|
@using TIAMWebApp.Shared.Application.Models.PageModels
|
||||||
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
|
@layout AdminLayout
|
||||||
|
@inject LogToBrowserConsole logToBrowserConsole
|
||||||
|
@inject IStringLocalizer<TIAMResources> localizer
|
||||||
|
@inject IWizardProcessor wizardProcessor
|
||||||
|
@inject IUserDataService userDataService
|
||||||
|
<PageTitle>Transfers</PageTitle>
|
||||||
|
|
||||||
|
<div class="text-center m-5">
|
||||||
|
<h1>Transfer management</h1>
|
||||||
|
<h2 style="font-size:small">Manage transfers here!</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<DxPopup CssClass="popup-demo-events"
|
||||||
|
@bind-Visible="@PopupVisible"
|
||||||
|
ShowFooter="true"
|
||||||
|
CloseOnEscape="true"
|
||||||
|
CloseOnOutsideClick="false"
|
||||||
|
ShowCloseButton="false"
|
||||||
|
HeaderText="MessageBox"
|
||||||
|
Closing="EulaPopupClosing"
|
||||||
|
Closed="EulaPopupClosed">
|
||||||
|
<BodyContentTemplate>
|
||||||
|
<InputWizard Data=@messageWizardModel
|
||||||
|
OnSubmit="SubmitForm"
|
||||||
|
IgnoreReflection=@ignoreList
|
||||||
|
TitleResourceString="NewMessage"
|
||||||
|
SubtitleResourceString="NewMessageSubtitle"
|
||||||
|
SubmitButtonText="ButtonSend"></InputWizard>
|
||||||
|
</BodyContentTemplate>
|
||||||
|
<FooterContentTemplate Context="Context">
|
||||||
|
<div class="popup-demo-events-footer">
|
||||||
|
<!--DxCheckBox CssClass="popup-demo-events-checkbox" @bind-Checked="@EulaAccepted">I accept the terms of the EULA</!--DxCheckBox-->
|
||||||
|
<!--DxButton CssClass="popup-demo-events-button ms-2" RenderStyle="ButtonRenderStyle.Primary" Text="OK" Click="Context.CloseCallback" /-->
|
||||||
|
<DxButton CssClass="popup-demo-events-button ms-2" RenderStyle="ButtonRenderStyle.Secondary" Text="Cancel" Click="CancelCreateClick" />
|
||||||
|
</div>
|
||||||
|
</FooterContentTemplate>
|
||||||
|
</DxPopup>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class=" col-12">
|
||||||
|
<Animation Effect="@Effect.FadeInUp" Class="glass" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||||
|
<div class="card">
|
||||||
|
<div class="d-flex flex-column mb-4 pb-2">
|
||||||
|
<div class="align-self-end pl-2 pb-2">
|
||||||
|
<DxButton Text="Column Chooser"
|
||||||
|
RenderStyle="ButtonRenderStyle.Secondary"
|
||||||
|
IconCssClass="btn-column-chooser"
|
||||||
|
Click="ColumnChooserButton_Click" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<DxGrid @ref="Grid"
|
||||||
|
Data="UserData"
|
||||||
|
AutoCollapseDetailRow="AutoCollapseDetailRow"
|
||||||
|
KeyboardNavigationEnabled="true"
|
||||||
|
CustomizeElement="Grid_CustomizeElement"
|
||||||
|
CustomizeEditModel="Grid_CustomizeEditModel"
|
||||||
|
EditModelSaving="Grid_EditModelSaving"
|
||||||
|
DataItemDeleting="Grid_DataItemDeleting"
|
||||||
|
EditMode="GridEditMode.EditForm"
|
||||||
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
ShowFilterRow="true"
|
||||||
|
KeyFieldName="Id">
|
||||||
|
|
||||||
|
<Columns>
|
||||||
|
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
|
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="false" SortIndex="0" Visible="false" />
|
||||||
|
<DxGridDataColumn FieldName="Profile.Name" />
|
||||||
|
<DxGridDataColumn FieldName="UserDto.PhoneNumber" />
|
||||||
|
<DxGridDataColumn FieldName="UserDto.Created" />
|
||||||
|
<DxGridDataColumn FieldName="UserDto.EmailConfirmed" />
|
||||||
|
<DxGridDataColumn FieldName="UserDto.RefferalId" />
|
||||||
|
<DxGridDataColumn FieldName="UserDto.EmailAddress">
|
||||||
|
<CellDisplayTemplate>
|
||||||
|
@{
|
||||||
|
var keyField = context.Value;
|
||||||
|
var keyItem = (UserModelDtoDetail)context.DataItem;
|
||||||
|
|
||||||
|
string buttonText = "Contact";
|
||||||
|
<DxButton Click="() => SendMail(keyItem)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary" />
|
||||||
|
}
|
||||||
|
</CellDisplayTemplate>
|
||||||
|
</DxGridDataColumn>
|
||||||
|
</Columns>
|
||||||
|
<DetailRowTemplate>
|
||||||
|
<UserGrid_MasterDetail_NestedGrid_UserProductMapping Customer="(UserModelDtoDetail)context.DataItem" KeyboardNavigationEnabled="true" />
|
||||||
|
</DetailRowTemplate>
|
||||||
|
<EditFormTemplate Context="EditFormContext">
|
||||||
|
@{
|
||||||
|
var transfer2 = (UserModelDtoDetail)EditFormContext.EditModel;
|
||||||
|
}
|
||||||
|
<DxFormLayout CssClass="w-100">
|
||||||
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.EmailAddress) ColSpanMd="4">
|
||||||
|
@EditFormContext.GetEditor("UserDto.EmailAddress")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.ConfirmEmail) ColSpanMd="4">
|
||||||
|
@EditFormContext.GetEditor("UserDto.EmailConfirmed")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.PhoneNumber) ColSpanMd="4">
|
||||||
|
@EditFormContext.GetEditor("UserDto.PhoneNumber")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.FullName) ColSpanMd="4">
|
||||||
|
@EditFormContext.GetEditor("Profile.Name")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
</DxFormLayout>
|
||||||
|
</EditFormTemplate>
|
||||||
|
|
||||||
|
|
||||||
|
</DxGrid>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</Animation>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class=" col-12 col-xl-6">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public UserModelDtoDetail myModel = new UserModelDtoDetail();
|
||||||
|
|
||||||
|
public List<UserModelDtoDetail>? UserData { get; set; }
|
||||||
|
|
||||||
|
bool PopupVisible { get; set; }
|
||||||
|
|
||||||
|
IGrid? Grid { get; set; }
|
||||||
|
object? MasterGridData { get; set; }
|
||||||
|
bool AutoCollapseDetailRow { get; set; }
|
||||||
|
|
||||||
|
public List<string> ignoreList = new List<string>
|
||||||
|
{
|
||||||
|
"ReceiverEmailAddress",
|
||||||
|
"ReceiverId",
|
||||||
|
"SenderEmailAddress",
|
||||||
|
"SenderId",
|
||||||
|
"ContextId"
|
||||||
|
};
|
||||||
|
|
||||||
|
public MessageWizardModel messageWizardModel = new MessageWizardModel();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async void SendMail(UserModelDtoDetail Item)
|
||||||
|
{
|
||||||
|
var user = await userDataService.GetUserDetailByIdAsync(Item.Id);
|
||||||
|
logToBrowserConsole.LogToBC($"Sending mail to {user.UserDto.EmailAddress}");
|
||||||
|
|
||||||
|
PopupVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CancelCreateClick()
|
||||||
|
{
|
||||||
|
|
||||||
|
PopupVisible = false;
|
||||||
|
}
|
||||||
|
void EulaPopupClosed()
|
||||||
|
{
|
||||||
|
//cancel clicked
|
||||||
|
|
||||||
|
}
|
||||||
|
void EulaPopupClosing(PopupClosingEventArgs args)
|
||||||
|
{
|
||||||
|
//myModel = new TransferWizardModel();
|
||||||
|
messageWizardModel = new MessageWizardModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
public async Task SubmitForm(object Result)
|
||||||
|
{
|
||||||
|
var email = await wizardProcessor.ProcessWizardAsync<MessageWizardModel>(Result.GetType(), Result);
|
||||||
|
|
||||||
|
logToBrowserConsole.LogToBC($"Submitted nested form: {Result.GetType().FullName}");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.ElementType == GridElementType.DataRow && e.VisibleIndex % 2 == 1)
|
||||||
|
{
|
||||||
|
e.CssClass = "bg-alt";
|
||||||
|
}
|
||||||
|
if (e.ElementType == GridElementType.HeaderCell)
|
||||||
|
{
|
||||||
|
e.Style = "background-color: rgba(0, 0, 0, 0.08); font-style=bold";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.IsNew)
|
||||||
|
{
|
||||||
|
var userEditModel = (UserModelDtoDetail)e.EditModel; //TODO not valid cast
|
||||||
|
userEditModel.Id = Guid.NewGuid();
|
||||||
|
|
||||||
|
userEditModel.UserDto = new UserDtoDetail();
|
||||||
|
userEditModel.UserDto.AffiliateId = Guid.NewGuid();
|
||||||
|
userEditModel.UserDto.EmailAddress = "";
|
||||||
|
userEditModel.UserDto.PhoneNumber = "";
|
||||||
|
userEditModel.Profile = new ProfileDto();
|
||||||
|
userEditModel.Profile.Name = "New user";
|
||||||
|
|
||||||
|
userEditModel.Products = new List<Product>();
|
||||||
|
|
||||||
|
userEditModel.ServiceProviders = new List<TiamServiceProvider>();
|
||||||
|
|
||||||
|
userEditModel.UserProductMappings = new List<UserProductMapping>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task Grid_EditModelSaving(GridEditModelSavingEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.IsNew)
|
||||||
|
{
|
||||||
|
//add new orderData to orderData array
|
||||||
|
RegistrationModel registration = new RegistrationModel();
|
||||||
|
//TODO: Refractor to userDataService
|
||||||
|
Random random = new Random();
|
||||||
|
string chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
||||||
|
string password = new string(Enumerable.Repeat(chars, 10)
|
||||||
|
.Select(s => s[random.Next(s.Length)]).ToArray());
|
||||||
|
|
||||||
|
registration.Email = ((UserModelDtoDetail)e.EditModel).UserDto.EmailAddress;
|
||||||
|
registration.PhoneNumber = ((UserModelDtoDetail)e.EditModel).UserDto.PhoneNumber;
|
||||||
|
registration.Password = password;
|
||||||
|
registration.ReferralId = null;
|
||||||
|
|
||||||
|
|
||||||
|
await userDataService.CreateGuestUser(registration);
|
||||||
|
logToBrowserConsole.LogToBC("New user created added");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logToBrowserConsole.LogToBC("orderData updated at id " + ((UserModelDtoDetail)e.EditModel).Id);
|
||||||
|
|
||||||
|
//await transferDataService.UpdateTransferAsync((TransferWizardModel)e.EditModel);
|
||||||
|
//modify transferData where transferData.Id == e.EditModel.Id
|
||||||
|
}
|
||||||
|
//get transfer from TransferData by Id
|
||||||
|
|
||||||
|
// foreach (var transferToModify in (List<Transfer>)TransferData)
|
||||||
|
// {
|
||||||
|
// myModel = (Transfer)e.EditModel;
|
||||||
|
|
||||||
|
// if (transferToModify.Id == myModel.Id)
|
||||||
|
// {
|
||||||
|
// //transferToModify.Driver = myModel.Driver;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
await UpdateDataAsync();
|
||||||
|
}
|
||||||
|
async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e)
|
||||||
|
{
|
||||||
|
//await NwindDataService.RemoveEmployeeAsync((EditableEmployee)e.DataItem);
|
||||||
|
//remove orderData from orderData array
|
||||||
|
logToBrowserConsole.LogToBC("orderData deleted");
|
||||||
|
//await UpdateDataAsync();
|
||||||
|
}
|
||||||
|
async Task UpdateDataAsync()
|
||||||
|
{
|
||||||
|
//refresh grid
|
||||||
|
UserData = await userDataService.GetUsersWithDetailsAsync();
|
||||||
|
logToBrowserConsole.LogToBC("orderData grid refreshed");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
UserData = (await userDataService.GetUsersWithDetailsAsync())?.OrderBy(x => x.Profile?.Name).ToList();
|
||||||
|
base.OnInitialized();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ColumnChooserButton_Click()
|
||||||
|
{
|
||||||
|
Grid?.ShowColumnChooser();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAfterRender(bool firstRender)
|
||||||
|
{
|
||||||
|
if (firstRender)
|
||||||
|
{
|
||||||
|
Grid?.ExpandDetailRow(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void AutoCollapseDetailRow_Changed(bool newValue)
|
||||||
|
{
|
||||||
|
AutoCollapseDetailRow = newValue;
|
||||||
|
if (newValue)
|
||||||
|
{
|
||||||
|
Grid?.BeginUpdate();
|
||||||
|
Grid?.CollapseAllDetailRows();
|
||||||
|
Grid?.ExpandDetailRow(0);
|
||||||
|
Grid?.EndUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,121 @@
|
||||||
|
@using TIAM.Entities.Products
|
||||||
|
@using TIAM.Entities.Transfers
|
||||||
|
@using TIAM.Entities.Drivers
|
||||||
|
@using TIAM.Entities.Users
|
||||||
|
@using TIAM.Models.Dtos.Users
|
||||||
|
@using TIAMWebApp.Shared.Application.Interfaces
|
||||||
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
|
@inject IUserDataService NwindDataService
|
||||||
|
@inject IServiceProviderDataService serviceProviderDataService
|
||||||
|
@inject LogToBrowserConsole logToBrowserConsole
|
||||||
|
|
||||||
|
<div class="mb-2">
|
||||||
|
UserProductMapping
|
||||||
|
</div>
|
||||||
|
<DxGrid Data="DetailGridData"
|
||||||
|
PageSize="5"
|
||||||
|
AutoExpandAllGroupRows="true"
|
||||||
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||||
|
KeyFieldName="Id"
|
||||||
|
ValidationEnabled="false"
|
||||||
|
CustomizeEditModel="CustomizeEditModel"
|
||||||
|
EditModelSaving="EditModelSaving"
|
||||||
|
DataItemDeleting="DataItemDeleting"
|
||||||
|
EditMode="GridEditMode.EditForm"
|
||||||
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
ShowFilterRow="true">
|
||||||
|
<Columns>
|
||||||
|
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
|
<DxGridDataColumn FieldName="Id" GroupIndex="0" />
|
||||||
|
<DxGridDataColumn FieldName="UserId" />
|
||||||
|
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
||||||
|
<DxGridDataColumn FieldName="Permissions" />
|
||||||
|
</Columns>
|
||||||
|
<EditFormTemplate Context="EditFormContext">
|
||||||
|
@{
|
||||||
|
var transfer2 = (UserProductMapping)EditFormContext.EditModel;
|
||||||
|
}
|
||||||
|
<DxFormLayout CssClass="w-100">
|
||||||
|
<DxFormLayoutItem Caption="UserId" ColSpanMd="4">
|
||||||
|
@EditFormContext.GetEditor("UserId")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption="Product:" ColSpanMd="4">
|
||||||
|
<DxComboBox Data="@AvailableProducts" TextFieldName="Name" @bind-Value="((UserProductMapping)EditFormContext.EditModel).ProductId" />
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption="Permissions" ColSpanMd="4">
|
||||||
|
@EditFormContext.GetEditor("Permissions")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</DxFormLayout>
|
||||||
|
</EditFormTemplate>
|
||||||
|
|
||||||
|
</DxGrid>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter]
|
||||||
|
public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
[Parameter]
|
||||||
|
public UserModelDtoDetail Customer { get; set; }
|
||||||
|
|
||||||
|
List<UserProductMapping> DetailGridData;
|
||||||
|
|
||||||
|
List<Product> AvailableProducts;
|
||||||
|
|
||||||
|
public UserModelDtoDetail UserInfo;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
|
||||||
|
//get userproductmappings by customer id
|
||||||
|
if (Customer.UserProductMappings == null)
|
||||||
|
DetailGridData = new List<UserProductMapping>();
|
||||||
|
else
|
||||||
|
DetailGridData = Customer.UserProductMappings;
|
||||||
|
|
||||||
|
AvailableProducts = await serviceProviderDataService.GetAllProductsAsync();
|
||||||
|
logToBrowserConsole.LogToBC($"DetailGridData: {DetailGridData.Count}");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.IsNew)
|
||||||
|
{
|
||||||
|
UserProductMapping newProductMapping = new UserProductMapping();
|
||||||
|
newProductMapping.ProductId = Guid.NewGuid();
|
||||||
|
newProductMapping.UserId = Customer.Id;
|
||||||
|
newProductMapping.Permissions = 1;
|
||||||
|
|
||||||
|
e.EditModel = newProductMapping;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task EditModelSaving(GridEditModelSavingEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.IsNew)
|
||||||
|
//add new orderData to orderData array
|
||||||
|
logToBrowserConsole.LogToBC("New orderData added");
|
||||||
|
//await NwindDataService.InsertEmployeeAsync((EditableEmployee)e.EditModel);
|
||||||
|
else
|
||||||
|
logToBrowserConsole.LogToBC("orderData updated");
|
||||||
|
|
||||||
|
//await NwindDataService.UpdateEmployeeAsync((EditableEmployee)e.DataItem, (EditableEmployee)e.EditModel);
|
||||||
|
|
||||||
|
await UpdateDataAsync();
|
||||||
|
}
|
||||||
|
async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
|
||||||
|
{
|
||||||
|
//await NwindDataService.RemoveEmployeeAsync((EditableEmployee)e.DataItem);
|
||||||
|
//remove orderData from orderData array
|
||||||
|
logToBrowserConsole.LogToBC("orderData deleted");
|
||||||
|
//await UpdateDataAsync();
|
||||||
|
}
|
||||||
|
async Task UpdateDataAsync()
|
||||||
|
{
|
||||||
|
//DataSource = await NwindDataService.GetEmployeesEditableAsync();
|
||||||
|
//refresh grid
|
||||||
|
logToBrowserConsole.LogToBC("orderData grid refreshed");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -66,6 +66,11 @@
|
||||||
Transfers
|
Transfers
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="nav-item px-3">
|
||||||
|
<NavLink class="nav-link" href="user/users">
|
||||||
|
Users
|
||||||
|
</NavLink>
|
||||||
|
</div>
|
||||||
<div class="nav-item px-3">
|
<div class="nav-item px-3">
|
||||||
<NavLink class="nav-link" href="user/destinations">
|
<NavLink class="nav-link" href="user/destinations">
|
||||||
Destinations
|
Destinations
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,23 @@ select {
|
||||||
background-color: #f7279f !important;
|
background-color: #f7279f !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg-important {
|
||||||
|
background-color: #fb9e9e !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-attention {
|
||||||
|
background-color: #fbf89e !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-finished {
|
||||||
|
background-color: #9efba1 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-cancel {
|
||||||
|
background-color: #999 !important;
|
||||||
|
color: #666 !important;
|
||||||
|
}
|
||||||
|
|
||||||
.bg-gradient {
|
.bg-gradient {
|
||||||
|
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
|
|
|
||||||
|
|
@ -156,9 +156,22 @@ namespace TIAMWebApp.Client.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<IEnumerable<UserModelDto>?> GetUsersAsync()
|
public async Task<List<UserModelDto>?> GetUsersAsync()
|
||||||
{
|
{
|
||||||
return await http.GetFromJsonAsync<IEnumerable<UserModelDto>>(APIUrls.GetUsers);
|
return await http.GetFromJsonAsync<List<UserModelDto>>(APIUrls.GetUsers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<UserModelDtoDetail>?> GetUsersWithDetailsAsync()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetUsersWithDetails}";
|
||||||
|
logToBrowserConsole.LogToBC("GetUserByEmailAsync url: " + url + "!");
|
||||||
|
var response = await http.GetFromJsonAsync<List<UserModelDtoDetail>>(APIUrls.GetUsersWithDetails);
|
||||||
|
//var result = await response.Content.ReadAsStringAsync();
|
||||||
|
//var user = JsonConvert.DeserializeObject<UserModelDto>(result);
|
||||||
|
return response;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UserModelDto?> GetUserByEmailAsync(string email)
|
public async Task<UserModelDto?> GetUserByEmailAsync(string email)
|
||||||
|
|
|
||||||
|
|
@ -242,5 +242,25 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpGet]
|
||||||
|
[Route(APIUrls.GetAllProductsRouteName)]
|
||||||
|
[Tags("In-Progress", "Product")]
|
||||||
|
public async Task<string> GetAllProducts()
|
||||||
|
{
|
||||||
|
Console.WriteLine("GetAllProducts called");
|
||||||
|
|
||||||
|
var products = _adminDal.GetProductsJson();
|
||||||
|
if (products != null)
|
||||||
|
{
|
||||||
|
return products;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -321,5 +321,15 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost]
|
||||||
|
[Route(APIUrls.UpdateTransferRouteName)]
|
||||||
|
public async Task<bool> UpdateTransfer(Transfer transferToModify)
|
||||||
|
{
|
||||||
|
Console.WriteLine("UpdateTransfer called!");
|
||||||
|
return await _adminDal.UpdateTransferAsync(transferToModify);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -310,6 +310,48 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost]
|
||||||
|
[Route(APIUrls.UpdateUser)]
|
||||||
|
public async Task<IActionResult> UpdateUser([FromBody] JsonElement SerializedUserModel)
|
||||||
|
{
|
||||||
|
Console.WriteLine("UpdateUser called");
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(SerializedUserModel.GetRawText()))
|
||||||
|
{
|
||||||
|
return BadRequest("SerializedUserModel is required");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var user = JObject.Parse(SerializedUserModel.GetRawText()).ToObject<UserModelDtoDetail>();
|
||||||
|
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
|
var userId = user.Id;
|
||||||
|
var email = user.Email;
|
||||||
|
var phoneNumber = user.PhoneNumber;
|
||||||
|
var password = user.Password;
|
||||||
|
|
||||||
|
if (email is null || phoneNumber is null || password is null)
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid request");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine($"User to be updated: {userId}");
|
||||||
|
Console.WriteLine($"User to be updated: {email}");
|
||||||
|
Console.WriteLine($"User to be updated: {phoneNumber}");
|
||||||
|
Console.WriteLine($"User to be updated: {password}");
|
||||||
|
|
||||||
|
await _userDal.UpdateUserAsync(new User(userId, email, phoneNumber, password));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok("yes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route(APIUrls.CreateGuestUserRouteName)]
|
[Route(APIUrls.CreateGuestUserRouteName)]
|
||||||
|
|
@ -385,6 +427,17 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
return _userDal.GetAllUsersModelDtoAsync();
|
return _userDal.GetAllUsersModelDtoAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpGet]
|
||||||
|
[Route(APIUrls.GetUsersWithDetailsRouteName)]
|
||||||
|
public Task<List<UserModelDtoDetail>> GetUsersWithDetails()
|
||||||
|
{
|
||||||
|
Console.WriteLine("GetUsersWithDetails called");
|
||||||
|
//var users = await _userDal.Ctx.Users.ToListAsync();//.GetUsersAsync();
|
||||||
|
//return users;
|
||||||
|
return _userDal.GetAllUsersModelDtoDetailAsync();
|
||||||
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("GetUserByEmail")]
|
[Route("GetUserByEmail")]
|
||||||
|
|
|
||||||
|
|
@ -54,5 +54,7 @@ namespace TIAMWebApp.Shared.Application.Interfaces
|
||||||
|
|
||||||
public Task<IEnumerable<Product>> GetProductsForServiceProviderAsync(Guid serviceProviderId);
|
public Task<IEnumerable<Product>> GetProductsForServiceProviderAsync(Guid serviceProviderId);
|
||||||
|
|
||||||
|
public Task<List<Product>> GetAllProductsAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,6 @@ namespace TIAMWebApp.Shared.Application.Interfaces
|
||||||
|
|
||||||
Task<Transfer?> GetTransferByIdAsync(Guid id);
|
Task<Transfer?> GetTransferByIdAsync(Guid id);
|
||||||
Task<List<Transfer>> GetTransfersAsync();
|
Task<List<Transfer>> GetTransfersAsync();
|
||||||
Task<Transfer> UpdateTransferAsync(TransferWizardModel model);
|
Task<bool> UpdateTransferAsync(Transfer model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@ namespace TIAMWebApp.Shared.Application.Interfaces
|
||||||
|
|
||||||
//public Task<Dictionary<int, string>> GetUserRolesAsync(UserModel userModel);
|
//public Task<Dictionary<int, string>> GetUserRolesAsync(UserModel userModel);
|
||||||
|
|
||||||
public Task<IEnumerable<UserModelDto>?> GetUsersAsync();
|
public Task<List<UserModelDto>?> GetUsersAsync();
|
||||||
|
|
||||||
|
public Task<List<UserModelDtoDetail>?> GetUsersWithDetailsAsync();
|
||||||
|
|
||||||
public Task<UserModelDto?> GetUserByIdAsync(Guid id);
|
public Task<UserModelDto?> GetUserByIdAsync(Guid id);
|
||||||
public Task<UserModelDtoDetail?> GetUserDetailByIdAsync(Guid id);
|
public Task<UserModelDtoDetail?> GetUserDetailByIdAsync(Guid id);
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@ namespace TIAMWebApp.Shared.Application.Models
|
||||||
public const string GetUsersRouteName = "GetUsers";
|
public const string GetUsersRouteName = "GetUsers";
|
||||||
public const string GetUsers = UserAPI + GetUsersRouteName;
|
public const string GetUsers = UserAPI + GetUsersRouteName;
|
||||||
|
|
||||||
|
public const string GetUsersWithDetailsRouteName = "GetUsersWithDetails/";
|
||||||
|
public const string GetUsersWithDetails = UserAPI + GetUsersWithDetailsRouteName;
|
||||||
|
|
||||||
public const string AuthenticateUserRouteName = "AuthenticateUser";
|
public const string AuthenticateUserRouteName = "AuthenticateUser";
|
||||||
public const string AuthenticateUser = UserAPI + AuthenticateUserRouteName;
|
public const string AuthenticateUser = UserAPI + AuthenticateUserRouteName;
|
||||||
|
|
||||||
|
|
@ -40,6 +43,9 @@ namespace TIAMWebApp.Shared.Application.Models
|
||||||
public const string CreateGuestUserRouteName = "CreateGuestUser";
|
public const string CreateGuestUserRouteName = "CreateGuestUser";
|
||||||
public const string CreateGuestUser = UserAPI + CreateGuestUserRouteName;
|
public const string CreateGuestUser = UserAPI + CreateGuestUserRouteName;
|
||||||
|
|
||||||
|
public const string UpdateUserRouteName = "UpdateUser";
|
||||||
|
public const string UpdateUser = UserAPI + UpdateUserRouteName;
|
||||||
|
|
||||||
public const string RefreshTokenRouteName = "RefreshToken";
|
public const string RefreshTokenRouteName = "RefreshToken";
|
||||||
public const string RefreshToken = UserAPI + RefreshTokenRouteName;
|
public const string RefreshToken = UserAPI + RefreshTokenRouteName;
|
||||||
|
|
||||||
|
|
@ -79,7 +85,10 @@ namespace TIAMWebApp.Shared.Application.Models
|
||||||
public const string CreateTransfersRouteName = "CreateTransfers";
|
public const string CreateTransfersRouteName = "CreateTransfers";
|
||||||
public const string CreateTransfers = TransferDataAPI+CreateTransfersRouteName;
|
public const string CreateTransfers = TransferDataAPI+CreateTransfersRouteName;
|
||||||
|
|
||||||
public const string UpdateTransferDestinationRouteName = "UpdateTransfer";
|
public const string UpdateTransferRouteName = "UpdateTransfer";
|
||||||
|
public const string UpdateTransfer = TransferDataAPI+UpdateTransferRouteName;
|
||||||
|
|
||||||
|
public const string UpdateTransferDestinationRouteName = "UpdateTransferDestintion";
|
||||||
public const string UpdateTransferDestination = TransferDataAPI + UpdateTransferDestinationRouteName;
|
public const string UpdateTransferDestination = TransferDataAPI + UpdateTransferDestinationRouteName;
|
||||||
|
|
||||||
//serviceprovider
|
//serviceprovider
|
||||||
|
|
@ -98,6 +107,9 @@ namespace TIAMWebApp.Shared.Application.Models
|
||||||
public const string AddProductRouteName = "AddProduct";
|
public const string AddProductRouteName = "AddProduct";
|
||||||
public const string AddProductRouteUrl = ServiceProviderAPI + AddProductRouteName;
|
public const string AddProductRouteUrl = ServiceProviderAPI + AddProductRouteName;
|
||||||
|
|
||||||
|
public const string GetAllProductsRouteName = "GetAllProducts/";
|
||||||
|
public const string GetAllProducts = ServiceProviderAPI + GetAllProductsRouteName;
|
||||||
|
|
||||||
public const string GetProductsByServiceProviderIdRouteName = "GetProductsByServiceProviderId";
|
public const string GetProductsByServiceProviderIdRouteName = "GetProductsByServiceProviderId";
|
||||||
public const string GetProductsByServiceProviderId = ServiceProviderAPI + GetProductsByServiceProviderIdRouteName;
|
public const string GetProductsByServiceProviderId = ServiceProviderAPI + GetProductsByServiceProviderIdRouteName;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide
|
||||||
public const string ApiBaseUrl = "https://localhost:7116";
|
public const string ApiBaseUrl = "https://localhost:7116";
|
||||||
//public const string BaseUrl = "https://touriam.mangoweb.hu";
|
//public const string BaseUrl = "https://touriam.mangoweb.hu";
|
||||||
//public const string ApiBaseUrl = "https://touriam.mangoweb.hu";
|
//public const string ApiBaseUrl = "https://touriam.mangoweb.hu";
|
||||||
|
//public const string BaseUrl = "https://test.touriam.com";
|
||||||
|
//public const string ApiBaseUrl = "https://test.touriam.com";
|
||||||
public const bool DarkMode = false;
|
public const bool DarkMode = false;
|
||||||
public static string Locale { get; set; }
|
public static string Locale { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||||
FromAddress = obj.PickupAddress,
|
FromAddress = obj.PickupAddress,
|
||||||
Appointment = obj.TripDate,
|
Appointment = obj.TripDate,
|
||||||
PassengerCount = Convert.ToByte(obj.NumberOfPassengers),
|
PassengerCount = Convert.ToByte(obj.NumberOfPassengers),
|
||||||
//TODO: ContactName = obj.FullName,
|
ContactName = obj.FullName,
|
||||||
ContactPhone = obj.PhoneNumber,
|
ContactPhone = obj.PhoneNumber,
|
||||||
ContactEmail = obj.EmailAddress,
|
ContactEmail = obj.EmailAddress,
|
||||||
Price = obj.Price,
|
Price = obj.Price,
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ using TIAM.Entities.ServiceProviders;
|
||||||
using TIAM.Entities.Users;
|
using TIAM.Entities.Users;
|
||||||
using TIAMWebApp.Shared.Application.Interfaces;
|
using TIAMWebApp.Shared.Application.Interfaces;
|
||||||
using TIAMWebApp.Shared.Application.Models;
|
using TIAMWebApp.Shared.Application.Models;
|
||||||
|
using TIAMWebApp.Shared.Application.Models.ClientSide;
|
||||||
using TIAMWebApp.Shared.Application.Utility;
|
using TIAMWebApp.Shared.Application.Utility;
|
||||||
|
|
||||||
namespace TIAMWebApp.Shared.Application.Services
|
namespace TIAMWebApp.Shared.Application.Services
|
||||||
|
|
@ -153,5 +154,19 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<Product>> GetAllProductsAsync()
|
||||||
|
{
|
||||||
|
var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetAllProducts}";
|
||||||
|
var response = await http.GetFromJsonAsync(url, typeof (List<Product>));
|
||||||
|
if (response != null)
|
||||||
|
{
|
||||||
|
return (List<Product>)response;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -179,9 +179,25 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<Transfer> UpdateTransferAsync(TransferWizardModel model)
|
public async Task<bool> UpdateTransferAsync(Transfer model)
|
||||||
{
|
{
|
||||||
return null;
|
var url = $"{Setting.ApiBaseUrl}/{APIUrls.UpdateTransfer}";
|
||||||
|
var response = await http.PostAsJsonAsync(url, model);
|
||||||
|
|
||||||
|
//var result = new WizardProcessorResult();
|
||||||
|
|
||||||
|
//if (response.IsSuccessStatusCode)
|
||||||
|
//{
|
||||||
|
// result.IsSucces = true;
|
||||||
|
// result.ResultJson = await response.Content.ReadAsStringAsync();
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var result = (bool)(await response.Content.ReadFromJsonAsync(typeof(bool)))!;
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue