org.agbu.annualgrantbudgets/templates/CRM/Grant/Page/AnnualBudgets.tpl

70 lines
2.6 KiB
Smarty
Raw Normal View History

2018-08-11 16:46:21 +00:00
<div class="crm-content-block crm-block">
2019-08-19 22:59:03 +00:00
{* Check to see if this user can lock/unlock items *}
{if call_user_func(array('CRM_Core_Permission','check'), 'Administer CiviCRM')}
{assign var='canLock' value='crm-editable'}
{/if}
2018-08-11 23:34:21 +00:00
<label>{ts}Fiscal Year: {/ts}</label>
<select name="fiscal_year" type="text" id="fiscal_year" class="crm-form-select required crm-select2 six">
{$fiscal_year_options}
</select>
</br></br>
2018-08-11 17:51:25 +00:00
<table cellpadding="0" cellspacing="0" border="0" class="row-highlight">
<thead class="sticky">
2018-10-22 19:13:08 +00:00
<th>{ts}Endowment{/ts}</th>
2018-08-11 17:51:25 +00:00
<th>{ts}Annual Budget{/ts}</th>
<th>{ts}Amount Awarded{/ts}</th>
2018-10-22 19:13:08 +00:00
<th>{ts}Amount Remaining{/ts}</th>
<th>{ts}Locked?{/ts}</th>
<th>{ts}Note{/ts}</th>
2018-08-11 17:51:25 +00:00
</thead>
2018-08-11 18:29:59 +00:00
{crmAPI var='result' entity='GrantBudget' action='getbudget' fiscal_year=$fiscalYear}
2019-08-19 21:06:17 +00:00
{crmAPI var='totals' entity='GrantBudget' action='getbudget' fiscal_year=$fiscalYear return_totals=1}
<tr id="GrantBudget-totals" class="crm-entity">
<td><strong>Totals:</strong></td>
{foreach from=$totals.values item=total}
<td><strong>{$total}</strong></td>
{/foreach}
</tr>
2018-08-11 17:51:25 +00:00
{foreach from=$result.values item=row}
2018-08-11 19:37:33 +00:00
{if $row.id}
{assign var='rowId' value=$row.id}
2019-08-19 22:59:03 +00:00
{if !$row.is_reserved}
{assign var='canEdit' value='crm-editable'}
{/if}
2018-08-11 19:37:33 +00:00
{else}
{capture assign=rowId}{$row.financial_type_id}_{$fiscalYear}{/capture}
{/if}
<tr id="GrantBudget-{$rowId}" class="crm-entity {cycle values="odd-row,even-row"}">
2018-08-11 17:51:25 +00:00
<td>{$row.name}</td>
2019-08-19 22:59:03 +00:00
<td class="{$canEdit}" data-field="budget" data-type="text">{$row.budget}</td>
2018-08-11 17:51:25 +00:00
<td>{$row.total_amount_granted}</td>
<td>{$row.balance_amount}</td>
2019-08-19 22:59:03 +00:00
<td class="{$canLock}" data-field="is_reserved" data-type="boolean">{if $row.is_reserved eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
<td class="{$canEdit}" data-field="note" data-type="text">{$row.note}</td>
2018-08-11 17:51:25 +00:00
</tr>
{/foreach}
2019-08-19 21:06:17 +00:00
<tr id="GrantBudget-totals" class="crm-entity">
<td><strong>Totals:</strong></td>
{foreach from=$totals.values item=total}
<td><strong>{$total}</strong></td>
{/foreach}
</tr>
2018-08-11 17:51:25 +00:00
</table>
{crmButton p="civicrm" q="reset=1" class="cancel" icon="times"}{ts}Done{/ts}{/crmButton}
2018-08-11 16:46:21 +00:00
</div>
2018-08-11 23:34:21 +00:00
{literal}
<script type="text/javascript">
CRM.$(function($) {
$('#fiscal_year').change(loadPage);
function loadPage() {
window.location.href = CRM.url('civicrm/grant/annual/budgets', {
reset: '1',
fiscalYear: $('#fiscal_year').val()
});
}
});
</script>
{/literal}