diff --git a/src/accounting/static/js/summary-editor.js b/src/accounting/static/js/summary-editor.js index 3596ec3..1ef00d2 100644 --- a/src/accounting/static/js/summary-editor.js +++ b/src/accounting/static/js/summary-editor.js @@ -769,7 +769,7 @@ class GeneralTripTab extends TagTabPlane { * @override */ populate() { - const found = this.editor.summary.value.match(/^([^—]+)—([^—→↔]+)([→↔])(.+?)(?:×\d+)?(?:\([^)]+\))?$/); + const found = this.editor.summary.value.match(/^([^—]+)—([^—→↔]+)([→↔])(.+?)(?:[*×]\d+)?(?:\([^)]+\))?$/); if (found === null) { return false; } @@ -957,7 +957,7 @@ class BusTripTab extends TagTabPlane { * @override */ populate() { - const found = this.editor.summary.value.match(/^([^—]+)—([^—]+)—([^—→]+)→(.+?)(?:×\d+)?(?:\([^)]+\))?$/); + const found = this.editor.summary.value.match(/^([^—]+)—([^—]+)—([^—→]+)→(.+?)(?:[*×]\d+)?(?:\([^)]+\))?$/); if (found === null) { return false; } @@ -1142,7 +1142,7 @@ class AnnotationTab extends TabPlane { * @override */ updateSummary() { - const found = this.editor.summary.value.match(/^(.*?)(?:×\d+)?(?:\([^)]+\))?$/); + const found = this.editor.summary.value.match(/^(.*?)(?:[*×]\d+)?(?:\([^)]+\))?$/); if (found !== null) { this.editor.summary.value = found[1]; } @@ -1171,16 +1171,19 @@ class AnnotationTab extends TabPlane { * @override */ populate() { - const found = this.editor.summary.value.match(/^(.*?)(?:×(\d+))?(?:\(([^)]+)\))?$/); - if (found[2] === undefined) { + const found = this.editor.summary.value.match(/^(.*?)(?:[*×](\d+))?(?:\(([^)]+)\))?$/); + this.editor.summary.value = found[1]; + if (found[2] === undefined || parseInt(found[2]) === 1) { this.editor.number.value = ""; } else { this.editor.number.value = found[2]; + this.editor.summary.value = this.editor.summary.value + "×" + this.editor.number.value; } if (found[3] === undefined) { this.editor.note.value = ""; } else { this.editor.note.value = found[3]; + this.editor.summary.value = this.editor.summary.value + "(" + this.editor.note.value + ")"; } return true; }