AFLOW-46-ui-duplication #1

Merged
grey merged 5 commits from AFLOW-46-ui-duplication into master 2024-06-19 18:34:40 +02:00
3 changed files with 14 additions and 0 deletions

View File

@ -3,6 +3,7 @@ function randomInRange(min, max) {
}
function doTheConfetti() {
// Create confetti
confetti({
angle: randomInRange(90, 110),
spread: randomInRange(70, 120),

View File

@ -8,6 +8,16 @@ function primeCreateNew() {
return true;
}
function triggerDuplicationDialog(sourceItemId) {
// Clear the form
$('.form-control').val('');
const form = document.getElementById('ItemModalForm');
document.getElementById('itemModifyModalLabel').innerText= "Duplicate an item";
form.setAttribute('method', 'POST');
getDataForEdit(sourceItemId);
return true;
}
function primeEdit() {
const form = document.getElementById('ItemModalForm');
document.getElementById('itemModifyModalLabel').innerText = 'Edit an item';

View File

@ -49,6 +49,9 @@ function dataResponseHandler(json) {
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModifyModal" onclick="primeEdit(); getDataForEdit('${item.id}')">
<i class="bi bi-pencil"></i>
</button>
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModifyModal" onclick="triggerDuplicationDialog('${item.id}')">
<i class="bi bi-copy"></i>
</button>
<button class="btn btn-danger" onclick="preFillDeleteModalNxt('${item.id}','items','Item')" data-bs-toggle="modal" data-bs-target="#staticBackdrop">
<i class="bi bi-trash"></i>
</button>`