mirror of
https://github.com/hargata/lubelog.git
synced 2025-12-10 00:46:08 -06:00
add enter event on sweetalert modals see #639
This commit is contained in:
parent
78e0a0146c
commit
94c6cca25c
@ -124,7 +124,7 @@
|
||||
Swal.fire({
|
||||
title: 'Generate Token',
|
||||
html: `
|
||||
<input type="text" id="inputEmail" class="swal2-input" placeholder="Email Address">
|
||||
<input type="text" id="inputEmail" class="swal2-input" placeholder="Email Address" onkeydown="handleSwalEnter(event)">
|
||||
`,
|
||||
confirmButtonText: 'Generate',
|
||||
focusConfirm: false,
|
||||
|
||||
@ -73,7 +73,7 @@
|
||||
Swal.fire({
|
||||
title: 'Field Name',
|
||||
html: `
|
||||
<input type="text" id="inputExtraFieldName" class="swal2-input" placeholder="Field Name">
|
||||
<input type="text" id="inputExtraFieldName" class="swal2-input" placeholder="Field Name" onkeydown="handleSwalEnter(event)">
|
||||
`,
|
||||
confirmButtonText: 'Add',
|
||||
focusConfirm: false,
|
||||
|
||||
@ -342,7 +342,7 @@
|
||||
title: 'Setup Credentials',
|
||||
html: `
|
||||
<input type="text" id="authUsername" class="swal2-input" placeholder="Username">
|
||||
<input type="password" id="authPassword" class="swal2-input" placeholder="Password">
|
||||
<input type="password" id="authPassword" class="swal2-input" placeholder="Password" onkeydown="handleSwalEnter(event)">
|
||||
`,
|
||||
confirmButtonText: 'Setup',
|
||||
focusConfirm: false,
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
Swal.fire({
|
||||
title: 'Add Collaborator',
|
||||
html: `
|
||||
<input type="text" id="inputUserName" class="swal2-input" placeholder="Username">
|
||||
<input type="text" id="inputUserName" class="swal2-input" placeholder="Username" onkeydown="handleSwalEnter(event)">
|
||||
`,
|
||||
confirmButtonText: 'Add',
|
||||
focusConfirm: false,
|
||||
|
||||
@ -408,7 +408,7 @@ function searchGasTableRows() {
|
||||
Swal.fire({
|
||||
title: 'Search Records',
|
||||
html: `
|
||||
<input type="text" id="inputSearch" class="swal2-input" placeholder="Keyword(case sensitive)">
|
||||
<input type="text" id="inputSearch" class="swal2-input" placeholder="Keyword(case sensitive)" onkeydown="handleSwalEnter(event)">
|
||||
`,
|
||||
confirmButtonText: 'Search',
|
||||
focusConfirm: false,
|
||||
|
||||
@ -281,7 +281,7 @@ function updatePlanRecordProgress(newProgress) {
|
||||
Swal.fire({
|
||||
title: 'Mark Task as Done?',
|
||||
html: `<p>To confirm, please enter the current odometer reading on your vehicle, as we also need the current odometer to auto convert the task into the relevant record.</p>
|
||||
<input type="text" inputmode="numeric" id="inputOdometer" class="swal2-input" placeholder="Odometer Reading">
|
||||
<input type="text" inputmode="numeric" id="inputOdometer" class="swal2-input" placeholder="Odometer Reading" onkeydown="handleSwalEnter(event)">
|
||||
`,
|
||||
confirmButtonText: 'Confirm',
|
||||
showCancelButton: true,
|
||||
|
||||
@ -23,7 +23,7 @@ function checkCustomMonthInterval() {
|
||||
Swal.fire({
|
||||
title: 'Specify Custom Month Interval',
|
||||
html: `
|
||||
<input type="text" inputmode="numeric" id="inputCustomMileage" class="swal2-input" placeholder="Months">
|
||||
<input type="text" inputmode="numeric" id="inputCustomMileage" class="swal2-input" placeholder="Months" onkeydown="handleSwalEnter(event)">
|
||||
`,
|
||||
confirmButtonText: 'Set',
|
||||
focusConfirm: false,
|
||||
@ -52,7 +52,7 @@ function checkCustomMileageInterval() {
|
||||
Swal.fire({
|
||||
title: 'Specify Custom Mileage Interval',
|
||||
html: `
|
||||
<input type="text" inputmode="numeric" id="inputCustomMileage" class="swal2-input" placeholder="Mileage">
|
||||
<input type="text" inputmode="numeric" id="inputCustomMileage" class="swal2-input" placeholder="Mileage" onkeydown="handleSwalEnter(event)">
|
||||
`,
|
||||
confirmButtonText: 'Set',
|
||||
focusConfirm: false,
|
||||
|
||||
@ -412,7 +412,7 @@ function editFileName(fileLocation, event) {
|
||||
Swal.fire({
|
||||
title: 'Rename File',
|
||||
html: `
|
||||
<input type="text" id="newFileName" class="swal2-input" placeholder="New File Name">
|
||||
<input type="text" id="newFileName" class="swal2-input" placeholder="New File Name" onkeydown="handleSwalEnter(event)">
|
||||
`,
|
||||
confirmButtonText: 'Rename',
|
||||
focusConfirm: false,
|
||||
@ -925,7 +925,7 @@ function replenishSupplies() {
|
||||
html: `
|
||||
<input type="text" id="inputSupplyAddQuantity" class="swal2-input" placeholder="Quantity">
|
||||
<br />
|
||||
<input type="text" id="inputSupplyAddCost" class="swal2-input" placeholder="Cost">
|
||||
<input type="text" id="inputSupplyAddCost" class="swal2-input" placeholder="Cost" onkeydown="handleSwalEnter(event)">
|
||||
<br />
|
||||
<span class='small'>leave blank to use unit cost calculation</span>
|
||||
`,
|
||||
@ -985,7 +985,7 @@ function searchTableRows(tabName) {
|
||||
Swal.fire({
|
||||
title: 'Search Records',
|
||||
html: `
|
||||
<input type="text" id="inputSearch" class="swal2-input" placeholder="Keyword(case sensitive)">
|
||||
<input type="text" id="inputSearch" class="swal2-input" placeholder="Keyword(case sensitive)" onkeydown="handleSwalEnter(event)">
|
||||
`,
|
||||
confirmButtonText: 'Search',
|
||||
focusConfirm: false,
|
||||
@ -1094,4 +1094,14 @@ function handleModalPaste(e, recordType) {
|
||||
$(`#${recordType}`)[0].files = acceptableFiles.files;
|
||||
$(`#${recordType}`).trigger('change');
|
||||
}
|
||||
}
|
||||
function handleEnter(e, submitButtonName) {
|
||||
if (e.which == 13) {
|
||||
$(`#${submitButtonName}`).trigger('click');
|
||||
}
|
||||
}
|
||||
function handleSwalEnter(e) {
|
||||
if (e.which == 13) {
|
||||
Swal.clickConfirm();
|
||||
}
|
||||
}
|
||||
@ -104,7 +104,7 @@ function checkCustomMonthIntervalForTax() {
|
||||
Swal.fire({
|
||||
title: 'Specify Custom Month Interval',
|
||||
html: `
|
||||
<input type="text" inputmode="numeric" id="inputCustomMileage" class="swal2-input" placeholder="Months">
|
||||
<input type="text" inputmode="numeric" id="inputCustomMileage" class="swal2-input" placeholder="Months" onkeydown="handleSwalEnter(event)">
|
||||
`,
|
||||
confirmButtonText: 'Set',
|
||||
focusConfirm: false,
|
||||
|
||||
@ -616,7 +616,7 @@ function getLastOdometerReadingAndIncrement(odometerFieldName) {
|
||||
Swal.fire({
|
||||
title: 'Increment Last Reported Odometer Reading',
|
||||
html: `
|
||||
<input type="text" id="inputOdometerIncrement" class="swal2-input" placeholder="Increment">
|
||||
<input type="text" id="inputOdometerIncrement" class="swal2-input" placeholder="Increment" onkeydown="handleSwalEnter(event)">
|
||||
`,
|
||||
confirmButtonText: 'Add',
|
||||
focusConfirm: false,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user