Merge pull request #17981 from eileenmcnaughton/merge_form
[civicrm-core.git] / templates / CRM / Price / Form / LineItem.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
11{* Displays contribution/event fees when price set is used. *}
12{foreach from=$lineItem item=value key=priceset}
589b90c6 13 {if $value neq 'skip'}
6a488035 14 {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *}
589b90c6 15 {if $priceset GT 0}<br/>{/if}
16 <strong>{ts}Participant {$priceset+1}{/ts}</strong>
17 {$part.$priceset.info}
152ff8b9 18 {/if}
6a488035 19 <table>
589b90c6 20 <tr class="columnheader">
152ff8b9 21 <th>{ts}Item{/ts}</th>
22 {if $context EQ "Membership"}
589b90c6 23 <th class="right">{ts}Fee{/ts}</th>
24 {else}
25 <th class="right">{ts}Qty{/ts}</th>
26 <th class="right">{ts}Unit Price{/ts}</th>
27 <th class="right">{ts}Total Price{/ts}</th>
28 {if $context EQ "Contribution" && $action eq 2}
29 <th class="right">{ts}Paid{/ts}</th>
30 <th class="right">{ts}Owing{/ts}</th>
31 <th class="right">{ts}Amount of<br>Current Payment {/ts}</th>
32 {/if}
152ff8b9 33 {/if}
152ff8b9 34
589b90c6 35 {if $pricesetFieldsCount}
36 <th class="right">{ts}Total Participants{/ts}</th>{/if}
37 </tr>
38 {foreach from=$value item=line}
39 <tr>
fa742e4e 40 <td>{if $line.field_title && $line.html_type neq 'Text'}{$line.field_title} &ndash; {$line.label}{else}{$line.label}{/if} {if $line.description}
589b90c6 41 <div class="description">{$line.description}</div>{/if}</td>
42 {if $context NEQ "Membership"}
43 <td class="right">{$line.qty}</td>
44 <td class="right">{$line.unit_price|crmMoney}</td>
45 {/if}
46 <td class="right">{$line.line_total|crmMoney}</td>
47 {if $pricesetFieldsCount}
48 <td class="right">{$line.participant_count}</td> {/if}
49 {if $context EQ "Contribution" && $action eq 2}
50 <td class="right">{$pricefildTotal.LineItems[$line.price_field_value_id]|crmMoney}</td>
51 <td class="right">
52 {assign var="fildTotal" value=$line.line_total-$pricefildTotal[$pricefildTotal.id][$line.price_field_value_id]}
53 {$fildTotal|crmMoney}
6a488035 54 </td>
589b90c6 55 <td class="left">$<input
56 type='text' id='txt-price[{$line.price_field_value_id}]'
57 name='txt-price[{$line.price_field_value_id}]' size='4'
58 class='distribute'>&nbsp<input type='checkbox'
59 id='cb-price[{$line.price_field_value_id}]'
60 name='cb-price[{$line.price_field_value_id}]'
61 price='{$fildTotal}' class='payFull'/></td>
62 {/if}
63 </tr>
64 {/foreach}
65 {if $context EQ "Contribution" && $action eq 2}
66 <tr>
67 <td>
68 {ts}Contribution Total{/ts}:
69 </td>
70 <td></td>
71 <td></td>
72 <td class="right">{$totalAmount|crmMoney}</td>
73 <td class="right">{$pricefildTotal.total|crmMoney}</td>
74 <td class="right">{assign var="total" value= $totalAmount-$pricefildTotal.total}{$total|crmMoney}</td>
75 <td class="left"><h5 class='editPayment'></h5>
76 {literal}
77 <script type="text/javascript">
78 CRM.$(function ($) {
79 $(document).on('blur', '.distribute', function () {
80 var totalAmount = 0;
81 $('.distribute').each(function () {
82 if ($(this).val().length > 0) {
83 totalAmount = parseFloat(totalAmount) + parseFloat($(this).val());
84 }
85 });
6a488035 86
589b90c6 87 $('.editPayment').text('$ ' + totalAmount);
88 var unlocateAmount = '{/literal}{$total}{literal}';
89 $('.unlocateAmount').text('$ ' + (unlocateAmount - totalAmount));
90 });
91 });
92 </script>
93 {/literal}
6a488035 94
589b90c6 95 </td>
96 </tr>
97 <tr>
98 <td colspan=6 class="right"><strong>Unallocated Amount</strong></td>
99 <td><h5 class='unlocateAmount'>{$total|crmMoney} </h5></td>
100 </tr>
101 {/if}
6a488035 102 </table>
589b90c6 103 {/if}
6a488035
TO
104{/foreach}
105
106<div class="crm-section no-label total_amount-section">
589b90c6 107 <div class="content bold">
108 {if $context EQ "Contribution"}
109 {ts}Contribution Total{/ts}:
110 {elseif $context EQ "Event"}
111 {ts}Event Total{/ts}:
112 {elseif $context EQ "Membership"}
113 {ts}Membership Fee Total{/ts}:
114 {else}
115 {ts}Total Amount{/ts}:
116 {/if}
6a488035 117 {$totalAmount|crmMoney}
589b90c6 118 </div>
119 <div class="content bold">
120 {if $pricesetFieldsCount}
6a488035
TO
121 {ts}Total Participants{/ts}:
122 {foreach from=$lineItem item=pcount}
123 {if $pcount neq 'skip'}
589b90c6 124 {assign var="lineItemCount" value=0}
152ff8b9 125
589b90c6 126 {foreach from=$pcount item=p_count}
127 {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
128 {/foreach}
129 {if $lineItemCount < 1 }
130 {assign var="lineItemCount" value=1}
131 {/if}
132 {assign var="totalcount" value=$totalcount+$lineItemCount}
152ff8b9 133 {/if}
6a488035
TO
134 {/foreach}
135 {$totalcount}
589b90c6 136 {/if}
137 </div>
6a488035
TO
138</div>
139
140{if $hookDiscount.message}
589b90c6 141 <div class="crm-section hookDiscount-section">
142 <em>({$hookDiscount.message})</em>
143 </div>
6a488035 144{/if}