Merge pull request #13809 from sushantpaste/auto-complete-search
[civicrm-core.git] / templates / CRM / Activity / Form / Search.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
4 | |
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 |
8 +--------------------------------------------------------------------+
9 *}
10 {* Search form and results for Activities *}
11 <div class="crm-form-block crm-search-form-block">
12 <div class="crm-accordion-wrapper crm-advanced_search_form-accordion {if $rows}collapsed{/if}">
13 <div class="crm-accordion-header crm-master-accordion-header">
14 {ts}Edit Search Criteria{/ts}
15 </div>
16 <!-- /.crm-accordion-header -->
17 <div class="crm-accordion-body">
18 <div id="searchForm" class="form-item">
19 {strip}
20 <table class="form-layout">
21 <tr>
22 <td class="font-size12pt" colspan="2">
23 {$form.sort_name.label}&nbsp;&nbsp;{$form.sort_name.html|crmAddClass:'twenty'}
24 <div>
25 <div class="description font-italic">{ts}Complete OR Partial Name{/ts}
26 <span class="contact-name-option option-1">{ts} of the Source Contact{/ts}</span>
27 <span class="contact-name-option option-2">{ts} of the Assignee Contact{/ts}</span>
28 <span class="contact-name-option option-3">{ts} of the Target Contact{/ts}</span>
29 </div>
30 </div>
31 </td>
32 <td>{include file="CRM/common/formButtons.tpl" location="top"}</td>
33 </tr>
34
35 {include file="CRM/Activity/Form/Search/Common.tpl"}
36
37 <tr>
38 <td colspan="3">{include file="CRM/common/formButtons.tpl" location="botton"}</td>
39 </tr>
40 </table>
41 {/strip}
42 </div>
43 </div>
44 </div>
45 </div>
46
47 {if $rowsEmpty || $rows }
48 <div class="crm-content-block">
49 {if $rowsEmpty}
50 <div class="crm-results-block crm-results-block-empty">
51 {include file="CRM/Activity/Form/Search/EmptyResults.tpl"}
52 </div>
53 {/if}
54
55 {if $rows}
56 <div class="crm-results-block">
57 {* Search request has returned 1 or more matching rows. *}
58
59 {* This section handles form elements for action task select and submit *}
60 <div class="crm-search-tasks">
61 {include file="CRM/common/searchResultTasks.tpl"}
62 </div>
63 {* This section displays the rows along and includes the paging controls *}
64 <div class="crm-search-results">
65 {include file="CRM/Activity/Form/Selector.tpl" context="Search"}
66 </div>
67 {* END Actions/Results section *}
68 </div>
69 {/if}
70 </div>
71 {/if}
72 {literal}
73 <script type="text/javascript">
74 CRM.$(function($) {
75 var $form = $('form.{/literal}{$form.formClass}{literal}'),
76 roleId = $('input[name=activity_role]:checked', $form).val();
77 if (roleId) {
78 $('.description .option-' + roleId).show();
79 }
80
81 $('[name=activity_role]:input').change(function() {
82 $('.description .contact-name-option').hide();
83 if ($(this).is(':checked')) {
84 $('.description .option-' + $(this).val()).show();
85 }
86 }).change();
87 });
88
89
90 </script>
91 {/literal}