Nice changes. Cleaned up Enquiry adding, AJAXified it so you can add a new contact while adding an enquiry. Awesome commit. Hope it deploys well
This commit is contained in:
parent
bf63a5abca
commit
f3eadaecba
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -1,2 +1,7 @@
|
|||
tmp/*
|
||||
tmp/logs/*
|
||||
tmp/cache/models/*
|
||||
tmp/cache/persistent/*
|
||||
tmp/cache/views/*
|
||||
tmp/sessions/*
|
||||
tmp/tests/*
|
||||
*.tar.gz
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
class AddressesController extends AppController {
|
||||
|
||||
var $name = 'Addresses';
|
||||
var $helpers = array('Html', 'Form');
|
||||
|
||||
var $helpers = array('Html', 'Form', 'Ajax');
|
||||
var $components = array('RequestHandler');
|
||||
function index() {
|
||||
$this->Address->recursive = 0;
|
||||
$this->set('addresses', $this->paginate());
|
||||
|
|
@ -41,6 +41,18 @@ class AddressesController extends AppController {
|
|||
$this->set(compact('customer', 'states', 'countries'));
|
||||
}
|
||||
|
||||
function add_another($increment) {
|
||||
$this->set('increment', $increment);
|
||||
$states = $this->Address->State->find('list');
|
||||
$countries = $this->Address->Country->find('list');
|
||||
$this->set('states', $states);
|
||||
$this->set('countries', $countries);
|
||||
}
|
||||
function remove_another($increment) {
|
||||
$this->set('increment', $increment);
|
||||
}
|
||||
|
||||
|
||||
function edit($id = null) {
|
||||
if (!$id && empty($this->data)) {
|
||||
$this->Session->setFlash(__('Invalid Address', true));
|
||||
|
|
@ -63,16 +75,6 @@ class AddressesController extends AppController {
|
|||
$this->set(compact('customers','states','countries'));
|
||||
}
|
||||
|
||||
function delete($id = null) {
|
||||
if (!$id) {
|
||||
$this->Session->setFlash(__('Invalid id for Address', true));
|
||||
$this->redirect(array('action'=>'index'));
|
||||
}
|
||||
if ($this->Address->del($id)) {
|
||||
$this->Session->setFlash(__('Address deleted', true));
|
||||
$this->redirect(array('action'=>'index'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
class ContactsController extends AppController {
|
||||
|
||||
var $name = 'Contacts';
|
||||
var $helpers = array('Html', 'Form');
|
||||
|
||||
var $helpers = array('Html', 'Form', 'Ajax');
|
||||
var $components = array('RequestHandler');
|
||||
var $paginate = array(
|
||||
'Contact' => array('order' => array('Contact.customer_id' => 'asc')),
|
||||
'Enquiry' => array('order' => array('Enquiry.id' => 'asc'))
|
||||
|
|
@ -37,7 +37,7 @@ class ContactsController extends AppController {
|
|||
$this->redirect(array('controller'=>'Enquiries', 'action'=>'index'));
|
||||
}
|
||||
if (!empty($this->data)) {
|
||||
$this->data['Contact']['name'] = $this->data['Contact']['first_name'].' '.$this->data['Contact']['last_name'];
|
||||
|
||||
$this->Contact->create();
|
||||
if ($this->Contact->save($this->data)) {
|
||||
$this->Session->setFlash(__('The Contact has been saved', true));
|
||||
|
|
@ -51,6 +51,22 @@ class ContactsController extends AppController {
|
|||
$this->set(compact('customer'));
|
||||
}
|
||||
|
||||
function add_another($increment) {
|
||||
$this->set('increment', $increment);
|
||||
|
||||
}
|
||||
function remove_another($increment) {
|
||||
$this->set('increment', $increment);
|
||||
}
|
||||
function add_one($customerid) {
|
||||
$this->set('customerid', $customerid);
|
||||
}
|
||||
function remove_one($customerid) {
|
||||
$contacts = $this->Contact->find('all', array('conditions' => array('Contact.customer_id' => $customerid)));
|
||||
$contacts = Set::Combine($contacts, '{n}.Contact.id', array('{0}, {1}', '{n}.Contact.first_name', '{n}.Contact.last_name'));
|
||||
$this->set('contacts', $contacts);
|
||||
$this->set('customerid', $customerid);
|
||||
}
|
||||
|
||||
function edit($id = null) {
|
||||
if (!$id && empty($this->data)) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
class CurrenciesController extends AppController {
|
||||
|
||||
var $name = 'Currencies';
|
||||
var $helpers = array('Html', 'Form');
|
||||
var $helpers = array('Html', 'Form'), 'Ajax';
|
||||
var $components = array('RequestHandler');
|
||||
|
||||
function index() {
|
||||
$this->Currency->recursive = 0;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
class CustomersController extends AppController {
|
||||
|
||||
var $name = 'Customers';
|
||||
var $helpers = array('Html', 'Form', 'Time');
|
||||
|
||||
var $helpers = array('Html', 'Form', 'Time', 'Ajax');
|
||||
var $components = array('RequestHandler');
|
||||
var $paginate = array(
|
||||
'Customer' => array('order' => array('Customer.name' => 'asc'),
|
||||
'limit' => 200
|
||||
|
|
@ -29,7 +29,6 @@ class CustomersController extends AppController {
|
|||
function add() {
|
||||
if (!empty($this->data)) {
|
||||
|
||||
|
||||
if($this->Customer->saveAll($this->data, array('validate'=>'first')) ) {
|
||||
$newcustomerid = $this->Customer->id;
|
||||
$this->Session->setFlash(__('The Customer has been saved', true));
|
||||
|
|
|
|||
|
|
@ -42,15 +42,6 @@ class EnquiriesController extends AppController {
|
|||
|
||||
function add() {
|
||||
|
||||
|
||||
$states = $this->Enquiry->State->find('list');
|
||||
$countries = $this->Enquiry->Country->find('list', array('order'=> 'Country.name asc'));
|
||||
$principles = $this->Enquiry->Principle->find('list', array('order' => 'Principle.name asc'));
|
||||
$statuses = $this->Enquiry->Status->find('list');
|
||||
$users = $this->Enquiry->User->find('list', array('fields' => array('User.id', 'User.username')));
|
||||
$this->set(compact('users', 'customers', 'states', 'countries', 'principles', 'statuses'));
|
||||
|
||||
|
||||
if(empty($this->data)) {
|
||||
$this->set('step', 1);
|
||||
}
|
||||
|
|
@ -65,91 +56,87 @@ class EnquiriesController extends AppController {
|
|||
|
||||
|
||||
if(isset($customer)) {
|
||||
|
||||
/* Check if the customer exists in the database - otherwise send the user back to step 1*/
|
||||
if(!$customer) {
|
||||
$this->Session->setFlash(__('The customer must already exist in the database. Please try again', true));
|
||||
$this->redirect(array('action'=>'add'));
|
||||
}
|
||||
$this->set('customer', $customer);
|
||||
$contacts = $this->Enquiry->Contact->find('list', array('conditions' => array('Contact.customer_id' => $customer['Customer']['id'])));
|
||||
$this->set('step',2);
|
||||
|
||||
$this->set('contacts', $contacts);
|
||||
|
||||
$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);
|
||||
|
||||
/* Feels like an ugly hack. But it gets the desired effect and it will do for now */
|
||||
|
||||
if(isset($customerAddresses[0]['BillingAddress'])) {
|
||||
foreach ($customerAddresses as $address) {
|
||||
$i = $address['BillingAddress']['id'];
|
||||
$billing_address_list[$i] = $address['BillingAddress']['address'].'<br>'.$address['BillingAddress']['city'].' '.$address['State']['name'].' '.$address['BillingAddress']['postcode'].'<br>'.up($address['Country']['name']).'<br><br>';
|
||||
}
|
||||
$this->set('billing_addresses_list', $billing_address_list);
|
||||
$this->set('shipping_addresses_list', $billing_address_list);
|
||||
}
|
||||
else {
|
||||
$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');
|
||||
}
|
||||
$this->__showPage2($customer);
|
||||
$this->render();
|
||||
|
||||
}
|
||||
|
||||
if ( (!empty($this->data)) && ($this->data['Enquiry']['finished'] == 'true') ) {
|
||||
/*
|
||||
$this->Enquiry->set($this->data);
|
||||
/* Page to display if Validation Fails
|
||||
if( !($this->Enquiry->validates()) ) {
|
||||
$customer = $this->Enquiry->Customer->findByName($this->data['Customer']['name']);
|
||||
|
||||
/* Feels like an ugly hack. But it gets the desired effect and it will do for now */
|
||||
|
||||
if(isset($customerAddresses[0]['BillingAddress'])) {
|
||||
foreach ($customerAddresses as $address) {
|
||||
$i = $address['BillingAddress']['id'];
|
||||
$billing_address_list[$i] = $address['BillingAddress']['address'].'<br>'.$address['BillingAddress']['city'].' '.$address['State']['name'].' '.$address['BillingAddress']['postcode'].'<br>'.up($address['Country']['name']).'<br><br>';
|
||||
}
|
||||
$this->set('billing_addresses_list', $billing_address_list);
|
||||
$this->set('shipping_addresses_list', $billing_address_list);
|
||||
}
|
||||
else {
|
||||
$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');
|
||||
}
|
||||
|
||||
|
||||
$this->set('customer', $customer);
|
||||
$contacts = $this->Enquiry->Contact->find('list', array('conditions' => array('Contact.customer_id' => $customer['Customer']['id'])));
|
||||
$this->set('contacts', $contacts);
|
||||
$this->set('billing_addresses', $this->Enquiry->BillingAddress->find('list', array('conditions'=>array('BillingAddress.customer_id' => $customer['Customer']['id']))));
|
||||
$this->set('shipping_addresses', $this->Enquiry->ShippingAddress->find('list', array('conditions'=>array('ShippingAddress.customer_id' => $customer['Customer']['id']))));
|
||||
$this->set('errors', $this->Enquiry->invalidFields());
|
||||
$this->set('step',2);
|
||||
$this->render();
|
||||
|
||||
$this->__showPage2($this->data);
|
||||
|
||||
}
|
||||
*
|
||||
else {
|
||||
*/
|
||||
$this->Enquiry->create();
|
||||
|
||||
$enquiryno = $this->__generateEnquiryNumber($this->data);
|
||||
$this->data['Enquiry']['title'] = $enquiryno;
|
||||
$principle = $this->Enquiry->Principle->findById($this->data['Enquiry']['principle_id']);
|
||||
$this->data['Enquiry']['principle_code'] = $principle['Principle']['code']; //Store which principle code this enquiry belongs to.
|
||||
Sanitize::clean($this->data);
|
||||
if(isset($this->data['Contact']['new'])) {
|
||||
if($this->data['Contact']['new']) {
|
||||
$this->Enquiry->Contact->save($this->data);
|
||||
$this->data['Enquiry']['contact_id'] = $this->Enquiry->Contact->id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($this->Enquiry->save($this->data)) {
|
||||
$id = $this->Enquiry->id;
|
||||
$this->__sendNewEnquiryEmail($id);
|
||||
} else {
|
||||
$this->Session->setFlash(__('The Enquiry could not be saved. Please, try again.', true));
|
||||
$this->__showPage2($this->Enquiry->Customer->findById($this->data['Enquiry']['customer_id']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
|
||||
/* 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 = 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'));
|
||||
$principles = $this->Enquiry->Principle->find('list', array('order' => 'Principle.name asc'));
|
||||
$statuses = $this->Enquiry->Status->find('list');
|
||||
$users = $this->Enquiry->User->find('list', array('fields' => array('User.id', 'User.username')));
|
||||
$this->set(compact('users', 'customers', 'states', 'countries', 'principles', 'statuses', 'contacts', 'customer'));
|
||||
$this->set('step',2);
|
||||
$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());
|
||||
/* Feels like an ugly hack. But it gets the desired effect and it will do for now */
|
||||
|
||||
if(isset($customerAddresses[0]['BillingAddress'])) {
|
||||
foreach ($customerAddresses as $address) {
|
||||
$i = $address['BillingAddress']['id'];
|
||||
$billing_address_list[$i] = $address['BillingAddress']['address'].'<br>'.$address['BillingAddress']['city'].' '.$address['State']['name'].' '.$address['BillingAddress']['postcode'].'<br>'.up($address['Country']['name']).'<br><br>';
|
||||
}
|
||||
$this->set('billing_addresses_list', $billing_address_list);
|
||||
$this->set('shipping_addresses_list', $billing_address_list);
|
||||
}
|
||||
else {
|
||||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Generate Enquiry number and return it as a string */
|
||||
|
||||
|
|
@ -278,7 +265,7 @@ class EnquiriesController extends AppController {
|
|||
$this->redirect(array('action'=>'view/'.$id), null, false);
|
||||
}
|
||||
else {
|
||||
$this->Session->setFlash(__('The Enquiry has been added abut email to the contact has NOT been sent. Something went wrong.', true));
|
||||
$this->Session->setFlash(__('The Enquiry has been added but email to the contact has NOT been sent. Something went wrong.', true));
|
||||
$this->redirect(array('action'=>'view/'.$id), null, false);
|
||||
$this->set('smtp-errors', $this->Email->smtpError);
|
||||
}
|
||||
|
|
@ -306,7 +293,9 @@ class EnquiriesController extends AppController {
|
|||
$enquiry = $this->Enquiry->read(null, $id);
|
||||
$users = $this->Enquiry->User->find('list', array('fields' => array('User.id', 'User.username')));
|
||||
$customer = $this->Enquiry->Customer->findById($enquiry['Enquiry']['customer_id']);
|
||||
$contacts = $this->Enquiry->Contact->find('list', array('conditions' => array('Contact.customer_id' => $enquiry['Enquiry']['customer_id'] )));
|
||||
|
||||
$contacts = $this->Enquiry->Contact->find('all', array('conditions' => array('Contact.customer_id' => $enquiry['Enquiry']['customer_id'])));
|
||||
$contacts = Set::Combine($contacts, '{n}.Contact.id', array('{0} {1}', '{n}.Contact.first_name', '{n}.Contact.last_name'));
|
||||
$state = $this->Enquiry->State->findById($enquiry['Enquiry']['state_id']);
|
||||
$country = $this->Enquiry->Country->findById($enquiry['Enquiry']['country_id']);
|
||||
$principle = $this->Enquiry->Principle->findById($enquiry['Enquiry']['principle_id']);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,45 @@ class Address extends AppModel {
|
|||
|
||||
var $name = 'Address';
|
||||
|
||||
var $validate = array(
|
||||
'address' => array(
|
||||
'rule' => array('notEmpty'),
|
||||
'message' => 'Please Enter the Addess',
|
||||
'required' => true,
|
||||
'allowEmpty' => false
|
||||
),
|
||||
|
||||
'city' => array(
|
||||
'rule' => array('notEmpty'),
|
||||
'message' => 'Please Enter the City',
|
||||
'required' => true,
|
||||
'allowEmpty' => false
|
||||
),
|
||||
'state_id' => array(
|
||||
'rule' => array('notEmpty'),
|
||||
'message' => 'Please select the State',
|
||||
'required' => true,
|
||||
'allowEmpty' => false
|
||||
),
|
||||
'postcode' => array(
|
||||
'rule' => array('notEmpty'),
|
||||
'message' => 'Please enter the Post Code',
|
||||
'required' => true,
|
||||
'allowEmpty' => false
|
||||
),
|
||||
'country_id' => array(
|
||||
'rule' => array('notEmpty'),
|
||||
'message' => 'Please select the Country',
|
||||
'required' => true,
|
||||
'allowEmpty' => false
|
||||
),
|
||||
'type' => array(
|
||||
'rule' => array('notEmpty'),
|
||||
'message' => 'Please select the Type of Address',
|
||||
'required' => true,
|
||||
'allowEmpty' => false
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,11 @@ class Enquiry extends AppModel {
|
|||
'message' => 'User ID must be selected',
|
||||
'on' => 'create'
|
||||
),
|
||||
|
||||
'title' => array(
|
||||
'rule' => 'notEmpty',
|
||||
'required' => true,
|
||||
'on' => 'create'
|
||||
),
|
||||
'customer_id' => array(
|
||||
'rule' => 'numeric',
|
||||
'required' => true,
|
||||
|
|
@ -24,6 +28,7 @@ class Enquiry extends AppModel {
|
|||
'message' => 'Must choose a Contact for this Enquiry',
|
||||
'on' => 'create'
|
||||
),
|
||||
|
||||
'customer_id' => array(
|
||||
'rule' => 'numeric',
|
||||
'required' => true,
|
||||
|
|
@ -65,7 +70,7 @@ class Enquiry extends AppModel {
|
|||
'gst' => array(
|
||||
'rule' => 'numeric',
|
||||
'required' => true,
|
||||
'message' => 'Must slect whether GST is applicable for this Enquiry',
|
||||
'message' => 'Must select whether GST is applicable for this Enquiry',
|
||||
'on' => 'create'
|
||||
)
|
||||
);
|
||||
|
|
|
|||
1
tmp/.gitignore
vendored
Normal file
1
tmp/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
*/*
|
||||
16
views/addresses/add_another.ctp
Normal file
16
views/addresses/add_another.ctp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<legend><?php __('Add An Address');?></legend> <? echo $ajax->link('Remove this', array('controller' => 'addresses', 'action' => 'remove_another', $increment), array('update' => 'addresses'.$increment)); ?>
|
||||
<?php
|
||||
|
||||
echo $form->input("Address.$increment.address", array('label' => 'Address', 'title' => 'The Address to be added'));
|
||||
echo $form->input("Address.$increment.city", array('label' => 'City', 'title' => 'Name of the City/Suburb for this Address'));
|
||||
echo $form->input("Address.$increment.state_id", array('value' => $states));
|
||||
echo $form->input("Address.$increment.postcode", array('label' => 'Post Code', 'title' => 'The Post Code for this Address. Eg. 2015 for Alexandria'));
|
||||
echo $form->input("Address.$increment.country_id", array('value' => $countries));
|
||||
echo $form->input("Address.$increment.type", array('label' => 'Address Type (Billing,Shipping or Both)', 'options' => array('Billing','Shipping', 'Both Shipping and Billing', 'Other')));
|
||||
|
||||
|
||||
$next = $increment;
|
||||
$next++;
|
||||
echo $ajax->link('Add another Address to this New Customer', array('controller' => 'addresses', 'action' => 'add_another',$next), array('update'=>'addresses'.$next));
|
||||
?>
|
||||
<div id="addresses<?php echo $next; ?>"></div>
|
||||
|
|
@ -9,7 +9,6 @@ echo $paginator->counter(array(
|
|||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<th><?php echo $paginator->sort('id');?></th>
|
||||
<th><?php echo $paginator->sort('name');?></th>
|
||||
<th><?php echo $paginator->sort('address');?></th>
|
||||
<th><?php echo $paginator->sort('city');?></th>
|
||||
<th><?php echo $paginator->sort('state_id');?></th>
|
||||
|
|
@ -30,9 +29,6 @@ foreach ($addresses as $address):
|
|||
<td>
|
||||
<?php echo $address['Address']['id']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $address['Address']['name']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $address['Address']['address']; ?>
|
||||
</td>
|
||||
|
|
|
|||
6
views/addresses/remove_another.ctp
Normal file
6
views/addresses/remove_another.ctp
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?
|
||||
|
||||
if($increment == 0) {
|
||||
echo $ajax->link('Add an Address to this New Customer', array('controller' => 'addresses', 'action' => 'add_another',0), array('update'=>'addresses0'));
|
||||
}
|
||||
?>
|
||||
|
|
@ -4,7 +4,6 @@
|
|||
<legend><?php __('Add Contact');?></legend>
|
||||
<?php
|
||||
echo $form->input('customer_id');
|
||||
echo $form->input('name');
|
||||
echo $form->input('first_name');
|
||||
echo $form->input('last_name');
|
||||
echo $form->input('email');
|
||||
|
|
|
|||
19
views/contacts/add_another.ctp
Normal file
19
views/contacts/add_another.ctp
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
<legend><?php __('Add A Contact');?></legend> <? echo $ajax->link('Remove this', array('controller' => 'contacts', 'action' => 'remove_another', $increment), array('update' => 'contacts'.$increment));
|
||||
|
||||
?>
|
||||
<?
|
||||
|
||||
echo $form->input("Contact.$increment.first_name");
|
||||
echo $form->input("Contact.$increment.last_name");
|
||||
echo $form->input("Contact.$increment.email");
|
||||
echo $form->input("Contact.$increment.phone");
|
||||
echo $form->input("Contact.$increment.mobile");
|
||||
echo $form->input("Contact.$increment.fax");
|
||||
echo $form->input("Contact.$increment.notes");
|
||||
|
||||
$next = $increment;
|
||||
$next++;
|
||||
echo $ajax->link('Add another Contact to this New Customer', array('controller' => 'contacts', 'action' => 'add_another',$next), array('update'=>'contacts'.$next));
|
||||
?>
|
||||
<div id="contacts<?php echo $next; ?>"></div>
|
||||
17
views/contacts/add_one.ctp
Normal file
17
views/contacts/add_one.ctp
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php /* add_one.ctp - Used via AJAX from the Add new Enquiry page */ ?>
|
||||
|
||||
<legend><?php __('New Contact');?></legend> <? echo $ajax->link('Remove this', array('controller' => 'contacts', 'action' => 'remove_one', $customerid), array('update' => 'contact'));
|
||||
|
||||
?>
|
||||
<?
|
||||
|
||||
echo $form->input("Contact.new", array('type'=>'hidden', 'value' => 'yes'));
|
||||
echo $form->input("Contact.first_name");
|
||||
echo $form->input("Contact.last_name");
|
||||
echo $form->input("Contact.email");
|
||||
echo $form->input("Contact.phone");
|
||||
echo $form->input("Contact.mobile");
|
||||
echo $form->input("Contact.fax");
|
||||
echo $form->input("Contact.notes");
|
||||
echo $form->input("Contact.customer_id", array('type'=>'hidden', 'value' => $customerid));
|
||||
?>
|
||||
|
|
@ -10,7 +10,6 @@ echo $paginator->counter(array(
|
|||
<tr>
|
||||
<th><?php echo $paginator->sort('customer_id');?></th>
|
||||
<th><?php echo $paginator->sort('id');?></th>
|
||||
<th><?php echo $paginator->sort('name');?></th>
|
||||
<th><?php echo $paginator->sort('first_name');?></th>
|
||||
<th><?php echo $paginator->sort('last_name');?></th>
|
||||
<th><?php echo $paginator->sort('email');?></th>
|
||||
|
|
@ -34,9 +33,7 @@ foreach ($contacts as $contact):
|
|||
<td>
|
||||
<?php echo $contact['Contact']['id']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $contact['Contact']['name']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $contact['Contact']['first_name']; ?>
|
||||
</td>
|
||||
|
|
|
|||
7
views/contacts/remove_another.ctp
Normal file
7
views/contacts/remove_another.ctp
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?
|
||||
|
||||
if($increment == 0) {
|
||||
echo $ajax->link('Add A Contact to this New Customer', array('controller' => 'contacts', 'action' => 'add_another',0), array('update'=>'contacts0'));
|
||||
}
|
||||
?>
|
||||
|
||||
4
views/contacts/remove_one.ctp
Normal file
4
views/contacts/remove_one.ctp
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?
|
||||
echo $form->input('contact_id', array('options' => $contacts));
|
||||
echo $ajax->link('New Contact', array('controller' => 'contacts', 'action' => 'add_one', $customerid), array('update'=>'contact'));
|
||||
?>
|
||||
|
|
@ -1,37 +1,40 @@
|
|||
|
||||
<div class="tipbox">
|
||||
<span class="tip">Tip: When adding/removing Contact/Address entry forms, removing the first contact/address form will remove all of the dynamically added forms. <br><br>Also note, do not submit blank Contacts or Addresses - it may cause validation to fail and you'll have to reenter the data. Remove any Contacts/Address forms you don't need.</span>
|
||||
</div>
|
||||
<div class="customers form">
|
||||
|
||||
<?php echo $form->create('Customer', array('action'=>'add'));?>
|
||||
<fieldset>
|
||||
<legend><?php __('Add Customer');?></legend>
|
||||
<?php
|
||||
echo $form->input('name', array('label'=>'Company Name', 'title' => 'The Company Name. Eg. XYZ Business Pty Ltd'));
|
||||
echo $form->input('abn', array('label'=>'ABN', 'title' => 'The 11-digit Australian Business Number for the new Customer. Enter numbers only, no dashes or punctuation'));
|
||||
echo '<br><span>You will be able to add Contacts and Addresses to this Customer after it has been created</span>';
|
||||
echo "<br><br><span>Please <b>make sure</b> that the Customer you are adding doesn't already exist on the ".$html->link('Customers Index', array('action' => 'index'))."</span>";
|
||||
/*
|
||||
echo '<br><span>Add a Contact to this new Customer</span>';
|
||||
echo $form->input('Contact.0.first_name');
|
||||
echo $form->input('Contact.0.last_name');
|
||||
echo $form->input('Contact.0.email');
|
||||
echo $form->input('Contact.0.phone');
|
||||
echo $form->input('Contact.0.mobile');
|
||||
echo $form->input('Contact.0.fax');
|
||||
echo $form->input('Contact.0.notes');
|
||||
*/
|
||||
/*echo '<br><span>Add an Address for this Customer</span>';
|
||||
echo $form->input('Address.0.name', array('label'=>'Short Name', 'title' => 'Short Name for this Address. eg. \'Head Quarters\', \'Manufacturing Plant No 7\' '));
|
||||
echo $form->input('Address.0.address');
|
||||
echo $form->input('Address.0.city');
|
||||
echo $form->input('Address.0.state_id');
|
||||
echo $form->input('Address.0.country_id');
|
||||
echo $form->input('Address.0.type', array('label' => 'Address Type (Billing,Shipping or Both)', 'options' => array('Billing','Shipping', 'Both Shipping and Billing')));
|
||||
*/
|
||||
echo "<br><br><span class=\"warning\">Please <i>make sure</i> that the Customer you are adding doesn't already exist on the ".$html->link('Customers Index', array('action' => 'index'))."</span>";
|
||||
echo '<br><br>';
|
||||
?>
|
||||
<div id="contacts0">
|
||||
<? echo $ajax->link('Add A Contact to this New Customer', array('controller' => 'contacts', 'action' => 'add_another',0), array('update'=>'contacts0'));
|
||||
echo $html->image('contact-new.png');
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div id="addresses0">
|
||||
<?
|
||||
echo $ajax->link('Add an Address to this New Customer', array('controller' => 'addresses', 'action' => 'add_another',0), array('update'=>'addresses0')); ?>
|
||||
<? echo $html->image('address-book-new.png'); ?>
|
||||
</div>
|
||||
|
||||
<?
|
||||
echo $form->end('Submit');
|
||||
?>
|
||||
|
||||
|
||||
</fieldset>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<ul>
|
||||
<li><?php echo $html->link(__('List Customers', true), array('action'=>'index'));?></li>
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
}
|
||||
?>
|
||||
<tr<?php echo $class;?>>
|
||||
<td><?php echo $contact['name'];?></td>
|
||||
<td><?php echo $contact['first_name'].' '.$contact['last_name'];?></td>
|
||||
<td><?php echo $html->link($contact['email'], 'mailto:'.$contact['email']);?></td>
|
||||
<td><?php echo $contact['phone'];?></td>
|
||||
<td><?php echo $contact['fax'];?></td>
|
||||
|
|
|
|||
|
|
@ -88,8 +88,8 @@ foreach ($enquiries as $enquiry):
|
|||
<td>
|
||||
<?php echo $html->link($enquiry['Customer']['name'], array('controller'=> 'customers', 'action'=>'view', $enquiry['Customer']['id'])); ?>
|
||||
</td>
|
||||
<td class = "nowrap">
|
||||
<?php echo $html->link($enquiry['Contact']['name'], array('controller'=> 'contacts', 'action'=>'view', $enquiry['Contact']['id'])); ?>
|
||||
<td>
|
||||
<?php echo $html->link($enquiry['Contact']['first_name'].' '.$enquiry['Contact']['last_name'], array('controller'=> 'contacts', 'action'=>'view', $enquiry['Contact']['id'])); ?>
|
||||
</td>
|
||||
<td>
|
||||
<? //BCC address to Con is hardcoded in here. ?>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
<div class="tipbox">
|
||||
<span class="tip">
|
||||
Tip: You can add a new Contact to an Existing Customer while creating the enquiry. If the Contact you want to assign to the enquiry
|
||||
doesn't appear in the drop down list, click 'New Contact'
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="enquiries form">
|
||||
<?php echo $form->create('Enquiry');?>
|
||||
<fieldset>
|
||||
|
|
@ -17,8 +24,14 @@
|
|||
else {
|
||||
//echo $form->select('Contact.id', array(), null, array('id'=>'contacts'));
|
||||
echo $form->input('Customer.name', array('readonly'=>'readonly', 'value'=>$customer['Customer']['name']));
|
||||
|
||||
echo $form->input('user_id', array('label' =>'Assigned to User'), $users);
|
||||
echo $form->input('contact_id');
|
||||
echo '<div id="contact">';
|
||||
echo $form->input('contact_id', array('div' => false));
|
||||
echo '<br>';
|
||||
echo $ajax->link('New Contact', array('controller' => 'contacts', 'action' => 'add_one',$customer['Customer']['id']), array('update'=>'contact'));
|
||||
echo $html->image('contact-new.png');
|
||||
echo '</div>';
|
||||
echo '<span>The Contact will be emailed informing them of the new Enquiry</span>';
|
||||
echo $form->input('state_id');
|
||||
echo $form->input('country_id');
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
</dd>
|
||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Contact'); ?></dt>
|
||||
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
||||
<?php echo $html->link($enquiry['Contact']['name'], array('controller'=> 'contacts', 'action'=>'view', $enquiry['Contact']['id'])); ?>
|
||||
<?php echo $html->link($enquiry['Contact']['first_name'].' '.$enquiry['Contact']['last_name'], array('controller'=> 'contacts', 'action'=>'view', $enquiry['Contact']['id'])); ?>
|
||||
|
||||
</dd>
|
||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('State'); ?></dt>
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ dd.altrow {
|
|||
|
||||
/* Forms */
|
||||
form {
|
||||
clear: both;
|
||||
clear: left;
|
||||
margin-right: 20px;
|
||||
padding: 0;
|
||||
width: 50%;
|
||||
|
|
@ -671,6 +671,14 @@ div.auto_complete {
|
|||
margin :0px;
|
||||
padding :0px;
|
||||
}
|
||||
|
||||
div.tipbox {
|
||||
float: right;
|
||||
width: 30%;
|
||||
border: 1px dashed #000000;
|
||||
background: #90EE90;
|
||||
}
|
||||
|
||||
li.selected { background-color: #ffb; }
|
||||
|
||||
span {
|
||||
|
|
@ -682,6 +690,14 @@ span {
|
|||
span.note {
|
||||
font-size: 85%;
|
||||
}
|
||||
span.warning {
|
||||
font-size: 80%;
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
span.tip {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
div#qTip {
|
||||
padding: 3px;
|
||||
|
|
|
|||
BIN
webroot/img/edit-undo.png
Normal file
BIN
webroot/img/edit-undo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Loading…
Reference in a new issue