improve flawed test
[civicrm-core.git] / templates / CRM / Price / Page / Field.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
1188c7a8 3 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 4 | |
1188c7a8
TO
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
6a488035
TO
8 +--------------------------------------------------------------------+
9*}
10{if ($action eq 1 or $action eq 2 or $action eq 4) and !$isReserved}
d5a08746 11 {include file="CRM/Price/Form/Field.tpl"}
6a488035 12{elseif $action eq 8 and !$usedBy and !$isReserved}
d5a08746 13 {include file="CRM/Price/Form/DeleteField.tpl"}
6a488035 14{elseif $action eq 1024 }
d5a08746 15 {include file="CRM/Price/Form/Preview.tpl"}
e5e8ab99
CW
16{elseif ($usedBy and $action eq 8) or $usedBy.civicrm_event or $usedBy.civicrm_contribution_page}
17 <div id="price_set_used_by" class="messages status no-popup">
34d6cec4 18 {icon icon="fa-info-circle"}{/icon}
e5e8ab99
CW
19 {if $action eq 8}
20 {ts 1=$usedPriceSetTitle}Unable to delete the '%1' Price Field - it is currently in use by one or more active events or contribution pages or contributions or event templates.{/ts}
21 {/if}
6a488035 22
e5e8ab99
CW
23 {if $usedBy.civicrm_event or $usedBy.civicrm_contribution_page or $usedBy.civicrm_event_template}
24 {include file="CRM/Price/Page/table.tpl"}
25 {/if}
26 </div>
d5a08746 27{/if}
6a488035 28
ef79e4f5 29{* priceField is set when e.g. in browse mode *}
30{if $action NEQ 8 and !empty($priceField)}
036aa39d 31<div class="crm-content-block crm-block">
d5a08746
DG
32 <div class="action-link">
33 {if !$isReserved}
80bc2820 34 {crmButton q="reset=1&action=add&sid=$sid" id="newPriceField" icon="plus-circle"}{ts}Add Price Field{/ts}{/crmButton}
d5a08746 35 {/if}
80bc2820 36 {crmButton p="civicrm/admin/price" q="action=preview&sid=`$sid`&reset=1&context=field" icon="television"}{ts}Preview (all fields){/ts}{/crmButton}
d5a08746
DG
37 </div>
38 <div id="field_page">
39 {strip}
6a488035 40 {* handle enable/disable actions*}
d5a08746 41 {include file="CRM/common/enableDisableApi.tpl"}
d5a08746
DG
42 <table id="options" class="row-highlight">
43 <thead>
44 <tr>
45 <th>{ts}Field Label{/ts}</th>
46 <th>{ts}Field Type{/ts}</th>
47 <th>{ts}Order{/ts}</th>
48 <th>{ts}Req?{/ts}</th>
49 <th>{ts}Enabled?{/ts}</th>
50 <th>{ts}Active On{/ts}</th>
51 <th>{ts}Expire On{/ts}</th>
52 <th>{ts}Price{/ts}</th>
3b5db8ce 53 {if $getTaxDetails}
54 <th>{ts}Tax Label{/ts}</th>
55 <th>{ts}Tax Amount{/ts}</th>
56 {/if}
d5a08746
DG
57 <th></th>
58 </tr>
59 </thead>
60 {foreach from=$priceField key=fid item=row}
4d17a233 61 <tr id="price_field-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"} {$row.class}{if NOT $row.is_active} disabled{/if}">
d5a08746
DG
62 <td class="crm-editable" data-field="label">{$row.label}</td>
63 <td>{$row.html_type_display}</td>
64 <td class="nowrap">{$row.weight}</td>
b633f8bd 65 <td class="crm-editable" data-field="is_required" data-type="boolean">{if $row.is_required eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
d5a08746 66 <td id="row_{$row.id}_status">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
70a44aee
SL
67 <td>{if $row.active_on}{$row.active_on|crmDate}{/if}</td>
68 <td>{if $row.expire_on}{$row.expire_on|crmDate}{/if}</td>
d5a08746 69 <td>{if $row.html_type eq "Text"}{$row.price|crmMoney}{else}<a class="action-item" href="{crmURL p="civicrm/admin/price/field/option" q="action=browse&reset=1&sid=$sid&fid=$fid"}">{if $isReserved}{ts}View Price Options{/ts}{else}{ts}Edit Price Options{/ts}{/if}</a>{/if}</td>
3b5db8ce 70 {if $getTaxDetails}
71 <td>{if $row.tax_rate != '' && $row.html_type eq "Text / Numeric Quantity"}
72 {$taxTerm} ({$row.tax_rate|string_format:"%.2f"}%)
73 {/if}
d75f2f47 74 </td>
3b5db8ce 75 <td>{if $row.html_type eq "Text / Numeric Quantity" }{$row.tax_amount|crmMoney}{/if}</td>
6a488035 76 {/if}
d5a08746
DG
77 <td class="field-action">{$row.action|replace:'xx':$row.id}</td>
78 </tr>
79 {/foreach}
80 </table>
81 {/strip}
82 </div>
83 <div class="action-link">
84 {if !$isReserved}
80bc2820 85 {crmButton q="reset=1&action=add&sid=$sid" id="newPriceField" icon="plus-circle"}{ts}Add Price Field{/ts}{/crmButton}
d5a08746 86 {/if}
80bc2820 87 {crmButton p="civicrm/admin/price" q="action=preview&sid=`$sid`&reset=1&context=field" icon="television"}{ts}Preview (all fields){/ts}{/crmButton}
d5a08746 88 </div>
036aa39d 89</div>
d5a08746
DG
90{else}
91 {if $action eq 16}
92 <div class="messages status no-popup crm-empty-table">
34d6cec4 93 {icon icon="fa-info-circle"}{/icon}
d5a08746
DG
94 {ts}None found.{/ts}
95 </div>
96 <div class="action-link">
80bc2820 97 {crmButton q="reset=1&action=add&sid=$sid" id="newPriceField" icon="plus-circle"}{ts}Add Price Field{/ts}{/crmButton}
d5a08746 98 </div>
6a488035
TO
99 {/if}
100{/if}