diff --git a/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java b/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java index df685fd..f294100 100644 --- a/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java +++ b/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java @@ -69,6 +69,9 @@ public class BuilderService { executeDump(true); // ADD OTHER SERVICE +addCustomMenu( "Forma", "Transcations"); + + System.out.println("dashboard and menu inserted..."); diff --git a/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Controllers/FormaController.java b/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Controllers/FormaController.java new file mode 100644 index 0000000..fce63e7 --- /dev/null +++ b/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Controllers/FormaController.java @@ -0,0 +1,106 @@ +package com.realnet.basicp1.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.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.beans.factory.annotation.*; +import com.realnet.basicp1.Entity.Forma; +import com.realnet.basicp1.Services.FormaService ; +@RequestMapping(value = "/Forma") + @CrossOrigin("*") +@RestController +public class FormaController { + @Autowired + private FormaService Service; + +@Value("${projectPath}") + private String projectPath; + + + + + + + + + + + + + + + + + + @PostMapping("/Forma") + public Forma Savedata(@RequestBody Forma data) { + Forma save = Service.Savedata(data) ; + + + + + + + + + + + + + + + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Forma/{id}") + public Forma update(@RequestBody Forma data,@PathVariable Integer id ) { + Forma update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Forma/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("/Forma") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Forma") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Forma/{id}") + public Forma getdetailsbyId(@PathVariable Integer id ) { + Forma get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Forma/{id}") + public void delete_by_id(@PathVariable Integer id ) { + Service.delete_by_id(id); + + } + +} \ No newline at end of file diff --git a/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Forma.java b/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Forma.java new file mode 100644 index 0000000..f1e0969 --- /dev/null +++ b/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Forma.java @@ -0,0 +1,70 @@ +package com.realnet.basicp1.Entity; + import lombok.*; +import com.realnet.WhoColumn.Extension; + import javax.persistence.*; + import java.time.LocalDateTime; + import java.util.*; + + + + + + + + + + + + + + + + + + @Entity + @Data + public class Forma extends Extension { + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + +private String namen; + +private String sub; + + private String gender; + + + + +private boolean pune; + + + +private boolean nagpur; + + + +private boolean mumbai; + + + +private String filetestname; +private String filetestpath ; + +private String imagetestname; +private String imagetestpath ; + +private String audiotestname; +private String audiotestpath ; + +private String videotestname; +private String videotestpath ; + + +} diff --git a/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Repository/FormaRepository.java b/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Repository/FormaRepository.java new file mode 100644 index 0000000..b84b930 --- /dev/null +++ b/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Repository/FormaRepository.java @@ -0,0 +1,31 @@ +package com.realnet.basicp1.Repository; + + +import org.springframework.data.jpa.repository.JpaRepository; + +import org.springframework.stereotype.Repository; +import java.util.*; + + + + + + + + + + + + + + + + + + + +import com.realnet.basicp1.Entity.Forma; + +@Repository +public interface FormaRepository extends JpaRepository { +} \ No newline at end of file diff --git a/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/FormaService.java b/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/FormaService.java new file mode 100644 index 0000000..e844095 --- /dev/null +++ b/prod110rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/FormaService.java @@ -0,0 +1,130 @@ +package com.realnet.basicp1.Services; +import com.realnet.basicp1.Repository.FormaRepository; +import com.realnet.basicp1.Entity.Forma;import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import com.realnet.SequenceGenerator.Service.SequenceService; +import com.realnet.Notification.Entity.NotificationService; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import com.realnet.users.service1.AppUserServiceImpl; +import com.realnet.users.entity1.AppUser; + + + + + + + + + + + + + + + + + import org.springframework.stereotype.Service; + +@Service + public class FormaService { +@Autowired +private FormaRepository Repository; + @Autowired + private AppUserServiceImpl userService; + + + + + + + + + + + + + + + +public Forma Savedata(Forma data) { + + + + + + + + + + + + + + + + +Forma save = Repository.save(data); + return save; + } + + +// get all with pagination + public Page getAllWithPagination(Pageable page) { + return Repository.findAll(page); + } +public List getdetails() { + return (List) Repository.findAll(); + } + + +public Forma getdetailsbyId(Integer id) { + return Repository.findById(id).get(); + } + + + public void delete_by_id(Integer id) { + Repository.deleteById(id); +} + + +public Forma update(Forma data,Integer id) { + Forma old = Repository.findById(id).get(); +old.setNamen(data.getNamen()); + +old.setSub(data.getSub()); + +old.setGender(data.getGender()); + + + +old.setPune(data.isPune()); + + + +old.setNagpur(data.isNagpur()); + + + +old.setMumbai(data.isMumbai()); + + + + + + + + + + + + + +final Forma test = Repository.save(old); + return test;} + public AppUser getUser() { + AppUser user = userService.getLoggedInUser(); + return user; + + }} diff --git a/prod110rb-db-d/authsec_mysql/mysql/wf_table/wf_table.sql b/prod110rb-db-d/authsec_mysql/mysql/wf_table/wf_table.sql new file mode 100755 index 0000000..1a67724 --- /dev/null +++ b/prod110rb-db-d/authsec_mysql/mysql/wf_table/wf_table.sql @@ -0,0 +1,2 @@ +CREATE TABLE db.Forma(id BIGINT NOT NULL AUTO_INCREMENT, sub VARCHAR(400), gender VARCHAR(400), city VARCHAR(400), Imagetest VARCHAR(400), Namen VARCHAR(400), videotest VARCHAR(400), audiotest VARCHAR(400), Filetest VARCHAR(400), PRIMARY KEY (id)); + diff --git a/prod110rb-front-f/authsec_react_bootstrap/authsec_react_bootstrap/src/App.js b/prod110rb-front-f/authsec_react_bootstrap/authsec_react_bootstrap/src/App.js index c8d8903..35ee42f 100644 --- a/prod110rb-front-f/authsec_react_bootstrap/authsec_react_bootstrap/src/App.js +++ b/prod110rb-front-f/authsec_react_bootstrap/authsec_react_bootstrap/src/App.js @@ -1,3 +1,5 @@ +import Forma from "./Components/BuilderComponents/basicp1/Forma/Forma"; + import Stt from "./Components/BuilderComponents/feedback_formn/Stt/Stt"; import React from "react"; @@ -44,6 +46,9 @@ function App() { } /> {/* buildercomponents */} + } /> + + } /> } /> diff --git a/prod110rb-front-f/authsec_react_bootstrap/authsec_react_bootstrap/src/Components/BuilderComponents/basicp1/Forma/Forma.js b/prod110rb-front-f/authsec_react_bootstrap/authsec_react_bootstrap/src/Components/BuilderComponents/basicp1/Forma/Forma.js new file mode 100644 index 0000000..6206022 --- /dev/null +++ b/prod110rb-front-f/authsec_react_bootstrap/authsec_react_bootstrap/src/Components/BuilderComponents/basicp1/Forma/Forma.js @@ -0,0 +1,642 @@ +import React, { useEffect, useState } from "react"; +import axios from "axios"; +import { Modal, Button, Form, Pagination } from "react-bootstrap"; +import { ToastContainer, toast } from "react-toastify"; +import "react-toastify/dist/ReactToastify.css"; +import Table from "react-bootstrap/Table"; + +const API_URL = `${process.env.REACT_APP_API_URL}/Forma/Forma`; + +const EntityTable = () => { + const [data, setData] = useState([]); + const [filteredData, setFilteredData] = useState([]); + const [newEntity, setNewEntity] = useState({ + namen: "", + + sub: "", + + gender: "", + + city: "", + +filetest: null, + + imagetest: "", + +audiotest: null, + +videotest: null, + + }); + 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(""); + + useEffect(() => { + fetchData(); + }, []); + + useEffect(() => { + handleSearch(); + }, [searchQuery, data]); + + const fetchData = async () => { + try { + const response = await axios.get(API_URL, { + headers: { Authorization: `Bearer ${process.env.REACT_APP_API_TOKEN}` }, + }); + setData(response.data); + } catch (error) { + console.error("Error fetching data:", error); + } + }; + + const handleDelete = async () => { + try { + await axios.delete(`${API_URL}/${deleteEntityId}`, { + headers: { Authorization: `Bearer ${process.env.REACT_APP_API_TOKEN}` }, + }); + fetchData(); + toast.success("Successfully deleted!"); + setShowDeleteModal(false); + } catch (error) { + console.error("Error deleting data:", error); + } + }; + + const handleAdd = async () => { + try { + await axios.post(API_URL, newEntity, { + headers: { Authorization: `Bearer ${process.env.REACT_APP_API_TOKEN}` }, + }); + fetchData(); + setNewEntity({ + namen: "", + + sub: "", + + gender: "", + + city: "", + +filetest: null, + + imagetest: "", + +audiotest: null, + +videotest: null, + + }); + 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 handleUpdate = async () => { + try { + await axios.put(`${API_URL}/${editEntity.id}`, editEntity, { + headers: { Authorization: `Bearer ${process.env.REACT_APP_API_TOKEN}` }, + }); + fetchData(); + setShowEditModal(false); + toast.success("Successfully updated!"); + } catch (error) { + console.error("Error updating data:", error); + } + }; + + const handleSearch = () => { + const filtered = data.filter( + (entity) => + + + entity.namen.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + + entity.sub.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + + entity.gender.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + + entity.city.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + + entity.filetest.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + + entity.imagetest.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + + entity.audiotest.toLowerCase().includes(searchQuery.toLowerCase()) || + + + + + entity.videotest.toLowerCase().includes(searchQuery.toLowerCase()) ); + setFilteredData(filtered); + }; + + const handlePageChange = (pageNumber) => { + setCurrentPage(pageNumber); + }; + + // 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) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ))} + +
namensubgendercityfiletestimagetestaudiotestvideotest
{entity.namen}{entity.sub}{entity.gender}{entity.city}{entity.filetest}{entity.imagetest}{entity.audiotest}{entity.videotest} + + +
+ + {Array.from( + { length: Math.ceil(filteredData.length / itemsPerPage) }, + (_, index) => ( + handlePageChange(index + 1)} + > + {index + 1} + + ) + )} + + setShowEditModal(false)}> + + Edit Entity + + + {editEntity && ( +
+
+ + +
+ + + sub + + + {Options.map((option) => ( + + ))} + + + + + gender + + + + + + + + + + + + + + + city + + + + handleEditCheckboxChange("pune")} + /> + + + + + handleEditCheckboxChange("nagpur")} + /> + + + + + handleEditCheckboxChange("mumbai")} + /> + + + + + + filetest + + setEditEntity({ ...editEntity, filetest: e.target.files[0] }) + } + /> + + + + imagetest + + setEditEntity({ ...editEntity, imagetest: e.target.files[0] }) + } + /> + + + + audiotest + + setEditEntity({ ...editEntity, audiotest: e.target.files[0] }) + } + /> + + + + videotest + + setEditEntity({ ...editEntity, videotest: e.target.files[0] }) + } + /> + + +
+ + )} +
+ + + + +
+ setShowAddModal(false)}> + + Add New Entity + + +
+
+ + +
+ + + sub + + + {Options.map((option) => ( + + ))} + + + + + + gender + + + + + + + + + + + + + + city + + + + handleCheckboxChange("pune")} + /> + + + + + handleCheckboxChange("nagpur")} + /> + + + + + handleCheckboxChange("mumbai")} + /> + + + + + + filetest + + setNewEntity({ ...newEntity, filetest: e.target.files[0] }) + } + /> + + + + imagetest + + setNewEntity({ ...newEntity, imagetest: e.target.files[0] }) + } + /> + + + + audiotest + + setNewEntity({ ...newEntity, audiotest: e.target.files[0] }) + } + /> + + + + videotest + + setNewEntity({ ...newEntity, videotest: e.target.files[0] }) + } + /> + + +
+ +
+ + + + +
+ setShowDeleteModal(false)}> + + Confirm Delete + + Are you sure you want to delete this entity? + + + + + +
+ ); +}; + +export default EntityTable;