|
Lines 1919-1927
Link Here
|
| 1919 |
], |
1919 |
], |
| 1920 |
}); |
1920 |
}); |
| 1921 |
|
1921 |
|
| 1922 |
// Debounce variables for RFID batch input |
1922 |
// Debounce variable for RFID batch input |
| 1923 |
let debounceTimer; |
1923 |
let debounceTimer; |
| 1924 |
let isReceivingRFIDInput = false; |
|
|
| 1925 |
|
1924 |
|
| 1926 |
// Batch mode toggle functionality |
1925 |
// Batch mode toggle functionality |
| 1927 |
$('#batch-mode-toggle').on('change', function() { |
1926 |
$('#batch-mode-toggle').on('change', function() { |
|
Lines 1957-1999
Link Here
|
| 1957 |
|
1956 |
|
| 1958 |
// Handle RFID input with debouncing |
1957 |
// Handle RFID input with debouncing |
| 1959 |
$('#barcode').on('input paste', function(e) { |
1958 |
$('#barcode').on('input paste', function(e) { |
| 1960 |
const currentValue = $(this).val(); |
1959 |
clearTimeout(debounceTimer); // Clear any existing timer |
| 1961 |
|
1960 |
if ( $(this).val().match('\n$') ) { |
| 1962 |
// Clear any existing timer |
1961 |
// After a newline (in batch mode), set debounce timer |
| 1963 |
clearTimeout(debounceTimer); |
1962 |
// Form submits when there is no further input |
| 1964 |
|
|
|
| 1965 |
// Check if this looks like RFID batch input (contains newlines) |
| 1966 |
if (currentValue.includes('\n')) { |
| 1967 |
isReceivingRFIDInput = true; |
| 1968 |
|
| 1969 |
// Auto-enable batch mode if not already enabled |
| 1970 |
if (!$('#batch-mode-toggle').is(':checked')) { |
| 1971 |
$('#batch-mode-toggle').prop('checked', true).trigger('change'); |
| 1972 |
} |
| 1973 |
|
| 1974 |
// Set a debounce timer to submit after RFID scanning finishes |
| 1975 |
debounceTimer = setTimeout(function() { |
1963 |
debounceTimer = setTimeout(function() { |
| 1976 |
isReceivingRFIDInput = false; |
|
|
| 1977 |
ChangeBatchCheckinSettings(); |
| 1978 |
$('#checkin-form').submit(); |
1964 |
$('#checkin-form').submit(); |
| 1979 |
}, debounceInterval); // delay after last input |
1965 |
}, debounceInterval); // delay after last input |
| 1980 |
} |
1966 |
} |
| 1981 |
}); |
1967 |
}); |
| 1982 |
|
1968 |
|
| 1983 |
// Prevent immediate form submission on Enter if receiving RFID input |
1969 |
// Only submit after Enter in single mode |
| 1984 |
$('#barcode').on('keydown', function(e) { |
1970 |
$('#barcode').on('keydown', function(e) { |
| 1985 |
if (e.which === 13 && isReceivingRFIDInput) { |
1971 |
if ( e.which === 13 && !$('#batch-mode-toggle').prop('checked') ) { |
| 1986 |
e.preventDefault(); |
1972 |
e.preventDefault(); |
| 1987 |
return false; |
1973 |
$('#checkin-form').submit(); |
| 1988 |
} |
1974 |
} |
| 1989 |
}); |
1975 |
}); |
| 1990 |
|
1976 |
|
| 1991 |
// Prevent form submission during RFID input |
|
|
| 1992 |
$('#checkin-form').on('submit', function(e) { |
1977 |
$('#checkin-form').on('submit', function(e) { |
| 1993 |
if (isReceivingRFIDInput) { |
1978 |
ChangeBatchCheckinSettings(); |
| 1994 |
e.preventDefault(); |
|
|
| 1995 |
return false; |
| 1996 |
} |
| 1997 |
}); |
1979 |
}); |
| 1998 |
|
1980 |
|
| 1999 |
[% IF ( !(Koha.Preference('TransfersBlockCirc')) && Koha.Preference('AutomaticConfirmTransfer') ) %] |
1981 |
[% IF ( !(Koha.Preference('TransfersBlockCirc')) && Koha.Preference('AutomaticConfirmTransfer') ) %] |
| 2000 |
- |
|
|