diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java index f9801fb..df7ee6a 100644 --- a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java @@ -69,6 +69,15 @@ public class BuilderService { executeDump(true); // ADD OTHER SERVICE +addCustomMenu( "Analytics","Analytics", "Transcations"); + + +addCustomMenu( "Frequency","Frequency", "Master"); + + +addCustomMenu( "Create_new_habit","Create_new_habit", "Transcations"); + + System.out.println("dashboard and menu inserted..."); diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/AnalyticsController.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/AnalyticsController.java new file mode 100644 index 0000000..a2454a0 --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/AnalyticsController.java @@ -0,0 +1,107 @@ +package com.realnet.basic.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.springframework.web.bind.annotation.CrossOrigin; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.realnet.config.EmailService; +import com.realnet.users.entity1.AppUser; +import com.realnet.users.service1.AppUserServiceImpl; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.data.domain.*; +import com.realnet.fnd.response.EntityResponse; +import org.springframework.http.*; +import org.springframework.beans.factory.annotation.*; +import com.realnet.basic.Entity.Analytics; +import com.realnet.basic.Services.AnalyticsService ; + + + + + + + + +@RequestMapping(value = "/Analytics") + @CrossOrigin("*") +@RestController +public class AnalyticsController { + @Autowired + private AnalyticsService Service; + +@Value("${projectPath}") + private String projectPath; + + + + + + + + + + @PostMapping("/Analytics") + public Analytics Savedata(@RequestBody Analytics data) { + Analytics save = Service.Savedata(data) ; + + + + + + + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Analytics/{id}") + public Analytics update(@RequestBody Analytics data,@PathVariable Integer id ) { + Analytics update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Analytics/getall/page") + public Page getall(@RequestParam(value = "page", required = false) Integer page, + @RequestParam(value = "size", required = false) Integer size) { + Pageable paging = PageRequest.of(page, size); + Page get = Service.getAllWithPagination(paging); + + return get; + + } + @GetMapping("/Analytics") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Analytics") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Analytics/{id}") + public Analytics getdetailsbyId(@PathVariable Integer id ) { + Analytics get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Analytics/{id}") + public ResponseEntity delete_by_id(@PathVariable Integer id ) { + Service.delete_by_id(id); + return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); + + } + + + + + + + + + +} \ No newline at end of file diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/Create_new_habitController.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/Create_new_habitController.java new file mode 100644 index 0000000..61d7c82 --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/Create_new_habitController.java @@ -0,0 +1,99 @@ +package com.realnet.basic.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.springframework.web.bind.annotation.CrossOrigin; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.realnet.config.EmailService; +import com.realnet.users.entity1.AppUser; +import com.realnet.users.service1.AppUserServiceImpl; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.data.domain.*; +import com.realnet.fnd.response.EntityResponse; +import org.springframework.http.*; +import org.springframework.beans.factory.annotation.*; +import com.realnet.basic.Entity.Create_new_habit; +import com.realnet.basic.Services.Create_new_habitService ; + + + + + + +@RequestMapping(value = "/Create_new_habit") + @CrossOrigin("*") +@RestController +public class Create_new_habitController { + @Autowired + private Create_new_habitService Service; + +@Value("${projectPath}") + private String projectPath; + + + + + + + + @PostMapping("/Create_new_habit") + public Create_new_habit Savedata(@RequestBody Create_new_habit data) { + Create_new_habit save = Service.Savedata(data) ; + + + + + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Create_new_habit/{id}") + public Create_new_habit update(@RequestBody Create_new_habit data,@PathVariable Integer id ) { + Create_new_habit update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Create_new_habit/getall/page") + public Page getall(@RequestParam(value = "page", required = false) Integer page, + @RequestParam(value = "size", required = false) Integer size) { + Pageable paging = PageRequest.of(page, size); + Page get = Service.getAllWithPagination(paging); + + return get; + + } + @GetMapping("/Create_new_habit") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Create_new_habit") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Create_new_habit/{id}") + public Create_new_habit getdetailsbyId(@PathVariable Integer id ) { + Create_new_habit get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Create_new_habit/{id}") + public ResponseEntity delete_by_id(@PathVariable Integer id ) { + Service.delete_by_id(id); + return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); + + } + + + + + + + +} \ No newline at end of file diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/FrequencyController.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/FrequencyController.java new file mode 100644 index 0000000..e8e04d7 --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/FrequencyController.java @@ -0,0 +1,83 @@ +package com.realnet.basic.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.springframework.web.bind.annotation.CrossOrigin; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.realnet.config.EmailService; +import com.realnet.users.entity1.AppUser; +import com.realnet.users.service1.AppUserServiceImpl; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.data.domain.*; +import com.realnet.fnd.response.EntityResponse; +import org.springframework.http.*; +import org.springframework.beans.factory.annotation.*; +import com.realnet.basic.Entity.Frequency; +import com.realnet.basic.Services.FrequencyService ; + + +@RequestMapping(value = "/Frequency") + @CrossOrigin("*") +@RestController +public class FrequencyController { + @Autowired + private FrequencyService Service; + +@Value("${projectPath}") + private String projectPath; + + + + @PostMapping("/Frequency") + public Frequency Savedata(@RequestBody Frequency data) { + Frequency save = Service.Savedata(data) ; + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Frequency/{id}") + public Frequency update(@RequestBody Frequency data,@PathVariable Integer id ) { + Frequency update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Frequency/getall/page") + public Page getall(@RequestParam(value = "page", required = false) Integer page, + @RequestParam(value = "size", required = false) Integer size) { + Pageable paging = PageRequest.of(page, size); + Page get = Service.getAllWithPagination(paging); + + return get; + + } + @GetMapping("/Frequency") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Frequency") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Frequency/{id}") + public Frequency getdetailsbyId(@PathVariable Integer id ) { + Frequency get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Frequency/{id}") + public ResponseEntity delete_by_id(@PathVariable Integer id ) { + Service.delete_by_id(id); + return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); + + } + + + +} \ No newline at end of file diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/Frequency_ListFilter1Controller.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/Frequency_ListFilter1Controller.java new file mode 100644 index 0000000..0f48d59 --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/Frequency_ListFilter1Controller.java @@ -0,0 +1,24 @@ +package com.realnet.basic.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import com.realnet.basic.Entity.Frequency_ListFilter1; +import com.realnet.basic.Services.Frequency_ListFilter1Service ; +@RequestMapping(value = "/Frequency_ListFilter1") +@RestController +public class Frequency_ListFilter1Controller { + + @Autowired + private Frequency_ListFilter1Service Service; + + @GetMapping("/Frequency_ListFilter1") + public List getlist() { + List get = Service.getlistbuilder(); + return get; +} + @GetMapping("/Frequency_ListFilter11") + public List getlistwithparam( ) { + List get = Service.getlistbuilderparam( ); + return get; +} +} \ No newline at end of file diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/tokenFree_AnalyticsController.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/tokenFree_AnalyticsController.java new file mode 100644 index 0000000..403a83b --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/tokenFree_AnalyticsController.java @@ -0,0 +1,107 @@ +package com.realnet.basic.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.springframework.web.bind.annotation.CrossOrigin; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.realnet.config.EmailService; +import com.realnet.users.entity1.AppUser; +import com.realnet.users.service1.AppUserServiceImpl; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.data.domain.*; +import com.realnet.fnd.response.EntityResponse; +import org.springframework.http.*; +import org.springframework.beans.factory.annotation.*; +import com.realnet.basic.Entity.Analytics; +import com.realnet.basic.Services.AnalyticsService ; + + + + + + + + +@RequestMapping(value = "/token/Analytics") + @CrossOrigin("*") +@RestController +public class tokenFree_AnalyticsController { + @Autowired + private AnalyticsService Service; + +@Value("${projectPath}") + private String projectPath; + + + + + + + + + + @PostMapping("/Analytics") + public Analytics Savedata(@RequestBody Analytics data) { + Analytics save = Service.Savedata(data) ; + + + + + + + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Analytics/{id}") + public Analytics update(@RequestBody Analytics data,@PathVariable Integer id ) { + Analytics update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Analytics/getall/page") + public Page getall(@RequestParam(value = "page", required = false) Integer page, + @RequestParam(value = "size", required = false) Integer size) { + Pageable paging = PageRequest.of(page, size); + Page get = Service.getAllWithPagination(paging); + + return get; + + } + @GetMapping("/Analytics") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Analytics") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Analytics/{id}") + public Analytics getdetailsbyId(@PathVariable Integer id ) { + Analytics get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Analytics/{id}") + public ResponseEntity delete_by_id(@PathVariable Integer id ) { + Service.delete_by_id(id); + return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); + + } + + + + + + + + + +} \ No newline at end of file diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/tokenFree_Create_new_habitController.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/tokenFree_Create_new_habitController.java new file mode 100644 index 0000000..06534a8 --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/tokenFree_Create_new_habitController.java @@ -0,0 +1,99 @@ +package com.realnet.basic.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.springframework.web.bind.annotation.CrossOrigin; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.realnet.config.EmailService; +import com.realnet.users.entity1.AppUser; +import com.realnet.users.service1.AppUserServiceImpl; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.data.domain.*; +import com.realnet.fnd.response.EntityResponse; +import org.springframework.http.*; +import org.springframework.beans.factory.annotation.*; +import com.realnet.basic.Entity.Create_new_habit; +import com.realnet.basic.Services.Create_new_habitService ; + + + + + + +@RequestMapping(value = "/token/Create_new_habit") + @CrossOrigin("*") +@RestController +public class tokenFree_Create_new_habitController { + @Autowired + private Create_new_habitService Service; + +@Value("${projectPath}") + private String projectPath; + + + + + + + + @PostMapping("/Create_new_habit") + public Create_new_habit Savedata(@RequestBody Create_new_habit data) { + Create_new_habit save = Service.Savedata(data) ; + + + + + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Create_new_habit/{id}") + public Create_new_habit update(@RequestBody Create_new_habit data,@PathVariable Integer id ) { + Create_new_habit update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Create_new_habit/getall/page") + public Page getall(@RequestParam(value = "page", required = false) Integer page, + @RequestParam(value = "size", required = false) Integer size) { + Pageable paging = PageRequest.of(page, size); + Page get = Service.getAllWithPagination(paging); + + return get; + + } + @GetMapping("/Create_new_habit") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Create_new_habit") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Create_new_habit/{id}") + public Create_new_habit getdetailsbyId(@PathVariable Integer id ) { + Create_new_habit get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Create_new_habit/{id}") + public ResponseEntity delete_by_id(@PathVariable Integer id ) { + Service.delete_by_id(id); + return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); + + } + + + + + + + +} \ No newline at end of file diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/tokenFree_FrequencyController.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/tokenFree_FrequencyController.java new file mode 100644 index 0000000..8857883 --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/tokenFree_FrequencyController.java @@ -0,0 +1,83 @@ +package com.realnet.basic.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.springframework.web.bind.annotation.CrossOrigin; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.realnet.config.EmailService; +import com.realnet.users.entity1.AppUser; +import com.realnet.users.service1.AppUserServiceImpl; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.data.domain.*; +import com.realnet.fnd.response.EntityResponse; +import org.springframework.http.*; +import org.springframework.beans.factory.annotation.*; +import com.realnet.basic.Entity.Frequency; +import com.realnet.basic.Services.FrequencyService ; + + +@RequestMapping(value = "/token/Frequency") + @CrossOrigin("*") +@RestController +public class tokenFree_FrequencyController { + @Autowired + private FrequencyService Service; + +@Value("${projectPath}") + private String projectPath; + + + + @PostMapping("/Frequency") + public Frequency Savedata(@RequestBody Frequency data) { + Frequency save = Service.Savedata(data) ; + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Frequency/{id}") + public Frequency update(@RequestBody Frequency data,@PathVariable Integer id ) { + Frequency update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Frequency/getall/page") + public Page getall(@RequestParam(value = "page", required = false) Integer page, + @RequestParam(value = "size", required = false) Integer size) { + Pageable paging = PageRequest.of(page, size); + Page get = Service.getAllWithPagination(paging); + + return get; + + } + @GetMapping("/Frequency") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Frequency") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Frequency/{id}") + public Frequency getdetailsbyId(@PathVariable Integer id ) { + Frequency get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Frequency/{id}") + public ResponseEntity delete_by_id(@PathVariable Integer id ) { + Service.delete_by_id(id); + return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK); + + } + + + +} \ No newline at end of file diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/tokenFree_Frequency_ListFilter1Controller.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/tokenFree_Frequency_ListFilter1Controller.java new file mode 100644 index 0000000..6471cbb --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Controllers/tokenFree_Frequency_ListFilter1Controller.java @@ -0,0 +1,24 @@ +package com.realnet.basic.Controllers; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.web.bind.annotation.*; +import com.realnet.basic.Entity.Frequency_ListFilter1; +import com.realnet.basic.Services.Frequency_ListFilter1Service ; +@RequestMapping(value = "/token/Frequency_ListFilter1") +@RestController +public class tokenFree_Frequency_ListFilter1Controller { + + @Autowired + private Frequency_ListFilter1Service Service; + + @GetMapping("/Frequency_ListFilter1") + public List getlist() { + List get = Service.getlistbuilder(); + return get; +} + @GetMapping("/Frequency_ListFilter11") + public List getlistwithparam( ) { + List get = Service.getlistbuilderparam( ); + return get; +} +} \ No newline at end of file diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Entity/Analytics.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Entity/Analytics.java new file mode 100644 index 0000000..599749d --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Entity/Analytics.java @@ -0,0 +1,36 @@ +package com.realnet.basic.Entity; + import lombok.*; +import com.realnet.WhoColumn.Entity.Extension; + import javax.persistence.*; + import java.time.LocalDateTime; + import java.util.*; + + + + + + + + + @Entity + @Data + public class Analytics extends Extension { + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + +private int longest_streak; + +private int completed_today; + +private int total_habits; + +private String frequency_analysis; + + +} diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Entity/Create_new_habit.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Entity/Create_new_habit.java new file mode 100644 index 0000000..cc1e08f --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Entity/Create_new_habit.java @@ -0,0 +1,34 @@ +package com.realnet.basic.Entity; + import lombok.*; +import com.realnet.WhoColumn.Entity.Extension; + import javax.persistence.*; + import java.time.LocalDateTime; + import java.util.*; + + + + + + + @Entity + @Data + public class Create_new_habit extends Extension { + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + +private String habit_name; + +@Column(length = 2000) +private String description; + +private String frequency; +private String frequencyname; + + +} diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Entity/Frequency.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Entity/Frequency.java new file mode 100644 index 0000000..f42bccc --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Entity/Frequency.java @@ -0,0 +1,24 @@ +package com.realnet.basic.Entity; + import lombok.*; +import com.realnet.WhoColumn.Entity.Extension; + import javax.persistence.*; + import java.time.LocalDateTime; + import java.util.*; + + + @Entity + @Data + public class Frequency extends Extension { + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + +private String name; + + +} diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Entity/Frequency_ListFilter1.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Entity/Frequency_ListFilter1.java new file mode 100644 index 0000000..3b03226 --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Entity/Frequency_ListFilter1.java @@ -0,0 +1,14 @@ +package com.realnet.basic.Entity; + import lombok.*; + import javax.persistence.*; + import java.time.LocalDateTime; + import java.util.*; + + @Data + public class Frequency_ListFilter1 { + + private Integer id; + + + private String name; +} diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Repository/AnalyticsRepository.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Repository/AnalyticsRepository.java new file mode 100644 index 0000000..f0397a1 --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Repository/AnalyticsRepository.java @@ -0,0 +1,32 @@ +package com.realnet.basic.Repository; + + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import org.springframework.stereotype.Repository; +import java.util.*; + + + + + + + + + + + +import com.realnet.basic.Entity.Analytics; + +@Repository +public interface AnalyticsRepository extends JpaRepository { + +@Query(value = "select * from analytics where created_by=?1", nativeQuery = true) + List findAll(Long creayedBy); + +@Query(value = "select * from analytics where created_by=?1", nativeQuery = true) + Page findAll(Pageable page, Long creayedBy); +} \ No newline at end of file diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Repository/Create_new_habitRepository.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Repository/Create_new_habitRepository.java new file mode 100644 index 0000000..72dff26 --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Repository/Create_new_habitRepository.java @@ -0,0 +1,30 @@ +package com.realnet.basic.Repository; + + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import org.springframework.stereotype.Repository; +import java.util.*; + + + + + + + + + +import com.realnet.basic.Entity.Create_new_habit; + +@Repository +public interface Create_new_habitRepository extends JpaRepository { + +@Query(value = "select * from create_new_habit where created_by=?1", nativeQuery = true) + List findAll(Long creayedBy); + +@Query(value = "select * from create_new_habit where created_by=?1", nativeQuery = true) + Page findAll(Pageable page, Long creayedBy); +} \ No newline at end of file diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Repository/FrequencyRepository.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Repository/FrequencyRepository.java new file mode 100644 index 0000000..0027e4d --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Repository/FrequencyRepository.java @@ -0,0 +1,26 @@ +package com.realnet.basic.Repository; + + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import org.springframework.stereotype.Repository; +import java.util.*; + + + + + +import com.realnet.basic.Entity.Frequency; + +@Repository +public interface FrequencyRepository extends JpaRepository { + +@Query(value = "select * from frequency where created_by=?1", nativeQuery = true) + List findAll(Long creayedBy); + +@Query(value = "select * from frequency where created_by=?1", nativeQuery = true) + Page findAll(Pageable page, Long creayedBy); +} \ No newline at end of file diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Services/AnalyticsService.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Services/AnalyticsService.java new file mode 100644 index 0000000..bb1d0d8 --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Services/AnalyticsService.java @@ -0,0 +1,103 @@ +package com.realnet.basic.Services; +import com.realnet.basic.Repository.AnalyticsRepository; +import com.realnet.basic.Entity.Analytics +;import java.util.*; + +import org.springframework.beans.factory.annotation.Autowired; +import com.realnet.SequenceGenerator.Service.SequenceService; +import org.springframework.data.domain.Page; +import com.realnet.realm.Entity.Realm; +import com.realnet.realm.Services.RealmService; +import org.springframework.data.domain.Pageable; +import org.springframework.http.*; +import com.realnet.users.service1.AppUserServiceImpl; +import com.realnet.users.entity1.AppUser; + + + + + + + + + import org.springframework.stereotype.Service; + +@Service + public class AnalyticsService { +@Autowired +private AnalyticsRepository Repository; + @Autowired + private AppUserServiceImpl userService; +@Autowired + private RealmService realmService; + + + + + + + +public Analytics Savedata(Analytics data) { + + + + + + + + + data.setUpdatedBy(getUser().getUserId()); + data.setCreatedBy(getUser().getUserId()); + data.setAccountId(getUser().getAccount().getAccount_id()); +Analytics save = Repository.save(data); + return save; + } + + +// get all with pagination + public Page getAllWithPagination(Pageable page) { + return Repository.findAll(page, getUser().getUserId()); + } +public List getdetails() { + List realm = realmService.findByUserId(getUser().getUserId()); +List all = Repository.findAll(getUser().getUserId()); + + return all ; } + + +public Analytics getdetailsbyId(Integer id) { + return Repository.findById(id).get(); + } + + + public void delete_by_id(Integer id) { + Repository.deleteById(id); +} + + +public Analytics update(Analytics data,Integer id) { + Analytics old = Repository.findById(id).get(); +old.setLongest_streak(data.getLongest_streak()); + +old.setCompleted_today(data.getCompleted_today()); + +old.setTotal_habits(data.getTotal_habits()); + +old.setFrequency_analysis(data.getFrequency_analysis()); + +final Analytics test = Repository.save(old); + data.setUpdatedBy(getUser().getUserId()); + return test;} + + + + + + + + + public AppUser getUser() { + AppUser user = userService.getLoggedInUser(); + return user; + + }} diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Services/Create_new_habitService.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Services/Create_new_habitService.java new file mode 100644 index 0000000..4c941e9 --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Services/Create_new_habitService.java @@ -0,0 +1,115 @@ +package com.realnet.basic.Services; +import com.realnet.basic.Repository.Create_new_habitRepository; +import com.realnet.basic.Entity.Create_new_habit +;import java.util.*; + +import org.springframework.beans.factory.annotation.Autowired; +import com.realnet.SequenceGenerator.Service.SequenceService; +import org.springframework.data.domain.Page; +import com.realnet.realm.Entity.Realm; +import com.realnet.realm.Services.RealmService; +import org.springframework.data.domain.Pageable; +import org.springframework.http.*; +import com.realnet.users.service1.AppUserServiceImpl; +import com.realnet.users.entity1.AppUser; + + + + +import com.realnet.basic.Entity.Frequency; +import com.realnet.basic.Services.FrequencyService; + + + + import org.springframework.stereotype.Service; + +@Service + public class Create_new_habitService { +@Autowired +private Create_new_habitRepository Repository; + @Autowired + private AppUserServiceImpl userService; +@Autowired + private RealmService realmService; + + + +@Autowired + private FrequencyService frequencyserv; + +public Create_new_habit Savedata(Create_new_habit data) { + + + + + + +if (data.getFrequency() != null) { + try { + int frequencyId = Integer.valueOf(data.getFrequency()); +Frequency get = frequencyserv.getdetailsbyId(frequencyId); + if (get != null) { + + data.setFrequencyname(get.getName()); +} +} catch (NumberFormatException e) { + System.out.println(" frequencyId is not integer.."); + // Invalid integer string — ignore or log + } + + } + + + + + data.setUpdatedBy(getUser().getUserId()); + data.setCreatedBy(getUser().getUserId()); + data.setAccountId(getUser().getAccount().getAccount_id()); +Create_new_habit save = Repository.save(data); + return save; + } + + +// get all with pagination + public Page getAllWithPagination(Pageable page) { + return Repository.findAll(page, getUser().getUserId()); + } +public List getdetails() { + List realm = realmService.findByUserId(getUser().getUserId()); +List all = Repository.findAll(getUser().getUserId()); + + return all ; } + + +public Create_new_habit getdetailsbyId(Integer id) { + return Repository.findById(id).get(); + } + + + public void delete_by_id(Integer id) { + Repository.deleteById(id); +} + + +public Create_new_habit update(Create_new_habit data,Integer id) { + Create_new_habit old = Repository.findById(id).get(); +old.setHabit_name(data.getHabit_name()); + +old.setDescription(data.getDescription()); + +old.setFrequency(data.getFrequency()); + +final Create_new_habit test = Repository.save(old); + data.setUpdatedBy(getUser().getUserId()); + return test;} + + + + + + + public AppUser getUser() { + AppUser user = userService.getLoggedInUser(); + return user; + + }} diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Services/FrequencyService.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Services/FrequencyService.java new file mode 100644 index 0000000..ab0398d --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Services/FrequencyService.java @@ -0,0 +1,73 @@ +package com.realnet.basic.Services; +import com.realnet.basic.Repository.FrequencyRepository; +import com.realnet.basic.Entity.Frequency +;import java.util.*; + +import org.springframework.beans.factory.annotation.Autowired; +import com.realnet.SequenceGenerator.Service.SequenceService; +import org.springframework.data.domain.Page; +import com.realnet.realm.Entity.Realm; +import com.realnet.realm.Services.RealmService; +import org.springframework.data.domain.Pageable; +import org.springframework.http.*; +import com.realnet.users.service1.AppUserServiceImpl; +import com.realnet.users.entity1.AppUser; + + + import org.springframework.stereotype.Service; + +@Service + public class FrequencyService { +@Autowired +private FrequencyRepository Repository; + @Autowired + private AppUserServiceImpl userService; +@Autowired + private RealmService realmService; + +public Frequency Savedata(Frequency data) { + + + data.setUpdatedBy(getUser().getUserId()); + data.setCreatedBy(getUser().getUserId()); + data.setAccountId(getUser().getAccount().getAccount_id()); +Frequency save = Repository.save(data); + return save; + } + + +// get all with pagination + public Page getAllWithPagination(Pageable page) { + return Repository.findAll(page, getUser().getUserId()); + } +public List getdetails() { + List realm = realmService.findByUserId(getUser().getUserId()); +List all = Repository.findAll(getUser().getUserId()); + + return all ; } + + +public Frequency getdetailsbyId(Integer id) { + return Repository.findById(id).get(); + } + + + public void delete_by_id(Integer id) { + Repository.deleteById(id); +} + + +public Frequency update(Frequency data,Integer id) { + Frequency old = Repository.findById(id).get(); +old.setName(data.getName()); + +final Frequency test = Repository.save(old); + data.setUpdatedBy(getUser().getUserId()); + return test;} + + + public AppUser getUser() { + AppUser user = userService.getLoggedInUser(); + return user; + + }} diff --git a/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Services/Frequency_ListFilter1Service.java b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Services/Frequency_ListFilter1Service.java new file mode 100644 index 0000000..f596ccd --- /dev/null +++ b/habittracker-backh-b/authsec_springboot/backend/src/main/java/com/realnet/basic/Services/Frequency_ListFilter1Service.java @@ -0,0 +1,47 @@ +package com.realnet.basic.Services; +import java.util.*; +import com.realnet.basic.Repository.FrequencyRepository; +import com.realnet.basic.Entity.Frequency; + +import com.realnet.basic.Entity.Frequency_ListFilter1; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.stereotype.Service; + +@Service + public class Frequency_ListFilter1Service { +@Autowired +private FrequencyRepository Repository; + + + + + public List getlistbuilder() { + List list= Repository.findAll(); + ArrayList l = new ArrayList<>(); + for (Frequency data : list) { +{ +Frequency_ListFilter1 dummy = new Frequency_ListFilter1(); + dummy.setId(data.getId()); + dummy.setName(data.getName()); + l.add(dummy); +} +} +return l;} + + + + public List getlistbuilderparam( ) { + List list= Repository.findAll(); + ArrayList l = new ArrayList<>(); + for (Frequency data : list) { +{ +Frequency_ListFilter1 dummy = new Frequency_ListFilter1(); + dummy.setId(data.getId()); + dummy.setName(data.getName()); + l.add(dummy); +} +} +return l;} +} \ No newline at end of file diff --git a/habittracker-dbh-d/authsec_mysql/mysql/wf_table/wf_table.sql b/habittracker-dbh-d/authsec_mysql/mysql/wf_table/wf_table.sql new file mode 100755 index 0000000..b91c5b0 --- /dev/null +++ b/habittracker-dbh-d/authsec_mysql/mysql/wf_table/wf_table.sql @@ -0,0 +1,6 @@ +CREATE TABLE dbh.Create_new_habit(id BIGINT NOT NULL AUTO_INCREMENT, description VARCHAR(400), frequency int, habit_name VARCHAR(400), PRIMARY KEY (id)); + +CREATE TABLE dbh.Frequency(id BIGINT NOT NULL AUTO_INCREMENT, name VARCHAR(400), PRIMARY KEY (id)); + +CREATE TABLE dbh.Analytics(id BIGINT NOT NULL AUTO_INCREMENT, total_habits int, frequency_analysis VARCHAR(400), longest_streak int, completed_today int, PRIMARY KEY (id)); + diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/login/login-page/login_environment.ts b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/login/login-page/login_environment.ts index 231b3a1..fdff417 100644 --- a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/login/login-page/login_environment.ts +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/login/login-page/login_environment.ts @@ -2,14 +2,14 @@ export const LoginEnvironment = { - "templateNo": "", - "loginHeading": "", - "loginHeading2": "", - "isSignup": "", - "loginSignup": " ", - "loginSignup2": "", - "loginForgotpass": "", - "loginImage": "", - "loginImageURL": "" + "templateNo": "Template 1", + "loginHeading": "Welcome to", + "loginHeading2": "io8.dev", + "isSignup": "true", + "loginSignup": "Use your ID to sign in OR ", + "loginSignup2": "create one now", + "loginForgotpass": "FORGOT PASSWORD?", + "loginImage": "[]", + "loginImageURL": "null" } diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics.component.html b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics.component.html new file mode 100644 index 0000000..8532f59 --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics.component.html @@ -0,0 +1,411 @@ + +
+
+
+

Analytics

+
+
+ + + +
+ + + + Loading ... + +
{{error}}
+
+ + Longest Streak + + + + Completed Today + + + + Total Habits + + + + Frequency Analysis + + + + + + Action + + + + + +{{user.longest_streak }} + + +{{user.completed_today }} + + +{{user.total_habits }} + + +{{user.frequency_analysis }} + + + + + + + +
Who Column
+
Account ID: {{user.accountId}}
+
Created At: {{user.createdAt| date}}
+
Created By: {{user.createdBy}}
+
Updated At: {{user.updatedAt | date}}
+
Updated By: {{user.updatedBy}}
+
+
+
+ + + + + + + +
+ + + Users per page + {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} + of {{pagination.totalItems}} users + + +
+ + + +
+
+
+
+
+
+ +
+
+ {{beforeText(item.fieldtext)}} + {{ app[transform(item.fieldtext) ] }} + {{afterText(item.fieldtext)}} +
+ +
+ {{beforeText(item.fieldtext)}} + {{ app[transform(item.fieldtext) ] | date}} + {{afterText(item.fieldtext)}} +
+
+ {{beforeText(item.fieldtext)}} + {{ app[transform(item.fieldtext) ]}} + {{afterText(item.fieldtext)}} +
+ +
+
+
+ + +
+ +
+ +
File Preview
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics.component.scss b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics.component.scss new file mode 100644 index 0000000..c47b921 --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics.component.scss @@ -0,0 +1,78 @@ +//@import "../../../../assets/scss/var"; +.s-info-bar { + display: flex; + flex-direction: row; + justify-content: space-between; + button { + outline: none; + } +} +.delete,.heading{ + text-align: center; + color: red; +} +.entry-pg { + width: 750px; +} + +.button1::after { + content: none; +} +.button1:hover::after { + content: "ADD ROWS"; +} + +.section { + background-color: #dddddd; + height: 40px; +} + +.section p { + //color: white; + padding: 10px; + font-size: 18px; +} + +.clr-input { + color: #212529; + border: 1px solid #ced4da; + border-radius: 0.25rem; + padding: 0.75rem 0.75rem; + margin-top: 3px; + width: 100%; + margin-bottom: 10px; +} + +.clr-file { + color: #212529; + border: 1px solid #ced4da; + border-radius: 0.25rem; + //padding: 0.6rem 0.75rem; + margin-top: 3px; + width: 100%; + margin-bottom: 10px; +} + +.center { + text-align: center; +} +select{ + width: 100%; + margin-top: 3px; + padding: 5px 5px; + border: 1px solid #ccc; + border-radius: 4px; +} +input[type=text],[type=date],[type=number],textarea { + width: 100%; + padding: 15px 15px; + background-color:rgb(255, 255, 255); + // margin: 8px 0; + display: inline-block; + border: 1px solid #ccc; + border-radius: 4px; + box-sizing: border-box; +} +.error_mess { + color: red; +} diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics.component.ts b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics.component.ts new file mode 100644 index 0000000..3e2a08b --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics.component.ts @@ -0,0 +1,292 @@ +import { Component, OnInit } from '@angular/core'; +import { ToastrService } from 'ngx-toastr'; +import { AlertService } from 'src/app/services/alert.service'; +import { Analyticsservice} from './Analytics.service'; +import { AbstractControl, FormArray, FormBuilder, FormGroup, Validators, ValidationErrors } from '@angular/forms'; +import { ExtensionService } from 'src/app/services/fnd/extension.service'; +import { DashboardContentModel2 } from 'src/app/models/builder/dashboard'; +import { Analyticscardvariable } from './Analytics_cardvariable'; +import { UserInfoService } from 'src/app/services/user-info.service'; +declare var JsBarcode: any; +@Component({ + selector: 'app-Analytics', + templateUrl: './Analytics.component.html', + styleUrls: ['./Analytics.component.scss'] +}) +export class AnalyticsComponent implements OnInit { + cardButton = Analyticscardvariable.cardButton; + cardmodeldata = Analyticscardvariable.cardmodeldata; + public dashboardArray: DashboardContentModel2[]; + isCardview = Analyticscardvariable.cardButton; + cardmodal; changeView(){ + this.isCardview = !this.isCardview; + } + beforeText(fieldtext: string): string { // Extract the text before the first '<' + const index = fieldtext.indexOf('<'); + return index !== -1 ? fieldtext.substring(0, index) : fieldtext; + } + afterText(fieldtext: string): string { // Extract the text after the last '>' + const index = fieldtext.lastIndexOf('>'); + return index !== -1 ? fieldtext.substring(index + 1) : ''; + } + transform(fieldtext: string): string { + const match = fieldtext.match(/<([^>]*)>/); + return match ? match[1] : ''; // Extract the text between '<' and '>' + } + userrole; + rowSelected :any= {}; + modaldelete=false; + modalEdit=false; + modalAdd= false; + public entryForm: FormGroup; + loading = false; + product; + modalOpenedforNewLine = false; + newLine:any; + additionalFieldsFromBackend: any[] = []; + formcode = 'Analytics_formCode' +tableName = 'Analytics'; checkFormCode; selected: any[] = []; constructor( + private extensionService: ExtensionService, +private userInfoService:UserInfoService, + private mainService:Analyticsservice, + private alertService: AlertService, + private toastr: ToastrService, + private _fb: FormBuilder, + ) { } +// component button + ngOnInit(): void { + if(this.cardmodeldata !== ''){ + this.cardmodal = JSON.parse(this.cardmodeldata); + this.dashboardArray = this.cardmodal.dashboard.slice(); + console.log(this.dashboardArray) + } + this.userrole=this.userInfoService.getRoles(); + this.getData(); + this.entryForm = this._fb.group({ +longest_streak : [null,[Validators.required]], + +completed_today : [null,[Validators.required]], + +total_habits : [null,[Validators.required]], + +frequency_analysis : [null], + + + + + + + + + + + }); // component_button200 + // form code start + this.extensionService.getJsonObjectsByFormCodeList(this.formcode).subscribe(data => { + console.log(data); + const jsonArray = data.map((str) => JSON.parse(str)); + this.additionalFieldsFromBackend = jsonArray; + this.checkFormCode = this.additionalFieldsFromBackend.some(field => field.formCode === "Analytics_formCode"); + console.log(this.checkFormCode); + console.log(this.additionalFieldsFromBackend); + if (this.additionalFieldsFromBackend && this.additionalFieldsFromBackend.length > 0) { + this.additionalFieldsFromBackend.forEach(field => { + if (field.formCode === this.formcode) { + if (!this.entryForm.contains(field.extValue)) { + // Add the control only if it doesn't exist in the form + this.entryForm.addControl(field.extValue, this._fb.control(field.fieldValue)); + } + } + }); + } + }); + console.log(this.entryForm.value); + // form code end + + + + + + + + + + } + + + + + + + + + error; + getData() { + this.mainService.getAll().subscribe((data) => { + console.log(data); + this.product = data; + if(this.product.length==0){ + this.error="No Data Available" + } + },(error) => { + console.log(error); + if(error){ + this.error="Server Error"; + } + }); + } + onEdit(row) { + this.rowSelected = row; + + + + + + + + + + this.modalEdit = true; + } + onDelete(row) { + this.rowSelected = row; + this.modaldelete=true; + } + delete(id) + { + this.modaldelete = false; + console.log("in delete "+id); + this.mainService.delete(id).subscribe( + (data) => { + console.log(data); + this.ngOnInit(); + if (data) { this.toastr.success('Deleted successfully'); } + }); + } + onUpdate(id) { + this.modalEdit = false; + + + + + + + + + //console.log("in update"); + console.log("id " + id); + console.log(this.rowSelected); + //console.log("out update"); + this.mainService.update(id, this.rowSelected).subscribe( + (data) => { + console.log(data); + if (data || data.status >= 200 && data.status <= 299) { + this.toastr.success("Update Successfully"); + } +setTimeout(() => { + this.ngOnInit(); + }, 500); + + + + + + + + + }, (error) => { + console.log(error); + if (error.status >= 200 && error.status <= 299) { + // this.toastr.success("update Succesfully"); + } + if (error.status >= 400 && error.status <= 499) { + this.toastr.error("Not Updated"); + } + if (error.status >= 500 && error.status <= 599) { + this.toastr.error("Not Updated"); + } + }); + setTimeout(() => { + this.ngOnInit(); + }, 500); + } +onCreate() { + this.modalAdd=false; + + + + + + + + + this.mainService.create(this.entryForm.value).subscribe( + (data) => { + console.log(data); + if (data || data.status >= 200 && data.status <= 299) { + this.toastr.success("Added Successfully"); + } +setTimeout(() => { + this.ngOnInit(); + }, 500); + + + + + + + + + }, (error) => { + console.log(error); + if (error.status >= 200 && error.status <= 299) { + // this.toastr.success("Added Succesfully"); + } + if (error.status >= 400 && error.status <= 499) { + this.toastr.error("Not Added"); + } + if (error.status >= 500 && error.status <= 599) { + this.toastr.error("Not Added"); + } + }); + setTimeout(() => { + this.ngOnInit(); + }, 500); + } + goToAdd(row) { +this.modalAdd = true; this.submitted = false; + + + + + + + + + } + submitted = false; +onSubmit() { + console.log(this.entryForm.value); + this.submitted = true; + if (this.entryForm.invalid) { + return; + }this.onCreate(); + +} + + + + + + + + +// updateaction +} + + + + + + + diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics.service.ts b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics.service.ts new file mode 100644 index 0000000..bb0fe26 --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics.service.ts @@ -0,0 +1,41 @@ +import { Injectable } from '@angular/core'; +import { Observable } from "rxjs"; +import { HttpClient, HttpHeaders, HttpParams, } from "@angular/common/http"; +import { ApiRequestService } from "src/app/services/api/api-request.service"; +import { environment } from 'src/environments/environment'; +@Injectable({ + providedIn: 'root' +}) +export class Analyticsservice{ + private baseURL = "Analytics/Analytics" ; constructor( + private http: HttpClient, + private apiRequest: ApiRequestService, + ) { } + getAll(page?: number, size?: number): Observable { + return this.apiRequest.get(this.baseURL); + } + getById(id: number): Observable { + const _http = this.baseURL + "/" + id; + return this.apiRequest.get(_http); + } + create(data: any): Observable { + return this.apiRequest.post(this.baseURL, data); + } + update(id: number, data: any): Observable { + const _http = this.baseURL + "/" + id; + return this.apiRequest.put(_http, data); + } + delete(id: number): Observable { + const _http = this.baseURL + "/" + id; + return this.apiRequest.delete(_http); + } + + + + + + + + +// updateaction +} \ No newline at end of file diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics_cardvariable.ts b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics_cardvariable.ts new file mode 100644 index 0000000..b5551b4 --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Analytics/Analytics_cardvariable.ts @@ -0,0 +1,4 @@ +export const Analyticscardvariable = { + "cardButton": false, + "cardmodeldata": `` +} \ No newline at end of file diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit.component.html b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit.component.html new file mode 100644 index 0000000..04c749d --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit.component.html @@ -0,0 +1,389 @@ + +
+
+
+

Create New Habit

+
+
+ + + +
+ + + + Loading ... + +
{{error}}
+
+ + Habit Name + + + + Description + + + + Frequency + + + + + + Action + + + + + +{{user.habit_name }} + + + + + + +{{user. frequencyname }} + + + + + + + +
Who Column
+
Account ID: {{user.accountId}}
+
Created At: {{user.createdAt| date}}
+
Created By: {{user.createdBy}}
+
Updated At: {{user.updatedAt | date}}
+
Updated By: {{user.updatedBy}}
+
+
+
+ + + + + + + +
+ + + Users per page + {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} + of {{pagination.totalItems}} users + + +
+ + + +
+
+
+
+
+
+ +
+
+ {{beforeText(item.fieldtext)}} + {{ app[transform(item.fieldtext) ] }} + {{afterText(item.fieldtext)}} +
+ +
+ {{beforeText(item.fieldtext)}} + {{ app[transform(item.fieldtext) ] | date}} + {{afterText(item.fieldtext)}} +
+
+ {{beforeText(item.fieldtext)}} + {{ app[transform(item.fieldtext) ]}} + {{afterText(item.fieldtext)}} +
+ +
+
+
+ + +
+ +
+ +
File Preview
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit.component.scss b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit.component.scss new file mode 100644 index 0000000..c47b921 --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit.component.scss @@ -0,0 +1,78 @@ +//@import "../../../../assets/scss/var"; +.s-info-bar { + display: flex; + flex-direction: row; + justify-content: space-between; + button { + outline: none; + } +} +.delete,.heading{ + text-align: center; + color: red; +} +.entry-pg { + width: 750px; +} + +.button1::after { + content: none; +} +.button1:hover::after { + content: "ADD ROWS"; +} + +.section { + background-color: #dddddd; + height: 40px; +} + +.section p { + //color: white; + padding: 10px; + font-size: 18px; +} + +.clr-input { + color: #212529; + border: 1px solid #ced4da; + border-radius: 0.25rem; + padding: 0.75rem 0.75rem; + margin-top: 3px; + width: 100%; + margin-bottom: 10px; +} + +.clr-file { + color: #212529; + border: 1px solid #ced4da; + border-radius: 0.25rem; + //padding: 0.6rem 0.75rem; + margin-top: 3px; + width: 100%; + margin-bottom: 10px; +} + +.center { + text-align: center; +} +select{ + width: 100%; + margin-top: 3px; + padding: 5px 5px; + border: 1px solid #ccc; + border-radius: 4px; +} +input[type=text],[type=date],[type=number],textarea { + width: 100%; + padding: 15px 15px; + background-color:rgb(255, 255, 255); + // margin: 8px 0; + display: inline-block; + border: 1px solid #ccc; + border-radius: 4px; + box-sizing: border-box; +} +.error_mess { + color: red; +} diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit.component.ts b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit.component.ts new file mode 100644 index 0000000..ba30784 --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit.component.ts @@ -0,0 +1,275 @@ +import { Component, OnInit } from '@angular/core'; +import { ToastrService } from 'ngx-toastr'; +import { AlertService } from 'src/app/services/alert.service'; +import { Create_new_habitservice} from './Create_new_habit.service'; +import { AbstractControl, FormArray, FormBuilder, FormGroup, Validators, ValidationErrors } from '@angular/forms'; +import { ExtensionService } from 'src/app/services/fnd/extension.service'; +import { DashboardContentModel2 } from 'src/app/models/builder/dashboard'; +import { Create_new_habitcardvariable } from './Create_new_habit_cardvariable'; +import { UserInfoService } from 'src/app/services/user-info.service'; +declare var JsBarcode: any; +@Component({ + selector: 'app-Create_new_habit', + templateUrl: './Create_new_habit.component.html', + styleUrls: ['./Create_new_habit.component.scss'] +}) +export class Create_new_habitComponent implements OnInit { + cardButton = Create_new_habitcardvariable.cardButton; + cardmodeldata = Create_new_habitcardvariable.cardmodeldata; + public dashboardArray: DashboardContentModel2[]; + isCardview = Create_new_habitcardvariable.cardButton; + cardmodal; changeView(){ + this.isCardview = !this.isCardview; + } + beforeText(fieldtext: string): string { // Extract the text before the first '<' + const index = fieldtext.indexOf('<'); + return index !== -1 ? fieldtext.substring(0, index) : fieldtext; + } + afterText(fieldtext: string): string { // Extract the text after the last '>' + const index = fieldtext.lastIndexOf('>'); + return index !== -1 ? fieldtext.substring(index + 1) : ''; + } + transform(fieldtext: string): string { + const match = fieldtext.match(/<([^>]*)>/); + return match ? match[1] : ''; // Extract the text between '<' and '>' + } + userrole; + rowSelected :any= {}; + modaldelete=false; + modalEdit=false; + modalAdd= false; + public entryForm: FormGroup; + loading = false; + product; + modalOpenedforNewLine = false; + newLine:any; + additionalFieldsFromBackend: any[] = []; + formcode = 'Create_new_habit_formCode' +tableName = 'Create_new_habit'; checkFormCode; selected: any[] = []; constructor( + private extensionService: ExtensionService, +private userInfoService:UserInfoService, + private mainService:Create_new_habitservice, + private alertService: AlertService, + private toastr: ToastrService, + private _fb: FormBuilder, + ) { } +// component button + ngOnInit(): void { + if(this.cardmodeldata !== ''){ + this.cardmodal = JSON.parse(this.cardmodeldata); + this.dashboardArray = this.cardmodal.dashboard.slice(); + console.log(this.dashboardArray) + } + this.userrole=this.userInfoService.getRoles(); + this.getData(); + this.entryForm = this._fb.group({ +habit_name : [null], + +description : [null], + +frequency : [null], + + + + + + + + + }); // component_button200 + // form code start + this.extensionService.getJsonObjectsByFormCodeList(this.formcode).subscribe(data => { + console.log(data); + const jsonArray = data.map((str) => JSON.parse(str)); + this.additionalFieldsFromBackend = jsonArray; + this.checkFormCode = this.additionalFieldsFromBackend.some(field => field.formCode === "Create_new_habit_formCode"); + console.log(this.checkFormCode); + console.log(this.additionalFieldsFromBackend); + if (this.additionalFieldsFromBackend && this.additionalFieldsFromBackend.length > 0) { + this.additionalFieldsFromBackend.forEach(field => { + if (field.formCode === this.formcode) { + if (!this.entryForm.contains(field.extValue)) { + // Add the control only if it doesn't exist in the form + this.entryForm.addControl(field.extValue, this._fb.control(field.fieldValue)); + } + } + }); + } + }); + console.log(this.entryForm.value); + // form code end + + + + +this.getallfrequency(); + + + } + + + + + + + error; + getData() { + this.mainService.getAll().subscribe((data) => { + console.log(data); + this.product = data; + if(this.product.length==0){ + this.error="No Data Available" + } + },(error) => { + console.log(error); + if(error){ + this.error="Server Error"; + } + }); + } + onEdit(row) { + this.rowSelected = row; + + + + + + + + this.modalEdit = true; + } + onDelete(row) { + this.rowSelected = row; + this.modaldelete=true; + } + delete(id) + { + this.modaldelete = false; + console.log("in delete "+id); + this.mainService.delete(id).subscribe( + (data) => { + console.log(data); + this.ngOnInit(); + if (data) { this.toastr.success('Deleted successfully'); } + }); + } + onUpdate(id) { + this.modalEdit = false; + + + + + + + //console.log("in update"); + console.log("id " + id); + console.log(this.rowSelected); + //console.log("out update"); + this.mainService.update(id, this.rowSelected).subscribe( + (data) => { + console.log(data); + if (data || data.status >= 200 && data.status <= 299) { + this.toastr.success("Update Successfully"); + } +setTimeout(() => { + this.ngOnInit(); + }, 500); + + + + + + + }, (error) => { + console.log(error); + if (error.status >= 200 && error.status <= 299) { + // this.toastr.success("update Succesfully"); + } + if (error.status >= 400 && error.status <= 499) { + this.toastr.error("Not Updated"); + } + if (error.status >= 500 && error.status <= 599) { + this.toastr.error("Not Updated"); + } + }); + setTimeout(() => { + this.ngOnInit(); + }, 500); + } +onCreate() { + this.modalAdd=false; + + + + + + + this.mainService.create(this.entryForm.value).subscribe( + (data) => { + console.log(data); + if (data || data.status >= 200 && data.status <= 299) { + this.toastr.success("Added Successfully"); + } +setTimeout(() => { + this.ngOnInit(); + }, 500); + + + + + + + }, (error) => { + console.log(error); + if (error.status >= 200 && error.status <= 299) { + // this.toastr.success("Added Succesfully"); + } + if (error.status >= 400 && error.status <= 499) { + this.toastr.error("Not Added"); + } + if (error.status >= 500 && error.status <= 599) { + this.toastr.error("Not Added"); + } + }); + setTimeout(() => { + this.ngOnInit(); + }, 500); + } + goToAdd(row) { +this.modalAdd = true; this.submitted = false; + + + + + + + } + submitted = false; +onSubmit() { + console.log(this.entryForm.value); + this.submitted = true; + if (this.entryForm.invalid) { + return; + }this.onCreate(); + +} + + +rsModaldescription = false; +goToReplaceStringdescription(row){ +this.rowSelected = row; this.rsModaldescription =true; } + +selectfrequency ; +getallfrequency() { + this.mainService.getAllfrequency().subscribe(data=>{ +this.selectfrequency = data; +console.log(data); +},(error) => { console.log(error); }); } + +// updateaction +} + + + + + diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit.service.ts b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit.service.ts new file mode 100644 index 0000000..153f086 --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit.service.ts @@ -0,0 +1,40 @@ +import { Injectable } from '@angular/core'; +import { Observable } from "rxjs"; +import { HttpClient, HttpHeaders, HttpParams, } from "@angular/common/http"; +import { ApiRequestService } from "src/app/services/api/api-request.service"; +import { environment } from 'src/environments/environment'; +@Injectable({ + providedIn: 'root' +}) +export class Create_new_habitservice{ + private baseURL = "Create_new_habit/Create_new_habit" ; constructor( + private http: HttpClient, + private apiRequest: ApiRequestService, + ) { } + getAll(page?: number, size?: number): Observable { + return this.apiRequest.get(this.baseURL); + } + getById(id: number): Observable { + const _http = this.baseURL + "/" + id; + return this.apiRequest.get(_http); + } + create(data: any): Observable { + return this.apiRequest.post(this.baseURL, data); + } + update(id: number, data: any): Observable { + const _http = this.baseURL + "/" + id; + return this.apiRequest.put(_http, data); + } + delete(id: number): Observable { + const _http = this.baseURL + "/" + id; + return this.apiRequest.delete(_http); + } + + + + +getAllfrequency(): Observable { +return this.apiRequest.get("Frequency_ListFilter1/Frequency_ListFilter1"); } + +// updateaction +} \ No newline at end of file diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit_cardvariable.ts b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit_cardvariable.ts new file mode 100644 index 0000000..d10a3bd --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Create_new_habit/Create_new_habit_cardvariable.ts @@ -0,0 +1,4 @@ +export const Create_new_habitcardvariable = { + "cardButton": false, + "cardmodeldata": `` +} \ No newline at end of file diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency.component.html b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency.component.html new file mode 100644 index 0000000..2550fd2 --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency.component.html @@ -0,0 +1,322 @@ + +
+
+
+

Frequency

+
+
+ + + + + + +
+ + + + Loading ... + +
{{error}}
+
+ + Name + + + + + + Action + + + + + +{{user.name }} + + + + + + + +
Who Column
+
Account ID: {{user.accountId}}
+
Created At: {{user.createdAt| date}}
+
Created By: {{user.createdBy}}
+
Updated At: {{user.updatedAt | date}}
+
Updated By: {{user.updatedBy}}
+
+
+
+ + + + + + + +
+ + + Users per page + {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} + of {{pagination.totalItems}} users + + +
+ + + +
+
+
+
+
+
+ +
+
+ {{beforeText(item.fieldtext)}} + {{ app[transform(item.fieldtext) ] }} + {{afterText(item.fieldtext)}} +
+ +
+ {{beforeText(item.fieldtext)}} + {{ app[transform(item.fieldtext) ] | date}} + {{afterText(item.fieldtext)}} +
+
+ {{beforeText(item.fieldtext)}} + {{ app[transform(item.fieldtext) ]}} + {{afterText(item.fieldtext)}} +
+ +
+
+
+ + +
+ +
+ +
File Preview
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency.component.scss b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency.component.scss new file mode 100644 index 0000000..c47b921 --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency.component.scss @@ -0,0 +1,78 @@ +//@import "../../../../assets/scss/var"; +.s-info-bar { + display: flex; + flex-direction: row; + justify-content: space-between; + button { + outline: none; + } +} +.delete,.heading{ + text-align: center; + color: red; +} +.entry-pg { + width: 750px; +} + +.button1::after { + content: none; +} +.button1:hover::after { + content: "ADD ROWS"; +} + +.section { + background-color: #dddddd; + height: 40px; +} + +.section p { + //color: white; + padding: 10px; + font-size: 18px; +} + +.clr-input { + color: #212529; + border: 1px solid #ced4da; + border-radius: 0.25rem; + padding: 0.75rem 0.75rem; + margin-top: 3px; + width: 100%; + margin-bottom: 10px; +} + +.clr-file { + color: #212529; + border: 1px solid #ced4da; + border-radius: 0.25rem; + //padding: 0.6rem 0.75rem; + margin-top: 3px; + width: 100%; + margin-bottom: 10px; +} + +.center { + text-align: center; +} +select{ + width: 100%; + margin-top: 3px; + padding: 5px 5px; + border: 1px solid #ccc; + border-radius: 4px; +} +input[type=text],[type=date],[type=number],textarea { + width: 100%; + padding: 15px 15px; + background-color:rgb(255, 255, 255); + // margin: 8px 0; + display: inline-block; + border: 1px solid #ccc; + border-radius: 4px; + box-sizing: border-box; +} +.error_mess { + color: red; +} diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency.component.ts b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency.component.ts new file mode 100644 index 0000000..3118658 --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency.component.ts @@ -0,0 +1,238 @@ +import { Component, OnInit } from '@angular/core'; +import { ToastrService } from 'ngx-toastr'; +import { AlertService } from 'src/app/services/alert.service'; +import { Frequencyservice} from './Frequency.service'; +import { AbstractControl, FormArray, FormBuilder, FormGroup, Validators, ValidationErrors } from '@angular/forms'; +import { ExtensionService } from 'src/app/services/fnd/extension.service'; +import { DashboardContentModel2 } from 'src/app/models/builder/dashboard'; +import { Frequencycardvariable } from './Frequency_cardvariable'; +import { UserInfoService } from 'src/app/services/user-info.service'; +import { ActivatedRoute, Router } from '@angular/router'; +declare var JsBarcode: any; +@Component({ + selector: 'app-Frequency', + templateUrl: './Frequency.component.html', + styleUrls: ['./Frequency.component.scss'] +}) +export class FrequencyComponent implements OnInit { + cardButton = Frequencycardvariable.cardButton; + cardmodeldata = Frequencycardvariable.cardmodeldata; + public dashboardArray: DashboardContentModel2[]; + isCardview = Frequencycardvariable.cardButton; + cardmodal; changeView(){ + this.isCardview = !this.isCardview; + } + beforeText(fieldtext: string): string { // Extract the text before the first '<' + const index = fieldtext.indexOf('<'); + return index !== -1 ? fieldtext.substring(0, index) : fieldtext; + } + afterText(fieldtext: string): string { // Extract the text after the last '>' + const index = fieldtext.lastIndexOf('>'); + return index !== -1 ? fieldtext.substring(index + 1) : ''; + } + transform(fieldtext: string): string { + const match = fieldtext.match(/<([^>]*)>/); + return match ? match[1] : ''; // Extract the text between '<' and '>' + } + userrole; + rowSelected :any= {}; + modaldelete=false; + modalEdit=false; + modalAdd= false; + public entryForm: FormGroup; + loading = false; + product; + modalOpenedforNewLine = false; + newLine:any; + additionalFieldsFromBackend: any[] = []; + formcode = 'Frequency_formCode' +tableName = 'Frequency'; checkFormCode; selected: any[] = []; constructor( + private extensionService: ExtensionService, +private userInfoService:UserInfoService, + private mainService:Frequencyservice, + private alertService: AlertService, + private toastr: ToastrService, + private _fb: FormBuilder, + private router: Router, + private route: ActivatedRoute ) { } +// component button + ngOnInit(): void { + if(this.cardmodeldata !== ''){ + this.cardmodal = JSON.parse(this.cardmodeldata); + this.dashboardArray = this.cardmodal.dashboard.slice(); + console.log(this.dashboardArray) + } + this.userrole=this.userInfoService.getRoles(); + this.getData(); + this.entryForm = this._fb.group({ +name : [null], + + + + + }); // component_button200 + // form code start + this.extensionService.getJsonObjectsByFormCodeList(this.formcode).subscribe(data => { + console.log(data); + const jsonArray = data.map((str) => JSON.parse(str)); + this.additionalFieldsFromBackend = jsonArray; + this.checkFormCode = this.additionalFieldsFromBackend.some(field => field.formCode === "Frequency_formCode"); + console.log(this.checkFormCode); + console.log(this.additionalFieldsFromBackend); + if (this.additionalFieldsFromBackend && this.additionalFieldsFromBackend.length > 0) { + this.additionalFieldsFromBackend.forEach(field => { + if (field.formCode === this.formcode) { + if (!this.entryForm.contains(field.extValue)) { + // Add the control only if it doesn't exist in the form + this.entryForm.addControl(field.extValue, this._fb.control(field.fieldValue)); + } + } + }); + } + }); + console.log(this.entryForm.value); + // form code end + + + + } + + + error; + getData() { + this.mainService.getAll().subscribe((data) => { + console.log(data); + this.product = data; + if(this.product.length==0){ + this.error="No Data Available" + } + },(error) => { + console.log(error); + if(error){ + this.error="Server Error"; + } + }); + } + onEdit(row) { + this.rowSelected = row; + + + + this.modalEdit = true; + } + onDelete(row) { + this.rowSelected = row; + this.modaldelete=true; + } + delete(id) + { + this.modaldelete = false; + console.log("in delete "+id); + this.mainService.delete(id).subscribe( + (data) => { + console.log(data); + this.ngOnInit(); + if (data) { this.toastr.success('Deleted successfully'); } + }); + } + onUpdate(id) { + this.modalEdit = false; + + + //console.log("in update"); + console.log("id " + id); + console.log(this.rowSelected); + //console.log("out update"); + this.mainService.update(id, this.rowSelected).subscribe( + (data) => { + console.log(data); + if (data || data.status >= 200 && data.status <= 299) { + this.toastr.success("Update Successfully"); + } +setTimeout(() => { + this.ngOnInit(); + }, 500); + + + }, (error) => { + console.log(error); + if (error.status >= 200 && error.status <= 299) { + // this.toastr.success("update Succesfully"); + } + if (error.status >= 400 && error.status <= 499) { + this.toastr.error("Not Updated"); + } + if (error.status >= 500 && error.status <= 599) { + this.toastr.error("Not Updated"); + } + }); + setTimeout(() => { + this.ngOnInit(); + }, 500); + } +onCreate() { + this.modalAdd=false; + + + this.mainService.create(this.entryForm.value).subscribe( + (data) => { + console.log(data); + if (data || data.status >= 200 && data.status <= 299) { + this.toastr.success("Added Successfully"); + } +setTimeout(() => { + this.ngOnInit(); + }, 500); + + + }, (error) => { + console.log(error); + if (error.status >= 200 && error.status <= 299) { + // this.toastr.success("Added Succesfully"); + } + if (error.status >= 400 && error.status <= 499) { + this.toastr.error("Not Added"); + } + if (error.status >= 500 && error.status <= 599) { + this.toastr.error("Not Added"); + } + }); + setTimeout(() => { + this.ngOnInit(); + }, 500); + } + goToAdd(row) { +this.modalAdd = true; this.submitted = false; + + + } + submitted = false; +onSubmit() { + console.log(this.entryForm.value); + this.submitted = true; + if (this.entryForm.invalid) { + return; + }this.onCreate(); + +} + + + goToDataM(){ + this.router.navigate(['/cns-portal/datamanagement'],{ relativeTo: this.route }); + } + + +downloadCSV(tableName): void { + this.mainService.downloadCSV(tableName).subscribe(response => { + const blob = new Blob([response], { type: 'application/octet-stream' }); + const url = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = `${tableName}.csv`; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + }); +}// updateaction +} + diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency.service.ts b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency.service.ts new file mode 100644 index 0000000..5f54659 --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency.service.ts @@ -0,0 +1,40 @@ +import { Injectable } from '@angular/core'; +import { Observable } from "rxjs"; +import { HttpClient, HttpHeaders, HttpParams, } from "@angular/common/http"; +import { ApiRequestService } from "src/app/services/api/api-request.service"; +import { environment } from 'src/environments/environment'; +import baseUrl from 'src/app/services/api/helper'; +@Injectable({ + providedIn: 'root' +}) +export class Frequencyservice{ + private baseURL = "Frequency/Frequency" ; constructor( + private http: HttpClient, + private apiRequest: ApiRequestService, + ) { } + getAll(page?: number, size?: number): Observable { + return this.apiRequest.get(this.baseURL); + } + getById(id: number): Observable { + const _http = this.baseURL + "/" + id; + return this.apiRequest.get(_http); + } + create(data: any): Observable { + return this.apiRequest.post(this.baseURL, data); + } + update(id: number, data: any): Observable { + const _http = this.baseURL + "/" + id; + return this.apiRequest.put(_http, data); + } + delete(id: number): Observable { + const _http = this.baseURL + "/" + id; + return this.apiRequest.delete(_http); + } + + +downloadCSV(tableName: string): Observable { + const url = `${baseUrl}/api/template/download-csv?tableName=${tableName}`; + return this.http.get(url, { responseType: 'blob' }) + +}// updateaction +} \ No newline at end of file diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency_cardvariable.ts b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency_cardvariable.ts new file mode 100644 index 0000000..9c33bbe --- /dev/null +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/BuilderComponents/basic/Frequency/Frequency_cardvariable.ts @@ -0,0 +1,4 @@ +export const Frequencycardvariable = { + "cardButton": false, + "cardmodeldata": `` +} \ No newline at end of file diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/main-routing.module.ts b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/main-routing.module.ts index 7377c69..20b363e 100644 --- a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/main-routing.module.ts +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/main-routing.module.ts @@ -1,3 +1,6 @@ +import { AnalyticsComponent } from './BuilderComponents/basic/Analytics/Analytics.component'; +import { FrequencyComponent } from './BuilderComponents/basic/Frequency/Frequency.component'; +import { Create_new_habitComponent } from './BuilderComponents/basic/Create_new_habit/Create_new_habit.component'; import { SequencegenaratorComponent } from './fnd/sequencegenarator/sequencegenarator.component'; import { Component, NgModule } from '@angular/core'; @@ -256,6 +259,15 @@ const routes: Routes = [ // buildercomponents +{path:'Analytics',component:AnalyticsComponent}, + + +{path:'Frequency',component:FrequencyComponent}, + + +{path:'Create_new_habit',component:Create_new_habitComponent}, + + diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/main.module.ts b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/main.module.ts index ecbab3d..59686c1 100644 --- a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/main.module.ts +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/app/modules/main/main.module.ts @@ -1,3 +1,6 @@ +import { AnalyticsComponent } from './BuilderComponents/basic/Analytics/Analytics.component'; +import { FrequencyComponent } from './BuilderComponents/basic/Frequency/Frequency.component'; +import { Create_new_habitComponent } from './BuilderComponents/basic/Create_new_habit/Create_new_habit.component'; import { CommonModule } from '@angular/common'; @@ -129,6 +132,15 @@ import { Stepper_workflowComponent } from './BuilderComponents/stepperworkflow/S // buildercomponents +AnalyticsComponent, + + +FrequencyComponent, + + +Create_new_habitComponent, + + diff --git a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/assets/i18n/en.json b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/assets/i18n/en.json index ee15955..8a64e53 100644 --- a/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/assets/i18n/en.json +++ b/habittracker-fronth-f/authsec_angular/frontend/angular-clarity-master/src/assets/i18n/en.json @@ -226,10 +226,14 @@ "MENU_ACTION_LINK": "Menu Action Link", "STATUS": "Status", "SUB_MENU": "Sub Menu", - "Active": "Active", "Description": "Description", - "Fileupload_Field": "Fileupload_Field", - "Test22": "Test22", - "Test11": "Test11", + "Total_Habits": "Total_Habits", + "Frequency_Analysis": "Frequency_Analysis", + "Create_new_habit": "Create_new_habit", + "Frequency": "Frequency", + "Longest_Streak": "Longest_Streak", + "Completed_Today": "Completed_Today", + "Analytics": "Analytics", + "Habit_Name": "Habit_Name", "Name": "Name" } \ No newline at end of file