Shipment thing mostly functional. ShipmentInvoices and export,local to be done tomorrow
This commit is contained in:
parent
34162801b4
commit
a6bffff40e
|
|
@ -2,7 +2,7 @@
|
||||||
class AddressesController extends AppController {
|
class AddressesController extends AppController {
|
||||||
|
|
||||||
var $name = 'Addresses';
|
var $name = 'Addresses';
|
||||||
var $helpers = array('Html', 'Form', 'Ajax');
|
var $helpers = array('Html', 'Form');
|
||||||
var $components = array('RequestHandler');
|
var $components = array('RequestHandler');
|
||||||
function index() {
|
function index() {
|
||||||
$this->Address->recursive = 0;
|
$this->Address->recursive = 0;
|
||||||
|
|
@ -81,5 +81,12 @@ class AddressesController extends AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function customerAddresses($customerID) {
|
||||||
|
$this->layout = 'ajax';
|
||||||
|
|
||||||
|
$this->set('addresses', $this->Address->find('all', array('conditions'=>array('Customer.id'=>$customerID))));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
19
views/addresses/customer_addresses.ctp
Normal file
19
views/addresses/customer_addresses.ctp
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$(".selectAddress").button();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<?foreach($addresses as $address):?>
|
||||||
|
<div class="address">
|
||||||
|
<span class="address"><?=$address['Address']['address']?></span>
|
||||||
|
<span class="city"><?=$address['Address']['city'];?></span>
|
||||||
|
<span class="state"><?=$address['State']['name'];?></span>
|
||||||
|
<span class="country"><?=$address['Country']['name'];?></span>
|
||||||
|
<button class="selectAddress" id="<?=$address['Address']['id']?>">Ship to this Address</button>
|
||||||
|
</div>
|
||||||
|
<?endforeach;?>
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
|
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
|
||||||
));
|
));
|
||||||
?></p>
|
?></p>
|
||||||
|
<button class="newShipment">New Shipment</button>
|
||||||
<table cellpadding="0" cellspacing="0" class="shipments">
|
<table cellpadding="0" cellspacing="0" class="shipments">
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php echo $paginator->sort('user_id');?></th>
|
<th><?php echo $paginator->sort('user_id');?></th>
|
||||||
|
|
@ -20,8 +21,9 @@
|
||||||
<th>Jobs</th>
|
<th>Jobs</th>
|
||||||
<th><?php echo $paginator->sort('# Boxes','box_count');?></th>
|
<th><?php echo $paginator->sort('# Boxes','box_count');?></th>
|
||||||
<th>Box Details<br>
|
<th>Box Details<br>
|
||||||
L x W x H (kg)
|
LxWxH (cm)
|
||||||
</th>
|
</th>
|
||||||
|
<th>Weight (kg)</th>
|
||||||
<th><?php echo $paginator->sort('freight_forwarder_id');?></th>
|
<th><?php echo $paginator->sort('freight_forwarder_id');?></th>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -88,29 +90,38 @@
|
||||||
<?php echo $shipment['Shipment']['box_count']; ?>
|
<?php echo $shipment['Shipment']['box_count']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td class="boxDimensions">
|
||||||
<?php
|
<?php
|
||||||
//This is nasty. Will fix this once its working.
|
//This is nasty. Will fix this once its working.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$totalWeight = 0;
|
$totalWeight = 0;
|
||||||
|
$weightString = '';
|
||||||
|
|
||||||
foreach($shipment['Box'] as $box):?>
|
foreach($shipment['Box'] as $box):?>
|
||||||
<?=$box['length']?> x <?=$box['width']?> x <?=$box['height']?> (<?=$box['weight']?> kg) <br>
|
<?=$box['length']?>x<?=$box['width']?>x<?=$box['height']?><br>
|
||||||
<? $totalWeight += $box['weight']; ?>
|
<?
|
||||||
|
$weightString .= $box['weight'].' kg <br>';
|
||||||
|
$totalWeight += $box['weight']; ?>
|
||||||
<?php endforeach;?>
|
<?php endforeach;?>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td> <?=$totalWeight?> kg</td>
|
<td> <?
|
||||||
|
|
||||||
|
$boxCount = $shipment['Shipment']['box_count'];
|
||||||
|
if($boxCount > 1) {
|
||||||
|
echo $weightString;
|
||||||
|
echo '<hr>';
|
||||||
|
|
||||||
|
}?>
|
||||||
|
<? if($boxCount != 0): ?>
|
||||||
|
<span class="totalWeight"><?=$totalWeight;?> kg</span></td>
|
||||||
|
<? endif;?>
|
||||||
<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>
|
||||||
|
|
@ -136,7 +147,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<ul>
|
<ul>
|
||||||
<li><button id="newShipment">New Shipment</button></li>
|
<li><button class="newShipment">New Shipment</button></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1440,11 +1440,18 @@ table.shipments tr td {
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.shipments tr td.boxDimensions {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
table.shipments {
|
table.shipments {
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.habtmList {
|
.habtmList {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
@ -1477,3 +1484,18 @@ table.shipments {
|
||||||
|
|
||||||
.boxForm div {
|
.boxForm div {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span.totalWeight {
|
||||||
|
|
||||||
|
font-weight: bolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.address {
|
||||||
|
border: 1px solid;
|
||||||
|
margin-top: 1em;
|
||||||
|
width: 15em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.address span {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
@ -34,7 +34,7 @@ $(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$( "#newShipment" ).button().click(function() {
|
$( ".newShipment" ).button().click(function() {
|
||||||
|
|
||||||
$( "#dialog-form" ).dialog( "open" );
|
$( "#dialog-form" ).dialog( "open" );
|
||||||
|
|
||||||
|
|
@ -50,6 +50,13 @@ $(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('#date_dispatched_display').datepicker({
|
||||||
|
showButtonPanel: true,
|
||||||
|
dateFormat: 'd M yy',
|
||||||
|
altFormat: 'yy-mm-dd',
|
||||||
|
altField: '#date_dispatched'
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the relevent elements depending on this Shipment Type */
|
* Display the relevent elements depending on this Shipment Type */
|
||||||
$("#shipmentType").change(function() {
|
$("#shipmentType").change(function() {
|
||||||
|
|
@ -58,9 +65,12 @@ $(function() {
|
||||||
$(".hiddenDefault").hide();
|
$(".hiddenDefault").hide();
|
||||||
|
|
||||||
switch(shipmentTypeID) {
|
switch(shipmentTypeID) {
|
||||||
case 1:
|
case 1: //Import
|
||||||
$("#importFields, #principle, #purchaseOrder, #freight_forwarder, #airway_bill, #boxes").show();
|
$("#importFields, #principle, #purchaseOrder, #freight_forwarder, #airway_bill, #boxes").show();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 2: //Direct
|
||||||
|
$("#purchaseOrder, #job,#principle, #dateDispatched, #customer, #address, #addressSpan, #freight_forwarder, #airway_bill, #boxes").show();
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -121,6 +131,20 @@ $(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("#customer_autocomplete").autocomplete({
|
||||||
|
source: "/customers/completeCustomer",
|
||||||
|
minLength: 2,
|
||||||
|
select: function( event, ui ) {
|
||||||
|
$("#customer_id").val(ui.item.id);
|
||||||
|
|
||||||
|
$.get('/addresses/customerAddresses/'+ui.item.id, function(data) {
|
||||||
|
$("#address").html(data);
|
||||||
|
$(".selectAddress", data).button();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
$("#addBox").button().click(function() {
|
$("#addBox").button().click(function() {
|
||||||
addBox(addedBoxes);
|
addBox(addedBoxes);
|
||||||
|
|
@ -131,6 +155,40 @@ $(function() {
|
||||||
$(this).parent().remove();
|
$(this).parent().remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$(".selectAddress").live('click', function() {
|
||||||
|
var ID = $(this).attr('id');
|
||||||
|
$("#address_id").val(ID);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$(this).removeClass('selectAddress');
|
||||||
|
$(this).addClass('changeAddress');
|
||||||
|
|
||||||
|
$(".selectAddress").button('disable');
|
||||||
|
$(".selectAddress").parent('div').fadeOut();
|
||||||
|
|
||||||
|
$(this).button({
|
||||||
|
label: 'Select a different address'
|
||||||
|
});
|
||||||
|
$(this).button('enable');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".changeAddress").live('click', function() {
|
||||||
|
$("#address_id").val('');
|
||||||
|
$(this).removeClass('changeAddress');
|
||||||
|
$(this).button({
|
||||||
|
label: 'Ship to this Address'
|
||||||
|
});
|
||||||
|
$(this).addClass('selectAddress');
|
||||||
|
|
||||||
|
$(".selectAddress").parent('div').fadeIn();
|
||||||
|
|
||||||
|
$('.selectAddress').button('enable');
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the Form to its default site
|
* Resets the Form to its default site
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue