Skip to content

Commit b4659fe

Browse files
authored
Merge pull request #3 from Kushal0189/master
new upload
2 parents 9c0704b + 5451f69 commit b4659fe

File tree

1 file changed

+229
-0
lines changed

1 file changed

+229
-0
lines changed

templates/testing.html

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
<html>
2+
<head>
3+
4+
<title>Data Upload</title>
5+
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
8+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
9+
10+
11+
<!--<link rel="shortcut icon" type="image/png" href="image/shortcut.png">-->
12+
13+
<link rel="stylesheet" media="screen" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css">
14+
15+
16+
<style>
17+
.navbar-header{
18+
margin-left:5px;
19+
width:100%;
20+
}
21+
</style>
22+
23+
24+
<script>
25+
26+
$(document).ready(function() {
27+
function disablePrev() { window.history.forward() }
28+
window.onload = disablePrev();
29+
window.onpageshow = function(evt) { if (evt.persisted) disableBack() }
30+
});
31+
32+
var queryString = "";
33+
window.onload = function(){
34+
if(queryString.length == 0)
35+
{
36+
if(window.location.search.split('?').length > 1)
37+
{
38+
var key = decodeURIComponent(window.location.search.split('=')[1]);
39+
queryString = queryString + key;
40+
}
41+
}
42+
if(queryString == "1")
43+
{
44+
document.getElementById("excel").style.display = 'block' ;
45+
document.getElementById("pageheading").style.display = 'none' ;
46+
document.getElementById("pagebutton").style.display = 'none' ;
47+
}
48+
if(queryString == "2")
49+
{
50+
document.getElementById("twitter").style.display = 'block';
51+
document.getElementById("pageheading").style.display = 'none';
52+
document.getElementById("pagebutton").style.display = 'none';
53+
}
54+
if(queryString == "")
55+
{
56+
document.getElementById("excel").style.display = 'none' ;
57+
document.getElementById("twitter").style.display = 'none';
58+
}
59+
};
60+
61+
62+
/*$(document).ready(function(){
63+
$("#excel").hide();
64+
$("#twitter").hide();
65+
});*/
66+
67+
function Send()
68+
{
69+
var url = "./test.html?name=" + encodeURIComponent('1');
70+
window.location.href = url;
71+
return false;
72+
}
73+
74+
</script>
75+
76+
</head>
77+
<body>
78+
79+
80+
<!--Navbar starts here-->
81+
<nav class="navbar navbar-inverse navbar-fixed-top" style="background-color: white;border-color: floralwhite">
82+
<div class="container-fluid">
83+
<!-- Brand and toggle get grouped for better mobile display -->
84+
<div class="navbar-header">
85+
<a class="navbar-brand" href="index"><i class="fas fa-desktop"></i> Admin Dashboard </a>
86+
<form class="form-inline my-2 my-lg-0">
87+
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" style="float:right;margin-top:8px">
88+
<!--<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>-->
89+
</form>
90+
</div>
91+
</div>
92+
</nav>
93+
<!--Navbar Ends-->
94+
95+
96+
<!--Sidebar Starts-->
97+
<div class="col-sm-3 col-md-2 sidebar" style="background-color: white;height:605px;border-right-color: ghostwhite;position: fixed">
98+
<ul class="nav nav-sidebar">
99+
<li><a href="dataanalysis.html"><i class="glyphicon glyphicon-signal" style="padding-right: 5px"></i>Data Analysis</a></li>
100+
<li><a href="pastdata.html"><i class="glyphicon glyphicon-list-alt" style="padding-right: 5px"></i>Past Reports</a></li>
101+
<li><a href="about.html"><i class="glyphicon glyphicon-user" style="padding-right: 5px"></i>About</a></li>
102+
<li><a href="contact.html"><i class="glyphicon glyphicon-pencil" style="padding-right: 5px"></i>Contact Us</a></li>
103+
<p style="margin-top: 420px;color: black;font-size: 10px">@CopyRights-2020</p>
104+
</ul>
105+
</div>
106+
<!--Sidebar Ends-->
107+
108+
109+
110+
<div class="container" style="margin-top: 50px;margin-left: 230px">
111+
<div class="page-header" id="pageheading">
112+
<h1>Choose Your Option</h1>
113+
</div>
114+
115+
<div align="center" id="pagebutton">
116+
<button type="button" class="btn btn-info" id="upload">Upload Your CSV File</button>
117+
<button type="button" class="btn btn-info" id="api">Fetch Data From Twiiter</button>
118+
</div>
119+
120+
<div class="custom-file mb-3" id="excel" style="display: none">
121+
<form class="form-group" method="post">
122+
123+
<label class="custom-file-label" for="customFile"><h2>Upload Your File</h2></label>
124+
<input type="file" class="custom-file-input" id="customFile" name="filename">
125+
126+
<!--<div class="table-responsive">-->
127+
<br/>
128+
<div align="center">
129+
<input type="submit" value="LoadData" name="load_data" id="load_data" class="btn btn-info">
130+
</div>
131+
</form>
132+
<br/>
133+
<div align="center">
134+
<button type="button" class="btn btn-info" id="next" onclick="return Send()">Next</button>
135+
</div>
136+
137+
</div>
138+
<br/>
139+
<div class="table-responsive">
140+
<div id="table">
141+
</div>
142+
</div>
143+
144+
145+
<div class="custom-file mb-3" id="twitter" style="display: none">
146+
<form class="form-group" method="post">
147+
<h1>Enter Twitter Details</h1>
148+
<input type="text" class="form-control" placeholder="Enter No. of Tweets" aria-describedby="basic-addon1" style="width:90%">
149+
<br/>
150+
<div align="center">
151+
<input type="submit" class="btn btn-info" id="" value="submit">
152+
</div>
153+
</form>
154+
<br/>
155+
<div align="center">
156+
<button type="button" class="btn btn-info" id="next" onclick="return Send()">Next</button>
157+
</div>
158+
</div>
159+
</div>
160+
161+
162+
<script>
163+
164+
/*$("#upload").click(function(){
165+
$("#excel").show();
166+
$("#pageheading").hide();
167+
$("#pagebutton").hide();
168+
$("#next").hide();
169+
});
170+
171+
$("#api").click(function(){
172+
$("#twitter").show();
173+
$("#pageheading").hide();
174+
$("#pagebutton").hide();
175+
$("#next").hide();
176+
});
177+
178+
$("#customFile").click(function(){
179+
$("#load_data").show();
180+
});
181+
182+
$("#load_data").click(function(){
183+
$("#next").show();
184+
});*/
185+
186+
var fil = "";
187+
188+
$('#load_data').click(function(){
189+
fil = fil + document.getElementById("customFile").files[0].name;
190+
console.log(document.getElementById("customFile").files[0]);
191+
});
192+
193+
194+
$(document).ready(function(){
195+
$('#load_data').click(function(){
196+
$.ajax({
197+
url:fil,
198+
dataType:"text",
199+
success:function(data){
200+
var data = data.split(/\r?\n|\r/);
201+
var table_data = '<table class="table table-bordered table-striped">';
202+
for(var count = 0; count<data.length; count++)
203+
{
204+
var cell_data = data[count].split(",");
205+
table_data += '<tr>';
206+
for(var cell_count=0; cell_count<cell_data.length; cell_count++)
207+
{
208+
if(count === 0)
209+
{
210+
table_data += '<th>'+cell_data[cell_count]+'</th>';
211+
}
212+
else
213+
{
214+
table_data += '<td>'+cell_data[cell_count]+'</td>';
215+
}
216+
}
217+
table_data += '</tr>';
218+
}
219+
table_data += '</table>';
220+
$('#table').html(table_data);
221+
}
222+
});
223+
});
224+
});
225+
226+
</script>
227+
228+
</body>
229+
</html>

0 commit comments

Comments
 (0)