Ajax loading icon. Search now finds customer PO and Job numbers

This commit is contained in:
Karl Cordes 2010-05-20 15:15:57 +10:00
parent 2751bd4ee0
commit 857bc1b986
5 changed files with 69 additions and 5 deletions

View file

@ -482,7 +482,14 @@ class EnquiriesController extends AppController {
$this->set('status_list', $status_list);
$this->set(compact('customerResults', 'enquiryResults', 'contactResults', 'searchDone', 'status_list'));
$jobConditions = array('OR' =>array("Job.title LIKE" =>"%$searchQuery%",
"Job.customer_order_number LIKE" =>"%$searchQuery%"));
$jobResults = $this->Enquiry->Job->find('all', array('conditions'=>$jobConditions, 'recursive'=>1));
$this->set(compact('customerResults', 'enquiryResults', 'contactResults', 'searchDone', 'status_list',
'jobResults'));
$this->layout = 'ajax';
}

View file

@ -2,7 +2,7 @@
<?php $enqCount = count($enquiryResults);
$custCount = count($customerResults);
$contactCount = count($contactResults);
$jobCount = count($jobResults);
?>
@ -145,7 +145,45 @@
</table>
<?php endif;?>
<?php if( ($contactCount == 0) && ($enqCount == 0) && ($custCount == 0) ) {
<?php if($jobCount > 0): ?>
<h2><?php echo $jobCount; ?> Matching Jobs</h2>
<table>
<tr>
<th>Date Order Received</th>
<th>Job Number</th>
<th>Enquiry</th>
<th>Customer PO Number</th>
</tr>
<?php
$i = 0;
foreach($jobResults as $job): ?>
<? if($i % 2 == 0) {
echo "<tr>";
}
else {
echo '<tr class="altrow">';
}
?>
<td><?php echo $job['Job']['date_order_received']; ?></td>
<td><?php echo $job['Job']['title']; ?></td>
<td><?php echo $job['Enquiry']['title']; ?></td>
<td><?php echo $job['Job']['customer_order_number']; ?></td>
</tr>
<?
$i++;
endforeach; ?>
</table>
<?php endif; ?>
<?php if( ($contactCount == 0) && ($enqCount == 0) && ($custCount == 0) && ($jobCount == 0) ) {
echo "<h2>No matching records found :( Try modifying your search terms</h2>";
}
?>

View file

@ -23,6 +23,7 @@
echo $javascript->link('jquery.form');
echo $javascript->link('menu');
echo $javascript->link('search');
//echo $javascript->link('ajaxLoader');
echo $javascript->link('ckeditor/adapters/jquery');
echo $scripts_for_layout;
@ -155,7 +156,7 @@
echo '<h2>Search';
echo $html->image('system-search.png');
echo '</h2>';
echo "<p>Enter part of an Enquiry Number, Customer Name or Contact Name</p>";
echo "<p>Search for anything: Enquiry Number, Job Number, Customer, Contact or Customer Order Number</p>";
echo $form->input('Enquiry.search_string', array('label'=>false, 'id'=>'searchString'));
//echo $form->input('Customer.id', array('type'=>'hidden'));
@ -169,7 +170,7 @@
</div>
<div id="ajaxLoading"><?php echo $html->image('ajax-loader.gif'); ?></div>
<div id="results"></div>
</div>
@ -188,6 +189,9 @@
?>
<?php echo $cakeDebug; ?>
</body>

View file

@ -1222,4 +1222,11 @@ form.cmxform fieldset fieldset label {
select.editinplace {
text-size: 80%;
font-weight: normal;
}
#ajaxLoading {
position: relative;
margin-top: 10em;
margin-left: 10em;
}

View file

@ -8,6 +8,14 @@
$(function() {
$("#ajaxLoading").hide();
$("#ajaxLoading").bind("ajaxSend", function() {
$(this).show();
}).bind("ajaxComplete", function() {
$(this).hide();
});