Commit | Line | Data |
---|---|---|
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 | <div class="crm-block crm-form-block crm-batch-search-form-block"> | |
11 | <h3>{ts}Data Entry Batches{/ts}</h3> | |
12 | <table class="form-layout-compressed"> | |
13 | <tr> | |
14 | <td> | |
15 | {$form.title.html}<br /> | |
16 | <span class="description font-italic"> | |
17 | {ts}Complete OR partial batch name.{/ts} | |
18 | </span> | |
19 | </td> | |
f212d37d | 20 | <td>{include file="CRM/common/formButtons.tpl"}</td> |
6a488035 TO |
21 | </tr> |
22 | </table> | |
23 | </div> | |
f850beb4 | 24 | <div class="action-link"> |
12941281 | 25 | {crmButton accesskey="N" p="civicrm/batch/add" q="reset=1&action=add" id="newBatch" icon="crm-i fa-plus-circle"}{ts}New Data Entry Batch{/ts}{/crmButton}<br/> |
6a488035 | 26 | </div> |
24e7a504 | 27 | <table class="crm-batch-selector"> |
6a488035 TO |
28 | <thead> |
29 | <tr> | |
30 | <th class="crm-batch-name">{ts}Batch Name{/ts}</th> | |
31 | <th class="crm-batch-type">{ts}Type{/ts}</th> | |
32 | <th class="crm-batch-item_count">{ts}Item Count{/ts}</th> | |
33 | <th class="crm-batch-total_amount">{ts}Total Amount{/ts}</th> | |
34 | <th class="crm-batch-status">{ts}Status{/ts}</th> | |
35 | <th class="crm-batch-created_by">{ts}Created By{/ts}</th> | |
36 | <th></th> | |
37 | </tr> | |
38 | </thead> | |
39 | </table> | |
40 | ||
41 | {literal} | |
42 | <script type="text/javascript"> | |
3cc60a06 | 43 | CRM.$(function($) { |
6a488035 | 44 | buildBatchSelector( false ); |
2c68626a | 45 | $('#_qf_Search_refresh').click( function() { |
6a488035 TO |
46 | buildBatchSelector(true); |
47 | }); | |
6a488035 | 48 | |
2c68626a | 49 | function buildBatchSelector( filterSearch ) { |
16d7b9f4 | 50 | var status = {/literal}{if !empty($status)}{$status}{else}0{/if}{literal}; |
6a488035 | 51 | if (filterSearch) { |
2c68626a DJ |
52 | crmBatchSelector.fnDestroy(); |
53 | var ZeroRecordText = '<div class="status messages">{/literal}{ts escape="js"}No matching Data Entry Batches found for your search criteria.{/ts}{literal}</li></ul></div>'; | |
6a488035 | 54 | } |
2c68626a DJ |
55 | else if (status == 1) { |
56 | var ZeroRecordText = {/literal}'<div class="status messages">{ts escape="js"}You do not have any Open Data Entry Batches.{/ts}</div>'{literal}; | |
57 | } | |
58 | else { | |
59 | var ZeroRecordText = {/literal}'<div class="status messages">{ts escape="js"}No Data Entry Batches have been created for this site.{/ts}</div>'{literal}; | |
60 | } | |
61 | ||
62 | var columns = ''; | |
63 | var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/batchlist" h=0 q="snippet=4"}'{literal}; | |
64 | var $context = $('#crm-main-content-wrapper'); | |
65 | ||
66 | crmBatchSelector = $('table.crm-batch-selector', $context).dataTable({ | |
67 | "bFilter" : false, | |
68 | "bAutoWidth" : false, | |
69 | "aaSorting" : [], | |
70 | "aoColumns" : [ | |
71 | {sClass:'crm-batch-name'}, | |
72 | {sClass:'crm-batch-type'}, | |
73 | {sClass:'crm-batch-item_count right'}, | |
74 | {sClass:'crm-batch-total_amount right'}, | |
75 | {sClass:'crm-batch-status'}, | |
76 | {sClass:'crm-batch-created_by'}, | |
77 | {sClass:'crm-batch-links', bSortable:false} | |
78 | ], | |
79 | "bProcessing": true, | |
80 | "asStripClasses" : [ "odd-row", "even-row" ], | |
81 | "sPaginationType": "full_numbers", | |
82 | "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>', | |
83 | "bServerSide": true, | |
84 | "bJQueryUI": true, | |
85 | "sAjaxSource": sourceUrl, | |
86 | "iDisplayLength": 25, | |
87 | "oLanguage": { "sZeroRecords": ZeroRecordText, | |
88 | "sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal}, | |
89 | "sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal}, | |
90 | "sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal}, | |
91 | "sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal}, | |
92 | "sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal}, | |
93 | "sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal}, | |
94 | "oPaginate": { | |
95 | "sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal}, | |
96 | "sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal}, | |
97 | "sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal}, | |
98 | "sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal} | |
99 | } | |
100 | }, | |
101 | "fnServerData": function ( sSource, aoData, fnCallback ) { | |
102 | if (filterSearch) { | |
103 | aoData.push( | |
104 | {name:'title', value: $('.crm-batch-search-form-block #title').val()} | |
105 | ); | |
106 | } | |
107 | $.ajax({ | |
108 | "dataType": 'json', | |
109 | "type": "POST", | |
110 | "url": sSource, | |
111 | "data": aoData, | |
112 | "success": fnCallback | |
113 | }); | |
114 | } | |
6a488035 TO |
115 | }); |
116 | } | |
2c68626a | 117 | }); |
6a488035 TO |
118 | |
119 | </script> | |
120 | {/literal} |