1<?php
2
3if (!defined("WHMCS")) {
4 die("This file cannot be accessed directly");
5}
6
7$reportdata['isPrintable'] = false;
8$reportdata['canCsvExport'] = false;
9
10$userid = App::getFromRequest('userid');
11
12$onloadUserReplaceJs = '';
13if ($userid) {
14 $onloadUserReplaceJs = 'jQuery("#selectUserid")[0].selectize.trigger("change");';
15}
16
17$reportdata["title"] = "Client Data Export";
18
19$reportdata["description"] = "This report allows you to generate a JSON export of data relating to a given client. You can choose which data points you wish to be included in the export below.";
20
21$reportdata["headertext"] = '
22<form method="post" action="' . routePath('admin-client-export', 'xxx') . '" data-route="' . routePath('admin-client-export', 'xxx') . '" id="frmClientExport">
23<input type="hidden" name="export" value="true">
24<br>
25<p>
26 Choose the client to export<br>
27 ' . $aInt->clientsDropDown($userid) . '
28</p>
29<div style="background-color:#f8f8f8;margin:10px 0 20px;padding:20px;border-radius:4px;">
30 <div class="row">
31 <div class="col-sm-3">
32 <label class="checkbox-inline">
33 <input type="checkbox" name="exportdata[]" value="profile" checked>
34 Profile Data
35 </label>
36 </div>
37 <div class="col-sm-3">
38 <label class="checkbox-inline">
39 <input type="checkbox" name="exportdata[]" value="paymethods">
40 Pay Methods
41 </label>
42 </div>
43 <div class="col-sm-3">
44 <label class="checkbox-inline">
45 <input type="checkbox" name="exportdata[]" value="contacts">
46 Contacts
47 </label>
48 </div>
49 <div class="col-sm-3">
50 <label class="checkbox-inline">
51 <input type="checkbox" name="exportdata[]" value="services">
52 Products/Services
53 </label>
54 </div>
55 <div class="col-sm-3">
56 <label class="checkbox-inline">
57 <input type="checkbox" name="exportdata[]" value="domains">
58 Domains
59 </label>
60 </div>
61 <div class="col-sm-3">
62 <label class="checkbox-inline">
63 <input type="checkbox" name="exportdata[]" value="billableitems">
64 Billable Items
65 </label>
66 </div>
67 <div class="col-sm-3">
68 <label class="checkbox-inline">
69 <input type="checkbox" name="exportdata[]" value="invoices">
70 Invoices
71 </label>
72 </div>
73 <div class="col-sm-3">
74 <label class="checkbox-inline">
75 <input type="checkbox" name="exportdata[]" value="quotes">
76 Quotes
77 </label>
78 </div>
79 <div class="col-sm-3">
80 <label class="checkbox-inline">
81 <input type="checkbox" name="exportdata[]" value="transactions">
82 Transactions
83 </label>
84 </div>
85 <div class="col-sm-3">
86 <label class="checkbox-inline">
87 <input type="checkbox" name="exportdata[]" value="tickets">
88 Tickets
89 </label>
90 </div>
91 <div class="col-sm-3">
92 <label class="checkbox-inline">
93 <input type="checkbox" name="exportdata[]" value="emails">
94 Emails
95 </label>
96 </div>
97 <div class="col-sm-3">
98 <label class="checkbox-inline">
99 <input type="checkbox" name="exportdata[]" value="notes">
100 Notes
101 </label>
102 </div>
103 <div class="col-sm-3">
104 <label class="checkbox-inline">
105 <input type="checkbox" name="exportdata[]" value="consenthistory">
106 Consent History
107 </label>
108 </div>
109 <div class="col-sm-3">
110 <label class="checkbox-inline">
111 <input type="checkbox" name="exportdata[]" value="activitylog">
112 Activity Log
113 </label>
114 </div>
115 </div>
116</div>
117<button type="submit" class="btn btn-default"' . ($userid ? '' : ' disabled="disabled"') . ' id="btnExport">
118 <i class="fas fa-download fa-fw"></i>
119 Generate and Download Export
120</button>
121<br><br>
122<small>* Generating an export for a client with a substantial amount of history may take a while</small>
123</form>
124
125<script>
126$(document).ready(function() {
127 $("#selectUserid")[0].selectize.on("change", function() {
128 var userId = this.getValue();
129 if (userId) {
130 $("#frmClientExport").attr("action", $("#frmClientExport").data("route").replace("xxx", userId));
131 $("#btnExport").removeProp("disabled");
132 }
133 });
134
135 ' . $onloadUserReplaceJs . '
136});
137</script>
138';
139