2024-01-08 21:02:27 +00:00
|
|
|
function confirmAction (intent, sender) {
|
|
|
|
if (['rename', 'unconfirm', 'delete'].includes (intent) == false) return
|
|
|
|
let href = sender.getAttribute('action')
|
2024-05-13 22:25:43 +00:00
|
|
|
let intentTitle = document.querySelector("#modalOrderEditDialog #intentText")
|
|
|
|
let intentEdit = document.querySelector("#modalOrderEditDialog #intentRename")
|
|
|
|
let intentEditPanel = document.querySelector("#modalOrderEditDialog #intentEditPanel")
|
2024-01-08 21:02:27 +00:00
|
|
|
let intentFormAction = document.querySelector("#intentFormAction")
|
2024-05-13 22:25:43 +00:00
|
|
|
let intentSend = document.querySelector("#modalOrderEditDialog #intentSend")
|
2024-01-08 21:02:27 +00:00
|
|
|
// Resetting ui
|
2024-01-13 13:58:06 +00:00
|
|
|
intentEdit.removeAttribute('required')
|
|
|
|
intentEdit.removeAttribute('minlength')
|
2024-01-08 21:02:27 +00:00
|
|
|
intentFormAction.setAttribute('method', 'GET')
|
|
|
|
intentEditPanel.style.display = 'none';
|
|
|
|
|
|
|
|
intentTitle.innerText = intent + ' room'
|
|
|
|
intentFormAction.setAttribute('action', href)
|
|
|
|
switch (intent){
|
|
|
|
case 'rename':
|
|
|
|
intentEditPanel.style.display = 'block';
|
|
|
|
intentEdit.setAttribute('required', true)
|
2024-01-13 13:58:06 +00:00
|
|
|
intentEdit.setAttribute('minlength', 4)
|
2024-01-08 21:02:27 +00:00
|
|
|
intentFormAction.setAttribute('method', 'POST')
|
2024-01-08 22:07:59 +00:00
|
|
|
document.getElementById("intentRename").value = sender.parentElement.parentElement.querySelector("span").innerText;
|
2024-01-08 21:02:27 +00:00
|
|
|
break
|
|
|
|
case 'unconfirm':
|
|
|
|
break
|
|
|
|
case 'delete':
|
|
|
|
break
|
|
|
|
}
|
2024-05-13 22:25:43 +00:00
|
|
|
document.getElementById('modalOrderEditDialog').setAttribute('open', 'true');
|
2024-01-08 21:02:27 +00:00
|
|
|
}
|