working update

This commit is contained in:
Frede Hundewadt 2023-08-03 06:50:21 +02:00
parent b4b6420ea7
commit 7750630068
7 changed files with 23 additions and 39 deletions

View file

@ -58,7 +58,7 @@
<div class="col-sm-2">
<div class="position-relative">
<div class="product-image">
<img class="img-fluid img-thumbnail" src="@product.PictureLink?height=100"
<img class="img-fluid img-thumbnail" src="@($"{_config.AssetUrl}/images/{product.VendorItemNo}.png")?height=100"
onerror="this.onerror=null;this.src='@(_config.AssetUrl)/images/no-image.png?height=100'"
alt="@product.Description"/>
</div>
@ -87,7 +87,8 @@
@product.Description
</div>
<div class="col-sm-2 text-sm-start">
@product.Sku
<a class="btn btn-outline-secondary" href="@(_config.AssetUrl)/Home/DownloadLabelNumber?filename=@(product.VendorItemNo).lbx">
Hyldekant @product.Sku</a>
</div>
<div class="col-sm-1 text-center">
@product.Quantity

View file

@ -51,8 +51,8 @@ public static class Utils
{
return items.Select(item => new ProductVariant
{
VariantId = item.VariantId,
S5A = item.S5A,
VariantId = item.VariantId,
S5A = item.S5A,
S9A = item.S9A
})
.ToList();
@ -159,7 +159,7 @@ public static class Utils
}).ToList();
}
public static string StringToDigits(string digitString)
{
if (string.IsNullOrWhiteSpace(digitString))

View file

@ -80,7 +80,7 @@ public class AdvisorCustomerHistoryRepository : IAdvisorCustomerHistoryRepositor
public async Task<List<ProductInventoryItemView>> GetInventory(string companyId)
{
var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmInventoryExt}");
var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/history/inventory");
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content))
return new List<ProductInventoryItemView>();
@ -90,7 +90,7 @@ public class AdvisorCustomerHistoryRepository : IAdvisorCustomerHistoryRepositor
public async Task<List<ProductHistoryView>> GetProductInvoiceLines(string companyId)
{
var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmProductExt}");
var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/history/products");
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content))
{
@ -102,7 +102,7 @@ public class AdvisorCustomerHistoryRepository : IAdvisorCustomerHistoryRepositor
public async Task<List<ProductHistoryView>> GetProductInvoiceLines(string companyId, int months)
{
var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmProductExt}/statistic?months={months}");
var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/history/products/statistic?months={months}");
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content))
{
@ -114,7 +114,7 @@ public class AdvisorCustomerHistoryRepository : IAdvisorCustomerHistoryRepositor
public async Task<List<ProductHistoryView>> GetProductInvoiceLines(string companyId, string sku)
{
var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmProductExt}/{sku}");
var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/history/products/{sku}");
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content))
{

View file

@ -51,7 +51,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository
public async Task<List<WorkplaceListView>> GetWorkplaces(string companyId)
{
var result = await _client.GetAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}");
$"{_api.CrmCustomers}/{companyId}/workplaces");
var content = await result.Content.ReadAsStringAsync();
if (!result.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content))
{
@ -64,7 +64,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository
public async Task<WorkplaceDto> GetWorkplace(string companyId, string workplaceId)
{
var result = await _client.GetAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}");
$"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}");
var content = await result.Content.ReadAsStringAsync();
if (!result.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content))
{
@ -77,7 +77,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository
public async Task<WorkplaceDocInfo> GetDocuments(string companyId, string workplaceId)
{
var result = await _client.GetAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents");
$"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}/documents");
var content = await result.Content.ReadAsStringAsync();
if (!result.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content))
{
@ -90,7 +90,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository
public async Task<WorkplaceDocInfo> GetRevisionList(string companyId, string workplaceId)
{
var result = await _client.GetAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents/revision");
$"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}/documents/revision");
var content = await result.Content.ReadAsStringAsync();
if (!result.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content))
{
@ -103,7 +103,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository
public async Task<string> PostWorkplace(string companyId, WorkplaceDto workplace)
{
var result = await _client.PostAsJsonAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}", workplace, _options);
$"{_api.CrmCustomers}/{companyId}/workplaces", workplace, _options);
var content = await result.Content.ReadAsStringAsync();
// if (!result.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content))
// {
@ -116,7 +116,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository
public async Task<BucketResultView> PostWorkplaceDocuments(string companyId, string workplaceId, BucketDto bucketDto)
{
var result = await _client.PostAsJsonAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents/bop", bucketDto, _options);
$"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}/documents/bop", bucketDto, _options);
var content = await result.Content.ReadAsStringAsync();
if (!result.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content))
{
@ -129,31 +129,31 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository
public async Task PutWorkplace(string companyId, WorkplaceDto workplace)
{
await _client.PutAsJsonAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplace.WorkplaceId}", workplace, _options);
$"{_api.CrmCustomers}/{companyId}/workplaces/{workplace.WorkplaceId}", workplace, _options);
}
public async Task DeleteWorkplace(string companyId, string workplaceId)
{
await _client.DeleteAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}");
$"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}");
}
public async Task DeleteDocument(string companyId, string workplaceId, string documentId)
{
await _client.DeleteAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents/{documentId}");
$"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}/documents/{documentId}");
}
public async Task DeleteVariantDocuments(string companyId, string workplaceId, string apbDocumentId, string apvDocumentId)
{
await _client.DeleteAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents/{apvDocumentId}");
$"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}/documents/{apvDocumentId}");
await _client.DeleteAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents/{apbDocumentId}");
$"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}/documents/{apbDocumentId}");
}
}

View file

@ -137,6 +137,7 @@ public partial class AdvisorCustomerWorkplaceRevisionPage : IDisposable
Logger.LogDebug("submitRevision {}", JsonSerializer.Serialize(x));
var result = await WorkplaceRepo.PostWorkplaceDocuments(CompanyId, WorkplaceId, x);
Logger.LogDebug("result {}", JsonSerializer.Serialize(result));
Toaster.ClearAll();
Toaster.ShowInfo("Sådan!");

View file

@ -1,7 +1,7 @@
{
"appInfo": {
"name": "Wonky Online",
"version": "197.0",
"version": "203.0",
"rc": true,
"sandBox": true,
"image": "grumpy-coder.png",
@ -24,12 +24,9 @@
"baseUrl": "https://dev.innotec.dk",
"catalog": "api/v2/catalog/country",
"crmCustomers": "api/v2/crm/companies",
"crmInventoryExt": "history/inventory",
"crmProductExt": "history/products",
"crmReports": "api/v2/crm/advisors/reports",
"crmActivities": "api/v2/crm/advisors/activities",
"crmTasks": "api/v2/crm/advisors/tasks",
"crmWorkplaceExt": "workplaces",
"officeBase": "api/v2/office",
"officeActivities": "api/v2/office/activities",
"officeAdvisors": "api/v2/office/users/advisors",

View file

@ -53,21 +53,6 @@ public class ApiConfig
/// </summary>
public string CrmCustomers { get; set; } = "";
/// <summary>
/// Application uri for customer product inventory request
/// </summary>
public string CrmInventoryExt { get; set; } = "";
/// <summary>
/// Application uri for customer product sale request
/// </summary>
public string CrmProductExt { get; set; } = "";
/// <summary>
/// Application uri for getting workplace(s)
/// </summary>
public string CrmWorkplaceExt { get; set; } = "";
/// <summary>
/// Office base url
/// </summary>