diff --git a/src/Khaemhat.Web/Components/Pages/Inventory/ReorderPage.razor b/src/Khaemhat.Web/Components/Pages/Inventory/ReorderPage.razor index aa759b8..7698ff3 100644 --- a/src/Khaemhat.Web/Components/Pages/Inventory/ReorderPage.razor +++ b/src/Khaemhat.Web/Components/Pages/Inventory/ReorderPage.razor @@ -72,7 +72,7 @@ else } else { -
+
diff --git a/src/Khaemhat.Web/Components/Pages/Inventory/StockPage.razor b/src/Khaemhat.Web/Components/Pages/Inventory/StockPage.razor index 07d6136..673e392 100644 --- a/src/Khaemhat.Web/Components/Pages/Inventory/StockPage.razor +++ b/src/Khaemhat.Web/Components/Pages/Inventory/StockPage.razor @@ -109,10 +109,10 @@ else { - diff --git a/src/Khaemhat.Web/Components/Pages/Inventory/StockTakePage.razor b/src/Khaemhat.Web/Components/Pages/Inventory/StockTakePage.razor index a55016e..6dc7b1b 100644 --- a/src/Khaemhat.Web/Components/Pages/Inventory/StockTakePage.razor +++ b/src/Khaemhat.Web/Components/Pages/Inventory/StockTakePage.razor @@ -146,29 +146,29 @@ else
- - - - @if (IsOpen && CanWrite) - { - - - @if (Session.Permissions.Allows(InventoryService.PostPermission)) - { - - } - } - -
+
+ + + @if (IsOpen && CanWrite) + { + + + @if (Session.Permissions.Allows(InventoryService.PostPermission)) + { + + } + } +
+
@T.Date(move.Date) + @if (move.Kind is { } kind && move.DocumentId is { } document) { - @T["Sales.Kinds." + kind] @move.Number + @T["Sales.Kinds." + kind] @move.Number } @move.ReasonCode
diff --git a/src/Khaemhat.Web/Components/Pages/Sales/SalesDocumentPage.razor b/src/Khaemhat.Web/Components/Pages/Sales/SalesDocumentPage.razor index e1e6485..24c398b 100644 --- a/src/Khaemhat.Web/Components/Pages/Sales/SalesDocumentPage.razor +++ b/src/Khaemhat.Web/Components/Pages/Sales/SalesDocumentPage.razor @@ -52,7 +52,7 @@ else var h = Record.Header; - @@ -113,7 +113,7 @@ else @if (_differences.Count > 0) {
- @T.Format("Purchases.PriceDifferences.Summary", _differences.Count, T.Money(_differences.Sum(d => d.Amount))) + @(_differences.Count == 1 ? T.Format("Purchases.PriceDifferences.SummaryOne", T.Money(_differences[0].Amount)) : T.Format("Purchases.PriceDifferences.Summary", _differences.Count, T.Money(_differences.Sum(d => d.Amount)))) @foreach (var difference in _differences.Take(5)) {
@T.Format("Purchases.PriceDifferences.Line", difference.LineNumber, difference.Description, difference.SourceNumber ?? string.Empty, @@ -125,7 +125,7 @@ else @if (_selfAdvice is { } advice) {
- @T.Format("Purchases.SelfInvoices.Advice", advice.DocumentTypeCode, advice.Reason, T.Date(advice.Deadline)) + @T.Format("Purchases.SelfInvoices.Advice", advice.DocumentTypeCode, Sentence(advice.Reason), T.Date(advice.Deadline)) @if (Session.Permissions.Allows(PurchaseService.WritePermission) && DocumentStateMachine.IsInForce(h.Status)) { @@ -354,11 +354,11 @@ else
diff --git a/src/Khaemhat.Web/Components/Pages/Sales/SalesDocumentPage.razor.cs b/src/Khaemhat.Web/Components/Pages/Sales/SalesDocumentPage.razor.cs index d0eaa8e..2d2e1b3 100644 --- a/src/Khaemhat.Web/Components/Pages/Sales/SalesDocumentPage.razor.cs +++ b/src/Khaemhat.Web/Components/Pages/Sales/SalesDocumentPage.razor.cs @@ -115,7 +115,7 @@ public sealed partial class SalesDocumentPage private string PageTitle => Record is null || _definition is null ? T["Shell.Menu.Sales"] - : _definition.Type.Description + " " + (Record.Header.DocumentNumber ?? T["Sales.DraftNumber"]); + : _definition.Type.Description + " " + SalesScreens.Number(T, Record.Header.DocumentNumber, Record.Header.Status); private bool IsInvoice => Record is not null && (Behavior.Lifecycle == DocumentLifecycle.Invoice || H.Kind == DocumentKind.ProForma || IsRegistered); @@ -336,6 +336,9 @@ public sealed partial class SalesDocumentPage } // A supplier invoice: the prices that differ from its order or receipt, and the self-invoice it needs. + // A reason ends with one full stop, whether the fiscal pack wrote it or not. + private static string Sentence(string text) => text.EndsWith('.') ? text : text + "."; + private async Task LoadPurchaseChecksAsync(Actor actor, string company) { _differences = []; diff --git a/src/Khaemhat.Web/Components/Pages/Sales/SalesDocumentsPage.razor b/src/Khaemhat.Web/Components/Pages/Sales/SalesDocumentsPage.razor index f234831..54381f8 100644 --- a/src/Khaemhat.Web/Components/Pages/Sales/SalesDocumentsPage.razor +++ b/src/Khaemhat.Web/Components/Pages/Sales/SalesDocumentsPage.razor @@ -103,7 +103,7 @@ else private IReadOnlyList> Columns => [ - new("number", T[_section?.Kinds.Contains(DocumentKind.PurchaseInvoice) == true ? "Purchases.Fields.Protocol" : "Sales.Fields.DocumentNumber"], r => r.DocumentNumber ?? T["Sales.DraftNumber"]) { Kind = KhColumnKind.Code, Width = "130px" }, + new("number", T[_section?.Kinds.Contains(DocumentKind.PurchaseInvoice) == true ? "Purchases.Fields.Protocol" : "Sales.Fields.DocumentNumber"], r => SalesScreens.Number(T, r.DocumentNumber, r.Status)) { Kind = KhColumnKind.Code, Width = "130px" }, new("date", T["Sales.Fields.DocumentDate"], r => r.Date) { Kind = KhColumnKind.Date, Width = "100px" }, new("type", T["Sales.Radar.Kind"], r => SalesScreens.KindName(T, r.Kind)) { Width = "150px", Sortable = false, Visible = _section?.Kinds.Count > 1 }, new("party", T[SalesScreens.PartyLabel(_section?.Direction ?? DocumentDirection.Sale)], r => r.PartyName) { Sortable = false, Visible = !Internal }, diff --git a/src/Khaemhat.Web/Documents/SalesScreens.cs b/src/Khaemhat.Web/Documents/SalesScreens.cs index 463bc5e..5c1ee73 100644 --- a/src/Khaemhat.Web/Documents/SalesScreens.cs +++ b/src/Khaemhat.Web/Documents/SalesScreens.cs @@ -134,6 +134,20 @@ public static class SalesScreens return texts["Sales.Kinds." + kind]; } + /// + /// The number shown for a document: its own number, else "Bozza" for a draft and "Senza numero" for a confirmed + /// document of a type without numerator (a supplier delivery note, which keeps the supplier's number). + /// + /// The texts. + /// The document number. + /// The state. + /// The text. + public static string Number(ITexts texts, string? number, DocumentStatus status) + { + ArgumentNullException.ThrowIfNull(texts); + return number ?? texts[status == DocumentStatus.Draft ? "Sales.DraftNumber" : "Sales.NoNumber"]; + } + /// The label and tone of a state; a quotation shows its outcome (accepted, refused, expired). /// The texts. /// The kind. diff --git a/src/Khaemhat.Web/Resources/it-IT/Purchases.json b/src/Khaemhat.Web/Resources/it-IT/Purchases.json index 2a62a3c..4689ab9 100644 --- a/src/Khaemhat.Web/Resources/it-IT/Purchases.json +++ b/src/Khaemhat.Web/Resources/it-IT/Purchases.json @@ -56,10 +56,11 @@ "Reason": "Motivo", "Deadline": "Entro il", "Create": "Crea autofattura", - "Advice": "Serve un'autofattura {0}: {1}. Da emettere entro il {2}." + "Advice": "Serve un'autofattura {0}: {1} Da emettere entro il {2}." }, "PriceDifferences": { "Summary": "{0} righe hanno un prezzo diverso dall'ordine o dal ricevimento: differenza totale {1}.", + "SummaryOne": "Una riga ha un prezzo diverso dall'ordine o dal ricevimento: differenza {0}.", "Line": "Riga {0}, {1}: {2} a {3}, in fattura {4}." } }, diff --git a/src/Khaemhat.Web/Resources/it-IT/Sales.json b/src/Khaemhat.Web/Resources/it-IT/Sales.json index 1f10cb0..4698eab 100644 --- a/src/Khaemhat.Web/Resources/it-IT/Sales.json +++ b/src/Khaemhat.Web/Resources/it-IT/Sales.json @@ -4,6 +4,7 @@ "NotFound": "Documento non trovato", "BackToList": "Torna all'elenco", "DraftNumber": "Bozza", + "NoNumber": "Senza numero", "NumberOnConfirm": "Assegnato alla conferma", "NoParty": "Cliente da scegliere", "Demo": "Dato dimostrativo", diff --git a/src/Khaemhat.Web/wwwroot/app.css b/src/Khaemhat.Web/wwwroot/app.css index 6b513a0..64c1bf0 100644 --- a/src/Khaemhat.Web/wwwroot/app.css +++ b/src/Khaemhat.Web/wwwroot/app.css @@ -409,10 +409,15 @@ h1[tabindex="-1"]:focus { outline: none; box-shadow: none; } /* Warehouse (M6): filters above a radar, count boxes, file picker as a button, grids inside dialogs. */ .kh-pagefilters { margin: 10px 0 4px; } .kh-searchbox { width: 220px; } +.kh-taketools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--kh-border); } +.kh-taketools .in { width: auto; } +.kh-taketools .kh-searchbox { flex: 1 1 200px; max-width: 320px; } +.kh-scrollx { overflow-x: auto; } .in.kh-countbox { width: 96px; height: 26px; text-align: right; } .kh-filebtn { position: relative; overflow: hidden; cursor: pointer; } .kh-filebtn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; } .kh-dialoggrid { max-height: 52vh; overflow: auto; margin-top: 10px; } +.kh-dialoggrid .mono { font-family: var(--kh-mono); font-size: 12px; } .kh-cellpick { min-width: 220px; } .kh-cellpick .f > label:empty { display: none; } .kh-plainlist { margin: 4px 0 0; padding-left: 18px; }
@if (SalesScreens.RecordUrl(link.Kind, link.Id) is { } url) { - @(link.DocumentNumber ?? T["Sales.DraftNumber"]) + @SalesScreens.Number(T, link.DocumentNumber, link.Status) } else { - @(link.DocumentNumber ?? T["Sales.DraftNumber"]) + @SalesScreens.Number(T, link.DocumentNumber, link.Status) } @T.Date(link.Date)