a lot of changes in frontend, APIS, and design
This commit is contained in:
parent
9d11b8756c
commit
f953cd8b2c
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections.Specialized;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using AyCode.Entities.Messages;
|
||||
using AyCode.Interfaces.Entities;
|
||||
using AyCode.Interfaces.TimeStampInfo;
|
||||
using AyCode.Interfaces.Users;
|
||||
|
|
@ -8,7 +9,7 @@ using AyCode.Interfaces.Users;
|
|||
namespace TIAM.Entities.Emails;
|
||||
|
||||
[Table(nameof(EmailMessage))]
|
||||
public class EmailMessage : IEntityGuid, ITimeStampInfo, IEmailRecipientsRelation, IEmailAddress
|
||||
public class EmailMessage : NoticeBase, IEntityGuid, ITimeStampInfo, IEmailRecipientsRelation, IEmailAddress
|
||||
{
|
||||
public EmailMessage()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -132,6 +132,15 @@ namespace TIAM.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Comment.
|
||||
/// </summary>
|
||||
public static string Comment {
|
||||
get {
|
||||
return ResourceManager.GetString("Comment", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Confirm Email.
|
||||
/// </summary>
|
||||
|
|
@ -231,6 +240,15 @@ namespace TIAM.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Flight or train number.
|
||||
/// </summary>
|
||||
public static string FlightNumber {
|
||||
get {
|
||||
return ResourceManager.GetString("FlightNumber", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Forgot password?.
|
||||
/// </summary>
|
||||
|
|
@ -294,6 +312,15 @@ namespace TIAM.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to (if applicable).
|
||||
/// </summary>
|
||||
public static string Optional {
|
||||
get {
|
||||
return ResourceManager.GetString("Optional", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -141,6 +141,9 @@
|
|||
<data name="ButtonSend" xml:space="preserve">
|
||||
<value>Küldés</value>
|
||||
</data>
|
||||
<data name="Comment" xml:space="preserve">
|
||||
<value>Megjegyzés</value>
|
||||
</data>
|
||||
<data name="ConfirmEmail" xml:space="preserve">
|
||||
<value>E-mail cím megerősítése</value>
|
||||
</data>
|
||||
|
|
@ -174,6 +177,9 @@
|
|||
<data name="EmailAddress" xml:space="preserve">
|
||||
<value>E-mail</value>
|
||||
</data>
|
||||
<data name="FlightNumber" xml:space="preserve">
|
||||
<value>Járatszám</value>
|
||||
</data>
|
||||
<data name="ForgotPassword" xml:space="preserve">
|
||||
<value>Elfelejtett jelszó</value>
|
||||
</data>
|
||||
|
|
@ -195,6 +201,9 @@
|
|||
<data name="NumberOfPassengers" xml:space="preserve">
|
||||
<value>Utasok száma</value>
|
||||
</data>
|
||||
<data name="Optional" xml:space="preserve">
|
||||
<value>(ha van)</value>
|
||||
</data>
|
||||
<data name="Password" xml:space="preserve">
|
||||
<value>Jelszó</value>
|
||||
</data>
|
||||
|
|
|
|||
|
|
@ -141,6 +141,9 @@
|
|||
<data name="ButtonSend" xml:space="preserve">
|
||||
<value>Send</value>
|
||||
</data>
|
||||
<data name="Comment" xml:space="preserve">
|
||||
<value>Comment</value>
|
||||
</data>
|
||||
<data name="ConfirmEmail" xml:space="preserve">
|
||||
<value>Confirm Email</value>
|
||||
</data>
|
||||
|
|
@ -174,6 +177,9 @@
|
|||
<data name="EmailAddress" xml:space="preserve">
|
||||
<value>Email</value>
|
||||
</data>
|
||||
<data name="FlightNumber" xml:space="preserve">
|
||||
<value>Flight or train number</value>
|
||||
</data>
|
||||
<data name="ForgotPassword" xml:space="preserve">
|
||||
<value>Forgot password?</value>
|
||||
</data>
|
||||
|
|
@ -195,6 +201,9 @@
|
|||
<data name="NumberOfPassengers" xml:space="preserve">
|
||||
<value>Passengers</value>
|
||||
</data>
|
||||
<data name="Optional" xml:space="preserve">
|
||||
<value>(if applicable)</value>
|
||||
</data>
|
||||
<data name="Password" xml:space="preserve">
|
||||
<value>Password</value>
|
||||
</data>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
<h3>
|
||||
@NullText
|
||||
</h3>
|
||||
|
||||
<DxTextBox @ref="firstNameTextField"
|
||||
TextChanged="@((newValue) => OnFirstNameChanged(newValue))"
|
||||
TextExpression="@(() => FirstName)"
|
||||
CssClass="form-field w-100"
|
||||
NullText="First name">
|
||||
</DxTextBox>
|
||||
<DxTextBox @ref="lastNameTextField"
|
||||
TextChanged="@((newValue) => OnLastNameChanged(newValue))"
|
||||
TextExpression="@(() => LastName)"
|
||||
CssClass="form-field w-100"
|
||||
NullText="Last name">
|
||||
</DxTextBox>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
using DevExpress.Blazor;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TIAMSharedUI.Pages.Components
|
||||
{
|
||||
public partial class FullNameEditor : ComponentBase
|
||||
{
|
||||
|
||||
[Parameter]
|
||||
public string FirstName { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string LastName { get; set; }
|
||||
|
||||
public string FullName { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string NullText { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> FirstNameChanged { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> LastNameChanged { get; set; }
|
||||
|
||||
public int InputDelay { get; set; } = 500;
|
||||
public DxTextBox firstNameTextField;
|
||||
public DxTextBox lastNameTextField;
|
||||
|
||||
void OnFirstNameChanged(string newValue)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(newValue))
|
||||
{
|
||||
FirstName = newValue;
|
||||
FullName = $"{newValue} {LastName}";
|
||||
}
|
||||
else
|
||||
{
|
||||
FirstName = null;
|
||||
firstNameTextField.Text = "Invalid data";
|
||||
}
|
||||
FirstNameChanged.InvokeAsync(newValue);
|
||||
}
|
||||
void OnLastNameChanged(string newValue)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(newValue))
|
||||
{
|
||||
LastName = newValue;
|
||||
FullName = $"{FirstName} {newValue}";
|
||||
}
|
||||
else
|
||||
{
|
||||
LastName = null;
|
||||
lastNameTextField.Text = "Invalid data";
|
||||
}
|
||||
LastNameChanged.InvokeAsync(newValue);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -267,6 +267,8 @@ namespace TIAMSharedUI.Pages.Components
|
|||
editor.OpenComponent<DxDateEdit<DateTime>>(j);
|
||||
editor.AddAttribute(j++, "Date", property.GetValue(Data));
|
||||
editor.AddAttribute(j++, "DateExpression", lambda);
|
||||
editor.AddAttribute(j++, "TimeSectionVisible", true);
|
||||
editor.AddAttribute(j++, "TimeSectionScrollPickerFormat", "tt h m");
|
||||
editor.AddAttribute(j++, "CssClass", "form-field");
|
||||
editor.AddAttribute(j++, "DateChanged", EventCallback.Factory.Create<DateTime>(this, str => { property.SetValue(Data, str); }));
|
||||
editor.CloseComponent();
|
||||
|
|
@ -377,6 +379,67 @@ namespace TIAMSharedUI.Pages.Components
|
|||
|
||||
}
|
||||
|
||||
else if (property.PropertyType == typeof(string) && string.Compare(attrList.CustomDataType, "FullName", true) == 0)
|
||||
{
|
||||
|
||||
editor.OpenComponent<FullNameEditor>(j);
|
||||
editor.AddAttribute(j++, "NullText", "Please tell us your name.");
|
||||
editor.AddAttribute(j++, "FirstNameChanged", EventCallback.Factory.Create<string>(this, result =>
|
||||
{
|
||||
LogToBrowserConsole.LogToBC($"FirstName changed to {result}");
|
||||
|
||||
//find property with name FirstName
|
||||
PropertyInfo firstNameProperty = propertyList.FirstOrDefault(p => p.Name == "FirstName");
|
||||
firstNameProperty.SetValue(Data, result);
|
||||
//find property with name LastName
|
||||
PropertyInfo lastNameProperty = propertyList.FirstOrDefault(p => p.Name == "LastName");
|
||||
//combine the two values, if they are not null
|
||||
if (firstNameProperty != null && lastNameProperty != null)
|
||||
{
|
||||
string firstName = result;
|
||||
string lastName = (string)lastNameProperty.GetValue(Data);
|
||||
string fullName = $"{firstName} {lastName}";
|
||||
property.SetValue(Data, fullName);
|
||||
}
|
||||
}));
|
||||
|
||||
editor.AddAttribute(j++, "LastNameChanged", EventCallback.Factory.Create<string>(this, result =>
|
||||
{
|
||||
LogToBrowserConsole.LogToBC($"LastName changed to {result}");
|
||||
|
||||
//find property with name FirstName
|
||||
PropertyInfo firstNameProperty = propertyList.FirstOrDefault(p => p.Name == "FirstName");
|
||||
//find property with name LastName
|
||||
PropertyInfo lastNameProperty = propertyList.FirstOrDefault(p => p.Name == "LastName");
|
||||
lastNameProperty.SetValue(Data, result);
|
||||
//combine the two values, if they are not null
|
||||
if (firstNameProperty != null && lastNameProperty != null)
|
||||
{
|
||||
string firstName = (string)firstNameProperty.GetValue(Data);
|
||||
string lastName = result;
|
||||
string fullName = $"{firstName} {lastName}";
|
||||
property.SetValue(Data, fullName);
|
||||
}
|
||||
LogToBrowserConsole.LogToBC($"bleh: {property.Name} = {property.GetValue(Data)}");
|
||||
StateHasChanged(); // Add this line to refresh the UI
|
||||
}));
|
||||
|
||||
editor.CloseComponent();
|
||||
editor.OpenComponent<DxTextBox>(j++);
|
||||
/*editor.AddAttribute(j++, "CssClass", "form-field");*/
|
||||
editor.AddAttribute(j++, "NullText", "Please type in the above fields");
|
||||
editor.AddAttribute(j++, "Enabled", false);
|
||||
editor.AddAttribute(j++, "Text", property.GetValue(Data));
|
||||
editor.AddAttribute(j++, "TextExpression", lambda);
|
||||
editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str =>
|
||||
{
|
||||
property.SetValue(Data, str);
|
||||
LogToBrowserConsole.LogToBC($"bleh: {property.Name} = {property.GetValue(Data)}");
|
||||
}));
|
||||
editor.CloseComponent();
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -378,12 +378,14 @@ new HeroSliderItem
|
|||
|
||||
public List<string> TransferIgnorList = new List<string>
|
||||
{
|
||||
"Id",
|
||||
"Id",
|
||||
"UserId",
|
||||
"Destination",
|
||||
"PickupAddress",
|
||||
"ProductId",
|
||||
"TripDate",
|
||||
"FirstName",
|
||||
"LastName",
|
||||
"UserProductMappingId",
|
||||
"UserProductToCarId",
|
||||
"ReferralId",
|
||||
|
|
|
|||
|
|
@ -125,15 +125,15 @@
|
|||
|
||||
public List<string> TransferIgnorList = new List<string>
|
||||
{
|
||||
"Id",
|
||||
"UserId",
|
||||
"ProductId",
|
||||
"Id",
|
||||
"UserId",
|
||||
"ProductId",
|
||||
"FirstName",
|
||||
"LastName",
|
||||
"UserProductMappingId",
|
||||
"UserProductToCarId",
|
||||
"ReferralId",
|
||||
"Price",
|
||||
"Driver",
|
||||
"Comment"
|
||||
"Price"
|
||||
};
|
||||
|
||||
/*protected override void OnAfterRender(bool isFirst)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
<h3>ManageMessages</h3>
|
||||
|
||||
<Messages/>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@
|
|||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI
|
||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.Messages
|
||||
@using TIAMWebApp.Shared.Application.Models.PageModels
|
||||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@layout AdminLayout
|
||||
@inject LogToBrowserConsole logToBrowserConsole
|
||||
|
|
@ -26,6 +27,7 @@
|
|||
<h2 style="font-size:small">Manage transfers here!</h2>
|
||||
</div>
|
||||
|
||||
|
||||
<DxPopup CssClass="popup-demo-events"
|
||||
@bind-Visible="@PopupVisible"
|
||||
ShowFooter="true"
|
||||
|
|
@ -55,94 +57,134 @@
|
|||
<div class="container">
|
||||
<div class="row">
|
||||
<div class=" col-12">
|
||||
<Animation Effect="@Effect.FadeInUp" Class="glass" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<Animation Effect="@Effect.Pulse" Class="glass" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card">
|
||||
<div class="d-flex flex-column mb-4 pb-2">
|
||||
<div class="align-self-end pl-2 pb-2">
|
||||
<DxButton Text="Column Chooser"
|
||||
RenderStyle="ButtonRenderStyle.Secondary"
|
||||
IconCssClass="btn-column-chooser"
|
||||
Click="ColumnChooserButton_Click" />
|
||||
</div>
|
||||
|
||||
<DxGrid @ref="Grid2"
|
||||
Data="TransferData"
|
||||
AutoCollapseDetailRow="AutoCollapseDetailRow"
|
||||
KeyboardNavigationEnabled="true"
|
||||
CustomizeElement="Grid_CustomizeElement"
|
||||
CustomizeEditModel="Grid_CustomizeEditModel"
|
||||
EditModelSaving="Grid_EditModelSaving"
|
||||
DataItemDeleting="Grid_DataItemDeleting"
|
||||
EditMode="GridEditMode.EditForm"
|
||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
ShowFilterRow="true"
|
||||
KeyFieldName="Id">
|
||||
<DxTabs>
|
||||
|
||||
<Columns>
|
||||
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="false" SortIndex="0" Visible="false" />
|
||||
<DxGridDataColumn FieldName="OrderId" />
|
||||
<DxGridDataColumn FieldName="FromAddress" />
|
||||
<DxGridDataColumn FieldName="ToAddress" />
|
||||
<DxGridDataColumn FieldName="Appointment" />
|
||||
<DxGridDataColumn FieldName="ContactName" />
|
||||
<DxGridDataColumn FieldName="ContactPhone" />
|
||||
<DxGridDataColumn FieldName="ContactEmail">
|
||||
<CellDisplayTemplate>
|
||||
<DxTabPage Text="DataGrid">
|
||||
<div class="d-flex flex-column mb-4 pb-2">
|
||||
<div class="align-self-end pl-2 pb-2">
|
||||
<DxButton Text="Column Chooser"
|
||||
RenderStyle="ButtonRenderStyle.Secondary"
|
||||
IconCssClass="btn-column-chooser"
|
||||
Click="ColumnChooserButton_Click" />
|
||||
</div>
|
||||
|
||||
<DxGrid @ref="Grid2"
|
||||
Data="TransferData"
|
||||
AutoCollapseDetailRow="AutoCollapseDetailRow"
|
||||
KeyboardNavigationEnabled="true"
|
||||
CustomizeElement="Grid_CustomizeElement"
|
||||
CustomizeEditModel="Grid_CustomizeEditModel"
|
||||
EditModelSaving="Grid_EditModelSaving"
|
||||
DataItemDeleting="Grid_DataItemDeleting"
|
||||
EditMode="GridEditMode.EditForm"
|
||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
ShowFilterRow="true"
|
||||
KeyFieldName="Id">
|
||||
|
||||
<Columns>
|
||||
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="false" SortIndex="0" Visible="false" />
|
||||
<DxGridDataColumn FieldName="OrderId" />
|
||||
<DxGridDataColumn FieldName="FromAddress" />
|
||||
<DxGridDataColumn FieldName="ToAddress" />
|
||||
<DxGridDataColumn FieldName="Appointment" DisplayFormat="f" />
|
||||
<DxGridDataColumn FieldName="FullName" />
|
||||
<DxGridDataColumn FieldName="ContactPhone" />
|
||||
<DxGridDataColumn FieldName="ContactEmail">
|
||||
<CellDisplayTemplate>
|
||||
@{
|
||||
var keyField = context.Value;
|
||||
var keyItem = (Transfer)context.DataItem;
|
||||
string buttonText = "Contact";
|
||||
<DxButton Click="() => SendMail(keyItem)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary" />
|
||||
}
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
<DxGridDataColumn FieldName="PassengerCount" />
|
||||
<DxGridDataColumn FieldName="TransferStatusType">
|
||||
<CellDisplayTemplate>
|
||||
@{
|
||||
|
||||
TransferStatusModel keyField = Statuses.FirstOrDefault(x => x.StatusValue == Convert.ToInt16(context.Value));
|
||||
string transferStatusText = keyField.StatusName;
|
||||
<p>@transferStatusText</p>
|
||||
}
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
<Grid_MasterDetail_NestedGrid_DetailContent Customer="(TIAM.Entities.Transfers.Transfer)context.DataItem" KeyboardNavigationEnabled="true" />
|
||||
</DetailRowTemplate>
|
||||
<EditFormTemplate Context="EditFormContext">
|
||||
@{
|
||||
var keyField = context.Value;
|
||||
var keyItem = (Transfer)context.DataItem;
|
||||
string buttonText = "Contact";
|
||||
<DxButton Click="() => SendMail(keyItem)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary" />
|
||||
var transfer2 = (Transfer)EditFormContext.EditModel;
|
||||
}
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
<DxGridDataColumn FieldName="PassengerCount" />
|
||||
<DxGridDataColumn FieldName="TransferStatusType">
|
||||
<CellDisplayTemplate>
|
||||
@{
|
||||
<DxFormLayout CssClass="w-100">
|
||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.FirstName) ColSpanMd="6">
|
||||
@EditFormContext.GetEditor("FirstName")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.LastName) ColSpanMd="6">
|
||||
@EditFormContext.GetEditor("LastName")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationAddress) ColSpanMd="6">
|
||||
@EditFormContext.GetEditor("ToAddress")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.PickupAddress) ColSpanMd="6">
|
||||
@EditFormContext.GetEditor("FromAddress")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Trip date:" ColSpanMd="6">
|
||||
|
||||
TransferStatusModel keyField = Statuses.FirstOrDefault(x => x.StatusValue == Convert.ToInt16(context.Value));
|
||||
string transferStatusText = keyField.StatusName;
|
||||
<p>@transferStatusText</p>
|
||||
}
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
<Grid_MasterDetail_NestedGrid_DetailContent Customer="(TIAM.Entities.Transfers.Transfer)context.DataItem" KeyboardNavigationEnabled="true" />
|
||||
</DetailRowTemplate>
|
||||
<EditFormTemplate Context="EditFormContext">
|
||||
@{
|
||||
var transfer2 = (Transfer)EditFormContext.EditModel;
|
||||
}
|
||||
<DxFormLayout CssClass="w-100">
|
||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationAddress) ColSpanMd="6">
|
||||
@EditFormContext.GetEditor("ToAddress")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.PickupAddress) ColSpanMd="6">
|
||||
@EditFormContext.GetEditor("FromAddress")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Trip date:" ColSpanMd="6">
|
||||
@EditFormContext.GetEditor("Appointment")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Passengers:" ColSpanMd="6">
|
||||
@EditFormContext.GetEditor("PassengerCount")
|
||||
</DxFormLayoutItem>
|
||||
<DxDateEdit @bind-Date="@transfer2.Appointment"
|
||||
TimeSectionVisible="true"
|
||||
TimeSectionScrollPickerFormat="tt h m">
|
||||
</DxDateEdit>
|
||||
|
||||
<DxFormLayoutItem Caption="Status:" ColSpanMd="6">
|
||||
@EditFormContext.GetEditor("TransferStatusType")
|
||||
</DxFormLayoutItem>
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Passengers:" ColSpanMd="6">
|
||||
@EditFormContext.GetEditor("PassengerCount")
|
||||
</DxFormLayoutItem>
|
||||
|
||||
<DxFormLayoutItem Caption="Status:" ColSpanMd="6">
|
||||
@EditFormContext.GetEditor("TransferStatusType")
|
||||
</DxFormLayoutItem>
|
||||
|
||||
</DxFormLayout>
|
||||
</EditFormTemplate>
|
||||
|
||||
|
||||
</DxGrid>
|
||||
|
||||
</div>
|
||||
</DxTabPage>
|
||||
|
||||
<DxTabPage Text="Calendar">
|
||||
<div class="d-flex flex-column mb-4 pb-2">
|
||||
<DxScheduler @bind-StartDate="@StartDate"
|
||||
DataStorage="@DataStorage"
|
||||
CssClass="w-100">
|
||||
<DxSchedulerTimelineView Duration="@TimeSpan.FromHours(48)" CellMinWidth="80">
|
||||
<Scales>
|
||||
<DxSchedulerTimeScale Unit="@SchedulerTimeScaleUnit.Day" UnitCount="1"></DxSchedulerTimeScale>
|
||||
<DxSchedulerTimeScale Unit="@SchedulerTimeScaleUnit.Hour" UnitCount="2"></DxSchedulerTimeScale>
|
||||
</Scales>
|
||||
</DxSchedulerTimelineView>
|
||||
<DxSchedulerWeekView ShowWorkTimeOnly="false"></DxSchedulerWeekView>
|
||||
<DxSchedulerDayView DayCount="1" ShowWorkTimeOnly="false"></DxSchedulerDayView>
|
||||
</DxScheduler>
|
||||
</div>
|
||||
</DxTabPage>
|
||||
</DxTabs>
|
||||
|
||||
</DxFormLayout>
|
||||
</EditFormTemplate>
|
||||
|
||||
|
||||
</DxGrid>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</Animation>
|
||||
</div>
|
||||
|
||||
|
|
@ -174,7 +216,10 @@
|
|||
|
||||
public MessageWizardModel messageWizardModel = new MessageWizardModel();
|
||||
|
||||
//IEnumerable<DriverModel> drivers { get; set; }
|
||||
public List<AppointmentModel>? AppoinmentData { get; set; }
|
||||
|
||||
DateTime StartDate { get; set; } = DateTime.Today;
|
||||
DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage();
|
||||
|
||||
|
||||
void SendMail(Transfer Item)
|
||||
|
|
@ -234,12 +279,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
//if (firstRender)
|
||||
// await Grid.StartEditRowAsync(0);
|
||||
}
|
||||
|
||||
void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||
{
|
||||
if (e.IsNew)
|
||||
|
|
@ -250,7 +289,8 @@
|
|||
transferEditModel.FromAddress = "From where?";
|
||||
transferEditModel.Appointment = DateTime.UtcNow.AddDays(3);
|
||||
transferEditModel.PassengerCount = 1;
|
||||
transferEditModel.ContactName = "Full name";
|
||||
transferEditModel.FirstName = "John";
|
||||
transferEditModel.LastName = "Doe";
|
||||
transferEditModel.ContactPhone = "+00000000000";
|
||||
transferEditModel.ContactEmail = "your@email.address";
|
||||
}
|
||||
|
|
@ -283,7 +323,7 @@
|
|||
// //transferToModify.Driver = myModel.Driver;
|
||||
// }
|
||||
// }
|
||||
if(success)
|
||||
if (success)
|
||||
await UpdateDataAsync();
|
||||
}
|
||||
async Task Grid_DataItemDeleting(GridDataItemDeletingEventArgs e)
|
||||
|
|
@ -315,6 +355,35 @@
|
|||
new TransferStatusModel(Convert.ToInt16(TransferStatusType.AdminDenied), "Admin cancelled")
|
||||
};
|
||||
TransferData = (await transferDataService.GetTransfersAsync()).OrderBy(x => x.TransferStatusType).ThenByDescending(x => x.OrderId).ToList();
|
||||
AppoinmentData = new List<AppointmentModel>();
|
||||
foreach (var transfer in TransferData)
|
||||
{
|
||||
// var bnm = DataStorage.CreateAppointmentItem();
|
||||
// bnm.Start = transfer.Appointment;
|
||||
// bnm.Description = $"{transfer.FullName}, {transfer.ToAddress}";
|
||||
// bnm.Location = transfer.FromAddress;
|
||||
// bnm.Subject = "Simple transfer";
|
||||
|
||||
AppoinmentData.Add(new AppointmentModel { StartDate = transfer.Appointment, EndDate=transfer.Appointment.AddMinutes(30), Description = $"{transfer.FullName}, {transfer.ToAddress}", Location = transfer.FromAddress, Caption = "Simple transfer" });
|
||||
}
|
||||
|
||||
DataStorage = new DxSchedulerDataStorage();
|
||||
DataStorage.AppointmentMappings = new DxSchedulerAppointmentMappings()
|
||||
{
|
||||
Type = "AppointmentType",
|
||||
Start = "StartDate",
|
||||
End = "EndDate",
|
||||
Subject = "Caption",
|
||||
AllDay = "AllDay",
|
||||
Location = "Location",
|
||||
Description = "Description",
|
||||
LabelId = "Label",
|
||||
StatusId = "Status",
|
||||
RecurrenceInfo = "Recurrence"
|
||||
};
|
||||
DataStorage.AppointmentsSource = AppoinmentData;
|
||||
|
||||
|
||||
base.OnInitialized();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,12 +21,13 @@
|
|||
@layout AdminLayout
|
||||
@inject LogToBrowserConsole logToBrowserConsole
|
||||
@inject IStringLocalizer<TIAMResources> localizer
|
||||
@inject ISessionService sessionService
|
||||
@inject IWizardProcessor wizardProcessor
|
||||
@inject IUserDataService userDataService
|
||||
<PageTitle>Transfers</PageTitle>
|
||||
|
||||
<div class="text-center m-5">
|
||||
<h1>Transfer management</h1>
|
||||
<h1>User management</h1>
|
||||
<h2 style="font-size:small">Manage transfers here!</h2>
|
||||
</div>
|
||||
|
||||
|
|
@ -85,7 +86,7 @@
|
|||
<Columns>
|
||||
<DxGridCommandColumn NewButtonVisible="false" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" ShowInColumnChooser="false" SortIndex="0" Visible="false" />
|
||||
<DxGridDataColumn FieldName="Profile.Name" />
|
||||
<DxGridDataColumn FieldName="Profile.FullName" />
|
||||
<DxGridDataColumn FieldName="UserDto.PhoneNumber" />
|
||||
<DxGridDataColumn FieldName="UserDto.Created" />
|
||||
<DxGridDataColumn FieldName="UserDto.EmailConfirmed" />
|
||||
|
|
@ -110,6 +111,9 @@
|
|||
var transfer2 = (UserModelDtoDetail)EditFormContext.EditModel;
|
||||
}
|
||||
<DxFormLayout CssClass="w-100">
|
||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.EmailAddress) ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("UserDto.EmailAddress")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.EmailAddress) ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("UserDto.EmailAddress")
|
||||
</DxFormLayoutItem>
|
||||
|
|
@ -119,8 +123,11 @@
|
|||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.PhoneNumber) ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("UserDto.PhoneNumber")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.FullName) ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("Profile.Name")
|
||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.FirstName) ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("Profile.FirstName")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.LastName) ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("Profile.LastName")
|
||||
</DxFormLayoutItem>
|
||||
|
||||
|
||||
|
|
@ -172,6 +179,11 @@
|
|||
var user = await userDataService.GetUserDetailByIdAsync(Item.Id);
|
||||
logToBrowserConsole.LogToBC($"Sending mail to {user.UserDto.EmailAddress}");
|
||||
|
||||
messageWizardModel.ReceiverId = user.Id;
|
||||
messageWizardModel.ReceiverEmailAddress = user.UserDto.EmailAddress;
|
||||
messageWizardModel.SenderId = sessionService.User.UserId;
|
||||
messageWizardModel.SenderEmailAddress = sessionService.User.Email;
|
||||
logToBrowserConsole.LogToBC($"Sending mail to {messageWizardModel.ReceiverEmailAddress} from {messageWizardModel.SenderId}");
|
||||
PopupVisible = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,122 @@
|
|||
@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
|
||||
@inject IUserDataService NwindDataService
|
||||
@inject IServiceProviderDataService serviceProviderDataService
|
||||
@inject LogToBrowserConsole logToBrowserConsole
|
||||
|
||||
<div class="mb-2">
|
||||
UserProductMapping
|
||||
</div>
|
||||
<DxGrid Data="DetailGridData"
|
||||
PageSize="5"
|
||||
AutoExpandAllGroupRows="true"
|
||||
KeyboardNavigationEnabled="KeyboardNavigationEnabled"
|
||||
KeyFieldName="Id"
|
||||
ValidationEnabled="false"
|
||||
CustomizeEditModel="CustomizeEditModel"
|
||||
EditModelSaving="EditModelSaving"
|
||||
DataItemDeleting="DataItemDeleting"
|
||||
EditMode="GridEditMode.EditForm"
|
||||
ColumnResizeMode="GridColumnResizeMode.NextColumn"
|
||||
ShowFilterRow="true">
|
||||
<Columns>
|
||||
<DxGridCommandColumn NewButtonVisible="true" Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
|
||||
<DxGridDataColumn FieldName="Id" GroupIndex="0" />
|
||||
<DxGridDataColumn FieldName="UserId" />
|
||||
<DxGridDataColumn FieldName="ProductId" Width="40%" />
|
||||
<DxGridDataColumn FieldName="Permissions" />
|
||||
</Columns>
|
||||
<EditFormTemplate Context="EditFormContext">
|
||||
@{
|
||||
var transfer2 = (UserProductMapping)EditFormContext.EditModel;
|
||||
}
|
||||
<DxFormLayout CssClass="w-100">
|
||||
<DxFormLayoutItem Caption="UserId" ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("UserId")
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Product:" ColSpanMd="4">
|
||||
<DxComboBox Data="@AvailableServices" TextFieldName="Name" @bind-Value="((UserProductMapping)EditFormContext.EditModel).ProductId" />
|
||||
</DxFormLayoutItem>
|
||||
<DxFormLayoutItem Caption="Permissions" ColSpanMd="4">
|
||||
@EditFormContext.GetEditor("Permissions")
|
||||
</DxFormLayoutItem>
|
||||
|
||||
|
||||
|
||||
</DxFormLayout>
|
||||
</EditFormTemplate>
|
||||
|
||||
</DxGrid>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public bool KeyboardNavigationEnabled { get; set; }
|
||||
[Parameter]
|
||||
public UserModelDtoDetail Customer { get; set; }
|
||||
|
||||
List<TiamServiceProvider> DetailGridData;
|
||||
|
||||
List<TiamServiceProvider> AvailableServices;
|
||||
|
||||
public UserModelDtoDetail UserInfo;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
//get userproductmappings by customer id
|
||||
if (Customer.ServiceProviders == null)
|
||||
DetailGridData = new List<TiamServiceProvider>();
|
||||
else
|
||||
DetailGridData = Customer.ServiceProviders;
|
||||
|
||||
AvailableServices = await serviceProviderDataService.GetServiceProvidersAsync();
|
||||
logToBrowserConsole.LogToBC($"DetailGridData: {DetailGridData.Count}");
|
||||
}
|
||||
|
||||
void CustomizeEditModel(GridCustomizeEditModelEventArgs e)
|
||||
{
|
||||
if (e.IsNew)
|
||||
{
|
||||
UserProductMapping newProductMapping = new UserProductMapping();
|
||||
newProductMapping.ProductId = Guid.NewGuid();
|
||||
newProductMapping.UserId = Customer.Id;
|
||||
newProductMapping.Permissions = 1;
|
||||
|
||||
e.EditModel = newProductMapping;
|
||||
}
|
||||
}
|
||||
|
||||
async Task EditModelSaving(GridEditModelSavingEventArgs e)
|
||||
{
|
||||
if (e.IsNew)
|
||||
//add new orderData to orderData array
|
||||
logToBrowserConsole.LogToBC("New orderData added");
|
||||
//await NwindDataService.InsertEmployeeAsync((EditableEmployee)e.EditModel);
|
||||
else
|
||||
logToBrowserConsole.LogToBC("orderData updated");
|
||||
|
||||
//await NwindDataService.UpdateEmployeeAsync((EditableEmployee)e.DataItem, (EditableEmployee)e.EditModel);
|
||||
|
||||
await UpdateDataAsync();
|
||||
}
|
||||
async Task DataItemDeleting(GridDataItemDeletingEventArgs e)
|
||||
{
|
||||
//await NwindDataService.RemoveEmployeeAsync((EditableEmployee)e.DataItem);
|
||||
//remove orderData from orderData array
|
||||
logToBrowserConsole.LogToBC("orderData deleted");
|
||||
//await UpdateDataAsync();
|
||||
}
|
||||
async Task UpdateDataAsync()
|
||||
{
|
||||
//DataSource = await NwindDataService.GetEmployeesEditableAsync();
|
||||
//refresh grid
|
||||
logToBrowserConsole.LogToBC("orderData grid refreshed");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -60,10 +60,9 @@ select {
|
|||
|
||||
.card {
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.57 );
|
||||
-webkit-box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.57 );
|
||||
|
||||
overflow: hidden;
|
||||
min-height: 300px;
|
||||
/*min-height: 300px;*/
|
||||
background-color: rgba( 255, 255, 255, 0.15 );
|
||||
/*color: #58457b;*/
|
||||
font-size: small;
|
||||
|
|
@ -75,6 +74,8 @@ select {
|
|||
background: rgba( 255, 255, 255, 0.25 ) !important;
|
||||
backdrop-filter: blur( 8px );
|
||||
-webkit-backdrop-filter: blur( 8px );
|
||||
box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.57 );
|
||||
-webkit-box-shadow: 0 8px 32px 0 rgba( 31, 38, 135, 0.57 );
|
||||
--dxbl-fl-caption-color: #fff !important;
|
||||
/*color: #58457b;*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace TIAMWebApp.Client.Services
|
|||
public async Task<UserSessionModel> IsLoggedInAsync(Guid id)
|
||||
{
|
||||
//api call to get user
|
||||
var userModelDto = await GetUserByIdAsync(id);
|
||||
var userModelDto = await GetUserDetailByIdAsync(id);
|
||||
|
||||
if (userModelDto != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using AyCode.Interfaces.Enums;
|
||||
using AyCode.Interfaces.Messages;
|
||||
using AyCode.Models.Messages;
|
||||
using System.Diagnostics;
|
||||
using TIAM.Entities.Transfers;
|
||||
using TIAM.Entities.Emails;
|
||||
//using TIAM.Entities.TransferDestinations;
|
||||
using TIAMWebApp.Shared.Application.Interfaces;
|
||||
using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
|
||||
|
|
@ -40,7 +40,8 @@ namespace TIAMWebApp.Client.Services
|
|||
return transferResult as TModelType;
|
||||
|
||||
case "MessageWizardModel":
|
||||
var messageResult = await MessageSenderService.SendNoticeAsync((EmailMessage)data, 1);
|
||||
EmailMessage emailMessage = ((MessageWizardModel)data).CopyToEmailMessage();
|
||||
var messageResult = await MessageSenderService.SendNoticeAsync(emailMessage, 1);
|
||||
return messageResult as TModelType;
|
||||
|
||||
case "ServiceProvider":
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ using TIAMWebApp.Shared.Application.Models.ClientSide.Messages;
|
|||
using AyCode.Models.Messages;
|
||||
using AyCode.Models.Enums;
|
||||
using TIAM.Database.DataLayers.Admins;
|
||||
using TIAM.Models.Dtos.Users;
|
||||
|
||||
namespace TIAMWebApp.Server.Controllers
|
||||
{
|
||||
|
|
@ -56,19 +57,22 @@ namespace TIAMWebApp.Server.Controllers
|
|||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[Route("SendEmail")]
|
||||
public async Task<IActionResult> SendEmail([FromBody] EmailMessageSenderModel SerializedMessageSenderModel)
|
||||
[Route(APIUrls.SendEmailRouteName)]
|
||||
public async Task<IActionResult> SendEmail([FromBody] JsonElement SerializedMessageSenderModel)
|
||||
{
|
||||
Console.WriteLine("SendEmail called!");
|
||||
var message = JObject.Parse(SerializedMessageSenderModel.GetRawText()).ToObject<MessageSenderModel<EmailMessage>>();
|
||||
|
||||
if (SerializedMessageSenderModel != null)
|
||||
if (message != null)
|
||||
{
|
||||
|
||||
if (SerializedMessageSenderModel.MessageType == MessageTypesEnum.email && SerializedMessageSenderModel.Message is EmailMessage)
|
||||
if (message.MessageType == MessageTypesEnum.email)
|
||||
{
|
||||
|
||||
Console.WriteLine($"EmailMessage!!!");
|
||||
|
||||
var result = await _messageSenderService.SendMessageAsync(SerializedMessageSenderModel.Message, (int)SerializedMessageSenderModel.MessageType);
|
||||
var messageElement = message.Message;
|
||||
Console.WriteLine(message.Message);
|
||||
var result = await _messageSenderService.SendMessageAsync(messageElement, (int)message.MessageType);
|
||||
//_adminDal.AddEmailMessageAsync((TIAM.Entities.Emails.EmailMessage)SerializedMessageSenderModel.Message);
|
||||
Console.WriteLine("SendEmail result: " + result);
|
||||
return Ok(result);
|
||||
|
|
@ -328,11 +328,10 @@ namespace TIAMWebApp.Server.Controllers
|
|||
if (user != null)
|
||||
{
|
||||
var userId = user.Id;
|
||||
var email = user.Email;
|
||||
var phoneNumber = user.PhoneNumber;
|
||||
var password = user.Password;
|
||||
var email = user.UserDto.EmailAddress;
|
||||
var phoneNumber = user.UserDto.PhoneNumber;
|
||||
|
||||
if (email is null || phoneNumber is null || password is null)
|
||||
if (email is null || phoneNumber is null)
|
||||
{
|
||||
return BadRequest("Invalid request");
|
||||
}
|
||||
|
|
@ -341,9 +340,8 @@ namespace TIAMWebApp.Server.Controllers
|
|||
Console.WriteLine($"User to be updated: {userId}");
|
||||
Console.WriteLine($"User to be updated: {email}");
|
||||
Console.WriteLine($"User to be updated: {phoneNumber}");
|
||||
Console.WriteLine($"User to be updated: {password}");
|
||||
|
||||
await _userDal.UpdateUserAsync(new User(userId, email, phoneNumber, password));
|
||||
await _userDal.UpdateUserAsync(new User(userId, email, phoneNumber));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using AyCode.Models.Enums;
|
|||
using AyCode.Entities.Messages;
|
||||
using AyCode.Models.Messages;
|
||||
using TIAM.Database.DataLayers.Users;
|
||||
using TIAMWebApp.Shared.Application.Models.ClientSide.Messages;
|
||||
|
||||
|
||||
namespace TIAMWebApp.Server.Services
|
||||
|
|
@ -27,12 +28,12 @@ namespace TIAMWebApp.Server.Services
|
|||
switch (messageType)
|
||||
{
|
||||
case (int)MessageTypesEnum.email:
|
||||
if (message is EmailMessage emailMessage)
|
||||
if (message is MessageSenderModel<EmailMessage> emailMessage)
|
||||
{
|
||||
Console.WriteLine($"EmailMessage!!!");
|
||||
// Access DerivedClass properties
|
||||
var _subject = emailMessage.Subject;
|
||||
result = await SendMailWithSendgrid(emailMessage);
|
||||
var _subject = emailMessage.Message.Subject;
|
||||
result = await SendMailWithSendgrid(emailMessage.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using AyCode.Interfaces.Messages;
|
||||
using TIAM.Entities.Emails;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
@ -10,7 +11,7 @@ namespace TIAMWebApp.Shared.Application.Interfaces
|
|||
{
|
||||
public interface IClientNoticeSenderService
|
||||
{
|
||||
public Task<string> SendNoticeAsync<TNotice>(TNotice message, int messageType) where TNotice : class, INoticeBase;
|
||||
public Task<string> SendNoticeAsync<TNotice>(TNotice message, int messageType) where TNotice : EmailMessage;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ namespace TIAMWebApp.Shared.Application.Models
|
|||
public const string ServiceProviderAPI = BaseUrlWithSlashAndVersion + "ServiceProviderAPI/";
|
||||
public const string UserPermissionAPI = BaseUrlWithSlashAndVersion + "UserPermissionAPI/";
|
||||
public const string FileAPI = BaseUrlWithSlashAndVersion + "FileAPI/";
|
||||
public const string MessageAPI = BaseUrlWithSlashAndVersion + "MessageAPI/";
|
||||
|
||||
//userdata
|
||||
public const string UserTestRouteName = "test1";
|
||||
|
|
@ -150,5 +151,9 @@ namespace TIAMWebApp.Shared.Application.Models
|
|||
public const string GetImageRouteName = "GetImage";
|
||||
public const string GetImage = FileAPI+GetImageRouteName;
|
||||
|
||||
//email
|
||||
public const string SendEmailRouteName = "SendEmail";
|
||||
public const string SendEmail = MessageAPI+SendEmailRouteName;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AyCode.Models.Messages;
|
||||
using TIAM.Entities.Emails;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Models.ClientSide.Messages
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|||
public Guid ContextId { get; set; }
|
||||
[Required(ErrorMessage = "The subject value should be specified.")]
|
||||
[DataType(DataType.Text)]
|
||||
[Display(Name = "Subject", ResourceType = typeof(TIAMResources))]
|
||||
[Display(Name = ResourceKeys.Subject, ResourceType = typeof(TIAMResources))]
|
||||
public string Subject { get; set; }
|
||||
[Required(ErrorMessage = "The content value should be specified.")]
|
||||
[DataType(DataType.MultilineText)]
|
||||
|
|
@ -38,23 +38,5 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|||
Subject = subject;
|
||||
Content = content;
|
||||
}
|
||||
|
||||
public static EmailMessage ConvertToNewEmailMessage(MessageWizardModel message)
|
||||
{
|
||||
var id = Guid.NewGuid();
|
||||
|
||||
|
||||
return new EmailMessage
|
||||
{
|
||||
Id = id,
|
||||
SenderId = message.SenderId,
|
||||
ContextId = message.ContextId,
|
||||
Subject = message.Subject,
|
||||
Text = message.Content,
|
||||
EmailAddress = message.SenderEmailAddress,
|
||||
Recipients = new List<EmailRecipient> { new EmailRecipient(
|
||||
Guid.NewGuid(), message.ReceiverId, id, "recipient@aycode.com") }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TIAM.Entities.Emails;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||
{
|
||||
public static class MessageWizardModelExtensions
|
||||
{
|
||||
|
||||
public static MessageWizardModel Clone(this MessageWizardModel obj)
|
||||
{
|
||||
return new MessageWizardModel()
|
||||
{
|
||||
ReceiverEmailAddress = obj.ReceiverEmailAddress,
|
||||
ReceiverId = obj.ReceiverId,
|
||||
SenderEmailAddress = obj.SenderEmailAddress,
|
||||
SenderId = obj.SenderId,
|
||||
ContextId = obj.ContextId,
|
||||
Subject = obj.Subject,
|
||||
Content = obj.Content
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static EmailMessage CopyToEmailMessage(this MessageWizardModel obj)
|
||||
{
|
||||
var id = Guid.NewGuid();
|
||||
|
||||
return new EmailMessage
|
||||
{
|
||||
Id = id,
|
||||
SenderId = obj.SenderId,
|
||||
ContextId = obj.ContextId,
|
||||
Subject = obj.Subject,
|
||||
Text = obj.Content,
|
||||
EmailAddress = obj.SenderEmailAddress,
|
||||
Recipients = new List<EmailRecipient> { new EmailRecipient(
|
||||
Guid.NewGuid(), obj.ReceiverId, id, "recipient@aycode.com") }
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -23,8 +23,6 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|||
|
||||
public Guid? ReferralId { get; set; }
|
||||
|
||||
public string ? Comment { get; set; }
|
||||
|
||||
#region wizard fields
|
||||
[Destination(ErrorMessage = "The destination value is invalid.")]
|
||||
[DataType("TransferDestination")]
|
||||
|
|
@ -36,6 +34,11 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|||
[Display(Name = ResourceKeys.PickupAddress, ResourceType = typeof(TIAMResources))]
|
||||
public string? PickupAddress { get; set; }
|
||||
|
||||
//Flight number
|
||||
[DataType(DataType.Text)]
|
||||
[Display(Name = ResourceKeys.FlightNumber + " " + ResourceKeys.Optional, ResourceType = typeof(TIAMResources))]
|
||||
public string? FlightNumber { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "The pickup time should be specified.")]
|
||||
[DataType(DataType.Date)]
|
||||
[Display(Name = ResourceKeys.PickupTime, ResourceType = typeof(TIAMResources))]
|
||||
|
|
@ -46,11 +49,19 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|||
[Display(Name = ResourceKeys.NumberOfPassengers, ResourceType = typeof(TIAMResources))]
|
||||
public int NumberOfPassengers { get; set; } = 1;
|
||||
|
||||
[Required(ErrorMessage = "The amount of luggage should be specified.")]
|
||||
[DataType("Int")]
|
||||
[Display(Name = ResourceKeys.NumberOfLuggage, ResourceType = typeof(TIAMResources))]
|
||||
public int NumberOfLuggage { get; set; } = 1;
|
||||
|
||||
//full name
|
||||
[Required(ErrorMessage = "The full name should be specified.")]
|
||||
[DataType(DataType.Text)]
|
||||
[Required(ErrorMessage = "The name should be specified.")]
|
||||
[DataType("FullName")]
|
||||
[Display(Name = ResourceKeys.FullName, ResourceType = typeof(TIAMResources))]
|
||||
public string? FullName { get; set; }
|
||||
public string? FullName => GetFullName();
|
||||
|
||||
public string? FirstName { get; set; }
|
||||
public string? LastName { get; set; }
|
||||
|
||||
//phone number
|
||||
[Required(ErrorMessage = "The phone number should be specified.")]
|
||||
|
|
@ -68,6 +79,10 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|||
[Display(Name = ResourceKeys.Price, ResourceType = typeof(TIAMResources))]
|
||||
public double? Price { get; set;}
|
||||
|
||||
[DataType(DataType.MultilineText)]
|
||||
[Display(Name = ResourceKeys.Comment, ResourceType = typeof(TIAMResources))]
|
||||
public string? Comment { get; set; }
|
||||
|
||||
//[DataType("Driver")]
|
||||
//[Display(Name = ResourceKeys.Driver, ResourceType = typeof(TIAMResources))]
|
||||
//public DriverModel Driver { get; set; }
|
||||
|
|
@ -83,38 +98,43 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|||
PickupAddress = pickupAddress;
|
||||
}
|
||||
|
||||
public TransferWizardModel(string destination, string pickupAddress, DateTime tripDate, int numberOfPassengers, string fullName, string phoneNumber, string emailAddress) : this(Guid.NewGuid(), destination, pickupAddress, tripDate, numberOfPassengers, fullName, phoneNumber, emailAddress) { }
|
||||
public TransferWizardModel(string destination, string pickupAddress, DateTime tripDate, int numberOfPassengers, string firstName, string lastName, string phoneNumber, string emailAddress) : this(Guid.NewGuid(), destination, pickupAddress, tripDate, numberOfPassengers, firstName, lastName, phoneNumber, emailAddress) { }
|
||||
|
||||
|
||||
public TransferWizardModel(Guid id, string destination, string pickupAddress, DateTime tripDate, int numberOfPassengers, string fullName, string phoneNumber, string emailAddress)
|
||||
public TransferWizardModel(Guid id, string destination, string pickupAddress, DateTime tripDate, int numberOfPassengers, string firstName, string lastName, string phoneNumber, string emailAddress)
|
||||
{
|
||||
Id = id;
|
||||
Destination = destination;
|
||||
PickupAddress = pickupAddress;
|
||||
TripDate = tripDate;
|
||||
NumberOfPassengers = numberOfPassengers;
|
||||
FullName = fullName;
|
||||
FirstName = firstName;
|
||||
LastName = lastName;
|
||||
PhoneNumber = phoneNumber;
|
||||
EmailAddress = emailAddress;
|
||||
}
|
||||
|
||||
public TransferWizardModel(string destination, string pickupAddress, DateTime tripDate, int numberOfPassengers, string fullName, string phoneNumber, string emailAddress, DriverModel driver) : this(Guid.NewGuid(), destination, pickupAddress, tripDate, numberOfPassengers, fullName, phoneNumber, emailAddress, driver) { }
|
||||
public TransferWizardModel(string destination, string pickupAddress, DateTime tripDate, int numberOfPassengers, string firstName, string lastName, string phoneNumber, string emailAddress, DriverModel driver) : this(Guid.NewGuid(), destination, pickupAddress, tripDate, numberOfPassengers, firstName, lastName, phoneNumber, emailAddress, driver) { }
|
||||
|
||||
|
||||
public TransferWizardModel(Guid id, string destination, string pickupAddress, DateTime tripDate, int numberOfPassengers, string fullName, string phoneNumber, string emailAddress, DriverModel driver)
|
||||
public TransferWizardModel(Guid id, string destination, string pickupAddress, DateTime tripDate, int numberOfPassengers, string firstName, string lastName, string phoneNumber, string emailAddress, DriverModel driver)
|
||||
{
|
||||
Id = id;
|
||||
Destination = destination;
|
||||
PickupAddress = pickupAddress;
|
||||
TripDate = tripDate;
|
||||
NumberOfPassengers = numberOfPassengers;
|
||||
FullName = fullName;
|
||||
FirstName = firstName;
|
||||
LastName = lastName;
|
||||
PhoneNumber = phoneNumber;
|
||||
EmailAddress = emailAddress;
|
||||
//Driver = driver;
|
||||
}
|
||||
|
||||
|
||||
public string GetFullName()
|
||||
{
|
||||
return FirstName + " " + LastName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,10 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|||
PickupAddress = obj.PickupAddress,
|
||||
TripDate = obj.TripDate,
|
||||
NumberOfPassengers = obj.NumberOfPassengers,
|
||||
FullName = obj.FullName,
|
||||
NumberOfLuggage = obj.NumberOfLuggage,
|
||||
FlightNumber = obj.FlightNumber,
|
||||
FirstName = obj.FirstName,
|
||||
LastName = obj.LastName,
|
||||
PhoneNumber = obj.PhoneNumber,
|
||||
EmailAddress = obj.EmailAddress,
|
||||
Price = obj.Price,
|
||||
|
|
@ -43,10 +46,12 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|||
FromAddress = obj.PickupAddress,
|
||||
Appointment = obj.TripDate,
|
||||
PassengerCount = Convert.ToByte(obj.NumberOfPassengers),
|
||||
ContactName = obj.FullName,
|
||||
FirstName = obj.FirstName,
|
||||
LastName = obj.LastName,
|
||||
ContactPhone = obj.PhoneNumber,
|
||||
ContactEmail = obj.EmailAddress,
|
||||
Price = obj.Price,
|
||||
LuggageCount = Convert.ToByte(obj.NumberOfLuggage),
|
||||
//UserProductMappingId = Guid.NewGuid(),
|
||||
TransferStatusType = TIAM.Core.Enums.TransferStatusType.OrderSubmitted,
|
||||
Comment = "Transfer order",
|
||||
|
|
@ -55,5 +60,10 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|||
|
||||
return transfer;
|
||||
}
|
||||
|
||||
public static string GetFullName(this TransferWizardModel obj)
|
||||
{
|
||||
return obj.FirstName + " " + obj.LastName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Models.PageModels
|
||||
{
|
||||
|
||||
public class AppointmentModel
|
||||
{
|
||||
public AppointmentModel() { }
|
||||
public int AppointmentType { get; set; }
|
||||
public DateTime StartDate { get; set; }
|
||||
public DateTime EndDate { get; set; }
|
||||
public string Caption { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Location { get; set; }
|
||||
public int? Label { get; set; }
|
||||
public int Status { get; set; }
|
||||
public bool AllDay { get; set; }
|
||||
public string Recurrence { get; set; }
|
||||
public int? ResourceId { get; set; }
|
||||
public bool Accepted { get; set; }
|
||||
|
||||
public AppointmentModel(int appointmentType, DateTime startDate, DateTime endDate, string caption, string description, string location, int? label, int status, bool allDay, string recurrence, int? resourceId, bool accepted)
|
||||
{
|
||||
AppointmentType = appointmentType;
|
||||
StartDate = startDate;
|
||||
EndDate = endDate;
|
||||
Caption = caption;
|
||||
Description = description;
|
||||
Location = location;
|
||||
Label = label;
|
||||
Status = status;
|
||||
AllDay = allDay;
|
||||
Recurrence = recurrence;
|
||||
ResourceId = resourceId;
|
||||
Accepted = accepted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using AyCode.Models.Messages;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using TIAM.Entities.Users;
|
||||
using TIAM.Models.Dtos.Users;
|
||||
|
|
@ -8,8 +9,10 @@ namespace TIAMWebApp.Shared.Application.Models
|
|||
public class UserSessionModel
|
||||
{
|
||||
//TODO: add user class
|
||||
public UserModelDto UserModelDto { get; set; }
|
||||
public UserModelDtoDetail UserModelDto { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
public string Email => UserModelDto.UserDto.EmailAddress;
|
||||
public UserType UserType { get; set; }
|
||||
public string? UserName => UserModelDto?.Profile?.Name;
|
||||
public string DisplayName => string.IsNullOrWhiteSpace(UserName) ? UserId.ToString() : UserName;
|
||||
|
|
@ -18,7 +21,7 @@ namespace TIAMWebApp.Shared.Application.Models
|
|||
public int UserRoles { get; set; }
|
||||
public Dictionary<int, string> UserRolesDictionary { get; set; }
|
||||
|
||||
public UserSessionModel(Guid userId, UserType userType, UserModelDto userModelDto, Dictionary<Guid, string>? hasProperties, int userRoles)
|
||||
public UserSessionModel(Guid userId, UserType userType, UserModelDtoDetail userModelDto, Dictionary<Guid, string>? hasProperties, int userRoles)
|
||||
{
|
||||
UserId = userId;
|
||||
UserType = userType;
|
||||
|
|
|
|||
|
|
@ -3,15 +3,67 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TIAM.Entities.Transfers;
|
||||
using TIAMWebApp.Shared.Application.Interfaces;
|
||||
using static System.Net.WebRequestMethods;
|
||||
using TIAMWebApp.Shared.Application.Models.ClientSide;
|
||||
using TIAMWebApp.Shared.Application.Models;
|
||||
using System.Net.Http.Json;
|
||||
//using AyCode.Models.Messages;
|
||||
using TIAM.Entities.Emails;
|
||||
using TIAMWebApp.Shared.Application.Utility;
|
||||
using TIAMWebApp.Shared.Application.Models.ClientSide.Messages;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Services
|
||||
{
|
||||
public class ClientNoticeSenderService : IClientNoticeSenderService
|
||||
{
|
||||
Task<string> IClientNoticeSenderService.SendNoticeAsync<TNotice>(TNotice message, int messageType)
|
||||
private readonly HttpClient http;
|
||||
|
||||
public ClientNoticeSenderService(HttpClient http)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
this.http = http;
|
||||
}
|
||||
|
||||
public async Task<string> SendNoticeAsync<TNotice>(TNotice message, int messageType) where TNotice : TIAM.Entities.Emails.EmailMessage
|
||||
{
|
||||
var url = $"{Setting.ApiBaseUrl}/{APIUrls.SendEmail}";
|
||||
|
||||
|
||||
if (message != null)
|
||||
{
|
||||
EmailMessage? bleh = new EmailMessage();
|
||||
bleh.Subject = message.Subject;
|
||||
bleh.SenderId = message.SenderId;
|
||||
|
||||
|
||||
if(messageType == (int)AyCode.Models.Enums.MessageTypesEnum.email)
|
||||
{
|
||||
MessageSenderModel<EmailMessage> messageModel = new EmailMessageSenderModel(bleh, (AyCode.Models.Enums.MessageTypesEnum)messageType);
|
||||
|
||||
messageModel.Message = message as EmailMessage;
|
||||
|
||||
var response = await http.PostAsJsonAsync(url, messageModel);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
return null;
|
||||
|
||||
var result = (string)(await response.Content.ReadFromJsonAsync(typeof(string)));
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return "Error sending the message";
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return "Error sending the message";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@
|
|||
public const string ButtonDelete = "ButtonDelete";
|
||||
public const string ButtonEdit = "ButtonEdit";
|
||||
public const string FullName = "FullName";
|
||||
public const string FirstName = "FirstName";
|
||||
public const string LastName = "LastName";
|
||||
public const string Comment = "Comment";
|
||||
public const string EmailAddress = "EmailAddress";
|
||||
public const string PhoneNumber = "PhoneNumber";
|
||||
public const string Password = "Password";
|
||||
|
|
@ -45,11 +48,17 @@
|
|||
public const string Destination = "Destination";
|
||||
public const string PickupTime = "PickupTime";
|
||||
public const string NumberOfPassengers = "NumberOfPassengers";
|
||||
public const string NumberOfLuggage = "NumberOfLuggage";
|
||||
public const string FlightNumber = "FlightNumber";
|
||||
public const string Optional = "Optional";
|
||||
|
||||
public const string ProductType = "ProductType";
|
||||
public const string ProductName = "ProductName";
|
||||
public const string ProductDescription = "ProductDescription";
|
||||
|
||||
public const string Subject = "Subject";
|
||||
public const string HtmlContent = "HtmlContent";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue