Added auto fill to Shipments register
This commit is contained in:
parent
9d3a6b7345
commit
2ebda7e86a
|
|
@ -640,6 +640,13 @@ class JobsController extends AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function getdata($id) {
|
||||||
|
$job = $this->Job->read(null, $id);
|
||||||
|
$this->set('job_json', json_encode($job));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Need to fix the customer_id which hasn't been set for these 500odd records.
|
* Need to fix the customer_id which hasn't been set for these 500odd records.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,7 @@ class PurchaseOrdersController extends AppController {
|
||||||
|
|
||||||
|
|
||||||
function getdata($id) {
|
function getdata($id) {
|
||||||
|
$this->layout = 'ajax';
|
||||||
$po = $this->PurchaseOrder->read(null, $id);
|
$po = $this->PurchaseOrder->read(null, $id);
|
||||||
$this->set('po_json', json_encode($po));
|
$this->set('po_json', json_encode($po));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,20 @@ echo $form->input('id', array('type'=>'hidden'));
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="purchaseOrder" class="hiddenDefault">
|
||||||
|
<?
|
||||||
|
echo $form->input('purchase_order', array('id'=>'purchase_order_autocomplete' ,'label'=>'Purchase Order (start typing and select from the list)'));?>
|
||||||
|
|
||||||
|
<ul id="purchaseOrdersList" class="habtmList">
|
||||||
|
<?php foreach($this->data['PurchaseOrder'] as $po):?>
|
||||||
|
<li id="PurchaseOrderID_<?=$po['id']?>">
|
||||||
|
<button class="removeFromList">X</button>
|
||||||
|
<?=$po['title'];?>
|
||||||
|
<input type="hidden" name="data[PurchaseOrder][PurchaseOrder][]" value="<?=$po['id']?>">
|
||||||
|
</li>
|
||||||
|
<?php endforeach?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="principle" class="hiddenDefault">
|
<div id="principle" class="hiddenDefault">
|
||||||
<? echo $form->input('Principle', array('name'=>'PrincipleSelect', 'type'=>'select', 'multiple'=>false)); ?>
|
<? echo $form->input('Principle', array('name'=>'PrincipleSelect', 'type'=>'select', 'multiple'=>false)); ?>
|
||||||
|
|
@ -38,20 +52,6 @@ echo $form->input('id', array('type'=>'hidden'));
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="purchaseOrder" class="hiddenDefault">
|
|
||||||
<?
|
|
||||||
echo $form->input('purchase_order', array('id'=>'purchase_order_autocomplete' ,'label'=>'Purchase Order (start typing and select from the list)'));?>
|
|
||||||
|
|
||||||
<ul id="purchaseOrdersList" class="habtmList">
|
|
||||||
<?php foreach($this->data['PurchaseOrder'] as $po):?>
|
|
||||||
<li id="PurchaseOrderID_<?=$po['id']?>">
|
|
||||||
<button class="removeFromList">X</button>
|
|
||||||
<?=$po['title'];?>
|
|
||||||
<input type="hidden" name="data[PurchaseOrder][PurchaseOrder][]" value="<?=$po['id']?>">
|
|
||||||
</li>
|
|
||||||
<?php endforeach?>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="job" class="hiddenDefault">
|
<div id="job" class="hiddenDefault">
|
||||||
<?
|
<?
|
||||||
|
|
|
||||||
1
views/jobs/getdata.ctp
Normal file
1
views/jobs/getdata.ctp
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<?=$job_json?>
|
||||||
|
|
@ -90,9 +90,6 @@ $(function() {
|
||||||
source: "/purchase_orders/autocomplete",
|
source: "/purchase_orders/autocomplete",
|
||||||
minLength: 2,
|
minLength: 2,
|
||||||
select: function( event, ui ) {
|
select: function( event, ui ) {
|
||||||
//alert(ui.item.value + ":" + ui.item.id);
|
|
||||||
//alert($('#PurchaseOrderID_'+ui.item.id).length);
|
|
||||||
|
|
||||||
|
|
||||||
if($('#PurchaseOrderID_'+ui.item.id).length == 0) { //This PO is already in the List. Don't do anything.'
|
if($('#PurchaseOrderID_'+ui.item.id).length == 0) { //This PO is already in the List. Don't do anything.'
|
||||||
addToList('PurchaseOrder', ui.item.id, ui.item.value, $('#purchaseOrdersList'));
|
addToList('PurchaseOrder', ui.item.id, ui.item.value, $('#purchaseOrdersList'));
|
||||||
|
|
@ -121,6 +118,21 @@ $(function() {
|
||||||
|
|
||||||
if($('#JobID_'+ui.item.id).length == 0) { //This Job is already in the List. Don't do anything.'
|
if($('#JobID_'+ui.item.id).length == 0) { //This Job is already in the List. Don't do anything.'
|
||||||
addToList('Job', ui.item.id, ui.item.value, $('#jobsList'));
|
addToList('Job', ui.item.id, ui.item.value, $('#jobsList'));
|
||||||
|
|
||||||
|
|
||||||
|
$.getJSON('/jobs/getdata/'+ui.item.id, function(data) {
|
||||||
|
//console.log(data);
|
||||||
|
//alert(data.Principle.id+' '+data.Principle.name);
|
||||||
|
$("#customer_autocomplete").val(data.Customer.name);
|
||||||
|
$("#customer_id").val(data.Customer.id);
|
||||||
|
|
||||||
|
$.get('/addresses/customerAddresses/'+data.Customer.id, function(addressdata) {
|
||||||
|
$("#address").html(addressdata);
|
||||||
|
$(".selectAddress", addressdata).button();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue