L'input de la boite de confirmation prend le focus automatiquement
Enter = Continuer Escape = Annuler
This commit is contained in:
parent
446233dbc0
commit
54b4751eb6
|
@ -47,7 +47,7 @@ public class MixService extends GenericService<Mix, MixDao> {
|
|||
|
||||
/**
|
||||
* Récupère les produits disponibles pour un mélange existant.
|
||||
*
|
||||
*`
|
||||
* @param mix Le mélange
|
||||
* @return Les produits disponibles pour ce mélange
|
||||
*/
|
||||
|
|
|
@ -43,7 +43,7 @@ public class CompanyCreatorController {
|
|||
try {
|
||||
company = companyService.save(company);
|
||||
|
||||
modelResponseBuilder.addResponseData(ResponseDataType.COMPANY_NAME, company.getName());
|
||||
modelResponseBuilder.addResponseCode(ResponseCode.SUCCESS_SAVING_COMPANY, company.getName());
|
||||
} catch (EntityAlreadyExistsException ex) {
|
||||
modelResponseBuilder.addResponseCode(ResponseCode.COMPANY_ALREADY_EXIST, company.getName());
|
||||
}
|
||||
|
|
|
@ -73,16 +73,16 @@ $(() => {
|
|||
}));
|
||||
|
||||
// Imprimante
|
||||
let src = `${baseUrl}/icons/printerError.svg`;
|
||||
let title = printErrorTitle;
|
||||
if ($(".bpac-extension-installed").length) {
|
||||
src = `${baseUrl}/icons/printer.svg`;
|
||||
title = printOkTitle;
|
||||
}
|
||||
$("#printStatusIcon").attr({
|
||||
src: src,
|
||||
title: title
|
||||
});
|
||||
let src = `${baseUrl}/icons/printerError.svg`;
|
||||
let title = printErrorTitle;
|
||||
if ($(".bpac-extension-installed").length) {
|
||||
src = `${baseUrl}/icons/printer.svg`;
|
||||
title = printOkTitle;
|
||||
}
|
||||
$("#printStatusIcon").attr({
|
||||
src: src,
|
||||
title: title
|
||||
});
|
||||
});
|
||||
|
||||
function confirmDatabaseExport() {
|
||||
|
@ -180,32 +180,59 @@ function showConfirm(value, prompt = false, continueCallback = () => {
|
|||
}) {
|
||||
const filter = $("#filter");
|
||||
const node = prompt ? $(promptMsg) : $(confirmMsg);
|
||||
const nodeInput = prompt ? node.find("#confirmInput") : $("");
|
||||
|
||||
if (prompt) node.find("#confirmInput").val("");
|
||||
if (prompt) {
|
||||
nodeInput.val("");
|
||||
|
||||
// Ne fonctionne pas sans
|
||||
setTimeout(function () {
|
||||
nodeInput.focus();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
showMessage(node, value, false);
|
||||
filter.show();
|
||||
filter.animate({opacity: 0.5}, messageBoxesAnimationTime);
|
||||
|
||||
node.find(".confirmContinue").one({
|
||||
click: function () {
|
||||
hideConfirm(node);
|
||||
setTimeout(() => {
|
||||
nodeInput.on({
|
||||
keyup: function (e) {
|
||||
if (e.which === 13) { // Enter
|
||||
confirmContinue(node, continueCallback);
|
||||
} else if (e.which === 27) {
|
||||
confirmCancel(node, cancelCallback)
|
||||
}
|
||||
}
|
||||
});
|
||||
node.find(".confirmContinue").one({
|
||||
click: () => {
|
||||
confirmContinue(node, continueCallback)
|
||||
}
|
||||
});
|
||||
node.find(".confirmCancel").one({
|
||||
click: () => {
|
||||
confirmCancel(node, cancelCallback)
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
if (!prompt) continueCallback();
|
||||
else continueCallback(node.find("#confirmInput").val());
|
||||
}, messageBoxesFunctionsDelay);
|
||||
}
|
||||
});
|
||||
node.find(".confirmCancel").one({
|
||||
click: function () {
|
||||
hideConfirm(node);
|
||||
function confirmContinue(node, continueCallback) {
|
||||
hideConfirm(node);
|
||||
|
||||
setTimeout(function () {
|
||||
cancelCallback();
|
||||
}, messageBoxesFunctionsDelay);
|
||||
}
|
||||
});
|
||||
setTimeout(function () {
|
||||
if (!prompt) continueCallback();
|
||||
else continueCallback(node.find("#confirmInput").val());
|
||||
}, messageBoxesFunctionsDelay);
|
||||
}
|
||||
|
||||
function confirmCancel(node, cancelCallback) {
|
||||
hideConfirm(node);
|
||||
|
||||
setTimeout(function () {
|
||||
cancelCallback();
|
||||
}, messageBoxesFunctionsDelay);
|
||||
}
|
||||
|
||||
function hideConfirm(node) {
|
||||
|
|
Loading…
Reference in New Issue