Enquiry File Uploading
This commit is contained in:
parent
9a0568bdd5
commit
e8b28d83d9
|
|
@ -4,7 +4,7 @@ App::import('Core', 'Sanitize');
|
||||||
class EnquiriesController extends AppController {
|
class EnquiriesController extends AppController {
|
||||||
|
|
||||||
var $name = 'Enquiries';
|
var $name = 'Enquiries';
|
||||||
var $helpers = array('Html', 'Form', 'Javascript', 'Time', 'Ajax');
|
var $helpers = array('Html', 'Form', 'Javascript', 'Time', 'Ajax', 'Number');
|
||||||
|
|
||||||
var $paginate = array(
|
var $paginate = array(
|
||||||
'limit' => 250,
|
'limit' => 250,
|
||||||
|
|
@ -24,6 +24,7 @@ class EnquiriesController extends AppController {
|
||||||
}
|
}
|
||||||
$this->set('enquiry', $this->Enquiry->read(null, $id));
|
$this->set('enquiry', $this->Enquiry->read(null, $id));
|
||||||
$this->set('quotes', $this->Enquiry->Quote->find('all', array('conditions'=>array('Quote.enquiry_id'=>$id), 'order'=>'Quote.revision DESC')));
|
$this->set('quotes', $this->Enquiry->Quote->find('all', array('conditions'=>array('Quote.enquiry_id'=>$id), 'order'=>'Quote.revision DESC')));
|
||||||
|
$this->set('files', $this->Enquiry->EnquiryFile->find('all', array('conditions' => array('EnquiryFile.enquiry_id'=>$id), 'order' => 'EnquiryFile.created ASC')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class QuoteProductsController extends AppController {
|
||||||
$this->Session->setFlash(__('The QuoteProduct could not be saved. Please, try again.', true));
|
$this->Session->setFlash(__('The QuoteProduct could not be saved. Please, try again.', true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$principles = $this->QuoteProduct->Principle->find('list');
|
$principles = $this->QuoteProduct->Product->Principle->find('list');
|
||||||
$currencies = $this->QuoteProduct->Currency->find('list');
|
$currencies = $this->QuoteProduct->Currency->find('list');
|
||||||
$quotes = $this->QuoteProduct->Quote->find('list');
|
$quotes = $this->QuoteProduct->Quote->find('list');
|
||||||
$products = $this->QuoteProduct->Product->find('list');
|
$products = $this->QuoteProduct->Product->find('list');
|
||||||
|
|
@ -69,4 +69,4 @@ class QuoteProductsController extends AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -45,28 +45,6 @@ class QuotesController extends AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function addold($id = null) {
|
|
||||||
|
|
||||||
if(isset($this->params['named']['enquiryid'])) {
|
|
||||||
$enquiryid = $this->params['named']['enquiryid'];
|
|
||||||
}
|
|
||||||
if (!empty($this->data)) {
|
|
||||||
$this->Quote->create();
|
|
||||||
|
|
||||||
$number_of_revisions = $this->Quote->findCount('enquiry_id ='. $this->data['Quote']['enquiry_id']);
|
|
||||||
$number_of_revisions++;
|
|
||||||
$this->data['Quote']['revision'] = $number_of_revisions;
|
|
||||||
if ($this->Quote->save($this->data)) {
|
|
||||||
$this->Session->setFlash(__('The Quote has been saved', true));
|
|
||||||
$this->redirect(array('action'=>'index'));
|
|
||||||
} else {
|
|
||||||
$this->Session->setFlash(__('The Quote could not be saved. Please, try again.', true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$enquiries = $this->Quote->Enquiry->find('list');
|
|
||||||
$this->set(compact('enquiries'));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function edit($id = null) {
|
function edit($id = null) {
|
||||||
if (!$id && empty($this->data)) {
|
if (!$id && empty($this->data)) {
|
||||||
|
|
@ -76,16 +54,18 @@ class QuotesController extends AppController {
|
||||||
if (!empty($this->data)) {
|
if (!empty($this->data)) {
|
||||||
if ($this->Quote->save($this->data)) {
|
if ($this->Quote->save($this->data)) {
|
||||||
$this->Session->setFlash(__('The Quote has been saved', true));
|
$this->Session->setFlash(__('The Quote has been saved', true));
|
||||||
$this->redirect(array('action'=>'index'));
|
$thisquote = $this->Quote->id;
|
||||||
|
$this->redirect(array('action' =>'view/'.$id), null, false);
|
||||||
} else {
|
} else {
|
||||||
$this->Session->setFlash(__('The Quote could not be saved. Please, try again.', true));
|
$this->Session->setFlash(__('The Quote could not be saved. Please, try again.', true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($this->data)) {
|
if (empty($this->data)) {
|
||||||
$this->data = $this->Quote->read(null, $id);
|
$quote = $this->Quote->read(null, $id);
|
||||||
|
$this->data = $quote;
|
||||||
}
|
}
|
||||||
$enquiries = $this->Quote->Enquiry->find('list');
|
$enquiry = $this->Quote->Enquiry->findById($quote['Quote']['enquiry_id']);
|
||||||
$this->set(compact('enquiries'));
|
$this->set(compact('enquiry', 'quote'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,11 @@ class Enquiry extends AppModel {
|
||||||
'exclusive' => '',
|
'exclusive' => '',
|
||||||
'finderQuery' => '',
|
'finderQuery' => '',
|
||||||
'counterQuery' => ''
|
'counterQuery' => ''
|
||||||
)
|
),
|
||||||
|
'EnquiryFile' => array('className' => 'EnquiryFile',
|
||||||
|
'foreignKey' => 'enquiry_id',
|
||||||
|
'dependent' => false
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ foreach ($enquiries as $enquiry):
|
||||||
$displayedComment = substr($enquiry['Enquiry']['comments'], 0, 260);
|
$displayedComment = substr($enquiry['Enquiry']['comments'], 0, 260);
|
||||||
echo $displayedComment;
|
echo $displayedComment;
|
||||||
if(strlen($enquiry['Enquiry']['comments']) > strlen($displayedComment) ) {
|
if(strlen($enquiry['Enquiry']['comments']) > strlen($displayedComment) ) {
|
||||||
echo '.... '.$html->link('view full comment', array('controller'=>'enquiries', 'action'=>'view', $enquiry['Enquiry']['id']));
|
echo '.... '.$html->link('view all', array('controller'=>'enquiries', 'action'=>'view', $enquiry['Enquiry']['id']));
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
echo $form->input('gst', array('label' => 'Is GST Applicable', 'options' => array('1' => 'Yes', '0' => 'No')));
|
echo $form->input('gst', array('label' => 'Is GST Applicable', 'options' => array('1' => 'Yes', '0' => 'No')));
|
||||||
echo $form->input('principle_id');
|
echo $form->input('principle_id');
|
||||||
echo $form->input('status_id');
|
echo $form->input('status_id');
|
||||||
echo $form->input('comments');
|
echo $form->input('comments', array('maxlength' => '250000'));
|
||||||
echo $form->input('customer_id', array('type'=>'hidden', 'value' => $customer['Customer']['id']));
|
echo $form->input('customer_id', array('type'=>'hidden', 'value' => $customer['Customer']['id']));
|
||||||
echo $form->input('finished', array('type' => 'hidden', 'value' => 'true'));
|
echo $form->input('finished', array('type' => 'hidden', 'value' => 'true'));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,3 +72,8 @@
|
||||||
<h3><?php __('Quotes in this Enquiry');?></h3>
|
<h3><?php __('Quotes in this Enquiry');?></h3>
|
||||||
<?php echo $this->element('quote_table', $quotes); ?>
|
<?php echo $this->element('quote_table', $quotes); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="related">
|
||||||
|
<h3><?php __('Files in this Enquiry');?><?php echo $html->image('document.png'); ?></h3>
|
||||||
|
<?php echo $this->element('enquiry_file_table', $files); ?>
|
||||||
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,26 @@
|
||||||
<div class="quotes form">
|
<div class="quotes form">
|
||||||
<?php echo $form->create('Quote');?>
|
<?php echo $form->create('Quote');?>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><?php __('Edit Quote');?></legend>
|
<legend>
|
||||||
|
<?php if($quote['Quote']['revision'] > 0) {
|
||||||
|
__('Edit Quote: '.$enquiry['Enquiry']['title'].'Rev'.$quote['Quote']['revision']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
__('Edit Quote: '.$enquiry['Enquiry']['title']);
|
||||||
|
}
|
||||||
|
?></legend>
|
||||||
<?php
|
<?php
|
||||||
echo $form->input('id');
|
echo $form->input('id');
|
||||||
echo $form->input('date_issued');
|
|
||||||
echo $form->input('enquiry_id');
|
echo $form->input('enquiry_id', array('type'=>'hidden', 'value' => $enquiry['Enquiry']['id']));
|
||||||
echo $form->input('revision');
|
|
||||||
echo $form->input('first_page');
|
echo $form->input('first_page');
|
||||||
echo $form->input('attachments');
|
echo $form->input('attachments');
|
||||||
echo $form->input('delivery_time');
|
echo $form->input('delivery_time');
|
||||||
echo $form->input('payment_terms');
|
echo $form->input('payment_terms');
|
||||||
|
echo $form->input('date_issued');
|
||||||
echo $form->input('days_valid');
|
echo $form->input('days_valid');
|
||||||
|
echo $form->input('valid_until');
|
||||||
?>
|
?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<?php echo $form->end('Submit');?>
|
<?php echo $form->end('Submit');?>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
|
||||||
<ul>
|
|
||||||
<li><?php echo $html->link(__('Delete', true), array('action'=>'delete', $form->value('Quote.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('Quote.id'))); ?></li>
|
|
||||||
<li><?php echo $html->link(__('List Quotes', true), array('action'=>'index'));?></li>
|
|
||||||
<li><?php echo $html->link(__('List Enquiries', true), array('controller'=> 'enquiries', 'action'=>'index')); ?> </li>
|
|
||||||
<li><?php echo $html->link(__('New Enquiry', true), array('controller'=> 'enquiries', 'action'=>'add')); ?> </li>
|
|
||||||
<li><?php echo $html->link(__('List Quote Products', true), array('controller'=> 'quote_products', 'action'=>'index')); ?> </li>
|
|
||||||
<li><?php echo $html->link(__('New Quote Product', true), array('controller'=> 'quote_products', 'action'=>'add')); ?> </li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
|
|
@ -11,17 +11,12 @@ else {
|
||||||
<dl><?php $i = 0; $class = ' class="altrow"';?>
|
<dl><?php $i = 0; $class = ' class="altrow"';?>
|
||||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
|
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
|
||||||
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
||||||
<?php echo $quote['Quote']['created']; ?>
|
<?php echo $time->nice($quote['Quote']['created']); ?>
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Modified'); ?></dt>
|
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Modified'); ?></dt>
|
||||||
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
||||||
<?php echo $quote['Quote']['modified']; ?>
|
<?php echo $time->nice($quote['Quote']['modified']); ?>
|
||||||
|
|
||||||
</dd>
|
|
||||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>
|
|
||||||
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
|
||||||
<?php echo $quote['Quote']['id']; ?>
|
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Enquiry'); ?></dt>
|
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Enquiry'); ?></dt>
|
||||||
|
|
@ -59,6 +54,11 @@ else {
|
||||||
<?php echo $quote['Quote']['days_valid']; ?>
|
<?php echo $quote['Quote']['days_valid']; ?>
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
|
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Valid Until'); ?></dt>
|
||||||
|
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
||||||
|
<?php echo $quote['Quote']['valid_until']; ?>
|
||||||
|
|
||||||
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
|
|
|
||||||
0
webroot/img/contact-new.png
Normal file → Executable file
0
webroot/img/contact-new.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
0
webroot/img/system-users.png
Normal file → Executable file
0
webroot/img/system-users.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in a new issue