Added buttons for PDF and emailing. Confirmatio nfor emailing

This commit is contained in:
Karl Cordes 2013-03-29 18:44:34 +11:00
parent 4f9ef7198d
commit 6eee4b0365
3 changed files with 11 additions and 6 deletions

View file

@ -40,7 +40,7 @@ $pagecounter = new PageCounter();
$pagecount = '';
if($attachment['Attachment']['type'] == 'application/pdf') {
$pagecount = '('.$pagecounter->count($attachment['Attachment']['file']).') pages';
$pagecount = '('.$pagecounter->count($attachment['Attachment']['file']).' pages)';
}
?>
<?= $attachment['Attachment']['name']; ?> <?= $pagecount ?><br>

View file

@ -19,10 +19,8 @@ echo $form->input('Document.id');
<button id="generateFirstPage">Generate first fage</button>
<button id="addPage">Add Content Page</button>
<button id="editQuoteDetails">View/Edit Quote details</button>
<button id="pdfDocButton">Generate PDF</button>
<button id="emailDocButton">Email Quote to customer</button>
<?=$html->link('Generate PDF of this Quote', '/documents/pdf/'.$document['Document']['id']);?>
<?=$html->link('Email this Quote', '/documents/email_pdf/'.$document['Document']['id']);?>
<button id="pdfDocButton" data-url="/documents/pdf/<?= $document['Document']['id']; ?>">Generate PDF</button>
<button id="emailDocButton" data-url="/documents/email_pdf/<?= $document['Document']['id']; ?>">Email Quote to customer</button>
</div>
<div id="flashMessage" class="message">

View file

@ -366,7 +366,14 @@ $(function() {
});
$("#pdfDocButton").click(function() {
window.location = $(this).data('url');
});
$("#emailDocButton").click(function() {
var confirmed = confirm("This will email this Quote and all Attachments to the Customer. Are you sure you want to do this?");
if(confirmed) {
window.location = $(this).data('url');
}
});