Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
2c4c49ca | 3 | | CiviCRM version 4.7 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
2a73d3b0 | 5 | | Copyright CiviCRM LLC (c) 2004-2017 | |
6a488035 TO |
6 | +--------------------------------------------------------------------+ |
7 | | This file is a part of CiviCRM. | | |
8 | | | | |
9 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
10 | | under the terms of the GNU Affero General Public License | | |
11 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
12 | | | | |
13 | | CiviCRM is distributed in the hope that it will be useful, but | | |
14 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
16 | | See the GNU Affero General Public License for more details. | | |
17 | | | | |
18 | | You should have received a copy of the GNU Affero General Public | | |
19 | | License and the CiviCRM Licensing Exception along | | |
20 | | with this program; if not, contact CiviCRM LLC | | |
21 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
22 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
24 | +--------------------------------------------------------------------+ | |
25 | *} | |
26 | <div class="crm-block crm-form-block crm-batch-search-form-block"> | |
27 | <h3>{ts}Data Entry Batches{/ts}</h3> | |
28 | <table class="form-layout-compressed"> | |
29 | <tr> | |
30 | <td> | |
31 | {$form.title.html}<br /> | |
32 | <span class="description font-italic"> | |
33 | {ts}Complete OR partial batch name.{/ts} | |
34 | </span> | |
35 | </td> | |
f212d37d | 36 | <td>{include file="CRM/common/formButtons.tpl"}</td> |
6a488035 TO |
37 | </tr> |
38 | </table> | |
39 | </div> | |
40 | <div class="crm-submit-buttons"> | |
12941281 | 41 | {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 | 42 | </div> |
24e7a504 | 43 | <table class="crm-batch-selector"> |
6a488035 TO |
44 | <thead> |
45 | <tr> | |
46 | <th class="crm-batch-name">{ts}Batch Name{/ts}</th> | |
47 | <th class="crm-batch-type">{ts}Type{/ts}</th> | |
48 | <th class="crm-batch-item_count">{ts}Item Count{/ts}</th> | |
49 | <th class="crm-batch-total_amount">{ts}Total Amount{/ts}</th> | |
50 | <th class="crm-batch-status">{ts}Status{/ts}</th> | |
51 | <th class="crm-batch-created_by">{ts}Created By{/ts}</th> | |
52 | <th></th> | |
53 | </tr> | |
54 | </thead> | |
55 | </table> | |
56 | ||
57 | {literal} | |
58 | <script type="text/javascript"> | |
3cc60a06 | 59 | CRM.$(function($) { |
6a488035 | 60 | buildBatchSelector( false ); |
2c68626a | 61 | $('#_qf_Search_refresh').click( function() { |
6a488035 TO |
62 | buildBatchSelector(true); |
63 | }); | |
6a488035 | 64 | |
2c68626a DJ |
65 | function buildBatchSelector( filterSearch ) { |
66 | var status = {/literal}{$status}{literal}; | |
6a488035 | 67 | if (filterSearch) { |
2c68626a DJ |
68 | crmBatchSelector.fnDestroy(); |
69 | 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 | 70 | } |
2c68626a DJ |
71 | else if (status == 1) { |
72 | var ZeroRecordText = {/literal}'<div class="status messages">{ts escape="js"}You do not have any Open Data Entry Batches.{/ts}</div>'{literal}; | |
73 | } | |
74 | else { | |
75 | var ZeroRecordText = {/literal}'<div class="status messages">{ts escape="js"}No Data Entry Batches have been created for this site.{/ts}</div>'{literal}; | |
76 | } | |
77 | ||
78 | var columns = ''; | |
79 | var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/batchlist" h=0 q="snippet=4"}'{literal}; | |
80 | var $context = $('#crm-main-content-wrapper'); | |
81 | ||
82 | crmBatchSelector = $('table.crm-batch-selector', $context).dataTable({ | |
83 | "bFilter" : false, | |
84 | "bAutoWidth" : false, | |
85 | "aaSorting" : [], | |
86 | "aoColumns" : [ | |
87 | {sClass:'crm-batch-name'}, | |
88 | {sClass:'crm-batch-type'}, | |
89 | {sClass:'crm-batch-item_count right'}, | |
90 | {sClass:'crm-batch-total_amount right'}, | |
91 | {sClass:'crm-batch-status'}, | |
92 | {sClass:'crm-batch-created_by'}, | |
93 | {sClass:'crm-batch-links', bSortable:false} | |
94 | ], | |
95 | "bProcessing": true, | |
96 | "asStripClasses" : [ "odd-row", "even-row" ], | |
97 | "sPaginationType": "full_numbers", | |
98 | "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>', | |
99 | "bServerSide": true, | |
100 | "bJQueryUI": true, | |
101 | "sAjaxSource": sourceUrl, | |
102 | "iDisplayLength": 25, | |
103 | "oLanguage": { "sZeroRecords": ZeroRecordText, | |
104 | "sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal}, | |
105 | "sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal}, | |
106 | "sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal}, | |
107 | "sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal}, | |
108 | "sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal}, | |
109 | "sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal}, | |
110 | "oPaginate": { | |
111 | "sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal}, | |
112 | "sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal}, | |
113 | "sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal}, | |
114 | "sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal} | |
115 | } | |
116 | }, | |
117 | "fnServerData": function ( sSource, aoData, fnCallback ) { | |
118 | if (filterSearch) { | |
119 | aoData.push( | |
120 | {name:'title', value: $('.crm-batch-search-form-block #title').val()} | |
121 | ); | |
122 | } | |
123 | $.ajax({ | |
124 | "dataType": 'json', | |
125 | "type": "POST", | |
126 | "url": sSource, | |
127 | "data": aoData, | |
128 | "success": fnCallback | |
129 | }); | |
130 | } | |
6a488035 TO |
131 | }); |
132 | } | |
2c68626a | 133 | }); |
6a488035 TO |
134 | |
135 | </script> | |
136 | {/literal} |