This commit is contained in:
Frede Hundewadt 2022-07-08 10:41:27 +02:00
parent d964ba2598
commit 16fa047942
13 changed files with 73 additions and 177 deletions

View file

@ -83,10 +83,10 @@ namespace Wonky.Client.HttpInterceptors
if (e.Response == null || e.Response.IsSuccessStatusCode)
return;
string message = "An error happened";
var message = "En ukendt fejl er opstået";
var currDoc = _navigation.ToBaseRelativePath(_navigation.Uri);
if (currDoc.Contains("login"))
currDoc = "/";
if (currDoc.Contains("login/"))
currDoc = "";
switch (e.Response.StatusCode)
{
@ -95,16 +95,24 @@ namespace Wonky.Client.HttpInterceptors
_toast.ShowInfo(message);
break;
case HttpStatusCode.BadRequest:
// message = "Der er et problem med data ...";
// _toast.ShowWarning(message);
break;
case HttpStatusCode.Unauthorized:
ClearInfo();
_navigation.NavigateTo($"/login/{currDoc}");
message = "Login info skal fornyes ...";
_toast.ShowInfo(message);
message = "Login skal fornyes ...";
_toast.ShowWarning(message);
break;
case HttpStatusCode.InternalServerError:
message = "Der er interne problemer på serveren ...";
_toast.ShowError(message);
break;
default:
_toast.ShowError(message);
break;
}
throw new HttpResponseException(message);
// throw new HttpResponseException(message);
}
private async void ClearInfo()

View file

@ -48,6 +48,7 @@
</InputSelect>
<ValidationMessage For="@(() => _draft.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">
@ -61,50 +62,63 @@
<ValidationMessage For="@(() => _draft.ActivityStatusEnum)"></ValidationMessage>
</div>
</div>
<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>
</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>
</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>
</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>
</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>
</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>
</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>
</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>
</div>
</div>
</div>
<div class="accordion" id="crmActivity">
@* Order lines *@

View file

@ -72,6 +72,7 @@ public partial class ActivityNewVisitPage : IDisposable
private UserInfoView _ux { get; set; } = new();
private DateTime _workDate { get; set; } = DateTime.Now;
private string _selectedDate { get; set; } = "";
private string _phone { get; set; } = "";
protected override async Task OnParametersSetAsync()
{
@ -107,6 +108,15 @@ public partial class ActivityNewVisitPage : IDisposable
_ux = await _storage.GetItemAsync<UserInfoView>("_xu");
_company = await _companyRepo.GetCompanyById(CompanyId);
// variable to validate if customer needs update
_phone = _company.Phone;
if (string.IsNullOrWhiteSpace(_company.Phone)
&& !string.IsNullOrWhiteSpace(_company.Account)
&& _company.Account != "NY")
{
_company.Phone = _company.Account[..8];
}
// set up identification
_draft.CompanyId = _company.CompanyId;
_draft.BcId = _company.BcId;
@ -152,15 +162,27 @@ public partial class ActivityNewVisitPage : IDisposable
return;
}
if (_draft.ActivityStatusEnum == "order" && DraftStateProvider.Draft.Items.Count == 0)
{
_toast.ShowError("Ved bestilling skal der angives et eller flere varenumre.");
return;
}
if (_draft.ActivityStatusEnum == "order" && string.IsNullOrWhiteSpace(_draft.Phone))
{
_toast.ShowError("Ved nye bestillinger skal en kundes telefon nummer angives.");
return;
}
HideButtons = true;
_draft.ActivityDate = _prefs.WorkDate;
var activityType = _draft.ActivityTypeEnum switch
_draft.OurRef = _draft.ActivityTypeEnum switch
{
"phone" => "T:",
"onSite" => "B:",
"phone" => $"T:{_ux.FullName.Split(" ")[0]}",
"onSite" => $"B:{_ux.FullName.Split(" ")[0]}",
_ => ""
};
_draft.OurRef = $"{activityType}{_ux.FullName.Split(" ")[0]}";
var ln = 0;
var lines = DraftStateProvider.Draft.Items.Select(item => new ActivityLineDto
{
@ -176,6 +198,12 @@ public partial class ActivityNewVisitPage : IDisposable
})
.ToList();
_draft.Lines = lines;
if (_phone != _draft.Phone)
{
_company.Phone = _draft.Phone;
await _companyRepo.UpdateCompany(_company.CompanyId, _company);
_toast.ShowInfo("Kunde telefon nummer er opdateret.");
}
var result = await _activityRepo.CreateActivity(_draft);
_toast.ShowSuccess($"{result.Message}.");
await DraftStateProvider.DeleteDraftAsync();

View file

@ -21,7 +21,7 @@ using Wonky.Entity.Views;
namespace Wonky.Client.Pages;
public partial class AdminVewSalesReportPage : IDisposable
public partial class AdminViewSalesReportPage : IDisposable
{
/// <summary>
/// Country code from url parameter

View file

@ -64,6 +64,8 @@
{
@foreach (var item in _items)
{
<ReportItemComponent ReportItem="@item"></ReportItemComponent>
<div class="report-page">
<ReportItemComponent ReportItem="@item"></ReportItemComponent>
</div>
}
}

View file

@ -26,9 +26,6 @@
<div class="top-row px-4 d-print-none">
<TopbarNavigation/>
</div>
<div class="nav-icon-only d-print-none">
<NavIconOnly />
</div>
<div class="content px-4 d-print-none">
@Body
</div>

View file

@ -8,10 +8,6 @@ main {
flex: 1;
}
.nav-icon-only {
background-image: linear-gradient(180deg, rgb(22, 21, 23) 10%, #ffaa00 100%);
}
.sidebar {
background-image: linear-gradient(180deg, rgb(22, 21, 23) 10%, #ffaa00 100%);
}
@ -58,31 +54,12 @@ main {
}
}
@media (max-width: 1024px){
.nav-icon-only {
display: block;
}
.sidebar {
display: none;
}
.top-row {
display: none;
}
}
@media (min-width: 1025px) {
.page {
flex-direction: row;
}
.nav-icon-only {
display: none;
}
.sidebar {
display: block;
width: 200px;
height: 100vh;
position: sticky;
@ -90,7 +67,6 @@ main {
}
.top-row {
display: block;
position: sticky;
top: 0;
z-index: 1;

View file

@ -1,96 +0,0 @@
@*
// 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]
//
*@
@inject IWebAssemblyHostEnvironment HostEnvironment
@using Wonky.Client.Components;
<div class="nav-icon-only">
<nav class="flex-column">
<AuthorizeView>
<NotAuthorized>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/" Match="NavLinkMatch.All">
<span class="oi oi-dashboard"></span>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/login">
<span class="oi oi-lock-locked"></span>
</NavLink>
</div>
</NotAuthorized>
</AuthorizeView>
<AuthorizeView Roles="Admin">
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/admin/users/advisers">
<span class="oi oi-people" aria-hidden="true"></span>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/admin/users/office">
<span class="oi oi-people" aria-hidden="true"></span>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/price-catalog">
<span class="oi oi-spreadsheet" aria-hidden="true"></span>
</NavLink>
</div>
</AuthorizeView>
<AuthorizeView Roles="Adviser">
<Authorized>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/home">
<span class="oi oi-calendar" aria-hidden="true"></span>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/companies">
<span class="oi oi-file" aria-hidden="true"></span>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/price-catalog">
<span class="oi oi-spreadsheet" aria-hidden="true"></span>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/activity-today">
<span class="oi oi-dashboard" aria-hidden="true"></span>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/sales-reports">
<span class="oi oi-document" aria-hidden="true"></span>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/info">
<span class="oi oi-question-mark" aria-hidden="true"></span>
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link ps-2" href="/logout">
<span class="oi oi-lock-unlocked"></span>
</NavLink>
</div>
</Authorized>
</AuthorizeView>
</nav>
</div>

View file

@ -1,38 +0,0 @@
.oi {
width: 2rem;
font-size: 1.1rem;
vertical-align: text-top;
top: -2px;
}
.nav-item {
font-size: 0.9rem;
padding-bottom: 0.5rem;
}
.nav-item:first-of-type {
padding-top: 1rem;
}
.nav-item:last-of-type {
padding-bottom: 1rem;
}
.nav-item ::deep a {
color: #d7d7d7;
border-radius: 4px;
height: 3rem;
display: flex;
align-items: center;
line-height: 3rem;
}
.nav-item ::deep a.active {
background-color: rgba(255,255,255,0.25);
color: white;
}
.nav-item ::deep a:hover {
background-color: rgba(255,255,255,0.1);
color: white;
}

View file

@ -1,13 +1,13 @@
{
"appInfo": {
"name": "Wonky Client",
"version": "0.8.136",
"version": "0.8.144",
"isBeta": false,
"sandBox": false,
"image": "grumpy-coder.png"
},
"apiConfig": {
"innoBaseUrl": "https://production.innotec.dk",
"innoBaseUrl": "https://staging.innotec.dk",
"glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=",
"glsId": "",
"virkUrl": "api/v2/services/virk",

View file

@ -138,10 +138,12 @@ footer.version {
https://developer.mozilla.org/en-US/docs/Web/CSS/break-before
firefox still needs this
*/
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
break-after: page;
break-before: page;
break-inside: avoid;
}
@ -163,10 +165,13 @@ footer.version {
}
.report-page {
/* deprecated style properties */
page-break-before: always;
page-break-after: always;
page-break-inside: avoid;
/* new style properties */
break-after: page;
break-before: page;
break-inside: avoid;
height: initial;

View file

@ -13,7 +13,7 @@
<meta name="theme-color" content="#000">
<base href="/" />
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="css/app-136.css" rel="stylesheet" />
<link href="css/app-144.css" rel="stylesheet" />
<link href="Wonky.Client.styles.css" rel="stylesheet" />
<link href="_content/Blazored.Toast/blazored-toast.min.css" rel="stylesheet" />
</head>