Skip to content

Commit

Permalink
Merge pull request #17 from Ali-YousefiTelori/develop
Browse files Browse the repository at this point in the history
Support for Multiple language UI and add ExternalServiceIdentifier
  • Loading branch information
Ali-YousefiTelori authored Dec 14, 2023
2 parents 1fc689a + 2afabab commit 893b680
Show file tree
Hide file tree
Showing 14 changed files with 534 additions and 330 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,17 @@
@using EasyMicroservices.UI.Ordering.Blazor.Pages.Products;
@using EasyMicroservices.UI.Ordering.Blazor.Pages.CountingUnits;

<FilterProductsList></FilterProductsList>
@* <FilterCountingUnitsList></FilterCountingUnitsList> *@
<MudTabs Elevation="2" Rounded="true" ApplyEffectsToContainer="true" PanelClass="pa-6">
<MudTabPanel Text="Add or Update Products">
<AddOrUpdateProduct></AddOrUpdateProduct>
</MudTabPanel>
<MudTabPanel Text="Filter Products">
<FilterProductsList></FilterProductsList>
</MudTabPanel>
<MudTabPanel Text="Add or Update CountingUnits">
<AddOrUpdateCountingUnit></AddOrUpdateCountingUnit>
</MudTabPanel>
<MudTabPanel Text="Filter Counting Units">
<FilterCountingUnitsList></FilterCountingUnitsList>
</MudTabPanel>
</MudTabs>
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
using EasyMicroservices.UI.Ordering.Blazor;
using EasyMicroservices.Domain.Contracts.Common;
using EasyMicroservices.UI.Cores;
using EasyMicroservices.UI.Ordering.Blazor.TestUI;
using EasyMicroservices.UI.Ordering.ViewModels.CountingUnits;
using EasyMicroservices.UI.Ordering.ViewModels.Orders;
using EasyMicroservices.UI.Ordering.ViewModels.Products;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.DependencyInjection;
using MudBlazor;
using MudBlazor.Services;
using Ordering.GeneratedServices;
using System;
using System.Net.Http;

LoadLanguage("en-US");
BaseViewModel.CurrentApplicationLanguage = "en-US";
BaseViewModel.IsRightToLeft = false;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddScoped(sp => new OrderClient("http://localhost:2005", sp.GetService<HttpClient>()));
builder.Services.AddScoped(sp => new ProductClient("http://localhost:2005", sp.GetService<HttpClient>()));
Expand All @@ -33,3 +32,167 @@
});

await builder.Build().RunAsync();

void LoadLanguage(string languageShortName)
{
BaseViewModel.AppendLanguage("Saving", new LanguageContract()
{
ShortName = languageShortName,
Value = "Saving"
});
BaseViewModel.AppendLanguage("Save", new LanguageContract()
{
ShortName = languageShortName,
Value = "Save"
});
BaseViewModel.AppendLanguage("Search", new LanguageContract()
{
ShortName = languageShortName,
Value = "Search"
});
BaseViewModel.AppendLanguage("Processing", new LanguageContract()
{
ShortName = languageShortName,
Value = "Processing"
});
BaseViewModel.AppendLanguage("Id", new LanguageContract()
{
ShortName = languageShortName,
Value = "Id"
});
BaseViewModel.AppendLanguage("Name", new LanguageContract()
{
ShortName = languageShortName,
Value = "Name"
});
BaseViewModel.AppendLanguage("Actions", new LanguageContract()
{
ShortName = languageShortName,
Value = "Actions"
});
BaseViewModel.AppendLanguage("Delete", new LanguageContract()
{
ShortName = languageShortName,
Value = "Delete"
});
BaseViewModel.AppendLanguage("Deleting", new LanguageContract()
{
ShortName = languageShortName,
Value = "Deleting"
});
BaseViewModel.AppendLanguage("Orders", new LanguageContract()
{
ShortName = languageShortName,
Value = "Orders"
});
BaseViewModel.AppendLanguage("Amount", new LanguageContract()
{
ShortName = languageShortName,
Value = "Amount"
});
BaseViewModel.AppendLanguage("Cancel", new LanguageContract()
{
ShortName = languageShortName,
Value = "Cancel"
});
BaseViewModel.AppendLanguage("DeleteQuestion_Content", new LanguageContract()
{
ShortName = languageShortName,
Value = "Do you really want to delete these records? This process cannot be undone."
});
BaseViewModel.AppendLanguage("Ordering_CountingUnit_Title", new LanguageContract()
{
ShortName = languageShortName,
Value = "Counting Units"
});
BaseViewModel.AppendLanguage("Ordering_ValueAddedTax_Title", new LanguageContract()
{
ShortName = languageShortName,
Value = "Value Added Tax"
});
BaseViewModel.AppendLanguage("Ordering_ExternalServiceIdentifier_Title", new LanguageContract()
{
ShortName = languageShortName,
Value = "External Service Identifier"
});
BaseViewModel.AppendLanguage("Ordering_AmountType_Title", new LanguageContract()
{
ShortName = languageShortName,
Value = "Amount Type"
});
BaseViewModel.AppendLanguage("Ordering_Decimal_Title", new LanguageContract()
{
ShortName = languageShortName,
Value = "Decimal"
});
BaseViewModel.AppendLanguage("Ordering_Percent_Title", new LanguageContract()
{
ShortName = languageShortName,
Value = "Percent"
});
BaseViewModel.AppendLanguage("Ordering_CountingUnitType_Title", new LanguageContract()
{
ShortName = languageShortName,
Value = "Counting Unit Type"
});
BaseViewModel.AppendLanguage("Ordering_DeleteCountingUnit_Title", new LanguageContract()
{
ShortName = languageShortName,
Value = "Delete CountingUnit"
});
BaseViewModel.AppendLanguage("Ordering_UpdateCountingUnit_Title", new LanguageContract()
{
ShortName = languageShortName,
Value = "Update CountingUnit"
});
BaseViewModel.AppendLanguage("Ordering_UpdateCountingUnit_Message", new LanguageContract()
{
ShortName = languageShortName,
Value = "CountingUnit updated."
});
BaseViewModel.AppendLanguage("Ordering_AddCountingUnit_Title", new LanguageContract()
{
ShortName = languageShortName,
Value = "Add CountingUnit"
});
BaseViewModel.AppendLanguage("Ordering_AddCountingUnit_Message", new LanguageContract()
{
ShortName = languageShortName,
Value = "CountingUnit added."
});
BaseViewModel.AppendLanguage("Ordering_DeleteCountingUnit_Message", new LanguageContract()
{
ShortName = languageShortName,
Value = "CountingUnit deleted!"
});
BaseViewModel.AppendLanguage("Ordering_DeleteProduct_Title", new LanguageContract()
{
ShortName = languageShortName,
Value = "Delete Product"
});
BaseViewModel.AppendLanguage("Ordering_DeleteProduct_Message", new LanguageContract()
{
ShortName = languageShortName,
Value = "Product deleted!"
});
BaseViewModel.AppendLanguage("Ordering_UpdateProduct_Title", new LanguageContract()
{
ShortName = languageShortName,
Value = "Update Product"
});
BaseViewModel.AppendLanguage("Ordering_UpdateProduct_Message", new LanguageContract()
{
ShortName = languageShortName,
Value = "Product updated."
});
BaseViewModel.AppendLanguage("Ordering_AddProduct_Title", new LanguageContract()
{
ShortName = languageShortName,
Value = "Add Product"
});
BaseViewModel.AppendLanguage("Ordering_AddProduct_Message", new LanguageContract()
{
ShortName = languageShortName,
Value = "Product added."
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<Authors>EasyMicroservices</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.0.12</Version>
<Version>0.0.0.13</Version>
<Description>ordering UI compoents.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>component,microcomponent,ui,core,order,ordering</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
@page "/AddOrUpdateCountingUnit"

@using EasyMicroservices.UI.Cores
@using EasyMicroservices.UI.Ordering.ViewModels.CountingUnits;
@using MudBlazor
@using global::Ordering.GeneratedServices;

@inject AddOrUpdateCountingUnitViewModel viewModel;

<MudStack>
<MudPaper Class="pa-4">
<MudStack Spacing="4">
<MudTextField @bind-Value="viewModel.Name" Label="Name" Variant="Variant.Text"></MudTextField>
</MudStack>
</MudPaper>
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Save" Color="Color.Info" Disabled="viewModel.IsBusy" OnClick="(arg) => viewModel.SaveCommand.Execute(null)">
@if (viewModel.IsBusy)
{
<MudProgressCircular Class="ms-n1" Size="Size.Small" Indeterminate="true" />
<MudText Class="ms-2">Saving</MudText>
}
else
{
<MudText>Save</MudText>
}
</MudButton>
</MudStack>
<MudRTLProvider RightToLeft="BaseViewModel.IsRightToLeft">
<MudStack>
<MudPaper Class="pa-4">
<MudStack Spacing="4">
<MudTextField @bind-Value="viewModel.Name" Label="@viewModel.GetLanguage("Name")" Variant="Variant.Text"></MudTextField>
</MudStack>
</MudPaper>
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Save" Color="Color.Info" Disabled="viewModel.IsBusy" OnClick="(arg) => viewModel.SaveCommand.Execute(null)">
@if (viewModel.IsBusy)
{
<MudProgressCircular Class="ms-n1" Size="Size.Small" Indeterminate="true" />
<MudText Class="ms-2">@viewModel.GetLanguage("Saving")</MudText>
}
else
{
<MudText>@viewModel.GetLanguage("Save")</MudText>
}
</MudButton>
</MudStack>
</MudRTLProvider>


@code {
public AddOrUpdateCountingUnitViewModel ViewModel
Expand Down
Loading

0 comments on commit 893b680

Please sign in to comment.