Changed find customer to jquery dialog box instead of autocomplete

This commit is contained in:
Karl Cordes 2010-03-30 10:36:29 +11:00
parent c760e58b22
commit d6c6dbc866
5 changed files with 34 additions and 37 deletions

View file

@ -30,6 +30,7 @@ class PrinciplesController extends AppController {
$status_list[] = array($status['Status']['id'], $status['Status']['name']);
}
$this->set('status_list', $status_list);
$this->set('enquiries', $this->paginate('Enquiry', array('Enquiry.principle_id' => $id)));
}

View file

@ -9,12 +9,17 @@
echo $form->input('Customer.name', array('Label'=>'Customer Name', 'id'=>'customerName', 'div'=>'ui-widget'));
echo $form->input('Customer.id', array('type'=>'hidden'));
//echo $form->input('Customer.id', array('type'=>'hidden'));
echo $form->end('Find');
//echo $form->end('Find');
?>
</div>
<div id="dialog" title="Search Results">
<ul id="similarCustList">
</ul>
</div>

View file

@ -85,20 +85,10 @@
<?php if (!empty($principle['Product'])):?>
<table cellpadding = "0" cellspacing = "0">
<tr>
<th><?php __('Id'); ?></th>
<th><?php __('Principle Id'); ?></th>
<th><?php __('Title'); ?></th>
<th><?php __('Description'); ?></th>
<th><?php __('Principle Part Number'); ?></th>
<th><?php __('Cmc Part Number'); ?></th>
<th><?php __('Costprice Each'); ?></th>
<th><?php __('Our Discount'); ?></th>
<th><?php __('Packing Each'); ?></th>
<th><?php __('Shipping Weight Each'); ?></th>
<th><?php __('Shipping Cost Each'); ?></th>
<th><?php __('Duty'); ?></th>
<th><?php __('Target Gp'); ?></th>
<th><?php __('Sellprice Each'); ?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
@ -110,20 +100,10 @@
}
?>
<tr<?php echo $class;?>>
<td><?php echo $product['id'];?></td>
<td><?php echo $product['principle_id'];?></td>
<td><?php echo $product['title'];?></td>
<td><?php echo $product['description'];?></td>
<td><?php echo $product['principle_part_number'];?></td>
<td><?php echo $product['cmc_part_number'];?></td>
<td><?php echo $product['costprice_each'];?></td>
<td><?php echo $product['our_discount'];?></td>
<td><?php echo $product['packing_each'];?></td>
<td><?php echo $product['shipping_weight_each'];?></td>
<td><?php echo $product['shipping_cost_each'];?></td>
<td><?php echo $product['duty'];?></td>
<td><?php echo $product['target_gp'];?></td>
<td><?php echo $product['sellprice_each'];?></td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller'=> 'products', 'action'=>'view', $product['id'])); ?>
<?php echo $html->link(__('Edit', true), array('controller'=> 'products', 'action'=>'edit', $product['id'])); ?>

View file

@ -3,7 +3,7 @@
*
* used in customers/add.ctp
*
* Not really an autocomplete, updates a dialog box with similar customer names to try and stop duplicate entries.
* Not an autocomplete anymore, updates a dialog box with similar customer names to try and stop duplicate entries.
*/

View file

@ -2,23 +2,34 @@
* filename: findcustomer.js
*
* used in: customers/find.ctp
* @todo: This doesn't update the ID for some reason.
*
*/
$(function() {
$("#dialog").hide();
$("#customerName").autocomplete({
source: "/customers/completeCustomer",
minLength: 3,
select: function(event, ui) {
$("#CustomerId").val(ui.item.id);
}
/*If the user has entered 3 or more characters. Check to see if its similar to existing customers. */
$("#customerName").change(function () {
if($("#customerName").val().length >= 3) {
$.post("/customers/similarCustomers", $("#customerName").serialize(), function(data) {
$("#similarCustList").html(data);
});
$("#dialog").dialog({
position: 'center',
width: 400
});
}
})
}