Merge branch 'office-functionality---phone-order' into dev-v6
This commit is contained in:
commit
56e3275e62
21 changed files with 697 additions and 87 deletions
|
@ -21,7 +21,7 @@ namespace Wonky.Client.HttpInterfaces;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface Customer History CRM Http repository
|
/// Interface Customer History CRM Http repository
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ICustomerHistoryRepository
|
public interface IAdvisorCustomerHistoryRepository
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetch Invoice LIst
|
/// Fetch Invoice LIst
|
|
@ -0,0 +1,70 @@
|
||||||
|
// 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.Entity.Views;
|
||||||
|
|
||||||
|
namespace Wonky.Client.HttpInterfaces;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface Customer History CRM Http repository
|
||||||
|
/// </summary>
|
||||||
|
public interface ICountryCustomerHistoryRepository
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Fetch Invoice LIst
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="companyId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<InvoiceListView> FetchInvoiceList(string countryCode, string companyId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetch given invoice for given customer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="companyId"></param>
|
||||||
|
/// <param name="invoiceId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<InvoiceView> FetchInvoice(string countryCode, string companyId, string invoiceId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetch inventory from given customer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="companyId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<ProductInventoryView>> FetchInventory(string countryCode, string companyId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetch History for given customer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="companyId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<ProductHistoryView>> FetchHistory(string countryCode, string companyId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetch history for given customer and a given product
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="companyId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<ProductHistoryView>> FetchHistory(string countryCode, string companyId, string sku);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// RPC call to initiate remote server sync for given customer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="companyId"></param>
|
||||||
|
/// <param name="syncDate"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<string> ErpInvoiceToCrmRpc(string countryCode, string companyId, string syncDate);
|
||||||
|
}
|
|
@ -24,6 +24,14 @@ namespace Wonky.Client.HttpInterfaces;
|
||||||
/// <remarks>Possibly duplicated in IReportHttpRepository</remarks>
|
/// <remarks>Possibly duplicated in IReportHttpRepository</remarks>
|
||||||
public interface ICountryReportRepository
|
public interface ICountryReportRepository
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Report Exist for given data (SalesRep)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="salesRepId"></param>
|
||||||
|
/// <param name="workDate"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> ReportExist(string salesRepId, string workDate);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Reports for given userId (Office)
|
/// Get Reports for given userId (Office)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -25,7 +25,7 @@ using Wonky.Entity.Views;
|
||||||
|
|
||||||
namespace Wonky.Client.HttpRepository;
|
namespace Wonky.Client.HttpRepository;
|
||||||
|
|
||||||
public class CustomerHistoryRepository : ICustomerHistoryRepository
|
public class AdvisorCustomerHistoryRepository : IAdvisorCustomerHistoryRepository
|
||||||
{
|
{
|
||||||
private readonly JsonSerializerOptions _options = new JsonSerializerOptions
|
private readonly JsonSerializerOptions _options = new JsonSerializerOptions
|
||||||
{
|
{
|
||||||
|
@ -33,12 +33,12 @@ public class CustomerHistoryRepository : ICustomerHistoryRepository
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly NavigationManager _navigation;
|
private readonly NavigationManager _navigation;
|
||||||
private ILogger<CustomerHistoryRepository> _logger;
|
private ILogger<AdvisorCustomerHistoryRepository> _logger;
|
||||||
private readonly HttpClient _client;
|
private readonly HttpClient _client;
|
||||||
private readonly ApiConfig _api;
|
private readonly ApiConfig _api;
|
||||||
|
|
||||||
public CustomerHistoryRepository(
|
public AdvisorCustomerHistoryRepository(
|
||||||
HttpClient client, ILogger<CustomerHistoryRepository> logger,
|
HttpClient client, ILogger<AdvisorCustomerHistoryRepository> logger,
|
||||||
NavigationManager navigation, IOptions<ApiConfig> configuration)
|
NavigationManager navigation, IOptions<ApiConfig> configuration)
|
||||||
{
|
{
|
||||||
_client = client;
|
_client = client;
|
145
Wonky.Client/HttpRepository/CountryCustomerHistoryRepository.cs
Normal file
145
Wonky.Client/HttpRepository/CountryCustomerHistoryRepository.cs
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
// 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.Net.Http.Json;
|
||||||
|
using System.Text.Json;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Wonky.Client.HttpInterfaces;
|
||||||
|
using Wonky.Client.Pages;
|
||||||
|
using Wonky.Entity.Configuration;
|
||||||
|
using Wonky.Entity.DTO;
|
||||||
|
using Wonky.Entity.Views;
|
||||||
|
|
||||||
|
namespace Wonky.Client.HttpRepository;
|
||||||
|
|
||||||
|
public class CountryCustomerHistoryRepository : ICountryCustomerHistoryRepository
|
||||||
|
{
|
||||||
|
private readonly JsonSerializerOptions _options = new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
PropertyNameCaseInsensitive = true
|
||||||
|
};
|
||||||
|
|
||||||
|
private readonly NavigationManager _navigation;
|
||||||
|
private ILogger<CountryCustomerHistoryRepository> _logger;
|
||||||
|
private readonly HttpClient _client;
|
||||||
|
private readonly ApiConfig _api;
|
||||||
|
|
||||||
|
public CountryCustomerHistoryRepository(
|
||||||
|
HttpClient client, ILogger<CountryCustomerHistoryRepository> logger,
|
||||||
|
NavigationManager navigation, IOptions<ApiConfig> configuration)
|
||||||
|
{
|
||||||
|
_client = client;
|
||||||
|
_logger = logger;
|
||||||
|
_navigation = navigation;
|
||||||
|
_api = configuration.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetch Invoice LIst
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="countryCode"></param>
|
||||||
|
/// <param name="companyId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<InvoiceListView> FetchInvoiceList(string countryCode, string companyId)
|
||||||
|
{
|
||||||
|
var response = await _client.GetAsync($"{_api.OfficeCustomers}/{countryCode}/{companyId}/invoices");
|
||||||
|
|
||||||
|
if (!response.IsSuccessStatusCode) return new InvoiceListView();
|
||||||
|
|
||||||
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
|
return response.IsSuccessStatusCode
|
||||||
|
? JsonSerializer.Deserialize<InvoiceListView>(content, _options)
|
||||||
|
: new InvoiceListView();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetch given invoice for given customer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="countryCode"></param>
|
||||||
|
/// <param name="companyId"></param>
|
||||||
|
/// <param name="invoiceId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<InvoiceView> FetchInvoice(string countryCode, string companyId, string invoiceId)
|
||||||
|
{
|
||||||
|
return await _client
|
||||||
|
.GetFromJsonAsync<InvoiceView>($"{_api.OfficeCustomers}/{countryCode}/{companyId}/invoices/{invoiceId}", _options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetch inventory from given customer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="companyId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<ProductInventoryView>> FetchInventory(string countryCode, string companyId)
|
||||||
|
{
|
||||||
|
var response = await _client.GetAsync($"{_api.OfficeCustomers}/{countryCode}/{companyId}/{_api.CrmInventoryExt}");
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
|
return new List<ProductInventoryView>();
|
||||||
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
|
return string.IsNullOrWhiteSpace(content)
|
||||||
|
? new List<ProductInventoryView>()
|
||||||
|
: JsonSerializer.Deserialize<List<ProductInventoryView>>(content, _options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetch History for given customer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="companyId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<ProductHistoryView>> FetchHistory(string countryCode, string companyId)
|
||||||
|
{
|
||||||
|
var response = await _client.GetAsync($"{_api.OfficeCustomers}/{countryCode}/{companyId}/{_api.CrmProductExt}");
|
||||||
|
|
||||||
|
if (!response.IsSuccessStatusCode) return new List<ProductHistoryView>();
|
||||||
|
|
||||||
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
|
return string.IsNullOrWhiteSpace(content)
|
||||||
|
? new List<ProductHistoryView>()
|
||||||
|
: JsonSerializer.Deserialize<List<ProductHistoryView>>(content, _options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetch history for given customer and a given product
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="companyId"></param>
|
||||||
|
/// <param name="sku"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<ProductHistoryView>> FetchHistory(string countryCode, string companyId, string sku)
|
||||||
|
{
|
||||||
|
var response = await _client.GetAsync($"{_api.OfficeCustomers}/{countryCode}/{companyId}/{_api.CrmProductExt}/{sku}");
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
|
return new List<ProductHistoryView>();
|
||||||
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
|
return string.IsNullOrWhiteSpace(content)
|
||||||
|
? new List<ProductHistoryView>()
|
||||||
|
: JsonSerializer.Deserialize<List<ProductHistoryView>>(content, _options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// RPC call to initiate remote server sync for given customer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="companyId"></param>
|
||||||
|
/// <param name="syncDate"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<string> ErpInvoiceToCrmRpc(string countryCode, string companyId, string syncDate)
|
||||||
|
{
|
||||||
|
var x = await _client.GetAsync($"{_api.OfficeCustomers}/{countryCode}/{companyId}/{_api.CrmRpcSyncExt}/{syncDate}");
|
||||||
|
if (!x.IsSuccessStatusCode)
|
||||||
|
return string.Empty;
|
||||||
|
var content = await x.Content.ReadAsStringAsync();
|
||||||
|
return content.Replace("\"", "");
|
||||||
|
}
|
||||||
|
}
|
|
@ -108,7 +108,7 @@ public class CountryCustomerRepository : ICountryCustomerRepository
|
||||||
["hasFolded"] = paging.HasFolded.ToString(),
|
["hasFolded"] = paging.HasFolded.ToString(),
|
||||||
};
|
};
|
||||||
|
|
||||||
var response = await _client.GetAsync(QueryHelpers.AddQueryString($"{_api.OfficeCustomers}/salesRep/{salesRepId}/", queryString));
|
var response = await _client.GetAsync(QueryHelpers.AddQueryString($"{_api.OfficeCustomers}/{countryCode}/salesRep/{salesRepId}/", queryString));
|
||||||
var content = await response.Content.ReadAsStringAsync();
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
var pagingResponse = new PagingResponse<CompanyDto>
|
var pagingResponse = new PagingResponse<CompanyDto>
|
||||||
{
|
{
|
||||||
|
@ -127,7 +127,7 @@ public class CountryCustomerRepository : ICountryCustomerRepository
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<CompanyDto> GetByCustomerId(string countryCode, string companyId)
|
public async Task<CompanyDto> GetByCustomerId(string countryCode, string companyId)
|
||||||
{
|
{
|
||||||
var company = await _client.GetFromJsonAsync<CompanyDto>($"{_api.OfficeCustomers}/id/{companyId}");
|
var company = await _client.GetFromJsonAsync<CompanyDto>($"{_api.OfficeCustomers}/{countryCode}/id/{companyId}");
|
||||||
return company ?? new CompanyDto();
|
return company ?? new CompanyDto();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ public class CountryCustomerRepository : ICountryCustomerRepository
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> UpdateCompany(string countryCode, string companyId, CompanyDto model)
|
public async Task<bool> UpdateCompany(string countryCode, string companyId, CompanyDto model)
|
||||||
{
|
{
|
||||||
var response = await _client.PutAsJsonAsync($"{_api.OfficeCustomers}/{companyId}", model);
|
var response = await _client.PutAsJsonAsync($"{_api.OfficeCustomers}/{countryCode}/{companyId}", model);
|
||||||
var content = await response.Content.ReadAsStringAsync();
|
var content = await response.Content.ReadAsStringAsync();
|
||||||
Console.WriteLine(content);
|
Console.WriteLine(content);
|
||||||
return response.IsSuccessStatusCode;
|
return response.IsSuccessStatusCode;
|
||||||
|
|
|
@ -47,6 +47,17 @@ public class CountryReportRepository : ICountryReportRepository
|
||||||
_apiConfig = configuration.Value;
|
_apiConfig = configuration.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Report Exist for given data (SalesRep)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="workDate"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<bool> ReportExist(string salesRepId, string workDate)
|
||||||
|
{
|
||||||
|
var result = await _client.GetFromJsonAsync<SalesReportClosedView>(
|
||||||
|
$"{_apiConfig.OfficeReports}/exist/{workDate}");
|
||||||
|
return result.ReportClosed;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Reports for given userId (Office)
|
/// Get Reports for given userId (Office)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -18,7 +18,6 @@ using System.Text.Json;
|
||||||
using Blazored.LocalStorage;
|
using Blazored.LocalStorage;
|
||||||
using Blazored.Toast.Services;
|
using Blazored.Toast.Services;
|
||||||
using Wonky.Client.HttpInterceptors;
|
using Wonky.Client.HttpInterceptors;
|
||||||
using Wonky.Client.HttpRepository;
|
|
||||||
using Wonky.Client.Models;
|
using Wonky.Client.Models;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Microsoft.AspNetCore.Components.Forms;
|
using Microsoft.AspNetCore.Components.Forms;
|
||||||
|
@ -47,7 +46,7 @@ public partial class AdvisorCreateActivityPage : IDisposable
|
||||||
[Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; }
|
[Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; }
|
||||||
[Inject] public IAdvisorActivityRepository AdvisorActivityRepo { get; set; }
|
[Inject] public IAdvisorActivityRepository AdvisorActivityRepo { get; set; }
|
||||||
[Inject] public IAdvisorReportRepository AdvisorReportRepo { get; set; }
|
[Inject] public IAdvisorReportRepository AdvisorReportRepo { get; set; }
|
||||||
[Inject] public ICustomerHistoryRepository HistoryRepo { get; set; }
|
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
|
||||||
// variables
|
// variables
|
||||||
private readonly JsonSerializerOptions _options = new() {PropertyNameCaseInsensitive = true};
|
private readonly JsonSerializerOptions _options = new() {PropertyNameCaseInsensitive = true};
|
||||||
private SalesItemView SelectedItem { get; set; } = new();
|
private SalesItemView SelectedItem { get; set; } = new();
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace Wonky.Client.Pages;
|
||||||
|
|
||||||
public partial class AdvisorCustomerInventoryListPage : IDisposable
|
public partial class AdvisorCustomerInventoryListPage : IDisposable
|
||||||
{
|
{
|
||||||
[Inject] public ICustomerHistoryRepository HistoryRepo { get; set; }
|
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
|
||||||
[Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; }
|
[Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; }
|
||||||
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
||||||
[Inject] public IToastService Toaster { get; set; }
|
[Inject] public IToastService Toaster { get; set; }
|
||||||
|
|
|
@ -17,7 +17,7 @@ public partial class AdvisorCustomerInvoiceListPage : IDisposable
|
||||||
[Parameter] public string CompanyId { get; set; } = "";
|
[Parameter] public string CompanyId { get; set; } = "";
|
||||||
[Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; }
|
[Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; }
|
||||||
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
||||||
[Inject] public ICustomerHistoryRepository HistoryRepo { get; set; }
|
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
|
||||||
[Inject] public IToastService Toaster { get; set; }
|
[Inject] public IToastService Toaster { get; set; }
|
||||||
[Inject] public ILocalStorageService Storage { get; set; }
|
[Inject] public ILocalStorageService Storage { get; set; }
|
||||||
[Inject] public ILogger<AdvisorCustomerInvoiceListPage> Logger { get; set; }
|
[Inject] public ILogger<AdvisorCustomerInvoiceListPage> Logger { get; set; }
|
||||||
|
|
|
@ -38,7 +38,7 @@ public partial class AdvisorCustomerViewPage : IDisposable
|
||||||
[Inject] public ILogger<AdvisorCustomerViewPage> Logger { get; set; }
|
[Inject] public ILogger<AdvisorCustomerViewPage> Logger { get; set; }
|
||||||
[Inject] public NavigationManager Navigator { get; set; }
|
[Inject] public NavigationManager Navigator { get; set; }
|
||||||
[Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; }
|
[Inject] public IAdvisorCustomerRepository CompanyRepo { get; set; }
|
||||||
[Inject] public ICustomerHistoryRepository HistoryRepo { get; set; }
|
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
|
||||||
[Inject] public IAdvisorContactRepository AdvisorContactRepo { get; set; }
|
[Inject] public IAdvisorContactRepository AdvisorContactRepo { get; set; }
|
||||||
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
||||||
[Inject] public VatInfoLookupService VatService { get; set; }
|
[Inject] public VatInfoLookupService VatService { get; set; }
|
||||||
|
|
238
Wonky.Client/Pages/CountryCreateNewOrderPage.razor
Normal file
238
Wonky.Client/Pages/CountryCreateNewOrderPage.razor
Normal file
|
@ -0,0 +1,238 @@
|
||||||
|
@*
|
||||||
|
// 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,Warehouse")]
|
||||||
|
@page "/office/customers/{CountryCode}/{CompanyId}/view"
|
||||||
|
|
||||||
|
<div class="row bg-dark text-white rounded-2 mb-2 py-2 align-items-center">
|
||||||
|
<div class="col">
|
||||||
|
<WorkDateComponent OnChangedCallback="@WorkDateComponentCallback"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row bg-light border-1 border-dark rounded-3 p-3">
|
||||||
|
<div class="col">
|
||||||
|
<h3>@Activity.Name - @Activity.Account</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (ReportClosed)
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<h3>Der kan ikke oprettes bestilling når der findes rapport for @SelectedDate.ToShortDateString()</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<EditForm EditContext="ActivityContext">
|
||||||
|
<DataAnnotationsValidator/>
|
||||||
|
|
||||||
|
<div class="row mb-1">
|
||||||
|
<div class="form-check">
|
||||||
|
<InputCheckbox id="express" class="form-check-input" @bind-Value="@Activity.Express"/>
|
||||||
|
<label class="form-check-label" for="express">Express</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-1">
|
||||||
|
<label for="referenceNumber" class="col-md-2 col-form-label">Rekvisition</label>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<InputText id="referenceNumber" class="form-control" @bind-Value="Activity.ReferenceNumber"/>
|
||||||
|
<ValidationMessage For="@(() => Activity.ReferenceNumber)"></ValidationMessage>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label for="yourRef" class="col-md-2 col-form-label">Indkøber</label>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<InputText id="yourRef" class="form-control" @bind-Value="Activity.YourRef"/>
|
||||||
|
<ValidationMessage For="@(() => Activity.YourRef)"></ValidationMessage>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-1">
|
||||||
|
<label for="orderMessage" class="col-md-2 col-form-label">Note /Kontor</label>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<InputTextArea id="orderMessage" class="form-control" @bind-Value="Activity.OrderMessage"/>
|
||||||
|
<ValidationMessage For="@(() => Activity.OrderMessage)"></ValidationMessage>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-2">
|
||||||
|
<label for="phone" class="col-md-2 col-form-label">Tlf.</label>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<InputText id="phone" class="form-control" @bind-Value="Activity.Phone"/>
|
||||||
|
<ValidationMessage For="@(() => Activity.Phone)"></ValidationMessage>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="this-draft" style="@(Activity.ActivityStatusEnum is "order" or "quote" ? "display: block" : "display:none")">
|
||||||
|
@* Order lines -----------------------------------------------------*@
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<table class="sticky-top table table-hover table-striped table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr class="bg-dark text-white">
|
||||||
|
<th scope="col" colspan="7">
|
||||||
|
Ordrekladde <span class="mx-2 draft-expires-msg">Global kladde (udløber efter @(DraftProvider.Draft.TimeToLiveInSeconds / 60)m inaktivitet)</span>
|
||||||
|
</th>
|
||||||
|
<th scope="col" class="text-end">
|
||||||
|
<button type="button" class="btn btn-danger btn-sm" @onclick="@DeleteDraft" disabled="@(DraftProvider.Draft.Items.Count == 0)"><i class="bi-trash"></i> Slet kladde</button>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="bg-dark opacity-75 text-white">
|
||||||
|
<th scope="col">Navn</th>
|
||||||
|
<th scope="col" class="text-nowrap">Varenr</th>
|
||||||
|
<th scope="col" class="text-end">Antal</th>
|
||||||
|
<th scope="col" class="text-end">Enhedspris</th>
|
||||||
|
<th scope="col" class="text-center">%</th>
|
||||||
|
<th scope="col" class="text-end">Linjesum</th>
|
||||||
|
<th scope="col"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@if (DraftProvider.Draft.Items.Count > 0)
|
||||||
|
{
|
||||||
|
@foreach (var cartItem in DraftProvider.Draft.Items)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td class="align-middle">@cartItem.Item.Name</td>
|
||||||
|
<td class="align-middle">@cartItem.Item.Sku</td>
|
||||||
|
<td class="align-middle text-end">@cartItem.Quantity</td>
|
||||||
|
<td class="align-middle text-end">@($"{cartItem.Price:N2}")</td>
|
||||||
|
<td class="align-middle text-end">@($"{cartItem.Discount:N2}")</td>
|
||||||
|
<td class="align-middle text-end">@($"{cartItem.LineTotal:N2}")</td>
|
||||||
|
<td class="align-middle text-end">
|
||||||
|
<button type="button" class="btn btn-danger" @onclick="@(() => RemoveItem(cartItem))"><i class="bi-trash2"></i> Slet Linje</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
<tr>
|
||||||
|
<td colspan="4"></td>
|
||||||
|
<td class="align-middle text-black text-end fw-bold">Total</td>
|
||||||
|
<td class="align-middle text-black text-end fw-bold">@($"{DraftProvider.Draft.Total:N2}")</td>
|
||||||
|
<td class="align-middle text-end">
|
||||||
|
<button class="btn btn-primary" type="button" @onclick="CallPriceListModal">
|
||||||
|
<i class="bi-plus"></i> Ny linje
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@* draft line ----------------------------------------------------- *@
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
@if (!string.IsNullOrWhiteSpace(SelectedItem.Name) && ShowItem)
|
||||||
|
{
|
||||||
|
<table id="draft-line" class="table table-bordered">
|
||||||
|
<thead>
|
||||||
|
<tr class="bg-dark text-white">
|
||||||
|
<th scope="col" colspan="6">Kladdelinje</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Antal</th>
|
||||||
|
<th scope="col">Pris</th>
|
||||||
|
<th scope="col">Rabat</th>
|
||||||
|
<th scope="col">Varenr.</th>
|
||||||
|
<th scope="col"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="align-middle">
|
||||||
|
<input type="number" class="form-control" @bind-value="@Quantity"/>
|
||||||
|
</td>
|
||||||
|
<td class="align-middle">
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="number" class="form-control" @bind-value="@Price"/>
|
||||||
|
<button class="btn btn-warning" type="button" @onclick="CallPriceHistoryModal">
|
||||||
|
<i class="bi-list-ul"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="align-middle">
|
||||||
|
<input type="number" class="form-control" @bind-value="@Discount"/>
|
||||||
|
</td>
|
||||||
|
<td class="align-middle">@SelectedItem.Sku</td>
|
||||||
|
<td class="align-middle">
|
||||||
|
<button type="button" class="btn btn-primary text-nowrap d-block" @onclick="@(() => AddItem(SelectedItem))">BESTIL @SelectedItem.Name</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@* end draft line ------------------------------------------------- *@
|
||||||
|
</div>
|
||||||
|
<div class="accordion" id="crmActivity">
|
||||||
|
@* Delivery address *@
|
||||||
|
<div class="accordion-item" style="@(Activity.ActivityStatusEnum == "order" ? "display: block" : "display:none")">
|
||||||
|
<h2 class="accordion-header" id="deliveryHeader">
|
||||||
|
<button class="accordion-button collapsed bg-light" type="button" data-bs-toggle="collapse" data-bs-target="#deliveryBody" aria-expanded="false" aria-controls="deliveryBody">
|
||||||
|
Leveringsadresse
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
|
<div id="deliveryBody" class="accordion-collapse collapse"
|
||||||
|
aria-labelledby="deliveryHeader" data-bs-parent="#crmActivity">
|
||||||
|
<div class="accordion-body">
|
||||||
|
<div class="row mb-1">
|
||||||
|
<label for="dlvName" class="col-md-2 col-form-label">Lev. Navn</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<InputText id="dlvName" class="form-control" @bind-Value="Activity.DlvName"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-1">
|
||||||
|
<label for="dlvAddress1" class="col-md-2 col-form-label">Lev. Adresse</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<InputText id="dlvAddress1" class="form-control" @bind-Value="Activity.DlvAddress1"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-1">
|
||||||
|
<label for="dlvAddress2" class="col-md-2 col-form-label">Lev. Adresse</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<InputText id="dlvAddress2" class="form-control" @bind-Value="Activity.DlvAddress2"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-1">
|
||||||
|
<label for="dlvZipCode" class="col-md-2 col-form-label">Lev. Postnr</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<InputText id="dlvZipCode" class="form-control" @bind-Value="Activity.DlvZipCode"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-1">
|
||||||
|
<label for="dlvCity" class="col-md-2 col-form-label">Lev. Bynavn</label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<InputText id="dlvCity" class="form-control" @bind-Value="Activity.DlvCity"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</EditForm>
|
||||||
|
<div class="row mt-5 mb-2">
|
||||||
|
<div class="col-sm-10 text-end">
|
||||||
|
<button type="button" class="btn btn-warning" @onclick="CreateActivity" disabled="@(PoFormInvalid || Working)"><i class="bi-plus"></i> Opret ordre</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
204
Wonky.Client/Pages/CountryCreateNewOrderPage.razor.cs
Normal file
204
Wonky.Client/Pages/CountryCreateNewOrderPage.razor.cs
Normal file
|
@ -0,0 +1,204 @@
|
||||||
|
// 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.Json;
|
||||||
|
using Wonky.Client.HttpInterceptors;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Forms;
|
||||||
|
using Wonky.Client.HttpInterfaces;
|
||||||
|
using Wonky.Client.Models;
|
||||||
|
using Wonky.Client.Services;
|
||||||
|
using Wonky.Client.Shared;
|
||||||
|
using Wonky.Entity.DTO;
|
||||||
|
using Wonky.Entity.Views;
|
||||||
|
|
||||||
|
namespace Wonky.Client.Pages;
|
||||||
|
|
||||||
|
public partial class CountryCreateNewOrderPage : IDisposable
|
||||||
|
{
|
||||||
|
[Parameter] public string CompanyId { get; set; } = "";
|
||||||
|
[Parameter] public string CountryCode { get; set; } = "";
|
||||||
|
|
||||||
|
[CascadingParameter] public DraftStateProvider DraftProvider { get; set; }
|
||||||
|
|
||||||
|
[Inject] public ILogger<CountryCreateNewOrderPage> Logger { get; set; }
|
||||||
|
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
||||||
|
[Inject] public ICountryCustomerRepository CustomerRepo { get; set; }
|
||||||
|
[Inject] public ICountryCustomerHistoryRepository InventoryRepo { get; set; }
|
||||||
|
[Inject] public ICountryReportRepository ReportRepo { get; set; }
|
||||||
|
[Inject] public ISystemUserRepository UserRepo { get; set; }
|
||||||
|
|
||||||
|
private DateTime SelectedDate { get; set; }
|
||||||
|
private CompanyDto _company { get; set; } = new();
|
||||||
|
private List<ProductInventoryView> CustomerInventory { get; set; } = new();
|
||||||
|
private readonly JsonSerializerOptions _options = new() {PropertyNameCaseInsensitive = true};
|
||||||
|
private SalesItemView SelectedItem { get; set; } = new();
|
||||||
|
private UserPref UserPrefs { get; set; } = new();
|
||||||
|
private ActivityDto Activity { get; set; } = new();
|
||||||
|
private EditContext ActivityContext { get; set; }
|
||||||
|
private bool ShowItem { get; set; }
|
||||||
|
private string Quantity { get; set; } = "1";
|
||||||
|
private string Price { get; set; } = "0";
|
||||||
|
private string Discount { get; set; } = "0";
|
||||||
|
private bool ReportClosed { get; set; }
|
||||||
|
private bool PoFormInvalid { get; set; } = true;
|
||||||
|
private bool Working { get; set; }
|
||||||
|
private WebUserInfoView ThisUserInfo { get; set; } = new();
|
||||||
|
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
ActivityContext = new EditContext(Activity);
|
||||||
|
ActivityContext.OnFieldChanged += HandleFieldChanged;
|
||||||
|
ActivityContext.OnValidationStateChanged += ValidationChanged;
|
||||||
|
|
||||||
|
Interceptor.RegisterEvent();
|
||||||
|
Interceptor.RegisterBeforeSendEvent();
|
||||||
|
_company = await CustomerRepo.GetByCustomerId(CountryCode, CompanyId);
|
||||||
|
var today = $"{DateTime.Now:yyyy-MM-dd}";
|
||||||
|
var ts = _company.HistorySync;
|
||||||
|
if (ts != today)
|
||||||
|
ts = await InventoryRepo.ErpInvoiceToCrmRpc(CountryCode, CompanyId, ts);
|
||||||
|
while (ts != today)
|
||||||
|
await Task.Delay(500);
|
||||||
|
// raise flag if report is closed
|
||||||
|
ReportClosed = await ReportRepo.ReportExist(_company.SalesRepId, ts);
|
||||||
|
// customer inventory
|
||||||
|
CustomerInventory = await InventoryRepo.FetchInventory(CountryCode, CompanyId);
|
||||||
|
// get sales rep info
|
||||||
|
ThisUserInfo = await UserRepo.GetAdvisorInfo(_company.SalesRepId);
|
||||||
|
// setting up base data
|
||||||
|
Activity.BcId = _company.BcId;
|
||||||
|
Activity.ActivityStatusEnum = "noSale";
|
||||||
|
Activity.VisitTypeEnum = _company.Account is "" or "NY" ? "new" : "recall";
|
||||||
|
Activity.ActivityTypeEnum = "phone";
|
||||||
|
Activity.ActivityStatusEnum = "order";
|
||||||
|
Activity.CompanyId = _company.CompanyId;
|
||||||
|
Activity.SalesRepId = _company.SalesRepId;
|
||||||
|
Activity.SalesRep = ThisUserInfo.Advisor;
|
||||||
|
Activity.CountryCode = ThisUserInfo.CountryCode;
|
||||||
|
Activity.Account = _company.Account;
|
||||||
|
Activity.VatNumber = _company.VatNumber;
|
||||||
|
Activity.Email = _company.Email;
|
||||||
|
Activity.Phone = _company.Phone;
|
||||||
|
Activity.Mobile = _company.Mobile;
|
||||||
|
Activity.Name = _company.Name;
|
||||||
|
Activity.Address1 = _company.Address1;
|
||||||
|
Activity.Address2 = _company.Address2;
|
||||||
|
Activity.ZipCode = _company.ZipCode;
|
||||||
|
Activity.City = _company.City;
|
||||||
|
Activity.DlvName = _company.Name;
|
||||||
|
Activity.DlvAddress1 = _company.Address1;
|
||||||
|
Activity.DlvAddress2 = _company.Address2;
|
||||||
|
Activity.DlvZipCode = _company.ZipCode;
|
||||||
|
Activity.DlvCity = _company.City;
|
||||||
|
// Initialize date variable
|
||||||
|
SelectedDate = DateTime.Now;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CallPriceListModal()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
private void CallPriceHistoryModal()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
private void DeleteDraft()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddItem(SalesItemView item)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
private void RemoveItem(DraftItem item)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateActivity()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Work Date component callback
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="workDate"></param>
|
||||||
|
private async Task WorkDateComponentCallback(string workDate)
|
||||||
|
{
|
||||||
|
ReportClosed = await ReportRepo.ReportExist(_company.SalesRepId, workDate);
|
||||||
|
SelectedDate = DateTime.Parse(workDate);
|
||||||
|
Activity.ActivityDate = workDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Edit Context handle field change
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
|
||||||
|
{
|
||||||
|
Logger.LogDebug("ActivityNewPage => HandleFieldChanged => ActivityStatusEnum <= '{}'", Activity.ActivityStatusEnum);
|
||||||
|
DraftProvider.Draft.DraftType = Activity.ActivityStatusEnum;
|
||||||
|
if (Activity.ActivityStatusEnum == "noSale")
|
||||||
|
{
|
||||||
|
Logger.LogDebug("ActivityNewPage => ActivityStatusEnum == 'noSale' <= remove items");
|
||||||
|
DraftProvider.Draft.Items = new List<DraftItem>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// InvalidCanvas = InvalidActivityType;
|
||||||
|
if (Activity.YourRef.Length > 35 || Activity.ReferenceNumber.Length > 20 || DraftProvider.Draft.Items.Count == 0)
|
||||||
|
{
|
||||||
|
PoFormInvalid = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PoFormInvalid = !ActivityContext.Validate();
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Edit Context handle validation change
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ValidationChanged(object sender, ValidationStateChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Activity.ActivityTypeEnum) && !ReportClosed)
|
||||||
|
{
|
||||||
|
PoFormInvalid = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PoFormInvalid = false;
|
||||||
|
ActivityContext.OnFieldChanged -= HandleFieldChanged;
|
||||||
|
ActivityContext.OnValidationStateChanged -= ValidationChanged;
|
||||||
|
ActivityContext = new EditContext(Activity);
|
||||||
|
ActivityContext.OnFieldChanged += HandleFieldChanged;
|
||||||
|
ActivityContext.OnValidationStateChanged += ValidationChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Implement Dispose from IDisposable
|
||||||
|
/// </summary>
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Interceptor.DisposeEvent();
|
||||||
|
ActivityContext.OnFieldChanged -= HandleFieldChanged;
|
||||||
|
ActivityContext.OnValidationStateChanged -= ValidationChanged;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,28 +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
|
|
||||||
@using Microsoft.AspNetCore.Components
|
|
||||||
@using Wonky.Client.Components
|
|
||||||
@attribute [Authorize(Roles = "Admin,Warehouse")]
|
|
||||||
@page "/office/customers/{CountryCode}/{CompanyId}/view"
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col">
|
|
||||||
<h3>Data for @CountryCode.ToUpper() Id '@CompanyId' er ikke klar</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,38 +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 System.Text.Json;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using Blazored.LocalStorage;
|
|
||||||
using Blazored.Toast.Services;
|
|
||||||
using Wonky.Client.HttpInterceptors;
|
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
using Microsoft.AspNetCore.Components.Forms;
|
|
||||||
using Wonky.Client.Helpers;
|
|
||||||
using Wonky.Client.HttpInterfaces;
|
|
||||||
using Wonky.Client.Models;
|
|
||||||
using Wonky.Client.Services;
|
|
||||||
using Wonky.Client.Shared;
|
|
||||||
using Wonky.Entity.DTO;
|
|
||||||
using Wonky.Entity.Models;
|
|
||||||
using Wonky.Entity.Views;
|
|
||||||
|
|
||||||
namespace Wonky.Client.Pages;
|
|
||||||
|
|
||||||
public partial class CountryCustomerViewPage
|
|
||||||
{
|
|
||||||
[Parameter] public string CompanyId { get; set; } = "";
|
|
||||||
[Parameter] public string CountryCode { get; set; } = "";
|
|
||||||
}
|
|
|
@ -57,16 +57,17 @@ builder.Services.Configure<AppInfo>(builder.Configuration.GetSection("AppInfo"))
|
||||||
builder.Services.AddScoped<IAdvisorActivityRepository, AdvisorActivityRepository>();
|
builder.Services.AddScoped<IAdvisorActivityRepository, AdvisorActivityRepository>();
|
||||||
builder.Services.AddScoped<IAdvisorCustomerRepository, AdvisorCustomerRepository>();
|
builder.Services.AddScoped<IAdvisorCustomerRepository, AdvisorCustomerRepository>();
|
||||||
builder.Services.AddScoped<IAdvisorContactRepository, AdvisorContactRepository>();
|
builder.Services.AddScoped<IAdvisorContactRepository, AdvisorContactRepository>();
|
||||||
builder.Services.AddScoped<ICustomerHistoryRepository, CustomerHistoryRepository>();
|
builder.Services.AddScoped<IAdvisorCustomerHistoryRepository, AdvisorCustomerHistoryRepository>();
|
||||||
builder.Services.AddScoped<IAdvisorTaskItemRepository, AdvisorTaskItemRepository>();
|
builder.Services.AddScoped<IAdvisorTaskItemRepository, AdvisorTaskItemRepository>();
|
||||||
|
builder.Services.AddScoped<IAdvisorReportRepository, AdvisorReportRepository>();
|
||||||
builder.Services.AddScoped<IWorkplaceRepository, WorkplaceRepository>();
|
builder.Services.AddScoped<IWorkplaceRepository, WorkplaceRepository>();
|
||||||
builder.Services.AddScoped<IAdvisorCatalogRepository, AdvisorCatalogRepository>();
|
builder.Services.AddScoped<IAdvisorCatalogRepository, AdvisorCatalogRepository>();
|
||||||
// administrative repositories
|
// administrative repositories
|
||||||
builder.Services.AddScoped<IAdvisorReportRepository, AdvisorReportRepository>();
|
builder.Services.AddScoped<ICountryCustomerHistoryRepository, CountryCustomerHistoryRepository>();
|
||||||
builder.Services.AddScoped<ISystemUserRepository, SystemUserRepository>();
|
|
||||||
builder.Services.AddScoped<ICountryCatalogRepository, CountryCatalogRepository>();
|
builder.Services.AddScoped<ICountryCatalogRepository, CountryCatalogRepository>();
|
||||||
builder.Services.AddScoped<ICountryCustomerRepository, CountryCustomerRepository>();
|
builder.Services.AddScoped<ICountryCustomerRepository, CountryCustomerRepository>();
|
||||||
builder.Services.AddScoped<ICountryReportRepository, CountryReportRepository>();
|
builder.Services.AddScoped<ICountryReportRepository, CountryReportRepository>();
|
||||||
|
builder.Services.AddScoped<ISystemUserRepository, SystemUserRepository>();
|
||||||
// warehouse repository
|
// warehouse repository
|
||||||
builder.Services.AddScoped<IWarehouseRepository, WarehouseRepository>();
|
builder.Services.AddScoped<IWarehouseRepository, WarehouseRepository>();
|
||||||
// mail service
|
// mail service
|
||||||
|
|
|
@ -29,7 +29,7 @@ public partial class InventoryReorderModal
|
||||||
{
|
{
|
||||||
[Parameter] public string CompanyId { get; set; } = "";
|
[Parameter] public string CompanyId { get; set; } = "";
|
||||||
[Parameter] public SalesItemView SalesItem { get; set; } = new();
|
[Parameter] public SalesItemView SalesItem { get; set; } = new();
|
||||||
[Inject] public ICustomerHistoryRepository HistoryRepo { get; set; }
|
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
|
||||||
[Parameter] public EventCallback<DraftItem> OnSelected { get; set; }
|
[Parameter] public EventCallback<DraftItem> OnSelected { get; set; }
|
||||||
private List<ProductHistoryView>? History { get; set; } = new();
|
private List<ProductHistoryView>? History { get; set; } = new();
|
||||||
private DraftItem SelectedItem { get; set; } = new();
|
private DraftItem SelectedItem { get; set; } = new();
|
||||||
|
|
|
@ -30,7 +30,7 @@ public partial class InvoiceViewModal : IDisposable
|
||||||
[Parameter] public string CompanyId { get; set; } = "";
|
[Parameter] public string CompanyId { get; set; } = "";
|
||||||
[Parameter] public string InvoiceId { get; set; } = "";
|
[Parameter] public string InvoiceId { get; set; } = "";
|
||||||
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
||||||
[Inject] public ICustomerHistoryRepository HistoryRepo { get; set; }
|
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
|
||||||
private string _modalDisplay = "";
|
private string _modalDisplay = "";
|
||||||
private bool _showBackdrop;
|
private bool _showBackdrop;
|
||||||
private InvoiceView Invoice { get; set; } = new();
|
private InvoiceView Invoice { get; set; } = new();
|
||||||
|
|
|
@ -29,7 +29,7 @@ public partial class ProductHistoryModal
|
||||||
// [Parameter] public EventCallback<decimal> OnSelected { get; set; }
|
// [Parameter] public EventCallback<decimal> OnSelected { get; set; }
|
||||||
[Parameter] public string CompanyId { get; set; } = "";
|
[Parameter] public string CompanyId { get; set; } = "";
|
||||||
[Parameter] public string ItemSku { get; set; } = "";
|
[Parameter] public string ItemSku { get; set; } = "";
|
||||||
[Inject] public ICustomerHistoryRepository HistoryRepo { get; set; }
|
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
|
||||||
private List<ProductHistoryView>? History { get; set; }
|
private List<ProductHistoryView>? History { get; set; }
|
||||||
private string ProductName { get; set; } = "";
|
private string ProductName { get; set; } = "";
|
||||||
private string _modalDisplay = "";
|
private string _modalDisplay = "";
|
||||||
|
|
|
@ -29,7 +29,7 @@ public partial class ProductPriceHistoryModal
|
||||||
[Parameter] public EventCallback<decimal> OnSelected { get; set; }
|
[Parameter] public EventCallback<decimal> OnSelected { get; set; }
|
||||||
[Parameter] public string CompanyId { get; set; } = "";
|
[Parameter] public string CompanyId { get; set; } = "";
|
||||||
[Parameter] public string Sku { get; set; } = "";
|
[Parameter] public string Sku { get; set; } = "";
|
||||||
[Inject] public ICustomerHistoryRepository HistoryRepo { get; set; }
|
[Inject] public IAdvisorCustomerHistoryRepository HistoryRepo { get; set; }
|
||||||
private List<ProductHistoryView>? History { get; set; }
|
private List<ProductHistoryView>? History { get; set; }
|
||||||
private string ProductName { get; set; } = "";
|
private string ProductName { get; set; } = "";
|
||||||
private string _modalDisplay = "";
|
private string _modalDisplay = "";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"appInfo": {
|
"appInfo": {
|
||||||
"name": "Wonky Client",
|
"name": "Wonky Client",
|
||||||
"version": "0.96.1",
|
"version": "0.96.2",
|
||||||
"rc": true,
|
"rc": true,
|
||||||
"sandBox": false,
|
"sandBox": false,
|
||||||
"image": "grumpy-coder.png"
|
"image": "grumpy-coder.png"
|
||||||
|
|
Loading…
Reference in a new issue