-
Notifications
You must be signed in to change notification settings - Fork 0
/
Developer Contributions Register handson.html
101 lines (75 loc) · 3.06 KB
/
Developer Contributions Register handson.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/4.1.2/papaparse.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.js"></script>
<script>
var fileNameAndPath = "/contributionspaid/data/CurrentS94TransactionsMFCut.csv";
var fromXlOne = false;
function getFileDate(path) {
$.ajaxSetup({cache: false});
$.ajax({
type: "GET",
async: true,
timeout: 5000,
url : path,
dataType : "text",
success: function(data, textStatus, request){
var lastModified = new Date(request.getResponseHeader("Last-Modified"));
document.getElementById("fileDate").innerHTML = lastModified.toString();
},
error: function(ex) {
console.log(ex);
}
});
}
Papa.parse(fileNameAndPath, {
download: true,
skipEmptyLines: true,
complete: function(parsed){
// console.log(parsed.data[1][6]); // THIS SHOULD BE THE FILE DATE
// console.log("Parsed:");
console.log("records parsed: ", parsed.data.length);
const options = {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
timeZoneName: 'short'
};
var curPath = window.location.href;
//var fileDate = "";
var localDate = "";
getFileDate(fileNameAndPath);
// console.log("First Balance:" + parsed.data[1][1]);
fixedData = [];
// console.log(parsed);
if (parsed.data[0][0] == "FORMAT XLONE REPORT") fromXLOne = true;
// dataObj = parsed.data;
var emptyCols = [];
//i[14] is the 'LEVIED' column
// i[15] is the 'PAID' column
dataObj = parsed.data.filter(function(i) {
return i[15] != "0.00"&& i[14] != "0.00";;
});
var container = document.querySelector("#output");
const hot = new Handsontable(container, {
data: dataObj,
licenseKey: "non-commercial-and-evaluation",
/* width: 400,
height: 300, */
colHeaders: true,
rowHeaders: true,
customBorders: true,
dropdownMenu: true,
multiColumnSorting: true,
filters: true,
manualRowMove: true,
readOnly: true,
})
}
});
</script>
<div><span id="fileDate"></span></div>
<div id="output"></div>