From 6188e2009022b5abf18659126fd3edb1552a27d8 Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Wed, 4 May 2011 11:49:07 +1000 Subject: [PATCH] Shipment indexes working --- controllers/shipments_controller.php | 52 ++++++++- models/shipment.php | 2 +- views/elements/shipment_index_all.ctp | 121 +++++++++++++++++++++ views/elements/shipment_index_direct.ctp | 121 +++++++++++++++++++++ views/elements/shipment_index_export.ctp | 121 +++++++++++++++++++++ views/elements/shipment_index_import.ctp | 121 +++++++++++++++++++++ views/elements/shipment_index_local.ctp | 121 +++++++++++++++++++++ views/layouts/default.ctp | 6 +- views/shipments/edit.ctp | 4 +- views/shipments/index.ctp | 129 ++--------------------- webroot/css/quotenik.css | 4 +- 11 files changed, 670 insertions(+), 132 deletions(-) create mode 100644 views/elements/shipment_index_all.ctp create mode 100644 views/elements/shipment_index_direct.ctp create mode 100644 views/elements/shipment_index_export.ctp create mode 100644 views/elements/shipment_index_import.ctp create mode 100644 views/elements/shipment_index_local.ctp diff --git a/controllers/shipments_controller.php b/controllers/shipments_controller.php index 345332d3..d22b1ad3 100644 --- a/controllers/shipments_controller.php +++ b/controllers/shipments_controller.php @@ -8,15 +8,59 @@ class ShipmentsController extends AppController { var $paginate = array( 'contain' => false, - 'limit' => 100, + 'limit' => 300, 'order'=>array('Shipment.id' => 'desc'), 'recursive' => 1 ); - function index() { + function index($type = 'all') { + + + + $this->Shipment->recursive = 0; - $this->set('shipments', $this->paginate()); + + switch($type) { + + case 'all': + $conditions = array(); + break; + + case 'import': + + $conditions = array('Shipment.type'=>1); + + + break; + + + case 'direct': + $conditions = array('Shipment.type'=>2); + + break; + + + case 'export': + $conditions = array('Shipment.type'=>3); + + + + break; + + case 'local': + $conditions = array('Shipment.type'=>4); + break; + + + default: + + + + } + $this->set('shipments', $this->paginate($conditions)); + $this->set('type', $type); + $principles = $this->Shipment->Principle->find('list'); $freightForwarders = $this->Shipment->FreightForwarder->find('list'); @@ -41,7 +85,7 @@ class ShipmentsController extends AppController { $shipmentType = $this->typeOptions(false); $shipmentTypeShort = $this->typeOptions(true); $this->set(compact('principles', 'freightForwarders', 'shipmentType', 'shipmentTypeShort')); - + } function edit($id = null) { diff --git a/models/shipment.php b/models/shipment.php index d8f45b30..55dafc3b 100644 --- a/models/shipment.php +++ b/models/shipment.php @@ -53,7 +53,7 @@ class Shipment extends AppModel { 'exclusive' => '', 'finderQuery' => '', 'counterQuery' => '' - ), + ), 'ShipmentInvoice' => array( 'className' => 'ShipmentInvoice', 'foreignKey' => 'shipment_id', diff --git a/views/elements/shipment_index_all.ctp b/views/elements/shipment_index_all.ctp new file mode 100644 index 00000000..6b1069ae --- /dev/null +++ b/views/elements/shipment_index_all.ctp @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sort('date_arrived');?>sort('date_dispatched');?>sort('type');?>Principle(s)PO(s)Jobssort('# Boxes','box_count');?>Box Details
+ LxWxH (cm) +
Weight (kg)sort('freight_forwarder_id');?>sort('airway_bill');?>sort('comments');?>
+ + + element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived'])); + ?> + + element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched'])); + ?> + + + + + link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id'])); + } + else { + echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id'])); + } + ?> + +
+ +
+ + link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?> +
+ +
+ + link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?> +
+ +
+ + + + + xx
+ '; + $totalWeight += $box['weight']; ?> + + +
1) { + echo $weightString; + echo '
'; + + }?> + + kg
+ link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> + + + + + + +
\ No newline at end of file diff --git a/views/elements/shipment_index_direct.ctp b/views/elements/shipment_index_direct.ctp new file mode 100644 index 00000000..6b1069ae --- /dev/null +++ b/views/elements/shipment_index_direct.ctp @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sort('date_arrived');?>sort('date_dispatched');?>sort('type');?>Principle(s)PO(s)Jobssort('# Boxes','box_count');?>Box Details
+ LxWxH (cm) +
Weight (kg)sort('freight_forwarder_id');?>sort('airway_bill');?>sort('comments');?>
+ + + element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived'])); + ?> + + element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched'])); + ?> + + + + + link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id'])); + } + else { + echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id'])); + } + ?> + +
+ +
+ + link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?> +
+ +
+ + link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?> +
+ +
+ + + + + xx
+ '; + $totalWeight += $box['weight']; ?> + + +
1) { + echo $weightString; + echo '
'; + + }?> + + kg
+ link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> + + + + + + +
\ No newline at end of file diff --git a/views/elements/shipment_index_export.ctp b/views/elements/shipment_index_export.ctp new file mode 100644 index 00000000..6b1069ae --- /dev/null +++ b/views/elements/shipment_index_export.ctp @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sort('date_arrived');?>sort('date_dispatched');?>sort('type');?>Principle(s)PO(s)Jobssort('# Boxes','box_count');?>Box Details
+ LxWxH (cm) +
Weight (kg)sort('freight_forwarder_id');?>sort('airway_bill');?>sort('comments');?>
+ + + element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived'])); + ?> + + element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched'])); + ?> + + + + + link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id'])); + } + else { + echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id'])); + } + ?> + +
+ +
+ + link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?> +
+ +
+ + link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?> +
+ +
+ + + + + xx
+ '; + $totalWeight += $box['weight']; ?> + + +
1) { + echo $weightString; + echo '
'; + + }?> + + kg
+ link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> + + + + + + +
\ No newline at end of file diff --git a/views/elements/shipment_index_import.ctp b/views/elements/shipment_index_import.ctp new file mode 100644 index 00000000..6b1069ae --- /dev/null +++ b/views/elements/shipment_index_import.ctp @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sort('date_arrived');?>sort('date_dispatched');?>sort('type');?>Principle(s)PO(s)Jobssort('# Boxes','box_count');?>Box Details
+ LxWxH (cm) +
Weight (kg)sort('freight_forwarder_id');?>sort('airway_bill');?>sort('comments');?>
+ + + element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived'])); + ?> + + element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched'])); + ?> + + + + + link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id'])); + } + else { + echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id'])); + } + ?> + +
+ +
+ + link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?> +
+ +
+ + link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?> +
+ +
+ + + + + xx
+ '; + $totalWeight += $box['weight']; ?> + + +
1) { + echo $weightString; + echo '
'; + + }?> + + kg
+ link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> + + + + + + +
\ No newline at end of file diff --git a/views/elements/shipment_index_local.ctp b/views/elements/shipment_index_local.ctp new file mode 100644 index 00000000..6b1069ae --- /dev/null +++ b/views/elements/shipment_index_local.ctp @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sort('date_arrived');?>sort('date_dispatched');?>sort('type');?>Principle(s)PO(s)Jobssort('# Boxes','box_count');?>Box Details
+ LxWxH (cm) +
Weight (kg)sort('freight_forwarder_id');?>sort('airway_bill');?>sort('comments');?>
+ + + element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived'])); + ?> + + element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched'])); + ?> + + + + + link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id'])); + } + else { + echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id'])); + } + ?> + +
+ +
+ + link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?> +
+ +
+ + link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?> +
+ +
+ + + + + xx
+ '; + $totalWeight += $box['weight']; ?> + + +
1) { + echo $weightString; + echo '
'; + + }?> + + kg
+ link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> + + + + + + +
\ No newline at end of file diff --git a/views/layouts/default.ctp b/views/layouts/default.ctp index 23367771..ee7944fa 100755 --- a/views/layouts/default.ctp +++ b/views/layouts/default.ctp @@ -77,7 +77,11 @@
  • link('Shipments','/shipments/index');?>
  • diff --git a/views/shipments/edit.ctp b/views/shipments/edit.ctp index 01a0e9f6..20712d42 100644 --- a/views/shipments/edit.ctp +++ b/views/shipments/edit.ctp @@ -74,7 +74,7 @@ echo $form->input('id', array('type'=>'hidden'));
    - input('customer', array('id'=>'customer_autocomplete', 'label'=>'Customer', 'value'=>$this->data['Shipment']['customer_id']));?> + input('customer', array('id'=>'customer_autocomplete', 'label'=>'Customer', 'value'=>$this->data['Customer']['name']));?> input('customer_id', array('type'=>'hidden', 'id'=>'customer_id', 'value'=>$this->data['Shipment']['customer_id']));?>
    @@ -83,6 +83,8 @@ echo $form->input('id', array('type'=>'hidden'));
    input('address_id', array('type'=>'hidden', 'id'=>'address_id', 'value'=>$this->data['Shipment']['address_id']));?> + +
    diff --git a/views/shipments/index.ctp b/views/shipments/index.ctp index d41a7573..aaae22d9 100644 --- a/views/shipments/index.ctp +++ b/views/shipments/index.ctp @@ -1,5 +1,5 @@
    -

    +

    link('shipment_index');?> @@ -10,134 +10,18 @@ )); ?>

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    sort('user_id');?>sort('date_arrived');?>sort('date_dispatched');?>sort('type');?>Principle(s)PO(s)Jobssort('# Boxes','box_count');?>Box Details
    - LxWxH (cm) -
    Weight (kg)sort('freight_forwarder_id');?>sort('airway_bill');?>sort('comments');?>
    - link($initials, array('controller'=> 'users', 'action'=>'view', $shipment['User']['id'])); ?> - - element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived'])); - ?> - - element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched'])); - ?> - - - - - link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id'])); - } - else { - echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id'])); - } - ?> - -
    - -
    - - link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?> -
    - -
    - - link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?> -
    - -
    - - - - - xx
    - '; - $totalWeight += $box['weight']; ?> - - -
    1) { - echo $weightString; - echo '
    '; - - }?> - - kg
    - link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> - - - - - - -
    +
    + element('shipment_index_'.$type);?> +
    +
    prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?> - | numbers();?> + | numbers();?> next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
    @@ -146,7 +30,6 @@
    -
    diff --git a/webroot/css/quotenik.css b/webroot/css/quotenik.css index ce1a3d79..28f13bff 100755 --- a/webroot/css/quotenik.css +++ b/webroot/css/quotenik.css @@ -72,7 +72,7 @@ h2 { color: #e32; font-family:'Gill Sans','lucida grande',helvetica, arial, sans-serif; font-size: 190%; - margin: 0.3em 0; + margin: 0; /* padding-top: 0.8em; */ } @@ -88,7 +88,7 @@ a.headerlinks { h3 { color: #2C5FD5; font-family:'Gill Sans','lucida grande',helvetica, arial, sans-serif; - font-size: 165%; + font-size: 130%; /* padding-top: 1.5em; */ }