diff --git a/controllers/addresses_controller.php b/controllers/addresses_controller.php index 7799b1a1..faf03861 100755 --- a/controllers/addresses_controller.php +++ b/controllers/addresses_controller.php @@ -60,19 +60,24 @@ class AddressesController extends AppController { } if (!empty($this->data)) { if ($this->Address->save($this->data)) { + $id = $this->Address->id; + $address = $this->Address->findById($id); $this->Session->setFlash(__('The Address has been saved', true)); - $this->redirect(array('action'=>'index')); + $this->redirect(array('controller' => 'customers', 'action'=>'view/'.$address['Address']['customer_id'])); } else { $this->Session->setFlash(__('The Address could not be saved. Please, try again.', true)); } } - if (empty($this->data)) { - $this->data = $this->Address->read(null, $id); - } - $customers = $this->Address->Customer->find('list'); + + $address = $this->Address->read(null, $id); + $customer = $this->Address->Customer->findById($address['Address']['customer_id']); $states = $this->Address->State->find('list'); $countries = $this->Address->Country->find('list'); - $this->set(compact('customers','states','countries')); + $this->set(compact('customer','states','countries', 'address')); + if (empty($this->data)) { + $this->data = $address; + } + } diff --git a/controllers/emails_controller.php b/controllers/emails_controller.php index f99a8d16..6747c929 100644 --- a/controllers/emails_controller.php +++ b/controllers/emails_controller.php @@ -2,8 +2,8 @@ class EmailsController extends AppController { var $name = 'Emails'; - var $helpers = array('Html', 'Form'); - + var $helpers = array('Html', 'Form', 'Number', 'Ajax', 'Text', 'Link'); + var $components = array('RequestHandler'); function index() { $this->Email->recursive = 0; $this->set('emails', $this->paginate()); @@ -31,36 +31,23 @@ class EmailsController extends AppController { $this->set(compact('enquiries')); } - function edit($id = null) { - if (!$id && empty($this->data)) { - $this->Session->setFlash(__('Invalid Email', true)); - $this->redirect(array('action'=>'index')); - } - if (!empty($this->data)) { - if ($this->Email->save($this->data)) { - $this->Session->setFlash(__('The Email has been saved', true)); - $this->redirect(array('action'=>'index')); - } else { - $this->Session->setFlash(__('The Email could not be saved. Please, try again.', true)); - } - } - if (empty($this->data)) { - $this->data = $this->Email->read(null, $id); - } - $enquiries = $this->Email->Enquiry->find('list'); - $this->set(compact('enquiries')); + function frame($id = null) { + $this->set('id', $id); } - function delete($id = null) { - if (!$id) { - $this->Session->setFlash(__('Invalid id for Email', true)); - $this->redirect(array('action'=>'index')); + function show($id = null) { + $this->layout = 'minimal'; + $this->set('email', $this->Email->read(null, $id)); + } - if ($this->Email->del($id)) { - $this->Session->setFlash(__('Email deleted', true)); - $this->redirect(array('action'=>'index')); + /* Violates DRY. Should probably clean this up at some point */ + function printview($id = null) { + $this->layout = 'minimal'; + $this->set('email', $this->Email->read(null, $id)); + } - } + + } -?> \ No newline at end of file +?> diff --git a/controllers/enquiries_controller.php b/controllers/enquiries_controller.php index 5f121b44..3e982edf 100755 --- a/controllers/enquiries_controller.php +++ b/controllers/enquiries_controller.php @@ -4,7 +4,7 @@ App::import('Core', 'Sanitize'); class EnquiriesController extends AppController { var $name = 'Enquiries'; - var $helpers = array('Html', 'Form', 'Javascript', 'Time', 'Ajax', 'Number'); + var $helpers = array('Html', 'Form', 'Javascript', 'Time', 'Ajax', 'Number', 'Text'); var $paginate = array( 'limit' => 250, @@ -30,6 +30,7 @@ class EnquiriesController extends AppController { $this->set('number_of_emails', $this->Enquiry->Email->find('count', array('conditions'=>array('Email.enquiry_id'=>$id)))); $this->set('number_of_quotes', $this->Enquiry->Quote->find('count', array('conditions'=>array('Quote.enquiry_id'=>$id)))); $this->set('number_of_files', $this->Enquiry->EnquiryFile->find('count', array('conditions' => array('EnquiryFile.enquiry_id'=>$id)))); + if($enquiry['Enquiry']['billing_address_id'] != 0) { $this->set('billingaddress', $this->Enquiry->BillingAddress->findById($enquiry['Enquiry']['billing_address_id'])); } diff --git a/views/addresses/edit.ctp b/views/addresses/edit.ctp index 6ce2ee1b..790f19f8 100755 --- a/views/addresses/edit.ctp +++ b/views/addresses/edit.ctp @@ -4,12 +4,12 @@ input('id'); - echo $form->input('name'); echo $form->input('address'); echo $form->input('city'); + echo $form->input('postcode'); echo $form->input('state_id'); echo $form->input('country_id'); - echo $form->input('customer_id'); + echo $form->input('customer_id', array('type' => 'hidden', 'value' => $customer['Customer']['id'])); echo $form->input('type', array('label' => 'Address Type (Billing,Shipping or Both)', 'options' => array('Billing','Shipping', 'Both Shipping and Billing'))); ?> diff --git a/views/elements/email/html/enquiry_added.ctp b/views/elements/email/html/enquiry_added.ctp index 78e8a52f..8f229cb2 100644 --- a/views/elements/email/html/enquiry_added.ctp +++ b/views/elements/email/html/enquiry_added.ctp @@ -14,7 +14,7 @@ Please see below for the contact details we have for this enquiry and advise if Mobile:
Fax:

-Depending on the nature of your request, we may need input from our manufacturers overseas. This will usually take 24 to 48 hours, but if your application is more complex, it may take longer.

+Depending on the nature of your request, we may need input from our manufacturers overseas. This will usually take 24 to 48 hours, but if your enquiry is non-standard, it may take a little longer.

Sincerely,

diff --git a/views/elements/email/text/enquiry_added.ctp b/views/elements/email/text/enquiry_added.ctp index 75085ffd..ee2a36d0 100644 --- a/views/elements/email/text/enquiry_added.ctp +++ b/views/elements/email/text/enquiry_added.ctp @@ -18,7 +18,7 @@ Mobile: Fax: -Depending on the nature of your request, we may need input from our manufacturers overseas. This will usually take 24 to 48 hours, but if your application is more complex, it may take longer. +Depending on the nature of your request, we may need input from our manufacturers overseas. This will usually take 24 to 48 hours, but if your enquiry is non-standard, it may take a little longer. Sincerely, diff --git a/views/elements/email_table.ctp b/views/elements/email_table.ctp index 226a8929..a49b4630 100644 --- a/views/elements/email_table.ctp +++ b/views/elements/email_table.ctp @@ -1,11 +1,12 @@ - +
+ - + > + - + diff --git a/views/elements/email_table_ajax.ctp b/views/elements/email_table_ajax.ctp new file mode 100644 index 00000000..eba79ab0 --- /dev/null +++ b/views/elements/email_table_ajax.ctp @@ -0,0 +1,51 @@ + +
link($email['Email']['subject'], array('controller'=> 'emails', 'action'=>'view/', $email['Email']['id'])); ?> link($email['Email']['subject'], array('controller'=> 'emails', 'action'=>'view/', $email['Email']['id'])); ?> link(__('View', true), array('controller'=> 'emails', 'action'=>'view/', $email['Email']['id'])); ?>
+ + + + + + + + + + + + + > + + + + + + + + + + + +
image('attach.png'); ?>
0) { + echo $html->image('attach.png'); + } + ?> + + + highlight($ajax->link($email['Email']['subject'], array('controller'=> 'emails', 'action'=>'frame/', $email['Email']['id']), array('update'=>'showemail')), 'Quotation'); ?> + link(__('View', true), array('controller'=> 'emails', 'action'=>'view/', $email['Email']['id'])); + echo $ajax->link('View', array('controller'=>'emails', 'action'=>'frame/', $email['Email']['id']), array('update' => 'showemail')); + echo $html->link('Print', array('controller' => 'emails', 'action'=>'printview/', $email['Email']['id'])); + ?> +
+ diff --git a/views/emails/edit.ctp b/views/emails/edit.ctp deleted file mode 100644 index 3c9300d9..00000000 --- a/views/emails/edit.ctp +++ /dev/null @@ -1,28 +0,0 @@ -
-create('Email');?> -
- - input('enquiry_id'); - echo $form->input('id'); - echo $form->input('to'); - echo $form->input('from'); - echo $form->input('cc'); - echo $form->input('body'); - echo $form->input('date'); - echo $form->input('subject'); - echo $form->input('content-type'); - ?> -
-end('Submit');?> -
-
- -
diff --git a/views/emails/frame.ctp b/views/emails/frame.ctp new file mode 100644 index 00000000..b5338073 --- /dev/null +++ b/views/emails/frame.ctp @@ -0,0 +1,3 @@ + diff --git a/views/emails/printview.ctp b/views/emails/printview.ctp new file mode 100644 index 00000000..f5ab0207 --- /dev/null +++ b/views/emails/printview.ctp @@ -0,0 +1,47 @@ +
+Enquiry Number:
+Date:
+Subject:
+To:
+From:
+CC:
+
+
+ +

- - + - diff --git a/views/enquiries/view.ctp b/views/enquiries/view.ctp index af2ecc3a..36cf375b 100755 --- a/views/enquiries/view.ctp +++ b/views/enquiries/view.ctp @@ -99,10 +99,12 @@ +
+
diff --git a/views/layouts/minimal.ctp b/views/layouts/minimal.ctp new file mode 100644 index 00000000..af7e3f41 --- /dev/null +++ b/views/layouts/minimal.ctp @@ -0,0 +1,8 @@ +css('quotenik'); +?> + +
+ +
+ diff --git a/views/pages/about.ctp b/views/pages/about.ctp index e69de29b..8a45aa45 100644 --- a/views/pages/about.ctp +++ b/views/pages/about.ctp @@ -0,0 +1,2 @@ +

About this Software

+ diff --git a/views/pages/help.ctp b/views/pages/help.ctp new file mode 100644 index 00000000..e69de29b diff --git a/webroot/css/quotenik.css b/webroot/css/quotenik.css index df7bd867..24522815 100755 --- a/webroot/css/quotenik.css +++ b/webroot/css/quotenik.css @@ -200,6 +200,42 @@ ul, li { padding: 6px 10px; text-align: right; } +#mailheaders { + width: 80%; + } +a#mailheaders { + color: #003d4c; + } + +#viewemail { + text-align: left; + font-size: 80%; + + } +#emailbody { + text-align: left; + font-size: 100%; + background-color: #FFFFFF; + color: #000000; + } + +#printemailbody { + text-align: left; + font-size: 90%; + background-color: #FFFFFF; + color: #000000; + } + + +#showemail { + padding-top:1em; + width: 70%; + } + +dl#showemail { + line-height: 2em; + margin: 0em 0em; +} .addressradio label { display: block; @@ -342,6 +378,10 @@ table.quotetable tr.mostrecent td { table.quotetable tr.altrow td { background: #f4f4f4; } + +table.emailtable { + font-size: small; +} /* Paging */ div.paging { @@ -367,6 +407,14 @@ dl { margin: 0em 0em; width: 60%; } + +dl.mailheaders { + line-height: 2em; + margin: 0em 0em; + width: 100%; + color: #000000; +} + dl.altrow { background: #f4f4f4; } @@ -387,6 +435,7 @@ dd { dd.altrow { background: #E6F0F0; } + /* Forms */ form { @@ -695,6 +744,11 @@ span.warning { color: #FF0000; } +span.highlight { + background-color: #74DD63; +} + + span.tip { color: #000000; } diff --git a/webroot/img/attach.png b/webroot/img/attach.png new file mode 100755 index 00000000..ee58b8f5 Binary files /dev/null and b/webroot/img/attach.png differ diff --git a/webroot/img/internet-mail.png b/webroot/img/internet-mail.png new file mode 100644 index 00000000..dc3b9dd3 Binary files /dev/null and b/webroot/img/internet-mail.png differ
'); ?> + + + + + + diff --git a/views/emails/show.ctp b/views/emails/show.ctp new file mode 100644 index 00000000..3a3ff52e --- /dev/null +++ b/views/emails/show.ctp @@ -0,0 +1,80 @@ +
+
+ > + > + link($email['Enquiry']['title'], array('controller'=> 'enquiries', 'action'=>'view', $email['Enquiry']['id'])); ?> +   + + > + > + +   + + > + > + +   + + > + > + autoLinkEmailsSubject($email['Email']['to'], $email['Email']['subject']); ?> + +   + + > + > + autoLinkEmails($email['Email']['from']); ?> +   + + > + > + autoLinkEmails($email['Email']['cc']); ?> +   + +
+ +
+ + + +
+ + +
diff --git a/views/emails/view.ctp b/views/emails/view.ctp index 564e51c1..be954fba 100644 --- a/views/emails/view.ctp +++ b/views/emails/view.ctp @@ -1,14 +1,21 @@

+ +
> > link($email['Enquiry']['title'], array('controller'=> 'enquiries', 'action'=>'view', $email['Enquiry']['id'])); ?>   - > + > > - + +   + + > + > +   > @@ -27,30 +34,12 @@   > - > +
 
- > - > - -   - - > - > - -   - - > - > - -   - - > - > - -   - + +
@@ -63,7 +52,6 @@
toReadableSize($emailAttachment['size']);?> - link(__('View', true), array('controller'=> 'email_attachments', 'action'=>'view', $emailAttachment['id'])); ?> - link(__('Edit', true), array('controller'=> 'email_attachments', 'action'=>'edit', $emailAttachment['id'])); ?> - link(__('Delete', true), array('controller'=> 'email_attachments', 'action'=>'delete', $emailAttachment['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $emailAttachment['id'])); ?> + link(__('View', true), array('controller'=> 'email_attachments', 'action'=>'download', $emailAttachment['id'])); ?>