diff --git a/controllers/addresses_controller.php b/controllers/addresses_controller.php index faf03861..442971b9 100755 --- a/controllers/addresses_controller.php +++ b/controllers/addresses_controller.php @@ -2,7 +2,7 @@ class AddressesController extends AppController { var $name = 'Addresses'; - var $helpers = array('Html', 'Form', 'Ajax'); + var $helpers = array('Html', 'Form'); var $components = array('RequestHandler'); function index() { $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)))); + } + } ?> diff --git a/views/addresses/customer_addresses.ctp b/views/addresses/customer_addresses.ctp new file mode 100644 index 00000000..997242ee --- /dev/null +++ b/views/addresses/customer_addresses.ctp @@ -0,0 +1,19 @@ + + + + +
+ + + + + +
+ \ No newline at end of file diff --git a/views/shipments/index.ctp b/views/shipments/index.ctp index 53a17ff3..f7fd97ef 100644 --- a/views/shipments/index.ctp +++ b/views/shipments/index.ctp @@ -9,6 +9,7 @@ 'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true) )); ?>

+ @@ -20,8 +21,9 @@ + @@ -88,29 +90,38 @@ - - + + @@ -136,7 +147,7 @@
diff --git a/webroot/css/quotenik.css b/webroot/css/quotenik.css index 8cfe109c..61e9f058 100755 --- a/webroot/css/quotenik.css +++ b/webroot/css/quotenik.css @@ -1440,11 +1440,18 @@ table.shipments tr td { border: 1px solid; } +table.shipments tr td.boxDimensions { + text-align: left; +} + + table.shipments { border: 1px solid; } + + .habtmList { list-style: none; margin: 0; @@ -1476,4 +1483,19 @@ table.shipments { } .boxForm div { +} + +span.totalWeight { + + font-weight: bolder; +} + +div.address { + border: 1px solid; + margin-top: 1em; + width: 15em; +} + +div.address span { + display: block; } \ No newline at end of file diff --git a/webroot/js/shipment_index.js b/webroot/js/shipment_index.js index 4a63598f..b97ec7c3 100644 --- a/webroot/js/shipment_index.js +++ b/webroot/js/shipment_index.js @@ -34,7 +34,7 @@ $(function() { } }); - $( "#newShipment" ).button().click(function() { + $( ".newShipment" ).button().click(function() { $( "#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 */ $("#shipmentType").change(function() { @@ -58,9 +65,12 @@ $(function() { $(".hiddenDefault").hide(); switch(shipmentTypeID) { - case 1: + case 1: //Import $("#importFields, #principle, #purchaseOrder, #freight_forwarder, #airway_bill, #boxes").show(); break; + + case 2: //Direct + $("#purchaseOrder, #job,#principle, #dateDispatched, #customer, #address, #addressSpan, #freight_forwarder, #airway_bill, #boxes").show(); default: 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(addedBoxes); @@ -131,6 +155,40 @@ $(function() { $(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 */ @@ -203,7 +261,7 @@ $(function() { } function capitalizeFirstLetter(string) { - return string.charAt(0).toUpperCase() + string.slice(1); + return string.charAt(0).toUpperCase() + string.slice(1); }
sort('user_id');?>Jobs sort('# Boxes','box_count');?> Box Details
- L x W x H (kg) + LxWxH (cm)
Weight (kg) sort('freight_forwarder_id');?> + - x x ( kg)
- - + xx
+ '; + $totalWeight += $box['weight']; ?>
kg 1) { + echo $weightString; + echo '
'; + + }?> + + kg
link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?>