...
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
@page "/Settings"
|
||||
@using Hushian.Application.Dtos.Company
|
||||
@using Common.Dtos.Company
|
||||
@using HushianWebApp.Components
|
||||
@using HushianWebApp.Service
|
||||
@using HushianWebApp.Services
|
||||
@@ -71,7 +71,10 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-12" style="margin-top:15px">
|
||||
<input dir="ltr" class="form-control text-center mb-2" @bind-value="@dto.Fullname" type="text" placeholder="نام کامل" />
|
||||
<input dir="ltr" class="form-control text-center mb-2" @bind-value="@dto.FullName" type="text" placeholder="نام شرکت" />
|
||||
</div>
|
||||
<div class="col-md-12" style="margin-top:15px">
|
||||
<input dir="ltr" class="form-control text-center mb-2" @bind-value="@dto.FullNameManager" type="text" placeholder="نام مدیر" />
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<input dir="ltr" class="form-control text-center mb-2" @bind-value="@dto.Email" type="text" placeholder="پست الکترونیک" />
|
||||
@@ -79,22 +82,17 @@
|
||||
<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">
|
||||
<input dir="ltr" class="form-control text-center mb-2" @bind-value="@dto.Phone" type="text" placeholder="تلفن" />
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<input dir="ltr" class="form-control text-center mb-2" @bind-value="@dto.Info" 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.img != null && dto.img.Length > 0)
|
||||
@if (dto.logo != null && dto.logo.Length > 0)
|
||||
{
|
||||
<Image src="@GetImageSource()" class="rounded mx-2" height="25" width="25" alt="Uploaded Image" />
|
||||
}
|
||||
</div>
|
||||
<div class="d-grid gap-2">
|
||||
<Button Loading=loading LoadingText="در حال ذخیره اطلاعات..." Color="ButtonColor.Warning"
|
||||
@onclick="updateItem">
|
||||
@onclick="updateItem">
|
||||
ویرایش
|
||||
</Button>
|
||||
</div>
|
||||
@@ -127,18 +125,20 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Inject] protected ToastService ToastService { get; set; } = default!;
|
||||
[Inject] protected ToastService ToastService { get; set; } = default!;
|
||||
|
||||
bool ALLOWcompanyinfo = true;
|
||||
bool ALLOWcompanyinfo = true;
|
||||
public bool loading { get; set; } = false;
|
||||
public CompanyDto dto { get; set; }
|
||||
public ReadANDUpdate_CompanyDto dto { get; set; }
|
||||
= new();
|
||||
int CompanyID = 0;
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (!(await localStorageService.GetItem<List<string>>("Role")).Any(a => a == "HushianManagerCompany"))
|
||||
if (await localStorageService.GetItem<string>("Role") != "Company")
|
||||
navigationManager.NavigateTo("/NotFound");
|
||||
CompanyID= await localStorageService.GetItem<int>("C/CompanyId");
|
||||
|
||||
dto=await companyService.GetCompany();
|
||||
dto = await companyService.GetCompany(CompanyID);
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
private async Task OnFileChange(InputFileChangeEventArgs e)
|
||||
@@ -147,14 +147,14 @@
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
await file.OpenReadStream().CopyToAsync(memoryStream);
|
||||
dto.img = memoryStream.ToArray();
|
||||
dto.logo = memoryStream.ToArray();
|
||||
}
|
||||
}
|
||||
private string GetImageSource()
|
||||
{
|
||||
if (dto.img != null)
|
||||
if (dto.logo != null)
|
||||
{
|
||||
return $"data:image/jpeg;base64,{Convert.ToBase64String(dto.img)}";
|
||||
return $"data:image/jpeg;base64,{Convert.ToBase64String(dto.logo)}";
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
Reference in New Issue
Block a user