Skip to content

Commit

Permalink
Added code to: Preview quote/invoice pdf in modal window in table
Browse files Browse the repository at this point in the history
Added code to implement the feature: Show quote/invoice pdf in modal (for table view) if Options menu setting 'Preview PDF' is active.
  • Loading branch information
Verony-makesIT committed Mar 8, 2023
1 parent 148a922 commit 70bac8c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions application/modules/invoices/views/partial_invoice_table.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<script>
$(function () {
$(document).on('click', '#invoice_preview_pdf', function () {
var invoice_id = $(this).data('invoice-id');
$('#modal-placeholder').load("<?php echo site_url('invoices/ajax/modal_preview_pdf'); ?>", {invoice_id: invoice_id});
});
});
</script>

<div class="table-responsive">
<table class="table table-hover table-striped">

Expand Down Expand Up @@ -100,8 +109,7 @@
<?php } ?>
<?php if (get_setting('show_menu_item_preview_pdf') == 1) { ?>
<li>
<a href="<?php echo site_url('invoices/generate_pdf/' . $invoice->invoice_id); ?>"
target="_blank">
<a href="#" id="invoice_preview_pdf" data-invoice-id="<?php echo $invoice->invoice_id; ?>">
<i class="fa fa-file-pdf-o fa-margin"></i> <?php _trans('preview_pdf'); ?>
</a>
</li>
Expand Down
12 changes: 10 additions & 2 deletions application/modules/quotes/views/partial_quote_table.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<script>
$(function () {
$(document).on('click', '#quote_preview_pdf', function () {
var quote_id = $(this).data('quote-id');
$('#modal-placeholder').load("<?php echo site_url('quotes/ajax/modal_preview_pdf'); ?>", {quote_id: quote_id});
});
});
</script>

<div class="table-responsive">
<table class="table table-hover table-striped">

Expand Down Expand Up @@ -72,8 +81,7 @@
<?php } ?>
<?php if (get_setting('show_menu_item_preview_pdf') == 1) { ?>
<li>
<a href="<?php echo site_url('quotes/generate_pdf/' . $quote->quote_id); ?>"
target="_blank">
<a href="#" id="quote_preview_pdf" data-quote-id="<?php echo $quote->quote_id; ?>">
<i class="fa fa-file-pdf-o fa-margin"></i> <?php _trans('preview_pdf'); ?>
</a>
</li>
Expand Down

0 comments on commit 70bac8c

Please sign in to comment.