diff --git a/Back/Controllers/VerificationController.cs b/Back/Controllers/VerificationController.cs index 44c1d21..78429ec 100644 --- a/Back/Controllers/VerificationController.cs +++ b/Back/Controllers/VerificationController.cs @@ -18,11 +18,12 @@ namespace Back.Controllers private readonly servSendMsg _servSendMsg; private readonly servCompany _servCompany; public VerificationController(ServValidatinMsg servValidatinMsg, GetVerificationValidation getVerificationValidation - , servCompany servCompany) + , servCompany servCompany, servSendMsg servSendMsg) { _servValidatinMsg = servValidatinMsg; _getVerificationValidation = getVerificationValidation; _servCompany = servCompany; + _servSendMsg = servSendMsg; } [HttpGet("GetVerification/{ID}")] [AllowAnonymous] diff --git a/TaxPayerFull/Layout/Lheaderbottom.razor b/TaxPayerFull/Layout/Lheaderbottom.razor index 578d0b2..f5975ab 100644 --- a/TaxPayerFull/Layout/Lheaderbottom.razor +++ b/TaxPayerFull/Layout/Lheaderbottom.razor @@ -1,4 +1,5 @@ -
+@inject Services.localService servlocal; +
@@ -36,7 +37,21 @@
- + @if (servlocal.OnlineUser().Result) + { + + } + else + { + + } + + + + + + +
@@ -45,4 +60,5 @@ @code { + } diff --git a/TaxPayerFull/Layout/LinfoUser.razor b/TaxPayerFull/Layout/LinfoUser.razor new file mode 100644 index 0000000..42e8d41 --- /dev/null +++ b/TaxPayerFull/Layout/LinfoUser.razor @@ -0,0 +1,43 @@ +@using Front.Services +@using Shared.DTOs +@inject ILocalStorageService Storage; +@inject UserAuthenticationDTO userinfo +@inject HttpClient _hc +@inject NavigationManager nav +
+
+ + + خروج + + +
+
+ + + + + + + @userinfo.FullName + +
+ +
+ +@code { + +} +@functions { + private async Task Logout() + { + _hc.DefaultRequestHeaders.Clear(); + await Storage.RemoveItem("token"); + userinfo.Token = ""; + nav.Refresh(); + } +} \ No newline at end of file diff --git a/TaxPayerFull/Pages/Home.razor b/TaxPayerFull/Pages/Home.razor index 75a67ad..3768595 100644 --- a/TaxPayerFull/Pages/Home.razor +++ b/TaxPayerFull/Pages/Home.razor @@ -1,4 +1,5 @@ -@page "/" +@inject Services.localService servlocal; +@page "/" Home @@ -40,10 +41,21 @@

فروش بیشتر با مدیریت بهتر کسب و کار

- - شروع کنید - - + @if (servlocal.OnlineUser().Result) + { + + ورود به برنامه + + + } + else + { + + شروع کنید + + + } + @@ -197,10 +209,21 @@
- - شروع کنید - - + @if (servlocal.OnlineUser().Result) + { + + ورود به برنامه + + + } + else + { + + شروع کنید + + + } +
@@ -351,10 +374,21 @@

راه حلی برای مدیریت بهتر صورتحساب ها

- - شروع کنید - - + @if (servlocal.OnlineUser().Result) + { + + ورود به برنامه + + + } + else + { + + شروع کنید + + + } +
diff --git a/TaxPayerFull/Pages/Panel.razor b/TaxPayerFull/Pages/Panel.razor new file mode 100644 index 0000000..83b4110 --- /dev/null +++ b/TaxPayerFull/Pages/Panel.razor @@ -0,0 +1,15 @@ +@page "/Panel" +@using Front.Services +@inject localService localserv; +@inject NavigationManager nav +

Panel

+@* @layout null *@ +@code { + protected override async Task OnInitializedAsync() + { + if (!await localserv.OnlineUser()) + nav.NavigateTo("/"); + + await base.OnInitializedAsync(); + } +} diff --git a/TaxPayerFull/Pages/Sign-in.razor b/TaxPayerFull/Pages/Sign-in.razor index e33c524..ffe1501 100644 --- a/TaxPayerFull/Pages/Sign-in.razor +++ b/TaxPayerFull/Pages/Sign-in.razor @@ -1,4 +1,5 @@ @page "/Sign-in" +@page "/Sign-in/{from}" @using Front.Services @using Shared.DTOs @inject ILocalStorageService Storage; @@ -116,7 +117,11 @@ @@ -133,6 +138,9 @@ @code { + [Parameter] + public string from { get; set; } = ""; + bool showbtn = false; [SupplyParameterFromForm] public Authentication? Model { get; set; } // alert @@ -140,11 +148,19 @@ IconName alertIconName = IconName.CheckCircleFill; bool Hidealert = true; string alertMessage = ""; + protected override async Task OnParametersSetAsync() + { + if (from == "Verification") + { + ShowSuccessAlert("ثبت نام شما با موفقیت انجام شد"); + } + await base.OnParametersSetAsync(); + } protected override async Task OnInitializedAsync() { if (await localserv.OnlineUser()) - nav.NavigateTo("/"); + nav.NavigateTo("/Panel"); Model ??= new(); await base.OnInitializedAsync(); @@ -153,11 +169,20 @@ @functions { private void ShowDangerAlert(string msg) { + showbtn = true; Hidealert = false; alertColor = AlertColor.Danger; alertIconName = IconName.ExclamationTriangleFill; alertMessage = msg; } + private void ShowSuccessAlert(string msg) + { + showbtn = false; + Hidealert = false; + alertColor = AlertColor.Success; + alertIconName = IconName.CheckCircleFill; + alertMessage = msg; + } private async Task EndForm() => nav.NavigateTo("/"); @@ -184,7 +209,7 @@ userinfo.enterDate = userinfomodel.enterDate; - nav.NavigateTo("/"); + nav.NavigateTo("/Panel"); } else if (request.StatusCode == System.Net.HttpStatusCode.NotFound) ShowDangerAlert("کاربری با این مشخصات یافت نشد"); diff --git a/TaxPayerFull/Pages/Verification.razor b/TaxPayerFull/Pages/Verification.razor index d1aec77..c0842e5 100644 --- a/TaxPayerFull/Pages/Verification.razor +++ b/TaxPayerFull/Pages/Verification.razor @@ -142,8 +142,11 @@ var status = await request.Content.ReadFromJsonAsync(); if (status) { - ShowSuccessAlert("عملیات با موفقیت انجام شد"); - successfull = true; + if (VerificationCodeModel.Type == "CompanyRegistration") + nav.NavigateTo("/Sign-in/Verification"); + else + nav.NavigateTo("/"); + } else {