Skip to content

Commit

Permalink
Changed to both bulk approve and reject
Browse files Browse the repository at this point in the history
  • Loading branch information
Cirx08 committed Dec 23, 2024
1 parent 7861eee commit 83de634
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
4 changes: 2 additions & 2 deletions WeddingShare/Views/Admin/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
</div>
}
<div class="mx-0 mx-sm-5 px-2 px-xl-5 text-warning d-inline-block">
<i class="btnApproveAll fa-solid fa-thumbs-up fa-2x pointer" alt="Approve All"></i>
<h6>Approve</h6>
<i class="btnBulkReview fa-solid fa-thumbs-up fa-2x pointer" alt="Bulk Review"></i>
<h6>Review</h6>
</div>
<div class="mx-0 mx-sm-5 px-2 px-xl-5 text-primary d-inline-block">
<i class="btnImport fa-solid fa-upload fa-2x pointer" alt="Import"></i>
Expand Down
39 changes: 33 additions & 6 deletions WeddingShare/wwwroot/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,16 @@
});
});

$(document).off('click', 'i.btnApproveAll').on('click', 'i.btnApproveAll', function (e) {
$(document).off('click', 'i.btnBulkReview').on('click', 'i.btnBulkReview', function (e) {
preventDefaults(e);

if ($(this).attr('disabled') == 'disabled') {
return;
}

displayPopup({
Title: 'Approve All',
Message: 'Are you sure you want to approve all pending items?',
Title: 'Bulk Review',
Message: 'Would you like to approve or reject all pending items?',
Buttons: [{
Text: 'Approve',
Class: 'btn-success',
Expand All @@ -132,16 +132,43 @@
$('#no-review-msg').removeClass('visually-hidden');
hideLoader();
} else if (data.message) {
displayMessage(`Approve Items`, `Approve failed`, [data.message]);
displayMessage(`Bulk Review`, `Approve failed`, [data.message]);
} else {
displayMessage(`Approve Items`, `Failed to approve all items`);
displayMessage(`Bulk Review`, `Failed to approve all items`);
}
})
.fail((xhr, error) => {
displayMessage(`Approve Items`, `Approve failed`, [error]);
displayMessage(`Bulk Review`, `Approve failed`, [error]);
});
}
}, {
Text: 'Reject',
Class: 'btn-danger',
Callback: function () {
displayLoader('Loading...');

$.ajax({
url: '/Admin/BulkReview',
method: 'POST',
data: { action: 2 }
})
.done(data => {
if (data.success === true) {
$('.pending-approval').remove();
$('#gallery-review').addClass('visually-hidden');
$('#no-review-msg').removeClass('visually-hidden');
hideLoader();
} else if (data.message) {
displayMessage(`Bulk Review`, `Reject failed`, [data.message]);
} else {
displayMessage(`Bulk Review`, `Failed to reject all items`);
}
})
.fail((xhr, error) => {
displayMessage(`Bulk Review`, `Reject failed`, [error]);
});
}
}, {
Text: 'Close'
}]
});
Expand Down

0 comments on commit 83de634

Please sign in to comment.