mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Use barcode defaults also for scan mode (fixes #1253)
This commit is contained in:
parent
030939e013
commit
d78e156609
@ -1864,7 +1864,7 @@ msgstr ""
|
||||
msgid "This is due earlier than already in-stock items"
|
||||
msgstr ""
|
||||
|
||||
msgid "When enabled, the amount will always be filled with 1 after changing/scanning a product and if all fields could be automatically populated (by product defaults), the transaction is automatically submitted"
|
||||
msgid "When enabled, after changing/scanning a product and if all fields could be automatically populated (by product and/or barcode defaults), the transaction is automatically submitted"
|
||||
msgstr ""
|
||||
|
||||
msgid "Quick consume amount"
|
||||
|
@ -287,23 +287,6 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||
$("#save-purchase-button").click();
|
||||
}
|
||||
|
||||
if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled))
|
||||
{
|
||||
$("#display_amount").val(1);
|
||||
$(".input-group-productamountpicker").trigger("change");
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm("purchase-form");
|
||||
if (document.getElementById("purchase-form").checkValidity() === true)
|
||||
{
|
||||
$('#save-purchase-button').click();
|
||||
}
|
||||
else
|
||||
{
|
||||
toastr.warning(__t("Scan mode is on but not all required fields could be populated automatically"));
|
||||
Grocy.UISound.Error();
|
||||
}
|
||||
}
|
||||
|
||||
RefreshLocaleNumberInput();
|
||||
|
||||
if (document.getElementById("product_id").getAttribute("barcode") != "null")
|
||||
@ -345,6 +328,8 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||
RefreshLocaleNumberInput();
|
||||
}
|
||||
}
|
||||
|
||||
ScanModeSubmit(false);
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
@ -355,6 +340,7 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||
else
|
||||
{
|
||||
$("#purchase-form").removeAttr("data-used-barcode");
|
||||
ScanModeSubmit();
|
||||
}
|
||||
|
||||
$('#display_amount').trigger("keyup");
|
||||
@ -588,3 +574,26 @@ $('#qu_id').on('change', function(e)
|
||||
priceTypeUnitPriceLabel.text($("#qu_id option:selected").text() + " " + __t("price"));
|
||||
refreshPriceHint();
|
||||
});
|
||||
|
||||
function ScanModeSubmit(singleUnit = true)
|
||||
{
|
||||
if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled))
|
||||
{
|
||||
if (singleUnit)
|
||||
{
|
||||
$("#display_amount").val(1);
|
||||
$(".input-group-productamountpicker").trigger("change");
|
||||
}
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm("purchase-form");
|
||||
if (document.getElementById("purchase-form").checkValidity() === true)
|
||||
{
|
||||
$('#save-purchase-button').click();
|
||||
}
|
||||
else
|
||||
{
|
||||
toastr.warning(__t("Scan mode is on but not all required fields could be populated automatically"));
|
||||
Grocy.UISound.Error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
<button id="scan-mode-button"
|
||||
class="btn @if(boolval($userSettings['scan_mode_consume_enabled'])) btn-success @else btn-danger @endif m-1 mt-md-0 mb-md-0 float-right"
|
||||
data-toggle="tooltip"
|
||||
title="{{ $__t('When enabled, the amount will always be filled with 1 after changing/scanning a product and if all fields could be automatically populated (by product defaults), the transaction is automatically submitted') }}">{{ $__t('Scan mode') }} <span id="scan-mode-status">@if(boolval($userSettings['scan_mode_consume_enabled'])) {{ $__t('on') }} @else {{ $__t('off') }} @endif</span></button>
|
||||
title="{{ $__t('When enabled, after changing/scanning a product and if all fields could be automatically populated (by product and/or barcode defaults), the transaction is automatically submitted') }}">{{ $__t('Scan mode') }} <span id="scan-mode-status">@if(boolval($userSettings['scan_mode_consume_enabled'])) {{ $__t('on') }} @else {{ $__t('off') }} @endif</span></button>
|
||||
<input id="scan-mode"
|
||||
type="checkbox"
|
||||
class="d-none user-setting-control"
|
||||
|
@ -31,7 +31,7 @@
|
||||
<button id="scan-mode-button"
|
||||
class="btn @if(boolval($userSettings['scan_mode_purchase_enabled'])) btn-success @else btn-danger @endif m-1 mt-md-0 mb-md-0 float-right"
|
||||
data-toggle="tooltip"
|
||||
title="{{ $__t('When enabled, the amount will always be filled with 1 after changing/scanning a product and if all fields could be automatically populated (by product defaults), the transaction is automatically submitted') }}">{{ $__t('Scan mode') }} <span id="scan-mode-status">@if(boolval($userSettings['scan_mode_purchase_enabled'])) {{ $__t('on') }} @else {{ $__t('off') }} @endif</span></button>
|
||||
title="{{ $__t('When enabled, after changing/scanning a product and if all fields could be automatically populated (by product and/or barcode defaults), the transaction is automatically submitted') }}">{{ $__t('Scan mode') }} <span id="scan-mode-status">@if(boolval($userSettings['scan_mode_purchase_enabled'])) {{ $__t('on') }} @else {{ $__t('off') }} @endif</span></button>
|
||||
<input id="scan-mode"
|
||||
type="checkbox"
|
||||
class="d-none user-setting-control"
|
||||
|
Loading…
x
Reference in New Issue
Block a user