Employee - Email Reminders

The screen below is used by employees to set email reminders for themselves to fill the time sheet for the day.


Back-end Changes

  1. com.fastcode.timesheetapp1.restcontrollers.extended.UserControllerExtended.java.

(i) Add the method createTriggerAndSendEmail.

@RequestMapping(value= "/reminder",method = RequestMethod.POST, consumes = {"application/json"}, produces = {"application/json"})
public ResponseEntity<Map<String,String>> createTriggerAndSendEmail(@RequestBody @Valid EmailTriggerInfo info) throws ClassNotFoundException, Exception

(ii) Add the method getReminderDetails.

@RequestMapping(value= "/getReminderDetails",method = RequestMethod.GET, consumes = {"application/json"}, produces = {"application/json"})

public ResponseEntity<Map<String,String>> getReminderDetails() throws ClassNotFoundException, Exception
  1. com.fastcode.timesheetapp1.restcontrollers.extended.UserAppServiceExtended.java.

When deleting a user, delete the associated trigger. Override the delete method.

//Override delete user method to remove associated trigger

public void delete(Long usersId)

Front-end Changes

  1. Create the Notifications angular component.

Create the component under src\app\extended\timesheet-module. The files for this component are present at the following relative path:

(i) \notifications\notifications.component.html
(ii) \notifications\notifications.component.scss
(iii) \notifications\notifications.component.ts

  1. Add the component's entry in entities array in timesheet.module.ts file.
import { NotificationsComponent } from 'src/app/extended/timesheet-module/notifications/notifications.component';

const entities = [NotificationsComponent]
  1. Add the component's entry in routes array timesheet.routing.ts file.
import { NotificationsComponent } from 'src/app/extended/timesheet-module/notifications/notifications.component';

const routes: Routes = [
{ path: "notifications", component: NotificationsComponent, canActivate: [ AuthGuard ] }];
  1. Add the methods setReminder and getReminderDetails in src/app/extended/admin/user-management/users/users.service.ts.
public setReminder(input): Observable<any> {
    return this.httpclient
      .post(this.url + '/reminder', input).pipe(catchError(this.handleError));

  public getReminderDetails(): Observable<any> {
    return this.httpclient
      .get(this.url + '/getReminderDetails').pipe(catchError(this.handleError));
  1. Create permission with name SET_REMINDER that is to be assigned to the Employee role (ROLE_Employee). Add the permission SET_REMINDER in the setPermission method in src/app/extended/core/main-nav/main-nav.component.ts.
setPermissions() {
  1. Add the code to show menu option for setting reminders. Add the code in in the file src/app/extended/core/main-nav/main-nav.component.html
<button mat-menu-item routerLink="/notifications" *ngIf="permissions['SET_REMINDER']">
        <mat-icon class="menu-item">notifications</mat-icon>
        &nbsp; {{'TIMESHEET.NOTIFICATIONS' | translate}}