From 033e33e84dbfea5376af9e9b626a1d6994d71009 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 7 Nov 2023 18:39:36 +0100 Subject: [PATCH] UserRoles basic concept --- .gitignore | 261 ++++++++++++++++++ TIAMSharedUI/Pages/HotelDetails.razor | 106 +++++++ TIAMSharedUI/Pages/RestaurantDetails.razor | 44 ++- TIAMSharedUI/Pages/Transfer.razor | 31 ++- TIAMSharedUI/Pages/Transfer.razor.css | 2 +- TIAMSharedUI/Pages/Transfer2.razor | 53 ---- TIAMSharedUI/Pages/TransferFinal.razor | 72 +++++ TIAMSharedUI/Shared/MainLayout.razor | 24 +- TIAMSharedUI/Shared/SliderItemSelector.razor | 70 ++++- TIAMSharedUI/wwwroot/css/TourIAm.css | 22 +- TIAMWebApp/Client/Services/UserDataService.cs | 37 +++ TIAMWebApp/Client/wwwroot/index.html | 4 +- .../Controllers/GoogleAPIController .cs | 138 +++++++++ .../PublishProfiles/FolderProfile1.pubxml | 17 ++ TIAMWebApp/Server/TIAMWebApp.Server.csproj | 3 +- .../Server/TIAMWebApp.Server.csproj.user | 2 +- .../Shared/Interfaces/IUserDataService.cs | 5 + TIAMWebApp/Shared/Models/RoleType.cs | 16 ++ TIAMWebApp/Shared/Models/TripInfo.cs | 25 ++ TIAMWebApp/Shared/Models/User.cs | 4 +- 20 files changed, 847 insertions(+), 89 deletions(-) create mode 100644 .gitignore create mode 100644 TIAMSharedUI/Pages/HotelDetails.razor delete mode 100644 TIAMSharedUI/Pages/Transfer2.razor create mode 100644 TIAMSharedUI/Pages/TransferFinal.razor create mode 100644 TIAMWebApp/Server/Controllers/GoogleAPIController .cs create mode 100644 TIAMWebApp/Server/Properties/PublishProfiles/FolderProfile1.pubxml create mode 100644 TIAMWebApp/Shared/Models/RoleType.cs create mode 100644 TIAMWebApp/Shared/Models/TripInfo.cs diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..3c4efe20 --- /dev/null +++ b/.gitignore @@ -0,0 +1,261 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc \ No newline at end of file diff --git a/TIAMSharedUI/Pages/HotelDetails.razor b/TIAMSharedUI/Pages/HotelDetails.razor new file mode 100644 index 00000000..6b81ae2f --- /dev/null +++ b/TIAMSharedUI/Pages/HotelDetails.razor @@ -0,0 +1,106 @@ +@page "/hotel" +@using TIAMSharedUI.Shared +@inject NavigationManager navManager + +
+
+ +
+
+ + + +
+
+

+ 10% DISCOUNT COUPON +

+
+ +
+ +
+
+
Authentic
+

Mandragóra Restaurant

+
+ + $10.00 +
+

A nice Hungarian restaurant that offers a delightful culinary journey with traditional dishes like goulash, stuffed peppers, and chimney cake, in a cozy, welcoming atmosphere.

+
+ +
+
+
+
+

Location:

+

Kacsa u. 13, Budapest

+ + @{ + var aKey = "AIzaSyAyEYJkpt2KDa3SJ34UNWO4-dNOJKmUtF8"; + var gUrl = "https://www.google.com/maps/embed/v1/place?key=" + aKey + "&q=Space+Needle,Budapest+HU"; + } + + +
+
+
+ +
+ + +
+ + +@code { + public void next() => navManager.NavigateTo("/transfer"); + +} diff --git a/TIAMSharedUI/Pages/RestaurantDetails.razor b/TIAMSharedUI/Pages/RestaurantDetails.razor index b75e8fdb..a821baa3 100644 --- a/TIAMSharedUI/Pages/RestaurantDetails.razor +++ b/TIAMSharedUI/Pages/RestaurantDetails.razor @@ -1,14 +1,21 @@ @page "/restaurant" @using TIAMSharedUI.Shared - +@inject NavigationManager navManager
-
+
+

@@ -29,12 +36,13 @@ Mirror Edge

+
-
+
Authentic

Mandragóra Restaurant

@@ -43,6 +51,31 @@

A nice Hungarian restaurant that offers a delightful culinary journey with traditional dishes like goulash, stuffed peppers, and chimney cake, in a cozy, welcoming atmosphere.

+ +
+
+
+

Offer:

+

Traditional Hungarian cuisine

+ +
+
+

Location:

+

Kacsa u. 13, Budapest

+
+ + + @{ + var aKey = "AIzaSyAyEYJkpt2KDa3SJ34UNWO4-dNOJKmUtF8"; + var gUrl = "https://www.google.com/maps/embed/v1/place?key=" + aKey + "&q=Space+Needle,Kacsa+utca+13,Budapest+HU"; + } +
@@ -50,7 +83,7 @@
- +
@code { + public void next() => navManager.NavigateTo("/transfer"); } + + diff --git a/TIAMSharedUI/Pages/Transfer.razor b/TIAMSharedUI/Pages/Transfer.razor index 06ee5157..ca67d7b1 100644 --- a/TIAMSharedUI/Pages/Transfer.razor +++ b/TIAMSharedUI/Pages/Transfer.razor @@ -1,6 +1,6 @@ @page "/transfer" @using TIAMSharedUI.Shared - +@inject NavigationManager navManager Transfer
@@ -9,15 +9,17 @@
- +
-
- @message -
+
- + +
+ +
+
@@ -41,11 +43,17 @@ @code { SliderItemSelector slider; - public string message; + public string message; + public string message2; + public List destinations = new List() {"Liszt Ferenc Airport", "Buda Castle", "Chain Bridge"}; void DisplaySlideData() { - message = " Target destination is " + slider.SliderElementId.ToString(); + if(slider.SliderElementId != 0) + { + message2 = destinations[slider.SliderElementId-1]; + } + } /*protected override void OnAfterRender(bool isFirst) @@ -53,10 +61,13 @@ message = " Target destination is " + slider.SliderElementId.ToString(); }*/ - public void next() + void changeDest(string dest) { - + message2 = dest; } + public void next() => navManager.NavigateTo("/transfer2"); + + } diff --git a/TIAMSharedUI/Pages/Transfer.razor.css b/TIAMSharedUI/Pages/Transfer.razor.css index 2468a425..83c30f41 100644 --- a/TIAMSharedUI/Pages/Transfer.razor.css +++ b/TIAMSharedUI/Pages/Transfer.razor.css @@ -176,7 +176,7 @@ /*background-color: #03A9F4;*/ color: #fff; border-radius: 15px; - box-shadow: 3px 3px 3px #b1b1b1, -3px -3px 3px #fff; + /*box-shadow: 3px 3px 3px #b1b1b1, -3px -3px 3px #fff;*/ letter-spacing: 1.3px; } diff --git a/TIAMSharedUI/Pages/Transfer2.razor b/TIAMSharedUI/Pages/Transfer2.razor deleted file mode 100644 index 0de367ee..00000000 --- a/TIAMSharedUI/Pages/Transfer2.razor +++ /dev/null @@ -1,53 +0,0 @@ -@page "/transfer2" -@using TIAMSharedUI.Shared - -Transfer summary - -
-

Transfer

-

Please finalize your order!

-
- - - - -
-
- -
- -
- -
-
- -
-
- -
-
- -
-
- -
- Back - Next - -
- - - - -@code { - - [Parameter] - public object? Transfer { get; set; } - - public void next() - { - - } - -} - diff --git a/TIAMSharedUI/Pages/TransferFinal.razor b/TIAMSharedUI/Pages/TransferFinal.razor new file mode 100644 index 00000000..6677c123 --- /dev/null +++ b/TIAMSharedUI/Pages/TransferFinal.razor @@ -0,0 +1,72 @@ +@page "/transfer2" +Transferdetails +@inject NavigationManager navManager + +
+

Transfer summary

+

Please review your transfer!

+
+ +
+
+
+
+
+
+
+
+

27th November, 2023, 10:00 AM

+
+ +
+
+
+
+
+

Passenger info

+
+1 123 12345678
+
+

Destination

+
Liszt Ferenc Airport
+
+

Pick up address

+
Budapest, Dózsa György út 35, 1146
+
+
3 persons
+

Silver, Toyota, Prius

+ +
+
+ +
+ +
+ +
+

$ 35 via (COD)

+
+
+ +
+
+
+
+
+ + +@code { + public void next() => navManager.NavigateTo("/transfer"); + public void previous() => navManager.NavigateTo("/transfer3"); +} diff --git a/TIAMSharedUI/Shared/MainLayout.razor b/TIAMSharedUI/Shared/MainLayout.razor index 751b8b51..4598e1e2 100644 --- a/TIAMSharedUI/Shared/MainLayout.razor +++ b/TIAMSharedUI/Shared/MainLayout.razor @@ -1,6 +1,7 @@ @inherits LayoutComponentBase @using TIAMWebApp.Shared.Application.Interfaces @inject IUserDataService UserDataService; +@inject IJSRuntime jsRuntime
@@ -27,10 +28,31 @@ bool isUserLoggedIn; int userType = 0; + int currentUserRole = 249; + //add a new dictionary for the role types + + + protected override async Task OnInitializedAsync() { var user = await UserDataService.IsLoggedInAsync(); - isUserLoggedIn = user.IsLoggedIn; + isUserLoggedIn = user.IsLoggedIn; + } + + protected override void OnAfterRender(bool isFirst) + { + LogToBrowserConsole("0 "); + + } + + + + public void LogToBrowserConsole(string message) + { + jsRuntime.InvokeVoidAsync("console.log", message); + } + + } diff --git a/TIAMSharedUI/Shared/SliderItemSelector.razor b/TIAMSharedUI/Shared/SliderItemSelector.razor index d1df7813..71bda048 100644 --- a/TIAMSharedUI/Shared/SliderItemSelector.razor +++ b/TIAMSharedUI/Shared/SliderItemSelector.razor @@ -1,5 +1,41 @@  -