diff --git a/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java index f9801fb..53af707 100644 --- a/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java +++ b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java @@ -69,6 +69,12 @@ public class BuilderService { executeDump(true); // ADD OTHER SERVICE +addCustomMenu( "Testb","Testb", "Transcations"); + + +addCustomMenu( "Testa","Testa", "Transcations"); + + System.out.println("dashboard and menu inserted..."); diff --git a/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Controllers/TestaController.java b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Controllers/TestaController.java new file mode 100644 index 0000000..3013e49 --- /dev/null +++ b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Controllers/TestaController.java @@ -0,0 +1,115 @@ +package com.realnet.reactbootstrap.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.reactbootstrap.Entity.Testa; +import com.realnet.reactbootstrap.Services.TestaService ; + + + + + + + + + + +@RequestMapping(value = "/Testa") + @CrossOrigin("*") +@RestController +public class TestaController { + @Autowired + private TestaService Service; + +@Value("${projectPath}") + private String projectPath; + + + + + + + + + + + + @PostMapping("/Testa") + public Testa Savedata(@RequestBody Testa data) { + Testa save = Service.Savedata(data) ; + + + + + + + + + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Testa/{id}") + public Testa update(@RequestBody Testa data,@PathVariable Integer id ) { + Testa update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Testa/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("/Testa") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Testa") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Testa/{id}") + public Testa getdetailsbyId(@PathVariable Integer id ) { + Testa get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Testa/{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/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Controllers/TestbController.java b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Controllers/TestbController.java new file mode 100644 index 0000000..c2eda1e --- /dev/null +++ b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Controllers/TestbController.java @@ -0,0 +1,115 @@ +package com.realnet.reactbootstrap.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.reactbootstrap.Entity.Testb; +import com.realnet.reactbootstrap.Services.TestbService ; + + + + + + + + + + +@RequestMapping(value = "/Testb") + @CrossOrigin("*") +@RestController +public class TestbController { + @Autowired + private TestbService Service; + +@Value("${projectPath}") + private String projectPath; + + + + + + + + + + + + @PostMapping("/Testb") + public Testb Savedata(@RequestBody Testb data) { + Testb save = Service.Savedata(data) ; + + + + + + + + + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Testb/{id}") + public Testb update(@RequestBody Testb data,@PathVariable Integer id ) { + Testb update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Testb/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("/Testb") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Testb") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Testb/{id}") + public Testb getdetailsbyId(@PathVariable Integer id ) { + Testb get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Testb/{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/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Controllers/tokenFree_TestaController.java b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Controllers/tokenFree_TestaController.java new file mode 100644 index 0000000..360c170 --- /dev/null +++ b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Controllers/tokenFree_TestaController.java @@ -0,0 +1,115 @@ +package com.realnet.reactbootstrap.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.reactbootstrap.Entity.Testa; +import com.realnet.reactbootstrap.Services.TestaService ; + + + + + + + + + + +@RequestMapping(value = "/token/Testa") + @CrossOrigin("*") +@RestController +public class tokenFree_TestaController { + @Autowired + private TestaService Service; + +@Value("${projectPath}") + private String projectPath; + + + + + + + + + + + + @PostMapping("/Testa") + public Testa Savedata(@RequestBody Testa data) { + Testa save = Service.Savedata(data) ; + + + + + + + + + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Testa/{id}") + public Testa update(@RequestBody Testa data,@PathVariable Integer id ) { + Testa update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Testa/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("/Testa") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Testa") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Testa/{id}") + public Testa getdetailsbyId(@PathVariable Integer id ) { + Testa get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Testa/{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/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Controllers/tokenFree_TestbController.java b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Controllers/tokenFree_TestbController.java new file mode 100644 index 0000000..d52155b --- /dev/null +++ b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Controllers/tokenFree_TestbController.java @@ -0,0 +1,115 @@ +package com.realnet.reactbootstrap.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.reactbootstrap.Entity.Testb; +import com.realnet.reactbootstrap.Services.TestbService ; + + + + + + + + + + +@RequestMapping(value = "/token/Testb") + @CrossOrigin("*") +@RestController +public class tokenFree_TestbController { + @Autowired + private TestbService Service; + +@Value("${projectPath}") + private String projectPath; + + + + + + + + + + + + @PostMapping("/Testb") + public Testb Savedata(@RequestBody Testb data) { + Testb save = Service.Savedata(data) ; + + + + + + + + + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Testb/{id}") + public Testb update(@RequestBody Testb data,@PathVariable Integer id ) { + Testb update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Testb/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("/Testb") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Testb") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Testb/{id}") + public Testb getdetailsbyId(@PathVariable Integer id ) { + Testb get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Testb/{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/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Entity/Testa.java b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Entity/Testa.java new file mode 100644 index 0000000..8988a08 --- /dev/null +++ b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Entity/Testa.java @@ -0,0 +1,44 @@ +package com.realnet.reactbootstrap.Entity; + import lombok.*; +import com.realnet.WhoColumn.Entity.Extension; + import javax.persistence.*; + import java.time.LocalDateTime; + import java.util.*; + + + + + + + + + + + @Entity + @Data + public class Testa extends Extension { + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + +private String name; + +private int number_field; + + private String phone_number; + + +@Column(length = 2000) +private String paragraph_field; + +private String password_field; +@Transient +private String confirmpassword_field; + + +} diff --git a/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Entity/Testb.java b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Entity/Testb.java new file mode 100644 index 0000000..4eefb2f --- /dev/null +++ b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Entity/Testb.java @@ -0,0 +1,41 @@ +package com.realnet.reactbootstrap.Entity; + import lombok.*; +import com.realnet.WhoColumn.Entity.Extension; + import javax.persistence.*; + import java.time.LocalDateTime; + import java.util.*; + + + + + + + + + + + @Entity + @Data + public class Testb extends Extension { + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + +private String name; + +@Column(length = 2000) +private String textarea_field; + +private String date_field; + +private String datetime_field; + +private String email_field; + + +} diff --git a/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Repository/TestaRepository.java b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Repository/TestaRepository.java new file mode 100644 index 0000000..891f6bc --- /dev/null +++ b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Repository/TestaRepository.java @@ -0,0 +1,34 @@ +package com.realnet.reactbootstrap.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.reactbootstrap.Entity.Testa; + +@Repository +public interface TestaRepository extends JpaRepository { + +@Query(value = "select * from testa where created_by=?1", nativeQuery = true) + List findAll(Long creayedBy); + +@Query(value = "select * from testa where created_by=?1", nativeQuery = true) + Page findAll(Pageable page, Long creayedBy); +} \ No newline at end of file diff --git a/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Repository/TestbRepository.java b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Repository/TestbRepository.java new file mode 100644 index 0000000..d94caaf --- /dev/null +++ b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Repository/TestbRepository.java @@ -0,0 +1,34 @@ +package com.realnet.reactbootstrap.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.reactbootstrap.Entity.Testb; + +@Repository +public interface TestbRepository extends JpaRepository { + +@Query(value = "select * from testb where created_by=?1", nativeQuery = true) + List findAll(Long creayedBy); + +@Query(value = "select * from testb where created_by=?1", nativeQuery = true) + Page findAll(Pageable page, Long creayedBy); +} \ No newline at end of file diff --git a/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Services/TestaService.java b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Services/TestaService.java new file mode 100644 index 0000000..684e94d --- /dev/null +++ b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Services/TestaService.java @@ -0,0 +1,113 @@ +package com.realnet.reactbootstrap.Services; +import com.realnet.reactbootstrap.Repository.TestaRepository; +import com.realnet.reactbootstrap.Entity.Testa +;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 TestaService { +@Autowired +private TestaRepository Repository; + @Autowired + private AppUserServiceImpl userService; +@Autowired + private RealmService realmService; + + + + + + + + + +public Testa Savedata(Testa data) { + + + + + + + + + + + data.setUpdatedBy(getUser().getUserId()); + data.setCreatedBy(getUser().getUserId()); + data.setAccountId(getUser().getAccount().getAccount_id()); +Testa 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 Testa getdetailsbyId(Integer id) { + return Repository.findById(id).get(); + } + + + public void delete_by_id(Integer id) { + Repository.deleteById(id); +} + + +public Testa update(Testa data,Integer id) { + Testa old = Repository.findById(id).get(); +old.setName(data.getName()); + +old.setNumber_field(data.getNumber_field()); + +old.setPhone_number(data.getPhone_number()); + +old.setParagraph_field(data.getParagraph_field()); + +old.setPassword_field(data.getPassword_field()); + +final Testa test = Repository.save(old); + data.setUpdatedBy(getUser().getUserId()); + return test;} + + + + + + + + + + + public AppUser getUser() { + AppUser user = userService.getLoggedInUser(); + return user; + + }} diff --git a/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Services/TestbService.java b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Services/TestbService.java new file mode 100644 index 0000000..2502dd2 --- /dev/null +++ b/test55rb-backrb-b/authsec_springboot/backend/src/main/java/com/realnet/reactbootstrap/Services/TestbService.java @@ -0,0 +1,113 @@ +package com.realnet.reactbootstrap.Services; +import com.realnet.reactbootstrap.Repository.TestbRepository; +import com.realnet.reactbootstrap.Entity.Testb +;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 TestbService { +@Autowired +private TestbRepository Repository; + @Autowired + private AppUserServiceImpl userService; +@Autowired + private RealmService realmService; + + + + + + + + + +public Testb Savedata(Testb data) { + + + + + + + + + + + data.setUpdatedBy(getUser().getUserId()); + data.setCreatedBy(getUser().getUserId()); + data.setAccountId(getUser().getAccount().getAccount_id()); +Testb 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 Testb getdetailsbyId(Integer id) { + return Repository.findById(id).get(); + } + + + public void delete_by_id(Integer id) { + Repository.deleteById(id); +} + + +public Testb update(Testb data,Integer id) { + Testb old = Repository.findById(id).get(); +old.setName(data.getName()); + +old.setTextarea_field(data.getTextarea_field()); + +old.setDate_field(data.getDate_field()); + +old.setDatetime_field(data.getDatetime_field()); + +old.setEmail_field(data.getEmail_field()); + +final Testb test = Repository.save(old); + data.setUpdatedBy(getUser().getUserId()); + return test;} + + + + + + + + + + + public AppUser getUser() { + AppUser user = userService.getLoggedInUser(); + return user; + + }} diff --git a/test55rb-dbrb-d/authsec_mysql/mysql/wf_table/wf_table.sql b/test55rb-dbrb-d/authsec_mysql/mysql/wf_table/wf_table.sql new file mode 100755 index 0000000..4ae9af8 --- /dev/null +++ b/test55rb-dbrb-d/authsec_mysql/mysql/wf_table/wf_table.sql @@ -0,0 +1,4 @@ +CREATE TABLE dbrb.Testa(id BIGINT NOT NULL AUTO_INCREMENT, paragraph_field VARCHAR(400), number_field int, phone_number VARCHAR(400), password_field VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id)); + +CREATE TABLE dbrb.Testb(id BIGINT NOT NULL AUTO_INCREMENT, textarea_field VARCHAR(400), datetime_field VARCHAR(400), date_field Date, email_field VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id)); + diff --git a/test55rb-frontrb-f/Authsec_ReactBootStrapNew/src/App.js b/test55rb-frontrb-f/Authsec_ReactBootStrapNew/src/App.js index 43680cf..53f16be 100644 --- a/test55rb-frontrb-f/Authsec_ReactBootStrapNew/src/App.js +++ b/test55rb-frontrb-f/Authsec_ReactBootStrapNew/src/App.js @@ -1,3 +1,7 @@ +import TestB from "./components/BuilderComponents/reactbootstrap/TestB/TestB"; + +import TestA from "./components/BuilderComponents/reactbootstrap/TestA/TestA"; + import React from "react"; @@ -139,6 +143,12 @@ const App = () => { }/> {/* } /> */} {/* buildercomponents */} + } /> + + + } /> + + @@ -155,5 +165,4 @@ const App = () => { ); }; -export default App; - +export default App; \ No newline at end of file diff --git a/test55rb-frontrb-f/Authsec_ReactBootStrapNew/src/components/BuilderComponents/reactbootstrap/TestA/TestA.js b/test55rb-frontrb-f/Authsec_ReactBootStrapNew/src/components/BuilderComponents/reactbootstrap/TestA/TestA.js new file mode 100644 index 0000000..067716f --- /dev/null +++ b/test55rb-frontrb-f/Authsec_ReactBootStrapNew/src/components/BuilderComponents/reactbootstrap/TestA/TestA.js @@ -0,0 +1,826 @@ +import React, { useEffect, useState , useRef } from "react"; +import QRCode from "qrcode.react"; +import Barcode from "react-barcode"; +import html2canvas from "html2canvas"; +import Select from "react-select"; +import ReCAPTCHA from "react-google-recaptcha"; +import axios from "axios"; +import { FaTrash } from "react-icons/fa"; +import { Modal, Button, Form, Pagination,Container, Row, Col, Image , ProgressBar , } from "react-bootstrap"; +import { ToastContainer, toast } from "react-toastify"; +import "react-toastify/dist/ReactToastify.css"; +import { getToken } from '../../../../utils/tokenService';import Table from "react-bootstrap/Table"; +const FILE_API_URL = `${process.env.REACT_APP_API_URL}FileUpload/Uploadeddocs`; +const API_URL = `${process.env.REACT_APP_API_URL}TestA/TestA`; +const REACT_APP_API_TOKEN = localStorage.getItem("authToken") + +const EntityTable = () => { + const [data, setData] = useState([]); + const [filteredData, setFilteredData] = useState([]); + const [newEntity, setNewEntity] = useState({ + name: "", + + number_field: "", + + phone_number: "", + + paragraph_field: "", + +password_field:"", +confirmpassword_field:"", + + }); + const [editEntity, setEditEntity] = useState(null); + const [showEditModal, setShowEditModal] = useState(false); + const [showAddModal, setShowAddModal] = useState(false); + const [showDeleteModal, setShowDeleteModal] = useState(false); + const [deleteEntityId, setDeleteEntityId] = useState(null); + const [currentPage, setCurrentPage] = useState(1); + const [itemsPerPage] = useState(5); // Adjust this value as needed + const [searchQuery, setSearchQuery] = useState(""); + const [loading, setLoading] = useState(true); + const [options, setOptions] = useState([]); + const [filteredOptions, setFilteredOptions] = useState([]); + const [error, setError] = useState(null); + const [uploadProgress, setUploadProgress] = useState(0); + const [showModal, setShowModal] = useState(false); + const [showValulistModal, setShowValulistModal] = useState(false); + const barcodeRef = useRef(null); + const [serverData, setServerData] = useState([]); + const recaptchaRef = useRef(null); + const editBarcodeRef = useRef(null); + useEffect(() => { + fetchData(); + + + + + + + + + + + }, []); + + useEffect(() => { + handleSearch(); + }, [searchQuery, data]); + const fetchData = async () => { + try { +const token = getToken(); + const response = await axios.get(API_URL, { + headers: { Authorization: `Bearer ${token}` }, + }); + setData(response.data); + } catch (error) { + console.error("Error fetching data:", error); + } + }; + + const handleDelete = async () => { + try { + const token = getToken(); + await axios.delete(`${API_URL}/${deleteEntityId}`, { + headers: { Authorization: `Bearer ${token}` }, + }); + fetchData(); + toast.success("Successfully deleted!"); + setShowDeleteModal(false); + } catch (error) { + console.error("Error deleting data:", error); + } + }; + + const handleAdd = async () => { + + + + + + + + + if (newEntity.password_field !== newEntity.confirmpassword_field) { + toast.error("Passwords do not match!"); + return; + } + + try { + const token = getToken(); + await axios.post(API_URL, newEntity, { + + + + + + + + + + + headers: { Authorization: `Bearer ${token}` }, + }); + fetchData(); + setNewEntity({ + name: "", + + number_field: "", + + phone_number: "", + + paragraph_field: "", + +password_field:"", +confirmpassword_field:"", + + }); + setShowAddModal(false); + toast.success("Successfully added!"); + } catch (error) { + console.error("Error adding data:", error); + } + }; + + const handleChange = (e) => { + const { name, value } = e.target; + setNewEntity({ ...newEntity, [name]: value }); + }; + + const handleEditChange = (e) => { + const { name, value } = e.target; + setEditEntity({ ...editEntity, [name]: value }); + }; + + const handleEdit = (entity) => { + setEditEntity(entity); + + + + + + + + + + + + setShowEditModal(true); + }; + + const formatCurrency = (value) => { + if (value && !value.startsWith('₹')) { + return `₹${value}`; + } + return value; +}; + + + + + + + + + + + + + const handleUpdate = async () => { + + + + + + + + + if (editEntity.password_field !== editEntity.confirmpassword_field) { + toast.error("Passwords do not match!"); + return; + } + + try { +const token = getToken(); + await axios.put(`${API_URL}/${editEntity.id}`, editEntity, { + + + + + + + + + + + headers: { Authorization: `Bearer ${token}` }, + }); + fetchData(); + setShowEditModal(false); + toast.success("Successfully updated!"); + } catch (error) { + console.error("Error updating data:", error); + } + }; + + const handleSearch = () => { + const filtered = data.filter( + (entity) => + + entity.name.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + entity.number_field.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + entity.phone_number.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + entity.paragraph_field.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + entity.password_field.toLowerCase().includes(searchQuery.toLowerCase()) ); + setFilteredData(filtered); + }; + + const handlePageChange = (pageNumber) => { + setCurrentPage(pageNumber); + }; + + const generateBarcodeImage = async (ref) => { + if (ref.current) { + const canvas = await html2canvas(ref.current); + const imgData = canvas.toDataURL("image/png"); + const link = document.createElement("a"); + link.href = imgData; + link.download = "barcode.png"; + link.click(); + } + }; + + // Calculate items for current page + const indexOfLastItem = currentPage * itemsPerPage; + const indexOfFirstItem = indexOfLastItem - itemsPerPage; + const currentItems = filteredData.slice(indexOfFirstItem, indexOfLastItem); + + return ( +
+ +

Entity Table

+
+ + + + + + + + + + + + + setSearchQuery(e.target.value)} + /> +
+ + + + + + + + + + + + + + + + + + {currentItems.map((entity) => ( + + + + + + + + + + + + + + + + + + + + + + + + ))} + +
namenumber_fieldphone_numberparagraph_fieldpassword_fieldAction
{entity.name}{entity.number_field}{entity.phone_number}{entity.paragraph_field}{entity.password_field} + + + + + + + + + + + + + +
+ + {Array.from( + { length: Math.ceil(filteredData.length / itemsPerPage) }, + (_, index) => ( + handlePageChange(index + 1)} + > + {index + 1} + + ) + )} + + + + + + + + + + + + setShowEditModal(false)}> + + Edit Entity + + + {editEntity && ( +
+
+
+
+
+
+
+ + +
+ { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ + + Number Field + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> + + +
+ + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ + + Paragraph Field + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> + + +
+ + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ +
+ + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ + +
+
+
+
+
+ + )} +
+ + + + +
+ setShowAddModal(false)}> + + Add New Entity + + +
+
+
+
+
+
+
+ + +
+ { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ +
+ + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ +
+ + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ + + Paragraph Field + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> + + +
+ + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ +
+ + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ +
+
+
+
+
+ +
+ + + + + + + + + + + + + + +
+ setShowDeleteModal(false)}> + + Confirm Delete + + Are you sure you want to delete this entity? + + + + + +
+ ); +}; + +export default EntityTable; diff --git a/test55rb-frontrb-f/Authsec_ReactBootStrapNew/src/components/BuilderComponents/reactbootstrap/TestB/TestB.js b/test55rb-frontrb-f/Authsec_ReactBootStrapNew/src/components/BuilderComponents/reactbootstrap/TestB/TestB.js new file mode 100644 index 0000000..20fd38b --- /dev/null +++ b/test55rb-frontrb-f/Authsec_ReactBootStrapNew/src/components/BuilderComponents/reactbootstrap/TestB/TestB.js @@ -0,0 +1,765 @@ +import React, { useEffect, useState , useRef } from "react"; +import QRCode from "qrcode.react"; +import Barcode from "react-barcode"; +import html2canvas from "html2canvas"; +import Select from "react-select"; +import ReCAPTCHA from "react-google-recaptcha"; +import axios from "axios"; +import { FaTrash } from "react-icons/fa"; +import { Modal, Button, Form, Pagination,Container, Row, Col, Image , ProgressBar , } from "react-bootstrap"; +import { ToastContainer, toast } from "react-toastify"; +import "react-toastify/dist/ReactToastify.css"; +import { getToken } from '../../../../utils/tokenService';import Table from "react-bootstrap/Table"; +const FILE_API_URL = `${process.env.REACT_APP_API_URL}FileUpload/Uploadeddocs`; +const API_URL = `${process.env.REACT_APP_API_URL}TestB/TestB`; +const REACT_APP_API_TOKEN = localStorage.getItem("authToken") + +const EntityTable = () => { + const [data, setData] = useState([]); + const [filteredData, setFilteredData] = useState([]); + const [newEntity, setNewEntity] = useState({ + name: "", + + textarea_field: "", + + date_field: "", + + datetime_field: "", + + email_field: "", + + }); + const [editEntity, setEditEntity] = useState(null); + const [showEditModal, setShowEditModal] = useState(false); + const [showAddModal, setShowAddModal] = useState(false); + const [showDeleteModal, setShowDeleteModal] = useState(false); + const [deleteEntityId, setDeleteEntityId] = useState(null); + const [currentPage, setCurrentPage] = useState(1); + const [itemsPerPage] = useState(5); // Adjust this value as needed + const [searchQuery, setSearchQuery] = useState(""); + const [loading, setLoading] = useState(true); + const [options, setOptions] = useState([]); + const [filteredOptions, setFilteredOptions] = useState([]); + const [error, setError] = useState(null); + const [uploadProgress, setUploadProgress] = useState(0); + const [showModal, setShowModal] = useState(false); + const [showValulistModal, setShowValulistModal] = useState(false); + const barcodeRef = useRef(null); + const [serverData, setServerData] = useState([]); + const recaptchaRef = useRef(null); + const editBarcodeRef = useRef(null); + useEffect(() => { + fetchData(); + + + + + + + + + + + }, []); + + useEffect(() => { + handleSearch(); + }, [searchQuery, data]); + const fetchData = async () => { + try { +const token = getToken(); + const response = await axios.get(API_URL, { + headers: { Authorization: `Bearer ${token}` }, + }); + setData(response.data); + } catch (error) { + console.error("Error fetching data:", error); + } + }; + + const handleDelete = async () => { + try { + const token = getToken(); + await axios.delete(`${API_URL}/${deleteEntityId}`, { + headers: { Authorization: `Bearer ${token}` }, + }); + fetchData(); + toast.success("Successfully deleted!"); + setShowDeleteModal(false); + } catch (error) { + console.error("Error deleting data:", error); + } + }; + + const handleAdd = async () => { + + + + + + + + + + + try { + const token = getToken(); + await axios.post(API_URL, newEntity, { + + + + + + + + + + + headers: { Authorization: `Bearer ${token}` }, + }); + fetchData(); + setNewEntity({ + name: "", + + textarea_field: "", + + date_field: "", + + datetime_field: "", + + email_field: "", + + }); + setShowAddModal(false); + toast.success("Successfully added!"); + } catch (error) { + console.error("Error adding data:", error); + } + }; + + const handleChange = (e) => { + const { name, value } = e.target; + setNewEntity({ ...newEntity, [name]: value }); + }; + + const handleEditChange = (e) => { + const { name, value } = e.target; + setEditEntity({ ...editEntity, [name]: value }); + }; + + const handleEdit = (entity) => { + setEditEntity(entity); + + + + + + + + + + + + setShowEditModal(true); + }; + + const formatCurrency = (value) => { + if (value && !value.startsWith('₹')) { + return `₹${value}`; + } + return value; +}; + + + + + + + + + + + + + const handleUpdate = async () => { + + + + + + + + + + + try { +const token = getToken(); + await axios.put(`${API_URL}/${editEntity.id}`, editEntity, { + + + + + + + + + + + headers: { Authorization: `Bearer ${token}` }, + }); + fetchData(); + setShowEditModal(false); + toast.success("Successfully updated!"); + } catch (error) { + console.error("Error updating data:", error); + } + }; + + const handleSearch = () => { + const filtered = data.filter( + (entity) => + + entity.name.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + entity.textarea_field.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + entity.date_field.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + entity.datetime_field.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + entity.email_field.toLowerCase().includes(searchQuery.toLowerCase()) ); + setFilteredData(filtered); + }; + + const handlePageChange = (pageNumber) => { + setCurrentPage(pageNumber); + }; + + const generateBarcodeImage = async (ref) => { + if (ref.current) { + const canvas = await html2canvas(ref.current); + const imgData = canvas.toDataURL("image/png"); + const link = document.createElement("a"); + link.href = imgData; + link.download = "barcode.png"; + link.click(); + } + }; + + // Calculate items for current page + const indexOfLastItem = currentPage * itemsPerPage; + const indexOfFirstItem = indexOfLastItem - itemsPerPage; + const currentItems = filteredData.slice(indexOfFirstItem, indexOfLastItem); + + return ( +
+ +

Entity Table

+
+ + + + + + + + + + + + + setSearchQuery(e.target.value)} + /> +
+ + + + + + + + + + + + + + + + + + {currentItems.map((entity) => ( + + + + + + + + + + + + + + + + + + + + + + + + ))} + +
nametextarea_fielddate_fielddatetime_fieldemail_fieldAction
{entity.name}{entity.textarea_field}{entity.date_field}{entity.datetime_field}{entity.email_field} + + + + + + + + + + + + + +
+ + {Array.from( + { length: Math.ceil(filteredData.length / itemsPerPage) }, + (_, index) => ( + handlePageChange(index + 1)} + > + {index + 1} + + ) + )} + + + + + + + + + + + + setShowEditModal(false)}> + + Edit Entity + + + {editEntity && ( +
+
+
+
+
+
+
+ + +
+ { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ + + Textarea Field + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> + + +
+ + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ + + +
+ { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ + + Email Field + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> + + + +
+
+
+
+
+ + )} +
+ + + + +
+ setShowAddModal(false)}> + + Add New Entity + + +
+
+
+
+
+
+
+ + +
+ { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ +
+ + +
+ +
+ + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ + + +
+ { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ +
+ + { + e.target.style.borderColor = '#007bff'; + e.target.style.boxShadow = '0 0 8px rgba(0, 123, 255, 0.25)'; + }} + onBlur={(e) => { + e.target.style.borderColor = '#ced4da'; + e.target.style.boxShadow = 'none'; + }} + /> +
+ +
+
+
+
+
+ +
+ + + + + + + + + + + + + + +
+ setShowDeleteModal(false)}> + + Confirm Delete + + Are you sure you want to delete this entity? + + + + + +
+ ); +}; + +export default EntityTable;