Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 <input> requires — NOT pattern-driven.
* `widget` is one of DATE, DATETIME-LOCAL, TIME, MONTH, WEEK (case-insensitive). Empty -> ''.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<div x-h-toolbar data-variant="transparent">
<span x-h-toolbar-title class="shrink-0"
x-text="(mode === 'edit' ? T('$projectName:${tprefix}.defaults.edit', 'Edit') : T('$projectName:${tprefix}.defaults.new', 'New')) + ' ' + T('$projectName:${tprefix}.t.${dataName}', '${documentLabel}')#if($docNumProp != '') + (form.${docNumProp} ? ' ' + form.${docNumProp} : '')#end + (ownerName ? ' ' + T('$projectName:${tprefix}.defaults.for', 'for') + ' ' + ownerName : '')"></span>
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 : '')"></span>
#if($statusProp != "")
<span x-h-badge class="shrink-0" :data-variant="statusVariant(statusText())" x-show="mode === 'edit' && statusText()" x-text="statusText()"></span>
#end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<div x-h-toolbar data-variant="transparent">
<span x-h-toolbar-title class="shrink-0"
x-text="(mode === 'edit' ? T('$projectName:${tprefix}.defaults.edit', 'Edit') : T('$projectName:${tprefix}.defaults.new', 'New')) + ' ' + T('$projectName:${tprefix}.t.${dataName}', '${documentLabel}')#if($docNumProp != '') + (form.${docNumProp} ? ' ' + form.${docNumProp} : '')#end + (ownerName ? ' ' + T('$projectName:${tprefix}.defaults.for', 'for') + ' ' + ownerName : '')"></span>
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 : '')"></span>
#if($statusProp != "")
<span x-h-badge class="shrink-0" :data-variant="statusVariant(statusText())" x-show="mode === 'edit' && statusText()" x-text="statusText()"></span>
#end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
(heavier than the caption so it stands out), e.g. "Sales Invoice SI-0000001". -->
<div class="hbox items-baseline gap-2 shrink-0">
<span class="text-2xl font-semibold tracking-tight" x-text="T('$projectName:${tprefix}.t.${dataName}', '${documentLabel}')"></span>
<span class="text-2xl font-bold tracking-tight" x-show="(isEdit || isPreview) && form.${docNumberProp}" x-text="form.${docNumberProp}"></span>
<span class="text-2xl font-bold tracking-tight" x-show="(isEdit || isPreview) && window.HarmoniaFormat.documentNumber(form.${docNumberProp})" x-text="window.HarmoniaFormat.documentNumber(form.${docNumberProp})"></span>
</div>
#else
<span x-h-toolbar-title class="shrink-0" x-text="isPreview ? T('$projectName:${tprefix}.t.${dataName}', '${documentLabel}') : (isEdit ? T('$projectName:${tprefix}.defaults.formHeadUpdate', 'Edit ${documentLabel}', { name: T('$projectName:${tprefix}.t.${dataName}', '${documentLabel}') }) : T('$projectName:${tprefix}.defaults.formHeadCreate', 'New ${documentLabel}', { name: T('$projectName:${tprefix}.t.${dataName}', '${documentLabel}') }))"></span>
Expand Down
Loading