added blank items. bugs need to be fixed
This commit is contained in:
parent
b00db6a009
commit
67680e8e2f
|
|
@ -29,12 +29,15 @@ class LineItemsController extends AppController {
|
|||
if (!empty($this->data)) {
|
||||
$this->LineItem->create();
|
||||
|
||||
if(isset($this->data['LineItem']['product_id'])) {
|
||||
$product = $this->LineItem->Product->findById($this->data['LineItem']['product_id']);
|
||||
|
||||
/* Copy all the data from the Product to the new LineItem */
|
||||
|
||||
$this->data['LineItem']['description'] = $product['Product']['description'];
|
||||
$this->data['LineItem']['title'] = $product['Product']['title'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
// $numberOfItems = $this->LineItem->find('count',
|
||||
|
|
@ -65,7 +68,7 @@ class LineItemsController extends AppController {
|
|||
}
|
||||
|
||||
|
||||
/* Process the Line Item and add it to a quote */
|
||||
/* Process the Line Item and add it to a quote */
|
||||
function ajaxSave() {
|
||||
|
||||
|
||||
|
|
@ -73,11 +76,17 @@ class LineItemsController extends AppController {
|
|||
|
||||
if (!empty($this->data)) {
|
||||
$this->LineItem->create();
|
||||
|
||||
if(isset($this->data['LineItem']['product_id'])) {
|
||||
$product = $this->LineItem->Product->findById($this->data['LineItem']['product_id']);
|
||||
|
||||
/* Copy all the data from the Product to the new LineItem */
|
||||
|
||||
$this->data['LineItem']['description'] = $product['Product']['description'];
|
||||
$this->data['LineItem']['title'] = $product['Product']['title'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if($this->LineItem->save($this->data)) {
|
||||
|
|
|
|||
|
|
@ -108,6 +108,13 @@ $tcpdf->productPage($quote['Currency'], $enquiry['Enquiry']['gst'], $products, '
|
|||
|
||||
$output_dir = '/Users/karlcordes/Sites/quotenik/app/webroot/pdf/';
|
||||
|
||||
$debuglevel = Configure::read('debug');
|
||||
|
||||
if($debuglevel == 0) {
|
||||
$output_dir = '/var/www/cakephp/app/webroot/pdf/';
|
||||
}
|
||||
|
||||
|
||||
if($quote['Quote']['revision'] > 0) {
|
||||
$filename = $enquiry['Enquiry']['title'].'rev'.$quote['Quote']['revision'].'.pdf';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,13 +136,19 @@ foreach ($quote['QuotePage'] as $quotePage):
|
|||
|
||||
|
||||
?>
|
||||
<button id="addBlankItem">Add Blank Item</button>
|
||||
<?php
|
||||
echo $form->input('title', array('div'=>'blankItem'));
|
||||
echo $form->input('description', array('div'=>'blankItem'));
|
||||
?>
|
||||
|
||||
|
||||
<div id="productBox"></div>
|
||||
|
||||
<div id="productOptionsBox"></div>
|
||||
|
||||
<? echo $form->input('unit_price', array('id'=>"unitPrice", 'div'=>'nocosting', 'class'=>'nocostinput')); ?>
|
||||
<? echo $form->input('discount_percent', array('id'=>'discountPercent', 'div'=>'nocosting', 'class'=>'nocostinput'));
|
||||
<? echo $form->input('unit_price', array('id'=>"unitPrice", 'div'=>'nocosting', 'class'=>'nocostinput'));
|
||||
echo $form->input('discount_percent', array('id'=>'discountPercent', 'div'=>'nocosting', 'class'=>'nocostinput'));
|
||||
echo $form->input('discount_amount_each', array('id'=>'discountAmountEach', 'readonly'=>'readonly', 'div'=>'nocosting'));
|
||||
echo $form->input('net_price_each', array('id'=>'net_price_each', 'readonly'=>'readonly', 'div'=>'nocosting'));
|
||||
echo $form->input('total_discount_amount', array('id'=>'total_discountAmount', 'readonly'=>'readonly', 'div'=>'nocosting'));
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ $(function() {
|
|||
|
||||
|
||||
$(".nocosting").hide();
|
||||
|
||||
$(".blankItem").hide();
|
||||
|
||||
|
||||
$("#addLineItem-form").dialog({
|
||||
|
|
@ -33,6 +33,7 @@ $(function() {
|
|||
$.post("/line_items/ajaxSave", $("#LineItemAddForm").serialize(), function(data) {
|
||||
|
||||
fetchTable();
|
||||
$('#mydebug').html(data);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -80,7 +81,13 @@ $(function() {
|
|||
});
|
||||
|
||||
|
||||
$('#addBlankItem').button().click(function () {
|
||||
$("#LineItemPrincipleId").hide();
|
||||
$(".blankItem").show();
|
||||
$(".nocosting").show();
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue