com.megaphonetech.entitytem.../templates/CRM/EntityTemplates/Page/EntityTemplates.tpl

58 lines
1.9 KiB
Smarty
Raw Permalink Normal View History

2018-08-12 23:45:46 +00:00
<div class="crm-content-block crm-block">
2018-08-13 21:59:23 +00:00
<label>{ts}Entity Type: {/ts}</label>
<select name="entityType" type="text" id="entityType" class="crm-form-select required crm-select2 twelve">
2018-08-12 23:45:46 +00:00
{$entityTypeOptions}
</select>
</br></br>
<table cellpadding="0" cellspacing="0" border="0" class="row-highlight">
<thead class="sticky">
<th>{ts}Title{/ts}</th>
<th></th>
</thead>
2018-08-17 00:15:21 +00:00
{if $rows}
{foreach from=$rows item=row}
<tr id="EntityTemplates-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"}">
<td class='EntityTemplates-title'>{$row.title}</td>
<td class='EntityTemplates-links'>{$row.links}</td>
</tr>
{/foreach}
{else}
<tr>
<td style='text-align: center;' colspan="2">{ts}None found.{/ts}</td>
2018-08-12 23:45:46 +00:00
</tr>
2018-08-17 00:15:21 +00:00
{/if}
2018-08-12 23:45:46 +00:00
</table>
2018-08-17 00:15:21 +00:00
{crmButton p=$url q="`$query`" class="cancel" icon="times"}{ts}Add Template{/ts}{/crmButton}
2018-08-12 23:45:46 +00:00
{crmButton p="civicrm" q="reset=1" class="cancel" icon="times"}{ts}Done{/ts}{/crmButton}
</div>
{literal}
<script type="text/javascript">
CRM.$(function($) {
2018-08-13 21:59:23 +00:00
$('#entityType').change(loadPage);
2018-08-12 23:45:46 +00:00
function loadPage() {
window.location.href = CRM.url('civicrm/entity/templates', {
reset: '1',
entityType: $('#entityType').val()
});
}
2018-08-13 22:42:25 +00:00
$('a.delete-entity-template').click(deleteEntity);
function deleteEntity() {
var row = $(this).closest('.crm-entity');
var entityId = row.data('id') || row[0].id.split('-')[1];
CRM.confirm({
message: ts('Are you sure you want to delete this template?'),
title: ts('Delete Template'),
options: {{/literal}yes: '{ts escape="js"}Delete{/ts}', no: '{ts escape="js"}Cancel{/ts}'{literal}},
width: 300,
height: 'auto'
})
.on('crmConfirm:yes', function() {
CRM.api3('EntityTemplates', 'delete', {id: entityId}, true).done(loadPage);
});
return false;
}
2018-08-12 23:45:46 +00:00
});
</script>
{/literal}