Skip to content

Commit

Permalink
living situation / family approval / nationality
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhiogo Acioli committed Oct 12, 2024
1 parent 2d2d6a1 commit 70b5ab2
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 20 deletions.
14 changes: 14 additions & 0 deletions MM.Shared/Enums/FamilyApproval.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace MM.Shared.Enums
{
public enum FamilyApproval
{
[Custom(Name = "No", Description = "The family does not influence or participate in partner decisions.")]
No = 1,

[Custom(Name = "Yes (Partially)", Description = "The family has some influence or provides input, but the final decision is shared.")]
YesModerate = 3,

[Custom(Name = "Yes (Fully)", Description = "The family has significant influence or makes the final decision regarding the partner.")]
YesHeavy = 4
}
}
23 changes: 23 additions & 0 deletions MM.Shared/Enums/LivingSituation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace MM.Shared.Enums
{
public enum LivingSituation
{
[Custom(Name = "Alone", Description = "Lives independently, without other people in the household.")]
Alone = 1,

[Custom(Name = "With Family", Description = "Shares a household with family members, such as parents, siblings, or extended relatives.")]
WithFamily = 2,

[Custom(Name = "With Friends", Description = "Shares a living space with friends or close acquaintances.")]
WithFriends = 3,

[Custom(Name = "With Ex-Partner", Description = "Continues to live with a former romantic partner.")]
WithExPartner = 4,

[Custom(Name = "With Roommates", Description = "Shares living arrangements with individuals who are neither family nor close friends.")]
WithRoommates = 5,

[Custom(Name = "Other", Description = "Has a different living situation that doesn't fit common categories.")]
Other = 9
}
}
9 changes: 9 additions & 0 deletions MM.Shared/Models/Profile/ProfileModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public class ProfileModel : CosmosDocument
[Custom(Name = "Description_Name", Prompt = "Description_Prompt", ResourceType = typeof(Resources.ProfileBasicModel))]
public string? Description { get; set; }

[Custom(Name = "Nationality")]
public Country? Nationality { get; set; }

[JsonIgnore]
[Custom(Name = "Location_Name", Prompt = "Location_Prompt", Description = "Location_Description", ResourceType = typeof(Resources.ProfileBasicModel))]
public string? Location => Country.NotEmpty() ? $"{Country} - {State} - {City}" : null;
Expand Down Expand Up @@ -101,9 +104,15 @@ public class ProfileModel : CosmosDocument
ResourceType = typeof(Resources.ProfileLifestyleModel))]
public Religion? Religion { get; set; }

[Custom(Name = "Family Approval", Description = "There is influence from the family in the choice of partners and/or relationships")]
public FamilyApproval? FamilyApproval { get; set; }

[Custom(Name = "TravelFrequency_Name", ResourceType = typeof(Resources.ProfileLifestyleModel))]
public TravelFrequency? TravelFrequency { get; set; }

[Custom(Name = "Living Situation")]
public LivingSituation? LivingSituation { get; set; }

[Custom(Name = "NetWorth_Name", Description = "NetWorth_Description", ResourceType = typeof(Resources.ProfileLifestyleModel))]
public NetWorth? NetWorth { get; set; }

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions MM.Shared/Models/Profile/Resources/ProfileBasicModel.es.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@
<data name="Languages_Name" xml:space="preserve">
<value>Idiomas</value>
</data>
<data name="Location_Description" xml:space="preserve">
<value>No almacenamos su ubicación GPS, solo su ciudad. (El acceso a la ubicación del dispositivo debe ser liberado)</value>
</data>
<data name="Location_Name" xml:space="preserve">
<value>Ubicación</value>
</data>
Expand All @@ -168,4 +165,7 @@
<data name="SexualOrientation_Name" xml:space="preserve">
<value>Orientación sexual</value>
</data>
<data name="Location_Description" xml:space="preserve">
<value>No almacenamos su ubicación GPS, solo su ciudad. (El acceso a la ubicación del dispositivo debe estar habilitado)</value>
</data>
</root>
6 changes: 3 additions & 3 deletions MM.Shared/Models/Profile/Resources/ProfileBasicModel.pt.resx
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,6 @@
<data name="Languages_Name" xml:space="preserve">
<value>Idiomas</value>
</data>
<data name="Location_Description" xml:space="preserve">
<value>Não armazenamos sua localização GPS, apenas sua cidade. (deve-se liberar acesso a localização do aparelho)</value>
</data>
<data name="Location_Name" xml:space="preserve">
<value>Localização</value>
</data>
Expand All @@ -168,4 +165,7 @@
<data name="SexualOrientation_Name" xml:space="preserve">
<value>Orientação Sexual</value>
</data>
<data name="Location_Description" xml:space="preserve">
<value>Não armazenamos sua localização no GPS, apenas sua cidade. (O acesso à localização do dispositivo deve estar ativado)</value>
</data>
</root>
2 changes: 1 addition & 1 deletion MM.Shared/Models/Profile/Resources/ProfileBasicModel.resx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
<value>Languages</value>
</data>
<data name="Location_Description" xml:space="preserve">
<value>We don't store your GPS location, just your city. (Access to device location must be released)</value>
<value>We do not store your GPS location, only your city. (Device location access must be enabled)</value>
</data>
<data name="Location_Name" xml:space="preserve">
<value>Location</value>
Expand Down
5 changes: 3 additions & 2 deletions MM.WEB/Modules/Profile/Core/DataHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ namespace MM.WEB.Modules.Profile.Core
{
public static class DataHelper
{
public static void AddLanguages(this ProfileModel profile, Country country)
public static void AddLanguages(this ProfileModel profile, Country? country)
{
if (profile.Languages.Any()) return;
if (profile.Languages.Count != 0) return;
if (country == null) return;

switch (country)
{
Expand Down
20 changes: 17 additions & 3 deletions MM.WEB/Modules/Profile/ProfileData.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@page "/profile/data"
@using MM.Shared.Models.Profile;
@using MM.WEB.Modules.Profile.Components
@using MM.WEB.Modules.Profile.Core
@using MM.WEB.Modules.Shared.Popup;
@attribute [Authorize]
@inherits PageCore<ProfileData>
Expand Down Expand Up @@ -61,15 +62,16 @@
<FieldText For="@(() => Profile.NickName)" @bind-Value="@Profile.NickName" CssIcon="@FontAwesomeIcons.User" Required="true" LabelSize="LabelSize.Short"></FieldText>
<FieldText For="@(() => Profile.Description)" @bind-Value="@Profile.Description" CssIcon="@FontAwesomeIcons.QuoteLeft"
Rows="7" LabelSize="LabelSize.Short"></FieldText>
<FieldSelect For="@(() => Profile.Nationality)" TValue="Country?" TEnum="Country" SelectedValue="@Profile.Nationality" SelectedValueChanged="CountryChanged"
CssIcon="@FontAwesomeIcons.EarthAmericas" Required="true" LabelSize="LabelSize.Short" Order="@(o=>o.Name)" ShowHelper="false"></FieldSelect>
<FieldText For="@(() => Profile.Location)" Value="@Profile.Location" CssIcon="@FontAwesomeIcons.MapMarkerAlt" Required="true" Disabled="true"
ButtomClicked="async ()=> { await SetLocation(Profile); }" ButtomCssIcon="@FontAwesomeIcons.MapMarkedAlt" LabelSize="LabelSize.Short" ButtomTitle="Recuperar posição GPS"></FieldText>
</Column>
<Column ColumnSize="ColumnSize.Is6.OnDesktop">
<FieldSelect For="@(() => Profile.Languages)" TValue="HashSet<Language>" TEnum="Language" @bind-SelectedValues="@Profile.Languages"
CssIcon="@FontAwesomeIcons.Language" Required="true" Multiple="true" LabelSize="LabelSize.Short"></FieldSelect>
CssIcon="@FontAwesomeIcons.Language" Required="true" Multiple="true"></FieldSelect>
<FieldSelect For="@(() => Profile!.CurrentSituation)" TValue="CurrentSituation?" TEnum="CurrentSituation" @bind-SelectedValue="@Profile.CurrentSituation"
CssIcon="@FontAwesomeIcons.Heart" Required="true"></FieldSelect>

<FieldSelect For="@(() => Profile.BiologicalSex)" TValue="BiologicalSex?" TEnum="BiologicalSex" @bind-SelectedValue="@Profile.BiologicalSex"
CssIcon="@FontAwesomeIcons.PersonHalfDress" Required="true"></FieldSelect>
<FieldSelect For="@(() => Profile.GenderIdentities)" TValue="HashSet<GenderIdentity>" TEnum="GenderIdentity" @bind-SelectedValues="@Profile.GenderIdentities"
Expand Down Expand Up @@ -134,6 +136,8 @@
CssIcon="@FontAwesomeIcons.Utensils" Required="true"></FieldSelect>
<FieldSelect For="@(() => Profile.Religion)" TValue="Religion?" TEnum="Religion" @bind-SelectedValue="@Profile.Religion"
CssIcon="@FontAwesomeIcons.PrayingHands" Required="true"></FieldSelect>
<FieldSelect For="@(() => Profile.FamilyApproval)" TValue="FamilyApproval?" TEnum="FamilyApproval" @bind-SelectedValue="@Profile.FamilyApproval"
CssIcon="@FontAwesomeIcons.UserGroup" Required="true"></FieldSelect>
</Column>
<Column ColumnSize="ColumnSize.Is6.OnDesktop">
<FieldSelect For="@(() => Profile!.HaveChildren)" TValue="HaveChildren?" TEnum="HaveChildren" @bind-SelectedValue="@Profile!.HaveChildren"
Expand All @@ -142,8 +146,10 @@
CssIcon="@FontAwesomeIcons.GraduationCap" ShowHelper="true" Required="true"></FieldSelect>
<FieldSelect For="@(() => Profile.CareerCluster)" TValue="CareerCluster?" TEnum="CareerCluster" @bind-SelectedValue="@Profile.CareerCluster"
CssIcon="@FontAwesomeIcons.Briefcase" ShowGroup="true" Required="true"></FieldSelect>
<FieldSelect For="@(() => Profile.LivingSituation)" TValue="LivingSituation?" TEnum="LivingSituation" @bind-SelectedValue="@Profile.LivingSituation"
CssIcon="@FontAwesomeIcons.HomeUser" Required="true"></FieldSelect>
<FieldSelect For="@(() => Profile.TravelFrequency)" TValue="TravelFrequency?" TEnum="TravelFrequency" @bind-SelectedValue="@Profile.TravelFrequency"
CssIcon="@FontAwesomeIcons.Plane" ShowGroup="true" Required="true"></FieldSelect>
CssIcon="@FontAwesomeIcons.Plane" Required="true"></FieldSelect>
</Column>
</Row>
<Card>
Expand Down Expand Up @@ -290,6 +296,14 @@
Goals
}

private void CountryChanged(Country? country)
{
if (Profile == null) return;

Profile.Nationality = country;
Profile.AddLanguages(country);
}

private bool IsValid(Tabs tab)
{
var valid = false;
Expand Down
5 changes: 0 additions & 5 deletions MM.WEB/Modules/Profile/ProfileData.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ private async Task SetLocation(ProfileModel profile)
profile.Country = address?.GetCountry();
profile.State = address?.GetState();
profile.City = address?.GetCity();

var obj = EnumHelper.GetList<Country>().Single(s => s.Tips == (address?.countryCode ?? "USA"));
var country = (Country)obj.Value;

profile.AddLanguages(country);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion MM.WEB/Modules/Shared/Field/FieldSelect.razor
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
else
{
<SelectItem></SelectItem>
@foreach (var item in EnumHelper.GetList<TEnum>())
@foreach (var item in EnumHelper.GetList<TEnum>().OrderBy(Order))
{
<SelectItem Value="@item.Value">@item.Name</SelectItem>
}
Expand Down
2 changes: 1 addition & 1 deletion MM.WEB/Resources/BuildDate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024.10.09
2024.10.12

0 comments on commit 70b5ab2

Please sign in to comment.