Display barcode text near qrcode (#7553)

* Add setting to add texts to modals

* Adjust style

* adjust icon
This commit is contained in:
Matthias Mair 2024-07-04 00:46:45 +02:00 committed by GitHub
parent b15eb35273
commit 62790cddc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 2 deletions

View File

@ -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'),

View File

@ -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>

View File

@ -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,

View File

@ -97,7 +97,8 @@ export default function SystemSettings() {
keys={[
'BARCODE_ENABLE',
'BARCODE_INPUT_DELAY',
'BARCODE_WEBCAM_SUPPORT'
'BARCODE_WEBCAM_SUPPORT',
'BARCODE_SHOW_TEXT'
]}
/>
)