Add default ordered from field on POs
This commit is contained in:
parent
4e8b80cec7
commit
847bce6247
|
|
@ -71,5 +71,15 @@ class PrinciplesController extends AppController {
|
|||
}
|
||||
|
||||
|
||||
function defaults($id = null) {
|
||||
$this->layout = 'ajax';
|
||||
if($id == null) {
|
||||
echo("No ID");
|
||||
}
|
||||
$principle = $this->Principle->read(null, $id);
|
||||
$principle_json = json_encode($principle);
|
||||
$this->set('principle_json', $principle_json);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<h2>Purchase Order: <?=$document['PurchaseOrder']['title']?></h2>
|
||||
|
||||
<div id="flashMessage" class="message">
|
||||
</div>
|
||||
<div class="docButtons">
|
||||
|
|
|
|||
|
|
@ -1,3 +1,14 @@
|
|||
<?php
|
||||
echo $javascript->link('ckeditor/ckeditor');
|
||||
echo $javascript->link('ckeditor/adapters/jquery');
|
||||
?>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$("#PrinciplePoOrderedFrom").ckeditor(config);
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="principles form">
|
||||
<?php echo $form->create('Principle');?>
|
||||
<fieldset>
|
||||
|
|
@ -14,6 +25,7 @@
|
|||
echo $form->input('postcode');
|
||||
echo $form->input('country_id');
|
||||
echo $form->input('currency_id');
|
||||
echo $form->input('po_ordered_from');
|
||||
?>
|
||||
</fieldset>
|
||||
<?php echo $form->end('Submit');?>
|
||||
|
|
|
|||
|
|
@ -430,7 +430,7 @@ $(function() {
|
|||
var quoteID = $("#quoteID").html();
|
||||
|
||||
$('#QuoteCommercialComments').ckeditor(function() {
|
||||
this.destroy();
|
||||
this.destroy();
|
||||
});
|
||||
|
||||
$.get('/quotes/edit/'+quoteID, function(data) {
|
||||
|
|
@ -519,6 +519,16 @@ $(function() {
|
|||
saveDocument('Purchase Order');
|
||||
});
|
||||
|
||||
// Changing PO principal, fill in the default fields.
|
||||
$("#PurchaseOrderPrincipleId").live('change', function(d) {
|
||||
var principleID = getSelectedID('#PurchaseOrderPrincipleId');
|
||||
|
||||
$.getJSON('/principles/defaults/'+principleID, function(data) {
|
||||
console.log(data.Principle.po_ordered_from);
|
||||
$('#PurchaseOrderOrderedFrom').val(data.Principle.po_ordered_from);
|
||||
updateTextFields(); //Update the CKEditor instances.
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue