This commit is contained in:
Frede Hundewadt 2023-05-15 08:36:23 +02:00
parent 328a2d89f8
commit d77f3b612f
66 changed files with 548 additions and 193 deletions

View file

@ -26,7 +26,7 @@ namespace Wonky.Client.HttpRepository;
/// <summary>
/// Implementing Interface Activity CRM Http repository
/// </summary>
public class AdvisorActivityRepository : IAdvisorActivityRepository
public class CrmActivityRepository : ICrmActivityRepository
{
private readonly JsonSerializerOptions? _options = new JsonSerializerOptions
{
@ -34,12 +34,12 @@ public class AdvisorActivityRepository : IAdvisorActivityRepository
};
private readonly NavigationManager _navigation;
private readonly ILogger<AdvisorActivityRepository> _logger;
private readonly ILogger<CrmActivityRepository> _logger;
private readonly HttpClient _client;
private readonly ApiConfig _api;
public AdvisorActivityRepository(HttpClient client,
ILogger<AdvisorActivityRepository> logger,
public CrmActivityRepository(HttpClient client,
ILogger<CrmActivityRepository> logger,
NavigationManager navigation, IOptions<ApiConfig> configuration)
{
_client = client;

View file

@ -22,7 +22,7 @@ using Wonky.Entity.DTO;
namespace Wonky.Client.HttpRepository;
public class AdvisorContactRepository : IAdvisorContactRepository
public class CrmContactRepository : ICrmContactRepository
{
private readonly JsonSerializerOptions _options = new ()
{
@ -30,12 +30,12 @@ public class AdvisorContactRepository : IAdvisorContactRepository
};
private readonly NavigationManager _navigation;
private ILogger<AdvisorContactRepository> _logger;
private ILogger<CrmContactRepository> _logger;
private readonly HttpClient _client;
private readonly ApiConfig _conf;
public AdvisorContactRepository(HttpClient client,
ILogger<AdvisorContactRepository> logger,
public CrmContactRepository(HttpClient client,
ILogger<CrmContactRepository> logger,
NavigationManager navigation,
IOptions<ApiConfig> apiConfig)
{

View file

@ -22,7 +22,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.HttpRepository;
public class AdvisorCustomerHistoryRepository : IAdvisorCustomerHistoryRepository
public class CrmCustomerHistoryRepository : ICrmCustomerHistoryRepository
{
private readonly JsonSerializerOptions _options = new JsonSerializerOptions
{
@ -30,12 +30,12 @@ public class AdvisorCustomerHistoryRepository : IAdvisorCustomerHistoryRepositor
};
private readonly NavigationManager _navigation;
private ILogger<AdvisorCustomerHistoryRepository> _logger;
private ILogger<CrmCustomerHistoryRepository> _logger;
private readonly HttpClient _client;
private readonly ApiConfig _api;
public AdvisorCustomerHistoryRepository(
HttpClient client, ILogger<AdvisorCustomerHistoryRepository> logger,
public CrmCustomerHistoryRepository(
HttpClient client, ILogger<CrmCustomerHistoryRepository> logger,
NavigationManager navigation, IOptions<ApiConfig> configuration)
{
_client = client;

View file

@ -27,7 +27,7 @@ using Wonky.Entity.Requests;
namespace Wonky.Client.HttpRepository;
public class AdvisorCustomerRepository : IAdvisorCustomerRepository
public class CrmCustomerRepository : ICrmCustomerRepository
{
private readonly JsonSerializerOptions _options = new()
{
@ -35,12 +35,12 @@ public class AdvisorCustomerRepository : IAdvisorCustomerRepository
};
private readonly NavigationManager _navigation;
private ILogger<AdvisorCustomerRepository> _logger;
private ILogger<CrmCustomerRepository> _logger;
private readonly HttpClient _client;
private readonly ApiConfig _conf;
public AdvisorCustomerRepository(HttpClient client,
ILogger<AdvisorCustomerRepository> logger,
public CrmCustomerRepository(HttpClient client,
ILogger<CrmCustomerRepository> logger,
NavigationManager navigation,
IOptions<ApiConfig> apiConfig)
{

View file

@ -0,0 +1,38 @@
using System.Net.Http.Json;
using System.Text.Json;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Options;
using Wonky.Entity.Configuration;
using Wonky.Entity.DTO;
using Wonky.Entity.Views;
namespace Wonky.Client.HttpRepository;
public class CrmPublicProductRepository : ICrmPublicProductRepository
{
private readonly JsonSerializerOptions? _options = new()
{
PropertyNameCaseInsensitive = true
};
private readonly NavigationManager _navigation;
private ILogger<CrmPublicProductRepository> _logger;
private readonly HttpClient _client;
private readonly ApiConfig _api;
public CrmPublicProductRepository(HttpClient client, ILogger<CrmPublicProductRepository> logger,
NavigationManager navigation, IOptions<ApiConfig> configuration)
{
_client = client;
_logger = logger;
_navigation = navigation;
_api = configuration.Value;
}
public async Task<List<ExternalProductListView>> GetProducts()
{
var result = await _client
.GetFromJsonAsync<List<ExternalProductListView>>(_api.PublicProducts, _options);
return result ?? new List<ExternalProductListView>();
}
}

View file

@ -23,7 +23,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.HttpRepository;
public class AdvisorReportRepository : IAdvisorReportRepository
public class CrmSalesReportRepository : ICrmSalesReportRepository
{
private readonly JsonSerializerOptions _options = new JsonSerializerOptions
{
@ -31,12 +31,12 @@ public class AdvisorReportRepository : IAdvisorReportRepository
};
private readonly NavigationManager _navigation;
private ILogger<AdvisorReportRepository> _logger;
private ILogger<CrmSalesReportRepository> _logger;
private readonly HttpClient _client;
private readonly ApiConfig _api;
public AdvisorReportRepository(HttpClient client,
ILogger<AdvisorReportRepository> logger,
public CrmSalesReportRepository(HttpClient client,
ILogger<CrmSalesReportRepository> logger,
NavigationManager navigation, IOptions<ApiConfig> configuration)
{
_client = client;

View file

@ -22,7 +22,7 @@ using Wonky.Entity.DTO;
namespace Wonky.Client.HttpRepository;
public class AdvisorTaskItemRepository : IAdvisorTaskItemRepository
public class CrmTaskItemRepository : ICrmTaskItemRepository
{
private readonly JsonSerializerOptions _options = new JsonSerializerOptions
{
@ -31,12 +31,12 @@ public class AdvisorTaskItemRepository : IAdvisorTaskItemRepository
};
private readonly NavigationManager _navigation;
private ILogger<AdvisorTaskItemRepository> _logger;
private ILogger<CrmTaskItemRepository> _logger;
private readonly HttpClient _client;
private readonly ApiConfig _apiConfig;
public AdvisorTaskItemRepository(HttpClient client,
ILogger<AdvisorTaskItemRepository> logger,
public CrmTaskItemRepository(HttpClient client,
ILogger<CrmTaskItemRepository> logger,
NavigationManager navigation, IOptions<ApiConfig> configuration)
{
_client = client;

View file

@ -23,7 +23,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.HttpRepository;
public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository
public class CrmWorkplaceRepository : ICrmWorkplaceRepository
{
private readonly JsonSerializerOptions? _options = new JsonSerializerOptions
{
@ -31,13 +31,13 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository
};
private readonly NavigationManager _navigation;
private ILogger<AdvisorWorkplaceRepository> _logger;
private ILogger<CrmWorkplaceRepository> _logger;
private readonly HttpClient _client;
private readonly ApiConfig _api;
public AdvisorWorkplaceRepository(HttpClient client,
ILogger<AdvisorWorkplaceRepository> logger,
public CrmWorkplaceRepository(HttpClient client,
ILogger<CrmWorkplaceRepository> logger,
NavigationManager navigation,
IOptions<ApiConfig> configuration)
{

View file

@ -21,7 +21,7 @@ namespace Wonky.Client.HttpRepository;
/// <summary>
/// Interface Activity CRM Http repository
/// </summary>
public interface IAdvisorActivityRepository
public interface ICrmActivityRepository
{
/// <summary>
/// Get a list of open quotes

View file

@ -21,7 +21,7 @@ namespace Wonky.Client.HttpRepository;
/// Interface for Contacts CRM Http repository
/// </summary>
/// <returns></returns>
public interface IAdvisorContactRepository
public interface ICrmContactRepository
{
/// <summary>
/// Create Contact

View file

@ -20,7 +20,7 @@ namespace Wonky.Client.HttpRepository;
/// <summary>
/// Interface Customer History CRM Http repository
/// </summary>
public interface IAdvisorCustomerHistoryRepository
public interface ICrmCustomerHistoryRepository
{
/// <summary>
/// Fetch Invoice LIst

View file

@ -22,7 +22,7 @@ namespace Wonky.Client.HttpRepository;
/// <summary>
/// Interface Customer CRM Http repository
/// </summary>
public interface IAdvisorCustomerRepository
public interface ICrmCustomerRepository
{
/// <summary>
/// Get a list of CRM customers (SalesRep)

View file

@ -0,0 +1,9 @@
using Wonky.Entity.DTO;
using Wonky.Entity.Views;
namespace Wonky.Client.HttpRepository;
public interface ICrmPublicProductRepository
{
Task<List<ExternalProductListView>> GetProducts();
}

View file

@ -21,7 +21,7 @@ namespace Wonky.Client.HttpRepository;
/// <summary>
/// Interface Report Http repository
/// </summary>
public interface IAdvisorReportRepository
public interface ICrmSalesReportRepository
{
/// <summary>
/// Report Exist for given data (SalesRep)

View file

@ -20,7 +20,7 @@ namespace Wonky.Client.HttpRepository;
/// <summary>
/// Interface for handling CRM Tasks http repository
/// </summary>
public interface IAdvisorTaskItemRepository
public interface ICrmTaskItemRepository
{
/// <summary>
/// Get Task List (SalesRep)

View file

@ -21,7 +21,7 @@ namespace Wonky.Client.HttpRepository;
/// <summary>
/// Interface for handling Customer Workplaces (chemical document service)
/// </summary>
public interface IAdvisorWorkplaceRepository
public interface ICrmWorkplaceRepository
{
/// <summary>
/// Get Workplaces for given customer id
@ -70,6 +70,15 @@ public interface IAdvisorWorkplaceRepository
/// <returns></returns>
Task<WorkplaceInventory> GetWorkplaceInventory(string companyId, string workplaceId);
/// <summary>
/// Remove single document by Id
/// </summary>
/// <param name="companyId"></param>
/// <param name="workplaceId"></param>
/// <param name="documentId"></param>
/// <returns></returns>
Task DeleteWorkplaceDocuments(string companyId, string workplaceId, string documentId);
/// <summary>
/// Remove a document pair from the workplace
/// </summary>
@ -79,6 +88,4 @@ public interface IAdvisorWorkplaceRepository
/// <param name="apbDocumentId"></param>
/// <returns></returns>
Task DeleteWorkplaceDocuments(string companyId, string workplaceId, string apbDocumentId, string apvDocumentId);
Task DeleteWorkplaceDocuments(string companyId, string workplaceId, string documentId);
}

View file

@ -0,0 +1,59 @@
using System.Text.Json;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Options;
using Wonky.Entity.Configuration;
using Wonky.Entity.DTO;
namespace Wonky.Client.HttpRepository;
public class SystemKrvProductRepository : ISystemKrvProductRepository
{
private readonly JsonSerializerOptions? _options = new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
};
private readonly NavigationManager _navigation;
private ILogger<SystemKrvProductRepository> _logger;
private readonly HttpClient _client;
private readonly ApiConfig _api;
public SystemKrvProductRepository(HttpClient client, ILogger<SystemKrvProductRepository> logger,
NavigationManager navigation, IOptions<ApiConfig> configuration)
{
_client = client;
_logger = logger;
_navigation = navigation;
_api = configuration.Value;
}
public async Task<List<KrvProductDto>> GetProducts()
{
throw new NotImplementedException();
}
public async Task<KrvProductDto> GetProduct(string productId)
{
throw new NotImplementedException();
}
public async Task<KrvProductDto> CreateProduct(KrvProductDto product)
{
throw new NotImplementedException();
}
public async Task<KrvProductDto> DeleteProduct(string productId)
{
throw new NotImplementedException();
}
public async Task<KrvProductDto> UpdateProduct(string productId, KrvProductDto product)
{
throw new NotImplementedException();
}
public async Task EditProduct(string productId)
{
throw new NotImplementedException();
}
}

View file

@ -27,7 +27,7 @@ public partial class CustomerInventoryReorderOverlay
{
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public SalesItemView SalesItem { get; set; } = new();
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
[Inject] public ICrmCustomerHistoryRepository HistoryRepo { get; set; }
[Parameter] public EventCallback<DraftItem> OnSelected { get; set; }
private List<ProductHistoryView>? History { get; set; } = new();
private DraftItem SelectedItem { get; set; } = new();

View file

@ -27,7 +27,7 @@ public partial class CustomerInvoiceViewOverlay : IDisposable
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string InvoiceId { get; set; } = "";
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
[Inject] public ICrmCustomerHistoryRepository HistoryRepo { get; set; }
private string _modalDisplay = "";
private bool _showBackdrop;
private InvoiceView Invoice { get; set; } = new();

View file

@ -27,7 +27,7 @@ public partial class ProductHistoryOverlay
// [Parameter] public EventCallback<decimal> OnSelected { get; set; }
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string ItemSku { get; set; } = "";
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
[Inject] public ICrmCustomerHistoryRepository HistoryRepo { get; set; }
private List<ProductHistoryView>? History { get; set; }
private string ProductName { get; set; } = "";
private string _modalDisplay = "";

View file

@ -27,7 +27,7 @@ public partial class ProductPriceHistoryOverlay
[Parameter] public EventCallback<decimal> OnSelected { get; set; }
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string Sku { get; set; } = "";
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
[Inject] public ICrmCustomerHistoryRepository HistoryRepo { get; set; }
private List<ProductHistoryView>? ProductHistory { get; set; }
private string ProductName { get; set; } = "";
private string _modalDisplay = "";

View file

@ -387,7 +387,7 @@ else
<div class="row mb-2">
<div class="col-sm-6">
<a class="btn btn-warning" href="/advisor/customers/@Company.CompanyId"><i class="bi-arrow-left"></i> Kundekort</a>
<a class="btn btn-warning" href="/advisor/customers/@Company.CompanyId"><i class="bi-chevron-left"></i> Stamkort</a>
</div>
<div class="col-sm-4 text-end">
@*

View file

@ -45,10 +45,10 @@ public partial class AdvisorActivityCreatePage : IDisposable
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public ICountryCatalogRepository CatalogRepo { get; set; }
[Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; }
[Inject] public IAdvisorActivityRepository ActivityRepo { get; set; }
[Inject] public IAdvisorReportRepository ReportRepo { get; set; }
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
[Inject] public ICrmCustomerRepository CompanyRepo { get; set; }
[Inject] public ICrmActivityRepository ActivityRepo { get; set; }
[Inject] public ICrmSalesReportRepository ReportRepo { get; set; }
[Inject] public ICrmCustomerHistoryRepository HistoryRepo { get; set; }
[Inject] public IUserInfoService UserInfo { get; set; }
// #############################################################

View file

@ -33,8 +33,8 @@ public partial class AdvisorActivityTodayListPage : IDisposable
[Inject] public ILogger<AdvisorActivityTodayListPage> Logger { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public IAdvisorActivityRepository ActivityRepo { get; set; }
[Inject] public IAdvisorReportRepository ReportRepo { get; set; }
[Inject] public ICrmActivityRepository ActivityRepo { get; set; }
[Inject] public ICrmSalesReportRepository ReportRepo { get; set; }
[Inject] public IToastService Toaster { get; set; }
private ReportStatusView ReportStatusView { get; set; } = new();
private UserPreference UserPreference { get; set; } = new();

View file

@ -31,7 +31,7 @@ public partial class AdvisorActivityViewEditPage : IDisposable
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string OrderId { get; set; } = "";
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IAdvisorActivityRepository AdvisorActivityRepo { get; set; }
[Inject] public ICrmActivityRepository CrmActivityRepo { get; set; }
[Inject] public ILogger<AdvisorActivityViewEditPage> Logger { get; set; }
[Inject] public IToastService Toaster { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
@ -49,7 +49,7 @@ public partial class AdvisorActivityViewEditPage : IDisposable
Interceptor.RegisterBeforeSendEvent();
NoteContext = new EditContext(Note);
NoteContext.OnFieldChanged += HandleFieldChanged;
ReportItem = await AdvisorActivityRepo.GetReportItem(OrderId);
ReportItem = await CrmActivityRepo.GetReportItem(OrderId);
Note.ActivityId = ReportItem.ActivityId;
Note.OfficeNote = ReportItem.OfficeNote;
Logger.LogDebug("ReportItem => \n {}", JsonSerializer.Serialize(ReportItem));
@ -66,7 +66,7 @@ public partial class AdvisorActivityViewEditPage : IDisposable
Working = true;
Disabled = true;
Logger.LogDebug("OfficeNote => \n {}", JsonSerializer.Serialize(Note));
await AdvisorActivityRepo.UpdateOfficeNote(Note);
await CrmActivityRepo.UpdateOfficeNote(Note);
Toaster.ShowInfo($"{ReportItem.ESalesNumber} - notat opdateret");
Navigator.NavigateTo("/advisor/activity-today");
}

View file

@ -28,10 +28,10 @@
<h4 class="pt-1">@Company.Name</h4>
</div>
<div class="col-sm-3 align-content-end">
<a class="btn btn-primary d-block" href="/advisor/customers/@Company.CompanyId"><i class="bi-arrow-right"></i> Kundekort</a>
<a class="btn btn-primary d-block" href="/advisor/customers/@Company.CompanyId"><i class="bi-chevron-left"></i> Stamkort</a>
</div>
<div class="col-sm-3 align-content-end">
<a class="btn btn-primary d-block" href="/advisor/customers/@Company.CompanyId/activities/new"><i class="bi-arrow-right"></i> Besøg</a>
<a class="btn btn-primary d-block" href="/advisor/customers/@Company.CompanyId/activities/new"><i class="bi-chevron-right"></i> Besøg</a>
</div>
</div>

View file

@ -28,8 +28,8 @@ public partial class AdvisorCustomerActivityListPage : IDisposable
{
// ######################################################################
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IAdvisorActivityRepository AdvisorActivityRepo { get; set; }
[Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; }
[Inject] public ICrmActivityRepository CrmActivityRepo { get; set; }
[Inject] public ICrmCustomerRepository CompanyRepo { get; set; }
// ######################################################################
[Parameter] public string CompanyId { get; set; } = "";
@ -53,7 +53,7 @@ public partial class AdvisorCustomerActivityListPage : IDisposable
private async Task GetActivities()
{
ActivityList = await AdvisorActivityRepo.GetCustomerActivities(CompanyId);
ActivityList = await CrmActivityRepo.GetCustomerActivities(CompanyId);
if (ActivityList.Any())
ActivityList = ActivityList.OrderByDescending(x => x.OrderDate).ToList();
}

View file

@ -38,7 +38,7 @@ public partial class AdvisorCustomerCreatePage : IDisposable
[Inject] public ILogger<AdvisorCustomerCreatePage> Logger { get; set; }
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; }
[Inject] public ICrmCustomerRepository CompanyRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public VatInfoLookupService VatService { get; set; }
[Inject] public IUserInfoService UserInfoService { get; set; }

View file

@ -25,10 +25,10 @@
<h4 class="pt-1">Produkt oversigt @Company.Name</h4>
</div>
<div class="col-sm-3 align-content-end d-print-none">
<a class="btn btn-primary d-block" href="/advisor/customers/@CompanyId"><i class="bi-arrow-right"></i> Kundekort</a>
<a class="btn btn-primary d-block" href="/advisor/customers/@CompanyId"><i class="bi-chevron-left"></i> Stamkort</a>
</div>
<div class="col-sm-3 align-content-end d-print-none">
<a class="btn btn-primary d-block" href="/advisor/customers/@CompanyId/activities/new"><i class="bi-arrow-right"></i> Nyt Besøg</a>
<a class="btn btn-primary d-block" href="/advisor/customers/@CompanyId/activities/new"><i class="bi-chevron-right"></i> Besøg</a>
</div>
</div>

View file

@ -32,8 +32,8 @@ namespace Wonky.Client.Pages;
public partial class AdvisorCustomerInventoryListPage : IDisposable
{
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
[Inject] public IAdvisorCustomerRepository CustomerRepo { get; set; }
[Inject] public ICrmCustomerHistoryRepository HistoryRepo { get; set; }
[Inject] public ICrmCustomerRepository CustomerRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IToastService Toaster { get; set; }
[Inject] public ILogger<AdvisorCustomerInventoryListPage> Logger { get; set; }

View file

@ -26,10 +26,10 @@
<h4 class="pt-1">@Company.Name</h4>
</div>
<div class="col-sm-3 align-content-end">
<a class="btn btn-primary d-block" href="/advisor/customers/@Company.CompanyId"><i class="bi-arrow-right"></i> Kundekort</a>
<a class="btn btn-primary d-block" href="/advisor/customers/@Company.CompanyId"><i class="bi-chevron-left"></i> Stamkort</a>
</div>
<div class="col-sm-3 align-content-end">
<a class="btn btn-primary d-block" href="/advisor/customers/@Company.CompanyId/activities/new"><i class="bi-arrow-right"></i> Besøg</a>
<a class="btn btn-primary d-block" href="/advisor/customers/@Company.CompanyId/activities/new"><i class="bi-chevron-right"></i> Besøg</a>
</div>
</div>
<CustomerInvoiceListComponent OnShowInvoice="CallInvoiceModal" CompanyId="@CompanyId" InvoiceList="@CompanyInvoices.Invoices"/>

View file

@ -28,9 +28,9 @@ namespace Wonky.Client.Pages;
public partial class AdvisorCustomerInvoiceListPage : IDisposable
{
[Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; }
[Inject] public ICrmCustomerRepository CompanyRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
[Inject] public ICrmCustomerHistoryRepository HistoryRepo { get; set; }
[Inject] public IToastService Toaster { get; set; }
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public ILogger<AdvisorCustomerInvoiceListPage> Logger { get; set; }

View file

@ -31,7 +31,7 @@ public partial class AdvisorCustomerPagedListPage : IDisposable
// ######################################################################3
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public UserPreferenceService PreferenceService { get; set; }
[Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; }
[Inject] public ICrmCustomerRepository CompanyRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public IUserInfoService UserInfoService { get; set; }

View file

@ -19,7 +19,7 @@
@using Wonky.Entity.Configuration
@attribute [Authorize(Roles = "Advisor")]
@page "/advisor/customers/{CompanyId}"
<PageTitle>Kundekort for @Company.Name</PageTitle>
<PageTitle>Stamkort for @Company.Name</PageTitle>
@*
<div class="led-container">
@ -50,10 +50,16 @@
<h4>Ring til kontoret. Denne konto er spærret med kode '@Company.Blocked'</h4>
</div>
}
<div class="row pt-2 mb-2 rounded rounded-2 bg-dark text-white">
<div class="col-sm-12">
<span class="h3">@Company.Name</span> <span>(@Company.Account)</span>
<div class="row pt-2 pb-2 mb-2 rounded rounded-2 bg-dark text-white">
<div class="col-sm-10">
<div class="mt-1">
<span class="h3">@Company.Name</span> <span>(@Company.Account)</span>
</div>
</div>
<div class="col-sm-2 text-end">
<a class="btn btn-primary" href="/advisor/customers"><i class="bi-chevron-left"></i> Tilbage</a>
</div>
</div>
// erp context
<EditForm EditContext="ErpContext">
@ -116,12 +122,12 @@
@if (!Kanvas)
{
@if (AppInfo.Value.Rc)
@if (AppInfo!.Value!.Rc)
{
<label for="segment" class="col-sm-1 col-form-label-sm">Segment</label>
<div class="col-sm-2">
<InputSelect id="segment" class="form-select bg-warning text-bg-warning" @bind-Value="@Company.Segment">
<option value="0" disabled>segment</option>
<option value="" disabled>segment</option>
<option value="1">AUTO</option>
<option value="2">INDUSTRI</option>
</InputSelect>

View file

@ -40,9 +40,9 @@ public partial class AdvisorCustomerViewEditPage : IDisposable
[Inject] public IToastService Toaster { get; set; }
[Inject] public ILogger<AdvisorCustomerViewEditPage> Logger { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public IAdvisorCustomerRepository CustomerRepo { get; set; }
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
[Inject] public IAdvisorContactRepository AdvisorContactRepo { get; set; }
[Inject] public ICrmCustomerRepository CustomerRepo { get; set; }
[Inject] public ICrmCustomerHistoryRepository HistoryRepo { get; set; }
[Inject] public ICrmContactRepository CrmContactRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public VatInfoLookupService VatService { get; set; }
[Inject] public ILocalStorageService Storage { get; set; }
@ -206,7 +206,7 @@ public partial class AdvisorCustomerViewEditPage : IDisposable
private async Task FetchContacts(string companyId)
{
// load contacts
Contacts = await AdvisorContactRepo.GetContacts(companyId);
Contacts = await CrmContactRepo.GetContacts(companyId);
if (Contacts.Any() && Contacts.Count > 1)
Contacts = Contacts.OrderBy(x => x.FirstName).ToList();
}
@ -273,14 +273,14 @@ public partial class AdvisorCustomerViewEditPage : IDisposable
// new contact created
Logger.LogDebug("create => {}", jsonContact);
// send post request to backend
await AdvisorContactRepo.CreateContact(contact);
await CrmContactRepo.CreateContact(contact);
}
else
{
// contact modified
Logger.LogDebug("update => {}", jsonContact);
// send put request to backend
await AdvisorContactRepo.UpdateContact(contact);
await CrmContactRepo.UpdateContact(contact);
}
// reset selected contact
@ -299,7 +299,7 @@ public partial class AdvisorCustomerViewEditPage : IDisposable
Working = true;
Logger.LogDebug("delete {}", contactId);
// send delete request to backend
await AdvisorContactRepo.DeleteContact(CompanyId, contactId);
await CrmContactRepo.DeleteContact(CompanyId, contactId);
// reset selected contact
SelectedContact = new ContactDto();
// reload contacts from backend

View file

@ -29,7 +29,7 @@ namespace Wonky.Client.Pages;
public partial class AdvisorQuoteListPage : IDisposable
{
[Inject] public IAdvisorActivityRepository AdvisorActivityRepo { get; set; }
[Inject] public ICrmActivityRepository CrmActivityRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public ILogger<AdvisorQuoteListPage> Logger { get; set; }
[Inject] public IToastService Toaster { get; set; }
@ -44,7 +44,7 @@ public partial class AdvisorQuoteListPage : IDisposable
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
Working = true;
QuoteList = await AdvisorActivityRepo.GetQuotes();
QuoteList = await CrmActivityRepo.GetQuotes();
await Storage.SetItemAsync("quotes", QuoteList.OrderBy(x => x.Company.Name));
Working = false;
// filter quotes - if any - default to QStatus.NoteOpen
@ -76,12 +76,12 @@ public partial class AdvisorQuoteListPage : IDisposable
quote.OrderDate = $"{DateTime.Now:yyyy-MM-dd}";
quote.QuoteStatusEnum = Utils.EnumToString(args.Status);
// send update request to backend
var response = await AdvisorActivityRepo.UpdateQuoteStatus(quote);
var response = await CrmActivityRepo.UpdateQuoteStatus(quote);
Toaster.ShowInfo($"{response.Message}");
// clear and reload quotes
QuoteList = new List<ReportItemView>();
await Storage.RemoveItemAsync("quotes");
QuoteList = await AdvisorActivityRepo.GetQuotes();
QuoteList = await CrmActivityRepo.GetQuotes();
// store quotes in local storage
await Storage.SetItemAsync("quotes", QuoteList.OrderBy(x => x.Company.Name));
// filter quotes - if any - based on active filter

View file

@ -34,7 +34,7 @@ public partial class AdvisorReportCreatePage : IDisposable
// ##########################################################################
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public UserPreferenceService PreferenceService { get; set; }
[Inject] public IAdvisorReportRepository AdvisorReportRepo { get; set; }
[Inject] public ICrmSalesReportRepository CrmSalesReportRepo { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public ILogger<AdvisorReportCreatePage> Logger { get; set; }
[Inject] public IToastService Toaster { get; set; }
@ -95,7 +95,7 @@ public partial class AdvisorReportCreatePage : IDisposable
ThisWorkDate = DateTime.Parse(WorkDate);
}
if (await AdvisorReportRepo.ReportExist(WorkDate))
if (await CrmSalesReportRepo.ReportExist(WorkDate))
{
Navigator.NavigateTo($"/advisor/reports/view/{ThisWorkDate:yyyy-MM-dd}");
}
@ -133,7 +133,7 @@ public partial class AdvisorReportCreatePage : IDisposable
InitialValues = new ReportFiguresDto();
Activities = new List<ReportItemView>();
var data = await AdvisorReportRepo.InitializeReportData(WorkDate);
var data = await CrmSalesReportRepo.InitializeReportData(WorkDate);
if(data.ReportClosed)
Navigator.NavigateTo($"/advisor/reports/view/{ThisWorkDate:yyyy-MM-dd}");
@ -201,7 +201,7 @@ public partial class AdvisorReportCreatePage : IDisposable
return;
Working = true;
var result = await AdvisorReportRepo.CreateReport(WorkDate, Report);
var result = await CrmSalesReportRepo.CreateReport(WorkDate, Report);
Logger.LogDebug("CreateReport.result => {}", JsonSerializer.Serialize(result));
// reset km and date confirmation

View file

@ -24,7 +24,7 @@ namespace Wonky.Client.Pages;
public partial class AdvisorReportListPage : IDisposable
{
[Inject] public IAdvisorReportRepository AdvisorReportRepo { get; set; }
[Inject] public ICrmSalesReportRepository CrmSalesReportRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public ILogger<AdvisorReportListPage> Logger { get; set; }
@ -39,7 +39,7 @@ public partial class AdvisorReportListPage : IDisposable
Working = true;
var reports = await AdvisorReportRepo.GetReports();
var reports = await CrmSalesReportRepo.GetReports();
if (reports.Any())
ReportList = reports.OrderByDescending(x => x.ReportDate).ToList();

View file

@ -30,7 +30,7 @@ namespace Wonky.Client.Pages;
public partial class AdvisorReportViewPage : IDisposable
{
[Parameter] public string ReportDate { get; set; }
[Inject] public IAdvisorReportRepository AdvisorReportRepo { get; set; }
[Inject] public ICrmSalesReportRepository CrmSalesReportRepo { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
@ -106,7 +106,7 @@ public partial class AdvisorReportViewPage : IDisposable
Working = true;
// fetch report
Report = await AdvisorReportRepo.GetReport(workDate);
Report = await CrmSalesReportRepo.GetReport(workDate);
// extract activities
Activities = Report.ReportItems.Where(x => x.Lines.Any()).ToList();

View file

@ -30,7 +30,7 @@ public partial class AdvisorTaskItemListCrmPage : IDisposable
[Inject] public ILogger<AdvisorTaskItemListCrmPage> Logger { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public IAdvisorTaskItemRepository TaskRepo { get; set; }
[Inject] public ICrmTaskItemRepository TaskRepo { get; set; }
[Inject] public IToastService Toaster { get; set; }
private UserPreference Profile { get; set; } = new();
private string WorkDate { get; set; } = $"{DateTime.Now:yyyy-MM-dd}";

View file

@ -28,7 +28,7 @@ public partial class AdvisorTaskItemViewCrmPage : IDisposable
{
[Parameter] public string TaskItemId { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IAdvisorTaskItemRepository TaskRepo { get; set; }
[Inject] public ICrmTaskItemRepository TaskRepo { get; set; }
private TaskItemDto TaskItem { get; set; } = new ();
private EditContext TaskContext { get; set; }
private bool Working { get; set; } = true;

View file

@ -0,0 +1,52 @@
@* 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
@using Wonky.Client.Components
@attribute [Authorize(Roles = "Advisor")]
@page "/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}/newdoc"
<PageTitle>@Workplace.CompanyName - @Workplace.Name</PageTitle>
<div class="row -mb-3">
<div class="col-sm-4">
<h2>@Workplace.CompanyName</h2>
</div>
<div class="col-sm-4">
<h3>@Workplace.Name @(!string.IsNullOrWhiteSpace(Workplace.Description) ? $"- {Workplace.Description}" : "")</h3>
</div>
<div class="col-sm-2">
<a class="btn btn-primary" href="/advisor/customers/@CompanyId"><i class="bi-chevron-left"></i> Stamkort</a>
</div>
<div class="col-sm-2 text-end">
<a class="btn btn-primary" href="/advisor/customers/@CompanyId/workplaces/@WorkplaceId"><i class="bi-chevron-left"></i> Tilbage</a>
</div>
</div>
@if (Working)
{
<WorkingThreeDots/>
}
@*
<div class="col-sm-12 col-md-6">
<div class="form-floating">
<InputText id="workplaceName" class="form-control" @bind-Value="Workplace.Name" placeholder="Navn for arbejdssted"/>
<label for="workplaceName">Navn for arbejdssted</label>
<ValidationMessage For="@(() => Workplace.Name)"></ValidationMessage>
</div>
</div>
*@

View file

@ -0,0 +1,109 @@
// 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 System.Text;
using System.Text.Json;
using Blazored.Toast.Services;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;
using Wonky.Client.HttpInterceptors;
using Wonky.Client.HttpRepository;
using Wonky.Client.Local.Services;
using Wonky.Client.Models;
using Wonky.Client.Shared;
using Wonky.Entity.DTO;
using Wonky.Entity.Views;
using Wonky.Client.Helpers;
#pragma warning disable CS8618
namespace Wonky.Client.Pages;
public partial class CrmCustomerWorkplaceDocumentAddPage : IDisposable
{
// #############################################################
[Inject] public ICrmWorkplaceRepository Workplaces { get; set; }
[Inject] public ICrmWorkplaceRepository WorkplaceRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public ILogger<CrmCustomerWorkplaceDocumentAddPage> Logger { get; set; }
[Inject] public ISystemSendMailService SendMail { get; set; }
[Inject] public IToastService Toaster { get; set; }
// #############################################################
[Parameter] public string CompanyId { get; set; } = "";
[Parameter] public string WorkplaceId { get; set; } = "";
// #############################################################
private WorkplaceDto Workplace { get; set; } = new();
private EditContext WorkplaceContext { get; set; }
private bool Working { get; set; } = true;
private WorkplaceInventory WorkplaceInventory { get; set; } = new();
private List<DocView> DocViews { get; set; } = new();
private ConfirmDeleteModal ConfirmDeleteWorkplace { get; set; }
private ConfirmDeleteModal ConfirmDeleteProduct { get; set; }
private string DeleteMessage { get; set; } = "";
private string LinkRecipients { get; set; } = "";
private const string CopyText = "Kopier";
private const string CopyStyle = "btn btn-primary";
private const string SuccessText = "Kopieret";
private const string SuccessStyle = "btn btn-success";
private string _buttonText = CopyText;
private string _buttonStyle = CopyStyle;
protected override async Task OnInitializedAsync()
{
WorkplaceContext = new EditContext(Workplace);
WorkplaceContext.OnFieldChanged += HandleFieldChanged!;
WorkplaceContext.OnValidationStateChanged += ValidationChanged!;
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
Workplace = await Workplaces.GetWorkplace(CompanyId, WorkplaceId);
WorkplaceInventory = await WorkplaceRepo.GetWorkplaceInventory(CompanyId, WorkplaceId);
Working = false;
}
private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
{
WorkplaceContext.Validate();
StateHasChanged();
}
private void ValidationChanged(object sender, ValidationStateChangedEventArgs e)
{
WorkplaceContext.OnFieldChanged -= HandleFieldChanged!;
WorkplaceContext.OnValidationStateChanged -= ValidationChanged!;
WorkplaceContext = new EditContext(Workplace);
WorkplaceContext.OnFieldChanged += HandleFieldChanged!;
WorkplaceContext.OnValidationStateChanged += ValidationChanged!;
}
public void Dispose()
{
WorkplaceContext.OnFieldChanged += HandleFieldChanged!;
WorkplaceContext.OnValidationStateChanged += ValidationChanged!;
Interceptor.DisposeEvent();
}
}

View file

@ -27,7 +27,7 @@
<h3>@Company.Name</h3>
</div>
<div class="col-sm-3 d-flex">
<a class="btn btn-primary mx-auto" href="/advisor/customers/@CompanyId"><i class="bi-chevron-left"></i> Kundekort</a>
<a class="btn btn-primary mx-auto" href="/advisor/customers/@CompanyId"><i class="bi-chevron-left"></i> Stamkort</a>
</div>
<div class="col-sm-3 d-flex">
<a class="btn btn-primary mx-auto" href="/advisor/customers/@CompanyId/workplaces/new"><i class="bi-plus-lg"></i> Arbejdssted</a>

View file

@ -24,11 +24,11 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class AdvisorCustomerWorkplaceListPage : IDisposable
public partial class CrmCustomerWorkplaceListPage : IDisposable
{
// ###############################################################
[Inject] public IAdvisorWorkplaceRepository WorkplaceRepo { get; set; }
[Inject] public IAdvisorCustomerRepository CustomerRepo { get; set; }
[Inject] public ICrmWorkplaceRepository WorkplaceRepo { get; set; }
[Inject] public ICrmCustomerRepository CustomerRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
// ###############################################################

View file

@ -22,11 +22,11 @@
<div class="col-sm-8">
<h3>@Company.Name Opret Arbejdssted</h3>
</div>
<div class="col-sm-2 d-flex">
<a class="btn btn-primary mx-auto d-block" href="/advisor/customers/@CompanyId"><i class="bi-chevron-left"></i> Kundekort</a>
<div class="col-sm-2">
<a class="btn btn-primary" href="/advisor/customers/@CompanyId"><i class="bi-chevron-left"></i> Stamkort</a>
</div>
<div class="col-sm-2 d-flex d-block">
<a class="btn btn-primary mx-auto" href="/advisor/customers/@CompanyId"><i class="bi-chevron-left"></i> Arbejdssteder</a>
<div class="col-sm-2 text-end">
<a class="btn btn-primary" href="/advisor/customers/@CompanyId"><i class="bi-chevron-left"></i> Tilbage</a>
</div>
</div>

View file

@ -25,14 +25,15 @@ namespace Wonky.Client.Pages;
#pragma warning disable CS8618
public partial class AdvisorCustomerWorkplaceNew : IDisposable
public partial class CrmCustomerWorkplaceNewPage : IDisposable
{
// ###############################################################
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IAdvisorCustomerRepository CustomerRepo { get; set; }
[Inject] public IAdvisorWorkplaceRepository WorkplaceRepo { get; set; }
[Inject] public ICrmCustomerRepository CustomerRepo { get; set; }
[Inject] public ICrmWorkplaceRepository WorkplaceRepo { get; set; }
[Inject] public IToastService Toaster { get; set; }
[Inject] public ILogger<AdvisorCustomerWorkplaceNew> Logger { get; set; }
[Inject] public ILogger<CrmCustomerWorkplaceNewPage> Logger { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
// ###############################################################
[Parameter] public string CompanyId { get; set; } = "";
@ -76,6 +77,11 @@ public partial class AdvisorCustomerWorkplaceNew : IDisposable
Logger.LogDebug("Workplace {}", JsonSerializer.Serialize(Workplace, new JsonSerializerOptions(JsonSerializerDefaults.Web)));
var result = await WorkplaceRepo.CreateWorkplace(CompanyId, Workplace);
Logger.LogDebug("HTTP result {}", result);
if (!string.IsNullOrWhiteSpace(result))
{
Navigator.NavigateTo($"/advisor/customers/{CompanyId}/workplaces/{result}");
Toaster.ShowSuccess("Arbejdssted er oprettet.");
}
}
private void HandleFieldChanged(object sender, FieldChangedEventArgs e)

View file

@ -26,9 +26,9 @@
<h3>@Workplace.Name @(!string.IsNullOrWhiteSpace(Workplace.Description) ? $"- {Workplace.Description}" : "")</h3>
</div>
<div class="col-sm-2">
<a class="btn btn-primary" href="/advisor/customers/@CompanyId"><i class="bi-chevron-left"></i> Kundekort</a>
<a class="btn btn-primary" href="/advisor/customers/@CompanyId"><i class="bi-chevron-left"></i> Stamkort</a>
</div>
<div class="col-sm-2">
<div class="col-sm-2 text-end">
<a class="btn btn-primary" href="/advisor/customers/@CompanyId/workplaces"><i class="bi-chevron-left"></i> Tilbage</a>
</div>
</div>
@ -98,49 +98,43 @@
<ValidationMessage For="@(() => Workplace.WasteDeposit)"></ValidationMessage>
</div>
</div>
<div class="col-sm-3 mt-3">
<button type="button" class="form-control btn btn-danger" @onclick="@OnConfirmDeleteWorkplace"><i class="bi-trash"></i> Slet</button>
</div>
<div class="col-sm-3 mt-3 text-end">
<div class="col-sm-6 mt-3 text-end">
<button type="submit" class="form-control btn btn-success"><i class="bi-cloud-upload"></i> Gem</button>
</div>
</div>
<div class="row mb-2">
<div class="col-sm-12 col-md-6">
<div class="input-group">
<label class="input-group-text" for="qrlink">
<i class="bi-clipboard-plus"></i>
</label>
<input class="form-control text-muted" id="qrlink" type="text" readonly value="@Workplace.ShortUrl" />
<button type="button" class="@_buttonStyle" @onclick="@OnCopyLink">@_buttonText</button>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div class="input-group">
<label class="input-group-text" for="mailto">
<i class="bi-at"></i>
</label>
<input class="form-control" id="mailto" type="email" placeholder="Indtast email adresse"
@bind-Value:event="onchange" @bind-Value="LinkRecipients" required/>
<button type="button" class="btn btn-primary" onclick="@OnSendLink">Send Link</button>
</div>
</div>
</div>
</EditForm>
<ol class="list-group mb-3">
<li class="list-group-item">
<div class="row">
<div class="col-sm-5">
<div class="h3 pt-1">Produkt Oversigt</div>
<li class="list-group-item text-bg-warning">
<div class="row g-2">
<div class="col-sm-6 pt-2">
<div class="h3">Produkt Oversigt</div>
</div>
<div class="col-sm-4">
<a class="btn btn-primary" href="@Workplace.ShortUrl" target="_blank"><i class="bi-list-ul"></i> Åbn liste med QR-koder</a>
<div class="col-sm-3">
<a class="btn btn-primary" href="@Workplace.ShortUrl" target="_blank"><i class="bi-list-ul"></i> Vis QR-koder</a>
</div>
<div class="col-sm-3 text-end">
<button class="btn btn-primary"><i class="bi-plus-lg"></i> Produkt(er)</button>
</div>
<div class="col-sm-12 col-md-6">
<div class="input-group">
<label class="input-group-text" for="qrlink">
<i class="bi-clipboard-plus"></i>
</label>
<input class="form-control text-muted" id="qrlink" type="text" readonly value="@Workplace.ShortUrl"/>
<button type="button" class="@_buttonStyle" @onclick="@OnCopyLink">@_buttonText</button>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div class="input-group">
<label class="input-group-text" for="mailto">
<i class="bi-at"></i>
</label>
<input class="form-control" id="mailto" type="email" placeholder="Email adresse(r) (max 3)"
@bind-Value:event="onchange" @bind-Value="LinkRecipients" required/>
<button type="button" class="btn btn-primary" onclick="@OnSendLink">Send Link</button>
</div>
</div>
</div>
</li>
@ -153,19 +147,19 @@
<div class="fw-bold mb-1">@docView.VariantName.ToUpperInvariant()</div>
<div class="row">
<div class="col-sm-4">
<span class="me-3">APB</span><a class="btn btn-outline-dark btn-sm" href="@docView.ApbDocLink" target="_blank">@docView.ApbDocLink</a>
<span class="me-4">APB</span> <a class="btn btn-outline-dark btn-sm" href="@docView.ApbDocLink" target="_blank">@docView.ApbDocLink</a>
</div>
<div class="col-sm-4">
<span class="me-3">KAPV</span><a class="btn btn-outline-dark btn-sm" href="@docView.ApvDocLink" target="_blank">@docView.ApvDocLink</a>
<span class="me-3">KAPV</span> <a class="btn btn-outline-dark btn-sm" href="@docView.ApvDocLink" target="_blank">@docView.ApvDocLink</a>
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-danger btn-sm" @onclick="@(() => OnRemoveVariant(docView.ProductId, docView.VariantId))">
<i class="bi-trash"></i>
</button>
</div>
<div class="col-sm-2">
@docView.DocumentDate
</div>
<div class="col-sm-2">
<button type="button" class="btn btn-danger btn-sm" @onclick="@(() => OnRemoveDocument(docView.ProductId, docView.VariantId))">
<i class="bi-trash"></i>
</button>
</div>
</div>
</div>
</li>
@ -173,9 +167,14 @@
}
</ol>
<div class="row">
<div class="col-sm-12 mt-3">
<button type="button" class="btn btn-danger" @onclick="@OnConfirmDeleteWorkplace"><i class="bi-trash"></i> Fjern Arbejdssted og Dokumenter</button>
</div>
</div>
@if (Working)
{
<WorkingThreeDots/>
}
<ConfirmDeleteModal BodyMessage="@DeleteMessage" OnOkClicked="OnDeleteWorkplace" @ref="ConfirmDelete"/>
<ConfirmDeleteModal BodyMessage="@DeleteMessage" OnOkClicked="RemoveWorkplace" @ref="ConfirmDeleteWorkplace"/>

View file

@ -30,15 +30,15 @@ using Wonky.Client.Helpers;
#pragma warning disable CS8618
namespace Wonky.Client.Pages;
public partial class AdvisorCustomerWorkplaceViewEditPage : IDisposable
public partial class CrmCustomerWorkplaceViewEditPage : IDisposable
{
// #############################################################
[Inject] public IAdvisorWorkplaceRepository Workplaces { get; set; }
[Inject] public IAdvisorCustomerRepository CustomerRepo { get; set; }
[Inject] public IAdvisorWorkplaceRepository WorkplaceRepo { get; set; }
[Inject] public ICrmWorkplaceRepository Workplaces { get; set; }
[Inject] public ICrmCustomerRepository CustomerRepo { get; set; }
[Inject] public ICrmWorkplaceRepository WorkplaceRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public ILogger<AdvisorCustomerWorkplaceViewEditPage> Logger { get; set; }
[Inject] public ILogger<CrmCustomerWorkplaceViewEditPage> Logger { get; set; }
[Inject] public ISystemSendMailService SendMail { get; set; }
[Inject] public IUserInfoService UserInfo { get; set; }
[Inject] public IClipboardService Clipboard { get; set; }
@ -54,7 +54,8 @@ public partial class AdvisorCustomerWorkplaceViewEditPage : IDisposable
private bool Working { get; set; } = true;
private WorkplaceInventory WorkplaceInventory { get; set; } = new();
private List<DocView> DocViews { get; set; } = new();
private ConfirmDeleteModal ConfirmDelete { get; set; }
private ConfirmDeleteModal ConfirmDeleteWorkplace { get; set; }
private ConfirmDeleteModal ConfirmDeleteProduct { get; set; }
private string DeleteMessage { get; set; } = "";
private string LinkRecipients { get; set; } = "";
private const string CopyText = "Kopier";
@ -79,7 +80,6 @@ public partial class AdvisorCustomerWorkplaceViewEditPage : IDisposable
DocViews = GenerateDocumentListView();
Working = false;
DeleteMessage = $"Bekræft at du sletter<br/><strong>{Workplace.Name}</strong> fra <strong>{Workplace.CompanyName}</strong>?<br/>AL INFORMATION slettes og handlingen er uigenkaldelig.";
}
@ -153,32 +153,36 @@ public partial class AdvisorCustomerWorkplaceViewEditPage : IDisposable
Working = true;
await Workplaces.UpdateWorkplace(CompanyId, Workplace);
Working = false;
Toaster.ShowSuccess("Arbejdssted er opdateret");
}
private void OnConfirmDeleteWorkplace()
{
DeleteMessage = $"Bekræft at du sletter<br/><strong>{Workplace.Name}</strong> fra <strong>{Workplace.CompanyName}</strong>?<br/>AL INFORMATION slettes og handlingen er uigenkaldelig.";
Logger.LogDebug("ConfirmDeleteWorkplace");
ConfirmDelete.Show();
ConfirmDeleteWorkplace.Show();
}
private async Task OnDeleteWorkplace()
private async Task RemoveWorkplace()
{
Logger.LogDebug("DeleteWorkplace");
Working = true;
await Workplaces.DeleteWorkplace(CompanyId, WorkplaceId);
Toaster.ShowInfo("Arbejdssted er slettet.");
Navigator.NavigateTo($"/advisor/customers/{CompanyId}/workplaces");
}
private async Task OnRemoveDocument(string productId, string variantId)
private async Task OnRemoveVariant(string productId, string variantId)
{
// delete the apb and apv
var product = WorkplaceInventory
.Products.First(x => x.ProductId == productId);
var variant = product.Variants.First(x => x.VariantId == variantId);
Logger.LogDebug("variant => {}", JsonSerializer.Serialize(variant, new JsonSerializerOptions(JsonSerializerDefaults.Web)));
foreach (var doc in variant.Docs)
{
await WorkplaceRepo.DeleteWorkplaceDocuments(CompanyId, WorkplaceId, doc.DocumentId);
@ -186,6 +190,7 @@ public partial class AdvisorCustomerWorkplaceViewEditPage : IDisposable
WorkplaceInventory.Products.Remove(product);
DocViews = GenerateDocumentListView();
Toaster.ShowInfo("Produkt dokumenter er slettet.");
}

View file

@ -32,7 +32,7 @@ public partial class OfficeOrderViewPage : IDisposable
{
// #############################################################
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public IAdvisorActivityRepository AdvisorActivityRepo { get; set; }
[Inject] public ICrmActivityRepository CrmActivityRepo { get; set; }
[Inject] public ISystemSendMailService MailService { get; set; }
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public ICountryUserInfoRepository UserRepo { get; set; }
@ -59,7 +59,7 @@ public partial class OfficeOrderViewPage : IDisposable
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
// fetch order from backend
ReportItem = await AdvisorActivityRepo.GetReportItem(OrderId);
ReportItem = await CrmActivityRepo.GetReportItem(OrderId);
Logger.LogDebug("ReportItem => \n {}", JsonSerializer.Serialize(ReportItem, _options));
Working = false;
}
@ -75,7 +75,7 @@ public partial class OfficeOrderViewPage : IDisposable
Working = true;
Logger.LogDebug("GetExpressState => {}", JsonSerializer.Serialize(ReportItem, _options));
// send request to backend
var responseView = await AdvisorActivityRepo.GetExpressState(ReportItem.ActivityId);
var responseView = await CrmActivityRepo.GetExpressState(ReportItem.ActivityId);
Logger.LogDebug("SetExpressState => responseView <= {} ", JsonSerializer.Serialize(responseView));
// get user info from storage
var user = await UserInfoService.GetUserInfo();

View file

@ -145,7 +145,7 @@
</div>
<div class="card-body">
<div class="card-title fw-bold h5">
Kundekort
Stamkort
</div>
@ReportItem.CrmNote
</div>

View file

@ -21,27 +21,21 @@
<PageTitle>Support Dokumentation</PageTitle>
<div class="row">
<div class="col">
<div class="col-sm-6">
<h2>@Advisor.FullName</h2>
</div>
<div class="col-sm-3">
<a class="btn btn-primary" href="/supervisor/advisors" ><i class="bi-chevron-left"></i> Liste</a>
</div>
<div class="col-sm-3 text-end">
<a class="btn btn-primary" href="/supervisor/advisors/@AdvisorId/documents/new"><i class="bi-plus-lg"></i> Opret</a>
</div>
</div>
<div class="row">
<div class="col">
<h3>Support Dokumentation</h3>
</div>
<div class="col">
<div class="text-end">
<a class="btn btn-primary" href="/supervisor/advisors/@AdvisorId/documents/new"><i class="bi-plus-circle-fill"></i> Opret</a>
@*
<div class="busy-signal" style="display:@(_working ? "block" : "none")">
<div class="spinner-grow text-info" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
*@
</div>
</div>
</div>
@if (Documents.Any())

View file

@ -22,9 +22,15 @@
<PageTitle>Support Dokumentation</PageTitle>
<div class="row">
<div class="col">
<div class="col-sm-6">
<h2>@Document.AdvisorName</h2>
</div>
<div class="col-sm-3">
<a class="btn btn-primary" href="/supervisor/advisors" ><i class="bi-chevron-left"></i> Liste</a>
</div>
<div class="col-sm-3 text-end">
<a class="btn btn-primary" href="/supervisor/advisors/@AdvisorId/documents" ><i class="bi-chevron-left"></i> Tilbage</a>
</div>
</div>
<EditForm EditContext="FormContext" OnValidSubmit="SubmitDocument">

View file

@ -94,7 +94,7 @@ public partial class SupervisorDocumentNewPage : IDisposable
else
{
Toaster.ShowSuccess("Ok");
Navigator.NavigateTo($"/supervisor/advisors/{AdvisorId}/documents/{x.DocumentId}");
Navigator.NavigateTo($"/supervisor/advisors/{AdvisorId}/documents");
}
Toaster.ClearAll();
}

View file

@ -20,9 +20,15 @@
@page "/supervisor/advisors/{AdvisorId}/documents/{DocumentId}"
<div class="row">
<div class="col">
<div class="col-sm-6">
<h2>@Document.AdvisorName</h2>
</div>
<div class="col-sm-3">
<a class="btn btn-primary" href="/supervisor/advisors" ><i class="bi-chevron-left"></i> Liste</a>
</div>
<div class="col-sm-3 text-end">
<a class="btn btn-primary" href="/supervisor/advisors/@AdvisorId/documents" ><i class="bi-chevron-left"></i> Tilbage</a>
</div>
</div>
<div class="row">
<div class="col">

View file

@ -78,6 +78,7 @@ public partial class SupervisorDocumentViewEditPage : IDisposable
var x = await DocumentRepo.UpdateDocument(Document.DocumentId, Document);
Toaster.ShowSuccess("Ok");
Navigator.NavigateTo($"/supervisor/advisors/{AdvisorId}/documents");
}

View file

@ -60,13 +60,14 @@ builder.Services.AddScoped<IClipboardService, ClipboardService>();
builder.Services.AddScoped<IUserInfoService, UserInfoService>();
builder.Services.AddScoped<UserPreferenceService, UserPreferenceService>();
// crm repositories
builder.Services.AddScoped<IAdvisorActivityRepository, AdvisorActivityRepository>();
builder.Services.AddScoped<IAdvisorCustomerRepository, AdvisorCustomerRepository>();
builder.Services.AddScoped<IAdvisorContactRepository, AdvisorContactRepository>();
builder.Services.AddScoped<IAdvisorCustomerHistoryRepository, AdvisorCustomerHistoryRepository>();
builder.Services.AddScoped<IAdvisorTaskItemRepository, AdvisorTaskItemRepository>();
builder.Services.AddScoped<IAdvisorReportRepository, AdvisorReportRepository>();
builder.Services.AddScoped<IAdvisorWorkplaceRepository, AdvisorWorkplaceRepository>();
builder.Services.AddScoped<ICrmActivityRepository, CrmActivityRepository>();
builder.Services.AddScoped<ICrmCustomerRepository, CrmCustomerRepository>();
builder.Services.AddScoped<ICrmContactRepository, CrmContactRepository>();
builder.Services.AddScoped<ICrmCustomerHistoryRepository, CrmCustomerHistoryRepository>();
builder.Services.AddScoped<ICrmTaskItemRepository, CrmTaskItemRepository>();
builder.Services.AddScoped<ICrmSalesReportRepository, CrmSalesReportRepository>();
builder.Services.AddScoped<ICrmWorkplaceRepository, CrmWorkplaceRepository>();
builder.Services.AddScoped<ICrmPublicProductRepository, CrmPublicProductRepository>();
// administrative repositories
builder.Services.AddScoped<ICountryCustomerHistoryRepository, CountryCustomerHistoryRepository>();
builder.Services.AddScoped<ICountryCustomerActivityRepository, CountryCustomerActivityRepository>();

View file

@ -31,7 +31,7 @@ public partial class ContactModal
{
[Parameter] public ContactDto ParamContact { get; set; } = new();
[Parameter] public string CompanyName { get; set; } = "";
[Parameter] public IAdvisorContactRepository ContactRepo { get; set; }
[Parameter] public ICrmContactRepository ContactRepo { get; set; }
[Parameter] public HttpInterceptorService Interceptor { get; set; }
[Parameter] public EventCallback<ContactDto> OnSaveClicked { get; set; }
[Parameter] public EventCallback<string> OnDeleteClicked { get; set; }

View file

@ -5,6 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latestmajor</LangVersion>
<ServiceWorkerAssetsManifest>service-workker-assets.js</ServiceWorkerAssetsManifest>
</PropertyGroup>
<ItemGroup>
@ -26,7 +27,7 @@
<ItemGroup>
<ProjectReference Include="..\Wonky.Entity\Wonky.Entity.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="wwwroot\appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

View file

@ -1,15 +1,15 @@
{
"appInfo": {
"name": "Wonky Online",
"version": "141.2",
"version": "142.2",
"rc": true,
"sandBox": false,
"sandBox": true,
"image": "grumpy-coder.png"
},
"Logging": {
"LogLevel": {
"Default": "None",
"System": "None",
"Default": "Debug",
"System": "Debug",
"Microsoft": "None"
},
"Debug": {
@ -19,7 +19,7 @@
}
},
"apiConfig": {
"baseUrl": "https://zeta.innotec.dk",
"baseUrl": "https://eta.innotec.dk",
"catalog": "api/v2/catalog/country",
"crmCustomers": "api/v2/crm/companies",
"crmInventoryExt": "history/inventory",
@ -34,6 +34,7 @@
"officeCustomers": "api/v2/office/customers",
"officeReports": "api/v2/office/reports",
"officeUsers": "api/v2/office/users/admin",
"publicProducts": "api/v2/public/products",
"servicesGlsId": "",
"servicesGlsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=",
"servicesMail": "api/v2/services/sendmail",

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View file

@ -31,6 +31,6 @@
</div>
<script src="/bootstrap/js/bootstrap.bundle.js"></script>
<script src="/_framework/blazor.webassembly.js"></script>
<script src="/scripts/print-invoke.js" defer></script>
<script src="/scripts/print-invoke.js"></script>
</body>
</html>

View file

@ -93,6 +93,11 @@ public class ApiConfig
/// </summary>
public string OfficeReports { get; set; } = "";
/// <summary>
/// Public Product url
/// </summary>
public string PublicProducts { get; set; } = "";
/// <summary>
/// Application uri for token request
/// </summary>

View file

@ -0,0 +1,29 @@
namespace Wonky.Entity.DTO;
public class WorkplaceBopCreate
{
public string EyeCleanerLocation { get; set; } = "";
public string FirstAidLocation { get; set; } = "";
public string GlovesStorage { get; set; } = "";
public string GogglesStorage { get; set; } = "";
public string MaskStorage { get; set; } = "";
public string ProductStorage { get; set; } = "";
public string WasteDeposit { get; set; } = "";
public string AuthoredBy { get; set; } = "";
public string ApprovedBy { get; set; } = "";
public string ApprovedDate { get; set; } = "";
public string FollowupDate { get; set; } = "";
public List<ProductVariants> ProductVariants { get; set; } = new();
}
public class ProductVariants
{
public string VariantId { get; set; } = "";
public string S5A { get; set; } = "";
public string S9A { get; set; } = "";
// Sweden
// yearly consumption and product exposure
// public string S11A { get; set; } = "";
}

View file

@ -0,0 +1,21 @@
namespace Wonky.Entity.Views;
public class ExternalProductListView
{
public string ProductId { get; set; } = "";
public string TradingName { get; set; } = "";
public string PictureLink { get; set; } = "";
public string ProductCategoryEnum { get; set; } = "";
public List<ExternalProductVariantView> Variants { get; set; } = new();
}
public class ExternalProductVariantView
{
public string VariantId { get; set; } = "";
public string Name { get; set; } = "";
public string Sku { get; set; } = "";
public string ErpName { get; set; } = "";
public string ErpSku { get; set; } = "";
public string ShortName { get; set; } = "";
public string PictureLink { get; set; } = "";
}