-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathback-up.html
More file actions
275 lines (237 loc) · 9.04 KB
/
Copy pathback-up.html
File metadata and controls
275 lines (237 loc) · 9.04 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<html><head><base href="https://websim.dev/developer_daily_report/">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Developer Daily Report</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
:root {
--primary-color: #3498db;
--text-color: #2c3e50;
--background-color: #ecf0f1;
--card-background: #ffffff;
--border-color: #bdc3c7;
--placeholder-color: #95a5a6;
--success-color: #2ecc71;
--hover-color: #2980b9;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
background-color: var(--background-color);
margin: 0;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
color: var(--text-color);
}
.container {
background-color: var(--card-background);
padding: 40px;
border-radius: 12px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 500px;
}
h1 {
text-align: center;
color: var(--text-color);
font-size: 28px;
font-weight: 700;
margin-bottom: 30px;
}
form {
display: flex;
flex-direction: column;
}
label {
margin-top: 20px;
font-weight: 600;
color: var(--text-color);
font-size: 14px;
}
input, select, textarea {
width: 100%;
padding: 12px 16px;
margin-top: 8px;
border: 1px solid var(--border-color);
border-radius: 8px;
box-sizing: border-box;
font-size: 16px;
transition: all 0.3s ease;
background-color: var(--card-background);
color: var(--text-color);
}
input::placeholder, textarea::placeholder {
color: var(--placeholder-color);
}
input:focus, select:focus, textarea:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}
button {
background-color: var(--primary-color);
color: white;
padding: 14px;
border: none;
border-radius: 8px;
cursor: pointer;
margin-top: 30px;
font-size: 16px;
font-weight: 600;
transition: all 0.3s ease;
}
button:hover {
background-color: var(--hover-color);
}
.category-wrapper {
position: relative;
}
.category-wrapper::after {
content: '▼';
font-size: 12px;
color: var(--placeholder-color);
position: absolute;
right: 16px;
top: 50%;
transform: translateY(-50%);
pointer-events: none;
}
select {
appearance: none;
-webkit-appearance: none;
padding-right: 40px;
}
.time-category {
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 20px;
margin-top: 20px;
background-color: #f8f9fa;
}
.time-category h3 {
font-size: 16px;
margin: 0 0 15px 0;
color: var(--text-color);
}
.success-message {
background-color: var(--success-color);
color: white;
padding: 10px;
border-radius: 8px;
text-align: center;
margin-top: 20px;
display: none;
}
</style>
</head>
<body>
<div class="container">
<h1>Developer Daily Report</h1>
<form id="reportForm">
<label for="task">Task:</label>
<textarea id="task" name="task" rows="3" required placeholder="Describe your task here..."></textarea>
<label for="category">Category:</label>
<div class="category-wrapper">
<select id="category" name="category" required>
<option value="" disabled selected>Select a category</option>
<option value="Bug">Bug</option>
<option value="R&D">R&D</option>
<option value="Feature">Feature</option>
</select>
</div>
<div class="time-category">
<h3>Optional Time Categories</h3>
<label for="featureSpent">Feature Spent:</label>
<input type="number" id="featureSpent" name="featureSpent" min="0" step="0.5" placeholder="Hours spent on features">
<label for="featureBugSpent">Feature Bug Spent:</label>
<input type="number" id="featureBugSpent" name="featureBugSpent" min="0" step="0.5" placeholder="Hours spent on feature bugs">
<label for="bugFixesSpent">Bug Fixes Spent:</label>
<input type="number" id="bugFixesSpent" name="bugFixesSpent" min="0" step="0.5" placeholder="Hours spent on bug fixes">
</div>
<label for="date">Date:</label>
<input type="date" id="date" name="date" required>
<label for="hours">Total Hours Spent:</label>
<input type="number" id="hours" name="hours" min="0" step="0.5" required placeholder="Enter total hours (e.g. 2.5)">
<button type="submit">Submit Report</button>
</form>
<div id="successMessage" class="success-message">Report submitted successfully!</div>
</div>
<script src="https://apis.google.com/js/api.js"></script>
<script>
// Your client ID and API key from the Developer Console
const CLIENT_ID = 'YOUR_CLIENT_ID';
const API_KEY = 'YOUR_API_KEY';
// Array of API discovery doc URLs for APIs used by the quickstart
const DISCOVERY_DOCS = ["https://sheets.googleapis.com/$discovery/rest?version=v4"];
// Authorization scopes required by the API
const SCOPES = "https://www.googleapis.com/auth/spreadsheets";
function handleClientLoad() {
gapi.load('client:auth2', initClient);
}
function initClient() {
gapi.client.init({
apiKey: API_KEY,
clientId: CLIENT_ID,
discoveryDocs: DISCOVERY_DOCS,
scope: SCOPES
}).then(function () {
// Listen for sign-in state changes.
gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);
// Handle the initial sign-in state.
updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
}, function(error) {
console.error('Error initializing Google API:', error);
});
}
function updateSigninStatus(isSignedIn) {
if (isSignedIn) {
// User is signed in, enable form submission
document.getElementById('reportForm').onsubmit = submitReport;
} else {
// User is not signed in, handle authentication when form is submitted
document.getElementById('reportForm').onsubmit = function(event) {
event.preventDefault();
gapi.auth2.getAuthInstance().signIn().then(submitReport);
};
}
}
function submitReport(event) {
if (event) event.preventDefault();
const task = document.getElementById('task').value;
const category = document.getElementById('category').value;
const featureSpent = document.getElementById('featureSpent').value || '0';
const featureBugSpent = document.getElementById('featureBugSpent').value || '0';
const bugFixesSpent = document.getElementById('bugFixesSpent').value || '0';
const date = document.getElementById('date').value;
const hours = document.getElementById('hours').value;
const formattedDate = new Date(date).toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric'
});
const values = [
['', task, category, formattedDate, hours, featureSpent, featureBugSpent, bugFixesSpent]
];
gapi.client.sheets.spreadsheets.values.append({
spreadsheetId: '1jbBSwireFHWEqeW2XLnW2PSHVytISaX5C-8-O1TdD7M',
range: 'Sheet1!A:H',
valueInputOption: 'USER_ENTERED',
resource: { values: values }
}).then(function(response) {
console.log('Report submitted:', response);
document.getElementById('successMessage').style.display = 'block';
document.getElementById('reportForm').reset();
setTimeout(() => {
document.getElementById('successMessage').style.display = 'none';
}, 3000);
}, function(error) {
console.error('Error submitting report:', error);
alert('Error submitting report. Please try again.');
});
}
handleClientLoad();
</script>
</body>
</html>