diff --git a/controllers/enquiries_controller.php b/controllers/enquiries_controller.php index f9039cba..2b157878 100755 --- a/controllers/enquiries_controller.php +++ b/controllers/enquiries_controller.php @@ -23,10 +23,10 @@ class EnquiriesController extends AppController { $this->Enquiry->recursive = 0; $this->set('enquiries', $this->paginate()); $status_list = $this->Enquiry->Status->getJSON(); - + $this->set('status_list', $status_list); - $classNames = $this->Enquiry->Status->getClassNamesJSON(); - $this->set('class_names', $classNames); + $classNames = $this->Enquiry->Status->getClassNamesJSON(); + $this->set('class_names', $classNames); //debug($this->paginate()); // $this->set('status_list', $this->Enquiry->Status->find('list')); @@ -77,18 +77,17 @@ class EnquiriesController extends AppController { } - function add() { + /* function add() { $this->set('users',$this->Enquiry->User->find('list', array('conditions'=>array('User.type'=>'user', 'User.enabled'=>true)))); - } + }*/ + - /* function add() { if(empty($this->data)) { if(isset($this->params['named']['customerid'])) { - $customer = $this->Enquiry->Cu - * stomer->findById($this->params['named']['customerid']); + $customer = $this->Enquiry->Customer->findById($this->params['named']['customerid']); } else { $this->Session->setFlash(__('The customer must already exist in the database. Please add Enquiries to an existing Customer', true)); @@ -96,9 +95,9 @@ class EnquiriesController extends AppController { } } - if(isset($customer)) {*/ + if(isset($customer)) { /* Check if the customer exists in the database - otherwise send the user back to step 1*/ - /*if(!$customer) { + if(!$customer) { $this->Session->setFlash(__('The customer must already exist in the database. Please try again', true)); $this->redirect(array('action'=>'add')); } @@ -150,15 +149,15 @@ class EnquiriesController extends AppController { } } - }*/ + } /* Internal function to display page 2 of the Add Enquiry Form Wizard * to help make the flow-control logic of the add function clearer. * */ - /* function __showPage2($customer) { */ + function __showPage2($customer) { /* Combine the first_name and last_name for the Contact Drop Down Box */ -/* $contacts = $this->Enquiry->Contact->find('all', array('conditions' => array('Contact.customer_id' => $customer['Customer']['id']))); + $contacts = $this->Enquiry->Contact->find('all', array('conditions' => array('Contact.customer_id' => $customer['Customer']['id']))); $contacts = Set::Combine($contacts, '{n}.Contact.id', array('{0} {1}', '{n}.Contact.first_name', '{n}.Contact.last_name')); $states = $this->Enquiry->State->find('list'); $countries = $this->Enquiry->Country->find('list', array('order'=> 'Country.name asc')); @@ -169,9 +168,9 @@ class EnquiriesController extends AppController { $customerAddresses = $this->Enquiry->BillingAddress->find('all', array('conditions'=>array('BillingAddress.customer_id' => $customer['Customer']['id']))); $this->set('billing_addresses', $customerAddresses); $this->set('shipping_addresses', $customerAddresses); - $this->set('errors', $this->Enquiry->invalidFields()); */ + $this->set('errors', $this->Enquiry->invalidFields()); /* Feels like an ugly hack. But it gets the desired effect and it will do for now */ -/* + if(isset($customerAddresses[0]['BillingAddress'])) { $billing_address_list[0] = "No Address Selected"; foreach ($customerAddresses as $address) { @@ -185,8 +184,7 @@ class EnquiriesController extends AppController { $this->set('billing_addresses_list', 'No Addresses exist for this Customer. Please add one'); $this->set('shipping_addresses_list', 'No Addresses exist for this Customer. Please add one'); } - }*/ - + } /* Add enquiry_id to the Email Queue */ @@ -416,13 +414,13 @@ class EnquiriesController extends AppController { function update_status() { if($this->data) { - - $enquiry = $this->Enquiry->read(null, $this->data['Enquiry']['id']); - $enquiry['Enquiry']['status_id'] = $this->data['Enquiry']['status_id']; - - $this->Enquiry->save($enquiry); - - $this->set('enquiry', $this->Enquiry->read(null,$enquiry['Enquiry']['id'])); + + $enquiry = $this->Enquiry->read(null, $this->data['Enquiry']['id']); + $enquiry['Enquiry']['status_id'] = $this->data['Enquiry']['status_id']; + + $this->Enquiry->save($enquiry); + + $this->set('enquiry', $this->Enquiry->read(null,$enquiry['Enquiry']['id'])); } } @@ -522,7 +520,7 @@ class EnquiriesController extends AppController { else { $this->set('enquiries', $this->paginate('Enquiry', array('Enquiry.user_id' => $id))); - + $statuses = $this->Enquiry->Status->find('all', array('recursive'=>0)); $status_list = array(); foreach ($statuses as $status) { @@ -530,7 +528,7 @@ class EnquiriesController extends AppController { $status_list[$statusid] = $status['Status']['name']; } $this->set('status_list', $status_list); - $this->layout = 'ajax'; + $this->layout = 'ajax'; } } diff --git a/webroot/css/quotenik.css b/webroot/css/quotenik.css index 4655acb3..8bbc9b7a 100755 --- a/webroot/css/quotenik.css +++ b/webroot/css/quotenik.css @@ -69,7 +69,8 @@ h1 { margin: 0.1em 0; } h2 { - color: #e32; + /*color: #e32; */ + color: #045FB4; font-family:'Gill Sans','lucida grande',helvetica, arial, sans-serif; font-size: 190%; margin: 0; @@ -77,7 +78,7 @@ h2 { } h2 a { - color: #e32; + color: #045FB4; font-weight: normal; } diff --git a/webroot/js/document_add_edit.js b/webroot/js/document_add_edit.js index 9a177803..9d64443e 100644 --- a/webroot/js/document_add_edit.js +++ b/webroot/js/document_add_edit.js @@ -38,7 +38,7 @@ $(function() { $.post('/line_items/ajax_add', thisLineItemInputs, function(data) { if(data == 'SUCCESS') { - loadLineItems(); + loadLineItems(); $( "#addLineItemModal" ).dialog('close'); @@ -53,7 +53,7 @@ $(function() { }, Cancel: function() { loadLineItems(); - $( this ).dialog( "close" ); + $( this ).dialog( "close" ); } } @@ -66,29 +66,21 @@ $(function() { modal: true, buttons: { "Edit Line Item": function() { - $('#LineItemDescription').ckeditor(function() { this.updateElement(); this.destroy(); }); - - + var thisLineItemInputs = $('#LineItemEditForm').find('input,select,textarea'); $.post('/line_items/ajax_edit', thisLineItemInputs, function(data) { - - - if(data == 'SUCCESS') { $( "#editLineItemModal" ).dialog('close'); - - } else { alert("Line Item could not be saved") $('#LineItemDescription').ckeditor(config); } - }); }, @@ -98,6 +90,10 @@ $(function() { } }, close: function() { + $('#LineItemDescription').ckeditor(function() { + this.destroy(); + }); + loadLineItems(); } @@ -414,11 +410,11 @@ function loadLineItems() { });*/ $.ajax({ - url: '/line_items/getTable/'+documentID, - cache: false, - success: function(data) { - $("#lineItems").html(data); - } + url: '/line_items/getTable/'+documentID, + cache: false, + success: function(data) { + $("#lineItems").html(data); + } }); }