Added Confirmation to Close Ticket in Client Portal - Seperated cofirmation modal to a seperate JS file which is now included in the Client Portal

This commit is contained in:
johnnyq
2023-10-20 19:10:25 -04:00
parent fcfb162ec8
commit ba9442e6c3
5 changed files with 23 additions and 19 deletions

View File

@@ -28,6 +28,7 @@
<!-- AdminLTE App --> <!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script> <script src="dist/js/adminlte.min.js"></script>
<script src="js/app.js"></script> <script src="js/app.js"></script>
<script src="js/confirm_modal.js"></script>
</body> </body>
</html> </html>

View File

@@ -105,20 +105,3 @@ clipboard.on('error', function(e) {
$(function () { $(function () {
$('[data-toggle="popover"]').popover() $('[data-toggle="popover"]').popover()
}); });
$(document).ready(function() {
$("a.confirm-link").click(function(e) {
e.preventDefault();
// Save the link reference to use after confirmation
var linkReference = this;
// Show the confirmation modal
$("#confirmationModal").modal('show');
// When the submission is confirmed via the modal
$("#confirmSubmitBtn").off('click').on('click', function() {
window.location.href = $(linkReference).attr('href');
});
});
});

16
js/confirm_modal.js Normal file
View File

@@ -0,0 +1,16 @@
$(document).ready(function() {
$("a.confirm-link").click(function(e) {
e.preventDefault();
// Save the link reference to use after confirmation
var linkReference = this;
// Show the confirmation modal
$("#confirmationModal").modal('show');
// When the submission is confirmed via the modal
$("#confirmSubmitBtn").off('click').on('click', function() {
window.location.href = $(linkReference).attr('href');
});
});
});

View File

@@ -13,6 +13,8 @@
<p class="text-center"><?php echo nullable_htmlentities($session_company_name); ?></p> <p class="text-center"><?php echo nullable_htmlentities($session_company_name); ?></p>
<?php require_once "../inc_confirm_modal.php"; ?>
<!-- jQuery --> <!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script> <script src="../plugins/jquery/jquery.min.js"></script>
@@ -52,4 +54,6 @@
plugins: 'link image lists table code codesample fullscreen autoresize', plugins: 'link image lists table code codesample fullscreen autoresize',
}); });
</script> </script>
<script src="../js/confirm_modal.js"></script>

View File

@@ -53,7 +53,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
Ticket <?php echo $ticket_prefix, $ticket_number ?> Ticket <?php echo $ticket_prefix, $ticket_number ?>
<?php <?php
if ($ticket_status !== "Closed") { ?> if ($ticket_status !== "Closed") { ?>
<a href="portal_post.php?close_ticket=<?php echo $ticket_id; ?>" class="btn btn-sm btn-outline-success float-right text-white"><i class="fas fa-fw fa-check text-success"></i> Close ticket</a> <a href="portal_post.php?close_ticket=<?php echo $ticket_id; ?>" class="btn btn-sm btn-outline-success float-right text-white confirm-link"><i class="fas fa-fw fa-check text-success"></i> Close ticket</a>
<?php } ?> <?php } ?>
</h4> </h4>
</div> </div>