This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
137 lines (121 loc) · 5.89 KB
/
index.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!DOCTYPE html>
<html>
<head>
<title>American Redcross - CSV Tool</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=0.9">
<link rel="stylesheet" href="./css/bootstrap.min.css" />
<script src='angular.js'></script>
<script src='papaparse.js'></script>
<script src='angular_app.js'></script>
</head>
<body ng-app="masterApp" ng-controller="masterController">
<div ng-controller="selectMultipleDataSplitController" style="margin: 10px;">
<div class="row">
<div class="col-md-12"><label style="font-size: 16px; padding:5px;">American Redcross</label></div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Select File</h3>
</div>
<div class="panel-body">
<div class="col-md-12" style="padding: 10px; border: 1px solid #e3e0e0; background: #eff6fc">
<input type="file" file-change handler="fileSelect(files)" accept=".csv" />
</div>
<div ng-if="error" class="col-md-12">
{{error_message}}
</div>
<div ng-if="loading" style="color: red;" class="col-md-12">
Please wait...Loading...
</div>
</div>
</div>
</div>
</div>
<div class="row" ng-if="result.length>0">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Selected File Detail</h3>
</div>
<div class="panel-body">
<div class="col-md-12" style="padding: 5px; border: 1px solid #e3e0e0;">
<label>Total Records: {{result.length}}</label> <br>
<label>File Type: {{file_ext}}</label> <br>
<label>Number of Fields: {{headers.length}}</label>
<br>
<!-- UI issue -->
<!--
<label>Sample data: First 5 records</label>
<table class="table table-bordered table-striped">
<tr>
<th ng-repeat="head in headers"> {{head}}</th>
</tr>
<tr ng-repeat="data in result | limitTo:10">
<td ng-repeat="h in headers"> {{data[h]}}</td>
</tr>
</table>
-->
</div>
<div class="col-md-12" ng-if="result.length>0" style="padding: 10px; border: 1px solid #e3e0e0; background: #eff6fc">
<label>Select Fields to split and generate new CSV file.</label>
<div>
<table>
<tr ng-repeat="h in headers">
<td><input
type="checkbox"
name="selectedFields[]"
value=" {{h}}"
ng-checked="selected_fields.indexOf(h) > -1"
ng-click="toggleSelection(h)"
>
</td>
<td><label> {{h}}</label></td>
</tr>
</table>
Your selection: {{selected_fields}}
<br>
<button ng-click="generateCSV()" class="btn btn-primary">Generate </button>
<div style="color: red;" ng-if="loading">Please wait... Processing</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" ng-if="final_array.length>0">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Generated Result</h3>
</div>
<div class="panel-body">
<div >
<div class="alert alert-success">The new CSV file has been generated successfully.</div>
<label>Total Records: {{final_array.length}}</label> <br>
<label>File Type: {{file_ext}}</label> <br>
<label>Number of Fields (New CSV): {{headers_new.length}}</label>
<!-- UI issue -->
<!--
<label>First 5 records</label>
<table class="table table-bordered table-striped">
<tr>
<th ng-repeat="head in headers_new"> {{head}}</th>
</tr>
<tr ng-repeat="data in final_array | limitTo:6">
<td ng-repeat="h in headers_new"> {{data[h]}}</td>
</tr>
</table>
-->
<br>
<button ng-click="downloadCSV()" class="btn btn-success">Save Generated CSV</button>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>