Minor change to the display and sort order of unit sizes
git-svn-id: file:///svn-source/pmgr/branches/v0.3_work@992 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -148,6 +148,23 @@ class UnitSizesController extends AppController {
|
||||
return $conditions;
|
||||
}
|
||||
|
||||
function gridDataOrder(&$params, &$model, $index, $direction) {
|
||||
if ($index == 'UnitType.name')
|
||||
$index = 'UnitType.code';
|
||||
|
||||
$order = parent::gridDataOrder($params, $model, $index, $direction);
|
||||
|
||||
// After sorting by whatever the user wants, add these
|
||||
// defaults into the sort mechanism. If we're already
|
||||
// sorting by one of them, it will only be redundant,
|
||||
// and should cause no harm (possible a longer query?)
|
||||
$order[] = 'UnitType.code ' . $direction;
|
||||
$order[] = 'sqft ' . $direction;
|
||||
$order[] = 'UnitSize.rent ' . $direction;
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
function gridDataPostProcessLinks(&$params, &$model, &$records, $links) {
|
||||
$links['UnitSize'] = array('name');
|
||||
return parent::gridDataPostProcessLinks($params, $model, $records, $links);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// Define the table columns
|
||||
$cols = array();
|
||||
$cols['Size'] = array('index' => 'UnitSize.name', 'formatter' => 'shortname');
|
||||
$cols['Type'] = array('index' => 'UnitType.name', 'formatter' => 'shortname');
|
||||
$cols['Width'] = array('index' => 'UnitSize.width', 'formatter' => 'number');
|
||||
$cols['Depth'] = array('index' => 'UnitSize.depth', 'formatter' => 'number');
|
||||
$cols['Height'] = array('index' => 'UnitSize.height', 'formatter' => 'number');
|
||||
@@ -10,8 +11,8 @@ $cols['Area'] = array('index' => 'sqft', 'formatter' => 'nu
|
||||
$cols['Volume'] = array('index' => 'cuft', 'formatter' => 'number');
|
||||
$cols['Deposit'] = array('index' => 'UnitSize.deposit', 'formatter' => 'currency');
|
||||
$cols['Rent'] = array('index' => 'UnitSize.rent', 'formatter' => 'currency');
|
||||
$cols['A. Cost'] = array('index' => 'sqcost', 'formatter' => 'currency');
|
||||
$cols['V. Cost'] = array('index' => 'cucost', 'formatter' => 'currency');
|
||||
$cols['Per Foot'] = array('index' => 'sqcost', 'formatter' => 'currency');
|
||||
$cols['Per Cubic Ft'] = array('index' => 'cucost', 'formatter' => 'currency');
|
||||
$cols['Unavailable'] = array('index' => 'unavailable', 'formatter' => 'number');
|
||||
$cols['Occupied'] = array('index' => 'occupied', 'formatter' => 'number');
|
||||
$cols['Available'] = array('index' => 'available', 'formatter' => 'number');
|
||||
@@ -27,7 +28,13 @@ $grid
|
||||
->defaultFields(array('Size', 'Area'))
|
||||
->searchFields(array('Size', 'Width', 'Depth', 'Area', 'Deposit', 'Rent'))
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array_diff(array_keys($cols), array('Height', 'Volume',
|
||||
'A. Cost', 'V. Cost',
|
||||
'Occupied', 'Total', 'Occupancy', 'Vacancy',
|
||||
array_diff(array_keys($cols), array('Width', 'Depth',
|
||||
'Deposit',
|
||||
'Height', 'Volume',
|
||||
//'Per Foot',
|
||||
'Per Cubic Ft',
|
||||
'Occupied',
|
||||
//'Total',
|
||||
'Occupancy',
|
||||
//'Vacancy',
|
||||
'Comment')));
|
||||
|
||||
Reference in New Issue
Block a user