cmc-sales/app/views/documents/view.ctp
2024-04-21 17:32:05 +10:00

105 lines
2.5 KiB
PHP
Executable file

<?php
echo $javascript->link('ckeditor/ckeditor');
echo $javascript->link('ckeditor/adapters/jquery');
echo $javascript->link('document_add_edit_20240421');
echo $javascript->link('document_attachments');
?>
<?=$this->element('pdf_created_message'); ?>
<?
echo $this->element($docTypeElement);
?>
<button class="addLineItem">Add Line Item</button>
<div id="lineItems">
</div>
<button class="addLineItem">Add Line Item</button>
<div id="pageContentFactory">
<?
echo $form->input("DocPage.content", array('class'=>'page', 'label'=>'Page', 'between'=>'<button class="removePage">X</button>'));
?>
</div>
<div id="addLineItemModal" title="Add Line Item">
</div>
<div id="editLineItemModal" title="Edit Line Item">
</div>
<div id="Attachments" title="Attachments">
<h2 class="document-attachments">Attachments</h2><button id="addAttachment">Add Attachment</button>
<div id="attachments-table">
<table>
<thead>
<th></th>
<th>Filename</th>
<th>Name</th>
<th>Desc</th>
<th>Size</th>
</thead>
<tbody>
<?php
$totalSize = 0;
foreach($attachments as $index => $attachment) {
?>
<tr>
<?php echo $form->input('DocumentAttachment.document_id',
array('type'=>'hidden', 'value'=> $document['Document']['id'])); ?>
<td><?php echo $form->input("DocumentAttachment.{$index}.id",
array('type'=>'checkbox',
'value'=> $attachment['DocumentAttachment']['id'],
'label' => false, 'class'=>'documentAttachment-checkbox')); ?></td>
<td>
<?php echo $html->link($attachment['Attachment']['filename'], '/attachments/view/'.$attachment['Attachment']['id']); ?>
</td>
<td><?php echo $attachment['Attachment']['name']; ?></td>
<td><?php echo $attachment['Attachment']['description']; ?></td>
<td><?php echo $number->toReadableSize($attachment['Attachment']['size']); ?></td>
<?php $totalSize += $attachment['Attachment']['size']; ?>
</tr>
<?php }
?>
<tr class="attachment-total">
<td></td>
<td></td>
<td></td>
<td>Total size:</td>
<td><?php echo $number->toReadableSize($totalSize); ?></td>
</tr>
</tbody>
</table>
</div> <!-- #attachments-table -->
<button id="removeAttachments">Remove Selected</button>
</div>
<div id="addAttachmentModal" title="Add Attachment">
<?php echo $this->element('add_attachment'); ?>
</div>
<div id="QuoteDetails" title="Edit Quote Details">
</div>
<div id="InvoiceDetails">
</div>
<span id="documentID" style="display:none;"><?=$document['Document']['id']?></span>