This commit is contained in:
mmrbnjd
2025-07-26 11:47:32 +03:30
parent 29107ce9c6
commit c045ace959
10 changed files with 88 additions and 64 deletions

View File

@@ -17,13 +17,13 @@
<span>به هوشیان</span>
</div>
<div id="primary_form" class="form">
<EditForm id="primary_form" class="form" Model="model" OnSubmit="onClick" FormName="LoginForm">
<div class=" group w-full">
<label for="user-name" class="block mb-2 text-slate-600 font-bold">
شماره همراه / نام کاربری
</label>
<div class="container-input">
<input style="text-align:center" type="text" @bind-value="username" id="user-name" maxlength="64" title="نام کاربری را وارد کنید." class="input-form input_vk_1" required="" data-val="true" data-val-required="شماره همراه / نام کاربری را وارد کنید." name="Username">
<input style="text-align:center" type="text" @bind-value="model.Username" id="user-name" maxlength="64" title="نام کاربری را وارد کنید." class="input-form input_vk_1" required="" data-val="true" data-val-required="شماره همراه / نام کاربری را وارد کنید." name="Username">
</div>
</div>
<div class="relative group">
@@ -31,7 +31,7 @@
کلمه عبور
</label>
<div class="container-input">
<input style="text-align:center" @bind-value=Password type="password" id="password" title="کلمه عبور را وارد کنید." maxlength="36" class="input-form input_vk_2" autocomplete="off" required="" data-val="true" data-val-required="کلمه عبور را وارد کنید." name="Password">
<input style="text-align:center" @bind-value=model.Password type="password" id="password" title="کلمه عبور را وارد کنید." maxlength="36" class="input-form input_vk_2" autocomplete="off" required="" data-val="true" data-val-required="کلمه عبور را وارد کنید." name="Password">
<div class=" flex gap-1 px-1">
<div class="cursor-pointer hover:text-black hover:bg-primary hover:bg-opacity-10 rounded transition-all p-1 bg-slate-50 z-10 text-slate-500" onclick="showPassword(event, 'password')">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -53,7 +53,7 @@
</div>
<div class=" space-y-5 flex flex-col items-center">
<Button Loading=Loading LoadingText="در حال ورود ..." Color="ButtonColor.Primary" Type="ButtonType.Submit" @onclick=onClick class="btn-primary w-full mb-4 lg:mb-0">
<Button Loading=Loading LoadingText="در حال ورود ..." Color="ButtonColor.Primary" Type="ButtonType.Submit" class="btn-primary w-full mb-4 lg:mb-0">
ورود
</Button>
</div>
@@ -64,14 +64,13 @@
</div>
<input name="__RequestVerificationToken" type="hidden" value="CfDJ8P2efyfpaLFHon15HCO5GnTcqzVeJClceMnnP99o04SA4Jbau0j_wcgDQBvHrI3oVb7JTofciu8lxPVwkHOn85rf9-vWzZefUXIBfzQb9upg_bF2ZDxTduIs62mLs07I48u7WZpLohGSjdmJTjjcCQY">
</div>
</EditForm>
@code {
[Inject] protected ToastService ToastService { get; set; } = default!;
private ConfirmDialog dialog = default!;
[SupplyParameterFromForm]
AuthRequestFromCompanySide model { get; set; } = new();
private Modal modal = default!;
public string username { get; set; }
public string Password { get; set; }
public bool Loading { get; set; }
}
@functions {
@@ -80,21 +79,11 @@
async Task onClick()
{
if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(Password)) return;
if (string.IsNullOrEmpty(model.Username) || string.IsNullOrEmpty(model.Password)) return;
Loading = true;
var msg = await auth.login(new AuthRequestFromCompanySide()
{
Username = username,
Password = Password
});
if (msg == "ok")
{
navigationManager.NavigateTo("/");
}
var msg = await auth.login(model);
if (msg == "ok") navigationManager.NavigateTo("/");
Loading = false;
}

View File

@@ -40,8 +40,8 @@
</style>
<div class="container-fluid">
<div class="row row-fullheight">
@* <div class="row row-fullheight"> *@
<div class="row">
<!-- تغییر کلمه عبور -->
<div class="col-md-6 d-flex flex-column" style="height: fit-content;">
<div class="section-box w-100">
@@ -82,7 +82,7 @@
<div class="col-md-12">
<input dir="ltr" class="form-control text-center mb-2" @bind-value="@dto.WebSite" type="text" placeholder="وب سایت" />
</div>
<div class="col-md-12 d-flex align-items-center mb-2">
<InputFile type="file" OnChange="OnFileChange" accept=".png" />
@if (dto.logo != null && dto.logo.Length > 0)
@@ -101,7 +101,7 @@
}
<!-- پایین چپ -->
@* <!-- پایین چپ -->
<div class="col-md-6 d-flex flex-column">
<div class="section-box w-100">
<div class="section-title">
@@ -119,23 +119,25 @@
</div>
<!-- محتوای دلخواه -->
</div>
</div>
</div> *@
</div>
</div>
@code {
[Inject] protected ToastService ToastService { get; set; } = default!;
[Inject] protected ToastService ToastService { get; set; } = default!;
bool ALLOWcompanyinfo = true;
bool ALLOWcompanyinfo = false;
public bool loading { get; set; } = false;
public ReadANDUpdate_CompanyDto dto { get; set; }
= new();
int CompanyID = 0;
protected override async Task OnInitializedAsync()
{
if (await localStorageService.GetItem<string>("Role") != "Company")
if (await localStorageService.GetItem<string>("C/Role") == "User")
navigationManager.NavigateTo("/NotFound");
ALLOWcompanyinfo = await localStorageService.GetItem<string>("C/Role") == "Company";
CompanyID= await localStorageService.GetItem<int>("C/CompanyId");
dto = await companyService.GetCompany(CompanyID);