This commit is contained in:
Frede Hundewadt 2022-11-26 10:51:56 +01:00
parent 66c13df83f
commit 232b61949a
19 changed files with 336 additions and 152 deletions

View file

@ -1,3 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bestilling/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=kontrolleres/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Venligst/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Venligst/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Virk/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View file

@ -48,6 +48,7 @@ public partial class ProductInventoryTableComponent
private async Task OnSelectedItem(DraftItem draftItem)
{
// add item to order draft
DraftStateProvider.Draft.DraftType = "order";
DraftStateProvider.Draft.Items.Add(draftItem);
await DraftStateProvider.SaveChangesAsync();
}

View file

@ -21,9 +21,39 @@ namespace Wonky.Client.HttpInterfaces;
public interface ICatalogHttpRepository
{
/// <summary>
/// Get a paged sales item list
/// </summary>
/// <param name="pagingParameters"></param>
/// <returns></returns>
Task<PagingResponse<SalesItemView>> GetSalesItemsPaged(CatalogPagingParams pagingParameters);
/// <summary>
/// Get sales item by id
/// </summary>
/// <param name="salesItemId"></param>
/// <returns></returns>
Task<SalesItemView> GetSalesItemId(string salesItemId);
Task<SalesItemView> GetSalesVariantId(string variantId);
/// <summary>
/// Get sales item by sku
/// </summary>
/// <param name="sku"></param>
/// <returns></returns>
Task<SalesItemView> GetSalesItemSku(string sku);
Task<SalesItemView> GetSalesItemSku(string countryCode, string sku);
/// <summary>
/// Overload Get sales item by id and country code
/// </summary>
/// <param name="sku"></param>
/// <param name="countryCode"></param>
/// <returns></returns>
Task<SalesItemView> GetSalesItemSku(string sku, string countryCode);
/// <summary>
/// Get sales item by variant id
/// </summary>
/// <param name="variantId"></param>
/// <returns></returns>
Task<SalesItemView> GetSalesVariantId(string variantId);
}

View file

@ -20,12 +20,58 @@ namespace Wonky.Client.HttpInterfaces;
public interface ICrmActivityHttpRepository
{
Task<ReportItemView> GetReportItem(string salesHeadId);
Task<ActivityDto> GetActivity(string salesHeadId);
Task<ApiResponseView> CreateActivity(ActivityDto model);
Task<ApiResponseView> AcceptOffer(string id);
/// <summary>
/// Convert quote to sale
/// </summary>
/// <param name="activity"></param>
/// <returns></returns>
Task<ApiResponseView> AcceptQuote(ActivityDto activity);
/// <summary>
/// Get activities by date
/// </summary>
/// <param name="activityDate"></param>
/// <returns></returns>
Task<ReportStatusView> GetActivities(string activityDate);
/// <summary>
/// Create new activity
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
Task<ApiResponseView> CreateActivity(ActivityDto model);
/// <summary>
/// Get activity data by id
/// </summary>
/// <param name="activityId"></param>
/// <returns></returns>
Task<ActivityDto> GetActivity(string activityId);
/// <summary>
/// Get activity by id formatted for report
/// </summary>
/// <param name="activityId"></param>
/// <returns></returns>
Task<ReportItemView> GetReportItem(string activityId);
/// <summary>
/// Get activities for customer Id
/// </summary>
/// <param name="customerId"></param>
/// <returns></returns>
Task<List<ReportItemView>> GetCustomerActivities(string customerId);
/// <summary>
/// Set backend process state to express
/// </summary>
/// <param name="activityId"></param>
/// <returns>ApiResponseView</returns>
Task<ApiResponseView> SetProcessStateExpress(string activityId);
/// <summary>
/// Update office note for activity
/// </summary>
/// <param name="model"></param>
Task UpdateOfficeNote(ActivityOfficeNote model);
Task<ApiResponseView> GetExpressStatus(string id);
}

View file

@ -52,7 +52,12 @@ public class CatalogHttpRepository : ICatalogHttpRepository
_navigation = navigation;
_apiConfig = configuration.Value;
}
/// <summary>
/// Get a paged sales item list
/// </summary>
/// <param name="pagingParameters"></param>
/// <returns></returns>
public async Task<PagingResponse<SalesItemView>> GetSalesItemsPaged(CatalogPagingParams pagingParameters)
{
var queryString = new Dictionary<string, string>
@ -65,7 +70,7 @@ public class CatalogHttpRepository : ICatalogHttpRepository
["selectGroup"] = pagingParameters.SelectGroup == "0" ? "" : pagingParameters.SelectGroup,
};
var response = await _client
.GetAsync(QueryHelpers.AddQueryString($"{_apiConfig.Catalog}/page", queryString));
.GetAsync(QueryHelpers.AddQueryString($"{_apiConfig.Catalog}/page", queryString));
var content = await response.Content.ReadAsStringAsync();
@ -78,28 +83,50 @@ public class CatalogHttpRepository : ICatalogHttpRepository
return pagingResponse;
}
/// <summary>
/// Get sales item by id
/// </summary>
/// <param name="salesItemId"></param>
/// <returns></returns>
public async Task<SalesItemView> GetSalesItemId(string salesItemId)
{
var salesItem = await _client
.GetFromJsonAsync<SalesItemView>($"{_apiConfig.Catalog}/{salesItemId}");
return salesItem ?? new SalesItemView();
}
/// <summary>
/// Get sales item by sku
/// </summary>
/// <param name="sku"></param>
/// <returns></returns>
public async Task<SalesItemView> GetSalesItemSku(string sku)
{
var salesItem = await _client.GetFromJsonAsync<SalesItemView>($"{_apiConfig.Catalog}/sku/{sku}");
return salesItem ?? new SalesItemView();
}
/// <summary>
/// Overload Get sales item by id and country code
/// </summary>
/// <param name="sku"></param>
/// <param name="countryCode"></param>
/// <returns></returns>
public async Task<SalesItemView> GetSalesItemSku(string sku, string countryCode)
{
var salesItem = await _client.GetFromJsonAsync<SalesItemView>($"{_apiConfig.Catalog}/{countryCode}/sku/{sku}");
return salesItem ?? new SalesItemView();
}
/// <summary>
/// Get sales item by variant id
/// </summary>
/// <param name="variantId"></param>
/// <returns></returns>
public async Task<SalesItemView> GetSalesVariantId(string variantId)
{
var salesItem = await _client
.GetFromJsonAsync<SalesItemView>($"{_apiConfig.Catalog}/variant/{variantId}");
return salesItem ?? new SalesItemView();
}
public async Task<SalesItemView> GetSalesItemSku(string sku)
{
var salesItem = await _client.GetFromJsonAsync<SalesItemView>($"{_apiConfig.Catalog}/sku/{sku}");
return salesItem ?? new SalesItemView();
}
public async Task<SalesItemView> GetSalesItemSku(string countryCode, string sku)
{
var salesItem = await _client.GetFromJsonAsync<SalesItemView>($"{_apiConfig.Catalog}/{countryCode}/sku/{sku}");
return salesItem ?? new SalesItemView();
}
}

View file

@ -13,22 +13,13 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Json;
using System.Net.Mime;
using System.Text.Json;
using System.Threading.Tasks;
using Wonky.Client.Features;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Extensions.Options;
using Wonky.Client.HttpInterfaces;
using Wonky.Entity.Configuration;
using Wonky.Entity.DTO;
using Wonky.Entity.Models;
using Wonky.Entity.Requests;
using Wonky.Entity.Views;
namespace Wonky.Client.HttpRepository;
@ -44,7 +35,7 @@ public class CrmActivityHttpRepository : ICrmActivityHttpRepository
private ILogger<CrmActivityHttpRepository> _logger;
private readonly HttpClient _client;
private readonly ApiConfig _api;
public CrmActivityHttpRepository(HttpClient client,
ILogger<CrmActivityHttpRepository> logger,
NavigationManager navigation, IOptions<ApiConfig> configuration)
@ -55,44 +46,29 @@ public class CrmActivityHttpRepository : ICrmActivityHttpRepository
_api = configuration.Value;
}
public async Task<ApiResponseView> GetExpressStatus(string id)
/// <summary>
/// Convert quote to sale
/// </summary>
/// <param name="activity"></param>
/// <returns></returns>
public async Task<ApiResponseView> AcceptQuote(ActivityDto activity)
{
var response = await _client.GetFromJsonAsync<ApiResponseView>($"{_api.CrmSales}/express/{id}?status=Express");
var response = await _client.PutAsJsonAsync(
$"{_api.CrmActivities}/{activity.SalesHeadId}/accept", activity, _options);
if (response.IsSuccess) return response;
var msg = JsonSerializer.SerializeToElement(response.Message, _options);
response.Message = msg.ToString();
return response;
}
public async Task UpdateOfficeNote(ActivityOfficeNote model)
{
// _logger.LogDebug("UpdateOfficeNote => model \n{}", JsonSerializer.Serialize(model) );
// _logger.LogDebug("UpdateOfficeNote => url \n{}", $"{_api.CrmSales}/activity/{model.ActivityId}" );
await _client.PostAsJsonAsync($"{_api.CrmSales}/activity/{model.ActivityId}", model, _options);
}
public async Task<ReportStatusView> GetActivities(string activityDate)
{
var response = await _client
.GetAsync($"{_api.CrmSales}/date/{activityDate}");
var content = await response.Content.ReadAsStringAsync();
return string.IsNullOrWhiteSpace(content)
? new ReportStatusView()
: JsonSerializer.Deserialize<ReportStatusView>(content, _options);
var result = JsonSerializer.Deserialize<ApiResponseView>(content);
return result!;
}
public async Task<List<ReportItemView>> GetCustomerActivities(string customerId)
{
var response = await _client.GetAsync($"{_api.CrmSales}/company/{customerId}");
var content = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<List<ReportItemView>>(content, _options);
}
/// <summary>
/// Create new activity
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public async Task<ApiResponseView> CreateActivity(ActivityDto model)
{
var response = await _client.PostAsJsonAsync($"{_api.CrmSales}", model, _options);
var response = await _client.PostAsJsonAsync($"{_api.CrmActivities}", model, _options);
var content = await response.Content.ReadAsStringAsync();
var result = JsonSerializer.Deserialize<ApiResponseView>(content, _options);
if (result.IsSuccess) return result!;
@ -100,26 +76,84 @@ public class CrmActivityHttpRepository : ICrmActivityHttpRepository
result.Message = msg.ToString();
return result!;
}
public async Task<ReportItemView> GetReportItem(string salesHeadId)
/// <summary>
/// Get activities by date
/// </summary>
/// <param name="activityDate"></param>
/// <returns></returns>
public async Task<ReportStatusView> GetActivities(string activityDate)
{
var salesItem = await _client
.GetFromJsonAsync<ReportItemView>($"{_api.CrmSales}/{salesHeadId}");
return salesItem ?? new ReportItemView();
var response = await _client
.GetAsync($"{_api.CrmActivities}/date/{activityDate}");
var content = await response.Content.ReadAsStringAsync();
return string.IsNullOrWhiteSpace(content)
? new ReportStatusView()
: JsonSerializer.Deserialize<ReportStatusView>(content, _options);
}
public async Task<ActivityDto> GetActivity(string salesHeadId)
/// <summary>
/// Get activity data by id
/// </summary>
/// <param name="activityId"></param>
/// <returns></returns>
public async Task<ActivityDto> GetActivity(string activityId)
{
var salesItem = await _client
.GetFromJsonAsync<ActivityDto>($"{_api.CrmSales}/{salesHeadId}");
.GetFromJsonAsync<ActivityDto>($"{_api.CrmActivities}/{activityId}");
return salesItem ?? new ActivityDto();
}
public async Task<ApiResponseView> AcceptOffer(string id)
/// <summary>
/// Get activities for customer Id
/// </summary>
/// <param name="customerId"></param>
/// <returns></returns>
public async Task<List<ReportItemView>> GetCustomerActivities(string customerId)
{
var response = await _client.PostAsJsonAsync($"{_api.CrmSales}/{id}/accept", id);
var response = await _client.GetAsync($"{_api.CrmActivities}/company/{customerId}");
var content = await response.Content.ReadAsStringAsync();
var result = JsonSerializer.Deserialize<ApiResponseView>(content);
return result!;
return JsonSerializer.Deserialize<List<ReportItemView>>(content, _options);
}
/// <summary>
/// Get activity by id formatted for report
/// </summary>
/// <param name="activityId"></param>
/// <returns></returns>
public async Task<ReportItemView> GetReportItem(string activityId)
{
var salesItem = await _client
.GetFromJsonAsync<ReportItemView>($"{_api.CrmActivities}/{activityId}");
return salesItem ?? new ReportItemView();
}
/// Set backend process state to express
/// </summary>
/// <param name="activityId"></param>
/// <returns>ApiResponseView</returns>
public async Task<ApiResponseView> SetProcessStateExpress(string activityId)
{
var response = await _client.PutAsync(
$"{_api.CrmActivities}/express/{activityId}?status=Express", null);
var content = await response.Content.ReadAsStringAsync();
return string.IsNullOrWhiteSpace(content)
? new ApiResponseView
{
Code = (int)response.StatusCode,
Id = activityId,
Message = "Resoursen returnerede fejl",
IsSuccess = false
}
: JsonSerializer.Deserialize<ApiResponseView>(content);
}
/// <summary>
/// Update office note for activity
/// </summary>
/// <param name="model"></param>
public async Task UpdateOfficeNote(ActivityOfficeNote model)
{
await _client.PutAsJsonAsync($"{_api.CrmActivities}/note/{model.ActivityId}", model, _options);
}
}

View file

@ -79,7 +79,7 @@ public class CrmHistoryHttpRepository : ICrmHistoryHttpRepository
/// <returns>List of products</returns>
public async Task<List<ProductInventoryView>> FetchInventory(string companyId)
{
var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmInventory}");
var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmInventoryExt}");
var content = await response.Content.ReadAsStringAsync();
return response.IsSuccessStatusCode
? JsonSerializer.Deserialize<List<ProductInventoryView>>(content, _options)
@ -94,7 +94,7 @@ public class CrmHistoryHttpRepository : ICrmHistoryHttpRepository
public async Task<List<ProductHistoryView>> FetchHistory(string companyId)
{
return await _client.GetFromJsonAsync<List<ProductHistoryView>>(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmProducts}", _options);
$"{_api.CrmCustomers}/{companyId}/{_api.CrmProductExt}", _options);
}
/// <summary>
@ -106,7 +106,7 @@ public class CrmHistoryHttpRepository : ICrmHistoryHttpRepository
public async Task<List<ProductHistoryView>> FetchHistory(string companyId, string sku)
{
return await _client.GetFromJsonAsync<List<ProductHistoryView>>(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmProducts}/{sku}", _options);
$"{_api.CrmCustomers}/{companyId}/{_api.CrmProductExt}/{sku}", _options);
}
/// <summary>
/// execute a remote procedure designed to update crm database from erp system based on a date string
@ -116,6 +116,6 @@ public class CrmHistoryHttpRepository : ICrmHistoryHttpRepository
/// <returns>date string</returns>
public async Task<string> RpcSyncErpToCrm(string companyId, string syncDate)
{
return await _client.GetStringAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmSync}/{syncDate}");
return await _client.GetStringAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmRpcSyncExt}/{syncDate}");
}
}

View file

@ -50,32 +50,32 @@ public class CrmWorkplaceHttpRepository : ICrmWorkplaceHttpRepository
public async Task<List<WorkplaceListView>> GetWorkplaces(string companyId)
{
var result = await _client.GetFromJsonAsync<List<WorkplaceListView>>(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaces}", _options);
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}", _options);
return result ?? new List<WorkplaceListView>();
}
public async Task<WorkplaceDto> GetWorkplace(string companyId, string workplaceId)
{
var result = await _client.GetFromJsonAsync<WorkplaceDto>(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaces}/{workplaceId}", _options);
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}", _options);
return result ?? new WorkplaceDto();
}
public async Task CreateWorkplace(string companyId, WorkplaceDto workplace)
{
await _client.PostAsJsonAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaces}", workplace, _options);
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}", workplace, _options);
}
public async Task UpdateWorkplace(string companyId, WorkplaceDto workplace)
{
await _client.PutAsJsonAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaces}/{workplace.WorkplaceId}", workplace, _options);
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplace.WorkplaceId}", workplace, _options);
}
public async Task DeleteWorkplace(string companyId, string workplaceId)
{
await _client.DeleteAsync(
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaces}/{workplaceId}");
$"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}");
}
}

View file

@ -33,7 +33,7 @@ public class SendMailService : ISendMailService
public async Task<ApiResponseView> SendMail(string messageType, EmailMessage message)
{
var response = await _client.PostAsJsonAsync($"{_api.SendMail}/{messageType}", message, _options);
var response = await _client.PostAsJsonAsync($"{_api.ServicesMail}/{messageType}", message, _options);
if (!response.IsSuccessStatusCode)
return new ApiResponseView
{

View file

@ -31,6 +31,7 @@ public class DraftItem
public class Draft
{
public string DraftId { get; set; } = "";
public string DraftType { get; set; } = "noSale";
public List<DraftItem> Items { get; set; } = new ();
public decimal Total
{

View file

@ -50,8 +50,8 @@ else
<div class="row mb-1">
<label for="activityType" class="col-md-2 col-form-label">Ordre Type</label>
<div class="col-md-4">
<InputSelect id="activityType" class="form-select" @bind-Value="@Activity.ActivityTypeEnum">
<option value="">&rarr; TAG MIG &larr;</option>
<InputSelect id="activityType" class="form-select bg-info" @bind-Value="@Activity.ActivityTypeEnum">
<option value=""></option>
<option value="onSite">Besøg</option>
<option value="phone">Telefon</option>
</InputSelect>
@ -60,19 +60,27 @@ else
<label for="statusType" class="col-md-2 col-form-label">Status</label>
<div class="col-md-4">
<InputSelect id="statusType" class="form-select" @bind-Value="@Activity.ActivityStatusEnum">
<InputSelect id="statusType" class="form-select bg-info" @bind-Value="@Activity.ActivityStatusEnum">
<option value="noSale">Ingen salg</option>
@if (!string.IsNullOrEmpty(Activity.VatNumber) && !string.IsNullOrWhiteSpace(Activity.Address1) && Company.HasFolded == 0)
{
@if (DraftStateProvider.Draft.Items.Any())
@if (DraftStateProvider.Draft.DraftType == "quote")
{
<option value="order" selected>Bestilling</option>
<option selected value="order">Bestilling</option>
}
else
{
<option value="order">Bestilling</option>
}
<option value="quote">Tilbud</option>
@if(DraftStateProvider.Draft.DraftType == "offer")
{
<option selected value="quote">Tilbud</option>
}
else
{
<option value="quote">Tilbud</option>
}
}
</InputSelect>
<ValidationMessage For="@(() => Activity.ActivityStatusEnum)"></ValidationMessage>
@ -322,13 +330,10 @@ else
</div>
</EditForm>
<div class="row mt-2 mb-2">
<div class="col">
<a class="btn btn-info" href="/companies">Til Oversigt</a>
</div>
<div class="col">
<div class="col text-end">
<a class="btn btn-warning" href="/companies/@Company.CompanyId">Tilbage</a>
</div>
<div class="col">
<div class="col text-end">
<button type="button" class="btn btn-primary" @onclick="CreateActivity" disabled="@PoFormInvalid">Opret besøg</button>
</div>
</div>

View file

@ -100,6 +100,7 @@ public partial class CrmActivityNewPage : IDisposable
{
Company.Phone = Company.Account[..8];
}
// Populate base activity information
Activity.BcId = Company.BcId;
Activity.ActivityStatusEnum = "noSale";
@ -135,7 +136,7 @@ public partial class CrmActivityNewPage : IDisposable
ConfirmWorkDate.Show();
}
// Lines may already have been added from the company inventory page
if (DraftStateProvider.Draft.Items.Any())
if (DraftStateProvider.Draft.DraftType == "order")
{
// set dropdown selection accordingly
Activity.ActivityTypeEnum = "onSite";
@ -144,6 +145,7 @@ public partial class CrmActivityNewPage : IDisposable
}
StateHasChanged();
}
/// <summary>
/// Work Date confirm callback
/// </summary>
@ -153,6 +155,18 @@ public partial class CrmActivityNewPage : IDisposable
ConfirmWorkDate.Hide();
StateHasChanged();
}
/// <summary>
/// Work Date component callback
/// </summary>
/// <param name="workDate"></param>
private async Task WorkDateComponentCallback(string workDate)
{
ReportClosed = await CrmReportRepo.ReportExist(workDate);
SelectedDate = DateTime.Parse(workDate);
Activity.ActivityDate = workDate;
}
/// <summary>
/// Show Price list modal
/// </summary>
@ -160,6 +174,7 @@ public partial class CrmActivityNewPage : IDisposable
{
PriceListModal.Show();
}
/// <summary>
/// Price List modal callback
/// </summary>
@ -177,6 +192,7 @@ public partial class CrmActivityNewPage : IDisposable
StateHasChanged();
}
/// <summary>
/// Show Price History modal
/// </summary>
@ -185,6 +201,7 @@ public partial class CrmActivityNewPage : IDisposable
if(ShowItem)
PriceHistoryModal.Show();
}
/// <summary>
/// Price History modal callback
/// </summary>
@ -198,16 +215,6 @@ public partial class CrmActivityNewPage : IDisposable
StateHasChanged();
}
/// <summary>
/// Work Date component callback
/// </summary>
/// <param name="workDate"></param>
private async Task WorkDateComponentCallback(string workDate)
{
ReportClosed = await CrmReportRepo.ReportExist(workDate);
SelectedDate = DateTime.Parse(workDate);
Activity.ActivityDate = workDate;
}
/// <summary>
/// Validate and Create Activity
/// </summary>
@ -294,6 +301,7 @@ public partial class CrmActivityNewPage : IDisposable
PoFormInvalid = false;
Toast.ShowError(result.Message, "ORDRE FEJL");
}
/// <summary>
/// Delete current draft
/// </summary>
@ -302,6 +310,7 @@ public partial class CrmActivityNewPage : IDisposable
await DraftStateProvider.DeleteDraftAsync();
Activity.ActivityStatusEnum = "noSale";
}
/// <summary>
/// Add item to draft
/// </summary>
@ -330,6 +339,7 @@ public partial class CrmActivityNewPage : IDisposable
// save the item using the CartStateProvider's save method
await DraftStateProvider.SaveChangesAsync();
}
/// <summary>
/// Remove item from draft
/// </summary>
@ -343,6 +353,7 @@ public partial class CrmActivityNewPage : IDisposable
if (!DraftStateProvider.Draft.Items.Any())
Activity.ActivityStatusEnum = "noSale";
}
/// <summary>
/// Edit Context handle field change
/// </summary>
@ -350,6 +361,7 @@ public partial class CrmActivityNewPage : IDisposable
/// <param name="e"></param>
private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
{
DraftStateProvider.Draft.DraftType = Activity.ActivityStatusEnum;
// InvalidCanvas = InvalidActivityType;
InvalidActivity = InvalidActivityType
|| PoFormInvalid
@ -368,6 +380,7 @@ public partial class CrmActivityNewPage : IDisposable
PoFormInvalid = !ActivityContext.Validate();
StateHasChanged();
}
/// <summary>
/// Edit Context handle validation change
/// </summary>
@ -387,6 +400,7 @@ public partial class CrmActivityNewPage : IDisposable
ActivityContext.OnFieldChanged += HandleFieldChanged;
ActivityContext.OnValidationStateChanged += ValidationChanged;
}
/// <summary>
/// Implement Dispose from IDisposable
/// </summary>

View file

@ -0,0 +1,15 @@
@page "/companies/{CompanyId}/quotes"
@using Wonky.Client.HttpInterfaces
<div class="row">
<h3>Åbne tilbud</h3>
</div>
@code {
[Inject] ICrmHistoryHttpRepository HistoryRepo { get; set; }
protected override Task OnParametersSetAsync()
{
return base.OnParametersSetAsync();
}
}

View file

@ -98,7 +98,7 @@
<button type="button" class="btn btn-primary" disabled="@(Company.HasFolded == 0)" onclick="@ForceActivity">Aktiver besøg</button>
</div>
<div class="col-sm-2 text-end">
<button type="button" class="btn btn-primary" onclick="@UpdateErpData" disabled="@(Working)">Gem STAM data</button>
<button type="button" class="btn btn-primary" onclick="@UpdateErpData" disabled="@(Working)">STAM data <i class="bi-save"></i></button>
</div>
@* account *@
@ -123,7 +123,7 @@
</div>
@* save vat number *@
<div class="col-sm-2 text-end">
<button type="button" class="btn btn-primary" @onclick="UpdateVatNumber">Gem MOMS Nr</button>
<button type="button" class="btn btn-primary" @onclick="UpdateVatNumber">MOMS Nr<i class="bi-save"></i></button>
</div>
</div>
@ -131,7 +131,10 @@
@* activity buttons *@
<div class="row mt-3 mb-2">
<div class="col">
<a class="btn btn-light border-dark d-block" href="/companies/@Company.CompanyId/invoices">Faktura</a>
<a class="btn btn-light border-dark d-block" href="/companies/@Company.CompanyId/invoices">Poster</a>
</div>
<div class="col">
<a class="btn btn-light border-dark d-block" href="/companies/@Company.CompanyId/quotes">Tilbud</a>
</div>
<div class="col">
<a class="btn btn-light border-dark d-block" href="/companies/@Company.CompanyId/activities">Besøg</a>
@ -165,7 +168,7 @@
</div>
@* Save CRM data button *@
<div class="col-sm-3 text-end">
<button type="button" class="btn btn-primary" @onclick="UpdateCrmData">Gem CRM data</button>
<button type="button" class="btn btn-primary" @onclick="UpdateCrmData">CRM <i class="bi-save"></i></button>
</div>
</div>
@* crm context - contacts *@

View file

@ -57,10 +57,13 @@ public partial class OfficeOrderViewPage : IDisposable
Logger.LogDebug("ReportItem => \n {}", JsonSerializer.Serialize(_reportItem, _options));
}
/// <summary>
/// Set activity process state to express. Send confirmation notification to salesRep
/// </summary>
private async Task SetExpressState()
{
Logger.LogDebug("SetExpressState => \n {}", JsonSerializer.Serialize(_reportItem, _options));
var responseView = await ActivityRepo.GetExpressStatus(_reportItem.ActivityId);
var responseView = await ActivityRepo.SetProcessStateExpress(_reportItem.ActivityId);
Logger.LogDebug("SetExpressState => \n {}", responseView.Message );
if (!responseView.IsSuccess)
@ -105,12 +108,15 @@ public partial class OfficeOrderViewPage : IDisposable
var sendMail = await MailService.SendMail("System", msg);
if (sendMail.IsSuccess)
{
Toast.ShowSuccess($"Status er opdateret og notifikation sendt til {salesRep.FirstName}.", "OK");
Toast
.ShowSuccess(
$"Status er opdateret og notifikation sendt til {salesRep.FirstName}.", "OK");
}
else
{
Toast.ShowWarning($"Notifikation til {salesRep.FirstName} kunne ikke sendes. {sendMail.Message}",
"ADVARSEL");
Toast
.ShowWarning(
$"Notifikation til {salesRep.FirstName} kunne ikke sendes. {sendMail.Message}", "ADVARSEL");
}
_isNotified = true;

View file

@ -41,7 +41,7 @@ builder.Services.AddScoped(sp =>
builder.Services.AddHttpClient("InnoAPI", (sp, cl) =>
{
var apiConfig = sp.GetRequiredService<IOptions<ApiConfig>>();
cl.BaseAddress = new Uri(apiConfig.Value.InnoBaseUrl);
cl.BaseAddress = new Uri(apiConfig.Value.ApiBaseUrl);
cl.DefaultRequestHeaders.CacheControl = CacheControlHeaderValue.Parse("no-cache, no-store, must-revalidate");
cl.DefaultRequestHeaders.Add("Pragma", "no-cache");
cl.EnableIntercept(sp);

View file

@ -52,7 +52,7 @@ public class VatInfoLookupService
["zipCode"] = $"{query.ZipCode}",
["entityName"] = $"{query.EntityName}"
};
var endpoint = QueryHelpers.AddQueryString(_config.ServiceVirk, queryString);
var endpoint = QueryHelpers.AddQueryString(_config.ServicesVatDk, queryString);
var response = await _client.GetAsync(endpoint);
var content = await response.Content.ReadAsStringAsync();
@ -80,7 +80,7 @@ public class VatInfoLookupService
["vatNumber"] = $"{vatNumber}"
};
var endpoint = QueryHelpers.AddQueryString(_config.ServiceBrReg, queryString);
var endpoint = QueryHelpers.AddQueryString(_config.ServicesVatNo, queryString);
var response = await _client.GetAsync(endpoint);
var content = await response.Content.ReadAsStringAsync();
@ -102,7 +102,7 @@ public class VatInfoLookupService
{
["vatNumber"] = $"{vatNumber}"
};
var endpoint = QueryHelpers.AddQueryString(_config.ServiceVies, queryString);
var endpoint = QueryHelpers.AddQueryString(_config.ServicesVatEu, queryString);
var response = await _client.GetAsync(endpoint);
var content = await response.Content.ReadAsStringAsync();

View file

@ -1,36 +1,36 @@
{
"appInfo": {
"name": "Wonky Client",
"version": "0.52.1",
"rc": false,
"version": "0.53.2",
"rc": true,
"sandBox": false,
"image": "grumpy-coder.png"
},
"apiConfig": {
"innoBaseUrl": "https://zeta.innotec.dk",
"glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=",
"glsId": "",
"serviceVirk": "api/v2/services/virk",
"serviceBrReg": "api/v2/services/brReg",
"serviceVies": "api/v2/services/vies",
"token": "token",
"userInfo": "api/auth/userinfo",
"apiBaseUrl": "https://zeta.innotec.dk",
"catalog": "api/v2/catalog",
"crmSales": "api/v2/crm/advisors/sales",
"crmReports": "api/v2/crm/advisors/reports",
"crmTasks": "api/v2/crm/advisors/tasks",
"crmCustomers": "api/v2/crm/companies",
"crmInventory": "history/inventory",
"crmProducts": "history/products",
"crmSync": "invoices/sync",
"crmWorkplaces": "workplaces",
"crmInventoryExt": "history/inventory",
"crmProductExt": "history/products",
"crmReports": "api/v2/crm/advisors/reports",
"crmActivities": "api/v2/crm/advisors/activities",
"crmRpcSyncExt": "invoices/sync",
"crmBaseTasks": "api/v2/crm/advisors/tasks",
"crmWorkplaceExt": "workplaces",
"officeAdvisors": "api/v2/office/users/advisors",
"officeUsers": "api/v2/office/users/admin",
"officeUserPasswd": "api/v2/office/users/passwd",
"officeCustomers": "api/v2/office/customers",
"officeReports": "api/v2/office/reports",
"warehouse": "api/v2/warehouse/packages",
"sendMail": "api/v2/services/sendmail"
"officeUserPasswd": "api/v2/office/users/passwd",
"officeUsers": "api/v2/office/users/admin",
"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",
"servicesVatDk": "api/v2/services/virk",
"serviceVatEu": "api/v2/services/vies",
"servicesVatNo": "api/v2/services/brReg",
"token": "token",
"userInfo": "api/auth/userinfo",
"warehouse": "api/v2/warehouse/packages"
},
"Logging": {
"LogLevel": {

View file

@ -19,32 +19,32 @@ public class ApiConfig
/// <summary>
/// Application base url
/// </summary>
public string InnoBaseUrl { get; set; } = "";
public string ApiBaseUrl { get; set; } = "";
/// <summary>
/// GLS tracking url
/// </summary>
public string GlsTrackUrl { get; set; } = "";
public string ServicesGlsTrackUrl { get; set; } = "";
/// <summary>
/// GLS customer entity
/// </summary>
public string GlsId { get; set; } = "";
public string ServicesGlsId { get; set; } = "";
/// <summary>
/// VAT registrar url Denmark
/// </summary>
public string ServiceVirk { get; set; } = "";
public string ServicesVatDk { get; set; } = "";
/// <summary>
/// VAT registrar url Norway
/// </summary>
public string ServiceBrReg { get; set; } = "";
public string ServicesVatNo { get; set; } = "";
/// <summary>
/// VAT registrar url EU
/// </summary>
public string ServiceVies { get; set; } = "";
public string ServicesVatEu { get; set; } = "";
/// <summary>
/// Application uri for token request
@ -64,7 +64,7 @@ public class ApiConfig
/// <summary>
/// Application uri for activity request
/// </summary>
public string CrmSales { get; set; } = "";
public string CrmActivities { get; set; } = "";
/// <summary>
/// Application uri for sales report request
@ -84,22 +84,22 @@ public class ApiConfig
/// <summary>
/// Application uri for customer product inventory request
/// </summary>
public string CrmInventory { get; set; } = "";
public string CrmInventoryExt { get; set; } = "";
/// <summary>
/// Application uri for customer product sale request
/// </summary>
public string CrmProducts { get; set; } = "";
public string CrmProductExt { get; set; } = "";
/// <summary>
/// Application uri for updating customer product sale request
/// </summary>
public string CrmSync { get; set; } = "";
public string CrmRpcSyncExt { get; set; } = "";
/// <summary>
/// Application uri for getting workplace(s)
/// </summary>
public string CrmWorkplaces { get; set; } = "";
public string CrmWorkplaceExt { get; set; } = "";
/// <summary>
/// Application uri for administration of sales representatives
@ -134,7 +134,7 @@ public class ApiConfig
/// <summary>
/// url for sending mail message
/// </summary>
public string SendMail { get; set; } = "";
public string ServicesMail { get; set; } = "";
// /// <summary>
// /// Application uri for reading salesReports
// /// </summary>