From 8bc0618e0e2f168c0131ef4ab8f96185ef0c2df9 Mon Sep 17 00:00:00 2001 From: delchev Date: Wed, 22 Jul 2026 19:07:33 +0300 Subject: [PATCH] feat(harmonia): hide the create-time UUID placeholder in the document title MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A not-yet-issued document holds a create-time UUID placeholder in its number field (the platform's numbering, until the real number is stamped at issue). The Harmonia document title rendered that raw UUID (e.g. "SALES INVOICE 3f2a1c9e-…"). Now the title shows just the document label until the real number appears. - HarmoniaFormat.documentNumber(v) (shared format.js): returns '' for a UUID-shaped value, else the value unchanged. - The document title uses it in the main document view (x-show + x-text) and the partner / my document views, so a draft reads "Sales Invoice" and, once issued, "Sales Invoice SI00000042". Independent display fix - improves the current hand-written-placeholder behavior too (not only first-class numbering). Verified: the shared format.js serves the helper. Co-Authored-By: Claude Opus 4.8 --- .../application-core/shell/js/services/format.js | 12 ++++++++++++ .../ui/my/my-document-view.html.template | 2 +- .../ui/partner/partner-document-view.html.template | 2 +- .../perspective/document/document-view.html.template | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/components/resources/application-core/src/main/resources/META-INF/dirigible/application-core/shell/js/services/format.js b/components/resources/application-core/src/main/resources/META-INF/dirigible/application-core/shell/js/services/format.js index 5ccc2596ae2..921beff460c 100644 --- a/components/resources/application-core/src/main/resources/META-INF/dirigible/application-core/shell/js/services/format.js +++ b/components/resources/application-core/src/main/resources/META-INF/dirigible/application-core/shell/js/services/format.js @@ -179,6 +179,18 @@ return this.value(v, true); }, + /** + * A document number for display. A not-yet-issued document holds a create-time UUID placeholder in + * its number field (the platform's numbering places it there until the real number is stamped at + * issue); render that as empty so the title shows just the document label ("Sales Invoice", not the + * raw UUID). Once the real number is stamped it passes through unchanged, as does any non-UUID value. + */ + documentNumber(v) { + if (v === null || v === undefined) return ''; + const uuid = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/; + return uuid.test(String(v)) ? '' : v; + }, + /** * Convert a date/datetime value to the FIXED shape an HTML requires — NOT pattern-driven. * `widget` is one of DATE, DATETIME-LOCAL, TIME, MONTH, WEEK (case-insensitive). Empty -> ''. diff --git a/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/my/my-document-view.html.template b/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/my/my-document-view.html.template index 2b97bfb539d..aa1f2c2b46b 100644 --- a/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/my/my-document-view.html.template +++ b/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/my/my-document-view.html.template @@ -15,7 +15,7 @@
+ x-text="(mode === 'edit' ? T('$projectName:${tprefix}.defaults.edit', 'Edit') : T('$projectName:${tprefix}.defaults.new', 'New')) + ' ' + T('$projectName:${tprefix}.t.${dataName}', '${documentLabel}')#if($docNumProp != '') + (window.HarmoniaFormat.documentNumber(form.${docNumProp}) ? ' ' + window.HarmoniaFormat.documentNumber(form.${docNumProp}) : '')#end + (ownerName ? ' ' + T('$projectName:${tprefix}.defaults.for', 'for') + ' ' + ownerName : '')"> #if($statusProp != "") #end diff --git a/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/partner/partner-document-view.html.template b/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/partner/partner-document-view.html.template index 20c06cc00ed..77d8c5b71bd 100644 --- a/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/partner/partner-document-view.html.template +++ b/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/partner/partner-document-view.html.template @@ -15,7 +15,7 @@
+ x-text="(mode === 'edit' ? T('$projectName:${tprefix}.defaults.edit', 'Edit') : T('$projectName:${tprefix}.defaults.new', 'New')) + ' ' + T('$projectName:${tprefix}.t.${dataName}', '${documentLabel}')#if($docNumProp != '') + (window.HarmoniaFormat.documentNumber(form.${docNumProp}) ? ' ' + window.HarmoniaFormat.documentNumber(form.${docNumProp}) : '')#end + (ownerName ? ' ' + T('$projectName:${tprefix}.defaults.for', 'for') + ' ' + ownerName : '')"> #if($statusProp != "") #end diff --git a/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/perspective/document/document-view.html.template b/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/perspective/document/document-view.html.template index b0bc58d7241..6ec154201f6 100644 --- a/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/perspective/document/document-view.html.template +++ b/components/template/template-application-ui-harmonia-java/src/main/resources/META-INF/dirigible/template-application-ui-harmonia-java/ui/perspective/document/document-view.html.template @@ -24,7 +24,7 @@ (heavier than the caption so it stands out), e.g. "Sales Invoice SI-0000001". -->
- +
#else