Changes to add LineItem JS

This commit is contained in:
Karl Cordes 2010-05-31 15:54:44 +10:00
parent f701a6719a
commit 037df7d1da
8 changed files with 115 additions and 56 deletions

View file

@ -21,6 +21,7 @@
echo $javascript->link('jquery-ui');
echo $javascript->link('jquery.form');
echo $javascript->link('jquery.validate.min');
echo $javascript->link('menu');
echo $javascript->link('search');
//echo $javascript->link('ajaxLoader');
@ -72,11 +73,7 @@
</ul>
</li>
<li><?php echo $html->link('Contacts', '/contacts/index'); ?>
<ul>
<li class="last"><?php echo $html->link('Contact Index', '/contacts/index'); ?></li>
</ul>
</li>
<li><?php echo $html->link('Invoices', '/invoices/index'); ?>
<ul>
@ -91,12 +88,6 @@
</ul>
</li>
<li><?php echo $html->link('Quotes', '/quotes/index'); ?>
<ul>
<li><?php echo $html->link('Quote Index', '/quotes/index'); ?></li>
<li class="last"><?php echo $html->link('Find Quote', '/quotes/find'); ?></li>
</ul>
</li>
<li><?php echo $html->link('Principles', '/principles/index'); ?>
<ul>
@ -152,14 +143,16 @@
<?php echo $form->create('Enquiry', array('default'=>false, 'div'=>false));
<?php
echo $form->create('Enquiry', array('default'=>false, 'id'=>'searchForm'));
echo '<h2>Search';
echo $html->image('system-search.png');
echo '</h2>';
echo "<p>Search for anything: Enquiry Number, Job Number, Customer, Contact or Customer Order Number</p>";
echo "<p>Search for: 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'));
echo $form->end();

View file

@ -148,8 +148,8 @@
echo $quote['Currency']['symbol'].$lineItem['LineItem']['net_price']; ?></td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller'=> 'line_items', 'action'=>'view', $lineItem['LineItem']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('controller'=> 'line_items', 'action'=>'edit', $lineItem['LineItem']['id']), array('class'=>'editLink')); ?>
<?php echo $html->link(__('View/Edit', true), array('controller'=> 'line_items', 'action'=>'edit', $lineItem['LineItem']['id']), array('class'=>'editLink')); ?>
<?php echo $html->link(__('Remove', true), array('controller'=> 'line_items', 'action'=>'delete', $lineItem['LineItem']['id']), null, sprintf(__('Are you sure you want to remove # %s?', true), $lineItem['LineItem']['item_number'])); ?>

View file

@ -1,3 +1,6 @@
<?php echo $javascript->link('costing_dialog'); ?>
<div class="products view">
<h2><?php __('Product: '.$product['Product']['title']);?></h2>
@ -38,7 +41,7 @@
<li><?php echo $html->link(__('Edit Product', true), array('action'=>'edit', $product['Product']['id'])); ?> </li>
<li><?php echo $html->link(__('Add Costing', true), array('controller'=>'costings', 'action'=>'add/productid:'.$product['Product']['id']));?></li>
<button id="addCostingDialog"></button>
<button id="addCostingDialog">Add Costing</button>
</ul>
</div>

View file

@ -133,11 +133,20 @@ foreach ($quote['QuotePage'] as $quotePage):
echo $form->input('option', array('label'=>'Optional Item'));
echo $form->input('quantity', array('class'=>'nocostinput'));
echo $form->input('principle_id', array('options'=>$principles, 'empty' =>'Select the Principle for this Product'));
echo $form->input('fromDB', array('label'=>'Is this product in the database already?',
'empty'=>'',
'type'=>'select', 'options'=>array('Yes'=>'Yes', 'No'=>'No')));
?>
<button id="addBlankItem">Add Blank Item</button>
<? echo $form->input('principle_id', array('options'=>$principles, 'empty' =>'Select the Principle for this Product', 'div'=>'fromProductDB')); ?>
<?php
echo $form->input('title', array('div'=>'blankItem'));
echo $form->input('description', array('div'=>'blankItem'));

View file

@ -1143,9 +1143,10 @@ form.cmxform label {
}
label span.rightHandLabel {
position: absolute;
left: 40em;
width: 25em; color: #088A4B; font-size: 85%; font-weight: normal; text-transform: uppercase;
position: relative;
display: inline-block;
left: 5em;
width: auto; color: #088A4B; font-size: 85%; font-weight: normal; text-transform: uppercase;
}
label span.purchaseCurrency {
@ -1170,6 +1171,10 @@ label span#exchangeConversion {
}
form.cmxform {
width: 80%;
}
form.cmxform input {
width: auto;
display: inline;
@ -1230,3 +1235,7 @@ select.editinplace {
margin-top: 10em;
margin-left: 10em;
}
span.addLineItem {
clear: right;
}

View file

@ -20,6 +20,7 @@ $(function() {
$(".nocosting").hide();
$(".blankItem").hide();
$(".fromProductDB").hide();
$("#addLineItem-form").dialog({
@ -89,6 +90,21 @@ $(function() {
});
$('#LineItemFromDB').change(function () {
if(this.value == 'No') {
$(".blankItem").show();
$(".nocosting").show();
$(".fromProductDB").hide();
}
else {
$(".fromProductDB").show();
$(".blankItem").hide();
$(".nocosting").hide();
}
});
});

View file

@ -1,21 +1,54 @@
$(function() {
/*
* Fetch the costing add form. Place it in element ID 'costingdiv'
*
* @todo - write a plugin that generalises the method. It would be handy with the cake way of doing things
*
*/
function AjaxFetchPage() {
$.post("/costings/", $("#LineItemQuoteId").serialize(), function (itemTable) {
$("#productTable").html(itemTable);
$("#costingdiv").dialog({
autoOpen: false,
height: 800,
width: 800,
modal: true,
buttons: {
'Add Costing': function() {
$.post("/line_items/ajaxSave", $("#LineItemAddForm").serialize(), function(data) {
fetchTable();
$('#mydebug').html(data);
}
);
$("#LineItemAddForm").resetForm();
$(this).dialog('close');
},
Cancel: function() {
$(this).dialog('close');
}
},
close: function() {
}
});
}
/**
* When add costing button is pressed. Bring up costing dialog
*/
$("#addCostingDialog").button().click(function () {
$.get('/costings/add/', function(data) {
$("#costingdiv").html(data);
$('#costingdiv').dialog('open');
})
});
});
function AjaxFetchPage() {
$.post("/costings/", $("#LineItemQuoteId").serialize(), function (itemTable) {
$("#productTable").html(itemTable);
});
}

View file

@ -20,24 +20,23 @@ $(function() {
$("#dialogDiv").hide();
$("#dialogDiv").hide();
$("#dialogDiv").dialog({
autoOpen: false,
width: 900,
height: 900,
modal: true
});
});
$("#searchLink").click(function() {
$("#searchLink").click(function() {
$("#dialogDiv").dialog('open');
return false;
});
$("#dialogDiv").dialog('open');
return false;
});
$("#searchButton").button().click(function() {
@ -48,6 +47,10 @@ return false;
$("#dialogDiv").bind("dialogclose", function() {
$("#results").empty();
})
});
@ -57,12 +60,5 @@ function doSearch() {
$.post("/enquiries/doSearch", $("#searchString").serialize(), function(data) {
$("#results").html(data);
});
}
function searchDialog() {
$("")
}