Fixed that checkbox was undefined, as dialog was already closed

This commit is contained in:
Marc Ole Bulling 2021-01-15 14:12:04 +01:00
parent a31283fbc3
commit 2b3f0978b7
No known key found for this signature in database
GPG Key ID: C126AFC2A47B06FF

View File

@ -442,6 +442,7 @@ $(document).on("click", "#print-shopping-list-button", function(e)
className: 'btn-secondary', className: 'btn-secondary',
callback: function () { callback: function () {
bootbox.hideAll(); bootbox.hideAll();
var printHeader = $("#print-show-header").prop("checked");
var thermalPrintDialog = bootbox.dialog({ var thermalPrintDialog = bootbox.dialog({
title: __t('Printing'), title: __t('Printing'),
message: '<p><i class="fa fa-spin fa-spinner"></i> ' + __t('Connecting to printer...') + '</p>' message: '<p><i class="fa fa-spin fa-spinner"></i> ' + __t('Connecting to printer...') + '</p>'
@ -449,7 +450,7 @@ $(document).on("click", "#print-shopping-list-button", function(e)
//Delaying for one second so that the alert can be closed //Delaying for one second so that the alert can be closed
setTimeout(function () setTimeout(function ()
{ {
Grocy.Api.Get('print/shoppinglist/thermal?list=' + $("#selected-shopping-list").val() + '&printHeader=' + $("#print-show-header").prop("checked"), Grocy.Api.Get('print/shoppinglist/thermal?list=' + $("#selected-shopping-list").val() + '&printHeader=' + printHeader,
function (result) function (result)
{ {
bootbox.hideAll(); bootbox.hideAll();