Addresses working on Shipments register
This commit is contained in:
parent
796371fc36
commit
cd61a550e6
|
|
@ -98,6 +98,10 @@ class ShipmentsController extends AppController {
|
|||
if(isset($id)) {
|
||||
if (empty($this->data)) {
|
||||
$this->data = $this->Shipment->read(null, $id);
|
||||
|
||||
$address = $this->Shipment->Address->find('first', array('conditions'=>array('Address.id'=>$this->data['Shipment']['address_id']),'recursive'=>0));
|
||||
|
||||
|
||||
$principles = $this->Shipment->Principle->find('list');
|
||||
$freightForwarders = $this->Shipment->FreightForwarder->find('list');
|
||||
$shipmentType = $this->typeOptions(false);
|
||||
|
|
@ -107,7 +111,7 @@ class ShipmentsController extends AppController {
|
|||
$invoiceType = $this->invoiceTypeOptions();
|
||||
$this->set('yesNo', array(0=>'No', 1=>'Yes'));
|
||||
|
||||
$this->set(compact('principles', 'freightForwarders', 'shipmentType', 'shipmentTypeShort', 'currencies','invoiceType', 'yesNo'));
|
||||
$this->set(compact('principles', 'freightForwarders', 'shipmentType', 'shipmentTypeShort', 'currencies','invoiceType', 'yesNo', 'address'));
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -80,11 +80,19 @@ echo $form->input('id', array('type'=>'hidden'));
|
|||
<span>Shipping Address:</span>
|
||||
</div>
|
||||
<div id="address" class="hiddenDefault">
|
||||
<?=$form->input('address_id', array('type'=>'hidden', 'id'=>'address_id', 'value'=>$this->data['Shipment']['address_id']));?>
|
||||
|
||||
<?
|
||||
if(isset($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="changeAddress" id="<?=$address['Address']['id']?>">Select a different Address</button>
|
||||
</div>
|
||||
<? endif;?>
|
||||
|
||||
</div>
|
||||
|
||||
<?=$form->input('address_id', array('type'=>'hidden', 'id'=>'address_id', 'value'=>$this->data['Shipment']['address_id']));?>
|
||||
|
||||
<div id="freight_forwarder" class="hiddenDefault">
|
||||
<?=$form->input('freight_forwarder_id');?>
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
<?=$this->element('add_edit_shipment');?>
|
||||
|
||||
<?php debug($this->data); ?>
|
||||
<?php debug($address); ?>
|
||||
|
|
@ -165,7 +165,7 @@ $(function() {
|
|||
$(".selectAddress").parent('div').fadeOut();
|
||||
|
||||
$(this).button({
|
||||
label: 'Select a different address'
|
||||
label: 'Select a different Address'
|
||||
});
|
||||
$(this).button('enable');
|
||||
|
||||
|
|
@ -173,15 +173,12 @@ $(function() {
|
|||
|
||||
$(".changeAddress").live('click', function() {
|
||||
$("#address_id").val('');
|
||||
$(this).removeClass('changeAddress');
|
||||
$(this).button({
|
||||
label: 'Ship to this Address'
|
||||
|
||||
$.get('/addresses/customerAddresses/'+$("#customer_id").val(), function(data) {
|
||||
$("#address").html(data);
|
||||
$(".selectAddress", data).button();
|
||||
});
|
||||
$(this).addClass('selectAddress');
|
||||
|
||||
$(".selectAddress").parent('div').fadeIn();
|
||||
|
||||
$('.selectAddress').button('enable');
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue