Made the app controller include the action by default. Added virtual callouts for data order and limit. Changed fields to use formatting, including a custom format for currency and id. Added a function for auto conversion from PHP variables to javascript. Fixed some minor bugs in the controllers already converted to jqGrid. Moved leases onto jqGrid.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@118 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -1,85 +1,16 @@
|
||||
<?php /* -*- mode:PHP -*- */
|
||||
|
||||
if (isset($heading))
|
||||
echo $heading;
|
||||
elseif (!isset($caption))
|
||||
echo '<h2>'.__('Leases',true).'</h2>';
|
||||
// Define the table columns
|
||||
$cols = array();
|
||||
$cols['Lease'] = array('index' => 'Lease.number', 'formatter' => 'id');
|
||||
$cols['Unit'] = array('index' => 'Unit.name', 'width' => '50', 'align' => 'center');
|
||||
$cols['Customer'] = array('index' => 'Customer.name', 'width' => '150');
|
||||
$cols['Signed'] = array('index' => 'Lease.lease_date', 'formatter' => 'date');
|
||||
$cols['Move-In'] = array('index' => 'Lease.movein_date', 'formatter' => 'date');
|
||||
$cols['Move-Out'] = array('index' => 'Lease.moveout_date', 'formatter' => 'date');
|
||||
$cols['Balance'] = array('index' => 'Lease.balance', 'formatter' => 'currency');
|
||||
$cols['Comment'] = array('index' => 'Lease.comment', 'formatter' => 'comment');
|
||||
|
||||
$headers = array_merge(array('Lease'),
|
||||
isset($leases[0]['Unit'])
|
||||
? array('Unit')
|
||||
: array('Customer'),
|
||||
array('Signed', 'Move-In', 'Move-Out', 'Balance', 'Comment'));
|
||||
$column_class = array();
|
||||
foreach (array_intersect($headers, array('Lease', 'Unit')) AS $k => $v) {
|
||||
$column_class[$k] = 'id';
|
||||
}
|
||||
foreach (array_intersect($headers, array('Balance')) AS $k => $v) {
|
||||
$column_class[$k] = 'currency';
|
||||
}
|
||||
foreach (array_intersect($headers, array('Comment')) AS $k => $v) {
|
||||
$column_class[$k] = 'slack';
|
||||
}
|
||||
echo $this->element('jqGrid',
|
||||
array('jqGridColumns' => $cols));
|
||||
|
||||
if (isset($paginator)) {
|
||||
echo $paginator->counter(array('format' => __('Page %page% of %pages%, showing %current% records (%start% - %end%) of %count% total', true)));
|
||||
|
||||
$headers = array_merge(array($paginator->sort('Lease')),
|
||||
isset($leases[0]['Unit'])
|
||||
? array($paginator->sort('Unit', 'Unit.id'))
|
||||
: array($paginator->sort('Customer.id')),
|
||||
array($paginator->sort('Signed', 'lease_date'),
|
||||
$paginator->sort('Move-In', 'movein_date'),
|
||||
$paginator->sort('Move-Out', 'moveout_date'),
|
||||
$paginator->sort('balance'),
|
||||
$paginator->sort('comment')));
|
||||
}
|
||||
|
||||
$rows = array();
|
||||
foreach($leases AS $lease) {
|
||||
$unit = $customer = null;
|
||||
|
||||
if (isset($lease['Unit']))
|
||||
$unit = $lease['Unit'];
|
||||
else
|
||||
$customer = $lease['Customer'];
|
||||
|
||||
if (isset($lease['Lease']))
|
||||
$lease = $lease['Lease'];
|
||||
|
||||
$rows[] = array_merge(array($html->link('#'.$lease['number'],
|
||||
array('controller' => 'leases',
|
||||
'action' => 'view',
|
||||
$lease['id']))),
|
||||
isset($unit)
|
||||
? array($html->link($unit['name'],
|
||||
array('controller' => 'units',
|
||||
'action' => 'view',
|
||||
$unit['id'])))
|
||||
: array($html->link($customer['name'],
|
||||
array('controller' => 'customers',
|
||||
'action' => 'view',
|
||||
$customer['id']))),
|
||||
array(FormatHelper::date($lease['lease_date']),
|
||||
FormatHelper::date($lease['movein_date']),
|
||||
FormatHelper::date($lease['moveout_date']),
|
||||
FormatHelper::currency($lease['balance']),
|
||||
$lease['comment']));
|
||||
}
|
||||
|
||||
echo $this->element('table',
|
||||
array('class' => 'item lease list',
|
||||
'caption' => isset($caption) ? $caption : null,
|
||||
'headers' => $headers,
|
||||
'rows' => $rows,
|
||||
'column_class' => $column_class));
|
||||
|
||||
if (isset($paginator)) {
|
||||
echo('<div class="paging">' . "\n");
|
||||
echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));
|
||||
echo(' | ');
|
||||
echo $paginator->numbers();
|
||||
echo(' | ');
|
||||
echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));
|
||||
echo('</div>' . "\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user