Skip to content

Commit 671ad24

Browse files
committed
add calendar's from and to
1 parent 37654ae commit 671ad24

File tree

4 files changed

+47
-10
lines changed

4 files changed

+47
-10
lines changed

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@
1818
<div id="title">
1919
<p class="title">Web Activity Time Tracker</p>
2020
</div>
21-
<div id="buttons">
21+
<div id="buttons" class="btn-block">
2222
<input type="button" value="Today" class="active" id="btnToday"/>
2323
<input type="button" value="All" id="btnAll"/>
2424
<input type="button" value="By days" id="btnByDays"/>
2525
</div>
26-
<div id="chart" class="margin-top-7"></div>
26+
<div id="chart"></div>
2727
<div id="resultTable" class="list-of-site"></div>
2828
<div id="total" class="inline-flex"></div>
29+
<div id="byDays" class="calendar-block"></div>
2930
</body>
3031

3132
</html>

scripts/ui.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ class UI {
2222
document.getElementById('btnAll').classList.remove('active');
2323
document.getElementById('btnToday').classList.remove('active');
2424

25-
document.getElementById('resultTable').innerHTML = null;
26-
document.getElementById('chart').innerHTML = null;
25+
this.clearUI();
26+
this.addBlockForCalendar();
2727
}
2828

2929
clearUI() {
3030
document.getElementById('resultTable').innerHTML = null;
3131
document.getElementById('chart').innerHTML = null;
3232
document.getElementById('total').innerHTML = null;
33+
document.getElementById('byDays').innerHTML = null;
3334
}
3435

3536
createTotalBlock(totalTime) {
@@ -131,4 +132,28 @@ class UI {
131132
div.appendChild(spanTime);
132133
this.getTableOfSite().appendChild(div);
133134
}
135+
136+
addBlockForCalendar() {
137+
var div = document.getElementById('byDays');
138+
139+
var from = document.createElement('span');
140+
from.innerHTML = 'From';
141+
var to = document.createElement('span');
142+
to.innerHTML = 'To';
143+
144+
var calendarFirst = document.createElement('input');
145+
calendarFirst.type = 'date';
146+
var previousDate = new Date();
147+
previousDate.setDate(previousDate.getDate() - 7);
148+
calendarFirst.valueAsDate = previousDate;
149+
150+
var calendarTwo = document.createElement('input');
151+
calendarTwo.type = 'date';
152+
calendarTwo.valueAsDate = new Date();
153+
154+
div.appendChild(from);
155+
div.appendChild(calendarFirst);
156+
div.appendChild(to);
157+
div.appendChild(calendarTwo);
158+
}
134159
}

scripts/webact.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ function getTabsFromStorage(tabs) {
4444
tabsFromStorage = tabs;
4545
targetTabs = [];
4646

47-
var table = ui.getTableOfSite();
4847
ui.clearUI();
4948

5049
if (currentTypeOfList === TypeListEnum.All) {

style/webact.css

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,12 @@ body {
33
color: #262626;
44
}
55

6-
.margin-top-7{
7-
margin-top: 7px;
8-
}
9-
106
.list-of-site{
117
overflow-y: auto;
128
}
139

1410
.inline-flex{
1511
display: inline-flex;
16-
height: 25px;
1712
}
1813

1914
.inline-flex:hover{
@@ -107,6 +102,7 @@ input[type="button"]{
107102
border: 1px solid #0099CC;
108103
background: transparent;
109104
color: #0099CC;
105+
width: 32%;
110106
}
111107

112108
input[type="button"]:hover {
@@ -119,11 +115,27 @@ input[type="button"].active {
119115
color: white;
120116
}
121117

118+
input[type="date"]{
119+
margin: 4px 6px;
120+
height: 22px;
121+
}
122+
123+
.btn-block{
124+
width: 500px;
125+
margin-bottom: 7px;
126+
}
127+
122128
.no-data{
123129
width: 500px;
124130
text-align: center;
125131
font-weight: 600;
126132
font-size: 14px;
133+
}
134+
135+
.calendar-block{
136+
margin-top: -20px;
137+
}
138+
127139
.table-header{
128140
margin:3px 0;
129141
border-radius: 5px;

0 commit comments

Comments
 (0)