build v.314

reorder activity header
add property salesRepName to activity header
code cleanup
This commit is contained in:
Frede Hundewadt 2023-12-01 10:16:41 +01:00
parent 03af77e0f0
commit fe8950579f
27 changed files with 229 additions and 236 deletions

View file

@ -27,18 +27,18 @@
<tr>
<th scope="row">Dato</th>
<td>@ReportItem.OrderDate</td>
<th scope="row">Konto</th>
<td>@ReportItem.Company.Account</td>
<th scope="row">Vores Ref</th>
<td>@ReportItem.OurRef</td>
</tr>
<tr>
<th scope="col">Telefon</th>
<td>@ReportItem.Company.Phone</td>
<th scope="row">Konto</th>
<td>@ReportItem.Company.Account</td>
<th scope="col">Køber</th>
<td>@ReportItem.YourRef</td>
</tr>
<tr>
<th scope="col">CVR/VAT</th>
<td>@ReportItem.Company.VatNumber</td>
<th scope="col">Telefon</th>
<td>@ReportItem.Company.Phone</td>
<th scope="col">Rekvisition</th>
<td>@ReportItem.ReferenceNumber</td>
</tr>
@ -68,11 +68,13 @@
</tr>
<tr>
<th scope="col">Email</th>
<td colspan="3">@ReportItem.Company.Email</td>
<td>@ReportItem.Company.Email</td>
<th scope="col">Sælger</th>
<td>@SalesRep</td>
</tr>
<tr>
<th scope="row">Vores Ref</th>
<td>@ReportItem.OurRef</td>
<th scope="col">CVR/VAT</th>
<td>@ReportItem.Company.VatNumber</td>
<th scope="row">Oprettet af</th>
<td>@ReportItem.CreatedBy</td>
</tr>
@ -80,10 +82,3 @@
<tfoot>
</tfoot>
</table>
@code {
[Parameter]
public ReportItemView ReportItem { get; set; } = new();
}

View file

@ -0,0 +1,10 @@
using Microsoft.AspNetCore.Components;
using Wonky.Entity.Views;
namespace Wonky.Client.Components;
public partial class ActivityHeaderComponent
{
[Parameter] public ReportItemView ReportItem { get; set; } = new();
[Parameter] public string SalesRep { get; set; } = "";
}

View file

@ -23,83 +23,89 @@
<div class="row mt-2 d-flex g-3">
@foreach (var company in CompanyList)
{
<div class="col-sm-6">
<div class="mx-3 card px-0 col-sm-12 col-lg-6 col-xxl-4" style="width:500px;">
@*
<div class="row g-0">
<div class="col-sm-12 col-md-6 col-lg-4 col-xl-3">
<div class="card">
@if (string.IsNullOrWhiteSpace(company.Blocked))
{
<div class="card-header fw-bold @(company.HasFolded == 1 ? "alert alert-dark" : "alert alert-success")">
@company.Name @(company.HasFolded == 1 ? "(OPHØRT)" : "")
</div>
}
else
{
<div class="card-header fw-bold alert alert-danger">
@company.Name (spærret med kode '@company.Blocked')
</div>
}
<div class="card-body">
<table class="table">
<tr>
<th scope="row">Konto</th>
<td>@company.Account</td>
<th scope="row">Org Nr.</th>
<td>@(string.IsNullOrWhiteSpace(company.VatNumber) ? "mangler" : company.VatNumber) </td>
</tr>
<tr>
<th scope="row">Telefon</th>
<td colspan="3">@company.Phone</td>
</tr>
<tr>
<th scope="row">Adresse</th>
<td colspan="3">@company.Address1 @(string.IsNullOrWhiteSpace(company.Address2) ? "" : ",") @company.Address2</td>
</tr>
<tr>
<th scope="row">Post By</th>
<td colspan="3">@company.CountryCode.ToUpper()-@company.ZipCode @company.City</td>
</tr>
<tr>
<th scope="row">
Sælgernr.
</th>
<td>
@company.SalesRep
</td>
</tr>
<tr>
<th scope="row">Sidst besøgt</th>
<td>
@(Mapper.MapVisitState(company.LastVisit) == "the-draw" ? "?" : company.LastVisit)
</td>
</tr>
<tr>
<th scope="row">Næste besøg</th>
<td>
@(Mapper.MapVisitState(company.LastVisit) == "the-draw" ? "?" : company.NextVisit)
</td>
</tr>
</table>
*@
@if (string.IsNullOrWhiteSpace(company.Blocked))
{
<div class="card-header fw-bold @(company.HasFolded == 1 ? "alert alert-dark" : "alert alert-success")">
@company.Name @(company.HasFolded == 1 ? "(OPHØRT)" : "")
</div>
<div class="card-footer">
<div class="row">
<div class="col">
<button class="btn btn-sm btn-danger" @onclick="@(() => ShowInvoiceList(company.CompanyId))">Faktura</button>
</div>
<div class="col">
<button class="btn btn-sm btn-warning" @onclick="@(() => ShowActivityList(company.CompanyId))">Aktiviteter</button>
</div>
<div class="col">
<button class="btn btn-sm btn-success" @onclick="@(() => ShowInventory(company.CompanyId))">Produkter</button>
</div>
<div class="col">
<a class="btn btn-sm btn-primary" href="/office/customers/@CountryCode/@company.CompanyId/order">Bestilling</a>
</div>
<div class="col">
<button class="btn btn-sm btn-secondary" @onclick="() => RequestBusinessCentralData(company.CompanyId, true)">BC <i class="bi-database-down"></i></button>
</div>
}
else
{
<div class="card-header fw-bold alert alert-danger">
@company.Name (spærret med kode '@company.Blocked')
</div>
}
<div class="card-body mx-0">
<table class="m-0 table table-sm table-striped table-light">
<tr>
<th scope="row" class="text-sm-start align-middle">Konto</th>
<td class="text-sm-start align-middle">@company.Account</td>
<th scope="row" class="text-sm-start align-middle">Org Nr.</th>
<td class="text-sm-start align-middle">@(string.IsNullOrWhiteSpace(company.VatNumber) ? "mangler" : company.VatNumber) </td>
</tr>
<tr>
<th scope="row" class="text-sm-start align-middle">Telefon</th>
<td colspan="3" class="text-sm-start align-middle">@company.Phone</td>
</tr>
<tr>
<th scope="row" class="text-sm-start align-middle">Adresse</th>
<td colspan="3" class="text-sm-start align-middle">@company.Address1 @(string.IsNullOrWhiteSpace(company.Address2) ? "" : ",") @company.Address2</td>
</tr>
<tr>
<th scope="row" class="text-sm-start align-middle">Post By</th>
<td colspan="3" class="text-sm-start align-middle">@company.CountryCode.ToUpper()-@company.ZipCode @company.City</td>
</tr>
<tr>
<th scope="row" class="text-sm-start align-middle">
Sælgernr.
</th>
<td colspan="3" class="text-sm-start align-middle">
@company.SalesRep
</td>
</tr>
<tr>
<th scope="row" class="text-sm-start align-middle">Sidst besøgt</th>
<td colspan="3" class="text-sm-start align-middle">
@(Mapper.MapVisitState(company.LastVisit) == "the-draw" ? "?" : company.LastVisit)
</td>
</tr>
<tr>
<th scope="row" class="text-sm-start align-middle">Næste besøg</th>
<td class="text-sm-start align-middle">
@(Mapper.MapVisitState(company.LastVisit) == "the-draw" ? "?" : company.NextVisit)
</td>
<td></td>
<td class="align-middle">
<button class="btn btn-sm btn-secondary w-100" @onclick="() => RequestBusinessCentralData(company.CompanyId, true)"><i class="bi-arrow-repeat"></i> BC</button>
</td>
</tr>
</table>
</div>
<div class="card-footer">
<div class="row">
<div class="px-1 col-sm-3">
<button class="btn btn-sm btn-danger w-100" @onclick="@(() => ShowInvoiceList(company.CompanyId))"> Salg</button>
</div>
<div class="px-1 col-sm-3">
<button class="btn btn-sm btn-warning w-100" @onclick="@(() => ShowActivityList(company.CompanyId))">Aktivitet</button>
</div>
<div class="px-1 col-sm-3">
<button class="btn btn-sm btn-success w-100" @onclick="@(() => ShowInventory(company.CompanyId))">Produkt</button>
</div>
<div class="px-1 col-sm-3">
<a class="btn btn-sm btn-primary w-100" href="/office/customers/@CountryCode/@company.CompanyId/order">Bestilling</a>
</div>
</div>
</div>
</div>
// </div>
}
</div>
<OfficeCustomerInvoiceListOverlay Company="@SelectedCompany" InvoiceList="@InvoiceList" @ref="@InvoiceListOverlay"/>

View file

@ -73,13 +73,13 @@
</tbody>
<tfoot>
<tr>
<td colspan="5"></td>
<td colspan="6"></td>
<td class="text-end">@(Activities.Sum(x => x.SasAmount))</td>
<td class="text-end">@(Activities.Sum(x => x.OrderAmount))</td>
<td colspan="4"></td>
</tr>
<tr>
<td colspan="6" class="text-end">TOTAL</td>
<td colspan="7" class="text-end">TOTAL</td>
<td class="text-end">@(Activities.Sum(x => x.SasAmount) + Activities.Sum(x => x.OrderAmount))</td>
<td colspan="4"></td>
</tr>

View file

@ -19,7 +19,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Components;
public partial class ActivityListComponent
public partial class ReportActivityListComponent
{
[Inject] public NavigationManager Navigator { get; set; }
[Parameter] public List<ReportItemView> Activities { get; set; } = new();

View file

@ -15,8 +15,9 @@
@using Wonky.Client.Helpers
<span>ReportActivityListShowDocumentCallbackComponent.razor</span>
@*
called via supervisor -> advisor -> activity button
*@
@if (Activities.Any())
{
<table class="table table-sm table-bordered table-striped">

View file

@ -19,7 +19,7 @@ using Microsoft.AspNetCore.Components;
namespace Wonky.Client.Components;
public partial class ReportDescriptionComponent
public partial class ReportLedgerDescriptionComponent
{
[Parameter] public ReportDataView ReportDataView { get; set; } = new();

View file

@ -27,7 +27,7 @@
<th class="text-center" colspan="4" scope="col">Måneds Resultat</th>
</tr>
<tr class="border-bottom">
<td>SALG</td>
<th scope="col">AKTIVITET</th>
<th class="text-end" scope="col">Besøg</th>
<th class="text-end" scope="col">Demo</th>
<th class="text-end" scope="col">Salg</th>
@ -65,62 +65,62 @@
</tr>
@* PHONE row *@
<tr>
<th scope="row">TELEFON</th>
<td class="bg-light"></td>
<td class="bg-light"></td>
<th scope="row">TLF</th>
<td></td>
<td></td>
<td class="text-end">@ReportData.PhoneCount</td>
<td class="text-end border-end">@ReportData.PhoneTurnover</td>
<td class="bg-light"></td>
<td class="bg-light"></td>
<td></td>
<td></td>
<td class="text-end">@ReportData.PhoneCountMonth</td>
<td class="text-end">@ReportData.PhoneTurnoverMonth</td>
</tr>
@* WEB row *@
<tr>
<th scope="row">WEB</th>
<td class="bg-light"></td>
<td class="bg-light"></td>
<td></td>
<td></td>
<td class="text-end">@ReportData.WebCount</td>
<td class="text-end border-end">@ReportData.WebTurnover</td>
<td class="bg-light"></td>
<td class="bg-light"></td>
<td></td>
<td></td>
<td class="text-end">@ReportData.WebCountMonth</td>
<td class="text-end">@ReportData.WebTurnoverMonth</td>
</tr>
@* SUMMARY row *@
<tr>
<th scope="row">NORMAL SALG</th>
<td class=""></td>
<td class="bg-light"></td>
<td class="bg-light"></td>
<th scope="row">SALG</th>
<td class="text-end">@ReportData.TotalVisitCount</td>
<td class="text-end">@ReportData.TotalDemoCount</td>
<td class="text-end">@ReportData.TotalSaleCount</td>
<td class="text-end fw-bold border-end">@(ReportData.NormalTurnover)</td>
<td class="bg-light"></td>
<td class="bg-light"></td>
<td class="bg-light"></td>
<td class="text-end">@ReportData.TotalVisitCountMonth</td>
<td class="text-end">@ReportData.TotalDemoCountMonth</td>
<td class="text-end">@ReportData.TotalSaleCountMonth</td>
<td class="text-end fw-bold">@(ReportData.NormalTurnoverMonth)</td>
</tr>
@* SAS row *@
<tr>
<th scope="row">SAS</th>
<td class="bg-light"></td>
<td class="bg-light"></td>
<td></td>
<td></td>
<td class="text-end">@ReportData.SasCount</td>
<td class="text-end fw-bold border-end">@ReportData.SasTurnover</td>
<td class="bg-light"></td>
<td class="bg-light"></td>
<td></td>
<td></td>
<td class="text-end">@ReportData.SasCountMonth</td>
<td class="text-end fw-bold">@ReportData.SasTurnoverMonth</td>
</tr>
@* TOTAL summarry row *@
<tr>
<th scope="row">TOTAL SALG</th>
<td class="text-end">@ReportData.TotalVisitCount</td>
<td class="text-end">@ReportData.TotalDemoCount</td>
<td class="text-end">@ReportData.TotalSaleCount</td>
<th>SUM</th>
<td></td>
<td></td>
<td></td>
<td class="text-end border-end">@ReportData.TotalTurnover</td>
<td class="text-end">@ReportData.TotalVisitCountMonth</td>
<td class="text-end">@ReportData.TotalDemoCountMonth</td>
<td class="text-end">@ReportData.TotalSaleCountMonth</td>
<td></td>
<td></td>
<td></td>
<td class="text-end">@ReportData.TotalTurnoverMonth</td>
</tr>
</tbody>

View file

@ -124,7 +124,7 @@ public class CountryPriceCatalogRepository : ICountryPriceCatalogRepository
public async Task<ProductDetailView> GetProductDetailView(string salesItemId)
{
var detailView = await _client
.GetFromJsonAsync<ProductDetailView>($"{_api.CountryPriceCatalog}/{salesItemId}");
.GetFromJsonAsync<ProductDetailView>($"{_api.CountryPriceCatalog}/item/{salesItemId}");
return detailView ?? new ProductDetailView();
}

View file

@ -124,7 +124,7 @@ public class CountryProductCatalogRepository : ICountryProductCatalogRepository
public async Task<ProductDetailView> GetProductDetailView(string salesItemId)
{
var detailView = await _client
.GetFromJsonAsync<ProductDetailView>($"{_api.CountryProductCatalog}/{salesItemId}");
.GetFromJsonAsync<ProductDetailView>($"{_api.CountryProductCatalog}/item/{salesItemId}");
return detailView ?? new ProductDetailView();
}

View file

@ -19,7 +19,7 @@
<div class="modal-dialog modal-dialog-scrollable modal-fullscreen">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title">Salgsfaktura @(Invoice.DocumentNumber.Split("-")[1])</h2>
<h2 class="modal-title">Info fra @(Invoice.DocumentNumber.Split("-")[1])</h2>
<button type="button" class="btn btn-danger" @onclick="@Hide" data-bs-dismiss="modal" aria-label="Luk"><i class="bi-x-lg"></i></button>
</div>
<div class="modal-body">
@ -79,7 +79,6 @@
<th class="text-end" scope="col">Pris</th>
<th class="text-end" scope="col">Rabat</th>
<th class="text-end" scope="col">Beløb</th>
<th class="text-center" scope="col">SAS</th>
</tr>
</thead>
<tbody>
@ -92,32 +91,12 @@
<td class="text-end">@line.Price</td>
<td class="text-end">@line.Discount</td>
<td class="text-end">@line.LineAmount</td>
<td class="text-center"><i class="bi- @(line.Sas ? "bi-check-square" : "bi-square")"></i></td>
</tr>
}
</tbody>
<tfoot>
@*
<tr>
<td colspan="3" class="text-end">Salg</td>
<td class="text-end">@NormalAmount</td>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="3" class="text-end">Heraf SAS</td>
<td></td>
<td class="text-end">@SasAmount</td>
<td></td>
</tr>
<tr>
<td colspan="3" class="text-end">Rabat</td>
<td></td>
<td class="text-end">@DiscountAmount</td>
<td></td>
</tr>
*@
<tr>
<td colspan="5" class="text-end">Faktura beløb</td>
<td colspan="5" class="text-end">Beløb</td>
<td class="text-end">@Invoice.InvoiceAmount</td>
<td colspan="1"></td>
</tr>

View file

@ -39,7 +39,7 @@
</div>
@if (ReportStatusView.ReportItems.Any())
{
<ActivityListComponent Activities="ReportStatusView.ReportItems" ViewAs="advisor"/>
<ReportActivityListComponent Activities="ReportStatusView.ReportItems" ViewAs="advisor"/>
}
@if (Working)
{

View file

@ -185,13 +185,13 @@
@if (_activities.Any())
{
<div class="row">
<ActivityListComponent Activities="_activities" ViewAs="advisor"/>
<ReportActivityListComponent Activities="_activities" ViewAs="advisor"/>
</div>
}
}
<div class="row">
@* ledger summaries calculated *@
<ReportLedgerActivityComponent ReportData="Report.Figures"/>
<ReportLedgerSummaryComponent ReportData="Report.Figures"/>
</div>
</EditForm>

View file

@ -45,14 +45,14 @@
</div>
<div class="row">
<div class="w-75">
<ReportDescriptionComponent ReportDataView="Report.ReportData"/>
<ReportLedgerDescriptionComponent ReportDataView="Report.ReportData"/>
</div>
<div class="w-25">
<ReportLedgerDistanceComponent ReportDataView="Report.ReportData"/>
</div>
</div>
<ActivityListComponent Activities="Report.ReportItems" ViewAs="advisor"/>
<ReportLedgerActivityComponent ReportData="Report.ReportData"/>
<ReportActivityListComponent Activities="Report.ReportItems" ViewAs="advisor"/>
<ReportLedgerSummaryComponent ReportData="Report.ReportData"/>
}
else
{

View file

@ -23,10 +23,11 @@
<div class="card col-md-4">
<div class="card-body">
<h5 class="card-title">
@_businessInfo.Name
Firmainfo
</h5>
<p class="card-text">
<i class="bi-card-heading"></i> @_businessInfo.Account<br/>
<i class="bi-card-heading"></i> @_businessInfo.Name<br/>
<i class="bi-card-text"></i> @_businessInfo.Account<br/>
<i class="bi-phone"></i> @_businessInfo.Phone<br/>
<i class="bi-at"></i> @_businessInfo.Email<br/>
</p>
@ -38,18 +39,19 @@
Leveringsadresse
</h5>
<p class="card-text">
@_businessInfo.Address1<br/>
@_businessInfo.Address2<br/>
@_businessInfo.ZipCode @_businessInfo.City<br/>
<i class="bi-card-heading"></i> @_businessInfo.Address1<br/>
<i class="bi-card-text"></i> @_businessInfo.Address2<br/>
<i class="bi-pin-map"></i> @_businessInfo.ZipCode @_businessInfo.City<br/>
</p>
</div>
</div>
<div class="card col-md-4">
<div class="card-body">
<h5 class="card-title">
@_advisorInfo.Name
Innotec Konsulent
</h5>
<p class="card-text">
<i class="bi-card-heading"></i> @_advisorInfo.Name<br/>
<i class="bi-phone"></i> @_advisorInfo.Phone<br/>
<i class="bi-at"></i> @_advisorInfo.Email<br/>
</p>
@ -73,17 +75,17 @@
@foreach (var line in DraftProvider.Draft.Items)
{
<tr>
<td>@line.Item.Sku</td>
<td>@line.Item.Name</td>
<td>@line.Quantity</td>
<td class="align-middle">@line.Item.Sku</td>
<td class="align-middle">@line.Item.Name</td>
<td class="align-middle">@line.Quantity</td>
<td><button class="btn btn-danger" @onclick="() => RemoveItem(line.Item.Sku)" >Slet</button></td>
</tr>
}
<tr>
<td></td>
<td class="align-middle text-end"><span class="px-3 pt-2 badge rounded-pill bg-info text-bg-info">kladde udløber efter @(DraftProvider.Draft.TimeToLiveInSeconds/60)m</span></td>
<td></td>
<td></td>
<td><button class="btn btn-primary">Send bestilling</button></td>
<td class="text-end"><a class="btn btn-primary" href="/b2b/@CountryCode/@CompanyId/order/new" >Vis Bestilling</a></td>
</tr>
</tbody>
</table>

View file

@ -34,11 +34,11 @@ public partial class BusinessCustomerLandingPage : IDisposable
private List<ProductInventoryItemView> _productInventory = new();
private ApiConfig _config = new();
private B2BProductPriceHistoryOverlay PriceHistoryOverlay { get; set; }
private string _price = "0";
private string _quantity = "1";
// private string _price = "0";
// private string _quantity = "1";
private string _productName = "";
private ItemSelect _selectedItem = new();
private string _sku = "";
// private string _sku = "";
private B2BGetOrderQuantityOverlay GetQuantity { get; set; }
@ -78,7 +78,7 @@ public partial class BusinessCustomerLandingPage : IDisposable
{
ItemNo = sku,
Quantity = $"{_productHistory[0].Quantity}",
Rate = $"{_productHistory[0].Price}",
Rate = "0",
};
GetQuantity.Show();
}

View file

@ -1 +1,18 @@
@* Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
*@
@attribute [Authorize(Roles = "EShop")]
@page "/b2b/{countryCode}/{companyId}/order/new"
@using Microsoft.AspNetCore.Authorization

View file

@ -44,6 +44,7 @@ public partial class BusinessOrderViewPage
private DateTime SelectedDate { get; set; }
private bool Working { get; set; } = true;
protected override async Task OnInitializedAsync()
{
Interceptor.RegisterEvent();
@ -52,40 +53,15 @@ public partial class BusinessOrderViewPage
// get info for logged in user
UserInfo = await UserInfoService.GetUserInfo();
SelectedDate = DateTime.Now;
var today = $"{SelectedDate:yyyy-MM-dd}";
Activity.ActivityDate = today;
Activity.ActivityVisitEnum = "web";
Activity.ActivityTypeEnum = "phone";
Activity.ActivityStatusEnum = "order";
Activity.Express = true;
Activity.OurRef = $"TLF:{UserInfo.FirstName}";
// setup edit context
// ActivityContext = new EditContext(Activity);
// ActivityContext.OnFieldChanged += HandleFieldChanged;
// ActivityContext.OnValidationStateChanged += ValidationChanged;
// // fetch customer
// Company = await CustomerRepo.GetByCustomerId(CountryCode, CompanyId);
// Logger.LogDebug("OfficeOrderCreate => Customer => {}", JsonSerializer.Serialize(Company));
// construct today's workdate
// Initialize date variable
SelectedDate = DateTime.Now;
var today = $"{SelectedDate:yyyy-MM-dd}";
Activity.ActivityDate = today;
// initiate a sync to ensure up-to-date product history
// if (Company.HistorySync != today)
// {
// Company.HistorySync = await HistoryRepo.RequestErpToCrmSync(CompanyId, Company.HistorySync, false);
// Logger.LogDebug("OfficeOrderCreate => RequestErpToCrmSync <= {}", Company.HistorySync);
// }
// fetch invoices
// CompanyInvoices = await HistoryRepo.GetInvoiceList(CountryCode, CompanyId);
// Logger.LogDebug("OfficeOrderCreate => Invoices => {}", JsonSerializer.Serialize(CompanyInvoices));
// fetch activities
// CompanyActivities = await CountryActivityRepo.GetActivityList(CompanyId);
// Logger.LogDebug("OfficeOrderCreate => Activities => {}", JsonSerializer.Serialize(CompanyActivities));
// fetch inventory
// CompanyInventory = await HistoryRepo.GetInventory(CountryCode, CompanyId);
// CompanyInventory = CompanyInventory.OrderBy(x => x.Description).ToList();
// Logger.LogDebug("OfficeOrderCreate => Inventory => {}", JsonSerializer.Serialize(CompanyInventory));
Activity.OurRef = $"WEB:{UserInfo.FirstName}";
// get sales rep info
// SalesRep = await UserRepo.GetUserInfo(Company.SalesRepId);
// Logger.LogDebug("OfficeOrderCreate => SalesRep => {}", JsonSerializer.Serialize(SalesRep));

View file

@ -48,15 +48,15 @@
</div>
<div class="row">
<div class="w-75">
<ReportDescriptionComponent ReportDataView="Report.ReportData"/>
<ReportLedgerDescriptionComponent ReportDataView="Report.ReportData"/>
</div>
<div class="w-25">
<ReportLedgerDistanceComponent ReportDataView="Report.ReportData"/>
</div>
</div>
@* <ReportActivityListOfficeComponent Activities="Report.ReportItems"/> *@
<ActivityListComponent Activities="Report.ReportItems" ViewAs="office" />
<ReportLedgerActivityComponent ReportData="Report.ReportData"/>
<ReportActivityListComponent Activities="Report.ReportItems" ViewAs="office" />
<ReportLedgerSummaryComponent ReportData="Report.ReportData"/>
}
else
{

View file

@ -47,7 +47,7 @@
</div>
</div>
<ActivityHeaderComponent ReportItem="ReportItem"/>
<ActivityHeaderComponent ReportItem="ReportItem" SalesRep="@($"{_salesRep.FirstName} {_salesRep.LastName}")"/>
<ActivityLinesComponent ReportItem="ReportItem"/>
@if (!string.IsNullOrWhiteSpace(ReportItem.OfficeNote))

View file

@ -40,7 +40,7 @@ public partial class OfficeOrderViewPage : IDisposable
[Inject] public ILocalStorageService Storage { get; set; }
[Inject] public ICountryUserInfoRepository UserRepo { get; set; }
[Inject] public ILogger<OfficeOrderViewPage> Logger { get; set; }
[Inject] public IToastService Toast { get; set; }
[Inject] public IToastService Toaster { get; set; }
[Inject] public IUserInfoService UserInfoService { get; set; }
[Inject] public IJSRuntime JsRuntime { get; set; }
[Inject] public IOrderProcessRepository ProcessRepo { get; set; }
@ -55,6 +55,9 @@ public partial class OfficeOrderViewPage : IDisposable
private bool IsNotified { get; set; }
private bool Working { get; set; } = true;
private IJSObjectReference JsModule { get; set; }
private UserInfoAdvisorView _salesRep = new();
private UserManagerEditView _user = new();
private readonly JsonSerializerOptions _options = new JsonSerializerOptions
@ -66,9 +69,13 @@ public partial class OfficeOrderViewPage : IDisposable
{
Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent();
// fetch order from backend
ReportItem = await AdvisorActivityRepo.GetReportItem(OrderId);
Logger.LogDebug("ReportItem => \n {}", JsonSerializer.Serialize(ReportItem, _options));
_user = await UserInfoService.GetUserInfo();
_salesRep = await UserRepo.GetUserInfo(ReportItem.SalesRepId);
Working = false;
}
@ -87,32 +94,33 @@ public partial class OfficeOrderViewPage : IDisposable
if (Working)
return;
Working = true;
// send request to backend
var responseView = await AdvisorActivityRepo.GetExpressState(ReportItem.ActivityId);
// get user info from storage
var user = await UserInfoService.GetUserInfo();
// fetch sales rep from response
var salesRep = await UserRepo.GetUserInfo(responseView.Id);
// create email notification body
if (!responseView.IsSuccess)
{
Toaster.ShowError("Noget gik galt med forbindelsen. Ordrestatus er ikke ændret og kvittering kan ikke sendes");
Working = false;
return;
}
var body = new StringBuilder();
body.AppendLine($"Kvittering for modtagelse af hasteordre {ReportItem.ESalesNumber}");
body.AppendLine($"Konto : {ReportItem.Company.Account}");
body.AppendLine($"Navn : {ReportItem.Company.Name}");
body.AppendLine($"Post By : {salesRep.CountryCode.ToUpper()}-{ReportItem.Company.ZipCode} {ReportItem.Company.City}");
body.AppendLine($"Post By : {_salesRep.CountryCode.ToUpper()}-{ReportItem.Company.ZipCode} {ReportItem.Company.City}");
body.AppendLine();
body.AppendLine("Med venlig hilsen");
body.AppendLine($"{user.FirstName} {user.LastName}");
body.AppendLine($"{user.PhoneNumber}");
// create a list of mail addresses
body.AppendLine($"{_user.FirstName} {_user.LastName}");
body.AppendLine($"{_user.PhoneNumber}");
var sendTo = new List<EmailContact>
{
new()
{
Email = salesRep.Email,
Name = $"{salesRep.FirstName} {salesRep.LastName}"
Email = _salesRep.Email,
Name = $"{_salesRep.FirstName} {_salesRep.LastName}"
}
};
// create an email
var msg = new EmailMessage
{
Body = body.ToString(),
@ -120,20 +128,18 @@ public partial class OfficeOrderViewPage : IDisposable
To = sendTo,
IsBodyHtml = false
};
Logger.LogDebug("SetExpressState Notification => \n {}", JsonSerializer.Serialize(msg));
// send a system generated email
var sendMail = await MailService.SendMail("System", msg);
// result notification
if (sendMail.IsSuccess)
{
Toast.ShowSuccess($"Status er opdateret og notifikation sendt til {salesRep.FirstName}.");
Toaster.ShowSuccess($"Status er opdateret og notifikation sendt til {_salesRep.FirstName}.");
}
else
{
Toast.ShowWarning($"Notifikation til {salesRep.FirstName} kunne ikke sendes. {sendMail.Message}");
Toaster.ShowWarning($"Notifikation til {_salesRep.FirstName} kunne ikke sendes. {sendMail.Message}");
}
// disable further notifications
IsNotified = true;
Working = false;
}

View file

@ -39,13 +39,13 @@
</div>
<div class="row">
<div class="w-75">
<ReportDescriptionComponent ReportDataView="Report.ReportData"/>
<ReportLedgerDescriptionComponent ReportDataView="Report.ReportData"/>
</div>
<div class="w-25">
<ReportLedgerDistanceComponent ReportDataView="Report.ReportData"/>
</div>
</div>
@* <ReportActivityListOfficeComponent Activities="Report.ReportItems"/> *@
<ActivityListComponent Activities="Report.ReportItems" />
<ReportLedgerActivityComponent ReportData="Report.ReportData"/>
<ReportActivityListComponent Activities="Report.ReportItems" />
<ReportLedgerSummaryComponent ReportData="Report.ReportData"/>
</div>

View file

@ -42,14 +42,14 @@
</div>
<div class="row">
<div class="w-75">
<ReportDescriptionComponent ReportDataView="Report.ReportData"/>
<ReportLedgerDescriptionComponent ReportDataView="Report.ReportData"/>
</div>
<div class="w-25">
<ReportLedgerDistanceComponent ReportDataView="Report.ReportData"/>
</div>
</div>
<ReportActivityListShowDocumentCallbackComponent Activities="Report.ReportItems" OnShowDocument="ShowDocument"/>
<ReportLedgerActivityComponent ReportData="Report.ReportData"/>
<ReportLedgerSummaryComponent ReportData="Report.ReportData"/>
}
else
{

View file

@ -1,7 +1,7 @@
{
"appInfo": {
"name": "Wonky Online",
"version": "310.0",
"version": "313.0",
"rc": false,
"sandBox": true,
"image": "grumpy-coder.png",

View file

@ -10,8 +10,8 @@
html, body {
height: 290mm;
width: 210mm;
-webkit-print-color-adjust: exact;
color-adjust: exact;
/*-webkit-print-color-adjust: exact;*/
/*color-adjust: exact;*/
}
.report-main {
/*page-break-before: always;*/
@ -26,8 +26,8 @@
font-size: 11px;
margin: auto;
width: initial;
-webkit-print-color-adjust: exact;
color-adjust: exact;
/*-webkit-print-color-adjust: exact;*/
/*color-adjust: exact;*/
}
.report-visit {
/*page-break-before: always;*/
@ -43,8 +43,8 @@
min-height: 250mm;
margin: 0;
width: initial;
-webkit-print-color-adjust: exact;
color-adjust: exact;
/*-webkit-print-color-adjust: exact;*/
/*color-adjust: exact;*/
}
.report-visit td {
font-size: 11px;

View file

@ -42,6 +42,7 @@ public class ReportItemView
public string ReferenceNumber { get; set; } = "";
public string Sales { get; set; } = "";
public string SalesRepId { get; set; } = "";
public string SalesRep { get; set; } = "";
public decimal SasAmount { get; set; }
public string StatusTypeEnum { get; set; } = "";
public string VisitTypeEnum { get; set; } = "";