refactor for country landing pages

This commit is contained in:
Frede Hundewadt 2022-12-31 13:53:02 +01:00
parent d89d1a055d
commit a4e9598fa3
47 changed files with 232 additions and 301 deletions

View file

@ -0,0 +1,44 @@
@*
// Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
*@
<div class="list-group list-group-flush">
@if (UserList.Any())
{
foreach (var user in UserList)
{
<div class="list-group-item list-group-item-action" style="cursor: pointer;">
<div class="row align-items-center">
<div class="col-sm-4">@user.FullName</div>
<div class="col-sm-2">@user.PhoneNumber</div>
<div class="col-sm-2">
<a class="btn btn-warning d-block" href="/office/users/advisors/@user.CountryCode.ToLower()/@user.UserId/reports">Rapporter</a>
</div>
<div class="col-sm-2">
<a class="btn btn-success d-block" href="/office/users/advisors/@user.CountryCode.ToLower()/@user.UserId/customers">Kunder</a>
</div>
<div class="col-sm-2">
<a class="btn btn-info d-block" href="/office/users/advisors/@user.CountryCode.ToLower()/@user.UserId/view">Rediger</a>
</div>
</div>
</div>
}
}
else
{
<div>Ingen data</div>
}
</div>

View file

@ -19,7 +19,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Components;
public partial class OfficeAdvisorTableComponent
public partial class CountrySalesRepListComponent
{
[Parameter] public List<UserListAdminView> UserList { get; set; } = new();
}

View file

@ -20,41 +20,10 @@
<PageTitle>Innotec Admin</PageTitle>
@*<div class="card mb-3" style="max-width: 300px">
<div class="row g-0">
<div class="col-4">
<i class="img-fluid rounded-start fi fi-dk" alt="dk flag"></i>
<div class="row">
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
<div class="col"></div>
</div>
<div class="col-8">
<div class="card-body">
Danmark
</div>
</div>
</div>
</div>
<div class="card mb-3" style="max-width: 300px">
<div class="row g-0">
<div class="col-4">
<i class="img-fluid rounded-start fi fi-no" alt="no flag"></i>
</div>
<div class="col-8">
<div class="card-body">
Norge
</div>
</div>
</div>
</div>
<div class="card mb-3" style="max-width: 300px">
<div class="row g-0">
<div class="col-4">
<i class="img-fluid rounded-start fi fi-se" alt="se flag"></i>
</div>
<div class="col-8">
<div class="card-body">
Sverige
</div>
</div>
</div>
</div>*@

View file

@ -1,58 +0,0 @@
@*
// Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
*@
@if (UserList.Any())
{
<table class="table table-striped">
<thead>
<tr>
<th scope="col">
Navn
</th>
<th scope="col">
Telefon
</th>
<th scope="col">
Email
</th>
<th scope="col">
</th>
<th scope="col">
</th>
</tr>
</thead>
<tbody>
@foreach (var user in UserList)
{
<tr class="align-middle">
<td>@user.FullName</td>
<td>@user.PhoneNumber</td>
<td>@user.Email</td>
<td><a class="btn btn-outline-dark" href="/office/users/advisors/@user.CountryCode.ToLower()/@user.UserId/reports">Rapporter</a></td>
<td><a class="btn btn-outline-dark" href="/office/users/advisors/@user.CountryCode.ToLower()/@user.UserId/companies">Kunder</a></td>
<td><a class="btn btn-outline-dark" href="/office/users/advisors/@user.CountryCode.ToLower()/@user.UserId/view">Rediger</a></td>
</tr>
}
</tbody>
</table>
}
else
{
<div>Ingen data</div>
}

View file

@ -16,29 +16,26 @@
*@
<div class="row mb-3">
<div class="col-md-4">
<div class="col-sm-4">
<div class="btn-group" role="group" aria-label="Ordre status">
<input type="radio" class="btn-check" name="btn-order" id="btn-order1" autocomplete="off" checked @onchange="@GetOrderStatusNone"/>
<label class="btn btn-outline-success" for="btn-order1">Ubehandlet</label>
<label class="btn btn-success" for="btn-order1">Ubehandlet</label>
<input type="radio" class="btn-check" name="btn-order" id="btn-order2" autocomplete="off" @onchange="@GetOrderStatusPicked"/>
<label class="btn btn-outline-warning" for="btn-order2">Plukket</label>
<label class="btn btn-warning" for="btn-order2">Plukket</label>
<input type="radio" class="btn-check" name="btn-order" id="btn-order3" autocomplete="off" @onchange="@GetOrderStatusPacked"/>
<label class="btn btn-outline-danger" for="btn-order3">Pakket</label>
<input type="radio" class="btn-check" name="btn-order" id="btn-order4" autocomplete="off" @onchange="@GetOrderStatusShipped"/>
<label class="btn btn-outline-info" for="btn-order4">Afsendt</label>
<label class="btn btn-danger" for="btn-order3">Pakket</label>
</div>
</div>
<div class="col-md-4 text-end">
<div class="col-sm-4 text-end">
<label class="btn btn-outline-dark position-relative">
@Header
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">@OrderList.Count</span>
<span class="visually-hidden">ordrer i listen</span>
</label>
</div>
<div class="col-md-4 text-end">
<div class="col-sm-4 text-end">
@if (ReadyToShip && OrderList.Any())
{
<button type="button" class="btn btn-primary text-sm-center" @onclick="SetAllPackedStatusToShipped">Sæt alle afsendt</button>

View file

@ -25,11 +25,13 @@ public class VatAddress
/// </summary>
[Required(ErrorMessage = "Vejnavn skal angives")]
public string StreetName { get; set; } = "";
/// <summary>
/// House Number
/// </summary>
[Required(ErrorMessage = "Husnummer skal angives")]
public string HouseNumber { get; set; } = "";
/// <summary>
/// Postal Code
/// </summary>

View file

@ -29,7 +29,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class CatalogCrmPage : IDisposable
public partial class CatalogPage : IDisposable
{
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public ICatalogCrmHttpRepository ItemRepo { get; set; }

View file

@ -29,7 +29,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class CatalogCountryPage : IDisposable
public partial class CountryCatalogPage : IDisposable
{
[Parameter] public string CountryCode { get; set; } = "";
[Inject] public ILocalStorageService Storage { get; set; }

View file

@ -28,7 +28,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages
{
public partial class CustomerListCountryPage : IDisposable
public partial class CountryCustomerListPage : IDisposable
{
[Parameter] public string CountryCode { get; set; } = "";
[Inject] public ILocalStorageService Storage { get; set; }

View file

@ -0,0 +1,64 @@
@*
// Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
*@
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin,Office,Warehouse")]
@page "/office/{CountryCode}"
<div class="row G-3">
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<h4 class="card-title">
@CountryCode.ToUpper() Kunder
</h4>
<div class="card-text">
Filtrer og søg kunder
</div>
<a class="btn btn-primary d-block" href="/office/users/advisors/@CountryCode"> Kundeliste</a>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<h4 class="card-title">
@CountryCode.ToUpper() Priskatalog
</h4>
<div class="card-text">
Produkter og priser
</div>
<a class="btn btn-primary d-block" href="/price-catalog/@CountryCode"> Priskatalog</a>
</div>
</div>
</div>
<AuthorizeView Roles="Admin,Office">
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<h4 class="card-title">
@CountryCode.ToUpper() Sælgere
</h4>
<p class="card-text">
Filtreret kundeliste, se/udskriv rapporter, rediger stamdata
</p>
<a class="btn btn-primary d-block" href="/office/users/advisors/@CountryCode"> Sælgere</a>
</div>
</div>
</div>
</AuthorizeView>
</div>

View file

@ -0,0 +1,11 @@
using Blazored.LocalStorage;
using Microsoft.AspNetCore.Components;
using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class CountryLandingPage
{
[Parameter] public string CountryCode { get; set; } = "";
[Inject] private ILocalStorageService Storage { get; set; }
}

View file

@ -18,7 +18,7 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin,Office,Warehouse")]
@page "/office/users/advisors/{CountryCode}/{UserId}/companies"
@page "/office/users/advisors/{CountryCode}/{UserId}/customers"
<div class="sticky-top bg-dark text-light rounded-2 px-3">
<div class="container-fluid pt-3">

View file

@ -22,12 +22,12 @@ using Wonky.Entity.Requests;
namespace Wonky.Client.Pages;
public partial class UserListSalesRepPage : IDisposable
public partial class CountrySalesRepCustomerListPage : IDisposable
{
[Parameter] public string UserId { get; set; } = "";
[Parameter] public string CountryCode { get; set; } = "dk";
[Inject] public ILogger<UserListSalesRepPage> Logger { get; set; }
[Inject] public ILogger<CountrySalesRepCustomerListPage> Logger { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public ICustomerOfficeHttpRepository CustomerRepo { get; set; }
[Inject] public UserProfileService UserProfileService { get; set; }

View file

@ -25,7 +25,7 @@
<h3>Sælgere</h3>
</div>
<div class="card-body">
<OfficeAdvisorTableComponent UserList="_salesReps" />
<CountrySalesRepListComponent UserList="SalesReps" />
</div>
</div>

View file

@ -0,0 +1,31 @@
using Microsoft.AspNetCore.Components;
using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpInterfaces;
using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class CountrySalesRepListPage
{
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IUserHttpRepository UserRepo { get; set; }
[Parameter] public string CountryCode { get; set; } = "";
private List<UserListAdminView> SalesReps { get; set; } = new();
private bool Working { get; set; } = true;
protected override async Task OnInitializedAsync()
{
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
var AdvisorList = await UserRepo.GetAdvisors();
SalesReps = AdvisorList
.Where(x => x.CountryCode.ToLower() == CountryCode && Convert.ToInt32(x.SalesRep) < 100)
.ToList();
Working = false;
}
public void Dispose()
{
Interceptor.DisposeEvent();
}
}

View file

@ -21,7 +21,7 @@ using Wonky.Client.HttpRepository;
namespace Wonky.Client.Pages;
public partial class WorkplaceDocumentListPage
public partial class CustomerWorkplaceDocumentListPage
{
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string WorkplaceId { get; set; } = "";

View file

@ -24,7 +24,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class WorkplaceListPage : IDisposable
public partial class CustomerWorkplaceListPage : IDisposable
{
[Parameter] public string CompanyId { get; set; } = "";
[Inject] public IWorkplaceCrmHttpRepository WorkplaceCrmRepo { get; set; }

View file

@ -25,7 +25,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class WorkplaceViewPage : IDisposable
public partial class CustomerWorkplaceViewPage : IDisposable
{
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string WorkplaceId { get; set; } = "";

View file

@ -15,26 +15,24 @@
//
*@
@using Wonky.Client.Components;
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Advisor,Admin,Office,Supervisor,Warehouse")]
@page "/"
@page "/index"
@page "/home"
@using Wonky.Client.Components;
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Advisor,Admin,Supervisor,Office,Warehouse")]
<AuthorizeView Roles="Advisor">
<LandingComponentAdvisor />
</AuthorizeView>
<AuthorizeView Roles="Warehouse">
<WarehouseListComponent />
</AuthorizeView>
<AuthorizeView Roles="Admin">
<AuthorizeView Roles="Admin,Office">
<LandingComponentAdmin />
</AuthorizeView>
<AuthorizeRouteView Roles="Admin,Office,Warehouse">
<WarehouseListComponent />
</AuthorizeRouteView>
@code{
}

View file

@ -1,39 +0,0 @@
@*
// Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
*@
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin")]
@page "/office/users/advisors"
<div class="card">
<div class="card-header bg-dark text-white">
<div class="card-title">
<h3>Lande</h3>
</div>
</div>
<div class="card-body">
<div class="list-group list-group-flush">
<a class="list-group-item list-group-item-action" href="/office/users/advisors/dk">Danmark</a>
<a class="list-group-item list-group-item-action" href="/office/users/advisors/no">Norge</a>
<a class="list-group-item list-group-item-action" href="/office/users/advisors/se">Sverige</a>
</div>
</div>
</div>
@code {
}

View file

@ -1,30 +0,0 @@
@*
// Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
*@
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin")]
@page "/office/{CountryCode}"
@code {
[Parameter]
public string CountryCode { get; set; } = "";
}

View file

@ -1,30 +0,0 @@
@*
// Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
*@
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin")]
@page "/office/{countryCode}/salesreps"
<div class="row">
<div class="col-sm-4"></div>
<div class="col-sm-4"></div>
<div class="col-sm-4"></div>
</div>
@code {
}

View file

@ -17,7 +17,7 @@
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Components
@attribute [Authorize(Roles = "Admin,Office,Warehouse,Advisor")]
@attribute [Authorize(Roles = "Admin,Advisor,Office,Warehouse")]
@page "/office/customers/{CompanyId}/orders/{OrderId}"
<table class="table table-sm table-striped d-print-table">

View file

@ -30,7 +30,7 @@ using Wonky.Client.Services;
namespace Wonky.Client.Pages;
public partial class OrderViewOfficePage : IDisposable
public partial class OfficeOrderViewPage : IDisposable
{
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string OrderId { get; set; } = "";
@ -39,7 +39,7 @@ public partial class OrderViewOfficePage : IDisposable
[Inject] public ISendMailService MailService { get; set; }
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public IUserHttpRepository UserRepo { get; set; }
[Inject] public ILogger<OrderViewOfficePage> Logger { get; set; }
[Inject] public ILogger<OfficeOrderViewPage> Logger { get; set; }
[Inject] public IToastService Toast { get; set; }
private ReportItemView _reportItem { get; set; } = new();
private bool _isNotified { get; set; }

View file

@ -15,10 +15,10 @@
//
*@
@page "/office/users/advisors/{CountryCode}/{UserId}/view"
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Components
@attribute [Authorize(Roles = "Admin")]
@page "/office/users/advisors/{CountryCode}/{UserId}/view"
<div class="card">
<div class="card-header bg-dark text-white">

View file

@ -26,13 +26,13 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class UserViewOfficePage : IDisposable
public partial class OfficeSalesRepViewPage : IDisposable
{
[Parameter] public string UserId { get; set; } = "";
[Parameter] public string CountryCode { get; set; } = "";
[Inject] public HttpInterceptorService _interceptor { get; set; }
[Inject] public IUserHttpRepository UserRepo { get; set; }
[Inject] public ILogger<UserViewOfficePage> _logger { get; set; }
[Inject] public ILogger<OfficeSalesRepViewPage> _logger { get; set; }
[Inject] public NavigationManager _navigator { get; set; }
[Inject] public IToastService _toast { get; set; }
private WebUserInfoView _userInfo { get; set; } = new();

View file

@ -15,13 +15,13 @@
//
*@
@page "/print/catalog"
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin,Advisor,Office,Warehouse")]
@page "/print/catalog"
<CatalogTablePrintComponent ItemList="Items" CountryName="@UserInfo.CountryName" />
@if (Working)
{
<WorkingThreeDots/>

View file

@ -17,8 +17,8 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin,Advisor,Office")]
@page "/print/report/{CountryCode}/{UserId}/{ReportDate}"
@attribute [Authorize(Roles = "Admin,Advisor")]
<div class="row mb-3 d-print-none">
<div class="col-sm-6 d-grid">

View file

@ -17,8 +17,8 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Admin,Advisor,Office")]
@page "/print/orders/{CountryCode}/{UserId}/{ReportDate}"
@attribute [Authorize(Roles = "Admin,Advisor")]
<div class="row mb-3 d-print-none">
<div class="col-sm-6 d-grid">

View file

@ -1,6 +1,24 @@
@page "/open-quotes"
@*
// Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
*@
@using Wonky.Client.Components
@using Wonky.Client.Models
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Advisor")]
@page "/open-quotes"
<div class="row g-3 align-items-center">
<div class="col-sm-8">

View file

@ -16,6 +16,8 @@
*@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Advisor")]
@page "/sales-reports"
<div class="card">

View file

@ -18,8 +18,8 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Models
@page "/sales-reports/view/{ReportDate}"
@attribute [Authorize(Roles = "Advisor,Admin,Supervisor")]
@page "/sales-reports/view/{ReportDate}"
<div class="row bg-dark text-white rounded-2 mb-2 py-2 align-items-center d-print-none">
<div class="col-sm-6">

View file

@ -18,8 +18,8 @@
@using Wonky.Client.Components
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Models
@page "/office/users/advisors/{CountryCode}/{UserId}/reports/{ReportDate}"
@attribute [Authorize(Roles = "Admin")]
@page "/office/users/advisors/{CountryCode}/{UserId}/reports/{ReportDate}"
<div class="row pt-2 pb-2 mb-3 rounded-2 d-print-none bg-dark text-white">
<div class="col-sm-6">

View file

@ -1,49 +0,0 @@
// Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
using Microsoft.AspNetCore.Components;
using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpInterfaces;
using Wonky.Client.HttpRepository;
using Wonky.Entity.DTO;
using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class UserListOfficePage : IDisposable
{
[Parameter] public string CountryCode { get; set; } = "";
[Inject] public HttpInterceptorService _interceptor { get; set; }
[Inject] public IUserHttpRepository UserRepo { get; set; }
private List<UserListAdminView> _salesReps { get; set; } = new();
private bool Working { get; set; } = true;
protected override async Task OnInitializedAsync()
{
_interceptor.RegisterEvent();
_interceptor.RegisterBeforeSendEvent();
var AdvisorList = await UserRepo.GetAdvisors();
_salesReps = AdvisorList
.Where(x => x.CountryCode.ToLower() == CountryCode && Convert.ToInt32(x.SalesRep) < 100)
.ToList();
Working = false;
}
public void Dispose()
{
_interceptor.DisposeEvent();
}
}

View file

@ -21,9 +21,3 @@
@page "/warehouse/orders/{Status}"
<WarehouseListComponent Status="@Status" />
@code{
[Parameter] public string Status { get; set; } = "none";
}

View file

@ -0,0 +1,8 @@
using Microsoft.AspNetCore.Components;
namespace Wonky.Client.Pages;
public partial class WarehouseOrderListPage
{
[Parameter] public string Status { get; set; } = "none";
}

View file

@ -25,14 +25,14 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class OrderViewWarehousePage : IDisposable
public partial class WarehouseOrderViewPage : IDisposable
{
[Parameter] public string OrderId { get; set; } = "";
[Inject] public HttpInterceptorService _interceptor { get; set; }
[Inject] public IWarehouseHttpRepository _warehouseRepo { get; set; }
[Inject] public NavigationManager _navigator { get; set; }
[Inject] public IToastService _toast { get; set; }
[Inject] public ILogger<OrderViewWarehousePage> _logger { get; set; }
[Inject] public ILogger<WarehouseOrderViewPage> _logger { get; set; }
private WarehouseOrderView _order { get; set; } = new();
private bool Working { get; set; }

View file

@ -36,9 +36,9 @@ builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Logging.AddConfiguration(builder.Configuration.GetSection("Logging"));
builder.Services.AddScoped(sp =>
sp.GetService<IHttpClientFactory>().CreateClient("backend"));
sp.GetService<IHttpClientFactory>().CreateClient("inno-api"));
builder.Services.AddHttpClient("backend", (sp, cl) =>
builder.Services.AddHttpClient("inno-api", (sp, cl) =>
{
var apiConfig = sp.GetRequiredService<IOptions<ApiConfig>>();
cl.BaseAddress = new Uri(apiConfig.Value.BaseUrl);
@ -58,12 +58,11 @@ builder.Services.AddScoped<IActivityCrmHttpRepository, ActivityCrmHttpRepository
builder.Services.AddScoped<ICustomerCrmHttpRepository, CustomerCrmCrmHttpRepository>();
builder.Services.AddScoped<IContactCrmHttpRepository, ContactCrmHttpRepository>();
builder.Services.AddScoped<ICustomerHistoryCrmHttpRepository, CustomerHistoryCrmHttpRepository>();
builder.Services.AddScoped<IReportHttpRepository, ReportHttpRepository>();
builder.Services.AddScoped<ITaskItemCrmHttpRepository, TaskItemCrmHttpRepository>();
builder.Services.AddScoped<IWorkplaceCrmHttpRepository, WorkplaceCrmHttpRepository>();
// administrative repositories
builder.Services.AddScoped<IReportHttpRepository, ReportHttpRepository>();
builder.Services.AddScoped<IUserHttpRepository, UserHttpRepository>();
builder.Services.AddScoped<IReportOfficeHttpRepository, ReportOfficeHttpRepository>();
builder.Services.AddScoped<ICustomerOfficeHttpRepository, CustomerOfficeHttpRepository>();
// warehouse repository
builder.Services.AddScoped<IWarehouseHttpRepository, WarehouseHttpRepository>();

View file

@ -52,12 +52,12 @@
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/office/no">
<i class="bi-file-spreadsheet pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Sverige
<i class="bi-file-spreadsheet pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Norge
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/office/se">
<i class="bi-file-spreadsheet pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Norge
<i class="bi-file-spreadsheet pe-2" style="font-size:1.3em;" aria-hidden="true"></i> Sverige
</NavLink>
</div>
<div class="nav-item px-3">