wip - creating crm activity

This commit is contained in:
Frede Hundewadt 2022-04-11 11:19:05 +02:00
parent 5cc95de069
commit 93f1600cb8
11 changed files with 424 additions and 354 deletions

View file

@ -1,8 +0,0 @@
namespace Wonky.Client;
public class AppId
{
public string Version { get; set; } = "0.2.15";
public string Name { get; set; } = "wwo";
public bool IsBeta { get; set; } = true;
}

View file

@ -12,4 +12,10 @@
// You should have received a copy of the Affero GNU General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//*@
<span class="version">@app.Name</span> <span class="version">@app.Version</span>@if(app.IsBeta){<span class="version">-beta</span>}
<span class="version">@Name</span> <span class="version">@Version</span>@if(IsBeta){<span class="version">-beta</span>}
@code
{
private const string Version = "0.2.18";
private const string Name = "wwo";
private const bool IsBeta = true;
}

View file

@ -1,6 +0,0 @@
namespace Wonky.Client.Components;
public partial class AppVersion
{
private AppId app { get; set; } = new();
}

View file

@ -24,27 +24,29 @@ namespace Wonky.Client.Models
public int ActivityId { get; set; }
public string CrmCompanyKey { get; set; } = "";
[Required(ErrorMessage = "Sælger skal udfyldes")] public string SalesRep { get; set; } = "";
// From company row
[Required(ErrorMessage = "Konto skal udfyldes")] public string Account { get; set; } = "";
[Required(ErrorMessage = "CVR / ORG nummer skal udfyldes")] public string VatNumber { get; set; } = "";
[Required(ErrorMessage = "Navn skal udfyldes")] public string Name { get; set; } = "";
public string Address { get; set; } = "";
public string Address2 { get; set; } = "";
[Required(ErrorMessage = "Bynavn skal udfyldes")] public string City { get; set; }= "";
[Required(ErrorMessage = "Postnummer skal udfyldes")] public string ZipCode { get; set; } = "";
public string OurRef { get; set; } = ""; // sales rep
public string Address { get; set; } = "";
public string Address2 { get; set; } = "";
public string Phone { get; set; } = "";
public string EMail { get; set; } = "";
// Form entries
public string Demo { get; set; } = "";
public string VatNumber { get; set; } = "";
public string ReferenceNumber { get; set; } = "";
[Required(ErrorMessage = "Indkøber skal udfyldes")] public string YourRef { get; set; } = "";
public string OurRef { get; set; } = "";
public string YourRef { get; set; } = "";
[MaxLength(255, ErrorMessage = "Du kan højst bruge 255 tegn")] public string OrderMessage { get; set; } = "";
// From company or form entry
public string CrmNote { get; set; } = "";
// form entry
public string DlvName { get; set; } = "";
public string DlvAddress1 { get; set; } = "";
public string DlvAddress2 { get; set; } = "";
public string DlvZipCode { get; set; } = "";
public string DlvCity { get; set; } = "";
// Lines
public List<CrmSalesLines> Lines { get; set; } = new();
}
}

View file

@ -129,5 +129,5 @@
}
else
{
@* <AppSpinner/> *@
<AppSpinner/>
}

View file

@ -22,63 +22,70 @@
@using Wonky.Entity.Models
@attribute [Authorize(Roles = "Adviser")]
<div class="card">
<div class="card-header">
<div class="h2"><img src="gravestone.png" class="img-fluid" style="float:left;width:48px;height:48px;display:@(_hasFolded ? "block" : "none")" alt="tombstone" /> @_company.Name</div>
</div>
<div class="card-body">
<table class="table table-sm table-striped table-bordered">
<tbody>
<tr>
<th scope="row">Konto</th>
<td colspan="2">@_company.Account</td>
</tr>
<tr>
<th scope="row">Conavn</th>
<td colspan="2">@_company.Address1</td>
</tr>
<tr>
<th scope="row">Adresse</th>
<td colspan="2">@_company.Address2</td>
</tr>
<tr>
<th scope="row">Postnummer</th>
<td colspan="2">@_company.ZipCode</td>
</tr>
<tr>
<th scope="row">Bynavn</th>
<td colspan="2">@_company.City</td>
</tr>
<tr>
<th scope="row">CVR</th>
<td class="state"><DisplayStateComponent StateClass="@_vatState"></DisplayStateComponent></td>
<td>@_company.VatNumber</td>
</tr>
<tr>
<th scope="row">Telefon</th>
<td colspan="2">@_company.Phone</td>
</tr>
<tr>
<th scope="row">Email</th>
<td colspan="2">@_company.Email</td>
</tr>
<tr>
<th scope="row">Sidste besøg</th>
<td colspan="2">@_company.LastVisit</td>
</tr>
<tr>
<th scope="row">Næste besøg</th>
<td class="state"><DisplayStateComponent StateClass="@(_hasFolded ? "the-dead" : Utils.GetVisitState(_company.NextVisit))"></DisplayStateComponent></td>
<td>@_company.NextVisit</td>
</tr>
</tbody>
</table>
</div>
<div class="card-footer">
<div class="d-flex align-items-end">
<a class="btn btn-primary mx-2" href="/companies">Tilbage</a>
<a class="btn btn-primary mx-2" href="/company/@_company.CompanyId/update">Rediger</a>
<a class="btn btn-primary mx-2" href="/company/@_company.CompanyId/Activity">Aktivitet</a>
@if (_company != null)
{
<div class="card">
<div class="card-header">
<div class="h2"><img src="gravestone.png" class="img-fluid" style="float:left;width:48px;height:48px;display:@(_hasFolded ? "block" : "none")" alt="tombstone"/> @_company.Name</div>
</div>
<div class="card-body">
<table class="table table-sm table-striped table-bordered">
<tbody>
<tr>
<th scope="row">Konto</th>
<td colspan="2">@_company.Account</td>
</tr>
<tr>
<th scope="row">Conavn</th>
<td colspan="2">@_company.Address1</td>
</tr>
<tr>
<th scope="row">Adresse</th>
<td colspan="2">@_company.Address2</td>
</tr>
<tr>
<th scope="row">Postnummer</th>
<td colspan="2">@_company.ZipCode</td>
</tr>
<tr>
<th scope="row">Bynavn</th>
<td colspan="2">@_company.City</td>
</tr>
<tr>
<th scope="row">CVR</th>
<td class="state"><DisplayStateComponent StateClass="@_vatState"></DisplayStateComponent></td>
<td>@_company.VatNumber</td>
</tr>
<tr>
<th scope="row">Telefon</th>
<td colspan="2">@_company.Phone</td>
</tr>
<tr>
<th scope="row">Email</th>
<td colspan="2">@_company.Email</td>
</tr>
<tr>
<th scope="row">Sidste besøg</th>
<td colspan="2">@_company.LastVisit</td>
</tr>
<tr>
<th scope="row">Næste besøg</th>
<td class="state"><DisplayStateComponent StateClass="@(_hasFolded ? "the-dead" : Utils.GetVisitState(_company.NextVisit))"></DisplayStateComponent></td>
<td>@_company.NextVisit</td>
</tr>
</tbody>
</table>
</div>
<div class="card-footer">
<div class="d-flex align-items-end">
<a class="btn btn-primary mx-2" href="/companies">Tilbage</a>
<a class="btn btn-primary mx-2" href="/company/@_company.CompanyId/update">Rediger</a>
<a class="btn btn-primary mx-2" href="/company/@_company.CompanyId/Activity">Aktivitet</a>
</div>
</div>
</div>
</div>
}
else
{
<AppSpinner/>
}

View file

@ -0,0 +1,333 @@
@*
// 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 Affero GNU 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
// Affero GNU General Public License for more details.
//
// You should have received a copy of the Affero GNU General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
*@
@page "/company/{companyId}/activity"
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Adviser")]
@using Wonky.Client.Components
@if (_company != null)
{
<h2>@_purchaseOrder.Name</h2>
<EditForm EditContext="_editContext" OnValidSubmit="CreateActivity" class="card card-body bg-light mt-5">
<DataAnnotationsValidator/>
<div class="accordion" id="crmActivity">
@* Section for activity header *@
<div class="accordion-item">
<h2 class="accordion-header" id="activityHeader">
<button class="accordion-button" type="button"
data-bs-toggle="collapse" data-bs-target="#activityBody"
aria-expanded="true" aria-controls="activityBody">
Aktivitet
</button>
</h2>
<div id="activityBody" class="accordion-collapse collapse show"
aria-labelledby="activityHeader" data-bs-parent="#crmActivity">
<div class="accordion-body">
<div class="row mb-1">
<label for="account" class="col-md-2 col-form-label">Konto</label>
<div class="col-md-4">
<InputText id="account" class="form-control" @bind-Value="_purchaseOrder.Account" readonly/>
<ValidationMessage For="@(() => _purchaseOrder.Account)"></ValidationMessage>
</div>
<label for="salesRep" class="col-md-2 col-form-label">Sælger</label>
<div class="col-md-4">
<InputText id="salesRep" class="form-control" @bind-Value="_purchaseOrder.SalesRep" readonly/>
<ValidationMessage For="@(() => _purchaseOrder.SalesRep)"></ValidationMessage>
</div>
</div>
<div class="row mb-1">
<label for="demo" class="col-md-2 col-form-label">Demo</label>
<div class="col-md-10">
<InputText id="demo" class="form-control" @bind-Value="_purchaseOrder.Demo"/>
</div>
</div>
<div class="row mb-1">
<label for="vatNumber" class="col-md-2 col-form-label">CVR nummer</label>
<div class="col-md-10">
<InputText id="vatNumber" class="form-control" @bind-Value="_purchaseOrder.VatNumber"/>
<ValidationMessage For="@(() => _purchaseOrder.VatNumber)"></ValidationMessage>
</div>
</div>
<div class="row mb-1">
<label for="referenceNumber" class="col-md-2 col-form-label">Rekvisition</label>
<div class="col-md-10">
<InputText id="referenceNumber" class="form-control" @bind-Value="_purchaseOrder.ReferenceNumber"v/>
<ValidationMessage For="@(() => _purchaseOrder.ReferenceNumber)"></ValidationMessage>
</div>
</div>
<div class="row mb-1">
<label for="yourRef" class="col-md-2 col-form-label">Indkøber</label>
<div class="col-md-10">
<InputText id="yourRef" class="form-control" @bind-Value="_purchaseOrder.YourRef"/>
<ValidationMessage For="@(() => _purchaseOrder.YourRef)"></ValidationMessage>
</div>
</div>
<div class="row mb-1">
<label for="orderMessage" class="col-md-2 col-form-label">Besked til kontoret</label>
<div class="col-md-10">
<InputText id="orderMessage" class="form-control" @bind-Value="_purchaseOrder.OrderMessage"/>
<ValidationMessage For="@(() => _purchaseOrder.OrderMessage)"></ValidationMessage>
</div>
</div>
<div class="row mb-1">
<label for="crmNote" class="col-md-2 col-form-label">CRM note</label>
<div class="col-md-10">
<InputText id="crmNote" class="form-control" @bind-Value="_purchaseOrder.CrmNote"/>
</div>
</div>
</div>
</div>
</div>
@* Section for delivery address *@
<div class="accordion-item">
<h2 class="accordion-header" id="deliveryHeader">
<button class="accordion-button collapsed" type="button"
data-bs-toggle="collapse" data-bs-target="#deliveryBody"
aria-expanded="false" aria-controls="deliveryBody">
Leveringsadresse
</button>
</h2>
<div id="deliveryBody" class="accordion-collapse collapse"
aria-labelledby="deliveryHeader" data-bs-parent="#crmActivity">
<div class="accordion-body">
<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="_purchaseOrder.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="_purchaseOrder.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="_purchaseOrder.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="_purchaseOrder.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="_purchaseOrder.DlvCity"/>
</div>
</div>
</div>
</div>
</div>
@* Catalog selection for draft *@
<div class="accordion-item">
<h2 class="accordion-header" id="catalogHeader">
<button class="accordion-button collapsed" type="button"
data-bs-toggle="collapse" data-bs-target="#catalogBody"
aria-expanded="false" aria-controls="catalogBody">
Produkt katalog
</button>
</h2>
<div id="catalogBody" class="accordion-collapse collapse"
aria-labelledby="catalogHeader" data-bs-parent="#crmActivity">
<div class="accordion-body">
@* ---------------------------------------------- *@
@* collapse product selection and draft line *@
@* ---------------------------------------------- *@
@* display product filter options *@
<div class="row mb-3">
<div class="col">
<ItemGroupDropdown OnChanged="SetItemGroup"/>
</div>
<div class="col">
<ItemSearchDropdown OnChanged="SetSearchCol"/>
</div>
<div class="col">
<SearchPhrase OnChanged="SetSortCol"/>
</div>
<div class="col">
</div>
</div>
@* ---------------------------------------------- *@
@* display catalog *@
@if (SalesItems.Any())
{
<table class="table table-hover table-striped justify-content-center">
<thead>
<tr>
<th scope="col" style="width: 50%;">Navn</th>
<th scope="col" style="width: 30%;" class="text-nowrap">Varenr</th>
<th scope="col" style="width: 20%">Stk / Pris</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@foreach (var item in SalesItems)
{
<tr>
<td>@item.Name</td>
<td>@item.Sku</td>
<td>
<ul class="list-group">
@foreach (var rate in item.Rates)
{
<li class="list-group-item d-flex justify-content-between align-items-end">
<div class="text-sm-start px-2">@rate.Quantity</div>
<div class="text-sm-end">@rate.Rate</div>
</li>
}
</ul>
</td>
<td>
<button class="btn btn-primary" @onclick="@(() => SelectItem(item.ItemId))">Vælg</button>
</td>
</tr>
}
</tbody>
</table>
}
else
{
<AppSpinner/>
}
@* ---------------------------------------------- *@
@* Display draft line *@
@if (_selectedItem != null && ShowItem)
{
<div class="card mb-3 mt-3">
<div class="card-header bg-info fw-bold text-white">Kladdelinje</div>
<div class="card-body">
<div class="row">
<div class="col col-md-4 fw-bold">
Varenavn
</div>
<div class="col fw-bold">
Varenr
</div>
<div class="col fw-bold">
Antal
</div>
<div class="col fw-bold">
Pris
</div>
<div class="col">
</div>
</div>
<div class="row">
<div class="col col-md-4">
@_selectedItem.Name
</div>
<div class="col">
@_selectedItem.Sku
</div>
<div class="col">
<input class="form-control" type="number" @bind-value="@Quantity"/>
</div>
<div class="col">
<input class="form-control" type="number" @bind-value="@Price"/>
</div>
<div class="col">
<button class="btn btn-info" @onclick="@(() => AddItem(_selectedItem))">Læg til</button>
</div>
</div>
</div>
</div>
}
</div>
</div>
</div>
@* Draft lines *@
<div class="accordion-item">
<h2 class="accordion-header" id="draftHeader">
<button class="accordion-button collapsed" type="button"
data-bs-toggle="collapse" data-bs-target="#draftBody"
aria-expanded="false" aria-controls="draftBody">
Kladdelinjer <span class="mx-2 draft-expires-msg">Kladde udløber efter @(DraftStateProvider.Draft.TimeToLiveInSeconds / 60)m inaktivitet.</span>
</button>
</h2>
<div id="draftBody" class="accordion-collapse collapse"
aria-labelledby="draftHeader">
<div class="accordion-body">
@* ---------------------------------------------- *@
@* Display draft content *@
@if (DraftStateProvider != null && DraftStateProvider.Draft.Items.Count > 0)
{
<table class="table table-hover table-striped justify-content-center">
<thead>
<tr>
<th scope="col">Navn</th>
<th scope="col" class="text-nowrap">Varenr</th>
<th scope="col" class="text-end">Antal</th>
<th scope="col" class="text-end">Enhedspris</th>
<th scope="col" class="text-end">Linjesum</th>
<th scope="col">&nbsp;</th>
</tr>
</thead>
<tbody>
@foreach (var cItem in DraftStateProvider.Draft.Items)
{
<tr>
<td>@cItem.Item.Name</td>
<td>@cItem.Item.Sku</td>
<td class="text-end">@cItem.Quantity</td>
<td class="text-end">@cItem.Price</td>
<td class="text-end">@cItem.Total</td>
<td>
<button class="btn btn-warning" @onclick="@(() => RemoveItem(@cItem))">Slet</button>
</td>
</tr>
}
<tr>
<td></td>
<td></td>
<td></td>
<td class="text-black text-end fw-bold">Total</td>
<td class="text-black text-end fw-bold">@DraftStateProvider.Draft.Total</td>
<td></td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col">
<button class="btn btn-danger" @onclick="@DeleteDraft">Slet kladde</button>
</div>
<div class="col">
<a class="btn btn-success" href="/Companies">Overfør</a>
</div>
</div>
}
</div>
</div>
</div>
</div>
</EditForm>
@* ---------------------------------------------- *@
@* Display action buttons *@
<div class="row mb-2">
<div class="col">
<a class="btn btn-primary" href="/company/@_company.CompanyId">Tilbage</a>
<button type="submit" class="btn btn-success" disabled="@_poFormInvalid">Tilbud</button>
<button type="submit" class="btn btn-success" disabled="@_poFormInvalid">Bestilling</button>
</div>
</div>
}

View file

@ -31,7 +31,7 @@ using Wonky.Entity.Requests;
namespace Wonky.Client.Pages;
public partial class PurchaseOrderCreate : IDisposable
public partial class CrmActivityCreate : IDisposable
{
private PurchaseOrder _purchaseOrder = new ();
private CompanyDto _company = new();

View file

@ -1,267 +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 Affero GNU 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
// Affero GNU General Public License for more details.
//
// You should have received a copy of the Affero GNU General Public License
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
*@
@page "/company/{companyId}/activity"
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize(Roles = "Adviser")]
@using Wonky.Client.Components
<h2>@_purchaseOrder.Name</h2>
<EditForm EditContext="_editContext" OnValidSubmit="CreateActivity" class="card card-body bg-light mt-5">
<DataAnnotationsValidator />
<div class="row mb-1">
<label for="account" class="col-md-2 col-form-label">Konto</label>
<div class="col-md-4">
<InputText id="account" class="form-control" @bind-Value="_purchaseOrder.Account" readonly/>
<ValidationMessage For="@(() => _purchaseOrder.Account)"></ValidationMessage>
</div>
<label for="salesRep" class="col-md-2 col-form-label">Sælger</label>
<div class="col-md-4">
<InputText id="salesRep" class="form-control" @bind-Value="_purchaseOrder.SalesRep" readonly/>
<ValidationMessage For="@(() => _purchaseOrder.SalesRep)"></ValidationMessage>
</div>
</div>
<div class="row mb-1">
<label for="vatNumber" class="col-md-2 col-form-label">CVR nummer</label>
<div class="col-md-10">
<InputText id="vatNumber" class="form-control" @bind-Value="_purchaseOrder.VatNumber"/>
<ValidationMessage For="@(() => _purchaseOrder.VatNumber)"></ValidationMessage>
</div>
</div>
<div class="row mb-1">
<label for="referenceNumber" class="col-md-2 col-form-label">Rekvisition</label>
<div class="col-md-10">
<InputText id="referenceNumber" class="form-control" @bind-Value="_purchaseOrder.ReferenceNumber"v/>
<ValidationMessage For="@(() => _purchaseOrder.ReferenceNumber)"></ValidationMessage>
</div>
</div>
<div class="row mb-1">
<label for="yourRef" class="col-md-2 col-form-label">Indkøber</label>
<div class="col-md-10">
<InputText id="yourRef" class="form-control" @bind-Value="_purchaseOrder.YourRef"/>
<ValidationMessage For="@(() => _purchaseOrder.YourRef)"></ValidationMessage>
</div>
</div>
<div class="row mb-1">
<label for="orderMessage" class="col-md-2 col-form-label">Besked til kontoret</label>
<div class="col-md-10">
<InputText id="orderMessage" class="form-control" @bind-Value="_purchaseOrder.OrderMessage"/>
<ValidationMessage For="@(() => _purchaseOrder.OrderMessage)"></ValidationMessage>
</div>
</div>
<hr/>
<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="_purchaseOrder.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="_purchaseOrder.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="_purchaseOrder.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="_purchaseOrder.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="_purchaseOrder.DlvCity"/>
</div>
</div>
@* ---------------------------------------------- *@
@* Display action buttons *@
<div class="row mb-2">
<div class="col">
<a class="btn btn-primary" href="/company/@_company.CompanyId"></a>
</div>
<div class="col">
<button type="submit" class="btn btn-success" disabled="@_poFormInvalid">Tilbud</button>
<button type="submit" class="btn btn-success" disabled="@_poFormInvalid">Bestilling</button>
</div>
</div>
</EditForm>
@* ---------------------------------------------- *@
@* display product filter options *@
<div class="row mb-3">
<div class="col">
<ItemGroupDropdown OnChanged="SetItemGroup" />
</div>
<div class="col">
<ItemSearchDropdown OnChanged="SetSearchCol" />
</div>
<div class="col">
<SearchPhrase OnChanged="SetSortCol" />
</div>
<div class="col">
</div>
</div>
@* ---------------------------------------------- *@
@* display catolog *@
@if (SalesItems.Any())
{
// display filtered product list
<table class="table table-hover table-striped justify-content-center">
<thead>
<tr>
<th scope="col" style="width: 50%;">Navn</th>
<th scope="col" style="width: 30%;" class="text-nowrap">Varenr</th>
<th scope="col" style="width: 20%">Stk / Pris</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@foreach (var item in SalesItems)
{
<tr>
<td>@item.Name</td>
<td>@item.Sku</td>
<td><ul class="list-group">
@foreach (var rate in item.Rates)
{
<li class="list-group-item d-flex justify-content-between align-items-end">
<div class="text-sm-start px-2">@rate.Quantity</div>
<div class="text-sm-end">@rate.Rate</div>
</li>
}
</ul></td>
<td><button class="btn btn-primary" @onclick="@(() => SelectItem(item.ItemId))">Vælg</button></td>
</tr>
}
</tbody>
</table>
}
else
{
<AppSpinner/>
}
@* ---------------------------------------------- *@
@* Display draft line *@
@if (_selectedItem != null && ShowItem)
{
<div class="card mb-3 mt-3">
<div class="card-header bg-info fw-bold text-white">Kladdelinje</div>
<div class="card-body">
<div class="row">
<div class="col col-md-4 fw-bold">
Varenavn
</div>
<div class="col fw-bold">
Varenr
</div>
<div class="col fw-bold">
Antal
</div>
<div class="col fw-bold">
Pris
</div>
<div class="col">
</div>
</div>
<div class="row">
<div class="col col-md-4">
@_selectedItem.Name
</div>
<div class="col">
@_selectedItem.Sku
</div>
<div class="col">
<input class="form-control" type="number" @bind-value="@Quantity"/>
</div>
<div class="col">
<input class="form-control" type="number" @bind-value="@Price"/>
</div>
<div class="col">
<button class="btn btn-info" @onclick="@(() => AddItem(_selectedItem))">Læg til</button>
</div>
</div>
</div>
</div>
}
@* ---------------------------------------------- *@
@* Display draft content *@
@if (DraftStateProvider != null && DraftStateProvider.Draft.Items.Count > 0)
{
<div class="card mt-3 mb-3">
<div class="card-header bg-success text-white fw-bold">Ordrekladde <span class="draft-expires-msg">Kladde udløber efter @(DraftStateProvider.Draft.TimeToLiveInSeconds)m inaktivitet.</span></div>
<div class="card-body">
<table class="table table-hover table-striped justify-content-center">
<thead>
<tr>
<th scope="col">Navn</th>
<th scope="col" class="text-nowrap">Varenr</th>
<th scope="col" class="text-end">Antal</th>
<th scope="col" class="text-end">Enhedspris</th>
<th scope="col" class="text-end">Linjesum</th>
<th scope="col">&nbsp;</th>
</tr>
</thead>
<tbody>
@foreach (var cItem in DraftStateProvider.Draft.Items)
{
<tr>
<td>@cItem.Item.Name</td>
<td>@cItem.Item.Sku</td>
<td class="text-end">@cItem.Quantity</td>
<td class="text-end">@cItem.Price</td>
<td class="text-end">@cItem.Total</td>
<td><button class="btn btn-warning" @onclick="@(() => RemoveItem(@cItem))">Slet</button></td>
</tr>
}
<tr>
<td></td>
<td></td>
<td></td>
<td class="text-black text-end fw-bold">Total</td>
<td class="text-black text-end fw-bold">@DraftStateProvider.Draft.Total</td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div class="card-footer">
<div class="row">
<div class="col">
<button class="btn btn-danger" @onclick="@DeleteDraft">Slet kladde</button>
</div>
<div class="col">
<a class="btn btn-success" href="/Companies">Overfør</a>
</div>
</div>
</div>
</div>
}

View file

@ -39,7 +39,7 @@
<AuthorizeView>
<NotAuthorized>
<div class="nav-item px-3">
<NavLink class="nav-link" href="Login">
<NavLink class="nav-link" href="login">
<span class="oi oi-account-login"></span> Log ind
</NavLink>
</div>
@ -48,17 +48,17 @@
<AuthorizeView Roles="Adviser,Admin">
<Authorized>
<div class="nav-item px-3">
<NavLink class="nav-link" href="Companies">
<NavLink class="nav-link" href="companies">
<span class="oi oi-list-rich" aria-hidden="true"></span> Firmaer
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="/Price-Catalog">
<NavLink class="nav-link" href="price-catalog">
<span class="oi oi-list-rich" aria-hidden="true"></span> Priskatalog
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="Logout">
<NavLink class="nav-link" href="logout">
<span class="oi oi-account-logout"></span> Log af
</NavLink>
</div>

View file

@ -6,7 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Wonky Online</title>
<base href="/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<!-- <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />-->
<link href="css/app.css" rel="stylesheet" />
<link href="Wonky.Client.styles.css" rel="stylesheet" />
<link href="_content/Blazored.Toast/blazored-toast.min.css" rel="stylesheet" />
@ -21,6 +22,8 @@
<!-- <a href="" class="reload">Reload</a>-->
<!-- <a class="dismiss">🗙</a>-->
<!-- </div>-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="_framework/blazor.webassembly.js"></script>
</body>