merge
This commit is contained in:
commit
a93ec8258f
|
|
@ -188,7 +188,7 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
#endregion Address
|
||||
|
||||
#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> 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.
|
||||
|
|
@ -234,6 +234,7 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
|
||||
|
||||
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)
|
||||
//{
|
||||
|
|
@ -253,13 +254,6 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
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
|
||||
|
||||
#region PermissionTypes
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ public class SignalRTags : AcSignalRTags
|
|||
//public const int AddAddress = 32;
|
||||
//public const int RemoveAddress = 33;
|
||||
|
||||
public const int GetProfile = 35;
|
||||
public const int GetProfileById = 35;
|
||||
//public const int GetProfiles = 36;
|
||||
public const int GetProfilesByContextId = 37;
|
||||
//public const int GetProfileByContextId = 37;
|
||||
public const int UpdateProfile = 38;
|
||||
|
||||
//public const int AddAddress = 39;
|
||||
|
|
@ -57,4 +57,11 @@ public class SignalRTags : AcSignalRTags
|
|||
|
||||
public const int GetMessagesByContextId = 60;
|
||||
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}"
|
||||
@using TIAM.Entities.Transfers
|
||||
@using TIAM.Resources
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using AyCode.Services.Loggers
|
||||
@using TIAM.Core.Enums
|
||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||
@using TIAMWebApp.Shared.Application.Services
|
||||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@using TIAMSharedUI.Pages.User.SysAdmins
|
||||
@using TIAMSharedUI.Pages.Components
|
||||
@inject HttpClient Http
|
||||
@inject NavigationManager navManager
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
@inject ITransferDataService transferDataService
|
||||
@inject SumupService SumUpService
|
||||
@inject NavigationManager navigationManager
|
||||
@inject IStringLocalizer<TIAMResources> localizer
|
||||
@inject IWizardProcessor wizardProcessor
|
||||
|
||||
<PageTitle>Transfer details</PageTitle>
|
||||
<div class="text-center m-5">
|
||||
|
|
@ -18,6 +24,32 @@
|
|||
<h2 style="font-size:small">Manage your transfer 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="@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)
|
||||
{
|
||||
<div class="text-center m-5">
|
||||
|
|
@ -33,7 +65,10 @@ else if (!string.IsNullOrEmpty(errorMessage))
|
|||
}
|
||||
else
|
||||
{
|
||||
<div class="container mt-4">
|
||||
<div class="container mt-4">
|
||||
<DxTabs>
|
||||
<DxTabPage Text="Details">
|
||||
|
||||
|
||||
@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>
|
||||
}
|
||||
|
||||
|
|
@ -216,9 +257,82 @@ else
|
|||
|
||||
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>();
|
||||
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()
|
||||
{
|
||||
if (transfer != null)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
@inject IPopulationStructureDataProvider DataProvider
|
||||
@inject ISupplierService SupplierService
|
||||
@inject IUserDataService UserDataService
|
||||
<PageTitle>Transfer</PageTitle>
|
||||
<PageTitle>HotelAdmin</PageTitle>
|
||||
|
||||
<div class="text-center m-5">
|
||||
<h1>Dashboard</h1>
|
||||
|
|
@ -17,12 +17,12 @@
|
|||
<div class="container">
|
||||
|
||||
<HotelComponent Id="@Id"></HotelComponent>
|
||||
|
||||
|
||||
<!-- Stats admin-->
|
||||
<hr />
|
||||
|
||||
|
||||
<div class="row py-3">
|
||||
@* <div class="row py-3">
|
||||
<div class=" col-12 col-xl-3">
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<div class="card-header py-2 px-4">
|
||||
|
|
@ -177,7 +177,7 @@
|
|||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div> *@
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row py-3">
|
||||
|
||||
<div class=" col-12 col-xl-3">
|
||||
|
|
|
|||
|
|
@ -1,7 +1,23 @@
|
|||
@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.Components.Grids
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Services
|
||||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@layout AdminLayout
|
||||
@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">
|
||||
<h1>Company: @Id</h1>
|
||||
|
|
@ -10,18 +26,78 @@
|
|||
|
||||
<div class="container">
|
||||
<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>
|
||||
<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>
|
||||
<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="Permissions">
|
||||
<PermissionsComponent></PermissionsComponent>
|
||||
@* <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="Services">
|
||||
<Products></Products>
|
||||
</DxTabPage>
|
||||
|
||||
@* <DxTabPage Text="Address">
|
||||
<AddressDetailGridComponent ParentData="((Company)context.DataItem).Profile" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage> *@
|
||||
</DxTabs>
|
||||
</div>
|
||||
|
||||
|
|
@ -32,12 +108,53 @@
|
|||
[Parameter]
|
||||
public string Id { get; set; }
|
||||
|
||||
private Guid CompanyId;
|
||||
|
||||
private CompanyGrid _gridCompany;
|
||||
|
||||
public string ProfileUrl => $"/images/serviceprovider/{Id}.png";
|
||||
|
||||
private LoggerClient<ServiceProvider> _logger;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
_logger = new LoggerClient<ServiceProvider>(LogWriters.ToArray());
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Id))
|
||||
{
|
||||
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>
|
||||
<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)" /> *@
|
||||
</FooterContentTemplate>
|
||||
</DxPopup>
|
||||
|
|
@ -125,7 +125,17 @@
|
|||
<CompaniesNestedUserProductMapping CurrentCompany="(TIAM.Entities.ServiceProviders.Company)context.DataItem" KeyboardNavigationEnabled="true" />
|
||||
</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>
|
||||
<EditFormTemplate Context="EditFormContext">
|
||||
@{
|
||||
|
|
@ -163,6 +173,8 @@
|
|||
private CompanyGrid _gridCompany;
|
||||
private bool _autoCollapseDetailRow;
|
||||
|
||||
private Company CompanyToSetOwner = null;
|
||||
|
||||
public List<string> IgnoreList =
|
||||
[
|
||||
"ReceiverEmailAddress",
|
||||
|
|
@ -179,15 +191,7 @@
|
|||
string EmailMask { get; set; } = @"(\w|[.-])+@(\w|-)+\.(\w|-){2,4}";
|
||||
|
||||
DateTime StartDate { get; set; } = DateTime.Today;
|
||||
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;
|
||||
}
|
||||
DxSchedulerDataStorage _dataStorage = new();
|
||||
|
||||
void SendMail(Company item)
|
||||
{
|
||||
|
|
@ -203,26 +207,27 @@
|
|||
void SetOwnerPopup(Company item)
|
||||
{
|
||||
_logger.Info($"Setting owner of {item.OwnerId}, {item.Id}");
|
||||
|
||||
CompanyToSetOwner = item;
|
||||
_setOwnerPopupVisible = true;
|
||||
}
|
||||
|
||||
async Task<Company> SetOwner(Guid CompanyId)
|
||||
async Task<Company> SetOwner()
|
||||
{
|
||||
|
||||
//get user id from DB
|
||||
var userModelDto = await userDataService.GetUserByEmailAsync(Email);
|
||||
|
||||
//overwrite ServiceProvider ownerid
|
||||
var target = await serviceProviderDataService.GetServiceProviderByIdAsync(CompanyId);
|
||||
if (target == null)
|
||||
//var target = await serviceProviderDataService.GetServiceProviderByIdAsync(CompanyToSetOwner.Id);
|
||||
if (CompanyToSetOwner == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
target.OwnerId = userModelDto.Id;
|
||||
var result = await serviceProviderDataService.UpdateServiceProviderAsync(target);
|
||||
|
||||
CompanyToSetOwner.OwnerId = userModelDto.Id;
|
||||
var result = await serviceProviderDataService.UpdateServiceProviderAsync(CompanyToSetOwner);
|
||||
CompanyToSetOwner = null;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
@page "/user/transfers"
|
||||
@using BlazorAnimation
|
||||
@using TIAM.Core.Enums
|
||||
@using TIAM.Entities.Emails
|
||||
@using TIAM.Entities.Transfers
|
||||
@using TIAM.Resources
|
||||
@using TIAMSharedUI.Pages.Components
|
||||
|
|
@ -152,36 +153,11 @@
|
|||
<DxTabPage Text="Driver">
|
||||
<TransferToDriverGridComponent ParentData="(Transfer)context.DataItem" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage>
|
||||
</DxTabs>
|
||||
<DxTabs>
|
||||
<DxTabPage Text="Messages">
|
||||
<MessageDetailGrid
|
||||
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 Text="Messages">
|
||||
<MessageDetailGridComponent ContextId="((Transfer)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage>
|
||||
</DxTabs>
|
||||
|
||||
|
||||
</DetailRowTemplate>
|
||||
<EditFormTemplate Context="EditFormContext">
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@
|
|||
CloseOnOutsideClick="false"
|
||||
ShowCloseButton="false"
|
||||
HeaderText="MessageBox"
|
||||
Closing="EulaPopupClosing"
|
||||
Closed="EulaPopupClosed">
|
||||
Closing="EmailPopupClosing"
|
||||
Closed="EmailPopupClosed">
|
||||
<BodyContentTemplate>
|
||||
<InputWizard Data=@MessageWizardModel
|
||||
OnSubmit="SubmitForm"
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
KeyFieldName="Id">
|
||||
|
||||
<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("FullName")" FieldName="ProfileDto.FullName" />
|
||||
<DxGridDataColumn Name="@Localizer.GetString("PhoneNumber")" FieldName="UserDto.PhoneNumber" />
|
||||
|
|
@ -89,18 +89,21 @@
|
|||
var keyItem = (UserModelDtoDetail)context.DataItem;
|
||||
|
||||
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>
|
||||
</DxGridDataColumn>
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
<DxTabs>
|
||||
<DxTabPage Text="Profile">
|
||||
<ProfileGridComponent ProfileId="((UserModelDtoDetail)context.DataItem).ProfileDto.Id" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage>
|
||||
<DxTabPage Text="Address">
|
||||
<AddressDetailGridComponent ParentData="((UserModelDtoDetail)context.DataItem).ProfileDto" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage>
|
||||
<DxTabPage Text="Companies owned">
|
||||
<ServiceProviderGridComponent UserModelDtoDetail="(UserModelDtoDetail)context.DataItem" />
|
||||
<ServiceProviderGridComponent ContextId="((UserModelDtoDetail)context.DataItem).Id" />
|
||||
</DxTabPage>
|
||||
<DxTabPage Text="Roles in services">
|
||||
<UserProductMappingGridComponent UserModelDtoDetail="(UserModelDtoDetail)context.DataItem" KeyboardNavigationEnabled="true" />
|
||||
|
|
@ -194,12 +197,12 @@
|
|||
PopupVisible = false;
|
||||
}
|
||||
|
||||
void EulaPopupClosed()
|
||||
void EmailPopupClosed()
|
||||
{
|
||||
//cancel clicked
|
||||
}
|
||||
|
||||
void EulaPopupClosing(PopupClosingEventArgs args)
|
||||
void EmailPopupClosing(PopupClosingEventArgs args)
|
||||
{
|
||||
//myModel = new TransferWizardModel();
|
||||
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.ServiceProviders
|
||||
@using TIAM.Models.Dtos.Users
|
||||
@using TIAMSharedUI.Shared.Components.Grids
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Services
|
||||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@using AyCode.Services.Loggers
|
||||
@using TIAM.Core.Loggers
|
||||
@using AyCode.Core
|
||||
@using Profile = TIAM.Entities.Profiles.Profile
|
||||
@inject IServiceProviderDataService serviceProviderDataService
|
||||
@inject IUserDataService userDataService
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
|
||||
<div class="mb-2">
|
||||
<h3>Profile</h3>
|
||||
</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">
|
||||
@inject AdminSignalRClient AdminSignalRClient
|
||||
<ProfileDetailGrid @ref="_profileGrid"
|
||||
ContextId="ProfileId"
|
||||
Logger="_logger"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
PageSize="5"
|
||||
AutoExpandAllGroupRows="true"
|
||||
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||
KeyFieldName="Id"
|
||||
ValidationEnabled="false"
|
||||
CustomizeEditModel="CustomizeEditModel"
|
||||
EditMode="GridEditMode.EditForm"
|
||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
ShowFilterRow="false">
|
||||
<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="UserId" />
|
||||
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
||||
<DxGridDataColumn FieldName="Permissions" />
|
||||
<DxGridDataColumn FieldName="Name" />
|
||||
<DxGridDataColumn FieldName="FullName" />
|
||||
<DxGridDataColumn FieldName="Created" Width="40%" />
|
||||
<DxGridDataColumn FieldName="Modified" />
|
||||
</Columns>
|
||||
|
||||
<DetailRowTemplate>
|
||||
<DxTabs>
|
||||
|
||||
<DxTabPage Text="Address">
|
||||
<AddressDetailGridComponent ParentData="((Profile)context.DataItem)" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage>
|
||||
|
||||
</DxTabs>
|
||||
|
||||
</DxGrid>
|
||||
|
||||
</DetailRowTemplate>
|
||||
|
||||
</ProfileDetailGrid>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public bool KeyboardNavigationEnabled { get; set; }
|
||||
[Parameter]
|
||||
public object ProfileContext { get; set; }
|
||||
[Parameter]
|
||||
public string ContextIdType { get; set; }
|
||||
public Guid ProfileId { get; set; } = Guid.Empty;
|
||||
|
||||
List<TIAM.Entities.Profiles.Profile> _detailGridData;
|
||||
|
||||
List<TIAM.Entities.Profiles.Profile> _availableProfiles;
|
||||
|
||||
ILogger _logger;
|
||||
private ProfileDetailGrid _profileGrid = null!;
|
||||
private LoggerClient<ProfileGridComponent> _logger = null!;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
{
|
||||
|
||||
_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)
|
||||
//add new orderData to orderData array
|
||||
_logger.Info("Data added");
|
||||
|
||||
else
|
||||
_logger.Info("Data updated");
|
||||
|
||||
|
|
|
|||
|
|
@ -5,48 +5,58 @@
|
|||
@using TIAM.Entities.Users
|
||||
@using TIAM.Models.Dtos.Users
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Services
|
||||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@using AyCode.Services.Loggers
|
||||
@using TIAM.Core.Loggers
|
||||
@using AyCode.Core
|
||||
@using TIAMSharedUI.Shared.Components.Grids
|
||||
@inject IServiceProviderDataService ServiceProviderDataService
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
@inject AdminSignalRClient AdminSignalRClient;
|
||||
|
||||
<div class="mb-2">
|
||||
<h3>Companies owned</h3>
|
||||
</div>
|
||||
<DxGrid Data="_detailGridData"
|
||||
<CompanyDetailGrid Data="_detailGridData"
|
||||
Logger="_logger"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
ContextId="ContextId"
|
||||
PageSize="5"
|
||||
AutoExpandAllGroupRows="true"
|
||||
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||
KeyFieldName="Id"
|
||||
ValidationEnabled="false"
|
||||
CustomizeEditModel="CustomizeEditModel"
|
||||
EditModelSaving="EditModelSaving"
|
||||
DataItemDeleting="DataItemDeleting"
|
||||
ValidationEnabled="false"
|
||||
EditMode="GridEditMode.EditForm"
|
||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
ShowFilterRow="true">
|
||||
<Columns>
|
||||
<DxGridCommandColumn Width="135" MinWidth="135" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" ShowInColumnChooser="AcDomain.IsDeveloperVersion" Visible="AcDomain.IsDeveloperVersion" />
|
||||
<DxGridDataColumn FieldName="UserId" />
|
||||
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
||||
<DxGridDataColumn FieldName="Permissions" />
|
||||
<DxGridDataColumn FieldName="OwnerId" />
|
||||
<DxGridDataColumn FieldName="Name" Width="40%" />
|
||||
<DxGridDataColumn FieldName="AffiliateId" />
|
||||
<DxGridDataColumn FieldName="CommissionPercent" />
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
|
||||
<DxTabs>
|
||||
<DxTabPage Text="Products">
|
||||
<ProductDetailGridComponent ContextId="((Company)context.DataItem).Id" KeyboardNavigationEnabled="true" />
|
||||
</DxTabPage>
|
||||
|
||||
</DxTabs>
|
||||
|
||||
|
||||
</DetailRowTemplate>
|
||||
<EditFormTemplate Context="EditFormContext">
|
||||
@{
|
||||
var transfer2 = (UserProductMapping)EditFormContext.EditModel;
|
||||
var serviceProvider = (Company)EditFormContext.EditModel;
|
||||
}
|
||||
<DxFormLayout CssClass="w-100">
|
||||
<DxFormLayoutItem Caption="UserId" ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("UserId")
|
||||
<DxFormLayoutItem Caption="Name" ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("Name")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Product:" ColSpanMd="4">
|
||||
<DxComboBox Data="@_availableServices" TextFieldName="Name" @bind-Value="((UserProductMapping)EditFormContext.EditModel).ProductId" />
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Permissions" ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("Permissions")
|
||||
|
||||
<DxFormLayoutItem Caption="Commission rate" ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("CommissionPercent")
|
||||
</DxFormLayoutItem>
|
||||
|
||||
|
||||
|
|
@ -54,13 +64,12 @@
|
|||
</DxFormLayout>
|
||||
</EditFormTemplate>
|
||||
|
||||
</DxGrid>
|
||||
</CompanyDetailGrid>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public bool KeyboardNavigationEnabled { get; set; }
|
||||
[Parameter]
|
||||
public UserModelDtoDetail UserModelDtoDetail { get; set; }
|
||||
[Parameter] public bool KeyboardNavigationEnabled { get; set; }
|
||||
[Parameter] public UserModelDtoDetail UserModelDtoDetail { get; set; }
|
||||
[Parameter] public Guid? ContextId { get; set; }
|
||||
|
||||
List<Company> _detailGridData;
|
||||
|
||||
|
|
@ -68,7 +77,7 @@
|
|||
|
||||
public UserModelDtoDetail UserInfo;
|
||||
|
||||
ILogger _logger;
|
||||
private LoggerClient<ServiceProviderGridComponent> _logger = null!;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
|
@ -76,47 +85,47 @@
|
|||
|
||||
// ReSharper disable once NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract
|
||||
_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)
|
||||
{
|
||||
if (!e.IsNew) return;
|
||||
// void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||
// {
|
||||
// if (!e.IsNew) return;
|
||||
|
||||
var newProductMapping = new UserProductMapping
|
||||
{
|
||||
ProductId = Guid.NewGuid(),
|
||||
UserId = UserModelDtoDetail.Id,
|
||||
Permissions = 1
|
||||
};
|
||||
// var newProductMapping = new UserProductMapping
|
||||
// {
|
||||
// ProductId = Guid.NewGuid(),
|
||||
// UserId = UserModelDtoDetail.Id,
|
||||
// Permissions = 1
|
||||
// };
|
||||
|
||||
e.EditModel = newProductMapping;
|
||||
}
|
||||
// e.EditModel = newProductMapping;
|
||||
// }
|
||||
|
||||
async Task EditModelSaving(GridEditModelSavingEventArgs e)
|
||||
{
|
||||
if (e.IsNew)
|
||||
//add new orderData to orderData array
|
||||
_logger.Info("New orderData added");
|
||||
else
|
||||
_logger.Info("orderData updated");
|
||||
// async Task EditModelSaving(GridEditModelSavingEventArgs e)
|
||||
// {
|
||||
// if (e.IsNew)
|
||||
// //add new orderData to orderData array
|
||||
// _logger.Info("New orderData added");
|
||||
// else
|
||||
// _logger.Info("orderData updated");
|
||||
|
||||
await UpdateDataAsync();
|
||||
}
|
||||
// await UpdateDataAsync();
|
||||
// }
|
||||
|
||||
async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
|
||||
{
|
||||
//remove orderData from orderData array
|
||||
_logger.Info("orderData deleted");
|
||||
//await UpdateDataAsync();
|
||||
}
|
||||
// async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
|
||||
// {
|
||||
// //remove orderData from orderData array
|
||||
// _logger.Info("orderData deleted");
|
||||
// //await UpdateDataAsync();
|
||||
// }
|
||||
|
||||
async Task UpdateDataAsync()
|
||||
{
|
||||
//refresh grid
|
||||
_logger.Info("orderData grid refreshed");
|
||||
}
|
||||
// async Task UpdateDataAsync()
|
||||
// {
|
||||
// //refresh grid
|
||||
// _logger.Info("orderData grid refreshed");
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
@ -1,9 +1,18 @@
|
|||
using Microsoft.AspNetCore.Components;
|
||||
using TIAM.Services;
|
||||
|
||||
namespace TIAMSharedUI.Shared.Components.Grids;
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
throw new ArgumentOutOfRangeException(nameof(trackingState), trackingState, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[NonAction]
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
[SignalR(SignalRTags.AddCompany)]
|
||||
|
|
@ -103,7 +103,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
[Route(APIUrls.GetServiceProvidersRouteName)]
|
||||
[SignalR(SignalRTags.GetCompanies)]
|
||||
public async Task<string> GetServiceProviders()
|
||||
{
|
||||
{
|
||||
return await adminDal.GetServiceProvidersJsonAsync();
|
||||
}
|
||||
|
||||
|
|
@ -139,16 +139,34 @@ namespace TIAMWebApp.Server.Controllers
|
|||
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.
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[Route(APIUrls.CreateUserProductMappingRouteName)]
|
||||
[Route(APIUrls.CreateUserProductMappingRouteName)]
|
||||
[Tags("Finished", "ServiceProvider")]
|
||||
[EndpointSummary("Create assigned user to product")]
|
||||
[SignalR(SignalRTags.CreateUserProductMapping)]
|
||||
public async Task<IActionResult> CreateUserProductMapping(UserProductMapping userProductMapping)
|
||||
{
|
||||
if(userProductMapping.ProductId == Guid.Empty || userProductMapping.UserId == Guid.Empty)
|
||||
if (userProductMapping.ProductId == Guid.Empty || userProductMapping.UserId == Guid.Empty)
|
||||
{
|
||||
return BadRequest("Invalid request");
|
||||
}
|
||||
|
|
@ -191,7 +209,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
//23.
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[Route(APIUrls.GetUserProductMappingsForProductRouteName)]
|
||||
[Route(APIUrls.GetUserProductMappingsForProductRouteName)]
|
||||
public async Task<Dictionary<Guid, string>> GetUserProductMappingsForProduct(Guid serviceProviderId)
|
||||
{
|
||||
_logger.Info($@"GetUserProductMappingsForServiceProvider called with serviceProviderId: {serviceProviderId}");
|
||||
|
|
@ -204,7 +222,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
//put serviceprovider id and name into a dictionary
|
||||
|
||||
return myServiceproviders;
|
||||
}
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpGet]
|
||||
|
|
@ -214,7 +232,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
{
|
||||
_logger.Info($@"GetCarsForUserProductMapping called with userProductMappingId: {userProductMappingId}");
|
||||
|
||||
var cars = adminDal.GetCarByUserProductMappingId(Guid.Parse(userProductMappingId));
|
||||
var cars = adminDal.GetCarByUserProductMappingId(Guid.Parse(userProductMappingId));
|
||||
|
||||
return cars;
|
||||
}
|
||||
|
|
@ -279,8 +297,10 @@ namespace TIAMWebApp.Server.Controllers
|
|||
[HttpPost]
|
||||
[Route(APIUrls.AddProductRouteName)]
|
||||
[Tags("In-Progress", "Product")]
|
||||
[SignalR(SignalRTags.AddProduct)]
|
||||
public async Task<IActionResult> AddProduct([FromBody] Product product)
|
||||
{
|
||||
{
|
||||
|
||||
_logger.Info(@"AddProduct called");
|
||||
|
||||
if (product == null)
|
||||
|
|
@ -290,7 +310,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
else
|
||||
{
|
||||
var result = adminDal.AddProductAsync(product);
|
||||
return Ok(result);
|
||||
return Ok(product);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -322,36 +342,55 @@ namespace TIAMWebApp.Server.Controllers
|
|||
var byteImage = ms.ToArray();
|
||||
|
||||
var sigBase64 = Convert.ToBase64String(byteImage); // Get Base64
|
||||
|
||||
|
||||
return Ok(sigBase64);
|
||||
}
|
||||
}
|
||||
|
||||
[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]
|
||||
[HttpPost]
|
||||
[Route(APIUrls.GetProductsByServiceProviderIdRouteName)]
|
||||
[Route(APIUrls.GetProductsByServiceProviderIdRouteName)]
|
||||
[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}");
|
||||
|
||||
if (serviceProviderId == Guid.Empty)
|
||||
{
|
||||
return BadRequest("Invalid request");
|
||||
return await Task.FromResult("Invalid request");
|
||||
}
|
||||
else
|
||||
{
|
||||
var products = adminDal.GetProductsJsonByServiceProviderId(serviceProviderId);
|
||||
if (products != null)
|
||||
{
|
||||
return Ok(products);
|
||||
}
|
||||
else
|
||||
{
|
||||
//some Iactionresult that explains that there were errors
|
||||
return StatusCode(500);
|
||||
|
||||
}
|
||||
var result = await GetProductsByOwnerId(serviceProviderId);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
<p>{transfer.FullName}</p>
|
||||
<p>{transfer.PassengerCount}</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>Thank you,<br/>Tour I Am team</p>
|
||||
</body>
|
||||
|
|
@ -356,7 +356,7 @@ namespace TIAMWebApp.Server.Controllers
|
|||
<p>{createdTransfer.FullName}</p>
|
||||
<p>{createdTransfer.PassengerCount}</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>Thank you,<br/>Tour I Am team</p>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ builder.Services.AddSingleton<AuthService>();
|
|||
builder.Services.AddScoped<ServiceProviderAPIController>();
|
||||
builder.Services.AddScoped<TransferDataAPIController>();
|
||||
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));
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
|
|||
//private readonly ServiceProviderAPIController _serviceProviderApiController;
|
||||
//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;
|
||||
//_serviceProviderApiController = serviceProviderApiController;
|
||||
|
|
@ -106,6 +106,7 @@ public class DevAdminSignalRHub : Hub<ISignalRHubItemServer>, IAcSignalRHubServe
|
|||
_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(serviceProviderApiController));
|
||||
_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(transferDataApiController));
|
||||
_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(messageApiController));
|
||||
_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(profileApiController));
|
||||
//_dynamicMethodCallModels.Add(new DynamicMethodCallModel<SignalRAttribute>(typeof(AdminDal)));
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace TIAMWebApp.Shared.Application.Interfaces
|
|||
public Task<Company?> GetServiceProviderByIdAsync(Guid id);
|
||||
|
||||
//19. (IServiceProviderDataService) Create product
|
||||
public Task<bool> CreateProductAsync(Product product);
|
||||
public Task<Product> CreateProductAsync(Product product);
|
||||
|
||||
//20. (IServiceProviderDataService) Update 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 UserAPI = BaseUrlWithSlashAndVersion + "UserAPI/";
|
||||
public const string ProfileAPI = BaseUrlWithSlashAndVersion + "ProfileAPI/";
|
||||
public const string WeatherForecastAPI = BaseUrlWithSlashAndVersion + "WeatherForecastAPI/";
|
||||
public const string PopulationStructureAPI = BaseUrlWithSlashAndVersion + "PopulationStructureAPI/";
|
||||
public const string TransferDataAPI = BaseUrlWithSlashAndVersion + "TransferDataAPI/";
|
||||
|
|
@ -114,6 +115,9 @@ namespace TIAMWebApp.Shared.Application.Models
|
|||
public const string GetServiceProvidersByOwnerIdRouteName = "GetServiceProvidersByOwnerId";
|
||||
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 UpdateServiceProviderUrl = ServiceProviderAPI + UpdateServiceProviderRouteName;
|
||||
|
||||
|
|
@ -126,7 +130,7 @@ namespace TIAMWebApp.Shared.Application.Models
|
|||
public const string GetQrCodeByProductId = ServiceProviderAPI + GetQrCodeByProductIdRouteName;
|
||||
|
||||
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 GetAllProducts = ServiceProviderAPI + GetAllProductsRouteName;
|
||||
|
|
@ -161,6 +165,12 @@ namespace TIAMWebApp.Shared.Application.Models
|
|||
public const string DeleteCarRouteName = "DeleteCar";
|
||||
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
|
||||
//public const string CreateAssignedUserRouteName = "CreateAssignedUser";
|
||||
//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.Utility;
|
||||
using TIAM.Services;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Services
|
||||
{
|
||||
|
|
@ -38,9 +39,32 @@ namespace TIAMWebApp.Shared.Application.Services
|
|||
}
|
||||
|
||||
//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.
|
||||
|
|
@ -129,9 +153,12 @@ namespace TIAMWebApp.Shared.Application.Services
|
|||
}
|
||||
|
||||
//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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue