build_app
This commit is contained in:
parent
923e028d0d
commit
919e4761b2
@ -69,6 +69,9 @@ public class BuilderService {
|
||||
executeDump(true);
|
||||
|
||||
// ADD OTHER SERVICE
|
||||
addCustomMenu( "Form", "Transcations");
|
||||
|
||||
|
||||
|
||||
System.out.println("dashboard and menu inserted...");
|
||||
|
||||
|
86
test412rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Controllers/FormController.java
Normal file
86
test412rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Controllers/FormController.java
Normal file
@ -0,0 +1,86 @@
|
||||
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.Form;
|
||||
import com.realnet.basicp1.Services.FormService ;
|
||||
@RequestMapping(value = "/Form")
|
||||
@CrossOrigin("*")
|
||||
@RestController
|
||||
public class FormController {
|
||||
@Autowired
|
||||
private FormService Service;
|
||||
|
||||
@Value("${projectPath}")
|
||||
private String projectPath;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("/Form")
|
||||
public Form Savedata(@RequestBody Form data) {
|
||||
Form save = Service.Savedata(data) ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
System.out.println("data saved..." + save);
|
||||
|
||||
return save;
|
||||
}
|
||||
@PutMapping("/Form/{id}")
|
||||
public Form update(@RequestBody Form data,@PathVariable Integer id ) {
|
||||
Form update = Service.update(data,id);
|
||||
System.out.println("data update..." + update);
|
||||
return update;
|
||||
}
|
||||
// get all with pagination
|
||||
@GetMapping("/Form/getall/page")
|
||||
public Page<Form> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||
@RequestParam(value = "size", required = false) Integer size) {
|
||||
Pageable paging = PageRequest.of(page, size);
|
||||
Page<Form> get = Service.getAllWithPagination(paging);
|
||||
|
||||
return get;
|
||||
|
||||
}
|
||||
@GetMapping("/Form")
|
||||
public List<Form> getdetails() {
|
||||
List<Form> get = Service.getdetails();
|
||||
return get;
|
||||
}
|
||||
// get all without authentication
|
||||
|
||||
@GetMapping("/token/Form")
|
||||
public List<Form> getallwioutsec() {
|
||||
List<Form> get = Service.getdetails();
|
||||
return get;
|
||||
}
|
||||
@GetMapping("/Form/{id}")
|
||||
public Form getdetailsbyId(@PathVariable Integer id ) {
|
||||
Form get = Service.getdetailsbyId(id);
|
||||
return get;
|
||||
}
|
||||
@DeleteMapping("/Form/{id}")
|
||||
public void delete_by_id(@PathVariable Integer id ) {
|
||||
Service.delete_by_id(id);
|
||||
|
||||
}
|
||||
|
||||
}
|
34
test412rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Form.java
Normal file
34
test412rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Entity/Form.java
Normal file
@ -0,0 +1,34 @@
|
||||
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 Form extends Extension {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
private String namen;
|
||||
|
||||
private String gender;
|
||||
|
||||
private String imagetestname;
|
||||
private String imagetestpath ;
|
||||
|
||||
|
||||
}
|
21
test412rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Repository/FormRepository.java
Normal file
21
test412rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Repository/FormRepository.java
Normal file
@ -0,0 +1,21 @@
|
||||
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.Form;
|
||||
|
||||
@Repository
|
||||
public interface FormRepository extends JpaRepository<Form, Integer> {
|
||||
}
|
76
test412rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/FormService.java
Normal file
76
test412rb-back-b/authsec_springboot/backend/src/main/java/com/realnet/basicp1/Services/FormService.java
Normal file
@ -0,0 +1,76 @@
|
||||
package com.realnet.basicp1.Services;
|
||||
import com.realnet.basicp1.Repository.FormRepository;
|
||||
import com.realnet.basicp1.Entity.Form;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 FormService {
|
||||
@Autowired
|
||||
private FormRepository Repository;
|
||||
@Autowired
|
||||
private AppUserServiceImpl userService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Form Savedata(Form data) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Form save = Repository.save(data);
|
||||
return save;
|
||||
}
|
||||
|
||||
|
||||
// get all with pagination
|
||||
public Page<Form> getAllWithPagination(Pageable page) {
|
||||
return Repository.findAll(page);
|
||||
}
|
||||
public List<Form> getdetails() {
|
||||
return (List<Form>) Repository.findAll();
|
||||
}
|
||||
|
||||
|
||||
public Form getdetailsbyId(Integer id) {
|
||||
return Repository.findById(id).get();
|
||||
}
|
||||
|
||||
|
||||
public void delete_by_id(Integer id) {
|
||||
Repository.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
public Form update(Form data,Integer id) {
|
||||
Form old = Repository.findById(id).get();
|
||||
old.setNamen(data.getNamen());
|
||||
|
||||
old.setGender(data.getGender());
|
||||
|
||||
|
||||
|
||||
final Form test = Repository.save(old);
|
||||
return test;}
|
||||
public AppUser getUser() {
|
||||
AppUser user = userService.getLoggedInUser();
|
||||
return user;
|
||||
|
||||
}}
|
2
test412rb-db-d/authsec_mysql/mysql/wf_table/wf_table.sql
Executable file
2
test412rb-db-d/authsec_mysql/mysql/wf_table/wf_table.sql
Executable file
@ -0,0 +1,2 @@
|
||||
CREATE TABLE db.Form(id BIGINT NOT NULL AUTO_INCREMENT, gender VARCHAR(400), Imagetest VARCHAR(400), Namen VARCHAR(400), PRIMARY KEY (id));
|
||||
|
@ -1,3 +1,5 @@
|
||||
import Form from "./Components/BuilderComponents/basicp1/Form/Form";
|
||||
|
||||
import Stt from "./Components/BuilderComponents/feedback_formn/Stt/Stt";
|
||||
|
||||
import React from "react";
|
||||
@ -44,6 +46,9 @@ function App() {
|
||||
|
||||
<Route path="/Extension" element={<Extension/>} />
|
||||
{/* buildercomponents */}
|
||||
<Route path="/Form" element={<Form />} />
|
||||
|
||||
|
||||
<Route path="/Stt" element={<Stt />} />
|
||||
|
||||
<Route path="/setup" element={<SetupView />} />
|
||||
|
526
test412rb-front-f/authsec_react_bootstrap/authsec_react_bootstrap/src/Components/BuilderComponents/basicp1/Form/Form.js
Normal file
526
test412rb-front-f/authsec_react_bootstrap/authsec_react_bootstrap/src/Components/BuilderComponents/basicp1/Form/Form.js
Normal file
@ -0,0 +1,526 @@
|
||||
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 { Modal, Button, Form, Pagination,Container, Row, Col, Image } 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}/Form/Form`;
|
||||
const REACT_APP_API_TOKEN = localStorage.getItem("authToken")
|
||||
|
||||
const EntityTable = () => {
|
||||
const [data, setData] = useState([]);
|
||||
const [filteredData, setFilteredData] = useState([]);
|
||||
const [newEntity, setNewEntity] = useState({
|
||||
namen: "",
|
||||
|
||||
gender: "",
|
||||
|
||||
imagetest: 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("");
|
||||
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 response = await axios.get(API_URL, {
|
||||
headers: { Authorization: `Bearer ${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 ${REACT_APP_API_TOKEN}` },
|
||||
});
|
||||
fetchData();
|
||||
toast.success("Successfully deleted!");
|
||||
setShowDeleteModal(false);
|
||||
} catch (error) {
|
||||
console.error("Error deleting data:", error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleAdd = async () => {
|
||||
|
||||
|
||||
|
||||
|
||||
if (newEntity.imagetest) {
|
||||
// Handle file upload
|
||||
await uploadFile(
|
||||
|
||||
newEntity.imagetest);
|
||||
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
await axios.post(API_URL, newEntity, {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
headers: { Authorization: `Bearer ${REACT_APP_API_TOKEN}` },
|
||||
});
|
||||
fetchData();
|
||||
setNewEntity({
|
||||
namen: "",
|
||||
|
||||
gender: "",
|
||||
|
||||
imagetest: 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 formatCurrency = (value) => {
|
||||
if (value && !value.startsWith('₹')) {
|
||||
return `₹${value}`;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const FILE_API_URL = `${process.env.REACT_APP_API_URL}/FileUpload/Uploadeddocs`;
|
||||
const uploadFile = async ( file, ref, Form) => {
|
||||
if (!file) {
|
||||
toast.error("Please select a file to upload.");
|
||||
return;
|
||||
}
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("file", file); // Ensure the key matches the backend parameter name
|
||||
|
||||
|
||||
try {
|
||||
const response = await axios.post(
|
||||
`${FILE_API_URL}/${ref}/${Form}`, // Use path variables in the URL
|
||||
formData,
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
Authorization: `Bearer ${localStorage.getItem("authToken")}`,
|
||||
},
|
||||
onUploadProgress: (progressEvent) => {
|
||||
const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
|
||||
setUploadProgress(percentCompleted);
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
toast.success("File uploaded successfully!");
|
||||
console.log("Response:", response.data);
|
||||
} catch (error) {
|
||||
console.error("File upload failed with error:", error);
|
||||
console.log("Error details:", error.response); // Additional logging for debugging
|
||||
if (error.response && error.response.status === 405) {
|
||||
toast.error("Method Not Allowed. Please check the API endpoint and method.");
|
||||
} else {
|
||||
toast.error("File upload failed. Please try again.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
const handleUpdate = async () => {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
await axios.put(`${API_URL}/${editEntity.id}`, editEntity, {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
headers: { Authorization: `Bearer ${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.gender.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||
|
||||
|
||||
|
||||
|
||||
entity.imagetest.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 (
|
||||
<div className="container mt-5">
|
||||
<ToastContainer />
|
||||
<h1 className="mb-4">Entity Table</h1>
|
||||
<div className="d-flex justify-content-between mb-3">
|
||||
<Button variant="primary" onClick={() => setShowAddModal(true)}>
|
||||
Add Entity
|
||||
</Button>
|
||||
<Form.Control
|
||||
type="text"
|
||||
className="w-25"
|
||||
placeholder="Search..."
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<Table striped bordered hover responsive variant="dark">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>namen</th>
|
||||
|
||||
<th>gender</th>
|
||||
|
||||
<th>imagetest</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody >
|
||||
{currentItems.map((entity) => (
|
||||
<tr key={entity.id}>
|
||||
|
||||
<td>{entity.namen}</td>
|
||||
|
||||
|
||||
|
||||
<td>{entity.gender}</td>
|
||||
|
||||
|
||||
|
||||
<td>{entity.imagetest}</td>
|
||||
|
||||
|
||||
<td>
|
||||
<Button
|
||||
variant="warning"
|
||||
size="sm"
|
||||
className="me-2"
|
||||
onClick={() => handleEdit(entity)}
|
||||
>
|
||||
Update
|
||||
</Button>
|
||||
<Button
|
||||
variant="danger"
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
setDeleteEntityId(entity.id);
|
||||
setShowDeleteModal(true);
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
</Button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</Table>
|
||||
<Pagination className="d-flex justify-content-center mt-4">
|
||||
{Array.from(
|
||||
{ length: Math.ceil(filteredData.length / itemsPerPage) },
|
||||
(_, index) => (
|
||||
<Pagination.Item
|
||||
key={index + 1}
|
||||
active={index + 1 === currentPage}
|
||||
onClick={() => handlePageChange(index + 1)}
|
||||
>
|
||||
{index + 1}
|
||||
</Pagination.Item>
|
||||
)
|
||||
)}
|
||||
</Pagination>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<Modal show={showEditModal} onHide={() => setShowEditModal(false)}>
|
||||
<Modal.Header closeButton>
|
||||
<Modal.Title>Edit Entity</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body>
|
||||
{editEntity && (
|
||||
<Form className="bg-dark p-3 text-light rounded">
|
||||
<div className="form-group">
|
||||
<label htmlFor="namen">Namen</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="namen"
|
||||
name="namen"
|
||||
value={editEntity.namen}
|
||||
onChange={handleEditChange}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Form.Group className="mb-3">
|
||||
<Form.Label>gender</Form.Label>
|
||||
|
||||
|
||||
|
||||
<Form.Check
|
||||
type="radio"
|
||||
label="f"
|
||||
name="gender"
|
||||
value="f"
|
||||
checked={editEntity.gender === "f"}
|
||||
onChange={handleEditChange}
|
||||
className="bg-secondary text-light"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
|
||||
<Form.Check
|
||||
type="radio"
|
||||
label="m"
|
||||
name="gender"
|
||||
value="m"
|
||||
checked={editEntity.gender === "m"}
|
||||
onChange={handleEditChange}
|
||||
className="bg-secondary text-light"
|
||||
/>
|
||||
|
||||
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group controlId="formFileupload">
|
||||
<Form.Label>imagetest</Form.Label>
|
||||
<Form.Control
|
||||
type="file"
|
||||
name="imagetest"
|
||||
accept="image/png, image/jpeg, image/jpg, image/gif, image/webp"
|
||||
onChange={(e) =>
|
||||
setEditEntity({ ...editEntity, imagetest: e.target.files[0] })
|
||||
}
|
||||
/>
|
||||
</Form.Group>
|
||||
|
||||
</Form>
|
||||
|
||||
)}
|
||||
</Modal.Body>
|
||||
<Modal.Footer>
|
||||
<Button variant="secondary" onClick={() => setShowEditModal(false)}>
|
||||
Close
|
||||
</Button>
|
||||
<Button variant="primary" onClick={handleUpdate}>
|
||||
Save changes
|
||||
</Button>
|
||||
</Modal.Footer>
|
||||
</Modal>
|
||||
<Modal show={showAddModal} onHide={() => setShowAddModal(false)}>
|
||||
<Modal.Header closeButton>
|
||||
<Modal.Title>Add New Entity</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body>
|
||||
<Form className="bg-dark p-3 text-light rounded">
|
||||
<div className="form-group">
|
||||
<label htmlFor="namen">Namen</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control"
|
||||
id="namen"
|
||||
name="namen"
|
||||
value={newEntity.namen}
|
||||
onChange={handleChange}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Form.Group className="mb-3">
|
||||
|
||||
<Form.Label>gender</Form.Label>
|
||||
|
||||
|
||||
<Form.Check
|
||||
type="radio"
|
||||
label="f"
|
||||
name="gender"
|
||||
value="f"
|
||||
checked={newEntity.gender === "f"}
|
||||
|
||||
onChange={handleChange}
|
||||
className="bg-secondary text-light"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
<Form.Check
|
||||
type="radio"
|
||||
label="m"
|
||||
name="gender"
|
||||
value="m"
|
||||
checked={newEntity.gender === "m"}
|
||||
|
||||
onChange={handleChange}
|
||||
className="bg-secondary text-light"
|
||||
/>
|
||||
|
||||
|
||||
</Form.Group>
|
||||
|
||||
|
||||
<Form.Group controlId="formFileupload">
|
||||
<Form.Label>imagetest</Form.Label>
|
||||
<Form.Control
|
||||
type="file"
|
||||
name="imagetest"
|
||||
accept="image/png, image/jpeg, image/jpg, image/gif, image/webp"
|
||||
onChange={(e) =>
|
||||
setNewEntity({ ...newEntity, imagetest: e.target.files[0] })
|
||||
}
|
||||
/>
|
||||
</Form.Group>
|
||||
|
||||
</Form>
|
||||
|
||||
</Modal.Body>
|
||||
<Modal.Footer>
|
||||
<Button variant="secondary" onClick={() => setShowAddModal(false)}>
|
||||
Close
|
||||
</Button>
|
||||
<Button variant="primary" onClick={handleAdd}>
|
||||
Add Entity
|
||||
</Button>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Modal.Footer>
|
||||
</Modal>
|
||||
<Modal show={showDeleteModal} onHide={() => setShowDeleteModal(false)}>
|
||||
<Modal.Header closeButton>
|
||||
<Modal.Title>Confirm Delete</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body>Are you sure you want to delete this entity?</Modal.Body>
|
||||
<Modal.Footer>
|
||||
<Button variant="secondary" onClick={() => setShowDeleteModal(false)}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button variant="danger" onClick={handleDelete}>
|
||||
Delete
|
||||
</Button>
|
||||
</Modal.Footer>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default EntityTable;
|
Loading…
Reference in New Issue
Block a user