added new data fields to companyDto and activityDto

This commit is contained in:
Frede Hundewadt 2023-05-24 18:57:07 +02:00
parent e1a358f8b7
commit ee9921296a
15 changed files with 222 additions and 376 deletions

View file

@ -148,7 +148,7 @@ public class CrmCustomerRepository : ICrmCustomerRepository
};
var response = await _client.PutAsJsonAsync($"{_conf.CrmCustomers}/{companyId}/crmData", updateModel, _options);
var content = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<CompanyDto>(content);
return JsonSerializer.Deserialize<CompanyDto>(content) ?? new CompanyDto();
}
/// <summary>
@ -169,12 +169,14 @@ public class CrmCustomerRepository : ICrmCustomerRepository
Mobile = company.Mobile,
Name = company.Name,
Phone = company.Phone,
ZipCode = company.ZipCode
ZipCode = company.ZipCode,
EanNumber = company.EanNumber,
Segment = company.Segment
};
var response = await _client.PutAsJsonAsync($"{_conf.CrmCustomers}/{companyId}/erpData", updateModel, _options);
var content = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<CompanyDto>(content);
return JsonSerializer.Deserialize<CompanyDto>(content) ?? new CompanyDto();
}
/// <summary>

View file

@ -4,12 +4,12 @@ namespace Wonky.Client.Models;
public class DocView
{
public string ApbDocId { get; set; } = "";
public string ApbDocLink { get; set; } = "";
public string ApvDocId { get; set; } = "";
public string ApvDocLink { get; set; } = "";
public string DocumentDate { get; set; } = "";
public string ProductId { get; set; } = "";
public string VariantId { get; set; } = "";
public string VariantName { get; set; } = "";
public string ApbDocId { get; set; } = "";
public string ApbDocLink { get; set; } = "";
public string ApvDocId { get; set; } = "";
public string ApvDocLink { get; set; } = "";
public string DocumentDate { get; set; } = "";
public string ProductId { get; set; } = "";
public string VariantId { get; set; } = "";
public string VariantName { get; set; } = "";
}

View file

@ -167,6 +167,8 @@ public partial class AdvisorActivityCreatePage : IDisposable
Activity.DlvAddress2 = Company.Address2;
Activity.DlvZipCode = Company.ZipCode;
Activity.DlvCity = Company.City;
Activity.Segment = Company.Segment;
Activity.EanNumber = Company.EanNumber;
// Initialize date variable
Logger.LogDebug("AdvisorActivityCreatePage => DateTime parser => {}", UserPreference.WorkDate);

View file

@ -30,13 +30,13 @@
<div class="row pt-2 pb-2 mb-2 rounded rounded-2 bg-dark text-white">
<div class="col-sm-10">
<div class="mt-1">
<span class="h3">@Company.Name</span> <span>(@Company.Account)</span>
<span class="h3">@Company.Name</span> <span>(@Company.Account)</span>
</div>
</div>
<div class="col-sm-2 text-end">
<a class="btn btn-primary" href="/advisor/customers"><i class="bi-chevron-left"></i> Tilbage</a>
<a class="btn btn-primary" href="/advisor/customers"><i class="bi-chevron-left"></i> Tilbage</a>
</div>
</div>
// erp context
<EditForm EditContext="ErpContext">
@ -68,16 +68,22 @@
</div>
@* Post Code *@
<label for="zipCode" class="col-sm-1 col-form-label-sm">PostNr</label>
<div class="col-sm-2">
<div class="col-sm-1">
<InputText id="zipCode" class="form-control" @bind-Value="Company.ZipCode" readonly="@(ErpEditDisabled)"/>
<ValidationMessage For="@(() => Company.ZipCode)"></ValidationMessage>
</div>
@* City Name *@
<label for="city" class="col-sm-1 col-form-label-sm">Bynavn</label>
<div class="col-sm-8">
<div class="col-sm-3">
<InputText id="city" class="form-control" @bind-Value="Company.City" readonly="@(ErpEditDisabled)"/>
<ValidationMessage For="@(() => Company.City)"></ValidationMessage>
</div>
@* Email *@
<label for="email" class="col-sm-1 col-form-label-sm">Epost</label>
<div class="col-sm-5">
<InputText id="email" class="form-control" @bind-Value="Company.Email" readonly="@(ErpEditDisabled)"/>
<ValidationMessage For="@(() => Company.Email)"></ValidationMessage>
</div>
@* Phone *@
<label for="phone" class="col-sm-1 col-form-label-sm">Telefon</label>
<div class="col-sm-2">
@ -91,37 +97,29 @@
<ValidationMessage For="@(() => Company.Mobile)"></ValidationMessage>
</div>
@* Email *@
<label for="email" class="col-sm-1 col-form-label-sm">Epost</label>
<label for="email" class="col-sm-1 col-form-label-sm">EAN</label>
<div class="col-sm-5">
<InputText id="email" class="form-control" @bind-Value="Company.Email" readonly="@(ErpEditDisabled)"/>
<ValidationMessage For="@(() => Company.Email)"></ValidationMessage>
<InputText id="email" class="form-control" @bind-Value="Company.EanNumber" readonly="@(ErpEditDisabled)"/>
<ValidationMessage For="@(() => Company.EanNumber)"></ValidationMessage>
</div>
@if (!Kanvas)
{
@if (AppInfo!.Value!.Rc)
{
<label for="segment" class="col-sm-1 col-form-label-sm">Segment</label>
<div class="col-sm-2">
<InputSelect id="segment" class="form-select bg-warning text-bg-warning" @bind-Value="@Company.Segment">
<option value="" disabled>segment</option>
<option value="1">AUTO</option>
<option value="2">INDUSTRI</option>
</InputSelect>
@* <ValidationMessage For="@(() => )"></ValidationMessage> *@
<label for="segment" class="col-sm-1 col-form-label-sm">Segment</label>
<div class="col-sm-2">
<InputSelect id="segment" class="form-select bg-warning text-bg-warning"
@bind-Value="@Company.Segment" disabled="@(ErpEditDisabled)">
<option value="" disabled>segment</option>
<option value="1">AUTO</option>
<option value="2">INDUSTRI</option>
</InputSelect>
<ValidationMessage For="@(() => Company.Segment)"></ValidationMessage>
</div>
<div class="col-sm-1">
<div class="led-box @(DateTime.Now < DateTime.Parse("2023-12-31") ? "inno-display" : "inno-hidden")">
<div class="led-red"></div>
</div>
<div class="col-sm-1">
<div class="led-box @(DateTime.Now < DateTime.Parse("2023-12-31") ? "inno-display" : "inno-hidden")">
<div class="led-red"></div>
</div>
</div>
}
else
{
<div class="col-sm-4">
@* placeholder *@
</div>
}
</div>
@* Enable edit/save *@
<div class="col-sm-2 d-grid mx-auto">
@ -312,4 +310,4 @@
@ref="VatLookupPopup" OnSelectedCompany="SelectedCompanyCallback"/>
<ContactViewEditModal SelectedContact="SelectedContact" CompanyName="@Company.Name"
@ref="ContactViewPopup" OnSaveClicked="WriteContactCallback" OnDeleteClicked="DeleteContactCallback"/>
@ref="ContactViewPopup" OnSaveClicked="WriteContactCallback" OnDeleteClicked="DeleteContactCallback"/>

View file

@ -455,7 +455,7 @@ public partial class AdvisorCustomerViewEditPage : IDisposable
ErpContext = new EditContext(Company);
ErpContext.OnFieldChanged += HandleFieldChanged;
ErpContext.OnValidationStateChanged += ValidationChanged;
ErpContext.OnValidationStateChanged += ValidationChanged!;
}
/// <summary>

View file

@ -16,7 +16,7 @@
@using Microsoft.AspNetCore.Authorization
@using Wonky.Client.Components
@attribute [Authorize(Roles = "Advisor")]
@page "/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}/doc"
@page "/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}/documents/new"
<PageTitle>@Workplace.CompanyName - @Workplace.Name</PageTitle>
<div class="row -mb-3">
<div class="col-sm-4">
@ -33,6 +33,69 @@
</div>
</div>
<EditForm EditContext="FormContext" OnValidSubmit="SubmitForm">
<DataAnnotationsValidator/>
<div class="row g-3 mb-3">
<div class="col-sm-12 col-md-6">
<div class="form-floating">
<InputText id="eyeCleanerLocation" class="form-control" @bind-Value="WorkplaceDocumentDto.EyeCleanerLocation" placeholder="Øjenskylleflaske"/>
<label for="eyeCleanerLocation">Øjenskylleflaske</label>
<ValidationMessage For="@(() => WorkplaceDocumentDto.EyeCleanerLocation)"></ValidationMessage>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div class="form-floating">
<InputText id="firstAidStorage" class="form-control" @bind-Value="WorkplaceDocumentDto.FirstAidLocation" placeholder="Førstehjælp"/>
<label for="firstAidStorage">Førstehjælp</label>
<ValidationMessage For="@(() => WorkplaceDocumentDto.FirstAidLocation)"></ValidationMessage>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div class="form-floating">
<InputText id="productStorage" class="form-control" @bind-Value="WorkplaceDocumentDto.ProductStorage" placeholder="Produkt opbevaring"/>
<label for="productStorage">Produkt Opbevaring</label>
<ValidationMessage For="@(() => WorkplaceDocumentDto.ProductStorage)"></ValidationMessage>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div class="form-floating">
<InputText id="maskStorage" class="form-control" @bind-Value="WorkplaceDocumentDto.MaskStorage" placeholder="Maske opbevaring"/>
<label for="maskStorage">Maske Opbevaring</label>
<ValidationMessage For="@(() => WorkplaceDocumentDto.MaskStorage)"></ValidationMessage>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div class="form-floating">
<InputText id="glovesStorage" class="form-control" @bind-Value="WorkplaceDocumentDto.GlovesStorage" placeholder="Handsker"/>
<label for="glovesStorage">Handsker</label>
<ValidationMessage For="@(() => WorkplaceDocumentDto.GlovesStorage)"></ValidationMessage>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div class="form-floating">
<InputText id="gogglesStorage" class="form-control" @bind-Value="WorkplaceDocumentDto.GogglesStorage" placeholder="Beskyttelsesbriller"/>
<label for="gogglesStorage">Beskyttelsesbriller</label>
<ValidationMessage For="@(() => WorkplaceDocumentDto.GogglesStorage)"></ValidationMessage>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div class="form-floating">
<InputText id="wasteDeposit" class="form-control" @bind-Value="WorkplaceDocumentDto.WasteDeposit" placeholder="Affald og Spild"/>
<label for="wasteDeposit">Affald og Spild</label>
<ValidationMessage For="@(() => WorkplaceDocumentDto.WasteDeposit)"></ValidationMessage>
</div>
</div>
</div>
<div class="row mb-5">
<div class="col-sm-4 d-flex">
<a class="btn btn-primary mx-auto" href="/advisor/customers/@CompanyId"><i class="bi-x-lg"></i> Fortryd</a>
</div>
<div class="col-sm-4 d-flex">
<button type="submit" class="btn btn-success mx-auto" disabled="@FormInvalid"><i class="bi-cloud-upload"></i> Gem</button>
</div>
</div>
</EditForm>
@if (Working)

View file

@ -33,12 +33,11 @@ namespace Wonky.Client.Pages;
public partial class CrmCustomerWorkplaceDocumentAddPage : IDisposable
{
// #############################################################
[Inject] public ICrmWorkplaceRepository Workplaces { get; set; }
[Inject] public ICrmWorkplaceRepository WorkplaceRepo { get; set; }
[Inject] public ICrmPublicProductRepository PublicProductRepo { get; set; }
[Inject] public HttpInterceptorService Interceptor { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
[Inject] public ILogger<CrmCustomerWorkplaceDocumentAddPage> Logger { get; set; }
[Inject] public ISystemSendMailService SendMail { get; set; }
[Inject] public IToastService Toaster { get; set; }
// #############################################################
@ -46,64 +45,34 @@ public partial class CrmCustomerWorkplaceDocumentAddPage : IDisposable
[Parameter] public string WorkplaceId { get; set; } = "";
// #############################################################
private EditContext FormContext { get; set; }
private WorkplaceDto Workplace { get; set; } = new();
private EditContext WorkplaceContext { get; set; }
private bool Working { get; set; } = true;
private WorkplaceInventory WorkplaceInventory { get; set; } = new();
private List<DocView> DocViews { get; set; } = new();
private ConfirmDeleteModal ConfirmDeleteWorkplace { get; set; }
private ConfirmDeleteModal ConfirmDeleteProduct { get; set; }
private string DeleteMessage { get; set; } = "";
private string LinkRecipients { get; set; } = "";
private const string CopyText = "Kopier";
private const string CopyStyle = "btn btn-primary";
private const string SuccessText = "Kopieret";
private const string SuccessStyle = "btn btn-success";
private string _buttonText = CopyText;
private string _buttonStyle = CopyStyle;
private List<ExternalProductListView> AvailableProducts { get; set; } = new();
private WorkplaceDocumentDto WorkplaceDocumentDto { get; set; } = new();
private bool Working { get; set; } = true;
private bool FormInvalid { get; set; } = true;
protected override async Task OnInitializedAsync()
{
WorkplaceContext = new EditContext(Workplace);
WorkplaceContext.OnFieldChanged += HandleFieldChanged!;
WorkplaceContext.OnValidationStateChanged += ValidationChanged!;
FormContext = new EditContext(WorkplaceDocumentDto);
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
Workplace = await Workplaces.GetWorkplace(CompanyId, WorkplaceId);
Workplace = await WorkplaceRepo.GetWorkplace(CompanyId, WorkplaceId);
WorkplaceInventory = await WorkplaceRepo.GetWorkplaceInventory(CompanyId, WorkplaceId);
AvailableProducts = await PublicProductRepo.GetProducts();
Working = false;
}
private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
{
WorkplaceContext.Validate();
StateHasChanged();
}
private void ValidationChanged(object sender, ValidationStateChangedEventArgs e)
private void SubmitForm()
{
WorkplaceContext.OnFieldChanged -= HandleFieldChanged!;
WorkplaceContext.OnValidationStateChanged -= ValidationChanged!;
WorkplaceContext = new EditContext(Workplace);
WorkplaceContext.OnFieldChanged += HandleFieldChanged!;
WorkplaceContext.OnValidationStateChanged += ValidationChanged!;
}
public void Dispose()
{
WorkplaceContext.OnFieldChanged += HandleFieldChanged!;
WorkplaceContext.OnValidationStateChanged += ValidationChanged!;
Interceptor.DisposeEvent();
}
}

View file

@ -1,15 +1,15 @@
{
"appInfo": {
"name": "Wonky Online",
"version": "146.5",
"version": "147.0",
"rc": true,
"sandBox": true,
"sandBox": false,
"image": "grumpy-coder.png"
},
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Debug",
"Default": "Information",
"System": "Information",
"Microsoft": "Information"
},
"Debug": {
@ -19,7 +19,7 @@
}
},
"apiConfig": {
"baseUrl": "https://eta.innotec.dk",
"baseUrl": "https://zeta.innotec.dk",
"catalog": "api/v2/catalog/country",
"crmCustomers": "api/v2/crm/companies",
"crmInventoryExt": "history/inventory",

View file

@ -21,207 +21,106 @@ namespace Wonky.Entity.DTO;
public class ActivityDto
{
/// <summary>
/// Activity entity id
/// </summary>
public string SalesHeadId { get; set; } = "";
/// <summary>
/// Sales representative identification
/// </summary>
[Required]
[Required]
public string SalesRep { get; set; } = "";
/// <summary>
/// Sales representative entity Id
/// </summary>
[Required]
[Required]
public string SalesRepId { get; set; } = "";
/// <summary>
/// Company countryCode (ensure correct code when office create ordre)
/// </summary>
[Required]
public string CountryCode { get; set; } = "";
/// <summary>
/// Company entity Id
/// </summary>
[Required]
public string CompanyId { get; set; } = "";
/// <summary>
/// Business Central entity Id
/// </summary>
public string BcId { get; set; } = "";
/// <summary>
/// Customer account
/// </summary>
public string Account { get; set; } = "";
/// <summary>
/// VAT number
/// </summary>
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
public string VatNumber { get; set; } = "";
/// <summary>
/// Customer name
/// </summary>
[Required(ErrorMessage = "Navn skal udfyldes")]
[MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")]
public string Name { get; set; } = "";
/// <summary>
/// Customer address city name
/// </summary>
[Required(ErrorMessage = "Byanvn skal udfyldes")]
[MaxLength(30, ErrorMessage = "Du kan højst bruge 30 tegn")]
public string City { get; set; } = "";
/// <summary>
/// Customer address postal code
/// </summary>
[Required(ErrorMessage = "Postnr. skal udfyldes")]
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
public string ZipCode { get; set; } = "";
/// <summary>
/// Customer address line 1
/// </summary>
[MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")]
public string Address1 { get; set; } = "";
/// <summary>
/// Customer address line 2
/// </summary>
[MaxLength(50, ErrorMessage = "Du kan højst bruge 50 tegn")]
public string Address2 { get; set; } = "";
/// <summary>
/// Customer office phone
/// </summary>
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
public string Phone { get; set; } = "";
/// <summary>
/// Customer mobile phone
/// </summary>
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
public string Mobile { get; set; } = "";
/// <summary>
/// Customer office email
/// </summary>
[MaxLength(80, ErrorMessage = "Du kan højst bruge 80 tegn")]
public string Email { get; set; } = "";
/// <summary>
/// Customer attention description
/// </summary>
[MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")]
public string Attention { get; set; } = "";
/// <summary>
/// Flag express order
/// </summary>
public bool Express { get; set; }
// Form entries
/// <summary>
/// Activity status enum as string
/// </summary>
[Required(ErrorMessage = "Vælg status for besøg ")]
public string ActivityStatusEnum { get; set; } = "";
/// <summary>
/// Activity type enum as string
/// </summary>
[Required(ErrorMessage = "Vælg aktivitetstype")]
public string ActivityTypeEnum { get; set; } = "";
/// <summary>
/// Visit type enum as string
/// </summary>
public string ActivityVisitEnum { get; set; } = "recall";
/// <summary>
/// Activity date
/// </summary>
[Required(ErrorMessage = "Dato skal angives")]
public string ActivityDate { get; set; } = "";
/// <summary>
/// Product demonstration
/// </summary>
[MaxLength(50, ErrorMessage = "Du kan højst bruge 50 tegn")]
public string Demo { get; set; } = "";
/// <summary>
/// Our reference - system generated
/// </summary>
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
public string OurRef { get; set; } = "";
/// <summary>
/// Customer reference number
/// </summary>
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
public string ReferenceNumber { get; set; } = "";
/// <summary>
/// Customer reference description
/// </summary>
[MaxLength(35, ErrorMessage = "Du kan højst bruge 35 tegn")]
public string YourRef { get; set; } = "";
/// <summary>
/// Processing note to office
/// </summary>
[MaxLength(255, ErrorMessage = "Du kan højst bruge 255 tegn")]
public string OrderMessage { get; set; } = "";
/// <summary>
/// CRM note for future reference
/// </summary>
[MaxLength(255, ErrorMessage = "Du kan højst bruge 255 tegn")]
public string CrmNote { get; set; } = "";
// Delivery address form entries
/// <summary>
/// Customer delivery name
/// </summary>
[MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")]
public string DlvName { get; set; } = "";
/// <summary>
/// Customer delivery address line 1
/// </summary>
[MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")]
public string DlvAddress1 { get; set; } = "";
/// <summary>
/// Customer delivery address line 2
/// </summary>
[MaxLength(50, ErrorMessage = "Du kan højst bruge 50 tegn")]
public string DlvAddress2 { get; set; } = "";
/// <summary>
/// Customer delivery postal code
/// </summary>
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
public string DlvZipCode { get; set; } = "";
/// <summary>
/// Customer delivery city name
/// </summary>
[MaxLength(30, ErrorMessage = "Du kan højst bruge 30 tegn")]
public string DlvCity { get; set; } = "";
// Lines
/// <summary>
/// Order lines
/// </summary>
public string EanNumber { get; set; } = "";
public string Segment { get; set; } = "";
public List<ActivityLineDto> Lines { get; set; } = new();
}

View file

@ -21,180 +21,79 @@ namespace Wonky.Entity.DTO;
public class CompanyDto
{
/// <summary>
/// Account number
/// </summary>
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
public string Account { get; set; } = "";
/// <summary>
/// Office address 1
/// </summary>
[MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")]
public string Address1 { get; set; } = "";
/// <summary>
/// Office address 2
/// </summary>
[MaxLength(50, ErrorMessage = "Du kan højst bruge 50 tegn")]
public string Address2 { get; set; } = "";
/// <summary>
/// Attention
/// </summary>
[MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")]
public string Attention { get; set; } = "";
/// <summary>
/// Business Central entity Id
/// </summary>
public string BcId { get; set; } = "";
/// <summary>
/// ERP block state
/// </summary>
/// <remarks>Empty string - Customer not blocked</remarks>
[MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")]
public string Address1 { get; set; } = "";
[MaxLength(50, ErrorMessage = "Du kan højst bruge 50 tegn")]
public string Address2 { get; set; } = "";
[MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")]
public string Attention { get; set; } = "";
public string BcId { get; set; } = "";
public string Blocked { get; set; } = "";
/// <summary>
/// City name
/// </summary>
[Required(ErrorMessage = "Bynavn skal udfyldes")]
[MaxLength(30, ErrorMessage = "Du kan højst bruge 30 tegn")]
public string City { get; set; } = "";
/// <summary>
/// Company Id
/// </summary>
public string CompanyId { get; set; } = "";
/// <summary>
/// Country code ISO
/// </summary>
public string CountryCode { get; set; } = "";
/// <summary>
/// Crm note
/// </summary>
public string CrmNotes { get; set; } = "";
/// <summary>
/// Ean number
/// </summary>
public string CompanyId { get; set; } = "";
public string CountryCode { get; set; } = "";
public string CrmNotes { get; set; } = "";
public string EanNumber { get; set; } = "";
/// <summary>
/// Office email
/// </summary>
[MaxLength(80, ErrorMessage = "Du kan højst bruge 80 tegn")]
[MaxLength(80, ErrorMessage = "Du kan højst bruge 80 tegn")]
public string Email { get; set; } = "";
/// <summary>
/// Fax
/// </summary>
[MaxLength(30, ErrorMessage = "Du kan højst bruge 30 tegn")]
public string Fax { get; set; } = "";
/// <summary>
/// Value indication if company has shutdown
/// </summary>
/// <value>0 or 1</value>
public int HasFolded { get; set; }
/// <summary>
/// Date for last sync of product history
/// </summary>
public string HistorySync { get; set; } = "";
/// <summary>
/// Interval between visits
/// </summary>
/// <value>between 1 and 52 (inclusive) default value is 8</value>
[Range(1, 52, ErrorMessage = "Angiv interval mellem 1 og 52 uger")]
public int Interval { get; set; } = 8;
/// <summary>
/// User value for hiding the company is out of business
/// </summary>
/// <value>0 or 1</value>
public int IsHidden { get; set; }
/// <summary>
/// Last visit
/// </summary>
public string LastVisit { get; set; } = "2010-01-01";
/// <summary>
/// Mobile phone number
/// </summary>
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
public string Mobile { get; set; } = "";
/// <summary>
/// Name
/// </summary>
[Required(ErrorMessage = "Navn skal udfyldes")]
[MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")]
public string Name { get; set; } = "";
/// <summary>
/// Next visit
/// </summary>
public string NextVisit { get; set; } = "2010-01-01";
/// <summary>
/// Alert
/// </summary>
[MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")]
public string Note { get; set; } = "";
/// <summary>
/// Phone number
/// </summary>
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
public string Phone { get; set; } = "";
/// <summary>
/// SalesRep ERP identifier
/// </summary>
public string SalesRep { get; set; } = "";
/// <summary>
/// Sales representative entity Id
/// </summary>
public string SalesRepId { get; set; } = "";
/// <summary>
/// Customer Segment
/// </summary>
[Required(ErrorMessage = "Segment skal vælges - AUTO eller INDUSTRI")]
public string Segment { get; set; } = "";
/// <summary>
/// Value indicating the VAT number is valid
/// </summary>
/// <value>0 or 1</value>
public int ValidVat { get; set; }
/// <summary>
/// VAT number
/// </summary>
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
public string VatNumber { get; set; } = "";
/// <summary>
/// Postal code
/// </summary>
[Required(ErrorMessage = "Postnummer skal udfyldes")]
[MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")]
public string ZipCode { get; set; } = "";
/// <summary>
/// Virtual property indicating if timespan is within the defined interval
/// </summary>
/// <returns>true/false</returns>
public virtual bool ValidDateSpan()
{
var notAllowed = new List<string> {"2010-01-01", "1970-01-01", "0001-01-01"};
var notAllowed = new List<string> { "2010-01-01", "1970-01-01", "0001-01-01" };
if (notAllowed.Contains(LastVisit) || notAllowed.Contains(NextVisit))
return false;
return DateTime.Parse(LastVisit) < DateTime.Parse(NextVisit);

View file

@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations;
namespace Wonky.Entity.DTO;
public class UpdateDocHeaderDto
{
[Required][MaxLength(128)] public string ApprovedBy { get; set; } = "";
[Required][MaxLength(10)] public string ApprovedDate { get; set; } = "";
[Required][MaxLength(128)] public string AuthoredBy { get; set; } = "";
[Required][MaxLength(128)] public string DocumentId { get; set; } = "";
[Required][MaxLength(10)] public string FollowupDate { get; set; } = "";
}

View file

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

View file

@ -0,0 +1,32 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Wonky.Entity.DTO;
public class WorkplaceDocumentDto
{
[Required] public string EyeCleanerLocation { get; set; } = "";
[Required]public string FirstAidLocation { get; set; } = "";
[Required]public string GlovesStorage { get; set; } = "";
[Required]public string GogglesStorage { get; set; } = "";
[Required]public string MaskStorage { get; set; } = "";
[Required]public string ProductStorage { get; set; } = "";
[Required]public string WasteDeposit { get; set; } = "";
[Required]public string AuthoredBy { get; set; } = "";
[Required]public string ApprovedBy { get; set; } = "";
[Required]public string ApprovedDate { get; set; } = "";
[Required]public string FollowupDate { get; set; } = "";
public List<ProductVariant> ProductVariants { get; set; } = new();
}
public class ProductVariant
{
[Required] public string VariantId { get; set; } = "";
public string S5A { get; set; } = "";
public string S9A { get; set; } = "";
// Sweden
// yearly consumption and product exposure
// public string S11A { get; set; } = "";
}

View file

@ -9,16 +9,4 @@ public class ExternalProductListView
public string PictureLink { get; set; } = "";
public string ProductCategoryEnum { get; set; } = "";
public List<ExternalProductVariantView> Variants { get; set; } = new();
}
public class ExternalProductVariantView
{
public string VariantId { get; set; } = "";
public string Name { get; set; } = "";
public string Sku { get; set; } = "";
public string ErpName { get; set; } = "";
public string ErpSku { get; set; } = "";
public string ShortName { get; set; } = "";
public string PictureLink { get; set; } = "";
public bool Selected { get; set; }
}

View file

@ -0,0 +1,13 @@
namespace Wonky.Entity.Views;
public class ExternalProductVariantView
{
public string VariantId { get; set; } = "";
public string Name { get; set; } = "";
public string Sku { get; set; } = "";
public string ErpName { get; set; } = "";
public string ErpSku { get; set; } = "";
public string ShortName { get; set; } = "";
public string PictureLink { get; set; } = "";
public bool Selected { get; set; }
}