2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-01 13:06:45 +00:00

Refactoring

This commit is contained in:
Oliver Walters 2021-01-28 22:41:20 +11:00
parent ae15ce9d0a
commit 489a15704c

View File

@ -1,12 +1,14 @@
{% load i18n %} {% load i18n %}
function makeBarcodeInput(placeholderText='') { function makeBarcodeInput(placeholderText='', hintText='') {
/* /*
* Generate HTML for a barcode input * Generate HTML for a barcode input
*/ */
placeholderText = placeholderText || '{% trans "Scan barcode data here using wedge scanner" %}'; placeholderText = placeholderText || '{% trans "Scan barcode data here using wedge scanner" %}';
hintText = hintText || '{% trans "Enter barcode data" %}';
var html = ` var html = `
<div class='form-group'> <div class='form-group'>
<label class='control-label' for='barcode'>{% trans "Barcode" %}</label> <label class='control-label' for='barcode'>{% trans "Barcode" %}</label>
@ -17,7 +19,7 @@ function makeBarcodeInput(placeholderText='') {
</span> </span>
<input id='barcode' class='textinput textInput form-control' type='text' name='barcode' placeholder='${placeholderText}'> <input id='barcode' class='textinput textInput form-control' type='text' name='barcode' placeholder='${placeholderText}'>
</div> </div>
<div id='hint_barcode_data' class='help-block'>{% trans "Enter barcode data" %}</div> <div id='hint_barcode_data' class='help-block'>${hintText}</div>
</div> </div>
</div> </div>
`; `;
@ -28,6 +30,7 @@ function makeBarcodeInput(placeholderText='') {
function makeNotesField(options={}) { function makeNotesField(options={}) {
var tooltip = options.tooltip || '{% trans "Enter optional notes for stock transfer" %}'; var tooltip = options.tooltip || '{% trans "Enter optional notes for stock transfer" %}';
var placeholder = options.placeholder || '{% trans "Enter notes" %}';
return ` return `
<div class='form-group'> <div class='form-group'>
@ -37,7 +40,7 @@ function makeNotesField(options={}) {
<span class='input-group-addon'> <span class='input-group-addon'>
<span class='fas fa-sticky-note'></span> <span class='fas fa-sticky-note'></span>
</span> </span>
<input id='notes' class='textinput textInput form-control' type='text' name='notes' placeholder='{% trans "Enter notes" %}'> <input id='notes' class='textinput textInput form-control' type='text' name='notes' placeholder='${placeholder}'>
</div> </div>
<div id='hint_notes' class='help_block'>${tooltip}</div> <div id='hint_notes' class='help_block'>${tooltip}</div>
</div> </div>