check fetching of customer inventory from office customer list page
This commit is contained in:
parent
c929e7e17a
commit
9b64d515c3
3 changed files with 19 additions and 11 deletions
|
@ -32,6 +32,13 @@ namespace Wonky.Client.Components;
|
|||
|
||||
public partial class OfficeCountryCustomerListComponent
|
||||
{
|
||||
// ******************************************************
|
||||
// injects
|
||||
[Inject] public ICountryCustomerHistoryRepository HistoryRepo { get; set; }
|
||||
[Inject] public ICountryCustomerActivityRepository CustomerActivityRepo { get; set; }
|
||||
|
||||
[Inject] public ILogger<OfficeCountryCustomerListComponent> Logger { get; set; }
|
||||
|
||||
// ******************************************************
|
||||
// parameters
|
||||
[Parameter] public string CountryCode { get; set; } = "";
|
||||
|
@ -39,11 +46,6 @@ public partial class OfficeCountryCustomerListComponent
|
|||
// [Parameter] public EventCallback<DraftItem> OnOrderItem { get; set; }
|
||||
[CascadingParameter] public DraftStateProvider DraftProvider { get; set; }
|
||||
|
||||
// ******************************************************
|
||||
// injects
|
||||
[Inject] public ICountryCustomerHistoryRepository HistoryRepo { get; set; }
|
||||
[Inject] public ICountryCustomerActivityRepository CustomerActivityRepo { get; set; }
|
||||
|
||||
// ******************************************************
|
||||
// overlays
|
||||
private OfficeCustomerInvoiceListOverlay InvoiceListOverlay { get; set; } = new();
|
||||
|
@ -102,12 +104,16 @@ public partial class OfficeCountryCustomerListComponent
|
|||
SelectedCompany = CompanyList.First(x => x.CompanyId == companyId);
|
||||
// call erp to crm sync before requesting products
|
||||
var newSyncDate = await HistoryRepo.RequestErpToCrmSync(CountryCode, companyId, SelectedCompany.HistorySync);
|
||||
// give the script time to execute
|
||||
await Task.Delay(500);
|
||||
if (!string.IsNullOrWhiteSpace(newSyncDate))
|
||||
{
|
||||
|
||||
SelectedCompany.HistorySync = newSyncDate;
|
||||
}
|
||||
// request inventory
|
||||
ProductList = await HistoryRepo.GetInventory(SelectedCompany.CountryCode, SelectedCompany.CompanyId);
|
||||
// show the overlay
|
||||
InventoryListOverlay.Show();
|
||||
}
|
||||
|
||||
|
|
|
@ -70,14 +70,16 @@ public class CountryCustomerRepository : ICountryCustomerRepository
|
|||
};
|
||||
|
||||
var endpoint = WebUtils.QueryHelper($"{_api.OfficeCustomers}/{countryCode}", queryDictionary);
|
||||
var response = await _client.GetAsync(endpoint.ToString());
|
||||
|
||||
var response = await _client.GetAsync(endpoint);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
return new PagingResponse<CompanyDto>();
|
||||
}
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
|
||||
var pagingResponse = new PagingResponse<CompanyDto>
|
||||
{
|
||||
Items = JsonSerializer.Deserialize<List<CompanyDto>>(content, _options),
|
||||
MetaData = JsonSerializer.Deserialize<MetaData>(response.Headers.GetValues("X-Pagination").First(), _options)
|
||||
Items = JsonSerializer.Deserialize<List<CompanyDto>>(content, _options) ?? new List<CompanyDto>(),
|
||||
MetaData = JsonSerializer.Deserialize<MetaData>(response.Headers.GetValues("X-Pagination").First(), _options) ?? new MetaData()
|
||||
};
|
||||
return pagingResponse;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"appInfo": {
|
||||
"name": "Wonky Online",
|
||||
"version": "227.0",
|
||||
"version": "228.0",
|
||||
"rc": true,
|
||||
"sandBox": true,
|
||||
"image": "grumpy-coder.png",
|
||||
|
|
Loading…
Reference in a new issue