{$class_id = 'crm-contact-operation-delete-wrapper'} {$wrapper_id = uniqid($class_id)} {$linked_contacts_count = count($linked_contacts)} {$free_contacts_count = count($free_contacts)} {$total_count = $linked_contacts_count + $free_contacts_count}

{sprintf(_w('Delete contacts (%d)'), $total_count)}

{if $total_count > 0} [`Contact deletion cannot be undone.`] {else} [`You have no access rights to delete selected contacts.`] {/if}

{if $linked_contacts_count > 0}

[`IMPORTANT NOTE:`] {if $free_contacts_count == 0} [`All selected contacts have links to other applications.`] {else} {sprintf(_w('%d of %d selected contacts shown below have links to other applications.'), $linked_contacts_count, $total_count)} {/if} {if !$is_super_admin} [`Deletion of these contacts is allowed to Administrator only.`] {else} [`After deletion of these contacts other applications will refer to not existing contacts.`] {/if}

{foreach $linked_contacts as $id => $contact} {if $is_super_admin} {foreach $contact.links as $app_id => $app_links} {foreach $app_links as $link} {/foreach} {/foreach} {else} {/if} {/foreach}
{$contact.name|escape} {$apps[$app_id].name}/{$link.role|truncate:50|escape} {_w("%d link", "%d links", $link.links_number)}
{$contact.name|escape}
{/if}
{if !$is_super_admin && $free_contacts_count == 0} {else} {if !$is_super_admin && $linked_contacts_count > 0} {else} {/if} [`or`] [`cancel`] {/if}