Menu jquery-ified. Add customer autocomplete replaced with custom dialog box
This commit is contained in:
parent
a6873f7823
commit
625eb8e42a
|
|
@ -101,11 +101,13 @@ class CustomersController extends AppController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Autocomplete the customer name - Used in: add.ctp */
|
/* Autocomplete the customer name - Used in: find.ctp */
|
||||||
function completeCustomer() {
|
function completeCustomer() {
|
||||||
|
|
||||||
$query = strtolower($_GET["term"]);
|
$query = strtolower($_GET["term"]);
|
||||||
|
|
||||||
|
//$this->set('customers_json', print_r($this->data));
|
||||||
|
|
||||||
if($query == null) {
|
if($query == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -142,6 +144,28 @@ class CustomersController extends AppController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function similarCustomers() {
|
||||||
|
App::import('Core', 'Sanitize');
|
||||||
|
|
||||||
|
$query = Sanitize::clean($this->data['Customer']['name']);
|
||||||
|
|
||||||
|
|
||||||
|
$customers = $this->Customer->find('all', array(
|
||||||
|
'conditions' => array(
|
||||||
|
'Customer.name LIKE' => '%'.$query.'%'
|
||||||
|
),'fields' => array('Customer.name'),
|
||||||
|
'order' => array('Customer.name ASC')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
$this->set('customers', $customers);
|
||||||
|
$this->layout = 'ajax';
|
||||||
|
}
|
||||||
|
|
||||||
function find() {
|
function find() {
|
||||||
if(!empty($this->data)) {
|
if(!empty($this->data)) {
|
||||||
$customer = $this->Customer->findByName($this->data['Customer']['name']);
|
$customer = $this->Customer->findByName($this->data['Customer']['name']);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo $form->input('name', array('id'=>'customerName'));
|
echo $form->input('name', array('id'=>'customerName'));
|
||||||
echo "<br><br><span class=\"warning\">If the Customer you are adding appears automatically, it already exists in the ".$html->link('Customers Index', array('action' => 'index')). "<br>Do Not Add Duplicates.</span>";
|
|
||||||
|
|
||||||
echo $form->input('country_name', array('default'=>'Australia'));
|
echo $form->input('country_name', array('default'=>'Australia'));
|
||||||
echo $form->input('country_id', array('type'=>'hidden', 'value'=>1));
|
echo $form->input('country_id', array('type'=>'hidden', 'value'=>1));
|
||||||
|
|
@ -44,3 +43,9 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="dialog" title="Is this customer already in the database?">
|
||||||
|
<p>Please confirm the customer you are adding is not one of these customers:</p>
|
||||||
|
<ul id="similarCustList">
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
8
views/customers/similar_customers.ctp
Normal file
8
views/customers/similar_customers.ctp
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
<?
|
||||||
|
foreach ($customers as $customer) {
|
||||||
|
echo "<li>";
|
||||||
|
echo $html->link($customer['Customer']['name'],array('controller'=>'customers', 'action'=>'view',$customer['Customer']['id']));
|
||||||
|
echo "</li>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
echo $javascript->link('jquery-ui');
|
echo $javascript->link('jquery-ui');
|
||||||
echo $javascript->link('jquery.form');
|
echo $javascript->link('jquery.form');
|
||||||
|
echo $javascript->link('menu');
|
||||||
|
|
||||||
|
|
||||||
echo $scripts_for_layout;
|
echo $scripts_for_layout;
|
||||||
|
|
@ -50,59 +51,58 @@
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id = "nav">
|
<div id = "navdiv">
|
||||||
<ul id="nav">
|
<ul id="nav">
|
||||||
<li><h3><?php echo $html->link('Enquiries', '/enquiries/index'); ?></h3>
|
<li><?php echo $html->link('Enquiries', '/enquiries/index'); ?><ul>
|
||||||
<ul>
|
<li class="last"><?php echo $html->link('Enquiry Register', '/enquiries/index'); ?></li>
|
||||||
<li><?php echo $html->link('Enquiry Register', '/enquiries/index'); ?></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li><h3><?php echo $html->link('Customers', '/customers/index'); ?></h3>
|
<li><?php echo $html->link('Customers', '/customers/index'); ?>
|
||||||
<ul>
|
<ul>
|
||||||
<li><?php echo $html->link('Customer Index', '/customers/index'); ?></li>
|
<li><?php echo $html->link('Customer Index', '/customers/index'); ?></li>
|
||||||
<li><?php echo $html->link('Find Customer', '/customers/find'); ?></li>
|
<li><?php echo $html->link('Find Customer', '/customers/find'); ?></li>
|
||||||
<li><?php echo $html->link('Add Customer', '/customers/add'); ?></li>
|
<li><?php echo $html->link('Add Customer', '/customers/add'); ?></li>
|
||||||
<li><?php echo $html->link('Industries', '/industries/index'); ?></li>
|
<li class="last"><?php echo $html->link('Industries', '/industries/index'); ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li><h3><?php echo $html->link('Contacts', '/contacts/index'); ?></h3>
|
<li><?php echo $html->link('Contacts', '/contacts/index'); ?>
|
||||||
<ul>
|
<ul>
|
||||||
<li><?php echo $html->link('Contact Index', '/contacts/index'); ?></li>
|
<li><?php echo $html->link('Contact Index', '/contacts/index'); ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li><h3><?php echo $html->link('Products', '/products/index'); ?></h3>
|
<li><?php echo $html->link('Products', '/products/index'); ?>
|
||||||
<ul>
|
<ul>
|
||||||
<li><?php echo $html->link('Product Index', '/products/index'); ?></li>
|
<li><?php echo $html->link('Product Index', '/products/index'); ?></li>
|
||||||
<li><?php echo $html->link('Add Product', '/products/add'); ?></li>
|
<li class="last"><?php echo $html->link('Add Product', '/products/add'); ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li><h3><?php echo $html->link('Quotes', '/quotes/index'); ?></h3>
|
<li><?php echo $html->link('Quotes', '/quotes/index'); ?>
|
||||||
<ul>
|
<ul>
|
||||||
<li><?php echo $html->link('Quote Index', '/quotes/index'); ?></li>
|
<li><?php echo $html->link('Quote Index', '/quotes/index'); ?></li>
|
||||||
<li><?php echo $html->link('Find Quote', '/quotes/find'); ?></li>
|
<li class="last"><?php echo $html->link('Find Quote', '/quotes/find'); ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li><h3><?php echo $html->link('Principles', '/principles/index'); ?></h3>
|
<li><?php echo $html->link('Principles', '/principles/index'); ?>
|
||||||
<ul>
|
<ul>
|
||||||
<li><?php echo $html->link('Principle Index', '/principles/index'); ?></li>
|
<li><?php echo $html->link('Principle Index', '/principles/index'); ?></li>
|
||||||
<li><?php echo $html->link('Add Principle', '/principles/add'); ?></li>
|
<li class="last"><?php echo $html->link('Add Principle', '/principles/add'); ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li><h3><?php echo $html->link('Users', '/users/index'); ?></h3>
|
<li><?php echo $html->link('Users', '/users/index'); ?>
|
||||||
<ul>
|
<ul>
|
||||||
<li><?php echo $html->link('Users Index', '/users/index'); ?></li>
|
<li><?php echo $html->link('Users Index', '/users/index'); ?></li>
|
||||||
<li><?php echo $html->link('Add User', '/users/add'); ?></li>
|
<li class="last"><?php echo $html->link('Add User', '/users/add'); ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><h3><?php echo $html->link('Help', '/pages/help'); ?></h3>
|
<li><?php echo $html->link('Help', '/pages/help'); ?>
|
||||||
<ul>
|
<ul>
|
||||||
<li><?php echo $html->link('About', '/pages/about'); ?></li>
|
<li class="last"><?php echo $html->link('About', '/pages/about'); ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
|
||||||
0
views/statuses/status_list.ctp
Normal file
0
views/statuses/status_list.ctp
Normal file
|
|
@ -135,7 +135,8 @@ ul.principle-emails {
|
||||||
#header{
|
#header{
|
||||||
|
|
||||||
/* background: #E9E9E9 url(../img/top-gradient2.png) repeat-x bottom; */
|
/* background: #E9E9E9 url(../img/top-gradient2.png) repeat-x bottom; */
|
||||||
background: #7bf47b url(../img/gradient-blue4.png) repeat-x bottom;
|
/* background: #4686c3 url(../img/gradient-blue4.png) repeat-x bottom; */
|
||||||
|
background: #4686c3;
|
||||||
/* background: #6BBA70; */
|
/* background: #6BBA70; */
|
||||||
padding-bottom: 2%;
|
padding-bottom: 2%;
|
||||||
}
|
}
|
||||||
|
|
@ -176,81 +177,95 @@ ul.principle-emails {
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* nav CSS based on http://www.queness.com/post/1047/easy-to-style-jquery-drop-down-menu-tutorial */
|
||||||
#nav {
|
#nav {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
list-style:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#nav h3 {
|
/* make the LI display inline */
|
||||||
font-size: 120%;
|
/* it's position relative so that position absolute */
|
||||||
font-weight: bold;
|
/* can be used in submenu */
|
||||||
color:#FFFFFF;
|
#nav li {
|
||||||
/* background: #E9E9E9; */
|
float:left;
|
||||||
padding-left: 0.1em;
|
display:block;
|
||||||
padding-top: 0;
|
width:120px;
|
||||||
padding-right: 0;
|
padding-right: 1em;
|
||||||
padding-bottom: 0;
|
position:relative;
|
||||||
|
z-index:500;
|
||||||
|
margin:0 1px;
|
||||||
|
background: #4686c3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#nav h3 a{
|
/* this is the parent menu */
|
||||||
font-size: 160%;
|
#nav li a {
|
||||||
font-weight: normal;
|
display:block;
|
||||||
color:#FFFFFF;
|
width: 120px;
|
||||||
width: 100%;
|
padding:8px 5px 0 5px;
|
||||||
/* background: #E9E9E9; */
|
height:23px;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
|
color:#fff;
|
||||||
|
text-align:center;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#nav h3 a:hover {
|
#nav li a:hover {
|
||||||
/* background: #E9E9E9; */
|
color:#fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
#nav, #nav ul { /* all lists */
|
/* you can make a different style for default selected value */
|
||||||
|
#nav a.selected {
|
||||||
|
color:#f00;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* submenu, it's hidden by default */
|
||||||
|
#nav ul {
|
||||||
|
position:absolute;
|
||||||
|
left:0;
|
||||||
|
display:none;
|
||||||
|
margin:0 0 0 -1px;
|
||||||
|
padding:0;
|
||||||
|
list-style:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav ul li {
|
||||||
|
float:left;
|
||||||
|
|
||||||
|
border-top:1px solid #000;
|
||||||
|
border-left:1px solid #000;
|
||||||
|
border-right:1px solid #000;
|
||||||
|
|
||||||
|
/* border: 1px solid #000;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* used in the nav. so the borders are clean and 1px without doubling up */
|
||||||
|
li .last {
|
||||||
|
border-bottom:1px solid #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* display block will make the link fill the whole area of LI */
|
||||||
|
#nav ul a {
|
||||||
|
display:block;
|
||||||
|
height: auto;
|
||||||
|
padding: 8px 5px;
|
||||||
|
font-size: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav ul a:hover {
|
||||||
|
text-decoration:underline;
|
||||||
|
}
|
||||||
|
/*used for the jquery menu */
|
||||||
|
.clear {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
list-style: none;
|
clear: both;
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nav a {
|
|
||||||
padding-left: 0.5em;
|
|
||||||
padding-bottom:0.5em;
|
|
||||||
display: block;
|
|
||||||
width: 10em;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#nav a:hover {
|
|
||||||
}
|
|
||||||
|
|
||||||
#nav li { /* all list items */
|
|
||||||
float: left;
|
|
||||||
width: 8em; /* width needed or else Opera goes nuts */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#nav li ul { /* second-level lists */
|
|
||||||
position: absolute;
|
|
||||||
width: 10em;
|
|
||||||
left: -999em; /* using left instead of display to hide menus because display: none it read by screen readers */
|
|
||||||
}
|
|
||||||
|
|
||||||
#nav li:hover ul, #nav li.sfhover ul { /* lists nested under hovered list items */
|
|
||||||
left: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nav li ul a {
|
|
||||||
background: #4687c3;
|
|
||||||
color: #FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nav li ul a:hover {
|
|
||||||
background:#5d9cd7;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* END NAV */
|
||||||
|
|
||||||
#content{
|
#content{
|
||||||
background: #fff;
|
background: #fff;
|
||||||
|
|
@ -1023,7 +1038,7 @@ div.tipbox {
|
||||||
li.selected { background-color: #ffb; }
|
li.selected { background-color: #ffb; }
|
||||||
|
|
||||||
span {
|
span {
|
||||||
color: #2F782A;
|
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,20 +9,25 @@
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
|
$("#dialog").hide();
|
||||||
|
$("#customerName").change(function () {
|
||||||
|
|
||||||
|
$("#dialog").dialog('close'); //Remove any previously opened dialogs
|
||||||
|
|
||||||
$("#customerName").autocomplete({
|
$.post("/customers/similarCustomers", $("#customerName").serialize(), function(data) {
|
||||||
|
$("#similarCustList").html(data);
|
||||||
source: "/customers/completeCustomer",
|
|
||||||
minLength: 1
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("#dialog").dialog({position: 'right', width: 400});
|
||||||
|
|
||||||
|
|
||||||
|
}),
|
||||||
|
|
||||||
|
|
||||||
$("#CustomerCountryName").autocomplete({
|
$("#CustomerCountryName").autocomplete({
|
||||||
source: "/countries/completeCountry",
|
source: "/countries/completeCountry",
|
||||||
minLength: 2,
|
minLength: 3,
|
||||||
select: function(event, ui) {
|
select: function(event, ui) {
|
||||||
//alert("You selected " + ui.item.value + " ID:"+ ui.item.id);
|
//alert("You selected " + ui.item.value + " ID:"+ ui.item.id);
|
||||||
$("#CustomerCountryId").val(ui.item.id);
|
$("#CustomerCountryId").val(ui.item.id);
|
||||||
|
|
|
||||||
73
webroot/js/enquiry_table_editinplace.js
Normal file
73
webroot/js/enquiry_table_editinplace.js
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
|
||||||
|
|
||||||
|
/* This file isn't currently in use. Should complete / fix this up at some point.*/
|
||||||
|
$(function() {
|
||||||
|
|
||||||
|
$('#$enqid').editable('/enquiries/update_status', {
|
||||||
|
id : 'data[Enquiry][id]',
|
||||||
|
name: 'data[Enquiry][status_id]',
|
||||||
|
|
||||||
|
data : '$jsonList',
|
||||||
|
type : 'select',
|
||||||
|
indicator : 'Saving...',
|
||||||
|
submit : 'Update Status',
|
||||||
|
cssclass: 'MER-inplace-select',
|
||||||
|
callback : function(value, settings) {
|
||||||
|
|
||||||
|
var match = /won/i.test(value);
|
||||||
|
|
||||||
|
if(match == true) {
|
||||||
|
$('#row$enqid').removeClass().addClass('jobwon');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
match = /lost/i.test(value);
|
||||||
|
|
||||||
|
if(match == true) {
|
||||||
|
$('#row$enqid').removeClass().addClass('joblost');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
match = /cancelled/i.test(value);
|
||||||
|
|
||||||
|
if(match == true) {
|
||||||
|
$('#row$enqid').removeClass().addClass('joblost');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
match = /information sent/i.test(value);
|
||||||
|
if(match == true) {
|
||||||
|
$('#row$enqid').removeClass().addClass('informationsent');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
match = /issued/i.test(value);
|
||||||
|
if(match == true) {
|
||||||
|
$('#row$enqid').removeClass().addClass('quoted');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
match = /request for quotation/i.test(value);
|
||||||
|
if(match == true) {
|
||||||
|
$('#row$enqid').removeClass().addClass('requestforquote');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
match = /assigned/i.test(value);
|
||||||
|
if(match == true) {
|
||||||
|
$('#row$enqid').removeClass();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function makeEditable(selectedID) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
10
webroot/js/menu.js
Normal file
10
webroot/js/menu.js
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
$(function() {
|
||||||
|
$('#nav li').hover(
|
||||||
|
function() {
|
||||||
|
$('ul', this).slideDown(100); //show submenu
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
$('ul', this).slideUp(100); //hide submenu
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue