refactor component names and error page names
This commit is contained in:
parent
0e0484cdd2
commit
c28830f1b1
22 changed files with 250 additions and 149 deletions
|
@ -30,7 +30,7 @@
|
|||
<th class="text-center" scope="col"><i class="oi oi-phone"></i></th>
|
||||
<th class="text-center" scope="col"><i class="oi oi-flash"></i></th>
|
||||
<th class="text-center" scope="col"><i class="oi oi-calculator"></i></th>
|
||||
<th class="text-center" scope="col"><i class="bi bi-box"></i></th>
|
||||
<th class="text-center" scope="col"><i class="bi bi-truck"></i></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
|
@ -16,9 +16,7 @@
|
|||
*@
|
||||
|
||||
<i class="bi bi-@_icon @StateClass"></i>
|
||||
@* <svg class="bi bi-exclamation-triangle text-success" width="32" height="32" fill="currentColor" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> *@
|
||||
@* ... *@
|
||||
@* </svg> *@
|
||||
|
||||
@code{
|
||||
[Parameter] public string StateClass { get; set; } = "";
|
||||
private string _icon { get; set; } = "";
|
||||
|
@ -27,9 +25,9 @@
|
|||
{
|
||||
_icon = StateClass switch
|
||||
{
|
||||
"the-ugly-fg" => "square",
|
||||
"the-bad-fg" => "box2",
|
||||
"the-good-fg" => "box-seam-fill",
|
||||
"the-ugly-fg" => "file-earmark",
|
||||
"the-bad-fg" => "file-earmark-check",
|
||||
"the-good-fg" => "box2-fill",
|
||||
"the-draw-fg" => "truck",
|
||||
_ => "question-square"
|
||||
};
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
.the-good-fg {
|
||||
color: black;
|
||||
}
|
||||
.the-bad-fg {
|
||||
color: black;
|
||||
}
|
||||
.the-ugly-fg {
|
||||
color: black;
|
||||
}
|
||||
.the-draw-fg {
|
||||
color: black;
|
||||
}
|
|
@ -19,8 +19,9 @@
|
|||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<div class="d-print-none">
|
||||
<a class="btn btn-outline-light" href="logout"><i class="oi oi-lock-unlocked"></i> LOG AF</a>
|
||||
<a class="btn btn-outline-light" href="info">HJÆLP</a>
|
||||
<a class="btn btn-outline-light" href="logout" title="Log af" ><i class="bi-lock"></i></a>
|
||||
<a class="btn btn-outline-light" href="info" title="Information"><i class="bi-question"></i></a>
|
||||
<a class="btn btn-outline-light" href="preferences" title="Indstillinger"><i class="bi-sliders"></i></a>
|
||||
</div>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
|
@ -27,4 +27,5 @@ public interface ICrmActivityHttpRepository
|
|||
Task<ReportStatusView> GetActivities(string activityDate);
|
||||
Task<List<ReportItemView>> GetCustomerActivities(string customerId);
|
||||
Task UpdateOfficeNote(ActivityOfficeNote model);
|
||||
Task UpdateExpressStatus(string id);
|
||||
}
|
|
@ -43,7 +43,7 @@ public class CrmActivityHttpRepository : ICrmActivityHttpRepository
|
|||
private readonly NavigationManager _navigation;
|
||||
private ILogger<CrmActivityHttpRepository> _logger;
|
||||
private readonly HttpClient _client;
|
||||
private readonly ApiConfig _apiConfig;
|
||||
private readonly ApiConfig _api;
|
||||
|
||||
public CrmActivityHttpRepository(HttpClient client,
|
||||
ILogger<CrmActivityHttpRepository> logger,
|
||||
|
@ -52,19 +52,24 @@ public class CrmActivityHttpRepository : ICrmActivityHttpRepository
|
|||
_client = client;
|
||||
_logger = logger;
|
||||
_navigation = navigation;
|
||||
_apiConfig = configuration.Value;
|
||||
_api = configuration.Value;
|
||||
}
|
||||
|
||||
public async Task UpdateExpressStatus(string id)
|
||||
{
|
||||
await _client.PostAsync($"{_api.CrmSales}/express/{id}/?status=express", null);
|
||||
}
|
||||
|
||||
public async Task UpdateOfficeNote(ActivityOfficeNote model)
|
||||
{
|
||||
_logger.LogDebug("UpdateOfficeNote => model \n{}", JsonSerializer.Serialize(model) );
|
||||
_logger.LogDebug("UpdateOfficeNote => url \n{}", $"{_apiConfig.CrmSales}/activity/{model.ActivityId}" );
|
||||
await _client.PostAsJsonAsync($"{_apiConfig.CrmSales}/activity/{model.ActivityId}", model, _options);
|
||||
_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($"{_apiConfig.CrmSales}/date/{activityDate}");
|
||||
.GetAsync($"{_api.CrmSales}/date/{activityDate}");
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
return string.IsNullOrWhiteSpace(content)
|
||||
? new ReportStatusView()
|
||||
|
@ -73,7 +78,7 @@ public class CrmActivityHttpRepository : ICrmActivityHttpRepository
|
|||
|
||||
public async Task<List<ReportItemView>> GetCustomerActivities(string customerId)
|
||||
{
|
||||
var response = await _client.GetAsync($"{_apiConfig.CrmSales}/company/{customerId}");
|
||||
var response = await _client.GetAsync($"{_api.CrmSales}/company/{customerId}");
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
return JsonSerializer.Deserialize<List<ReportItemView>>(content, _options);
|
||||
|
||||
|
@ -81,29 +86,32 @@ public class CrmActivityHttpRepository : ICrmActivityHttpRepository
|
|||
|
||||
public async Task<ApiResponseView> CreateActivity(ActivityDto model)
|
||||
{
|
||||
var response = await _client.PostAsJsonAsync($"{_apiConfig.CrmSales}", model, _options);
|
||||
var response = await _client.PostAsJsonAsync($"{_api.CrmSales}", model, _options);
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
var result = JsonSerializer.Deserialize<ApiResponseView>(content);
|
||||
_logger.LogDebug("ActivityRepo => CreateActivity => ResponseContent <= {}", content);
|
||||
var result = JsonSerializer.Deserialize<ApiResponseView>(content, _options);
|
||||
var msg = JsonSerializer.SerializeToElement(result.Message);
|
||||
_logger.LogDebug("Message content <= {}", msg);
|
||||
return result!;
|
||||
}
|
||||
|
||||
public async Task<ReportItemView> GetReportItem(string id)
|
||||
{
|
||||
var salesItem = await _client
|
||||
.GetFromJsonAsync<ReportItemView>($"{_apiConfig.CrmSales}/{id}");
|
||||
.GetFromJsonAsync<ReportItemView>($"{_api.CrmSales}/{id}");
|
||||
return salesItem ?? new ReportItemView();
|
||||
}
|
||||
|
||||
public async Task<ActivityDto> GetActivity(string id)
|
||||
{
|
||||
var salesItem = await _client
|
||||
.GetFromJsonAsync<ActivityDto>($"{_apiConfig.CrmSales}/{id}");
|
||||
.GetFromJsonAsync<ActivityDto>($"{_api.CrmSales}/{id}");
|
||||
return salesItem ?? new ActivityDto();
|
||||
}
|
||||
|
||||
public async Task<ApiResponseView> AcceptOffer(string id)
|
||||
{
|
||||
var response = await _client.PostAsJsonAsync($"{_apiConfig.CrmSales}/{id}/accept", id);
|
||||
var response = await _client.PostAsJsonAsync($"{_api.CrmSales}/{id}/accept", id);
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
var result = JsonSerializer.Deserialize<ApiResponseView>(content);
|
||||
return result!;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
<div class="row bg-light border-1 border-dark rounded-3 p-3">
|
||||
<div class="col">
|
||||
<h3>@_draft.Name - @_draft.Account</h3>
|
||||
<h3>@_activity.Name - @_activity.Account</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -51,29 +51,29 @@ 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="@_draft.ActivityTypeEnum">
|
||||
<InputSelect id="activityType" class="form-select" @bind-Value="@_activity.ActivityTypeEnum">
|
||||
<option value="">→ TAG MIG ←</option>
|
||||
<option value="onSite">Besøg</option>
|
||||
<option value="phone">Telefon</option>
|
||||
</InputSelect>
|
||||
<ValidationMessage For="@(() => _draft.ActivityTypeEnum)"></ValidationMessage>
|
||||
<ValidationMessage For="@(() => _activity.ActivityTypeEnum)"></ValidationMessage>
|
||||
</div>
|
||||
|
||||
<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="@_draft.ActivityStatusEnum">
|
||||
<InputSelect id="statusType" class="form-select" @bind-Value="@_activity.ActivityStatusEnum">
|
||||
<option value="noSale" selected>Ingen salg</option>
|
||||
@if (!string.IsNullOrEmpty(_draft.VatNumber) && !string.IsNullOrWhiteSpace(_draft.Address1) && _company.HasFolded == 0)
|
||||
@if (!string.IsNullOrEmpty(_activity.VatNumber) && !string.IsNullOrWhiteSpace(_activity.Address1) && _company.HasFolded == 0)
|
||||
{
|
||||
<option value="order">Bestilling</option>
|
||||
<option value="quote">Tilbud</option>
|
||||
}
|
||||
</InputSelect>
|
||||
<ValidationMessage For="@(() => _draft.ActivityStatusEnum)"></ValidationMessage>
|
||||
@if (_draft.ActivityStatusEnum == "order")
|
||||
<ValidationMessage For="@(() => _activity.ActivityStatusEnum)"></ValidationMessage>
|
||||
@if (_activity.ActivityStatusEnum == "order")
|
||||
{
|
||||
<div class="form-check">
|
||||
<InputCheckbox id="express" class="form-check-input" @bind-Value="@_draft.Express"/>
|
||||
<InputCheckbox id="express" class="form-check-input" @bind-Value="@_activity.Express"/>
|
||||
<label class="form-check-label" for="express">Express</label>
|
||||
</div>
|
||||
}
|
||||
|
@ -83,63 +83,63 @@ else
|
|||
<div class="row mb-1">
|
||||
<label for="demo" class="col-md-2 col-form-label">Demo</label>
|
||||
<div class="col-md-4">
|
||||
<InputText id="demo" class="form-control" @bind-Value="_draft.Demo"/>
|
||||
<ValidationMessage For="@(() => _draft.Demo)"></ValidationMessage>
|
||||
<InputText id="demo" class="form-control" @bind-Value="_activity.Demo"/>
|
||||
<ValidationMessage For="@(() => _activity.Demo)"></ValidationMessage>
|
||||
</div>
|
||||
|
||||
<label for="email" class="col-md-2 col-form-label">Epost</label>
|
||||
<div class="col-md-4">
|
||||
<InputText id="email" class="form-control" @bind-Value="_draft.Email"/>
|
||||
<ValidationMessage For="@(() => _draft.Email)"></ValidationMessage>
|
||||
<InputText id="email" class="form-control" @bind-Value="_activity.Email"/>
|
||||
<ValidationMessage For="@(() => _activity.Email)"></ValidationMessage>
|
||||
</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="_draft.ReferenceNumber" />
|
||||
<ValidationMessage For="@(() => _draft.ReferenceNumber)"></ValidationMessage>
|
||||
<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="_draft.YourRef"/>
|
||||
<ValidationMessage For="@(() => _draft.YourRef)"></ValidationMessage>
|
||||
<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="_draft.OrderMessage"/>
|
||||
<ValidationMessage For="@(() => _draft.OrderMessage)"></ValidationMessage>
|
||||
<InputTextArea id="orderMessage" class="form-control" @bind-Value="_activity.OrderMessage"/>
|
||||
<ValidationMessage For="@(() => _activity.OrderMessage)"></ValidationMessage>
|
||||
</div>
|
||||
|
||||
<label for="crmNote" class="col-md-2 col-form-label">Note /Selv</label>
|
||||
<div class="col-md-4">
|
||||
<InputTextArea id="crmNote" class="form-control" @bind-Value="_draft.CrmNote"/>
|
||||
<ValidationMessage For="@(() => _draft.CrmNote)"></ValidationMessage>
|
||||
<InputTextArea id="crmNote" class="form-control" @bind-Value="_activity.CrmNote"/>
|
||||
<ValidationMessage For="@(() => _activity.CrmNote)"></ValidationMessage>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-1">
|
||||
<label for="attention" class="col-md-2 col-form-label">Att.</label>
|
||||
<div class="col-md-4">
|
||||
<InputText id="attention" class="form-control" @bind-Value="_draft.Attention"/>
|
||||
<ValidationMessage For="@(() => _draft.Attention)"></ValidationMessage>
|
||||
<InputText id="attention" class="form-control" @bind-Value="_activity.Attention"/>
|
||||
<ValidationMessage For="@(() => _activity.Attention)"></ValidationMessage>
|
||||
</div>
|
||||
|
||||
<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="_draft.Phone"/>
|
||||
<ValidationMessage For="@(() => _draft.Phone)"></ValidationMessage>
|
||||
<InputText id="phone" class="form-control" @bind-Value="_activity.Phone"/>
|
||||
<ValidationMessage For="@(() => _activity.Phone)"></ValidationMessage>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="accordion" id="crmActivity">
|
||||
@* Order lines *@
|
||||
<div class="accordion-item" style="@(_draft.ActivityStatusEnum is "order" or "quote" ? "display: block" : "display:none")">
|
||||
<div class="accordion-item" style="@(_activity.ActivityStatusEnum is "order" or "quote" ? "display: block" : "display:none")">
|
||||
<h2 class="accordion-header" id="catalogHeader">
|
||||
<button class="accordion-button collapsed bg-light" type="button"
|
||||
data-bs-toggle="collapse" data-bs-target="#catalogBody"
|
||||
|
@ -198,7 +198,7 @@ else
|
|||
<td class="align-middle text-black text-end fw-bold">@DraftStateProvider.Draft.Total</td>
|
||||
<td></td>
|
||||
<td class="align-middle text-end">
|
||||
<button class="btn btn-primary" type="button" @onclick="CallPriceListModal" >
|
||||
<button class="btn btn-primary" type="button" @onclick="CallPriceListModal">
|
||||
<i class="oi oi-plus"></i>
|
||||
</button>
|
||||
</td>
|
||||
|
@ -264,7 +264,7 @@ else
|
|||
</div>
|
||||
</div>
|
||||
@* Delivery address *@
|
||||
<div class="accordion-item" style="@(_draft.ActivityStatusEnum == "order" ? "display: block" : "display:none")">
|
||||
<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
|
||||
|
@ -276,31 +276,31 @@ else
|
|||
<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="_draft.DlvName"/>
|
||||
<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="_draft.DlvAddress1"/>
|
||||
<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="_draft.DlvAddress2"/>
|
||||
<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="_draft.DlvZipCode"/>
|
||||
<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="_draft.DlvCity"/>
|
||||
<InputText id="dlvCity" class="form-control" @bind-Value="_activity.DlvCity"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -308,12 +308,6 @@ else
|
|||
</div>
|
||||
</div>
|
||||
</EditForm>
|
||||
@if (HideButtons)
|
||||
{
|
||||
<LoaderThreeDots/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row mt-2 mb-2">
|
||||
<div class="col">
|
||||
<a class="btn btn-info" href="/companies">Til Oversigt</a>
|
||||
|
@ -325,5 +319,4 @@ else
|
|||
<button type="button" class="btn btn-primary" @onclick="CreateActivity" disabled="@_poFormInvalid">Opret besøg</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,29 +36,25 @@ public partial class CrmNewActivityPage : IDisposable
|
|||
[CascadingParameter] DraftStateProvider DraftStateProvider { get; set; }
|
||||
[Parameter] public string CompanyId { get; set; }
|
||||
// Services
|
||||
[Inject] public ILogger<CrmNewActivityPage> _logger { get; set; }
|
||||
[Inject] public HttpInterceptorService _interceptor { get; set; }
|
||||
[Inject] public UserPreferenceService _userPrefs { get; set; }
|
||||
[Inject] public IToastService _toast { get; set; }
|
||||
[Inject] public NavigationManager _navigator { get; set; }
|
||||
[Inject] public ILocalStorageService _storage { get; set; }
|
||||
[Inject] public ICatalogHttpRepository _itemRepo { get; set; }
|
||||
[Inject] public ICrmCompanyHttpRepository _companyRepo { get; set; }
|
||||
[Inject] public ILogger<CrmNewActivityPage> Logger { get; set; }
|
||||
[Inject] public HttpInterceptorService Interceptor { get; set; }
|
||||
[Inject] public UserPreferenceService PreferenceService { get; set; }
|
||||
[Inject] public IToastService Toast { get; set; }
|
||||
[Inject] public NavigationManager Navigator { get; set; }
|
||||
[Inject] public ILocalStorageService Storage { get; set; }
|
||||
[Inject] public ICatalogHttpRepository Catalog { get; set; }
|
||||
[Inject] public ICrmCompanyHttpRepository CompanyRepo { get; set; }
|
||||
[Inject] public ICrmActivityHttpRepository CrmActivityRepo { get; set; }
|
||||
[Inject] public ICrmReportHttpRepository CrmReportRepo { get; set; }
|
||||
// variables
|
||||
private readonly JsonSerializerOptions? _options = new JsonSerializerOptions{PropertyNameCaseInsensitive = true};
|
||||
private PriceListModal _priceListModal { get; set; }
|
||||
private ProductHistoryModal _historyModal { get; set; }
|
||||
private ProductPriceHistoryModal _priceHistoryModal { get; set; }
|
||||
private SalesItemView _selectedItem { get; set; } = new();
|
||||
private Preferences _prefs { get; set; } = new();
|
||||
private ActivityDto _draft { get; set; } = new();
|
||||
private ActivityDto _activity { get; set; } = new();
|
||||
private CompanyDto _company = new();
|
||||
private EditContext _editContext { get; set; }
|
||||
private bool _poFormInvalid { get; set; } = true;
|
||||
private bool ShowItem { get; set; }
|
||||
private bool HideButtons { get; set; }
|
||||
private string Quantity = "1";
|
||||
private string Price = "0";
|
||||
private string Discount = "0";
|
||||
|
@ -73,14 +69,17 @@ public partial class CrmNewActivityPage : IDisposable
|
|||
private DateTime _workDate { get; set; } = DateTime.Now;
|
||||
private string _selectedDate { get; set; } = "";
|
||||
private string _phone { get; set; } = "";
|
||||
// MODAL DIALOGS
|
||||
private PriceListModal _priceListModal { get; set; }
|
||||
private ProductHistoryModal _historyModal { get; set; }
|
||||
private ProductPriceHistoryModal _priceHistoryModal { get; set; }
|
||||
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
_interceptor.RegisterEvent();
|
||||
_interceptor.RegisterBeforeSendEvent();
|
||||
Interceptor.RegisterEvent();
|
||||
Interceptor.RegisterBeforeSendEvent();
|
||||
|
||||
_prefs = await _userPrefs.GetPreferences();
|
||||
_prefs = await PreferenceService.GetPreferences();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_prefs.WorkDate))
|
||||
_workDate = DateTime.Parse(_prefs.WorkDate);
|
||||
|
@ -91,16 +90,16 @@ public partial class CrmNewActivityPage : IDisposable
|
|||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_editContext = new EditContext(_draft);
|
||||
_editContext = new EditContext(_activity);
|
||||
_editContext.OnFieldChanged += HandleFieldChanged;
|
||||
_editContext.OnValidationStateChanged += ValidationChanged;
|
||||
|
||||
_draft.ActivityDate = $"{_workDate:yyyy-MM-dd}" ;
|
||||
_activity.ActivityDate = $"{_workDate:yyyy-MM-dd}" ;
|
||||
|
||||
_ux = await _storage.GetItemAsync<UserInfoView>("_xu");
|
||||
_ux = await Storage.GetItemAsync<UserInfoView>("_xu");
|
||||
|
||||
// get company
|
||||
_company = await _companyRepo.GetCompanyById(CompanyId);
|
||||
_company = await CompanyRepo.GetCompanyById(CompanyId);
|
||||
|
||||
// variable to validate if customer needs phone number update
|
||||
_phone = _company.Phone;
|
||||
|
@ -111,36 +110,36 @@ public partial class CrmNewActivityPage : IDisposable
|
|||
_company.Phone = _company.Account[..8];
|
||||
}
|
||||
|
||||
_draft.BcId = _company.BcId;
|
||||
_draft.ActivityStatusEnum = "noSale";
|
||||
_draft.VisitTypeEnum = _company.Account is "" or "NY" ? "new" : "recall";
|
||||
_activity.BcId = _company.BcId;
|
||||
_activity.ActivityStatusEnum = "noSale";
|
||||
_activity.VisitTypeEnum = _company.Account is "" or "NY" ? "new" : "recall";
|
||||
|
||||
if (_company.HasFolded == 1)
|
||||
_draft.OrderMessage = "Virksomheden er ophørt.";
|
||||
_activity.OrderMessage = "Virksomheden er ophørt.";
|
||||
|
||||
// permanent identifications
|
||||
_draft.CompanyId = _company.CompanyId;
|
||||
_draft.SalesRepId = _company.SalesRepId;
|
||||
_draft.SalesRep = _company.SalesRep;
|
||||
_draft.CountryCode = _company.CountryCode;
|
||||
_activity.CompanyId = _company.CompanyId;
|
||||
_activity.SalesRepId = _ux.Id;
|
||||
_activity.SalesRep = _ux.Advisor;
|
||||
_activity.CountryCode = _ux.CountryCode;
|
||||
|
||||
_draft.Account = _company.Account;
|
||||
_draft.VatNumber = _company.VatNumber;
|
||||
_draft.Email = _company.Email;
|
||||
_draft.Phone = _company.Phone;
|
||||
_draft.Mobile = _company.Mobile;
|
||||
_activity.Account = _company.Account;
|
||||
_activity.VatNumber = _company.VatNumber;
|
||||
_activity.Email = _company.Email;
|
||||
_activity.Phone = _company.Phone;
|
||||
_activity.Mobile = _company.Mobile;
|
||||
|
||||
_draft.Name = _company.Name;
|
||||
_draft.Address1 = _company.Address1;
|
||||
_draft.Address2 = _company.Address2;
|
||||
_draft.ZipCode = _company.ZipCode;
|
||||
_draft.City = _company.City;
|
||||
_activity.Name = _company.Name;
|
||||
_activity.Address1 = _company.Address1;
|
||||
_activity.Address2 = _company.Address2;
|
||||
_activity.ZipCode = _company.ZipCode;
|
||||
_activity.City = _company.City;
|
||||
|
||||
_draft.DlvName = _company.Name;
|
||||
_draft.DlvAddress1 = _company.Address1;
|
||||
_draft.DlvAddress2 = _company.Address2;
|
||||
_draft.DlvZipCode = _company.ZipCode;
|
||||
_draft.DlvCity = _company.City;
|
||||
_activity.DlvName = _company.Name;
|
||||
_activity.DlvAddress1 = _company.Address1;
|
||||
_activity.DlvAddress2 = _company.Address2;
|
||||
_activity.DlvZipCode = _company.ZipCode;
|
||||
_activity.DlvCity = _company.City;
|
||||
|
||||
}
|
||||
private void CallPriceListModal()
|
||||
|
@ -154,7 +153,7 @@ public partial class CrmNewActivityPage : IDisposable
|
|||
if (string.IsNullOrWhiteSpace(sku.ItemId))
|
||||
return;
|
||||
|
||||
_selectedItem = await _itemRepo.GetSalesItemId(sku.ItemId);
|
||||
_selectedItem = await Catalog.GetSalesItemId(sku.ItemId);
|
||||
ShowItem = true;
|
||||
Price = sku.Rate;
|
||||
Quantity = sku.Quantity;
|
||||
|
@ -181,46 +180,46 @@ public partial class CrmNewActivityPage : IDisposable
|
|||
{
|
||||
_selectedDate = workDate;
|
||||
_workDate = DateTime.Parse(_selectedDate);
|
||||
_draft.ActivityDate = _selectedDate;
|
||||
_activity.ActivityDate = _selectedDate;
|
||||
_reportClosdd = await CrmReportRepo.ReportExist(_selectedDate);
|
||||
}
|
||||
|
||||
private async Task CreateActivity()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_draft.Address1))
|
||||
_activity.CountryCode = "";
|
||||
if (string.IsNullOrWhiteSpace(_activity.Address1))
|
||||
{
|
||||
_toast.ShowError("Kunde adresse er ufuldstændig.");
|
||||
Toast.ShowError("Kunde adresse er ufuldstændig.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_draft.ActivityStatusEnum == "order")
|
||||
if (_activity.ActivityStatusEnum == "order")
|
||||
{
|
||||
if (DraftStateProvider.Draft.Items.Count == 0)
|
||||
{
|
||||
_toast.ShowError("Ved bestilling skal der angives et eller flere varenumre.");
|
||||
Toast.ShowError("Ved bestilling skal der angives et eller flere varenumre.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(_draft.Phone))
|
||||
if (string.IsNullOrWhiteSpace(_activity.Phone))
|
||||
{
|
||||
_toast.ShowError("Ved bestilling til ny kunde skal telefon nummer angives.");
|
||||
Toast.ShowError("Ved bestilling til ny kunde skal telefon nummer angives.");
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
HideButtons = true;
|
||||
_draft.ActivityDate = $"{_workDate:yyyy-MM-dd}";
|
||||
_draft.OurRef = _draft.ActivityTypeEnum switch
|
||||
_activity.ActivityDate = $"{_workDate:yyyy-MM-dd}";
|
||||
_activity.OurRef = _activity.ActivityTypeEnum switch
|
||||
{
|
||||
"phone" => $"T:{_ux.FullName.Split(" ")[0]}",
|
||||
"onSite" => $"B:{_ux.FullName.Split(" ")[0]}",
|
||||
_ => ""
|
||||
};
|
||||
if (_draft.Express)
|
||||
_draft.OurRef = $"E{_draft.OurRef}";
|
||||
if (_activity.Express)
|
||||
_activity.OurRef = $"E{_activity.OurRef}";
|
||||
|
||||
_draft.Lines = new List<ActivityLineDto>();
|
||||
_activity.Lines = new List<ActivityLineDto>();
|
||||
var ln = 0;
|
||||
if (DraftStateProvider.Draft.Items.Count != 0)
|
||||
{
|
||||
|
@ -238,26 +237,39 @@ public partial class CrmNewActivityPage : IDisposable
|
|||
Location = item.Item.Location
|
||||
})
|
||||
.ToList();
|
||||
_draft.Lines = lines;
|
||||
_activity.Lines = lines;
|
||||
}
|
||||
if (_phone != _draft.Phone)
|
||||
if (_phone != _activity.Phone)
|
||||
{
|
||||
_company.Phone = _draft.Phone;
|
||||
_company.Phone = _activity.Phone;
|
||||
// update company phone record
|
||||
await _companyRepo.UpdateCompany(_company.CompanyId, _company);
|
||||
await CompanyRepo.UpdateCompany(_company.CompanyId, _company);
|
||||
}
|
||||
|
||||
Logger.LogDebug("CrmNewActivityPage => \n {}", JsonSerializer.Serialize(_activity));
|
||||
|
||||
// post to api
|
||||
var result = await CrmActivityRepo.CreateActivity(_draft);
|
||||
var result = await CrmActivityRepo.CreateActivity(_activity);
|
||||
|
||||
Logger.LogDebug("ApiResponseView => \n {}", JsonSerializer.Serialize(result));
|
||||
|
||||
// show result message
|
||||
_toast.ShowSuccess($"{result.Message}.");
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
Toast.ShowSuccess($"{result.Message}", "RESULTAT");
|
||||
if(DraftStateProvider.Draft.Items.Any())
|
||||
Toast.ShowSuccess($"{result.Message}.", "BESTILLING OPRETTET");
|
||||
|
||||
await DraftStateProvider.DeleteDraftAsync();
|
||||
Navigator.NavigateTo($"/companies");
|
||||
}
|
||||
Toast.ShowError(result.Message, "ORDRE FEJL");
|
||||
_selectedItem = new SalesItemView();
|
||||
await DraftStateProvider.DeleteDraftAsync();
|
||||
_navigator.NavigateTo($"/companies");
|
||||
}
|
||||
|
||||
private void CheckActivity()
|
||||
{
|
||||
InvalidActivityType = string.IsNullOrWhiteSpace(_draft.ActivityTypeEnum);
|
||||
InvalidActivityType = string.IsNullOrWhiteSpace(_activity.ActivityTypeEnum);
|
||||
}
|
||||
|
||||
private async Task DeleteDraft()
|
||||
|
@ -301,8 +313,8 @@ public partial class CrmNewActivityPage : IDisposable
|
|||
InvalidActivity = InvalidActivityType
|
||||
|| _poFormInvalid
|
||||
|| DraftStateProvider.Draft.Items.Count == 0
|
||||
|| (_draft.ActivityStatusEnum == "offer" && string.IsNullOrWhiteSpace(_draft.Email));
|
||||
if (_draft.YourRef.Length > 35 || _draft.ReferenceNumber.Length > 20)
|
||||
|| (_activity.ActivityStatusEnum == "offer" && string.IsNullOrWhiteSpace(_activity.Email));
|
||||
if (_activity.YourRef.Length > 35 || _activity.ReferenceNumber.Length > 20)
|
||||
{
|
||||
_poFormInvalid = true;
|
||||
return;
|
||||
|
@ -319,9 +331,9 @@ public partial class CrmNewActivityPage : IDisposable
|
|||
}
|
||||
private void ValidationChanged(object sender, ValidationStateChangedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_draft.ActivityTypeEnum) && !_reportClosdd)
|
||||
if (string.IsNullOrEmpty(_activity.ActivityTypeEnum) && !_reportClosdd)
|
||||
{
|
||||
_toast.ShowWarning("Aktivitet type kan ikke være tom");
|
||||
Toast.ShowWarning("Aktivitet type kan ikke være tom");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -329,14 +341,14 @@ public partial class CrmNewActivityPage : IDisposable
|
|||
|
||||
_editContext.OnFieldChanged -= HandleFieldChanged;
|
||||
_editContext.OnValidationStateChanged -= ValidationChanged;
|
||||
_editContext = new EditContext(_draft);
|
||||
_editContext = new EditContext(_activity);
|
||||
_editContext.OnFieldChanged += HandleFieldChanged;
|
||||
_editContext.OnValidationStateChanged += ValidationChanged;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_interceptor.DisposeEvent();
|
||||
Interceptor.DisposeEvent();
|
||||
_editContext.OnFieldChanged -= HandleFieldChanged;
|
||||
_editContext.OnValidationStateChanged -= ValidationChanged;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
@using Microsoft.AspNetCore.Authorization
|
||||
@using System.Security.Claims
|
||||
|
||||
@attribute [Authorize(Roles = "Admin,Office,Warehouse,Advisor")]
|
||||
@page "/companies/{CompanyId}/orders/{OrderId}"
|
||||
|
||||
|
@ -20,11 +22,33 @@
|
|||
}
|
||||
@if (ReportItem.Express)
|
||||
{
|
||||
<h2 class="fw-bold text-center">HASTER</h2>
|
||||
<h2 class="fw-bold text-center"><i class="bi-lightning-charge text-dark" style="font-size: 3rem;"></i> HASTER</h2>
|
||||
}
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
@if (ReportItem.Express && ReportItem.ProcessStatusEnum.ToLower() == "none")
|
||||
{
|
||||
<div id="watermark">
|
||||
<i class="bi-lightning-charge text-dark" style="font-size: 11rem;"></i>
|
||||
</div>
|
||||
<AuthorizeView Roles="Admin,Office,Advisor,Warehouse">
|
||||
<Authorized>
|
||||
<tr class="d-print-none">
|
||||
<th colspan="3"></th>
|
||||
<th>
|
||||
<button type="button" class="btn btn-warning">PRINT</button>
|
||||
</th>
|
||||
</tr>
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div id="watermark">
|
||||
<i class="bi-check text-dark" style="font-size: 12rem;"></i>
|
||||
</div>
|
||||
}
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
|
@ -121,7 +145,10 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<div class="alert alert-dark">
|
||||
<h4 class="text-center">@ReportItem.OfficeNote</h4>
|
||||
</div>
|
||||
@if (!string.IsNullOrWhiteSpace(ReportItem.OfficeNote))
|
||||
{
|
||||
<div class="alert alert-dark">
|
||||
<h4 class="text-center">@ReportItem.OfficeNote</h4>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,11 @@ public partial class CrmViewActivityPage : IDisposable
|
|||
_logger.LogDebug("ReportItem => \n {}", JsonSerializer.Serialize(ReportItem));
|
||||
}
|
||||
|
||||
private async Task SetExpressState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
|
||||
{
|
||||
StateHasChanged();
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
#watermark {
|
||||
position: fixed;
|
||||
z-index: 999;
|
||||
top: 30px;
|
||||
right: 0;
|
||||
}
|
|
@ -17,7 +17,7 @@ using Microsoft.AspNetCore.Components;
|
|||
|
||||
namespace Wonky.Client.Pages;
|
||||
|
||||
public partial class Page404
|
||||
public partial class ErrorPage404
|
||||
{
|
||||
[Inject] public NavigationManager NavigationManager { get; set; }
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ using Microsoft.AspNetCore.Components;
|
|||
|
||||
namespace Wonky.Client.Pages
|
||||
{
|
||||
public partial class SiteErrorReport
|
||||
public partial class ErrorReportPage
|
||||
{
|
||||
[Parameter]
|
||||
public int ErrorCode { get; set; }
|
||||
|
|
|
@ -68,6 +68,7 @@ public partial class OfficeListCustomerPage : IDisposable
|
|||
_paging.HasFolded = _includeFolded ? 1 : 0;
|
||||
await GetCompanies();
|
||||
}
|
||||
|
||||
private async Task SelectedPage(int page)
|
||||
{
|
||||
_companyList = new List<CompanyDto>();
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
|
||||
@if (_items.Any())
|
||||
{
|
||||
@foreach (var item in _items)
|
||||
@foreach (var item in _items.Where(item => item.StatusTypeEnum.ToLower() != "offer" || item.ProcessStatusEnum.ToLower() == "none"))
|
||||
{
|
||||
<ReportItemComponent ReportItem="@item"></ReportItemComponent>
|
||||
}
|
||||
|
|
|
@ -1,5 +1,42 @@
|
|||
@page "/PreferencesPage"
|
||||
<h3>PreferencesPage</h3>
|
||||
@using Wonky.Client.Components
|
||||
@page "/preferences"
|
||||
<h3>Indstillinger</h3>
|
||||
|
||||
<div class="row mb-2">
|
||||
<label class="col-md-3 col-form-label">Side længde</label>
|
||||
<div class="col-md-3">
|
||||
<PageSizeComponent ></PageSizeComponent>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-2">
|
||||
<label class="col-md-3 col-form-label">Kunde søgning</label>
|
||||
<div class="col-md-3">
|
||||
<CompanySearchColumnComponent ></CompanySearchColumnComponent>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-2">
|
||||
<label class="col-md-3 col-form-label">Kunde sortering</label>
|
||||
<div class="col-md-3">
|
||||
<CompanySortComponent ></CompanySortComponent>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-2">
|
||||
<label class="col-md-3 col-form-label">Produkt søgning</label>
|
||||
<div class="col-md-3">
|
||||
<CatalogSearchComponent ></CatalogSearchComponent>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-2">
|
||||
<label class="col-md-3 col-form-label">Produkt sortering</label>
|
||||
<div class="col-md-3">
|
||||
<CatalogSortComponent ></CatalogSortComponent>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
|
|
|
@ -32,6 +32,6 @@
|
|||
<div class="content d-none d-print-block">
|
||||
@Body
|
||||
</div>
|
||||
<BlazoredToasts Position="ToastPosition.BottomCenter" Timeout="3"/>
|
||||
<BlazoredToasts Position="ToastPosition.BottomCenter" Timeout="10"/>
|
||||
</main>
|
||||
</div>
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
<div class="sticky-top bg-dark rounded-2 p-3">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<ItemSearchComponent OnChanged="SetSearchCol"/>
|
||||
<CatalogSearchComponent OnChanged="SetSearchCol"/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<ItemSearchPhraseComponent OnChanged="SetSearchPhrase"/>
|
||||
<CatalogSearchPhraseComponent OnChanged="SetSearchPhrase"/>
|
||||
</div>
|
||||
@* <div class="col"> *@
|
||||
@* <ItemSortComponent OnChanged="SetSortCol"/> *@
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"appInfo": {
|
||||
"name": "Wonky Client",
|
||||
"version": "0.22.1",
|
||||
"version": "0.23.1",
|
||||
"rc": true,
|
||||
"sandBox": true,
|
||||
"image": "grumpy-coder.png"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="bootstrap/css/bootstrap-icons.css" rel="stylesheet" />
|
||||
<link href="flag-icons/flag-icons.css" rel="stylesheet" />
|
||||
<link href="css/app-v0.12.0.css" rel="stylesheet" />
|
||||
<link href="css/app-v0.20.0.css" rel="stylesheet" />
|
||||
<link href="Wonky.Client.styles.css" rel="stylesheet" />
|
||||
<link href="_content/Blazored.Toast/blazored-toast.min.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
|
|
@ -22,7 +22,7 @@ public class ActivityDto
|
|||
/// <summary>
|
||||
/// Activity entity id
|
||||
/// </summary>
|
||||
public string ActivityId { get; set; } = "";
|
||||
public string SalesHeadId { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Sales representative identification
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Wonky.Entity.Views;
|
|||
public class ApiResponseView
|
||||
{
|
||||
public bool IsSuccess { get; set; }
|
||||
public HttpStatusCode Code { get; set; }
|
||||
public int Code { get; set; }
|
||||
public string Message { get; set; } = "";
|
||||
public string Id { get; set; } = "";
|
||||
}
|
Loading…
Reference in a new issue