merge
This commit is contained in:
commit
a93ec8258f
|
|
@ -188,7 +188,7 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
#endregion Address
|
#endregion Address
|
||||||
|
|
||||||
#region Profile
|
#region Profile
|
||||||
public Task<Profile?> GetProfileByIdAsync(Guid addressId) => SessionAsync(ctx => ctx.GetProfileById(addressId));
|
public Task<Profile?> GetProfileByIdAsync(Guid profileId) => SessionAsync(ctx => ctx.GetProfileById(profileId));
|
||||||
public Task<bool> UpdateProfileAsync(Profile profile) => TransactionAsync(ctx => ctx.UpdateProfile(profile));
|
public Task<bool> UpdateProfileAsync(Profile profile) => TransactionAsync(ctx => ctx.UpdateProfile(profile));
|
||||||
//public Task<bool> AddProfileAsync(Profile profile) => TransactionAsync(ctx => ctx.AddProfile(profile)); //Nem Add-olunk önmagában Profile-t! - J.
|
//public Task<bool> AddProfileAsync(Profile profile) => TransactionAsync(ctx => ctx.AddProfile(profile)); //Nem Add-olunk önmagában Profile-t! - J.
|
||||||
//public Task<bool> RemoveProfileAsync(Guid profileId) => TransactionAsync(ctx => ctx.RemoveProfile(profileId)); //Nem törlünk Profile-t! - J.
|
//public Task<bool> RemoveProfileAsync(Guid profileId) => TransactionAsync(ctx => ctx.RemoveProfile(profileId)); //Nem törlünk Profile-t! - J.
|
||||||
|
|
@ -234,6 +234,7 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
|
|
||||||
|
|
||||||
public virtual Task<Company?> GetServiceProviderByIdAsync(Guid id) => SessionAsync(ctx => ctx.GetServiceProviderById(id));
|
public virtual Task<Company?> GetServiceProviderByIdAsync(Guid id) => SessionAsync(ctx => ctx.GetServiceProviderById(id));
|
||||||
|
public virtual Task<List<Company>> GetServiceProvidersByOwnerIdAsync(Guid id) => SessionAsync(ctx => ctx.GetServiceProvidersByOwnerId(id));
|
||||||
|
|
||||||
//public Task<UserProductMapping> CreateUserProductMappingAsync(UserProductMapping userProductMapping)
|
//public Task<UserProductMapping> CreateUserProductMappingAsync(UserProductMapping userProductMapping)
|
||||||
//{
|
//{
|
||||||
|
|
@ -253,13 +254,6 @@ namespace TIAM.Database.DataLayers.Admins
|
||||||
public Task<bool> RemoveCompanyAsync(Company company) => TransactionAsync(ctx => ctx.RemoveServiceProvider(company));
|
public Task<bool> RemoveCompanyAsync(Company company) => TransactionAsync(ctx => ctx.RemoveServiceProvider(company));
|
||||||
|
|
||||||
|
|
||||||
//17. (IServiceProviderDataService) get service provider by ownerId
|
|
||||||
public Task<List<Company>> GetServiceProvidersByOwnerIdAsync()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region PermissionTypes
|
#region PermissionTypes
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ public class SignalRTags : AcSignalRTags
|
||||||
//public const int AddAddress = 32;
|
//public const int AddAddress = 32;
|
||||||
//public const int RemoveAddress = 33;
|
//public const int RemoveAddress = 33;
|
||||||
|
|
||||||
public const int GetProfile = 35;
|
public const int GetProfileById = 35;
|
||||||
//public const int GetProfiles = 36;
|
//public const int GetProfiles = 36;
|
||||||
public const int GetProfilesByContextId = 37;
|
//public const int GetProfileByContextId = 37;
|
||||||
public const int UpdateProfile = 38;
|
public const int UpdateProfile = 38;
|
||||||
|
|
||||||
//public const int AddAddress = 39;
|
//public const int AddAddress = 39;
|
||||||
|
|
@ -57,4 +57,11 @@ public class SignalRTags : AcSignalRTags
|
||||||
|
|
||||||
public const int GetMessagesByContextId = 60;
|
public const int GetMessagesByContextId = 60;
|
||||||
public const int GetAllMessages = 61;
|
public const int GetAllMessages = 61;
|
||||||
|
|
||||||
|
public const int GetProductById = 70;
|
||||||
|
public const int GetProductsByOwnerId = 71; //for now until we can send multiple parameters
|
||||||
|
public const int GetProductsByContextId = 72;
|
||||||
|
public const int UpdateProduct = 73;
|
||||||
|
public const int AddProduct = 74;
|
||||||
|
public const int RemoveProduct = 75;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,22 @@
|
||||||
@page "/mytransfers/{transferId:guid}"
|
@page "/mytransfers/{transferId:guid}"
|
||||||
@using TIAM.Entities.Transfers
|
@using TIAM.Entities.Transfers
|
||||||
|
@using TIAM.Resources
|
||||||
@using TIAMWebApp.Shared.Application.Interfaces
|
@using TIAMWebApp.Shared.Application.Interfaces
|
||||||
@using AyCode.Services.Loggers
|
@using AyCode.Services.Loggers
|
||||||
@using TIAM.Core.Enums
|
@using TIAM.Core.Enums
|
||||||
|
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||||
@using TIAMWebApp.Shared.Application.Services
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
@using TIAMWebApp.Shared.Application.Utility
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
|
@using TIAMSharedUI.Pages.User.SysAdmins
|
||||||
|
@using TIAMSharedUI.Pages.Components
|
||||||
@inject HttpClient Http
|
@inject HttpClient Http
|
||||||
@inject NavigationManager navManager
|
@inject NavigationManager navManager
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
@inject ITransferDataService transferDataService
|
@inject ITransferDataService transferDataService
|
||||||
@inject SumupService SumUpService
|
@inject SumupService SumUpService
|
||||||
@inject NavigationManager navigationManager
|
@inject NavigationManager navigationManager
|
||||||
|
@inject IStringLocalizer<TIAMResources> localizer
|
||||||
|
@inject IWizardProcessor wizardProcessor
|
||||||
|
|
||||||
<PageTitle>Transfer details</PageTitle>
|
<PageTitle>Transfer details</PageTitle>
|
||||||
<div class="text-center m-5">
|
<div class="text-center m-5">
|
||||||
|
|
@ -18,6 +24,32 @@
|
||||||
<h2 style="font-size:small">Manage your transfer here</h2>
|
<h2 style="font-size:small">Manage your transfer here</h2>
|
||||||
</div>
|
</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="@localizer.GetString("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>
|
||||||
|
|
||||||
@if (isLoading)
|
@if (isLoading)
|
||||||
{
|
{
|
||||||
<div class="text-center m-5">
|
<div class="text-center m-5">
|
||||||
|
|
@ -34,6 +66,9 @@ else if (!string.IsNullOrEmpty(errorMessage))
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div class="container mt-4">
|
<div class="container mt-4">
|
||||||
|
<DxTabs>
|
||||||
|
<DxTabPage Text="Details">
|
||||||
|
|
||||||
|
|
||||||
@if (!editMode)
|
@if (!editMode)
|
||||||
{
|
{
|
||||||
|
|
@ -203,6 +238,12 @@ else
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
</DxTabPage>
|
||||||
|
<DxTabPage Text="Messages">
|
||||||
|
<MessageDetailGridComponent ContextId="transferId" IsSenderEmailVisible="false" IsSubjectVisible="false"></MessageDetailGridComponent>
|
||||||
|
<DxButton Click="() => SendMail(transfer)" Text="Send a message" RenderStyle="ButtonRenderStyle.Primary" />
|
||||||
|
</DxTabPage>
|
||||||
|
</DxTabs>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,9 +257,82 @@ else
|
||||||
|
|
||||||
private LoggerClient<EditTransfers> _logger;
|
private LoggerClient<EditTransfers> _logger;
|
||||||
|
|
||||||
|
private MessageWizardModel _messageWizardModel = new();
|
||||||
|
|
||||||
|
private bool _popupVisible;
|
||||||
|
private bool _autoCollapseDetailRow;
|
||||||
|
|
||||||
|
|
||||||
|
public List<string> IgnoreList =
|
||||||
|
[
|
||||||
|
"ReceiverEmailAddress",
|
||||||
|
"ReceiverFullName",
|
||||||
|
"ReceiverId",
|
||||||
|
"SenderEmailAddress",
|
||||||
|
"SenderFullName",
|
||||||
|
"SenderId",
|
||||||
|
"ContextId",
|
||||||
|
];
|
||||||
|
|
||||||
List<string> StatusTypes = new List<string>();
|
List<string> StatusTypes = new List<string>();
|
||||||
private bool editMode = false;
|
private bool editMode = false;
|
||||||
|
|
||||||
|
void SendMail(Transfer item)
|
||||||
|
{
|
||||||
|
_logger.Info($"Sending mail to {item.ContactEmail}, {item.Id}");
|
||||||
|
|
||||||
|
_messageWizardModel.ReceiverId = item.UserId;
|
||||||
|
_messageWizardModel.ContextId = item.Id;
|
||||||
|
_messageWizardModel.SenderEmailAddress = "info@touriam.com";
|
||||||
|
_messageWizardModel.ReceiverEmailAddress = item.ContactEmail;
|
||||||
|
_messageWizardModel.ReceiverFullName = item.FullName;
|
||||||
|
_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 messageModel = result as MessageWizardModel;
|
||||||
|
messageModel.ContextId = _messageWizardModel.ContextId;
|
||||||
|
//messageModel.SenderId = sessionService.User.UserId;
|
||||||
|
|
||||||
|
string FormatEmailContent()
|
||||||
|
{
|
||||||
|
return $@"
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<p>Dear {messageModel.SenderFullName},</p>
|
||||||
|
<p>{messageModel.Content}:</p>
|
||||||
|
<p>Best regards,<br/>Tour I Am team</p>
|
||||||
|
</body>
|
||||||
|
</html>";
|
||||||
|
}
|
||||||
|
|
||||||
|
messageModel.Content = FormatEmailContent();
|
||||||
|
|
||||||
|
_logger.Info(messageModel.Content);
|
||||||
|
var email = await wizardProcessor.ProcessWizardAsync<MessageWizardModel>(result.GetType(), messageModel);
|
||||||
|
|
||||||
|
_logger.Info($"Submitted nested form: {result.GetType().FullName}");
|
||||||
|
}
|
||||||
|
|
||||||
private async Task Pay()
|
private async Task Pay()
|
||||||
{
|
{
|
||||||
if (transfer != null)
|
if (transfer != null)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
@inject IPopulationStructureDataProvider DataProvider
|
@inject IPopulationStructureDataProvider DataProvider
|
||||||
@inject ISupplierService SupplierService
|
@inject ISupplierService SupplierService
|
||||||
@inject IUserDataService UserDataService
|
@inject IUserDataService UserDataService
|
||||||
<PageTitle>Transfer</PageTitle>
|
<PageTitle>HotelAdmin</PageTitle>
|
||||||
|
|
||||||
<div class="text-center m-5">
|
<div class="text-center m-5">
|
||||||
<h1>Dashboard</h1>
|
<h1>Dashboard</h1>
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
|
||||||
<div class="row py-3">
|
@* <div class="row py-3">
|
||||||
<div class=" col-12 col-xl-3">
|
<div class=" col-12 col-xl-3">
|
||||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||||
<div class="card-header py-2 px-4">
|
<div class="card-header py-2 px-4">
|
||||||
|
|
@ -177,7 +177,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div> *@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row py-3">
|
<div class="row py-3">
|
||||||
|
|
||||||
<div class=" col-12 col-xl-3">
|
<div class=" col-12 col-xl-3">
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,23 @@
|
||||||
@page "/user/serviceprovider/{id}"
|
@page "/user/serviceprovider/{id}"
|
||||||
|
@using AyCode.Core
|
||||||
|
@using AyCode.Services.Loggers
|
||||||
|
@using TIAM.Entities.ServiceProviders
|
||||||
|
@using TIAM.Resources
|
||||||
|
@using TIAMSharedUI.Pages.User.SysAdmins
|
||||||
@using TIAMSharedUI.Shared
|
@using TIAMSharedUI.Shared
|
||||||
|
@using TIAMSharedUI.Shared.Components.Grids
|
||||||
|
@using TIAMWebApp.Shared.Application.Interfaces
|
||||||
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
@layout AdminLayout
|
@layout AdminLayout
|
||||||
@inject NavigationManager navigationManager
|
@inject NavigationManager navigationManager
|
||||||
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
|
@inject IStringLocalizer<TIAMResources> localizer
|
||||||
|
@inject IServiceProviderDataService serviceProviderDataService
|
||||||
|
@inject IUserDataService userDataService
|
||||||
|
@inject ISessionService sessionService
|
||||||
|
@inject AdminSignalRClient AdminSignalRClient;
|
||||||
|
<PageTitle>Admin - Companies</PageTitle>
|
||||||
|
|
||||||
<div class="text-center m-5">
|
<div class="text-center m-5">
|
||||||
<h1>Company: @Id</h1>
|
<h1>Company: @Id</h1>
|
||||||
|
|
@ -10,18 +26,78 @@
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="w-100 ch-220">
|
<div class="w-100 ch-220">
|
||||||
|
<CompanyGrid @ref="_gridCompany"
|
||||||
|
ContextId="@CompanyId"
|
||||||
|
Logger="_logger"
|
||||||
|
SignalRClient="AdminSignalRClient"
|
||||||
|
|
||||||
|
AutoCollapseDetailRow="false"
|
||||||
|
KeyboardNavigationEnabled="true"
|
||||||
|
CustomizeElement="Grid_CustomizeElement"
|
||||||
|
CustomizeEditModel="Grid_CustomizeEditModel"
|
||||||
|
EditMode="GridEditMode.EditForm"
|
||||||
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
ShowFilterRow="true"
|
||||||
|
KeyFieldName="Id">
|
||||||
|
|
||||||
|
<Columns>
|
||||||
|
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
|
<DxGridDataColumn FieldName="Id" SortIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
||||||
|
<DxGridDataColumn FieldName="Name" />
|
||||||
|
|
||||||
|
<DxGridDataColumn FieldName="AffiliateId" DisplayFormat="N" />
|
||||||
|
<DxGridDataColumn FieldName="CommissionPercent" />
|
||||||
|
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" />
|
||||||
|
<DxGridDataColumn FieldName="Modified" DisplayFormat="g" Width="140" />
|
||||||
|
@* <DxGridDataColumn FieldName="ContactEmail">
|
||||||
|
|
||||||
|
</DxGridDataColumn> *@
|
||||||
|
|
||||||
|
</Columns>
|
||||||
|
@* <DetailRowTemplate>
|
||||||
|
<CompaniesNestedUserProductMapping CurrentCompany="(TIAM.Entities.ServiceProviders.Company)context.DataItem" KeyboardNavigationEnabled="true" />
|
||||||
|
</DetailRowTemplate> *@
|
||||||
|
<DetailRowTemplate>
|
||||||
<DxTabs>
|
<DxTabs>
|
||||||
|
|
||||||
<DxTabPage Text="Profile">
|
<DxTabPage Text="Profile">
|
||||||
<ProfileComponent></ProfileComponent>
|
<ProfileGridComponent ProfileId="((Company)context.DataItem).ProfileId" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Permissions">
|
<DxTabPage Text="Products">
|
||||||
<PermissionsComponent></PermissionsComponent>
|
<ProductDetailGridComponent ContextId="((Company)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Services">
|
<DxTabPage Text="Address">
|
||||||
<Products></Products>
|
<AddressDetailGridComponent ParentData="((Company)context.DataItem).Profile" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
|
</DxTabs>
|
||||||
|
</DetailRowTemplate>
|
||||||
|
<EditFormTemplate Context="EditFormContext">
|
||||||
|
@{
|
||||||
|
var transfer2 = (Company)EditFormContext.EditModel;
|
||||||
|
}
|
||||||
|
<DxFormLayout CssClass="w-100">
|
||||||
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.LastName) ColSpanMd="6" ColSpanLg="6" ColSpanSm="12">
|
||||||
|
@EditFormContext.GetEditor("Name")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.LastName) ColSpanMd="6" ColSpanLg="6" ColSpanSm="12">
|
||||||
|
@EditFormContext.GetEditor("CommissionPercent")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
</DxFormLayout>
|
||||||
|
</EditFormTemplate>
|
||||||
|
</CompanyGrid>
|
||||||
|
|
||||||
|
<DxTabs>
|
||||||
|
@* <DxTabPage Text="Profile">
|
||||||
|
<ProfileComponent></ProfileComponent>
|
||||||
|
</DxTabPage> *@
|
||||||
|
@* <DxTabPage Text="Profile 2">
|
||||||
|
<ProfileGridComponent ProfileId="((Company)context.DataItem).ProfileId" KeyboardNavigationEnabled="true" />
|
||||||
|
</DxTabPage> *@
|
||||||
|
<DxTabPage Text="Products">
|
||||||
|
<ProductDetailGridComponent ContextId="@CompanyId" KeyboardNavigationEnabled="true" />
|
||||||
|
</DxTabPage>
|
||||||
|
@* <DxTabPage Text="Address">
|
||||||
|
<AddressDetailGridComponent ParentData="((Company)context.DataItem).Profile" KeyboardNavigationEnabled="true" />
|
||||||
|
</DxTabPage> *@
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -32,12 +108,53 @@
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
private Guid CompanyId;
|
||||||
|
|
||||||
|
private CompanyGrid _gridCompany;
|
||||||
|
|
||||||
public string ProfileUrl => $"/images/serviceprovider/{Id}.png";
|
public string ProfileUrl => $"/images/serviceprovider/{Id}.png";
|
||||||
|
|
||||||
|
private LoggerClient<ServiceProvider> _logger;
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
base.OnInitialized();
|
base.OnInitialized();
|
||||||
|
_logger = new LoggerClient<ServiceProvider>(LogWriters.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnParametersSet()
|
||||||
|
{
|
||||||
if (string.IsNullOrEmpty(Id))
|
if (string.IsNullOrEmpty(Id))
|
||||||
|
{
|
||||||
navigationManager.NavigateTo("/user/properties");
|
navigationManager.NavigateTo("/user/properties");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CompanyId = Guid.Parse(Id);
|
||||||
|
}
|
||||||
|
base.OnParametersSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Grid_CustomizeElement(GridCustomizeElementEventArgs e)
|
||||||
|
{
|
||||||
|
//TODO mark non active partners
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
{
|
||||||
|
if (!e.IsNew)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var companyEditModel = (Company)e.EditModel; //TODO not valid cast
|
||||||
|
companyEditModel.Id = Guid.NewGuid();
|
||||||
|
companyEditModel.AffiliateId = Guid.NewGuid();
|
||||||
|
companyEditModel.Name = "Company name";
|
||||||
|
companyEditModel.OwnerId = Guid.Empty;
|
||||||
|
companyEditModel.ProfileId = Guid.NewGuid();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
</BodyContentTemplate>
|
</BodyContentTemplate>
|
||||||
<FooterContentTemplate>
|
<FooterContentTemplate>
|
||||||
<DxButton CssClass="popup-button my-1 ms-2" RenderStyle="ButtonRenderStyle.Primary" Text="OK" Click="@(() => _setOwnerPopupVisible = false)" />
|
<DxButton CssClass="popup-button my-1 ms-2" RenderStyle="ButtonRenderStyle.Primary" Text="OK" Click="@SetOwner" />
|
||||||
@* <DxButton CssClass="popup-button my-1 ms-2" RenderStyle="ButtonRenderStyle.Secondary" Text="Cancel" Click="@(() => SetOwnerPopupVisible = false)" /> *@
|
@* <DxButton CssClass="popup-button my-1 ms-2" RenderStyle="ButtonRenderStyle.Secondary" Text="Cancel" Click="@(() => SetOwnerPopupVisible = false)" /> *@
|
||||||
</FooterContentTemplate>
|
</FooterContentTemplate>
|
||||||
</DxPopup>
|
</DxPopup>
|
||||||
|
|
@ -125,7 +125,17 @@
|
||||||
<CompaniesNestedUserProductMapping CurrentCompany="(TIAM.Entities.ServiceProviders.Company)context.DataItem" KeyboardNavigationEnabled="true" />
|
<CompaniesNestedUserProductMapping CurrentCompany="(TIAM.Entities.ServiceProviders.Company)context.DataItem" KeyboardNavigationEnabled="true" />
|
||||||
</DetailRowTemplate> *@
|
</DetailRowTemplate> *@
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
<AddressDetailGridComponent ParentData="((Company)context.DataItem).Profile" OnAddressChanged="AddressChanged" KeyboardNavigationEnabled="true" />
|
<DxTabs>
|
||||||
|
<DxTabPage Text="Profile">
|
||||||
|
<ProfileGridComponent ProfileId="((Company)context.DataItem).ProfileId" KeyboardNavigationEnabled="true" />
|
||||||
|
</DxTabPage>
|
||||||
|
<DxTabPage Text="Products">
|
||||||
|
<ProductDetailGridComponent ContextId="((Company)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
||||||
|
</DxTabPage>
|
||||||
|
<DxTabPage Text="Address">
|
||||||
|
<AddressDetailGridComponent ParentData="((Company)context.DataItem).Profile" KeyboardNavigationEnabled="true" />
|
||||||
|
</DxTabPage>
|
||||||
|
</DxTabs>
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
<EditFormTemplate Context="EditFormContext">
|
<EditFormTemplate Context="EditFormContext">
|
||||||
@{
|
@{
|
||||||
|
|
@ -163,6 +173,8 @@
|
||||||
private CompanyGrid _gridCompany;
|
private CompanyGrid _gridCompany;
|
||||||
private bool _autoCollapseDetailRow;
|
private bool _autoCollapseDetailRow;
|
||||||
|
|
||||||
|
private Company CompanyToSetOwner = null;
|
||||||
|
|
||||||
public List<string> IgnoreList =
|
public List<string> IgnoreList =
|
||||||
[
|
[
|
||||||
"ReceiverEmailAddress",
|
"ReceiverEmailAddress",
|
||||||
|
|
@ -181,14 +193,6 @@
|
||||||
DateTime StartDate { get; set; } = DateTime.Today;
|
DateTime StartDate { get; set; } = DateTime.Today;
|
||||||
DxSchedulerDataStorage _dataStorage = new();
|
DxSchedulerDataStorage _dataStorage = new();
|
||||||
|
|
||||||
private void AddressChanged(Address address)
|
|
||||||
{
|
|
||||||
_logger.Debug($"DataItemSaving; addressId: {address?.Id}");
|
|
||||||
|
|
||||||
// var company = _gridCompany.DataSource!.FirstOrDefault(x => x.Profile.AddressId == address.Id);
|
|
||||||
// company.Profile.Address = address;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SendMail(Company item)
|
void SendMail(Company item)
|
||||||
{
|
{
|
||||||
_logger.Info($"Sending mail to {item.OwnerId}, {item.Id}");
|
_logger.Info($"Sending mail to {item.OwnerId}, {item.Id}");
|
||||||
|
|
@ -203,26 +207,27 @@
|
||||||
void SetOwnerPopup(Company item)
|
void SetOwnerPopup(Company item)
|
||||||
{
|
{
|
||||||
_logger.Info($"Setting owner of {item.OwnerId}, {item.Id}");
|
_logger.Info($"Setting owner of {item.OwnerId}, {item.Id}");
|
||||||
|
CompanyToSetOwner = item;
|
||||||
_setOwnerPopupVisible = true;
|
_setOwnerPopupVisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<Company> SetOwner(Guid CompanyId)
|
async Task<Company> SetOwner()
|
||||||
{
|
{
|
||||||
|
|
||||||
//get user id from DB
|
//get user id from DB
|
||||||
var userModelDto = await userDataService.GetUserByEmailAsync(Email);
|
var userModelDto = await userDataService.GetUserByEmailAsync(Email);
|
||||||
|
|
||||||
//overwrite ServiceProvider ownerid
|
//overwrite ServiceProvider ownerid
|
||||||
var target = await serviceProviderDataService.GetServiceProviderByIdAsync(CompanyId);
|
//var target = await serviceProviderDataService.GetServiceProviderByIdAsync(CompanyToSetOwner.Id);
|
||||||
if (target == null)
|
if (CompanyToSetOwner == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
target.OwnerId = userModelDto.Id;
|
CompanyToSetOwner.OwnerId = userModelDto.Id;
|
||||||
var result = await serviceProviderDataService.UpdateServiceProviderAsync(target);
|
var result = await serviceProviderDataService.UpdateServiceProviderAsync(CompanyToSetOwner);
|
||||||
|
CompanyToSetOwner = null;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
@page "/user/transfers"
|
@page "/user/transfers"
|
||||||
@using BlazorAnimation
|
@using BlazorAnimation
|
||||||
@using TIAM.Core.Enums
|
@using TIAM.Core.Enums
|
||||||
|
@using TIAM.Entities.Emails
|
||||||
@using TIAM.Entities.Transfers
|
@using TIAM.Entities.Transfers
|
||||||
@using TIAM.Resources
|
@using TIAM.Resources
|
||||||
@using TIAMSharedUI.Pages.Components
|
@using TIAMSharedUI.Pages.Components
|
||||||
|
|
@ -152,37 +153,12 @@
|
||||||
<DxTabPage Text="Driver">
|
<DxTabPage Text="Driver">
|
||||||
<TransferToDriverGridComponent ParentData="(Transfer)context.DataItem" KeyboardNavigationEnabled="true" />
|
<TransferToDriverGridComponent ParentData="(Transfer)context.DataItem" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
</DxTabs>
|
|
||||||
<DxTabs>
|
|
||||||
<DxTabPage Text="Messages">
|
<DxTabPage Text="Messages">
|
||||||
<MessageDetailGrid
|
<MessageDetailGridComponent ContextId="((Transfer)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
||||||
Logger="_logger"
|
|
||||||
SignalRClient="AdminSignalRClient"
|
|
||||||
ContextIds="new[] {((Transfer)context.DataItem).Id}">
|
|
||||||
|
|
||||||
<Columns>
|
|
||||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
|
||||||
<DxGridDataColumn FieldName="ContextId" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" DisplayFormat="N" />
|
|
||||||
<DxGridDataColumn FieldName="EmailAddress" />
|
|
||||||
<DxGridDataColumn FieldName="Subject" />
|
|
||||||
<DxGridDataColumn FieldName="Text">
|
|
||||||
<CellDisplayTemplate Context="displayTextContext">
|
|
||||||
<text>@System.Text.RegularExpressions.Regex.Replace((displayTextContext.Value as string)!, "<(.|\n)*?>", string.Empty)</text>
|
|
||||||
|
|
||||||
</CellDisplayTemplate>
|
|
||||||
<CellEditTemplate Context="editTextContext">
|
|
||||||
@{
|
|
||||||
var value = ((EmailMessage)editTextContext.EditModel).Text;
|
|
||||||
<textarea>@value</textarea>
|
|
||||||
}
|
|
||||||
</CellEditTemplate>
|
|
||||||
</DxGridDataColumn>
|
|
||||||
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" />
|
|
||||||
</Columns>
|
|
||||||
</MessageDetailGrid>
|
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
</DxTabs>
|
</DxTabs>
|
||||||
|
|
||||||
|
|
||||||
</DetailRowTemplate>
|
</DetailRowTemplate>
|
||||||
<EditFormTemplate Context="EditFormContext">
|
<EditFormTemplate Context="EditFormContext">
|
||||||
@{
|
@{
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@
|
||||||
CloseOnOutsideClick="false"
|
CloseOnOutsideClick="false"
|
||||||
ShowCloseButton="false"
|
ShowCloseButton="false"
|
||||||
HeaderText="MessageBox"
|
HeaderText="MessageBox"
|
||||||
Closing="EulaPopupClosing"
|
Closing="EmailPopupClosing"
|
||||||
Closed="EulaPopupClosed">
|
Closed="EmailPopupClosed">
|
||||||
<BodyContentTemplate>
|
<BodyContentTemplate>
|
||||||
<InputWizard Data=@MessageWizardModel
|
<InputWizard Data=@MessageWizardModel
|
||||||
OnSubmit="SubmitForm"
|
OnSubmit="SubmitForm"
|
||||||
|
|
@ -75,7 +75,7 @@
|
||||||
KeyFieldName="Id">
|
KeyFieldName="Id">
|
||||||
|
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn Name="@Localizer.GetString("Id")" FieldName="Id" ShowInColumnChooser="false" SortIndex="0" Visible="false" />
|
<DxGridDataColumn Name="@Localizer.GetString("Id")" FieldName="Id" ShowInColumnChooser="false" SortIndex="0" Visible="false" />
|
||||||
<DxGridDataColumn Name="@Localizer.GetString("FullName")" FieldName="ProfileDto.FullName" />
|
<DxGridDataColumn Name="@Localizer.GetString("FullName")" FieldName="ProfileDto.FullName" />
|
||||||
<DxGridDataColumn Name="@Localizer.GetString("PhoneNumber")" FieldName="UserDto.PhoneNumber" />
|
<DxGridDataColumn Name="@Localizer.GetString("PhoneNumber")" FieldName="UserDto.PhoneNumber" />
|
||||||
|
|
@ -89,18 +89,21 @@
|
||||||
var keyItem = (UserModelDtoDetail)context.DataItem;
|
var keyItem = (UserModelDtoDetail)context.DataItem;
|
||||||
|
|
||||||
var buttonText = "Contact";
|
var buttonText = "Contact";
|
||||||
<DxButton Click="() => SendMail(keyItem)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary" />
|
<p>@keyField </p><DxButton Click="() => SendMail(keyItem)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary" />
|
||||||
}
|
}
|
||||||
</CellDisplayTemplate>
|
</CellDisplayTemplate>
|
||||||
</DxGridDataColumn>
|
</DxGridDataColumn>
|
||||||
</Columns>
|
</Columns>
|
||||||
<DetailRowTemplate>
|
<DetailRowTemplate>
|
||||||
<DxTabs>
|
<DxTabs>
|
||||||
|
<DxTabPage Text="Profile">
|
||||||
|
<ProfileGridComponent ProfileId="((UserModelDtoDetail)context.DataItem).ProfileDto.Id" KeyboardNavigationEnabled="true" />
|
||||||
|
</DxTabPage>
|
||||||
<DxTabPage Text="Address">
|
<DxTabPage Text="Address">
|
||||||
<AddressDetailGridComponent ParentData="((UserModelDtoDetail)context.DataItem).ProfileDto" KeyboardNavigationEnabled="true" />
|
<AddressDetailGridComponent ParentData="((UserModelDtoDetail)context.DataItem).ProfileDto" KeyboardNavigationEnabled="true" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Companies owned">
|
<DxTabPage Text="Companies owned">
|
||||||
<ServiceProviderGridComponent UserModelDtoDetail="(UserModelDtoDetail)context.DataItem" />
|
<ServiceProviderGridComponent ContextId="((UserModelDtoDetail)context.DataItem).Id" />
|
||||||
</DxTabPage>
|
</DxTabPage>
|
||||||
<DxTabPage Text="Roles in services">
|
<DxTabPage Text="Roles in services">
|
||||||
<UserProductMappingGridComponent UserModelDtoDetail="(UserModelDtoDetail)context.DataItem" KeyboardNavigationEnabled="true" />
|
<UserProductMappingGridComponent UserModelDtoDetail="(UserModelDtoDetail)context.DataItem" KeyboardNavigationEnabled="true" />
|
||||||
|
|
@ -194,12 +197,12 @@
|
||||||
PopupVisible = false;
|
PopupVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EulaPopupClosed()
|
void EmailPopupClosed()
|
||||||
{
|
{
|
||||||
//cancel clicked
|
//cancel clicked
|
||||||
}
|
}
|
||||||
|
|
||||||
void EulaPopupClosing(PopupClosingEventArgs args)
|
void EmailPopupClosing(PopupClosingEventArgs args)
|
||||||
{
|
{
|
||||||
//myModel = new TransferWizardModel();
|
//myModel = new TransferWizardModel();
|
||||||
MessageWizardModel = new MessageWizardModel();
|
MessageWizardModel = new MessageWizardModel();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
@using AyCode.Core
|
||||||
|
@using TIAM.Entities.Products
|
||||||
|
@using TIAM.Entities.ServiceProviders
|
||||||
|
@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
|
||||||
|
@using AyCode.Services.Loggers
|
||||||
|
@using TIAM.Core.Loggers
|
||||||
|
@using TIAM.Entities.Addresses
|
||||||
|
@using TIAMSharedUI.Shared.Components.Grids
|
||||||
|
@using TIAMSharedUI.Pages.Components.EditComponents
|
||||||
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
|
@using AyCode.Interfaces.Addresses
|
||||||
|
@inject IServiceProviderDataService serviceProviderDataService
|
||||||
|
@inject IUserDataService userDataService
|
||||||
|
@inject ITransferDataService transferDataService
|
||||||
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
|
@inject AdminSignalRClient AdminSignalRClient;
|
||||||
|
|
||||||
|
|
||||||
|
<MessageDetailGrid @ref="_messageGrid"
|
||||||
|
Logger="_logger"
|
||||||
|
SignalRClient="AdminSignalRClient"
|
||||||
|
ContextId="ContextId"
|
||||||
|
TextWrapEnabled="false">
|
||||||
|
|
||||||
|
<Columns>
|
||||||
|
<DxGridDataColumn FieldName="Id" Width="80px" Visible="false" />
|
||||||
|
<DxGridDataColumn FieldName="ContextId" Width="80px" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="false" />
|
||||||
|
<DxGridDataColumn FieldName="EmailAddress" Width="100px" Visible="@IsSenderEmailVisible" />
|
||||||
|
<DxGridDataColumn FieldName="Subject" Visible=@IsSubjectVisible />
|
||||||
|
<DxGridDataColumn FieldName="Text">
|
||||||
|
<CellDisplayTemplate Context="messageContext">
|
||||||
|
@{
|
||||||
|
var keyField = (string)messageContext.Value;
|
||||||
|
}
|
||||||
|
<div>@((MarkupString)keyField)</div>
|
||||||
|
</CellDisplayTemplate>
|
||||||
|
</DxGridDataColumn>
|
||||||
|
<DxGridDataColumn FieldName="Created" Width="100px" />
|
||||||
|
</Columns>
|
||||||
|
|
||||||
|
</MessageDetailGrid>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
[Parameter] public Guid? ContextId { get; set; }
|
||||||
|
[Parameter] public bool IsSubjectVisible { get; set; } = true;
|
||||||
|
[Parameter] public bool IsSenderEmailVisible { get; set; } = true;
|
||||||
|
|
||||||
|
|
||||||
|
private Guid? _contextId = null!;
|
||||||
|
private MessageGrid _messageGrid = null!;
|
||||||
|
private LoggerClient<MessageGridComponent> _logger = null!;
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
_logger = new LoggerClient<MessageGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
|
//DataSource = new List<Address>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
@using TIAM.Entities.Products
|
||||||
|
@using TIAM.Entities.ServiceProviders
|
||||||
|
@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
|
||||||
|
@using AyCode.Services.Loggers
|
||||||
|
@using TIAM.Core.Loggers
|
||||||
|
@using TIAM.Entities.Addresses
|
||||||
|
@using TIAMSharedUI.Shared.Components.Grids
|
||||||
|
@using TIAMSharedUI.Pages.Components.EditComponents
|
||||||
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
|
@using AyCode.Interfaces.Addresses
|
||||||
|
@inject IServiceProviderDataService serviceProviderDataService
|
||||||
|
@inject IUserDataService userDataService
|
||||||
|
@inject ITransferDataService transferDataService
|
||||||
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
|
@inject AdminSignalRClient AdminSignalRClient;
|
||||||
|
|
||||||
|
|
||||||
|
<MessageGrid @ref="_messageGrid"
|
||||||
|
ContextId="_contextId"
|
||||||
|
Logger="_logger"
|
||||||
|
SignalRClient="AdminSignalRClient"
|
||||||
|
PageSize="5"
|
||||||
|
AutoExpandAllGroupRows="true"
|
||||||
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||||
|
KeyFieldName="Id"
|
||||||
|
ValidationEnabled="false"
|
||||||
|
EditMode="GridEditMode.EditForm"
|
||||||
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
ShowFilterRow="false">
|
||||||
|
<Columns>
|
||||||
|
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
|
<DxGridDataColumn FieldName="Id" GroupIndex="0" />
|
||||||
|
<DxGridDataColumn FieldName="AddressText" />
|
||||||
|
<DxGridDataColumn FieldName="IsValid" Width="40" />
|
||||||
|
<DxGridDataColumn FieldName="IsHelper" Width="40" />
|
||||||
|
<DxGridDataColumn FieldName="Latitude" Width="40" />
|
||||||
|
<DxGridDataColumn FieldName="Longitude" Width="40" />
|
||||||
|
<DxGridDataColumn FieldName="Created" Width="40" />
|
||||||
|
<DxGridDataColumn FieldName="Modified" Width="40" />
|
||||||
|
</Columns>
|
||||||
|
|
||||||
|
</MessageGrid>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
private Guid? _contextId = null!;
|
||||||
|
private MessageGrid _messageGrid = null!;
|
||||||
|
private LoggerClient<MessageGridComponent> _logger = null!;
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
_logger = new LoggerClient<MessageGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
|
//DataSource = new List<Address>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,142 @@
|
||||||
|
@using TIAM.Entities.Products
|
||||||
|
@using TIAM.Entities.ServiceProviders
|
||||||
|
@using TIAM.Entities.Transfers
|
||||||
|
@using TIAM.Entities.Drivers
|
||||||
|
@using TIAM.Entities.Users
|
||||||
|
@using TIAM.Models.Dtos.Users
|
||||||
|
@using TIAM.Resources
|
||||||
|
@using TIAMWebApp.Shared.Application.Interfaces
|
||||||
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
|
@using AyCode.Services.Loggers
|
||||||
|
@using TIAM.Core.Loggers
|
||||||
|
@using Address = TIAM.Entities.Addresses.Address
|
||||||
|
@using Profile = TIAM.Entities.Profiles.Profile
|
||||||
|
@using TIAMSharedUI.Shared.Components.Grids
|
||||||
|
@using TIAMSharedUI.Pages.Components.EditComponents
|
||||||
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
|
@using AyCode.Interfaces.Addresses
|
||||||
|
@inject IStringLocalizer<TIAMResources> Localizer
|
||||||
|
@inject IServiceProviderDataService serviceProviderDataService
|
||||||
|
@inject IUserDataService userDataService
|
||||||
|
@inject ITransferDataService transferDataService
|
||||||
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
|
@inject AdminSignalRClient AdminSignalRClient;
|
||||||
|
|
||||||
|
|
||||||
|
<ProductDetailGrid @ref="_productGrid"
|
||||||
|
ContextId="ContextId"
|
||||||
|
Logger="_logger"
|
||||||
|
SignalRClient="AdminSignalRClient"
|
||||||
|
OnGridEditModelSaving="DataItemSaving"
|
||||||
|
OnGridItemDeleting="DataItemDeleting"
|
||||||
|
OnGridItemChanged="DataItemChanged"
|
||||||
|
PageSize="5"
|
||||||
|
AutoExpandAllGroupRows="true"
|
||||||
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||||
|
KeyFieldName="Id"
|
||||||
|
ValidationEnabled="false"
|
||||||
|
EditMode="GridEditMode.EditForm"
|
||||||
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
|
ShowFilterRow="true">
|
||||||
|
<Columns>
|
||||||
|
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
|
<DxGridDataColumn FieldName="Id" GroupIndex="0" />
|
||||||
|
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductName) FieldName="Name" />
|
||||||
|
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductType) FieldName="ProductType" Width="140" />
|
||||||
|
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.Price) FieldName="Price" Width="40" />
|
||||||
|
<DxGridDataColumn FieldName="ServiceProviderId" Width="40" />
|
||||||
|
<DxGridDataColumn Caption=@Localizer.GetString(ResourceKeys.ProductDescription) FieldName="Description" Width="40" />
|
||||||
|
</Columns>
|
||||||
|
<DetailRowTemplate>
|
||||||
|
<DxTabs>
|
||||||
|
<DxTabPage Text="Profile">
|
||||||
|
<ProfileGridComponent ProfileId="((Product)context.DataItem).ProfileId" KeyboardNavigationEnabled="true" />
|
||||||
|
</DxTabPage>
|
||||||
|
</DxTabs>
|
||||||
|
</DetailRowTemplate>
|
||||||
|
<EditFormTemplate Context="EditFormContext">
|
||||||
|
@{
|
||||||
|
var transfer2 = (Product)EditFormContext.EditModel;
|
||||||
|
}
|
||||||
|
<DxFormLayout CssClass="w-100">
|
||||||
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductName) ColSpanMd="4">
|
||||||
|
@EditFormContext.GetEditor("Name")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductType) ColSpanMd="4">
|
||||||
|
@EditFormContext.GetEditor("ProductType")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.Price) ColSpanMd="4">
|
||||||
|
@EditFormContext.GetEditor("Price")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
<DxFormLayoutItem Caption=@Localizer.GetString(ResourceKeys.ProductDescription) ColSpanMd="4">
|
||||||
|
@EditFormContext.GetEditor("Description")
|
||||||
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
</DxFormLayout>
|
||||||
|
</EditFormTemplate>
|
||||||
|
|
||||||
|
</ProductDetailGrid>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
|
[Parameter] public Guid? ContextId { get; set; }
|
||||||
|
|
||||||
|
private ProductDetailGrid _productGrid = null!;
|
||||||
|
private LoggerClient<ProductDetailGridComponent> _logger = null!;
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
_logger = new LoggerClient<ProductDetailGridComponent>(LogWriters.ToArray());
|
||||||
|
|
||||||
|
//DataSource = new List<Address>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataItemChanged(GridDataItemChangedEventArgs<Product> args)
|
||||||
|
{
|
||||||
|
_logger.Debug($"Saving: {args.DataItem.Name}, {args.DataItem.ServiceProviderId}");
|
||||||
|
|
||||||
|
_productGrid.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataItemSaving(GridEditModelSavingEventArgs e)
|
||||||
|
{
|
||||||
|
_logger.Debug($"DataItemSaving");
|
||||||
|
((Product)e.EditModel).ServiceProviderId = (Guid)ContextId!;
|
||||||
|
Guid _profileId = Guid.NewGuid();
|
||||||
|
((Product)e.EditModel).Profile = new Profile();
|
||||||
|
((Product)e.EditModel).Profile.Id = _profileId;
|
||||||
|
((Product)e.EditModel).ProfileId = _profileId;
|
||||||
|
((Product)e.EditModel).Profile.Name = ((Product)e.EditModel).Name;
|
||||||
|
Guid _addressId = Guid.NewGuid();
|
||||||
|
((Product)e.EditModel).Profile.Address = new Address();
|
||||||
|
((Product)e.EditModel).Profile.AddressId = _addressId;
|
||||||
|
((Product)e.EditModel).Profile.Address.Id = _addressId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_logger.Debug($"Saving: {((Product)e.EditModel).Name}, {((Product)e.EditModel).ServiceProviderId}");
|
||||||
|
|
||||||
|
//var result = serviceProviderDataService.CreateProductAsync((Product)e.EditModel);
|
||||||
|
_logger.Debug($"saved product: {((Product)e.EditModel).ServiceProviderId}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataItemDeleting(GridDataItemDeletingEventArgs obj)
|
||||||
|
{
|
||||||
|
_logger.Debug($"DataItemDeleting");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
|
{
|
||||||
|
if (!e.IsNew) return;
|
||||||
|
|
||||||
|
var newProduct = (Product)e.EditModel;
|
||||||
|
newProduct.Id = Guid.NewGuid();
|
||||||
|
newProduct.Name = "Type a name";
|
||||||
|
newProduct.ServiceProviderId = (Guid)ContextId!;
|
||||||
|
newProduct.Price = 0;
|
||||||
|
newProduct.ProductType = TIAM.Core.Enums.ProductType.Hotel;
|
||||||
|
newProduct.Description = "Type a description";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,86 +1,73 @@
|
||||||
@using TIAM.Entities.Products
|
@using TIAM.Entities.Products
|
||||||
@using TIAM.Entities.ServiceProviders
|
@using TIAM.Entities.ServiceProviders
|
||||||
@using TIAM.Models.Dtos.Users
|
@using TIAM.Models.Dtos.Users
|
||||||
|
@using TIAMSharedUI.Shared.Components.Grids
|
||||||
@using TIAMWebApp.Shared.Application.Interfaces
|
@using TIAMWebApp.Shared.Application.Interfaces
|
||||||
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
@using TIAMWebApp.Shared.Application.Utility
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
@using AyCode.Services.Loggers
|
@using AyCode.Services.Loggers
|
||||||
@using TIAM.Core.Loggers
|
@using TIAM.Core.Loggers
|
||||||
@using AyCode.Core
|
@using AyCode.Core
|
||||||
|
@using Profile = TIAM.Entities.Profiles.Profile
|
||||||
@inject IServiceProviderDataService serviceProviderDataService
|
@inject IServiceProviderDataService serviceProviderDataService
|
||||||
@inject IUserDataService userDataService
|
@inject IUserDataService userDataService
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
|
@inject AdminSignalRClient AdminSignalRClient
|
||||||
<div class="mb-2">
|
<ProfileDetailGrid @ref="_profileGrid"
|
||||||
<h3>Profile</h3>
|
ContextId="ProfileId"
|
||||||
</div>
|
Logger="_logger"
|
||||||
<DxGrid Data="_detailGridData"
|
SignalRClient="AdminSignalRClient"
|
||||||
PageSize="5"
|
PageSize="5"
|
||||||
AutoExpandAllGroupRows="true"
|
AutoExpandAllGroupRows="true"
|
||||||
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||||
KeyFieldName="Id"
|
KeyFieldName="Id"
|
||||||
ValidationEnabled="false"
|
ValidationEnabled="false"
|
||||||
CustomizeEditModel="CustomizeEditModel"
|
CustomizeEditModel="CustomizeEditModel"
|
||||||
EditModelSaving="EditModelSaving"
|
|
||||||
DataItemDeleting="DataItemDeleting"
|
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
ShowFilterRow="true">
|
ShowFilterRow="false">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||||
<DxGridDataColumn FieldName="UserId" />
|
<DxGridDataColumn FieldName="Name" />
|
||||||
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
<DxGridDataColumn FieldName="FullName" />
|
||||||
<DxGridDataColumn FieldName="Permissions" />
|
<DxGridDataColumn FieldName="Created" Width="40%" />
|
||||||
|
<DxGridDataColumn FieldName="Modified" />
|
||||||
</Columns>
|
</Columns>
|
||||||
|
<DetailRowTemplate>
|
||||||
|
<DxTabs>
|
||||||
|
|
||||||
|
<DxTabPage Text="Address">
|
||||||
|
<AddressDetailGridComponent ParentData="((Profile)context.DataItem)" KeyboardNavigationEnabled="true" />
|
||||||
|
</DxTabPage>
|
||||||
|
|
||||||
|
</DxTabs>
|
||||||
|
|
||||||
|
|
||||||
</DxGrid>
|
</DetailRowTemplate>
|
||||||
|
|
||||||
|
</ProfileDetailGrid>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public bool KeyboardNavigationEnabled { get; set; }
|
public bool KeyboardNavigationEnabled { get; set; }
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public object ProfileContext { get; set; }
|
public Guid ProfileId { get; set; } = Guid.Empty;
|
||||||
[Parameter]
|
|
||||||
public string ContextIdType { get; set; }
|
|
||||||
|
|
||||||
List<TIAM.Entities.Profiles.Profile> _detailGridData;
|
private ProfileDetailGrid _profileGrid = null!;
|
||||||
|
private LoggerClient<ProfileGridComponent> _logger = null!;
|
||||||
List<TIAM.Entities.Profiles.Profile> _availableProfiles;
|
|
||||||
|
|
||||||
ILogger _logger;
|
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
|
||||||
_logger = new LoggerClient<ProfileGridComponent>(LogWriters.ToArray());
|
_logger = new LoggerClient<ProfileGridComponent>(LogWriters.ToArray());
|
||||||
if(ContextIdType == null)
|
|
||||||
{
|
|
||||||
//get all profiles from DB
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (ContextIdType)
|
|
||||||
{
|
|
||||||
case ("user"):
|
|
||||||
//get profile for user
|
|
||||||
UserModelDto resultData = (UserModelDto)ProfileContext;
|
|
||||||
_detailGridData.Add(resultData.UserDto.Profile);
|
|
||||||
break;
|
|
||||||
case ("product"):
|
|
||||||
//get profile for product
|
|
||||||
//var resultData2 = await serviceProviderDataService.GetProductById(ContextId); //todo
|
|
||||||
Product resultData2 = (Product)ProfileContext;
|
|
||||||
_detailGridData.Add(resultData2.Profile);
|
|
||||||
break;
|
|
||||||
case ("company"):
|
|
||||||
//get profile for company
|
|
||||||
Company resultData3 = (Company)ProfileContext;
|
|
||||||
_detailGridData.Add(resultData3.Profile);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
protected override void OnParametersSet()
|
||||||
|
{
|
||||||
|
|
||||||
|
_logger.DebugConditional(ProfileId.ToString());
|
||||||
|
base.OnParametersSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -99,6 +86,7 @@
|
||||||
if (e.IsNew)
|
if (e.IsNew)
|
||||||
//add new orderData to orderData array
|
//add new orderData to orderData array
|
||||||
_logger.Info("Data added");
|
_logger.Info("Data added");
|
||||||
|
|
||||||
else
|
else
|
||||||
_logger.Info("Data updated");
|
_logger.Info("Data updated");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,48 +5,58 @@
|
||||||
@using TIAM.Entities.Users
|
@using TIAM.Entities.Users
|
||||||
@using TIAM.Models.Dtos.Users
|
@using TIAM.Models.Dtos.Users
|
||||||
@using TIAMWebApp.Shared.Application.Interfaces
|
@using TIAMWebApp.Shared.Application.Interfaces
|
||||||
|
@using TIAMWebApp.Shared.Application.Services
|
||||||
@using TIAMWebApp.Shared.Application.Utility
|
@using TIAMWebApp.Shared.Application.Utility
|
||||||
@using AyCode.Services.Loggers
|
@using AyCode.Services.Loggers
|
||||||
@using TIAM.Core.Loggers
|
@using TIAM.Core.Loggers
|
||||||
@using AyCode.Core
|
@using AyCode.Core
|
||||||
|
@using TIAMSharedUI.Shared.Components.Grids
|
||||||
@inject IServiceProviderDataService ServiceProviderDataService
|
@inject IServiceProviderDataService ServiceProviderDataService
|
||||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||||
|
@inject AdminSignalRClient AdminSignalRClient;
|
||||||
|
|
||||||
<div class="mb-2">
|
<CompanyDetailGrid Data="_detailGridData"
|
||||||
<h3>Companies owned</h3>
|
Logger="_logger"
|
||||||
</div>
|
SignalRClient="AdminSignalRClient"
|
||||||
<DxGrid Data="_detailGridData"
|
ContextId="ContextId"
|
||||||
PageSize="5"
|
PageSize="5"
|
||||||
AutoExpandAllGroupRows="true"
|
AutoExpandAllGroupRows="true"
|
||||||
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||||
KeyFieldName="Id"
|
KeyFieldName="Id"
|
||||||
ValidationEnabled="false"
|
ValidationEnabled="false"
|
||||||
CustomizeEditModel="CustomizeEditModel"
|
|
||||||
EditModelSaving="EditModelSaving"
|
|
||||||
DataItemDeleting="DataItemDeleting"
|
|
||||||
EditMode="GridEditMode.EditForm"
|
EditMode="GridEditMode.EditForm"
|
||||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||||
ShowFilterRow="true">
|
ShowFilterRow="true">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||||
<DxGridDataColumn FieldName="UserId" />
|
<DxGridDataColumn FieldName="OwnerId" />
|
||||||
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
<DxGridDataColumn FieldName="Name" Width="40%" />
|
||||||
<DxGridDataColumn FieldName="Permissions" />
|
<DxGridDataColumn FieldName="AffiliateId" />
|
||||||
|
<DxGridDataColumn FieldName="CommissionPercent" />
|
||||||
</Columns>
|
</Columns>
|
||||||
|
<DetailRowTemplate>
|
||||||
|
|
||||||
|
<DxTabs>
|
||||||
|
<DxTabPage Text="Products">
|
||||||
|
<ProductDetailGridComponent ContextId="((Company)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
||||||
|
</DxTabPage>
|
||||||
|
|
||||||
|
</DxTabs>
|
||||||
|
|
||||||
|
|
||||||
|
</DetailRowTemplate>
|
||||||
<EditFormTemplate Context="EditFormContext">
|
<EditFormTemplate Context="EditFormContext">
|
||||||
@{
|
@{
|
||||||
var transfer2 = (UserProductMapping)EditFormContext.EditModel;
|
var serviceProvider = (Company)EditFormContext.EditModel;
|
||||||
}
|
}
|
||||||
<DxFormLayout CssClass="w-100">
|
<DxFormLayout CssClass="w-100">
|
||||||
<DxFormLayoutItem Caption="UserId" ColSpanMd="4">
|
<DxFormLayoutItem Caption="Name" ColSpanMd="4">
|
||||||
@EditFormContext.GetEditor("UserId")
|
@EditFormContext.GetEditor("Name")
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
<DxFormLayoutItem Caption="Product:" ColSpanMd="4">
|
|
||||||
<DxComboBox Data="@_availableServices" TextFieldName="Name" @bind-Value="((UserProductMapping)EditFormContext.EditModel).ProductId" />
|
<DxFormLayoutItem Caption="Commission rate" ColSpanMd="4">
|
||||||
</DxFormLayoutItem>
|
@EditFormContext.GetEditor("CommissionPercent")
|
||||||
<DxFormLayoutItem Caption="Permissions" ColSpanMd="4">
|
|
||||||
@EditFormContext.GetEditor("Permissions")
|
|
||||||
</DxFormLayoutItem>
|
</DxFormLayoutItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -54,13 +64,12 @@
|
||||||
</DxFormLayout>
|
</DxFormLayout>
|
||||||
</EditFormTemplate>
|
</EditFormTemplate>
|
||||||
|
|
||||||
</DxGrid>
|
</CompanyDetailGrid>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter]
|
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||||
public bool KeyboardNavigationEnabled { get; set; }
|
[Parameter] public UserModelDtoDetail UserModelDtoDetail { get; set; }
|
||||||
[Parameter]
|
[Parameter] public Guid? ContextId { get; set; }
|
||||||
public UserModelDtoDetail UserModelDtoDetail { get; set; }
|
|
||||||
|
|
||||||
List<Company> _detailGridData;
|
List<Company> _detailGridData;
|
||||||
|
|
||||||
|
|
@ -68,7 +77,7 @@
|
||||||
|
|
||||||
public UserModelDtoDetail UserInfo;
|
public UserModelDtoDetail UserInfo;
|
||||||
|
|
||||||
ILogger _logger;
|
private LoggerClient<ServiceProviderGridComponent> _logger = null!;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
|
@ -76,47 +85,47 @@
|
||||||
|
|
||||||
// ReSharper disable once NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract
|
// ReSharper disable once NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract
|
||||||
_detailGridData = UserModelDtoDetail.ServiceProviders ?? [];
|
_detailGridData = UserModelDtoDetail.ServiceProviders ?? [];
|
||||||
_availableServices = await ServiceProviderDataService.GetServiceProvidersAsync();
|
//_availableServices = await ServiceProviderDataService.GetServiceProvidersAsync();
|
||||||
|
|
||||||
_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
//_logger.Info($"DetailGridData: {_detailGridData.Count}");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
// void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||||
{
|
// {
|
||||||
if (!e.IsNew) return;
|
// if (!e.IsNew) return;
|
||||||
|
|
||||||
var newProductMapping = new UserProductMapping
|
// var newProductMapping = new UserProductMapping
|
||||||
{
|
// {
|
||||||
ProductId = Guid.NewGuid(),
|
// ProductId = Guid.NewGuid(),
|
||||||
UserId = UserModelDtoDetail.Id,
|
// UserId = UserModelDtoDetail.Id,
|
||||||
Permissions = 1
|
// Permissions = 1
|
||||||
};
|
// };
|
||||||
|
|
||||||
e.EditModel = newProductMapping;
|
// e.EditModel = newProductMapping;
|
||||||
}
|
// }
|
||||||
|
|
||||||
async Task EditModelSaving(GridEditModelSavingEventArgs e)
|
// async Task EditModelSaving(GridEditModelSavingEventArgs e)
|
||||||
{
|
// {
|
||||||
if (e.IsNew)
|
// if (e.IsNew)
|
||||||
//add new orderData to orderData array
|
// //add new orderData to orderData array
|
||||||
_logger.Info("New orderData added");
|
// _logger.Info("New orderData added");
|
||||||
else
|
// else
|
||||||
_logger.Info("orderData updated");
|
// _logger.Info("orderData updated");
|
||||||
|
|
||||||
await UpdateDataAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
|
|
||||||
{
|
|
||||||
//remove orderData from orderData array
|
|
||||||
_logger.Info("orderData deleted");
|
|
||||||
// await UpdateDataAsync();
|
// await UpdateDataAsync();
|
||||||
}
|
// }
|
||||||
|
|
||||||
async Task UpdateDataAsync()
|
// async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
|
||||||
{
|
// {
|
||||||
//refresh grid
|
// //remove orderData from orderData array
|
||||||
_logger.Info("orderData grid refreshed");
|
// _logger.Info("orderData deleted");
|
||||||
}
|
// //await UpdateDataAsync();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// async Task UpdateDataAsync()
|
||||||
|
// {
|
||||||
|
// //refresh grid
|
||||||
|
// _logger.Info("orderData grid refreshed");
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,18 @@
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using TIAM.Services;
|
||||||
|
|
||||||
namespace TIAMSharedUI.Shared.Components.Grids;
|
namespace TIAMSharedUI.Shared.Components.Grids;
|
||||||
|
|
||||||
public class CompanyDetailGrid : CompanyGrid
|
public class CompanyDetailGrid : CompanyGrid
|
||||||
{
|
{
|
||||||
|
public CompanyDetailGrid() : base()
|
||||||
|
{
|
||||||
|
GetAllMessageTag = SignalRTags.GetCompaniesByContextId;
|
||||||
|
AddMessageTag = SignalRTags.AddCompany;
|
||||||
|
UpdateMessageTag = SignalRTags.UpdateCompany;
|
||||||
|
RemoveMessageTag = SignalRTags.RemoveCompany;
|
||||||
|
}
|
||||||
|
|
||||||
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
||||||
{
|
{
|
||||||
var isFirst = IsFirstInitializeParameters;
|
var isFirst = IsFirstInitializeParameters;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using TIAM.Entities.Products;
|
||||||
|
using TIAM.Services;
|
||||||
|
|
||||||
|
namespace TIAMSharedUI.Shared.Components.Grids;
|
||||||
|
|
||||||
|
public class ProductDetailGrid : ProductGrid
|
||||||
|
{
|
||||||
|
public ProductDetailGrid() : base()
|
||||||
|
{
|
||||||
|
GetAllMessageTag = SignalRTags.GetProductsByOwnerId;
|
||||||
|
AddMessageTag = SignalRTags.AddProduct;
|
||||||
|
UpdateMessageTag = SignalRTags.UpdateProduct;
|
||||||
|
RemoveMessageTag = SignalRTags.RemoveProduct;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
||||||
|
{
|
||||||
|
if (!IsFirstInitializeParameters)
|
||||||
|
{
|
||||||
|
//ShowFilterRow = true;
|
||||||
|
//ShowGroupPanel = true;
|
||||||
|
//AllowSort = false;
|
||||||
|
|
||||||
|
//etc...
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.SetParametersAsyncCore(parameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using TIAM.Entities.Products;
|
||||||
|
using TIAM.Services;
|
||||||
|
|
||||||
|
namespace TIAMSharedUI.Shared.Components.Grids;
|
||||||
|
|
||||||
|
public class ProductGrid : TiamGrid<Product>
|
||||||
|
{
|
||||||
|
public ProductGrid() : base()
|
||||||
|
{
|
||||||
|
GetAllMessageTag = SignalRTags.GetProductsByContextId;
|
||||||
|
AddMessageTag = SignalRTags.AddProduct;
|
||||||
|
UpdateMessageTag = SignalRTags.UpdateProduct;
|
||||||
|
RemoveMessageTag = SignalRTags.RemoveProduct;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
||||||
|
{
|
||||||
|
if (!IsFirstInitializeParameters)
|
||||||
|
{
|
||||||
|
//ShowFilterRow = true;
|
||||||
|
//ShowGroupPanel = true;
|
||||||
|
//AllowSort = false;
|
||||||
|
|
||||||
|
//etc...
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.SetParametersAsyncCore(parameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using TIAM.Entities.Profiles;
|
||||||
|
using TIAM.Services;
|
||||||
|
|
||||||
|
namespace TIAMSharedUI.Shared.Components.Grids;
|
||||||
|
|
||||||
|
public class ProfileDetailGrid : ProfileGrid
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
||||||
|
{
|
||||||
|
if (!IsFirstInitializeParameters)
|
||||||
|
{
|
||||||
|
//ShowFilterRow = true;
|
||||||
|
//ShowGroupPanel = true;
|
||||||
|
//AllowSort = false;
|
||||||
|
|
||||||
|
//etc...
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.SetParametersAsyncCore(parameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using TIAM.Entities.Profiles;
|
||||||
|
using TIAM.Services;
|
||||||
|
|
||||||
|
namespace TIAMSharedUI.Shared.Components.Grids;
|
||||||
|
|
||||||
|
public class ProfileGrid : TiamGrid<Profile>
|
||||||
|
{
|
||||||
|
public ProfileGrid() : base()
|
||||||
|
{
|
||||||
|
GetAllMessageTag = SignalRTags.GetProfileById;
|
||||||
|
//AddMessageTag = SignalRTags.AddProfile;
|
||||||
|
UpdateMessageTag = SignalRTags.UpdateProfile;
|
||||||
|
//RemoveMessageTag = SignalRTags.RemoveProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
||||||
|
{
|
||||||
|
if (!IsFirstInitializeParameters)
|
||||||
|
{
|
||||||
|
//ShowFilterRow = true;
|
||||||
|
//ShowGroupPanel = true;
|
||||||
|
//AllowSort = false;
|
||||||
|
|
||||||
|
//etc...
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.SetParametersAsyncCore(parameters);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using QRCoder;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using AyCode.Core.Enums;
|
||||||
|
using AyCode.Core.Extensions;
|
||||||
|
using TIAM.Database.DataLayers.Admins;
|
||||||
|
using TIAM.Entities.ServiceProviders;
|
||||||
|
using TIAM.Entities.Users;
|
||||||
|
using TIAMWebApp.Shared.Application.Models;
|
||||||
|
using Product = TIAM.Entities.Products.Product;
|
||||||
|
using TIAM.Entities.Addresses;
|
||||||
|
using TIAM.Entities.Profiles;
|
||||||
|
using AyCode.Core.Loggers;
|
||||||
|
using AyCode.Entities;
|
||||||
|
using AyCode.Services.SignalRs;
|
||||||
|
using AyCode.Utils.Extensions;
|
||||||
|
using TIAM.Entities.Drivers;
|
||||||
|
using TIAM.Services;
|
||||||
|
|
||||||
|
namespace TIAMWebApp.Server.Controllers
|
||||||
|
{
|
||||||
|
[Authorize]
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/v1/[controller]")]
|
||||||
|
public class ProfileAPIController(AdminDal adminDal, IEnumerable<IAcLogWriterBase> logWriters) : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly TIAM.Core.Loggers.Logger<ServiceProviderAPIController> _logger = new(logWriters.ToArray());
|
||||||
|
|
||||||
|
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpGet]
|
||||||
|
[Route(APIUrls.GetProfileByIdRouteName)]
|
||||||
|
[SignalR(SignalRTags.GetProfileById)]
|
||||||
|
public async Task<string> GetProfileById([FromBody] Guid id)
|
||||||
|
{
|
||||||
|
if (id != Guid.Empty)
|
||||||
|
{
|
||||||
|
_logger.Info($@"GetServiceProviderById called with id: {id}");
|
||||||
|
var result = await adminDal.GetProfileByIdAsync(id);
|
||||||
|
List<Profile> profiles = new List<Profile>();
|
||||||
|
if (result != null)
|
||||||
|
profiles.Add(result);
|
||||||
|
var jsonResult = profiles.ToJson();
|
||||||
|
return jsonResult;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost]
|
||||||
|
[Route(APIUrls.UpdateProfileRouteName)]
|
||||||
|
[SignalR(SignalRTags.UpdateProfile)]
|
||||||
|
public async Task<string> UpdateProfile(Profile profile)
|
||||||
|
{
|
||||||
|
_logger.Info($"UpdateUserProductMapping called! + {profile.Id}");
|
||||||
|
|
||||||
|
var result = await adminDal.UpdateProfileAsync(profile);
|
||||||
|
|
||||||
|
return result ? profile.ToJson() : string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -139,6 +139,24 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
return myServiceproviders;
|
return myServiceproviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
|
[HttpPost]
|
||||||
|
[Route(APIUrls.GetCompaniesByContextIdRouteName)]
|
||||||
|
[Tags("Finished", "ServiceProvider")]
|
||||||
|
[SignalR(SignalRTags.GetCompaniesByContextId)]
|
||||||
|
public async Task<string> GetCompaniesByContextId([FromBody] Guid ownerId)
|
||||||
|
{
|
||||||
|
_logger.Info($@"GetServiceProvidersByOwnerId called with ownerId: {ownerId}");
|
||||||
|
|
||||||
|
var serviceProviders = await adminDal.GetServiceProvidersByOwnerIdAsync(ownerId);
|
||||||
|
|
||||||
|
//return serviceProviders.Where(x => x.OwnerId == ownerId).ToList();
|
||||||
|
//var myServiceproviders = serviceProviders.Where(x => x.OwnerId == ownerId).ToDictionary(x => x.Id, x => x.Name);
|
||||||
|
//put Company id and name into a dictionary
|
||||||
|
|
||||||
|
return serviceProviders.ToJson();
|
||||||
|
}
|
||||||
|
|
||||||
//22.
|
//22.
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
|
@ -279,8 +297,10 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route(APIUrls.AddProductRouteName)]
|
[Route(APIUrls.AddProductRouteName)]
|
||||||
[Tags("In-Progress", "Product")]
|
[Tags("In-Progress", "Product")]
|
||||||
|
[SignalR(SignalRTags.AddProduct)]
|
||||||
public async Task<IActionResult> AddProduct([FromBody] Product product)
|
public async Task<IActionResult> AddProduct([FromBody] Product product)
|
||||||
{
|
{
|
||||||
|
|
||||||
_logger.Info(@"AddProduct called");
|
_logger.Info(@"AddProduct called");
|
||||||
|
|
||||||
if (product == null)
|
if (product == null)
|
||||||
|
|
@ -290,7 +310,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var result = adminDal.AddProductAsync(product);
|
var result = adminDal.AddProductAsync(product);
|
||||||
return Ok(result);
|
return Ok(product);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -327,31 +347,50 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NonAction]
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
|
public async Task<string> GetProductsByOwnerId(Guid serviceProviderId)
|
||||||
|
{
|
||||||
|
_logger.Info($@"GetProductsByServiceProviderId called with serviceProviderId: {serviceProviderId}");
|
||||||
|
|
||||||
|
if (serviceProviderId != Guid.Empty)
|
||||||
|
{
|
||||||
|
var products = adminDal.GetProductsJsonByServiceProviderId(serviceProviderId);
|
||||||
|
if (products != null)
|
||||||
|
{
|
||||||
|
return await Task.FromResult(products);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//some Iactionresult that explains that there were errors
|
||||||
|
return await Task.FromResult(string.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//some Iactionresult that explains that there were errors
|
||||||
|
return await Task.FromResult(string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route(APIUrls.GetProductsByServiceProviderIdRouteName)]
|
[Route(APIUrls.GetProductsByServiceProviderIdRouteName)]
|
||||||
[Tags("In-Progress", "Product")]
|
[Tags("In-Progress", "Product")]
|
||||||
public IActionResult GetProductsByServiceProviderId([FromBody] Guid serviceProviderId)
|
[SignalR(SignalRTags.GetProductsByOwnerId)]
|
||||||
|
public async Task<string> GetProductsByServiceProviderId([FromBody] Guid serviceProviderId)
|
||||||
{
|
{
|
||||||
_logger.Info($@"GetProductsByServiceProviderId called with serviceProviderId: {serviceProviderId}");
|
_logger.Info($@"GetProductsByServiceProviderId called with serviceProviderId: {serviceProviderId}");
|
||||||
|
|
||||||
if (serviceProviderId == Guid.Empty)
|
if (serviceProviderId == Guid.Empty)
|
||||||
{
|
{
|
||||||
return BadRequest("Invalid request");
|
return await Task.FromResult("Invalid request");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var products = adminDal.GetProductsJsonByServiceProviderId(serviceProviderId);
|
var result = await GetProductsByOwnerId(serviceProviderId);
|
||||||
if (products != null)
|
return result;
|
||||||
{
|
|
||||||
return Ok(products);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//some Iactionresult that explains that there were errors
|
|
||||||
return StatusCode(500);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
<p>{transfer.FullName}</p>
|
<p>{transfer.FullName}</p>
|
||||||
<p>{transfer.PassengerCount}</p>
|
<p>{transfer.PassengerCount}</p>
|
||||||
<p>Please confirm the transfer by clicking on the following link:</p>
|
<p>Please confirm the transfer by clicking on the following link:</p>
|
||||||
<p><a href=""https://www.touriam.com/mytransfer?{transfer.Id}"">Confirm Transfer</a></p>
|
<p><a href=""{Setting.BaseUrl}/mytransfers/{transfer.Id}"">Confirm Transfer</a></p>
|
||||||
<p>If you did not request this transfer, please disregard this email.</p>
|
<p>If you did not request this transfer, please disregard this email.</p>
|
||||||
<p>Thank you,<br/>Tour I Am team</p>
|
<p>Thank you,<br/>Tour I Am team</p>
|
||||||
</body>
|
</body>
|
||||||
|
|
@ -356,7 +356,7 @@ namespace TIAMWebApp.Server.Controllers
|
||||||
<p>{createdTransfer.FullName}</p>
|
<p>{createdTransfer.FullName}</p>
|
||||||
<p>{createdTransfer.PassengerCount}</p>
|
<p>{createdTransfer.PassengerCount}</p>
|
||||||
<p>Please confirm the transfer by clicking on the following link:</p>
|
<p>Please confirm the transfer by clicking on the following link:</p>
|
||||||
<p><a href=""https://{Setting.BaseUrl}/mytransfers/{createdTransfer.Id}"">Confirm Transfer</a></p>
|
<p><a href=""{Setting.BaseUrl}/mytransfers/{createdTransfer.Id}"">Confirm Transfer</a></p>
|
||||||
<p>If you did not request this transfer, please disregard this email.</p>
|
<p>If you did not request this transfer, please disregard this email.</p>
|
||||||
<p>Thank you,<br/>Tour I Am team</p>
|
<p>Thank you,<br/>Tour I Am team</p>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ builder.Services.AddSingleton<AuthService>();
|
||||||
builder.Services.AddScoped<ServiceProviderAPIController>();
|
builder.Services.AddScoped<ServiceProviderAPIController>();
|
||||||
builder.Services.AddScoped<TransferDataAPIController>();
|
builder.Services.AddScoped<TransferDataAPIController>();
|
||||||
builder.Services.AddScoped<MessageAPIController>();
|
builder.Services.AddScoped<MessageAPIController>();
|
||||||
|
builder.Services.AddScoped<ProfileAPIController>();
|
||||||
|
|
||||||
|
|
||||||
builder.Services.AddSignalR(options => options.MaximumReceiveMessageSize = 128 * 1024);//.AddMessagePackProtocol(options => options.SerializerOptions = MessagePackSerializerOptions.Standard.WithSecurity(MessagePackSecurity.UntrustedData));
|
builder.Services.AddSignalR(options => options.MaximumReceiveMessageSize = 128 * 1024);//.AddMessagePackProtocol(options => options.SerializerOptions = MessagePackSerializerOptions.Standard.WithSecurity(MessagePackSecurity.UntrustedData));
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
|
||||||
//private readonly ServiceProviderAPIController _serviceProviderApiController;
|
//private readonly ServiceProviderAPIController _serviceProviderApiController;
|
||||||
//private readonly TransferDataAPIController _transferDataApiController;
|
//private readonly TransferDataAPIController _transferDataApiController;
|
||||||
|
|
||||||
public DevAdminSignalRHub(AdminDal adminDal, ServiceProviderAPIController serviceProviderApiController, TransferDataAPIController transferDataApiController, MessageAPIController messageApiController, IEnumerable<IAcLogWriterBase> logWriters)
|
public DevAdminSignalRHub(AdminDal adminDal, ServiceProviderAPIController serviceProviderApiController, TransferDataAPIController transferDataApiController, MessageAPIController messageApiController, ProfileAPIController profileApiController, IEnumerable<IAcLogWriterBase> logWriters)
|
||||||
{
|
{
|
||||||
_adminDal = adminDal;
|
_adminDal = adminDal;
|
||||||
//_serviceProviderApiController = serviceProviderApiController;
|
//_serviceProviderApiController = serviceProviderApiController;
|
||||||
|
|
@ -106,6 +106,7 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
|
||||||
_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(serviceProviderApiController));
|
_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(serviceProviderApiController));
|
||||||
_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(transferDataApiController));
|
_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(transferDataApiController));
|
||||||
_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(messageApiController));
|
_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(messageApiController));
|
||||||
|
_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(profileApiController));
|
||||||
//_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(typeof(AdminDal)));
|
//_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(typeof(AdminDal)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ namespace TIAMWebApp.Shared.Application.Interfaces
|
||||||
public Task<Company?> GetServiceProviderByIdAsync(Guid id);
|
public Task<Company?> GetServiceProviderByIdAsync(Guid id);
|
||||||
|
|
||||||
//19. (IServiceProviderDataService) Create product
|
//19. (IServiceProviderDataService) Create product
|
||||||
public Task<bool> CreateProductAsync(Product product);
|
public Task<Product> CreateProductAsync(Product product);
|
||||||
|
|
||||||
//20. (IServiceProviderDataService) Update product
|
//20. (IServiceProviderDataService) Update product
|
||||||
public Task<bool> UpdateProductAsync(Product product);
|
public Task<bool> UpdateProductAsync(Product product);
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ namespace TIAMWebApp.Shared.Application.Models
|
||||||
public const string LoggerApi = BaseUrlWithSlashAndVersion + "LoggerApi/";
|
public const string LoggerApi = BaseUrlWithSlashAndVersion + "LoggerApi/";
|
||||||
|
|
||||||
public const string UserAPI = BaseUrlWithSlashAndVersion + "UserAPI/";
|
public const string UserAPI = BaseUrlWithSlashAndVersion + "UserAPI/";
|
||||||
|
public const string ProfileAPI = BaseUrlWithSlashAndVersion + "ProfileAPI/";
|
||||||
public const string WeatherForecastAPI = BaseUrlWithSlashAndVersion + "WeatherForecastAPI/";
|
public const string WeatherForecastAPI = BaseUrlWithSlashAndVersion + "WeatherForecastAPI/";
|
||||||
public const string PopulationStructureAPI = BaseUrlWithSlashAndVersion + "PopulationStructureAPI/";
|
public const string PopulationStructureAPI = BaseUrlWithSlashAndVersion + "PopulationStructureAPI/";
|
||||||
public const string TransferDataAPI = BaseUrlWithSlashAndVersion + "TransferDataAPI/";
|
public const string TransferDataAPI = BaseUrlWithSlashAndVersion + "TransferDataAPI/";
|
||||||
|
|
@ -114,6 +115,9 @@ namespace TIAMWebApp.Shared.Application.Models
|
||||||
public const string GetServiceProvidersByOwnerIdRouteName = "GetServiceProvidersByOwnerId";
|
public const string GetServiceProvidersByOwnerIdRouteName = "GetServiceProvidersByOwnerId";
|
||||||
public const string GetServiceProvidersByOwnerId = ServiceProviderAPI + GetServiceProvidersByOwnerIdRouteName;
|
public const string GetServiceProvidersByOwnerId = ServiceProviderAPI + GetServiceProvidersByOwnerIdRouteName;
|
||||||
|
|
||||||
|
public const string GetCompaniesByContextIdRouteName = "GetCompaniesByContextId";
|
||||||
|
public const string GetCompaniesByContextId = ServiceProviderAPI + GetCompaniesByContextIdRouteName;
|
||||||
|
|
||||||
public const string UpdateServiceProviderRouteName = "UpdateServiceProvider";
|
public const string UpdateServiceProviderRouteName = "UpdateServiceProvider";
|
||||||
public const string UpdateServiceProviderUrl = ServiceProviderAPI + UpdateServiceProviderRouteName;
|
public const string UpdateServiceProviderUrl = ServiceProviderAPI + UpdateServiceProviderRouteName;
|
||||||
|
|
||||||
|
|
@ -126,7 +130,7 @@ namespace TIAMWebApp.Shared.Application.Models
|
||||||
public const string GetQrCodeByProductId = ServiceProviderAPI + GetQrCodeByProductIdRouteName;
|
public const string GetQrCodeByProductId = ServiceProviderAPI + GetQrCodeByProductIdRouteName;
|
||||||
|
|
||||||
public const string AddProductRouteName = "AddProduct";
|
public const string AddProductRouteName = "AddProduct";
|
||||||
public const string AddProductRouteUrl = ServiceProviderAPI + AddProductRouteName;
|
public const string AddProduct = ServiceProviderAPI + AddProductRouteName;
|
||||||
|
|
||||||
public const string GetAllProductsRouteName = "GetAllProducts/";
|
public const string GetAllProductsRouteName = "GetAllProducts/";
|
||||||
public const string GetAllProducts = ServiceProviderAPI + GetAllProductsRouteName;
|
public const string GetAllProducts = ServiceProviderAPI + GetAllProductsRouteName;
|
||||||
|
|
@ -161,6 +165,12 @@ namespace TIAMWebApp.Shared.Application.Models
|
||||||
public const string DeleteCarRouteName = "DeleteCar";
|
public const string DeleteCarRouteName = "DeleteCar";
|
||||||
public const string DeleteCar = ServiceProviderAPI + DeleteCarRouteName;
|
public const string DeleteCar = ServiceProviderAPI + DeleteCarRouteName;
|
||||||
|
|
||||||
|
public const string GetProfileByIdRouteName = "GetProfileById";
|
||||||
|
public const string GetProfileById = ProfileAPI + GetProfileByIdRouteName;
|
||||||
|
|
||||||
|
public const string UpdateProfileRouteName = "UpdateProfile";
|
||||||
|
public const string UpdateProfile = ProfileAPI + UpdateProfileRouteName;
|
||||||
|
|
||||||
//AssingedUsers
|
//AssingedUsers
|
||||||
//public const string CreateAssignedUserRouteName = "CreateAssignedUser";
|
//public const string CreateAssignedUserRouteName = "CreateAssignedUser";
|
||||||
//public const string CreateAssignedUser = ServiceProviderAPI + CreateAssignedUserRouteName;
|
//public const string CreateAssignedUser = ServiceProviderAPI + CreateAssignedUserRouteName;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ using TIAMWebApp.Shared.Application.Models;
|
||||||
using TIAMWebApp.Shared.Application.Models.ClientSide;
|
using TIAMWebApp.Shared.Application.Models.ClientSide;
|
||||||
using TIAMWebApp.Shared.Application.Utility;
|
using TIAMWebApp.Shared.Application.Utility;
|
||||||
using TIAM.Services;
|
using TIAM.Services;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace TIAMWebApp.Shared.Application.Services
|
namespace TIAMWebApp.Shared.Application.Services
|
||||||
{
|
{
|
||||||
|
|
@ -38,9 +39,32 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
//19.
|
//19.
|
||||||
public Task<bool> CreateProductAsync(Product product)
|
public async Task<Product> CreateProductAsync(Product product)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var result = await _adminSignalRClient.PostDataAsync(SignalRTags.AddProduct, product);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
//var url = $"{Setting.ApiBaseUrl}/{APIUrls.AddProduct}";
|
||||||
|
//var response = await http.PostAsJsonAsync(url, product);
|
||||||
|
//if (response != null)
|
||||||
|
//{
|
||||||
|
// var resultCompany = await response.Content.ReadFromJsonAsync(typeof(Product));
|
||||||
|
// if (resultCompany != null)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// return (resultCompany as Product)!;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// return null;
|
||||||
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//15.
|
//15.
|
||||||
|
|
@ -129,9 +153,12 @@ namespace TIAMWebApp.Shared.Application.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
//18.
|
//18.
|
||||||
public Task<Company?> GetServiceProviderByIdAsync(Guid id)
|
public async Task<Company?> GetServiceProviderByIdAsync(Guid id)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var company = await _adminSignalRClient.GetByIdAsync<Company>(SignalRTags.GetCompany, id);
|
||||||
|
if (company != null) _logger.DetailConditional($"company: {company.Name}");
|
||||||
|
|
||||||
|
return company;
|
||||||
}
|
}
|
||||||
|
|
||||||
//16.
|
//16.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue