Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Time-Tracking-Application-Client-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kaustubh Negi
Time-Tracking-Application-Client-End
Commits
79e157df
Commit
79e157df
authored
Mar 01, 2023
by
Kaustubh Negi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 'master'
01-03-2023 See merge request
!7
parents
31ec07f1
55144538
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
2 deletions
+94
-2
attend.component.html
src/app/attend/attend.component.html
+11
-0
attend.component.ts
src/app/attend/attend.component.ts
+30
-2
time-entry-service.service.spec.ts
src/app/time-entry-service.service.spec.ts
+16
-0
time-entry-service.service.ts
src/app/time-entry-service.service.ts
+37
-0
No files found.
src/app/attend/attend.component.html
View file @
79e157df
...
@@ -149,6 +149,17 @@
...
@@ -149,6 +149,17 @@
<td>
Oppo
</td>
<td>
Oppo
</td>
<td>
OneClick
</td>
<td>
OneClick
</td>
</tr>
</tr>
<tr
*
ngFor=
"let entry of timeEntries"
>
<td>
{{ entry['S. No.'] }}
</td>
<td>
{{ entry['Date'] }}
</td>
<td>
{{ entry['Punch In'] }}
</td>
<td>
{{ entry['Punch Out'] }}
</td>
<td>
{{ entry['Project 1'] }}
</td>
<td>
{{ entry['Project 2'] }}
</td>
<td>
{{ entry['Project 3'] }}
</td>
</tr>
</tbody>
</tbody>
</table>
</table>
</div>
</div>
...
...
src/app/attend/attend.component.ts
View file @
79e157df
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
SendDateService
}
from
'../send-date.service'
;
import
{
SendDateService
}
from
'../send-date.service'
;
import
{
TimeEntryServiceService
}
from
'../time-entry-service.service'
;
// import { interval } from 'rxjs';
// import { interval } from 'rxjs';
import
{
DatePipe
}
from
'@angular/common'
;
import
{
DatePipe
}
from
'@angular/common'
;
import
"bootstrap"
;
import
"bootstrap"
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
ToastrService
}
from
'ngx-toastr'
;
import
{
Router
}
from
'@angular/router'
;
import
{
Router
}
from
'@angular/router'
;
import
{
HttpClient
}
from
'@angular/common/http'
;
@
Component
({
@
Component
({
...
@@ -17,13 +20,21 @@ export class AttendComponent implements OnInit {
...
@@ -17,13 +20,21 @@ export class AttendComponent implements OnInit {
timeEntries
:
any
[]
=
[];
// constructor(private datePipe: DatePipe) {}
// constructor(private datePipe: DatePipe) {}
constructor
(
private
sendDateService
:
SendDateService
,
private
toastr
:
ToastrService
,
private
router
:
Router
){}
constructor
(
private
http
:
HttpClient
,
private
timeEntryService
:
TimeEntryServiceService
,
private
sendDateService
:
SendDateService
,
private
toastr
:
ToastrService
,
private
router
:
Router
){}
getTimeEntries
()
{
// Call an API endpoint to get the time entries from the backend
this
.
http
.
get
<
any
[]
>
(
'http://localhost:3000/timeEntries'
)
.
subscribe
((
data
:
any
[])
=>
{
this
.
timeEntries
=
data
;
console
.
log
(
this
.
timeEntries
);
});
}
ngOnInit
():
void
{
ngOnInit
():
void
{
// const clock$ = interval(1000);
// const clock$ = interval(1000);
// clock$.subscribe(() => {
// clock$.subscribe(() => {
...
@@ -44,6 +55,23 @@ export class AttendComponent implements OnInit {
...
@@ -44,6 +55,23 @@ export class AttendComponent implements OnInit {
// }
// }
// const empCode = 'ABC123'; // replace with the employee code to fetch the time entries for
// this.timeEntryService.getTimeEntriesForEmployee(empCode).subscribe(
// (data) => {
// this.timeEntries = data; // assign the time entries to the component property
// console.log("checking if the time entries are fetched");
// console.log(this.timeEntries);
// console.log("time entries should be displayed above this line")
// },
// (error) => {
// console.error('Error fetching time entries:', error);
// }
// );
this
.
getTimeEntries
();
}
}
startTime
:
Date
;
startTime
:
Date
;
endTime
:
Date
;
endTime
:
Date
;
...
...
src/app/time-entry-service.service.spec.ts
0 → 100644
View file @
79e157df
import
{
TestBed
}
from
'@angular/core/testing'
;
import
{
TimeEntryServiceService
}
from
'./time-entry-service.service'
;
describe
(
'TimeEntryServiceService'
,
()
=>
{
let
service
:
TimeEntryServiceService
;
beforeEach
(()
=>
{
TestBed
.
configureTestingModule
({});
service
=
TestBed
.
inject
(
TimeEntryServiceService
);
});
it
(
'should be created'
,
()
=>
{
expect
(
service
).
toBeTruthy
();
});
});
src/app/time-entry-service.service.ts
0 → 100644
View file @
79e157df
import
{
Injectable
}
from
'@angular/core'
;
import
{
HttpClient
}
from
'@angular/common/http'
;
import
{
Observable
}
from
'rxjs'
;
import
{
map
}
from
'rxjs/operators'
;
@
Injectable
({
providedIn
:
'root'
})
export
class
TimeEntryServiceService
{
private
baseUrl
=
'http://localhost:3000/timeEntries'
;
// replace with your backend API endpoint
constructor
(
private
http
:
HttpClient
)
{
}
// fetch the time entries for an employee from the backend
getTimeEntriesForEmployee
(
empCode
:
string
):
Observable
<
any
>
{
let
token
:
string
=
""
;
let
json
:
string
|
null
=
localStorage
.
getItem
(
"response"
);
if
(
json
)
{
console
.
log
(
"json "
+
json
);
token
=
JSON
.
parse
(
json
).
token
;
console
.
log
(
token
);
}
const
headers
=
{
'Content-Type'
:
'application/json'
,
'Authorization'
:
`Bearer
${
token
}
`
};
return
this
.
http
.
get
<
any
>
(
this
.
baseUrl
,
{
headers
}).
pipe
(
map
((
response
)
=>
response
.
data
)
// extract the data property from the response
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment