mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Display barcode text near qrcode (#7553)
* Add setting to add texts to modals * Adjust style * adjust icon
This commit is contained in:
parent
b15eb35273
commit
62790cddc0
@ -1391,6 +1391,12 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
||||
'default': True,
|
||||
'validator': bool,
|
||||
},
|
||||
'BARCODE_SHOW_TEXT': {
|
||||
'name': _('Barcode Show Data'),
|
||||
'description': _('Display barcode data in browser as text'),
|
||||
'default': False,
|
||||
'validator': bool,
|
||||
},
|
||||
'PART_ENABLE_REVISION': {
|
||||
'name': _('Part Revisions'),
|
||||
'description': _('Enable revision field for Part'),
|
||||
|
@ -15,6 +15,7 @@
|
||||
{% include "InvenTree/settings/setting.html" with key="BARCODE_ENABLE" icon="fa-qrcode" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="BARCODE_INPUT_DELAY" icon="fa-hourglass-half" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="BARCODE_WEBCAM_SUPPORT" icon="fa-video" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="BARCODE_SHOW_TEXT" icon="fa-closed-captioning" %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
{% load i18n %}
|
||||
|
||||
/* globals
|
||||
global_settings,
|
||||
inventreeGet,
|
||||
QRCode,
|
||||
showAlertOrCache,
|
||||
@ -645,10 +646,14 @@ function showAlertDialog(title, content, options={}) {
|
||||
function showQRDialog(title, data, options={}) {
|
||||
|
||||
let content = `
|
||||
<div id='qrcode-container' style='margin: auto; width: 256px; padding: 25px;'>
|
||||
<div id='qrcode-container' style='width: 256px; ' class='py-4 m-auto'>
|
||||
<div id='qrcode'></div>
|
||||
</div>`;
|
||||
|
||||
if (global_settings.BARCODE_SHOW_TEXT) {
|
||||
content += `<div class='text-center' id='qrcode-text'>${data}</div>`;
|
||||
}
|
||||
|
||||
options.after_render = function(modal) {
|
||||
let qrcode = new QRCode('qrcode', {
|
||||
width: 256,
|
||||
|
@ -97,7 +97,8 @@ export default function SystemSettings() {
|
||||
keys={[
|
||||
'BARCODE_ENABLE',
|
||||
'BARCODE_INPUT_DELAY',
|
||||
'BARCODE_WEBCAM_SUPPORT'
|
||||
'BARCODE_WEBCAM_SUPPORT',
|
||||
'BARCODE_SHOW_TEXT'
|
||||
]}
|
||||
/>
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user