Editable row in jobs index now sets ALL_SENT to 1 if date_sent_to_customer is selected
This commit is contained in:
parent
70d53e892d
commit
34162801b4
|
|
@ -11,7 +11,7 @@ class Box extends AppModel {
|
||||||
'Shipment' => array(
|
'Shipment' => array(
|
||||||
'className' => 'Shipment',
|
'className' => 'Shipment',
|
||||||
'foreignKey' => 'shipment_id',
|
'foreignKey' => 'shipment_id',
|
||||||
'counterCache' => true
|
'counterCache' => 'box_count'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,10 @@
|
||||||
showButtonPanel: true,
|
showButtonPanel: true,
|
||||||
dateFormat: 'd M yy',
|
dateFormat: 'd M yy',
|
||||||
altFormat: 'yy-mm-dd',
|
altFormat: 'yy-mm-dd',
|
||||||
altField: '#<?=$job['Job']['id']?>_date_order_sent_to_customer'
|
altField: '#<?=$job['Job']['id']?>_date_order_sent_to_customer',
|
||||||
|
onSelect: function(dateText, inst) {
|
||||||
|
$('#all_sent').val(1);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -84,7 +87,7 @@
|
||||||
$('.export_sale_aud').attr("readonly",true);
|
$('.export_sale_aud').attr("readonly",true);
|
||||||
$('.commissions_any_currency').addClass("highlighted");
|
$('.commissions_any_currency').addClass("highlighted");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//Export Sale
|
//Export Sale
|
||||||
if(currencyID == 2) {//Export Sale. AUD
|
if(currencyID == 2) {//Export Sale. AUD
|
||||||
$('.export_sale_aud').attr("readonly",false);
|
$('.export_sale_aud').attr("readonly",false);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,10 @@
|
||||||
<th>Principle(s)</th>
|
<th>Principle(s)</th>
|
||||||
<th>PO(s)</th>
|
<th>PO(s)</th>
|
||||||
<th>Jobs</th>
|
<th>Jobs</th>
|
||||||
<th><?php echo $paginator->sort('box_count');?></th>
|
<th><?php echo $paginator->sort('# Boxes','box_count');?></th>
|
||||||
|
<th>Box Details<br>
|
||||||
|
L x W x H (kg)
|
||||||
|
</th>
|
||||||
<th><?php echo $paginator->sort('freight_forwarder_id');?></th>
|
<th><?php echo $paginator->sort('freight_forwarder_id');?></th>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -84,6 +87,30 @@
|
||||||
<td>
|
<td>
|
||||||
<?php echo $shipment['Shipment']['box_count']; ?>
|
<?php echo $shipment['Shipment']['box_count']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
//This is nasty. Will fix this once its working.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$totalWeight = 0;
|
||||||
|
|
||||||
|
foreach($shipment['Box'] as $box):?>
|
||||||
|
<?=$box['length']?> x <?=$box['width']?> x <?=$box['height']?> (<?=$box['weight']?> kg) <br>
|
||||||
|
<? $totalWeight += $box['weight']; ?>
|
||||||
|
|
||||||
|
<?php endforeach;?>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td> <?=$totalWeight?> kg</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $html->link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?>
|
<?php echo $html->link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ $(function() {
|
||||||
|
|
||||||
resetForm();
|
resetForm();
|
||||||
|
|
||||||
|
var addedBoxes = 0;
|
||||||
|
|
||||||
$( "#dialog-form" ).dialog({
|
$( "#dialog-form" ).dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
height: 900,
|
height: 900,
|
||||||
|
|
@ -121,12 +123,12 @@ $(function() {
|
||||||
|
|
||||||
|
|
||||||
$("#addBox").button().click(function() {
|
$("#addBox").button().click(function() {
|
||||||
addBox();
|
addBox(addedBoxes);
|
||||||
|
addedBoxes++;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".removeBox").click(function() {
|
$(".removeBox").live('click',function() {
|
||||||
alert("REMOVE THIS SHIT MAN");
|
$(this).parent().remove();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -140,13 +142,48 @@ $(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function addBox() {
|
function addBox(addedBoxes) {
|
||||||
|
|
||||||
|
var model = 'Box';
|
||||||
|
|
||||||
var newBoxForm = $("#boxFactory").clone();
|
var newBoxForm = $("#boxFactory").clone();
|
||||||
|
|
||||||
|
var boxNo = addedBoxes;
|
||||||
|
|
||||||
newBoxForm.attr('id','');
|
newBoxForm.attr('id','');
|
||||||
|
newBoxForm.addClass('boxForm');
|
||||||
newBoxForm.show();
|
newBoxForm.show();
|
||||||
|
|
||||||
|
//Set the appropriate naming for the fields so cake can work its magic.
|
||||||
|
//Should refactor into a function.
|
||||||
|
var div = newBoxForm.find('.length');
|
||||||
|
var ID = getCakeID(model,boxNo,'length');
|
||||||
|
var name = getCakeName(model, boxNo, 'length');
|
||||||
|
div.children('label').attr('for', ID);
|
||||||
|
div.children('input').attr('id', ID).attr('name', name);
|
||||||
|
|
||||||
|
div = newBoxForm.find('.width');
|
||||||
|
ID = getCakeID(model,boxNo,'width');
|
||||||
|
name = getCakeName(model, boxNo, 'width');
|
||||||
|
div.children('label').attr('for', ID);
|
||||||
|
div.children('input').attr('id', ID).attr('name', name);
|
||||||
|
|
||||||
|
div = newBoxForm.find('.height');
|
||||||
|
ID = getCakeID(model,boxNo,'height');
|
||||||
|
name = getCakeName(model, boxNo, 'height');
|
||||||
|
div.children('label').attr('for', ID);
|
||||||
|
div.children('input').attr('id', ID).attr('name', name);
|
||||||
|
|
||||||
|
div = newBoxForm.find('.weight');
|
||||||
|
ID = getCakeID(model,boxNo,'weight');
|
||||||
|
name = getCakeName(model, boxNo, 'weight');
|
||||||
|
div.children('label').attr('for', ID);
|
||||||
|
div.children('input').attr('id', ID).attr('name', name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var closeButton = $('<button>X</button>');
|
var closeButton = $('<button>X</button>');
|
||||||
closeButton.addClass('removeBox');
|
closeButton.addClass('removeBox');
|
||||||
closeButton.button();
|
closeButton.button();
|
||||||
|
|
@ -157,6 +194,18 @@ $(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getCakeID(model, count, field) {
|
||||||
|
return model+count+capitalizeFirstLetter(field);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCakeName(model, count, field) {
|
||||||
|
return 'data['+model+']['+count+']['+field+']';
|
||||||
|
}
|
||||||
|
|
||||||
|
function capitalizeFirstLetter(string) {
|
||||||
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A more generic way of handling the HABTM <ul> <li>[REMOVE BUTTON] NAME [HIDDEN INPUT]</li> </ul>
|
* A more generic way of handling the HABTM <ul> <li>[REMOVE BUTTON] NAME [HIDDEN INPUT]</li> </ul>
|
||||||
|
|
@ -170,7 +219,9 @@ $(function() {
|
||||||
var thisHiddenInput = $('<input type="hidden">');
|
var thisHiddenInput = $('<input type="hidden">');
|
||||||
|
|
||||||
var modelString = '['+modelName+']';
|
var modelString = '['+modelName+']';
|
||||||
|
|
||||||
thisHiddenInput.attr('name', 'data'+modelString+modelString+'[]');
|
thisHiddenInput.attr('name', 'data'+modelString+modelString+'[]');
|
||||||
|
|
||||||
thisHiddenInput.attr('value', id);
|
thisHiddenInput.attr('value', id);
|
||||||
|
|
||||||
thisLI.attr('id', modelName+'ID_'+id);
|
thisLI.attr('id', modelName+'ID_'+id);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue