build_app
This commit is contained in:
parent
e9b9fdc2bb
commit
863af294fc
@ -1,3 +1,25 @@
|
|||||||
|
import Listtest from "./components/BuilderComponents/angulardatatype/Listtest/Listtest";
|
||||||
|
|
||||||
|
import Test from "./components/BuilderComponents/angulardatatype/Test/Test";
|
||||||
|
|
||||||
|
import Ad9 from "./components/BuilderComponents/angulardatatype/Ad9/Ad9";
|
||||||
|
|
||||||
|
import Ad8 from "./components/BuilderComponents/angulardatatype/Ad8/Ad8";
|
||||||
|
|
||||||
|
import Ad7 from "./components/BuilderComponents/angulardatatype/Ad7/Ad7";
|
||||||
|
|
||||||
|
import Ad6 from "./components/BuilderComponents/angulardatatype/Ad6/Ad6";
|
||||||
|
|
||||||
|
import Adv5 from "./components/BuilderComponents/angulardatatype/Adv5/Adv5";
|
||||||
|
|
||||||
|
import Adv4 from "./components/BuilderComponents/angulardatatype/Adv4/Adv4";
|
||||||
|
|
||||||
|
import Support from "./components/BuilderComponents/angulardatatype/Support/Support";
|
||||||
|
|
||||||
|
import Adv3 from "./components/BuilderComponents/angulardatatype/Adv3/Adv3";
|
||||||
|
|
||||||
|
import Adv1 from "./components/BuilderComponents/angulardatatype/Adv1/Adv1";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
@ -139,6 +161,39 @@ const App = () => {
|
|||||||
<Route path="dashrunner/:id" element={<DashboardRunner/>}/>
|
<Route path="dashrunner/:id" element={<DashboardRunner/>}/>
|
||||||
{/* <Route path="test" element={<Regform />} /> */}
|
{/* <Route path="test" element={<Regform />} /> */}
|
||||||
{/* buildercomponents */}
|
{/* buildercomponents */}
|
||||||
|
<Route path="Listtest" element={<Listtest />} />
|
||||||
|
|
||||||
|
|
||||||
|
<Route path="Test" element={<Test />} />
|
||||||
|
|
||||||
|
|
||||||
|
<Route path="Ad9" element={<Ad9 />} />
|
||||||
|
|
||||||
|
|
||||||
|
<Route path="Ad8" element={<Ad8 />} />
|
||||||
|
|
||||||
|
|
||||||
|
<Route path="Ad7" element={<Ad7 />} />
|
||||||
|
|
||||||
|
|
||||||
|
<Route path="Ad6" element={<Ad6 />} />
|
||||||
|
|
||||||
|
|
||||||
|
<Route path="Adv5" element={<Adv5 />} />
|
||||||
|
|
||||||
|
|
||||||
|
<Route path="Adv4" element={<Adv4 />} />
|
||||||
|
|
||||||
|
|
||||||
|
<Route path="Support" element={<Support />} />
|
||||||
|
|
||||||
|
|
||||||
|
<Route path="Adv3" element={<Adv3 />} />
|
||||||
|
|
||||||
|
|
||||||
|
<Route path="Adv1" element={<Adv1 />} />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -156,4 +211,3 @@ const App = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,633 @@
|
|||||||
|
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}Ad6/Ad6`;
|
||||||
|
const REACT_APP_API_TOKEN = localStorage.getItem("authToken")
|
||||||
|
|
||||||
|
const EntityTable = () => {
|
||||||
|
const [data, setData] = useState([]);
|
||||||
|
const [filteredData, setFilteredData] = useState([]);
|
||||||
|
const [newEntity, setNewEntity] = useState({
|
||||||
|
name: "",
|
||||||
|
|
||||||
|
description: "",
|
||||||
|
|
||||||
|
checkout_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: "",
|
||||||
|
|
||||||
|
description: "",
|
||||||
|
|
||||||
|
checkout_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 handleCheckoutClick = () => {
|
||||||
|
setShowModal(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
setShowModal(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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.description.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
entity.checkout_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 (
|
||||||
|
<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="grey">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>name</th>
|
||||||
|
|
||||||
|
<th>description</th>
|
||||||
|
|
||||||
|
<th>checkout_field</th>
|
||||||
|
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody >
|
||||||
|
{currentItems.map((entity) => (
|
||||||
|
<tr key={entity.id}>
|
||||||
|
|
||||||
|
<td>{entity.name}</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>{entity.description}</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>{entity.checkout_field}</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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Container className="mt-5">
|
||||||
|
<h1>Checkout </h1>
|
||||||
|
<Button variant="primary" onClick={handleCheckoutClick}>
|
||||||
|
Checkout
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
{/* Modal for Payment Options */}
|
||||||
|
<Modal show={showModal} onHide={handleClose}>
|
||||||
|
<Modal.Header closeButton>
|
||||||
|
<Modal.Title>Select Payment Method</Modal.Title>
|
||||||
|
</Modal.Header>
|
||||||
|
<Modal.Body>
|
||||||
|
<Row>
|
||||||
|
<Col className="text-center">
|
||||||
|
{/* Razorpay Payment Option */}
|
||||||
|
<Image
|
||||||
|
src="https://d6xcmfyh68wv8.cloudfront.net/newsroom-content/uploads/2022/07/Razorpay_payments.png"
|
||||||
|
alt="Razorpay"
|
||||||
|
width={100}
|
||||||
|
onClick={() => alert('Razorpay Selected')}
|
||||||
|
className="payment-option"
|
||||||
|
style={{ cursor: 'pointer' }}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col className="text-center">
|
||||||
|
{/* Paytm Payment Option */}
|
||||||
|
<Image
|
||||||
|
src="https://img.icons8.com/fluent/200/paytm.png"
|
||||||
|
alt="Paytm"
|
||||||
|
width={100}
|
||||||
|
onClick={() => alert('Paytm Selected')}
|
||||||
|
className="payment-option"
|
||||||
|
style={{ cursor: 'pointer' }}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Modal.Body>
|
||||||
|
<Modal.Footer>
|
||||||
|
<Button variant="secondary" onClick={handleClose}>
|
||||||
|
Close
|
||||||
|
</Button>
|
||||||
|
</Modal.Footer>
|
||||||
|
</Modal>
|
||||||
|
</Container>
|
||||||
|
|
||||||
|
|
||||||
|
<Modal show={showEditModal} onHide={() => setShowEditModal(false)}>
|
||||||
|
<Modal.Header closeButton>
|
||||||
|
<Modal.Title>Edit Entity</Modal.Title>
|
||||||
|
</Modal.Header>
|
||||||
|
<Modal.Body>
|
||||||
|
{editEntity && (
|
||||||
|
<Form>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<label htmlFor="name" className="form-label">Name</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
value={editEntity.name}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label htmlFor="description" className="form-label">description</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="description"
|
||||||
|
name="description"
|
||||||
|
value={editEntity.description}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label htmlFor="checkout_field" className="form-label">Checkout Field</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="checkout_field"
|
||||||
|
name="checkout_field"
|
||||||
|
value={editEntity.checkout_field}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<label htmlFor="name" className="form-label">name</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
value={newEntity.name}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label htmlFor="description" className="form-label">description</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="description"
|
||||||
|
name="description"
|
||||||
|
value={newEntity.description}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label htmlFor="checkout_field" className="form-label">checkout_field</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="checkout_field"
|
||||||
|
name="checkout_field"
|
||||||
|
value={newEntity.checkout_field}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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;
|
||||||
@ -0,0 +1,532 @@
|
|||||||
|
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}Ad7/Ad7`;
|
||||||
|
const REACT_APP_API_TOKEN = localStorage.getItem("authToken")
|
||||||
|
|
||||||
|
const EntityTable = () => {
|
||||||
|
const [data, setData] = useState([]);
|
||||||
|
const [filteredData, setFilteredData] = useState([]);
|
||||||
|
const [newEntity, setNewEntity] = useState({
|
||||||
|
name: "",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
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: "",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
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 INSERT_API_URL = `${process.env.REACT_APP_API_URL}/Support/Support_insert`;
|
||||||
|
|
||||||
|
|
||||||
|
const [insertData, setInsertData] = useState({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
description: "",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
name: "",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
const [showInsertModal, setShowInsertModal] = useState(false);
|
||||||
|
const handleInsert = async () => {
|
||||||
|
try {
|
||||||
|
const token = getToken();
|
||||||
|
await axios.post(INSERT_API_URL, insertData, {
|
||||||
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
|
});
|
||||||
|
fetchData();
|
||||||
|
setInsertData({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
description: "",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
name: "",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
setShowInsertModal(false);
|
||||||
|
toast.success("Insert successful!");
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error inserting data:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const handleInsertChange = (e) => {
|
||||||
|
const { name, value } = e.target;
|
||||||
|
setInsertData({ ...insertData, [name]: 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.support.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>
|
||||||
|
|
||||||
|
|
||||||
|
<Button variant="secondary" onClick={() => setShowInsertModal(true)}>
|
||||||
|
Insert
|
||||||
|
</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="grey">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>name</th>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody >
|
||||||
|
{currentItems.map((entity) => (
|
||||||
|
<tr key={entity.id}>
|
||||||
|
|
||||||
|
<td>{entity.name}</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={showInsertModal} onHide={() => setShowInsertModal(false)}>
|
||||||
|
<Modal.Header closeButton>
|
||||||
|
<Modal.Title>Insert Data</Modal.Title>
|
||||||
|
</Modal.Header>
|
||||||
|
<Modal.Body>
|
||||||
|
<Form>
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Group>
|
||||||
|
<Form.Label> Description</Form.Label>
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
name="description"
|
||||||
|
value={insertData.description}
|
||||||
|
onChange={handleInsertChange}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Group>
|
||||||
|
<Form.Label> Name</Form.Label>
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
name="name"
|
||||||
|
value={insertData.name}
|
||||||
|
onChange={handleInsertChange}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
|
||||||
|
</Form>
|
||||||
|
</Modal.Body>
|
||||||
|
<Modal.Footer>
|
||||||
|
<Button variant="secondary" onClick={() => setShowInsertModal(false)}>
|
||||||
|
Close
|
||||||
|
</Button>
|
||||||
|
<Button variant="primary" onClick={handleInsert}>
|
||||||
|
Insert
|
||||||
|
</Button>
|
||||||
|
</Modal.Footer>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
|
||||||
|
<Modal show={showEditModal} onHide={() => setShowEditModal(false)}>
|
||||||
|
<Modal.Header closeButton>
|
||||||
|
<Modal.Title>Edit Entity</Modal.Title>
|
||||||
|
</Modal.Header>
|
||||||
|
<Modal.Body>
|
||||||
|
{editEntity && (
|
||||||
|
<Form>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<label htmlFor="name" className="form-label">Name</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
value={editEntity.name}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<label htmlFor="name" className="form-label">name</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
value={newEntity.name}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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;
|
||||||
@ -0,0 +1,728 @@
|
|||||||
|
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}Ad8/Ad8`;
|
||||||
|
const REACT_APP_API_TOKEN = localStorage.getItem("authToken")
|
||||||
|
|
||||||
|
const EntityTable = () => {
|
||||||
|
const [data, setData] = useState([]);
|
||||||
|
const [filteredData, setFilteredData] = useState([]);
|
||||||
|
const [newEntity, setNewEntity] = useState({
|
||||||
|
name: "",
|
||||||
|
|
||||||
|
support: [{
|
||||||
|
|
||||||
|
|
||||||
|
description: ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
name: ""
|
||||||
|
|
||||||
|
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
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: "",
|
||||||
|
|
||||||
|
support: [{
|
||||||
|
|
||||||
|
|
||||||
|
description: ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
name: ""
|
||||||
|
|
||||||
|
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
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 addNewField = () => {
|
||||||
|
setNewEntity((prev) => ({
|
||||||
|
...prev,
|
||||||
|
support: [...prev.support, {
|
||||||
|
|
||||||
|
|
||||||
|
description: ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
name: ""
|
||||||
|
|
||||||
|
|
||||||
|
}],
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const handlesChange = (e, index = null) => {
|
||||||
|
const { name, value } = e.target;
|
||||||
|
|
||||||
|
if (index !== null) {
|
||||||
|
const updated = [...newEntity.support];
|
||||||
|
updated[index] = { ...updated[index], [name]: value };
|
||||||
|
setNewEntity({ ...newEntity, support: updated });
|
||||||
|
} else {
|
||||||
|
setNewEntity({ ...newEntity, [name]: value });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// For handling changes in the edit entity form
|
||||||
|
const handlesEditChange = (e, index = null) => {
|
||||||
|
const { name, value } = e.target;
|
||||||
|
|
||||||
|
if (index !== null) {
|
||||||
|
const updated = [...editEntity.support];
|
||||||
|
updated[index] = { ...updated[index], [name]: value };
|
||||||
|
setEditEntity({ ...editEntity, support: updated });
|
||||||
|
} else {
|
||||||
|
setEditEntity({ ...editEntity, [name]: value });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const UPDATE_API_URL = `${API_URL}/Support_update`;
|
||||||
|
const [insertData, setInsertData] = useState({
|
||||||
|
|
||||||
|
|
||||||
|
description: "",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
name: "",
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
const [showInsertModal, setShowInsertModal] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (showInsertModal) {
|
||||||
|
setInsertData({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
description: editEntity ? editEntity.support.description : "",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
name: editEntity ? editEntity.support.name : "",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [showInsertModal, editEntity]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const handleOpenInsertModal = (entity) => {
|
||||||
|
setEditEntity(entity); // Set the entity we're editing
|
||||||
|
setInsertData({
|
||||||
|
|
||||||
|
|
||||||
|
description: entity.support?.description || ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
name: entity.support?.name || ""
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
setShowInsertModal(true); // Show the modal
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle the input change in the insert modal
|
||||||
|
const handleInsertChange = (e) => {
|
||||||
|
const { name, value } = e.target;
|
||||||
|
setInsertData((prev) => ({ ...prev, [name]: value }));
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle insert update and send to separate API
|
||||||
|
const handleInsertUpdate = async () => {
|
||||||
|
if (!editEntity) return;
|
||||||
|
try {
|
||||||
|
const token = getToken();
|
||||||
|
await axios.put(`${UPDATE_API_URL}/${editEntity.id}`, insertData, {
|
||||||
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
|
});
|
||||||
|
fetchData(); // Refresh the table data
|
||||||
|
setShowInsertModal(false); // Close modal
|
||||||
|
toast.success("Successfully updated!");
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error updating insert data:", error);
|
||||||
|
toast.error("Failed to update insert data!");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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.support.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
entity.support.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="grey">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>name</th>
|
||||||
|
|
||||||
|
<th>support</th>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody >
|
||||||
|
{currentItems.map((entity) => (
|
||||||
|
<tr key={entity.id}>
|
||||||
|
|
||||||
|
<td>{entity.name}</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>{entity.support.map(p => p.description).join(", ")}</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>{entity.support.map(p => p.name).join(", ")}</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<Button
|
||||||
|
variant="warning"
|
||||||
|
size="sm"
|
||||||
|
className="me-2"
|
||||||
|
onClick={() => handleEdit(entity)}
|
||||||
|
>
|
||||||
|
Update
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Button
|
||||||
|
variant="info"
|
||||||
|
onClick={() => handleOpenInsertModal(entity)}
|
||||||
|
>
|
||||||
|
Update Insert
|
||||||
|
</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={showInsertModal} onHide={() => setShowInsertModal(false)}>
|
||||||
|
<Modal.Header closeButton>
|
||||||
|
<Modal.Title>Update </Modal.Title>
|
||||||
|
</Modal.Header>
|
||||||
|
<Modal.Body>
|
||||||
|
<Form>
|
||||||
|
<Form.Group controlId="formupdate">
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Label>description</Form.Label>
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
name="description"
|
||||||
|
value={insertData.description}
|
||||||
|
onChange={handleInsertChange}
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Label>name</Form.Label>
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
name="name"
|
||||||
|
value={insertData.name}
|
||||||
|
onChange={handleInsertChange}
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
|
||||||
|
</Form>
|
||||||
|
</Modal.Body>
|
||||||
|
<Modal.Footer>
|
||||||
|
<Button variant="secondary" onClick={() => setShowInsertModal(false)}>
|
||||||
|
Close
|
||||||
|
</Button>
|
||||||
|
<Button variant="primary" onClick={handleInsertUpdate}>
|
||||||
|
Update Insert
|
||||||
|
</Button>
|
||||||
|
</Modal.Footer>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal show={showEditModal} onHide={() => setShowEditModal(false)}>
|
||||||
|
<Modal.Header closeButton>
|
||||||
|
<Modal.Title>Edit Entity</Modal.Title>
|
||||||
|
</Modal.Header>
|
||||||
|
<Modal.Body>
|
||||||
|
{editEntity && (
|
||||||
|
<Form>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<label htmlFor="name" className="form-label">Name</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
value={editEntity.name}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{editEntity.support.map((p, index) => (
|
||||||
|
<Form.Group className="mb-3" key={index}>
|
||||||
|
<Form.Label>support</Form.Label>
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
name="description"
|
||||||
|
value={p.description}
|
||||||
|
onChange={(e) => handlesEditChange(e, index)}
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
))}
|
||||||
|
<Button variant="secondary" onClick={addEditField}>
|
||||||
|
Add Another
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
name="name"
|
||||||
|
value={p.name}
|
||||||
|
onChange={(e) => handlesEditChange(e, index)}
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
))}
|
||||||
|
<Button variant="secondary" onClick={addEditField}>
|
||||||
|
Add Another
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<label htmlFor="name" className="form-label">name</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
value={newEntity.name}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{newEntity.support.map((p, index) => (
|
||||||
|
<Form.Group className="mb-3" key={index}>
|
||||||
|
<Form.Label>support</Form.Label>
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
name="description"
|
||||||
|
value={p.description}
|
||||||
|
onChange={(e) => handlesChange(e, index)}
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
))}
|
||||||
|
<Button variant="secondary" onClick={addNewField}>
|
||||||
|
Add Another
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
name="name"
|
||||||
|
value={p.name}
|
||||||
|
onChange={(e) => handlesChange(e, index)}
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
))}
|
||||||
|
<Button variant="secondary" onClick={addNewField}>
|
||||||
|
Add Another
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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;
|
||||||
@ -0,0 +1,591 @@
|
|||||||
|
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}Ad9/Ad9`;
|
||||||
|
const REACT_APP_API_TOKEN = localStorage.getItem("authToken")
|
||||||
|
|
||||||
|
const EntityTable = () => {
|
||||||
|
const [data, setData] = useState([]);
|
||||||
|
const [filteredData, setFilteredData] = useState([]);
|
||||||
|
const [newEntity, setNewEntity] = useState({
|
||||||
|
name: "",
|
||||||
|
|
||||||
|
approved_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: "",
|
||||||
|
|
||||||
|
approved_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 handleAddLine = () => {
|
||||||
|
setServerData([...serverData, {
|
||||||
|
formCode: '',
|
||||||
|
documentSeq: '',
|
||||||
|
approver: '',
|
||||||
|
comments: '',
|
||||||
|
actionedAt: ''
|
||||||
|
}]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleRemoveLine = (index) => {
|
||||||
|
setServerData(serverData.filter((_, i) => i !== index));
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleLineChange = (index, field, value) => {
|
||||||
|
const updatedData = serverData.map((item, i) =>
|
||||||
|
i === index ? { ...item, [field]: value } : item
|
||||||
|
);
|
||||||
|
setServerData(updatedData);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleLineSubmit = () => {
|
||||||
|
console.log('Submitted data:', serverData);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleLineCancel = () => {
|
||||||
|
console.log('Cancelled');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
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.approved_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 (
|
||||||
|
<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="grey">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>name</th>
|
||||||
|
|
||||||
|
<th>approved_field</th>
|
||||||
|
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody >
|
||||||
|
{currentItems.map((entity) => (
|
||||||
|
<tr key={entity.id}>
|
||||||
|
|
||||||
|
<td>{entity.name}</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>{entity.approved_field}</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>
|
||||||
|
|
||||||
|
|
||||||
|
<Container>
|
||||||
|
<div className="section">
|
||||||
|
<h6>Approval Hierarchy</h6>
|
||||||
|
</div>
|
||||||
|
<Table bordered>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>No</th>
|
||||||
|
<th>Form Code</th>
|
||||||
|
<th>Document Seq</th>
|
||||||
|
<th>Approver</th>
|
||||||
|
<th>Comments</th>
|
||||||
|
<th>Actioned At</th>
|
||||||
|
<th>Cancel</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{serverData.map((data, index) => (
|
||||||
|
<tr key={index}>
|
||||||
|
<td>{index + 1}</td>
|
||||||
|
<td>
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
value={data.formCode}
|
||||||
|
onChange={(e) => handleLineChange(index, 'formCode', e.target.value)}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
value={data.documentSeq}
|
||||||
|
onChange={(e) => handleLineChange(index, 'documentSeq', e.target.value)}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
value={data.approver}
|
||||||
|
onChange={(e) => handleLineChange(index, 'approver', e.target.value)}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
value={data.comments}
|
||||||
|
onChange={(e) => handleLineChange(index, 'comments', e.target.value)}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Form.Control
|
||||||
|
type="date"
|
||||||
|
value={data.actionedAt}
|
||||||
|
onChange={(e) => handleLineChange(index, 'actionedAt', e.target.value)}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Button variant="danger" onClick={() => handleRemoveLine(index)}>
|
||||||
|
<i className="bi bi-trash"></i>
|
||||||
|
</Button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</Table>
|
||||||
|
<Button variant="primary" onClick={handleAddLine} style={{ marginLeft: '20px' }}>
|
||||||
|
<i className="bi bi-plus"></i> Add
|
||||||
|
</Button>
|
||||||
|
<Row className="mt-3">
|
||||||
|
<Col className="text-end">
|
||||||
|
<Button variant="secondary" onClick={handleLineCancel}>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
<Button variant="primary" onClick={handleLineSubmit} style={{ marginLeft: '10px' }}>
|
||||||
|
Submit
|
||||||
|
</Button>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Container>
|
||||||
|
|
||||||
|
<Modal show={showEditModal} onHide={() => setShowEditModal(false)}>
|
||||||
|
<Modal.Header closeButton>
|
||||||
|
<Modal.Title>Edit Entity</Modal.Title>
|
||||||
|
</Modal.Header>
|
||||||
|
<Modal.Body>
|
||||||
|
{editEntity && (
|
||||||
|
<Form>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<label htmlFor="name" className="form-label">Name</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
value={editEntity.name}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label htmlFor="approved_field" className="form-label">Approved Field</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="approved_field"
|
||||||
|
name="approved_field"
|
||||||
|
value={editEntity.approved_field}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<label htmlFor="name" className="form-label">name</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
value={newEntity.name}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label htmlFor="approved_field" className="form-label">approved_field</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="approved_field"
|
||||||
|
name="approved_field"
|
||||||
|
value={newEntity.approved_field}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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;
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,868 @@
|
|||||||
|
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}Adv4/Adv4`;
|
||||||
|
const REACT_APP_API_TOKEN = localStorage.getItem("authToken")
|
||||||
|
|
||||||
|
const EntityTable = () => {
|
||||||
|
const [data, setData] = useState([]);
|
||||||
|
const [filteredData, setFilteredData] = useState([]);
|
||||||
|
const [newEntity, setNewEntity] = useState({
|
||||||
|
atoc: "",
|
||||||
|
atocname: "",
|
||||||
|
|
||||||
|
atc2: "",
|
||||||
|
atc2name: "",
|
||||||
|
|
||||||
|
atdy1: "",
|
||||||
|
|
||||||
|
atdy2: "",
|
||||||
|
|
||||||
|
support: {
|
||||||
|
|
||||||
|
|
||||||
|
description: "" ,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
name: "" ,
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
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 () => {
|
||||||
|
|
||||||
|
|
||||||
|
setNewEntity({
|
||||||
|
...newEntity,
|
||||||
|
atoc: 1,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setNewEntity({
|
||||||
|
...newEntity,
|
||||||
|
atc2: 1,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const isDuplicate = data.some(entity => entity.id !== newEntity.id&&
|
||||||
|
|
||||||
|
|
||||||
|
entity.support.description === newEntity.support.description);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
entity.support.name === newEntity.support.name);
|
||||||
|
|
||||||
|
|
||||||
|
if (isDuplicate) {
|
||||||
|
toast.error("Duplicate entry detected!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const token = getToken();
|
||||||
|
await axios.post(API_URL, newEntity, {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
|
});
|
||||||
|
fetchData();
|
||||||
|
setNewEntity({
|
||||||
|
atoc: "",
|
||||||
|
atocname: "",
|
||||||
|
|
||||||
|
atc2: "",
|
||||||
|
atc2name: "",
|
||||||
|
|
||||||
|
atdy1: "",
|
||||||
|
|
||||||
|
atdy2: "",
|
||||||
|
|
||||||
|
support: {
|
||||||
|
|
||||||
|
|
||||||
|
description: "" ,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
name: "" ,
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
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 fetch_name = async () => {
|
||||||
|
try {
|
||||||
|
const token = getToken();
|
||||||
|
const url = `${process.env.REACT_APP_API_URL}/Listtest_ListFilter1/Listtest_ListFilter1`;
|
||||||
|
const response = await axios.get(url, {
|
||||||
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
|
});
|
||||||
|
const data = response.data;
|
||||||
|
const countries = data.map((country) => ({
|
||||||
|
label: country.name,
|
||||||
|
value: country.id,
|
||||||
|
}));
|
||||||
|
setOptions(countries);
|
||||||
|
console.log(data);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error fetching namesan data:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
useEffect(() => {
|
||||||
|
fetch_name();
|
||||||
|
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const fetch_name = async () => {
|
||||||
|
try {
|
||||||
|
const token = getToken();
|
||||||
|
const url = `${process.env.REACT_APP_API_URL}/Listtest_ListFilter1/Listtest_ListFilter1`;
|
||||||
|
const response = await axios.get(url, {
|
||||||
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
|
});
|
||||||
|
const data = response.data;
|
||||||
|
const countries = data.map((country) => ({
|
||||||
|
label: country.name,
|
||||||
|
value: country.id,
|
||||||
|
}));
|
||||||
|
setOptions(countries);
|
||||||
|
console.log(data);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error fetching namesan data:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
useEffect(() => {
|
||||||
|
fetch_name();
|
||||||
|
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const Options = [
|
||||||
|
|
||||||
|
|
||||||
|
{ value: "name", label: "Name" },
|
||||||
|
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const Options = [
|
||||||
|
|
||||||
|
|
||||||
|
{ value: "name", label: "Name" },
|
||||||
|
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
const handlesChange = (e) => {
|
||||||
|
const { name, value } = e.target;
|
||||||
|
setNewEntity((prev) => ({
|
||||||
|
...prev,
|
||||||
|
[name]: value,
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
const handlesEditChange = (e) => {
|
||||||
|
const { name, value } = e.target;
|
||||||
|
setEditEntity((prev) => ({
|
||||||
|
...prev,
|
||||||
|
[name]: value,
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const handleUpdate = async () => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const isDuplicate = data.some(entity => entity.id !== editEntity.id&&
|
||||||
|
|
||||||
|
|
||||||
|
entity.support.description === editEntity.support.description);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
entity.support.name === editEntity.support.name);
|
||||||
|
|
||||||
|
|
||||||
|
if (isDuplicate) {
|
||||||
|
toast.error("Duplicate entry detected!");
|
||||||
|
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.atoc.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
entity.atc2.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
entity.atdy1.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
entity.atdy2.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
entity.support.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="grey">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>atoc</th>
|
||||||
|
|
||||||
|
<th>atc2</th>
|
||||||
|
|
||||||
|
<th>atdy1</th>
|
||||||
|
|
||||||
|
<th>atdy2</th>
|
||||||
|
|
||||||
|
<th>support</th>
|
||||||
|
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody >
|
||||||
|
{currentItems.map((entity) => (
|
||||||
|
<tr key={entity.id}>
|
||||||
|
|
||||||
|
<td>{entity.atocname}</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>{entity.atc2name}</td>
|
||||||
|
|
||||||
|
|
||||||
|
<td>{entity.atdy1}</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>{entity.atdy2}</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>{entity.support.description}</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>{entity.support.name}</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>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
<Form.Label>atoc</Form.Label>
|
||||||
|
<Select
|
||||||
|
options={options} // Options from the fetch
|
||||||
|
value={options.find(option => option.label === editEntity.atocname) || null}
|
||||||
|
onChange={(selectedOption) => {
|
||||||
|
if (selectedOption) {
|
||||||
|
setEditEntity({
|
||||||
|
...editEntity,
|
||||||
|
dynamicfldsname: selectedOption.label,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
isSearchable={false}
|
||||||
|
placeholder="Select an option"
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
<Form.Label>atc2</Form.Label>
|
||||||
|
<Select
|
||||||
|
options={options} // Options from the fetch
|
||||||
|
value={options.find(option => option.label === editEntity.atc2name) || null}
|
||||||
|
onChange={(selectedOption) => {
|
||||||
|
if (selectedOption) {
|
||||||
|
setEditEntity({
|
||||||
|
...editEntity,
|
||||||
|
dynamicfldsname: selectedOption.label,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
isSearchable={false}
|
||||||
|
placeholder="Select an option"
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
<Form.Label>atdy1</Form.Label>
|
||||||
|
<Select
|
||||||
|
isMulti
|
||||||
|
options={Options}
|
||||||
|
value={editEntity.atdy1
|
||||||
|
.split(",")
|
||||||
|
.filter(Boolean)
|
||||||
|
.map((val) => ({
|
||||||
|
value: val,
|
||||||
|
label: Options.find((opt) => opt.value === val)?.label || val,
|
||||||
|
}))}
|
||||||
|
onChange={(selectedOptions) => {
|
||||||
|
const selectedValues = selectedOptions.map((opt) => opt.value).join(",");
|
||||||
|
setEditEntity({ ...editEntity, atdy1: selectedValues });
|
||||||
|
}}
|
||||||
|
className="bg-secondary text-dark"
|
||||||
|
placeholder="Select or search..."
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
<Form.Label>atdy2</Form.Label>
|
||||||
|
<Select
|
||||||
|
isMulti
|
||||||
|
options={Options}
|
||||||
|
value={editEntity.atdy2
|
||||||
|
.split(",")
|
||||||
|
.filter(Boolean)
|
||||||
|
.map((val) => ({
|
||||||
|
value: val,
|
||||||
|
label: Options.find((opt) => opt.value === val)?.label || val,
|
||||||
|
}))}
|
||||||
|
onChange={(selectedOptions) => {
|
||||||
|
const selectedValues = selectedOptions.map((opt) => opt.value).join(",");
|
||||||
|
setEditEntity({ ...editEntity, atdy2: selectedValues });
|
||||||
|
}}
|
||||||
|
className="bg-secondary text-dark"
|
||||||
|
placeholder="Select or search..."
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
<Form.Label>description</Form.Label>
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
name="support.description"
|
||||||
|
value={editEntity.support?.description || ""}
|
||||||
|
onChange={(e) =>
|
||||||
|
setEditEntity((prev) => ({
|
||||||
|
...prev,
|
||||||
|
support: { ...prev.support, description: e.target.value },
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
<Form.Label>name</Form.Label>
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
name="support.name"
|
||||||
|
value={editEntity.support?.name || ""}
|
||||||
|
onChange={(e) =>
|
||||||
|
setEditEntity((prev) => ({
|
||||||
|
...prev,
|
||||||
|
support: { ...prev.support, name: e.target.value },
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
<Form.Label>atoc</Form.Label>
|
||||||
|
<Select
|
||||||
|
options={options} // Options from the fetch
|
||||||
|
value={options.find((option) => option.label === newEntity.atocname) || null}
|
||||||
|
onChange={(selectedOption) => {
|
||||||
|
if (selectedOption) {
|
||||||
|
setNewEntity({
|
||||||
|
...newEntity,
|
||||||
|
dynamicfldsname: selectedOption.label,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
isSearchable={false}
|
||||||
|
placeholder="Select an option"
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
<Form.Label>atc2</Form.Label>
|
||||||
|
<Select
|
||||||
|
options={options} // Options from the fetch
|
||||||
|
value={options.find((option) => option.label === newEntity.atc2name) || null}
|
||||||
|
onChange={(selectedOption) => {
|
||||||
|
if (selectedOption) {
|
||||||
|
setNewEntity({
|
||||||
|
...newEntity,
|
||||||
|
dynamicfldsname: selectedOption.label,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
isSearchable={false}
|
||||||
|
placeholder="Select an option"
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
<Form.Label>atdy1 </Form.Label>
|
||||||
|
<Select
|
||||||
|
isMulti
|
||||||
|
options={Options}
|
||||||
|
value={newEntity.atdy1
|
||||||
|
.split(",")
|
||||||
|
.filter(Boolean) // Filter out any empty strings
|
||||||
|
.map((val) => ({ value: val, label: Options.find((opt) => opt.value === val)?.label || val }))
|
||||||
|
}
|
||||||
|
onChange={(selectedOptions) => {
|
||||||
|
const selectedValues = selectedOptions.map((opt) => opt.value).join(",");
|
||||||
|
setNewEntity({ ...newEntity, atdy1: selectedValues });
|
||||||
|
}}
|
||||||
|
className="bg-secondary text-dark"
|
||||||
|
placeholder="Select or search..."
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
<Form.Label>atdy2 </Form.Label>
|
||||||
|
<Select
|
||||||
|
isMulti
|
||||||
|
options={Options}
|
||||||
|
value={newEntity.atdy2
|
||||||
|
.split(",")
|
||||||
|
.filter(Boolean) // Filter out any empty strings
|
||||||
|
.map((val) => ({ value: val, label: Options.find((opt) => opt.value === val)?.label || val }))
|
||||||
|
}
|
||||||
|
onChange={(selectedOptions) => {
|
||||||
|
const selectedValues = selectedOptions.map((opt) => opt.value).join(",");
|
||||||
|
setNewEntity({ ...newEntity, atdy2: selectedValues });
|
||||||
|
}}
|
||||||
|
className="bg-secondary text-dark"
|
||||||
|
placeholder="Select or search..."
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
|
||||||
|
<Form.Label>description</Form.Label>
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
name="description"
|
||||||
|
value={newEntity.support.description}
|
||||||
|
onChange={(e) =>
|
||||||
|
setNewEntity((prev) => ({
|
||||||
|
...prev,
|
||||||
|
support: { ...prev.support, description: e.target.value },
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
|
||||||
|
<Form.Label>name</Form.Label>
|
||||||
|
<Form.Control
|
||||||
|
type="text"
|
||||||
|
name="name"
|
||||||
|
value={newEntity.support.name}
|
||||||
|
onChange={(e) =>
|
||||||
|
setNewEntity((prev) => ({
|
||||||
|
...prev,
|
||||||
|
support: { ...prev.support, name: e.target.value },
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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;
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,483 @@
|
|||||||
|
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}Listtest/Listtest`;
|
||||||
|
const REACT_APP_API_TOKEN = localStorage.getItem("authToken")
|
||||||
|
|
||||||
|
const EntityTable = () => {
|
||||||
|
const [data, setData] = useState([]);
|
||||||
|
const [filteredData, setFilteredData] = useState([]);
|
||||||
|
const [newEntity, setNewEntity] = useState({
|
||||||
|
name: "",
|
||||||
|
|
||||||
|
description: "",
|
||||||
|
|
||||||
|
});
|
||||||
|
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: "",
|
||||||
|
|
||||||
|
description: "",
|
||||||
|
|
||||||
|
});
|
||||||
|
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.description.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="grey">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>name</th>
|
||||||
|
|
||||||
|
<th>description</th>
|
||||||
|
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody >
|
||||||
|
{currentItems.map((entity) => (
|
||||||
|
<tr key={entity.id}>
|
||||||
|
|
||||||
|
<td>{entity.name}</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>{entity.description}</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>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<label htmlFor="name" className="form-label">Name</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
value={editEntity.name}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
<Form.Label>Description</Form.Label>
|
||||||
|
<Form.Control
|
||||||
|
as="textarea"
|
||||||
|
name="description"
|
||||||
|
value={editEntity.description}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
rows={5}
|
||||||
|
placeholder="Enter description"
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<label htmlFor="name" className="form-label">name</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
value={newEntity.name}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label htmlFor="description">Description</label>
|
||||||
|
<textarea
|
||||||
|
className="form-control"
|
||||||
|
id="description"
|
||||||
|
name="description"
|
||||||
|
rows="3"
|
||||||
|
value={newEntity.description}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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;
|
||||||
@ -0,0 +1,483 @@
|
|||||||
|
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}Support/Support`;
|
||||||
|
const REACT_APP_API_TOKEN = localStorage.getItem("authToken")
|
||||||
|
|
||||||
|
const EntityTable = () => {
|
||||||
|
const [data, setData] = useState([]);
|
||||||
|
const [filteredData, setFilteredData] = useState([]);
|
||||||
|
const [newEntity, setNewEntity] = useState({
|
||||||
|
name: "",
|
||||||
|
|
||||||
|
description: "",
|
||||||
|
|
||||||
|
});
|
||||||
|
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: "",
|
||||||
|
|
||||||
|
description: "",
|
||||||
|
|
||||||
|
});
|
||||||
|
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.description.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="grey">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>name</th>
|
||||||
|
|
||||||
|
<th>description</th>
|
||||||
|
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody >
|
||||||
|
{currentItems.map((entity) => (
|
||||||
|
<tr key={entity.id}>
|
||||||
|
|
||||||
|
<td>{entity.name}</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>{entity.description}</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>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<label htmlFor="name" className="form-label">Name</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
value={editEntity.name}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
<Form.Label>Description</Form.Label>
|
||||||
|
<Form.Control
|
||||||
|
as="textarea"
|
||||||
|
name="description"
|
||||||
|
value={editEntity.description}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
rows={5}
|
||||||
|
placeholder="Enter description"
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<label htmlFor="name" className="form-label">name</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
value={newEntity.name}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label htmlFor="description">Description</label>
|
||||||
|
<textarea
|
||||||
|
className="form-control"
|
||||||
|
id="description"
|
||||||
|
name="description"
|
||||||
|
rows="3"
|
||||||
|
value={newEntity.description}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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;
|
||||||
@ -0,0 +1,641 @@
|
|||||||
|
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}Test/Test`;
|
||||||
|
const REACT_APP_API_TOKEN = localStorage.getItem("authToken")
|
||||||
|
|
||||||
|
const EntityTable = () => {
|
||||||
|
const [data, setData] = useState([]);
|
||||||
|
const [filteredData, setFilteredData] = useState([]);
|
||||||
|
const [newEntity, setNewEntity] = useState({
|
||||||
|
name: "",
|
||||||
|
|
||||||
|
description: "",
|
||||||
|
|
||||||
|
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: "",
|
||||||
|
|
||||||
|
description: "",
|
||||||
|
|
||||||
|
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.description.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 (
|
||||||
|
<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="grey">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>name</th>
|
||||||
|
|
||||||
|
<th>description</th>
|
||||||
|
|
||||||
|
<th>password_field</th>
|
||||||
|
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody >
|
||||||
|
{currentItems.map((entity) => (
|
||||||
|
<tr key={entity.id}>
|
||||||
|
|
||||||
|
<td>{entity.name}</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>{entity.description}</td>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<td>{entity.password_field}</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>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<label htmlFor="name" className="form-label">Name</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
value={editEntity.name}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Form.Group className="mb-3">
|
||||||
|
<Form.Label>Description</Form.Label>
|
||||||
|
<Form.Control
|
||||||
|
as="textarea"
|
||||||
|
name="description"
|
||||||
|
value={editEntity.description}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
rows={5}
|
||||||
|
placeholder="Enter description"
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Form.Group>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label htmlFor="password_field">Password Field</label>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
className="form-control"
|
||||||
|
id="password_field"
|
||||||
|
name="password_field"
|
||||||
|
value={editEntity.password_field}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label htmlFor="confirmpassword_field">Confirmpassword_field</label>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
className="form-control"
|
||||||
|
id="confirmpassword_field"
|
||||||
|
name="confirmpassword_field"
|
||||||
|
value={editEntity.confirmpassword_field}
|
||||||
|
onChange={handleEditChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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>
|
||||||
|
<div className="form-group">
|
||||||
|
<div className="container mt-4" style={{ width: '100%' }}>
|
||||||
|
<div className="card p-4 shadow-sm rounded">
|
||||||
|
<div className="row align-items-center">
|
||||||
|
<div className="col-md-3">
|
||||||
|
</div>
|
||||||
|
<label htmlFor="name" className="form-label">name</label>
|
||||||
|
|
||||||
|
<div className="col-md-9">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control"
|
||||||
|
id="name"
|
||||||
|
name="name"
|
||||||
|
value={newEntity.name}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label htmlFor="description">Description</label>
|
||||||
|
<textarea
|
||||||
|
className="form-control"
|
||||||
|
id="description"
|
||||||
|
name="description"
|
||||||
|
rows="3"
|
||||||
|
value={newEntity.description}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label htmlFor="password_field">Password Field</label>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
className="form-control"
|
||||||
|
id="password_field"
|
||||||
|
name="password_field"
|
||||||
|
value={newEntity.password_field}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-group">
|
||||||
|
<label htmlFor="confirmpassword_field">Confirmpassword_field</label>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
className="form-control"
|
||||||
|
id="confirmpassword_field"
|
||||||
|
name="confirmpassword_field"
|
||||||
|
value={newEntity.confirmpassword_field}
|
||||||
|
onChange={handleChange}
|
||||||
|
required
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f7f9fc',
|
||||||
|
border: '1px solid #ced4da',
|
||||||
|
borderRadius: '8px',
|
||||||
|
padding: '10px',
|
||||||
|
transition: 'border-color 0.3s ease, box-shadow 0.3s ease',
|
||||||
|
}}
|
||||||
|
onFocus={(e) => {
|
||||||
|
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';
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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;
|
||||||
@ -69,6 +69,39 @@ public class BuilderService {
|
|||||||
executeDump(true);
|
executeDump(true);
|
||||||
|
|
||||||
// ADD OTHER SERVICE
|
// ADD OTHER SERVICE
|
||||||
|
addCustomMenu( "Listtest","Listtest", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
addCustomMenu( "Test","Test", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
addCustomMenu( "Ad9","Ad9", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
addCustomMenu( "Ad8","Ad8", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
addCustomMenu( "Ad7","Ad7", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
addCustomMenu( "Ad6","Ad6", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
addCustomMenu( "Adv5","Adv5", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
addCustomMenu( "Adv4","Adv4", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
addCustomMenu( "Support","Support", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
addCustomMenu( "Adv3","Adv3", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
addCustomMenu( "Adv1","Adv1", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
System.out.println("dashboard and menu inserted...");
|
System.out.println("dashboard and menu inserted...");
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,99 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Ad6;
|
||||||
|
import com.realnet.angulardatatype.Services.Ad6Service ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/Ad6")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class Ad6Controller {
|
||||||
|
@Autowired
|
||||||
|
private Ad6Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Ad6")
|
||||||
|
public Ad6 Savedata(@RequestBody Ad6 data) {
|
||||||
|
Ad6 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Ad6/{id}")
|
||||||
|
public Ad6 update(@RequestBody Ad6 data,@PathVariable Integer id ) {
|
||||||
|
Ad6 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Ad6/getall/page")
|
||||||
|
public Page<Ad6> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Ad6> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad6")
|
||||||
|
public List<Ad6> getdetails() {
|
||||||
|
List<Ad6> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Ad6")
|
||||||
|
public List<Ad6> getallwioutsec() {
|
||||||
|
List<Ad6> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad6/{id}")
|
||||||
|
public Ad6 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Ad6 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Ad6/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,98 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Ad7;
|
||||||
|
import com.realnet.angulardatatype.Services.Ad7Service ;
|
||||||
|
|
||||||
|
|
||||||
|
import com.realnet.angulardatatype.Entity.Support;
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/Ad7")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class Ad7Controller {
|
||||||
|
@Autowired
|
||||||
|
private Ad7Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Ad7")
|
||||||
|
public Ad7 Savedata(@RequestBody Ad7 data) {
|
||||||
|
Ad7 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Ad7/{id}")
|
||||||
|
public Ad7 update(@RequestBody Ad7 data,@PathVariable Integer id ) {
|
||||||
|
Ad7 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Ad7/getall/page")
|
||||||
|
public Page<Ad7> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Ad7> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad7")
|
||||||
|
public List<Ad7> getdetails() {
|
||||||
|
List<Ad7> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Ad7")
|
||||||
|
public List<Ad7> getallwioutsec() {
|
||||||
|
List<Ad7> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad7/{id}")
|
||||||
|
public Ad7 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Ad7 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Ad7/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Ad7/Support_insert")
|
||||||
|
public Support insertSupport(@RequestBody Support data) {
|
||||||
|
Support insertaction = Service.insertSupport(data);
|
||||||
|
return insertaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,107 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Ad8;
|
||||||
|
import com.realnet.angulardatatype.Services.Ad8Service ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.realnet.angulardatatype.Entity.Support;
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/Ad8")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class Ad8Controller {
|
||||||
|
@Autowired
|
||||||
|
private Ad8Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Ad8")
|
||||||
|
public Ad8 Savedata(@RequestBody Ad8 data) {
|
||||||
|
Ad8 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Ad8/{id}")
|
||||||
|
public Ad8 update(@RequestBody Ad8 data,@PathVariable Integer id ) {
|
||||||
|
Ad8 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Ad8/getall/page")
|
||||||
|
public Page<Ad8> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Ad8> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad8")
|
||||||
|
public List<Ad8> getdetails() {
|
||||||
|
List<Ad8> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Ad8")
|
||||||
|
public List<Ad8> getallwioutsec() {
|
||||||
|
List<Ad8> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad8/{id}")
|
||||||
|
public Ad8 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Ad8 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Ad8/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping("/Ad8/Support_update/{id}")
|
||||||
|
public ResponseEntity<?> updateSupport(@PathVariable Integer id, @RequestBody Support data) {
|
||||||
|
ResponseEntity<?> update = Service.updateSupport(id, data);
|
||||||
|
System.out.println(update + " updateed");
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Ad9;
|
||||||
|
import com.realnet.angulardatatype.Services.Ad9Service ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/Ad9")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class Ad9Controller {
|
||||||
|
@Autowired
|
||||||
|
private Ad9Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Ad9")
|
||||||
|
public Ad9 Savedata(@RequestBody Ad9 data) {
|
||||||
|
Ad9 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Ad9/{id}")
|
||||||
|
public Ad9 update(@RequestBody Ad9 data,@PathVariable Integer id ) {
|
||||||
|
Ad9 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Ad9/getall/page")
|
||||||
|
public Page<Ad9> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Ad9> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad9")
|
||||||
|
public List<Ad9> getdetails() {
|
||||||
|
List<Ad9> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Ad9")
|
||||||
|
public List<Ad9> getallwioutsec() {
|
||||||
|
List<Ad9> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad9/{id}")
|
||||||
|
public Ad9 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Ad9 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Ad9/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,171 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Adv1;
|
||||||
|
import com.realnet.angulardatatype.Services.Adv1Service ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/Adv1")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class Adv1Controller {
|
||||||
|
@Autowired
|
||||||
|
private Adv1Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Adv1")
|
||||||
|
public Adv1 Savedata(@RequestBody Adv1 data) {
|
||||||
|
Adv1 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Adv1/{id}")
|
||||||
|
public Adv1 update(@RequestBody Adv1 data,@PathVariable Integer id ) {
|
||||||
|
Adv1 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Adv1/getall/page")
|
||||||
|
public Page<Adv1> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Adv1> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv1")
|
||||||
|
public List<Adv1> getdetails() {
|
||||||
|
List<Adv1> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Adv1")
|
||||||
|
public List<Adv1> getallwioutsec() {
|
||||||
|
List<Adv1> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv1/{id}")
|
||||||
|
public Adv1 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Adv1 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Adv1/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,163 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Adv3;
|
||||||
|
import com.realnet.angulardatatype.Services.Adv3Service ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/Adv3")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class Adv3Controller {
|
||||||
|
@Autowired
|
||||||
|
private Adv3Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Adv3")
|
||||||
|
public Adv3 Savedata(@RequestBody Adv3 data) {
|
||||||
|
Adv3 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Adv3/{id}")
|
||||||
|
public Adv3 update(@RequestBody Adv3 data,@PathVariable Integer id ) {
|
||||||
|
Adv3 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Adv3/getall/page")
|
||||||
|
public Page<Adv3> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Adv3> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv3")
|
||||||
|
public List<Adv3> getdetails() {
|
||||||
|
List<Adv3> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Adv3")
|
||||||
|
public List<Adv3> getallwioutsec() {
|
||||||
|
List<Adv3> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv3/{id}")
|
||||||
|
public Adv3 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Adv3 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Adv3/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,115 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Adv4;
|
||||||
|
import com.realnet.angulardatatype.Services.Adv4Service ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/Adv4")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class Adv4Controller {
|
||||||
|
@Autowired
|
||||||
|
private Adv4Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Adv4")
|
||||||
|
public Adv4 Savedata(@RequestBody Adv4 data) {
|
||||||
|
Adv4 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Adv4/{id}")
|
||||||
|
public Adv4 update(@RequestBody Adv4 data,@PathVariable Integer id ) {
|
||||||
|
Adv4 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Adv4/getall/page")
|
||||||
|
public Page<Adv4> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Adv4> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv4")
|
||||||
|
public List<Adv4> getdetails() {
|
||||||
|
List<Adv4> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Adv4")
|
||||||
|
public List<Adv4> getallwioutsec() {
|
||||||
|
List<Adv4> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv4/{id}")
|
||||||
|
public Adv4 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Adv4 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Adv4/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,139 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Adv5;
|
||||||
|
import com.realnet.angulardatatype.Services.Adv5Service ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/Adv5")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class Adv5Controller {
|
||||||
|
@Autowired
|
||||||
|
private Adv5Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Adv5")
|
||||||
|
public Adv5 Savedata(@RequestBody Adv5 data) {
|
||||||
|
Adv5 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Adv5/{id}")
|
||||||
|
public Adv5 update(@RequestBody Adv5 data,@PathVariable Integer id ) {
|
||||||
|
Adv5 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Adv5/getall/page")
|
||||||
|
public Page<Adv5> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Adv5> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv5")
|
||||||
|
public List<Adv5> getdetails() {
|
||||||
|
List<Adv5> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Adv5")
|
||||||
|
public List<Adv5> getallwioutsec() {
|
||||||
|
List<Adv5> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv5/{id}")
|
||||||
|
public Adv5 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Adv5 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Adv5/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Listtest;
|
||||||
|
import com.realnet.angulardatatype.Services.ListtestService ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/Listtest")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class ListtestController {
|
||||||
|
@Autowired
|
||||||
|
private ListtestService Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Listtest")
|
||||||
|
public Listtest Savedata(@RequestBody Listtest data) {
|
||||||
|
Listtest save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Listtest/{id}")
|
||||||
|
public Listtest update(@RequestBody Listtest data,@PathVariable Integer id ) {
|
||||||
|
Listtest update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Listtest/getall/page")
|
||||||
|
public Page<Listtest> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Listtest> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Listtest")
|
||||||
|
public List<Listtest> getdetails() {
|
||||||
|
List<Listtest> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Listtest")
|
||||||
|
public List<Listtest> getallwioutsec() {
|
||||||
|
List<Listtest> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Listtest/{id}")
|
||||||
|
public Listtest getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Listtest get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Listtest/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.realnet.angulardatatype.Controllers;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.realnet.angulardatatype.Entity.Listtest_ListFilter1;
|
||||||
|
import com.realnet.angulardatatype.Services.Listtest_ListFilter1Service ;
|
||||||
|
@RequestMapping(value = "/Listtest_ListFilter1")
|
||||||
|
@RestController
|
||||||
|
public class Listtest_ListFilter1Controller {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Listtest_ListFilter1Service Service;
|
||||||
|
|
||||||
|
@GetMapping("/Listtest_ListFilter1")
|
||||||
|
public List<Listtest_ListFilter1> getlist() {
|
||||||
|
List<Listtest_ListFilter1> get = Service.getlistbuilder();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Listtest_ListFilter11")
|
||||||
|
public List<Listtest_ListFilter1> getlistwithparam( ) {
|
||||||
|
List<Listtest_ListFilter1> get = Service.getlistbuilderparam( );
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Support;
|
||||||
|
import com.realnet.angulardatatype.Services.SupportService ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/Support")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class SupportController {
|
||||||
|
@Autowired
|
||||||
|
private SupportService Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Support")
|
||||||
|
public Support Savedata(@RequestBody Support data) {
|
||||||
|
Support save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Support/{id}")
|
||||||
|
public Support update(@RequestBody Support data,@PathVariable Integer id ) {
|
||||||
|
Support update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Support/getall/page")
|
||||||
|
public Page<Support> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Support> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Support")
|
||||||
|
public List<Support> getdetails() {
|
||||||
|
List<Support> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Support")
|
||||||
|
public List<Support> getallwioutsec() {
|
||||||
|
List<Support> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Support/{id}")
|
||||||
|
public Support getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Support get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Support/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.realnet.angulardatatype.Controllers;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.http.*;
|
||||||
|
import com.realnet.angulardatatype.Entity.Support;
|
||||||
|
import com.realnet.angulardatatype.Services.SupportInsertService1;
|
||||||
|
@RequestMapping(value = "/Support")
|
||||||
|
@RestController
|
||||||
|
public class SupportInsertController1{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SupportInsertService1 Service;
|
||||||
|
|
||||||
|
@PostMapping("/Support_insert")
|
||||||
|
public ResponseEntity<?> insert(@RequestBody Support support) {
|
||||||
|
Support insertaction = Service.insertaction(support);
|
||||||
|
return new ResponseEntity<>(insertaction, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package com.realnet.angulardatatype.Controllers;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.realnet.angulardatatype.Entity.Support;
|
||||||
|
import com.realnet.angulardatatype.Services.SupportUpdateService1 ;
|
||||||
|
@RequestMapping(value = "/Support")
|
||||||
|
@RestController
|
||||||
|
public class SupportUpdateController1{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SupportUpdateService1 Service;
|
||||||
|
|
||||||
|
@PutMapping("/Support_update/{id}")
|
||||||
|
public ResponseEntity<?> update(@PathVariable Integer id,@RequestBody Support support) {
|
||||||
|
ResponseEntity<?> update = Service.updateaction(id,support );
|
||||||
|
System.out.println(update+" updateed");
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Test;
|
||||||
|
import com.realnet.angulardatatype.Services.TestService ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/Test")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class TestController {
|
||||||
|
@Autowired
|
||||||
|
private TestService Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Test")
|
||||||
|
public Test Savedata(@RequestBody Test data) {
|
||||||
|
Test save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Test/{id}")
|
||||||
|
public Test update(@RequestBody Test data,@PathVariable Integer id ) {
|
||||||
|
Test update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Test/getall/page")
|
||||||
|
public Page<Test> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Test> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Test")
|
||||||
|
public List<Test> getdetails() {
|
||||||
|
List<Test> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Test")
|
||||||
|
public List<Test> getallwioutsec() {
|
||||||
|
List<Test> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Test/{id}")
|
||||||
|
public Test getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Test get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Test/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Ad6;
|
||||||
|
import com.realnet.angulardatatype.Services.Ad6Service ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/token/Ad6")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class tokenFree_Ad6Controller {
|
||||||
|
@Autowired
|
||||||
|
private Ad6Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Ad6")
|
||||||
|
public Ad6 Savedata(@RequestBody Ad6 data) {
|
||||||
|
Ad6 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Ad6/{id}")
|
||||||
|
public Ad6 update(@RequestBody Ad6 data,@PathVariable Integer id ) {
|
||||||
|
Ad6 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Ad6/getall/page")
|
||||||
|
public Page<Ad6> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Ad6> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad6")
|
||||||
|
public List<Ad6> getdetails() {
|
||||||
|
List<Ad6> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Ad6")
|
||||||
|
public List<Ad6> getallwioutsec() {
|
||||||
|
List<Ad6> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad6/{id}")
|
||||||
|
public Ad6 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Ad6 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Ad6/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,98 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Ad7;
|
||||||
|
import com.realnet.angulardatatype.Services.Ad7Service ;
|
||||||
|
|
||||||
|
|
||||||
|
import com.realnet.angulardatatype.Entity.Support;
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/token/Ad7")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class tokenFree_Ad7Controller {
|
||||||
|
@Autowired
|
||||||
|
private Ad7Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Ad7")
|
||||||
|
public Ad7 Savedata(@RequestBody Ad7 data) {
|
||||||
|
Ad7 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Ad7/{id}")
|
||||||
|
public Ad7 update(@RequestBody Ad7 data,@PathVariable Integer id ) {
|
||||||
|
Ad7 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Ad7/getall/page")
|
||||||
|
public Page<Ad7> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Ad7> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad7")
|
||||||
|
public List<Ad7> getdetails() {
|
||||||
|
List<Ad7> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Ad7")
|
||||||
|
public List<Ad7> getallwioutsec() {
|
||||||
|
List<Ad7> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad7/{id}")
|
||||||
|
public Ad7 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Ad7 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Ad7/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Ad7/Support_insert")
|
||||||
|
public Support insertSupport(@RequestBody Support data) {
|
||||||
|
Support insertaction = Service.insertSupport(data);
|
||||||
|
return insertaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,107 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Ad8;
|
||||||
|
import com.realnet.angulardatatype.Services.Ad8Service ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.realnet.angulardatatype.Entity.Support;
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/token/Ad8")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class tokenFree_Ad8Controller {
|
||||||
|
@Autowired
|
||||||
|
private Ad8Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Ad8")
|
||||||
|
public Ad8 Savedata(@RequestBody Ad8 data) {
|
||||||
|
Ad8 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Ad8/{id}")
|
||||||
|
public Ad8 update(@RequestBody Ad8 data,@PathVariable Integer id ) {
|
||||||
|
Ad8 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Ad8/getall/page")
|
||||||
|
public Page<Ad8> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Ad8> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad8")
|
||||||
|
public List<Ad8> getdetails() {
|
||||||
|
List<Ad8> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Ad8")
|
||||||
|
public List<Ad8> getallwioutsec() {
|
||||||
|
List<Ad8> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad8/{id}")
|
||||||
|
public Ad8 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Ad8 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Ad8/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping("/Ad8/Support_update/{id}")
|
||||||
|
public ResponseEntity<?> updateSupport(@PathVariable Integer id, @RequestBody Support data) {
|
||||||
|
ResponseEntity<?> update = Service.updateSupport(id, data);
|
||||||
|
System.out.println(update + " updateed");
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Ad9;
|
||||||
|
import com.realnet.angulardatatype.Services.Ad9Service ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/token/Ad9")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class tokenFree_Ad9Controller {
|
||||||
|
@Autowired
|
||||||
|
private Ad9Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Ad9")
|
||||||
|
public Ad9 Savedata(@RequestBody Ad9 data) {
|
||||||
|
Ad9 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Ad9/{id}")
|
||||||
|
public Ad9 update(@RequestBody Ad9 data,@PathVariable Integer id ) {
|
||||||
|
Ad9 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Ad9/getall/page")
|
||||||
|
public Page<Ad9> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Ad9> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad9")
|
||||||
|
public List<Ad9> getdetails() {
|
||||||
|
List<Ad9> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Ad9")
|
||||||
|
public List<Ad9> getallwioutsec() {
|
||||||
|
List<Ad9> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Ad9/{id}")
|
||||||
|
public Ad9 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Ad9 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Ad9/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,171 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Adv1;
|
||||||
|
import com.realnet.angulardatatype.Services.Adv1Service ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/token/Adv1")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class tokenFree_Adv1Controller {
|
||||||
|
@Autowired
|
||||||
|
private Adv1Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Adv1")
|
||||||
|
public Adv1 Savedata(@RequestBody Adv1 data) {
|
||||||
|
Adv1 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Adv1/{id}")
|
||||||
|
public Adv1 update(@RequestBody Adv1 data,@PathVariable Integer id ) {
|
||||||
|
Adv1 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Adv1/getall/page")
|
||||||
|
public Page<Adv1> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Adv1> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv1")
|
||||||
|
public List<Adv1> getdetails() {
|
||||||
|
List<Adv1> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Adv1")
|
||||||
|
public List<Adv1> getallwioutsec() {
|
||||||
|
List<Adv1> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv1/{id}")
|
||||||
|
public Adv1 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Adv1 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Adv1/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,163 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Adv3;
|
||||||
|
import com.realnet.angulardatatype.Services.Adv3Service ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/token/Adv3")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class tokenFree_Adv3Controller {
|
||||||
|
@Autowired
|
||||||
|
private Adv3Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Adv3")
|
||||||
|
public Adv3 Savedata(@RequestBody Adv3 data) {
|
||||||
|
Adv3 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Adv3/{id}")
|
||||||
|
public Adv3 update(@RequestBody Adv3 data,@PathVariable Integer id ) {
|
||||||
|
Adv3 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Adv3/getall/page")
|
||||||
|
public Page<Adv3> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Adv3> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv3")
|
||||||
|
public List<Adv3> getdetails() {
|
||||||
|
List<Adv3> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Adv3")
|
||||||
|
public List<Adv3> getallwioutsec() {
|
||||||
|
List<Adv3> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv3/{id}")
|
||||||
|
public Adv3 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Adv3 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Adv3/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,115 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Adv4;
|
||||||
|
import com.realnet.angulardatatype.Services.Adv4Service ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/token/Adv4")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class tokenFree_Adv4Controller {
|
||||||
|
@Autowired
|
||||||
|
private Adv4Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Adv4")
|
||||||
|
public Adv4 Savedata(@RequestBody Adv4 data) {
|
||||||
|
Adv4 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Adv4/{id}")
|
||||||
|
public Adv4 update(@RequestBody Adv4 data,@PathVariable Integer id ) {
|
||||||
|
Adv4 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Adv4/getall/page")
|
||||||
|
public Page<Adv4> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Adv4> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv4")
|
||||||
|
public List<Adv4> getdetails() {
|
||||||
|
List<Adv4> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Adv4")
|
||||||
|
public List<Adv4> getallwioutsec() {
|
||||||
|
List<Adv4> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv4/{id}")
|
||||||
|
public Adv4 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Adv4 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Adv4/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,139 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Adv5;
|
||||||
|
import com.realnet.angulardatatype.Services.Adv5Service ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/token/Adv5")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class tokenFree_Adv5Controller {
|
||||||
|
@Autowired
|
||||||
|
private Adv5Service Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Adv5")
|
||||||
|
public Adv5 Savedata(@RequestBody Adv5 data) {
|
||||||
|
Adv5 save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Adv5/{id}")
|
||||||
|
public Adv5 update(@RequestBody Adv5 data,@PathVariable Integer id ) {
|
||||||
|
Adv5 update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Adv5/getall/page")
|
||||||
|
public Page<Adv5> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Adv5> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv5")
|
||||||
|
public List<Adv5> getdetails() {
|
||||||
|
List<Adv5> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Adv5")
|
||||||
|
public List<Adv5> getallwioutsec() {
|
||||||
|
List<Adv5> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Adv5/{id}")
|
||||||
|
public Adv5 getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Adv5 get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Adv5/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Listtest;
|
||||||
|
import com.realnet.angulardatatype.Services.ListtestService ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/token/Listtest")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class tokenFree_ListtestController {
|
||||||
|
@Autowired
|
||||||
|
private ListtestService Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Listtest")
|
||||||
|
public Listtest Savedata(@RequestBody Listtest data) {
|
||||||
|
Listtest save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Listtest/{id}")
|
||||||
|
public Listtest update(@RequestBody Listtest data,@PathVariable Integer id ) {
|
||||||
|
Listtest update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Listtest/getall/page")
|
||||||
|
public Page<Listtest> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Listtest> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Listtest")
|
||||||
|
public List<Listtest> getdetails() {
|
||||||
|
List<Listtest> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Listtest")
|
||||||
|
public List<Listtest> getallwioutsec() {
|
||||||
|
List<Listtest> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Listtest/{id}")
|
||||||
|
public Listtest getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Listtest get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Listtest/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.realnet.angulardatatype.Controllers;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.realnet.angulardatatype.Entity.Listtest_ListFilter1;
|
||||||
|
import com.realnet.angulardatatype.Services.Listtest_ListFilter1Service ;
|
||||||
|
@RequestMapping(value = "/token/Listtest_ListFilter1")
|
||||||
|
@RestController
|
||||||
|
public class tokenFree_Listtest_ListFilter1Controller {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Listtest_ListFilter1Service Service;
|
||||||
|
|
||||||
|
@GetMapping("/Listtest_ListFilter1")
|
||||||
|
public List<Listtest_ListFilter1> getlist() {
|
||||||
|
List<Listtest_ListFilter1> get = Service.getlistbuilder();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Listtest_ListFilter11")
|
||||||
|
public List<Listtest_ListFilter1> getlistwithparam( ) {
|
||||||
|
List<Listtest_ListFilter1> get = Service.getlistbuilderparam( );
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,91 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Support;
|
||||||
|
import com.realnet.angulardatatype.Services.SupportService ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/token/Support")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class tokenFree_SupportController {
|
||||||
|
@Autowired
|
||||||
|
private SupportService Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Support")
|
||||||
|
public Support Savedata(@RequestBody Support data) {
|
||||||
|
Support save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Support/{id}")
|
||||||
|
public Support update(@RequestBody Support data,@PathVariable Integer id ) {
|
||||||
|
Support update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Support/getall/page")
|
||||||
|
public Page<Support> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Support> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Support")
|
||||||
|
public List<Support> getdetails() {
|
||||||
|
List<Support> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Support")
|
||||||
|
public List<Support> getallwioutsec() {
|
||||||
|
List<Support> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Support/{id}")
|
||||||
|
public Support getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Support get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Support/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Test;
|
||||||
|
import com.realnet.angulardatatype.Services.TestService ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "/token/Test")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RestController
|
||||||
|
public class tokenFree_TestController {
|
||||||
|
@Autowired
|
||||||
|
private TestService Service;
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/Test")
|
||||||
|
public Test Savedata(@RequestBody Test data) {
|
||||||
|
Test save = Service.Savedata(data) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
@PutMapping("/Test/{id}")
|
||||||
|
public Test update(@RequestBody Test data,@PathVariable Integer id ) {
|
||||||
|
Test update = Service.update(data,id);
|
||||||
|
System.out.println("data update..." + update);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
// get all with pagination
|
||||||
|
@GetMapping("/Test/getall/page")
|
||||||
|
public Page<Test> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
|
@RequestParam(value = "size", required = false) Integer size) {
|
||||||
|
Pageable paging = PageRequest.of(page, size);
|
||||||
|
Page<Test> get = Service.getAllWithPagination(paging);
|
||||||
|
|
||||||
|
return get;
|
||||||
|
|
||||||
|
}
|
||||||
|
@GetMapping("/Test")
|
||||||
|
public List<Test> getdetails() {
|
||||||
|
List<Test> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Test")
|
||||||
|
public List<Test> getallwioutsec() {
|
||||||
|
List<Test> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@GetMapping("/Test/{id}")
|
||||||
|
public Test getdetailsbyId(@PathVariable Integer id ) {
|
||||||
|
Test get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
@DeleteMapping("/Test/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.realnet.angulardatatype.Entity;
|
||||||
|
import lombok.*;
|
||||||
|
import com.realnet.WhoColumn.Entity.Extension;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
public class Ad6 extends Extension {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.realnet.angulardatatype.Entity;
|
||||||
|
import lombok.*;
|
||||||
|
import com.realnet.WhoColumn.Entity.Extension;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
public class Ad7 extends Extension {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.realnet.angulardatatype.Entity;
|
||||||
|
import lombok.*;
|
||||||
|
import com.realnet.WhoColumn.Entity.Extension;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
import com.realnet.angulardatatype.Entity.Support;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
public class Ad8 extends Extension {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@OneToMany( cascade=CascadeType.ALL)
|
||||||
|
private List<Support> support = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.realnet.angulardatatype.Entity;
|
||||||
|
import lombok.*;
|
||||||
|
import com.realnet.WhoColumn.Entity.Extension;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
public class Ad9 extends Extension {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String approved_field_status;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
package com.realnet.angulardatatype.Entity;
|
||||||
|
import lombok.*;
|
||||||
|
import com.realnet.WhoColumn.Entity.Extension;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
public class Adv1 extends Extension {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String ismale;
|
||||||
|
|
||||||
|
private String idfemale;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private boolean test1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private boolean t1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private String fileupload_fieldname;
|
||||||
|
private String fileupload_fieldpath ;
|
||||||
|
|
||||||
|
private String fileupload_field2name;
|
||||||
|
private String fileupload_field2path ;
|
||||||
|
|
||||||
|
private String imageupload_fieldname;
|
||||||
|
private String imageupload_fieldpath ;
|
||||||
|
|
||||||
|
private String imageupload_field2name;
|
||||||
|
private String imageupload_field2path ;
|
||||||
|
|
||||||
|
private String audio_fieldname;
|
||||||
|
private String audio_fieldpath ;
|
||||||
|
|
||||||
|
private String audio_field2name;
|
||||||
|
private String audio_field2path ;
|
||||||
|
|
||||||
|
private String video_fieldname;
|
||||||
|
private String video_fieldpath ;
|
||||||
|
|
||||||
|
private String video_field2name;
|
||||||
|
private String video_field2path ;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
package com.realnet.angulardatatype.Entity;
|
||||||
|
import lombok.*;
|
||||||
|
import com.realnet.WhoColumn.Entity.Extension;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
public class Adv3 extends Extension {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private String country;
|
||||||
|
|
||||||
|
private String state;
|
||||||
|
|
||||||
|
private String stmlit;
|
||||||
|
|
||||||
|
private String stmmlt2;
|
||||||
|
|
||||||
|
private String dy2;
|
||||||
|
private String dy2name;
|
||||||
|
|
||||||
|
private String dy1;
|
||||||
|
private String dy1name;
|
||||||
|
|
||||||
|
private String dymlti1;
|
||||||
|
|
||||||
|
private String dymlt2;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package com.realnet.angulardatatype.Entity;
|
||||||
|
import lombok.*;
|
||||||
|
import com.realnet.WhoColumn.Entity.Extension;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.realnet.angulardatatype.Entity.Support;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
public class Adv4 extends Extension {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String atoc;
|
||||||
|
private String atocname;
|
||||||
|
|
||||||
|
private String atc2;
|
||||||
|
private String atc2name;
|
||||||
|
|
||||||
|
private String atdy1;
|
||||||
|
|
||||||
|
private String atdy2;
|
||||||
|
|
||||||
|
@OneToOne( cascade=CascadeType.ALL)
|
||||||
|
private Support support;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
package com.realnet.angulardatatype.Entity;
|
||||||
|
import lombok.*;
|
||||||
|
import com.realnet.WhoColumn.Entity.Extension;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
import com.realnet.angulardatatype.Entity.Support;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
public class Adv5 extends Extension {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@OneToMany( cascade=CascadeType.ALL)
|
||||||
|
private List<Support> support = new ArrayList<>();
|
||||||
|
|
||||||
|
private int age;
|
||||||
|
|
||||||
|
private int age2;
|
||||||
|
|
||||||
|
private String addition;
|
||||||
|
|
||||||
|
private String subtration;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.realnet.angulardatatype.Entity;
|
||||||
|
import lombok.*;
|
||||||
|
import com.realnet.WhoColumn.Entity.Extension;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
public class Listtest extends Extension {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(length = 2000)
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.realnet.angulardatatype.Entity;
|
||||||
|
import lombok.*;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Listtest_ListFilter1 {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.realnet.angulardatatype.Entity;
|
||||||
|
import lombok.*;
|
||||||
|
import com.realnet.WhoColumn.Entity.Extension;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
public class Support extends Extension {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(length = 2000)
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package com.realnet.angulardatatype.Entity;
|
||||||
|
import lombok.*;
|
||||||
|
import com.realnet.WhoColumn.Entity.Extension;
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
public class Test extends Extension {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Column(length = 2000)
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private String password_field;
|
||||||
|
@Transient
|
||||||
|
private String confirmpassword_field;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Ad6;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface Ad6Repository extends JpaRepository<Ad6, Integer> {
|
||||||
|
|
||||||
|
@Query(value = "select * from ad6 where created_by=?1", nativeQuery = true)
|
||||||
|
List<Ad6> findAll(Long creayedBy);
|
||||||
|
|
||||||
|
@Query(value = "select * from ad6 where created_by=?1", nativeQuery = true)
|
||||||
|
Page<Ad6> findAll(Pageable page, Long creayedBy);
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Ad7;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface Ad7Repository extends JpaRepository<Ad7, Integer> {
|
||||||
|
|
||||||
|
@Query(value = "select * from ad7 where created_by=?1", nativeQuery = true)
|
||||||
|
List<Ad7> findAll(Long creayedBy);
|
||||||
|
|
||||||
|
@Query(value = "select * from ad7 where created_by=?1", nativeQuery = true)
|
||||||
|
Page<Ad7> findAll(Pageable page, Long creayedBy);
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Ad8;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface Ad8Repository extends JpaRepository<Ad8, Integer> {
|
||||||
|
|
||||||
|
@Query(value = "select * from ad8 where created_by=?1", nativeQuery = true)
|
||||||
|
List<Ad8> findAll(Long creayedBy);
|
||||||
|
|
||||||
|
@Query(value = "select * from ad8 where created_by=?1", nativeQuery = true)
|
||||||
|
Page<Ad8> findAll(Pageable page, Long creayedBy);
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Ad9;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface Ad9Repository extends JpaRepository<Ad9, Integer> {
|
||||||
|
|
||||||
|
@Query(value = "select * from ad9 where created_by=?1", nativeQuery = true)
|
||||||
|
List<Ad9> findAll(Long creayedBy);
|
||||||
|
|
||||||
|
@Query(value = "select * from ad9 where created_by=?1", nativeQuery = true)
|
||||||
|
Page<Ad9> findAll(Pageable page, Long creayedBy);
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Adv1;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface Adv1Repository extends JpaRepository<Adv1, Integer> {
|
||||||
|
|
||||||
|
@Query(value = "select * from adv1 where created_by=?1", nativeQuery = true)
|
||||||
|
List<Adv1> findAll(Long creayedBy);
|
||||||
|
|
||||||
|
@Query(value = "select * from adv1 where created_by=?1", nativeQuery = true)
|
||||||
|
Page<Adv1> findAll(Pageable page, Long creayedBy);
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Adv3;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface Adv3Repository extends JpaRepository<Adv3, Integer> {
|
||||||
|
|
||||||
|
@Query(value = "select * from adv3 where created_by=?1", nativeQuery = true)
|
||||||
|
List<Adv3> findAll(Long creayedBy);
|
||||||
|
|
||||||
|
@Query(value = "select * from adv3 where created_by=?1", nativeQuery = true)
|
||||||
|
Page<Adv3> findAll(Pageable page, Long creayedBy);
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Adv4;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface Adv4Repository extends JpaRepository<Adv4, Integer> {
|
||||||
|
|
||||||
|
@Query(value = "select * from adv4 where created_by=?1", nativeQuery = true)
|
||||||
|
List<Adv4> findAll(Long creayedBy);
|
||||||
|
|
||||||
|
@Query(value = "select * from adv4 where created_by=?1", nativeQuery = true)
|
||||||
|
Page<Adv4> findAll(Pageable page, Long creayedBy);
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Adv5;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface Adv5Repository extends JpaRepository<Adv5, Integer> {
|
||||||
|
|
||||||
|
@Query(value = "select * from adv5 where created_by=?1", nativeQuery = true)
|
||||||
|
List<Adv5> findAll(Long creayedBy);
|
||||||
|
|
||||||
|
@Query(value = "select * from adv5 where created_by=?1", nativeQuery = true)
|
||||||
|
Page<Adv5> findAll(Pageable page, Long creayedBy);
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Listtest;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface ListtestRepository extends JpaRepository<Listtest, Integer> {
|
||||||
|
|
||||||
|
@Query(value = "select * from listtest where created_by=?1", nativeQuery = true)
|
||||||
|
List<Listtest> findAll(Long creayedBy);
|
||||||
|
|
||||||
|
@Query(value = "select * from listtest where created_by=?1", nativeQuery = true)
|
||||||
|
Page<Listtest> findAll(Pageable page, Long creayedBy);
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Support;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface SupportRepository extends JpaRepository<Support, Integer> {
|
||||||
|
|
||||||
|
@Query(value = "select * from support where created_by=?1", nativeQuery = true)
|
||||||
|
List<Support> findAll(Long creayedBy);
|
||||||
|
|
||||||
|
@Query(value = "select * from support where created_by=?1", nativeQuery = true)
|
||||||
|
Page<Support> findAll(Pageable page, Long creayedBy);
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.realnet.angulardatatype.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.angulardatatype.Entity.Test;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface TestRepository extends JpaRepository<Test, Integer> {
|
||||||
|
|
||||||
|
@Query(value = "select * from test where created_by=?1", nativeQuery = true)
|
||||||
|
List<Test> findAll(Long creayedBy);
|
||||||
|
|
||||||
|
@Query(value = "select * from test where created_by=?1", nativeQuery = true)
|
||||||
|
Page<Test> findAll(Pageable page, Long creayedBy);
|
||||||
|
}
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
package com.realnet.angulardatatype.Services;
|
||||||
|
import com.realnet.angulardatatype.Repository.Ad6Repository;
|
||||||
|
import com.realnet.angulardatatype.Entity.Ad6
|
||||||
|
;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 Ad6Service {
|
||||||
|
@Autowired
|
||||||
|
private Ad6Repository Repository;
|
||||||
|
@Autowired
|
||||||
|
private AppUserServiceImpl userService;
|
||||||
|
@Autowired
|
||||||
|
private RealmService realmService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Ad6 Savedata(Ad6 data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
data.setCreatedBy(getUser().getUserId());
|
||||||
|
data.setAccountId(getUser().getAccount().getAccount_id());
|
||||||
|
Ad6 save = Repository.save(data);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// get all with pagination
|
||||||
|
public Page<Ad6> getAllWithPagination(Pageable page) {
|
||||||
|
return Repository.findAll(page, getUser().getUserId());
|
||||||
|
}
|
||||||
|
public List<Ad6> getdetails() {
|
||||||
|
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
|
||||||
|
List<Ad6> all = Repository.findAll(getUser().getUserId());
|
||||||
|
|
||||||
|
return all ; }
|
||||||
|
|
||||||
|
|
||||||
|
public Ad6 getdetailsbyId(Integer id) {
|
||||||
|
return Repository.findById(id).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void delete_by_id(Integer id) {
|
||||||
|
Repository.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Ad6 update(Ad6 data,Integer id) {
|
||||||
|
Ad6 old = Repository.findById(id).get();
|
||||||
|
old.setName(data.getName());
|
||||||
|
|
||||||
|
old.setDescription(data.getDescription());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
final Ad6 test = Repository.save(old);
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
return test;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public AppUser getUser() {
|
||||||
|
AppUser user = userService.getLoggedInUser();
|
||||||
|
return user;
|
||||||
|
|
||||||
|
}}
|
||||||
@ -0,0 +1,101 @@
|
|||||||
|
package com.realnet.angulardatatype.Services;
|
||||||
|
import com.realnet.angulardatatype.Repository.Ad7Repository;
|
||||||
|
import com.realnet.angulardatatype.Entity.Ad7
|
||||||
|
;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.angulardatatype.Entity.Support;
|
||||||
|
|
||||||
|
import com.realnet.angulardatatype.Repository.SupportRepository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class Ad7Service {
|
||||||
|
@Autowired
|
||||||
|
private Ad7Repository Repository;
|
||||||
|
@Autowired
|
||||||
|
private AppUserServiceImpl userService;
|
||||||
|
@Autowired
|
||||||
|
private RealmService realmService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Ad7 Savedata(Ad7 data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
data.setCreatedBy(getUser().getUserId());
|
||||||
|
data.setAccountId(getUser().getAccount().getAccount_id());
|
||||||
|
Ad7 save = Repository.save(data);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// get all with pagination
|
||||||
|
public Page<Ad7> getAllWithPagination(Pageable page) {
|
||||||
|
return Repository.findAll(page, getUser().getUserId());
|
||||||
|
}
|
||||||
|
public List<Ad7> getdetails() {
|
||||||
|
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
|
||||||
|
List<Ad7> all = Repository.findAll(getUser().getUserId());
|
||||||
|
|
||||||
|
return all ; }
|
||||||
|
|
||||||
|
|
||||||
|
public Ad7 getdetailsbyId(Integer id) {
|
||||||
|
return Repository.findById(id).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void delete_by_id(Integer id) {
|
||||||
|
Repository.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Ad7 update(Ad7 data,Integer id) {
|
||||||
|
Ad7 old = Repository.findById(id).get();
|
||||||
|
old.setName(data.getName());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
final Ad7 test = Repository.save(old);
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
return test;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Insert Action
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SupportRepository supportinsertrepository;
|
||||||
|
|
||||||
|
public Support insertSupport(Support data) {
|
||||||
|
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
data.setCreatedBy(getUser().getUserId());
|
||||||
|
data.setAccountId(getUser().getAccount().getAccount_id());
|
||||||
|
|
||||||
|
|
||||||
|
final Support save = supportinsertrepository.save(data);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppUser getUser() {
|
||||||
|
AppUser user = userService.getLoggedInUser();
|
||||||
|
return user;
|
||||||
|
|
||||||
|
}}
|
||||||
@ -0,0 +1,129 @@
|
|||||||
|
package com.realnet.angulardatatype.Services;
|
||||||
|
import com.realnet.angulardatatype.Repository.Ad8Repository;
|
||||||
|
import com.realnet.angulardatatype.Entity.Ad8
|
||||||
|
;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.angulardatatype.Entity.Support;
|
||||||
|
|
||||||
|
import com.realnet.angulardatatype.Repository.SupportRepository;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class Ad8Service {
|
||||||
|
@Autowired
|
||||||
|
private Ad8Repository Repository;
|
||||||
|
@Autowired
|
||||||
|
private AppUserServiceImpl userService;
|
||||||
|
@Autowired
|
||||||
|
private RealmService realmService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Ad8 Savedata(Ad8 data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
data.setCreatedBy(getUser().getUserId());
|
||||||
|
data.setAccountId(getUser().getAccount().getAccount_id());
|
||||||
|
Ad8 save = Repository.save(data);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// get all with pagination
|
||||||
|
public Page<Ad8> getAllWithPagination(Pageable page) {
|
||||||
|
return Repository.findAll(page, getUser().getUserId());
|
||||||
|
}
|
||||||
|
public List<Ad8> getdetails() {
|
||||||
|
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
|
||||||
|
List<Ad8> all = Repository.findAll(getUser().getUserId());
|
||||||
|
|
||||||
|
return all ; }
|
||||||
|
|
||||||
|
|
||||||
|
public Ad8 getdetailsbyId(Integer id) {
|
||||||
|
return Repository.findById(id).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void delete_by_id(Integer id) {
|
||||||
|
Repository.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Ad8 update(Ad8 data,Integer id) {
|
||||||
|
Ad8 old = Repository.findById(id).get();
|
||||||
|
old.setName(data.getName());
|
||||||
|
|
||||||
|
old.setSupport(data.getSupport());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
final Ad8 test = Repository.save(old);
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
return test;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// update Action
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SupportRepository supportupdaterepository;
|
||||||
|
|
||||||
|
|
||||||
|
public ResponseEntity<?> updateSupport(Integer id, Support data) {
|
||||||
|
Integer i = 0;
|
||||||
|
Ad8 s = Repository.findById(id).get();
|
||||||
|
|
||||||
|
List<Support> list = new ArrayList<>();
|
||||||
|
|
||||||
|
Object supportObject = s.getSupport();
|
||||||
|
|
||||||
|
if (supportObject instanceof List<?>) {
|
||||||
|
// If it's a list, cast and add all elements to the list
|
||||||
|
list.addAll((List<Support>) supportObject);
|
||||||
|
} else if (supportObject instanceof Support) {
|
||||||
|
// If it's a single Support object, add it to the list
|
||||||
|
list.add((Support) supportObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (Support li : list) {
|
||||||
|
Support old = supportupdaterepository.findById(li.getId()).get();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
final Support supportdata = supportupdaterepository.save(old);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(i + " updated", HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppUser getUser() {
|
||||||
|
AppUser user = userService.getLoggedInUser();
|
||||||
|
return user;
|
||||||
|
|
||||||
|
}}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
package com.realnet.angulardatatype.Services;
|
||||||
|
import com.realnet.angulardatatype.Repository.Ad9Repository;
|
||||||
|
import com.realnet.angulardatatype.Entity.Ad9
|
||||||
|
;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 Ad9Service {
|
||||||
|
@Autowired
|
||||||
|
private Ad9Repository Repository;
|
||||||
|
@Autowired
|
||||||
|
private AppUserServiceImpl userService;
|
||||||
|
@Autowired
|
||||||
|
private RealmService realmService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Ad9 Savedata(Ad9 data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
data.setCreatedBy(getUser().getUserId());
|
||||||
|
data.setAccountId(getUser().getAccount().getAccount_id());
|
||||||
|
Ad9 save = Repository.save(data);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// get all with pagination
|
||||||
|
public Page<Ad9> getAllWithPagination(Pageable page) {
|
||||||
|
return Repository.findAll(page, getUser().getUserId());
|
||||||
|
}
|
||||||
|
public List<Ad9> getdetails() {
|
||||||
|
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
|
||||||
|
List<Ad9> all = Repository.findAll(getUser().getUserId());
|
||||||
|
|
||||||
|
return all ; }
|
||||||
|
|
||||||
|
|
||||||
|
public Ad9 getdetailsbyId(Integer id) {
|
||||||
|
return Repository.findById(id).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void delete_by_id(Integer id) {
|
||||||
|
Repository.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Ad9 update(Ad9 data,Integer id) {
|
||||||
|
Ad9 old = Repository.findById(id).get();
|
||||||
|
old.setName(data.getName());
|
||||||
|
|
||||||
|
old.setApproved_field_status(data.getApproved_field_status());
|
||||||
|
|
||||||
|
final Ad9 test = Repository.save(old);
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
return test;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public AppUser getUser() {
|
||||||
|
AppUser user = userService.getLoggedInUser();
|
||||||
|
return user;
|
||||||
|
|
||||||
|
}}
|
||||||
@ -0,0 +1,195 @@
|
|||||||
|
package com.realnet.angulardatatype.Services;
|
||||||
|
import com.realnet.angulardatatype.Repository.Adv1Repository;
|
||||||
|
import com.realnet.angulardatatype.Entity.Adv1
|
||||||
|
;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 Adv1Service {
|
||||||
|
@Autowired
|
||||||
|
private Adv1Repository Repository;
|
||||||
|
@Autowired
|
||||||
|
private AppUserServiceImpl userService;
|
||||||
|
@Autowired
|
||||||
|
private RealmService realmService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Adv1 Savedata(Adv1 data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
data.setCreatedBy(getUser().getUserId());
|
||||||
|
data.setAccountId(getUser().getAccount().getAccount_id());
|
||||||
|
Adv1 save = Repository.save(data);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// get all with pagination
|
||||||
|
public Page<Adv1> getAllWithPagination(Pageable page) {
|
||||||
|
return Repository.findAll(page, getUser().getUserId());
|
||||||
|
}
|
||||||
|
public List<Adv1> getdetails() {
|
||||||
|
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
|
||||||
|
List<Adv1> all = Repository.findAll(getUser().getUserId());
|
||||||
|
|
||||||
|
return all ; }
|
||||||
|
|
||||||
|
|
||||||
|
public Adv1 getdetailsbyId(Integer id) {
|
||||||
|
return Repository.findById(id).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void delete_by_id(Integer id) {
|
||||||
|
Repository.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Adv1 update(Adv1 data,Integer id) {
|
||||||
|
Adv1 old = Repository.findById(id).get();
|
||||||
|
old.setIsmale(data.getIsmale());
|
||||||
|
|
||||||
|
old.setIdfemale(data.getIdfemale());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
old.setTest1(data.isTest1());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
old.setT1(data.isT1());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
final Adv1 test = Repository.save(old);
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
return test;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public AppUser getUser() {
|
||||||
|
AppUser user = userService.getLoggedInUser();
|
||||||
|
return user;
|
||||||
|
|
||||||
|
}}
|
||||||
@ -0,0 +1,234 @@
|
|||||||
|
package com.realnet.angulardatatype.Services;
|
||||||
|
import com.realnet.angulardatatype.Repository.Adv3Repository;
|
||||||
|
import com.realnet.angulardatatype.Entity.Adv3
|
||||||
|
;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.config.EmailService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.realnet.angulardatatype.Entity.Listtest;
|
||||||
|
import com.realnet.angulardatatype.Services.ListtestService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.realnet.angulardatatype.Entity.Listtest;
|
||||||
|
import com.realnet.angulardatatype.Services.ListtestService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class Adv3Service {
|
||||||
|
@Autowired
|
||||||
|
private Adv3Repository Repository;
|
||||||
|
@Autowired
|
||||||
|
private AppUserServiceImpl userService;
|
||||||
|
@Autowired
|
||||||
|
private RealmService realmService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmailService emailServicedynamic;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ListtestService dy2serv;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ListtestService dy1serv;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Adv3 Savedata(Adv3 data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
// emailServicedynamic.sendEmail( "gaurav_dekatc_com","Adv3", "testing");
|
||||||
|
emailServicedynamic.sendEmailViaSetu( "gaurav_dekatc_com","testing","lista","ganesh");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
System.out.println("Got error During Mail Send " + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (data.getDy2() != null) {
|
||||||
|
try {
|
||||||
|
int dy2Id = Integer.valueOf(data.getDy2());
|
||||||
|
Listtest get = dy2serv.getdetailsbyId(dy2Id);
|
||||||
|
if (get != null) {
|
||||||
|
|
||||||
|
data.setDy2name(get.getName());
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
System.out.println(" dy2Id is not integer..");
|
||||||
|
// Invalid integer string — ignore or log
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (data.getDy1() != null) {
|
||||||
|
try {
|
||||||
|
int dy1Id = Integer.valueOf(data.getDy1());
|
||||||
|
Listtest get = dy1serv.getdetailsbyId(dy1Id);
|
||||||
|
if (get != null) {
|
||||||
|
|
||||||
|
data.setDy1name(get.getName());
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
System.out.println(" dy1Id is not integer..");
|
||||||
|
// Invalid integer string — ignore or log
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
data.setCreatedBy(getUser().getUserId());
|
||||||
|
data.setAccountId(getUser().getAccount().getAccount_id());
|
||||||
|
Adv3 save = Repository.save(data);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// get all with pagination
|
||||||
|
public Page<Adv3> getAllWithPagination(Pageable page) {
|
||||||
|
return Repository.findAll(page, getUser().getUserId());
|
||||||
|
}
|
||||||
|
public List<Adv3> getdetails() {
|
||||||
|
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
|
||||||
|
List<Adv3> all = Repository.findAll(getUser().getUserId());
|
||||||
|
|
||||||
|
return all ; }
|
||||||
|
|
||||||
|
|
||||||
|
public Adv3 getdetailsbyId(Integer id) {
|
||||||
|
return Repository.findById(id).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void delete_by_id(Integer id) {
|
||||||
|
Repository.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Adv3 update(Adv3 data,Integer id) {
|
||||||
|
Adv3 old = Repository.findById(id).get();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
old.setCountry(data.getCountry());
|
||||||
|
|
||||||
|
old.setState(data.getState());
|
||||||
|
|
||||||
|
old.setStmlit(data.getStmlit());
|
||||||
|
|
||||||
|
old.setStmmlt2(data.getStmmlt2());
|
||||||
|
|
||||||
|
old.setDy2(data.getDy2());
|
||||||
|
|
||||||
|
old.setDy1(data.getDy1());
|
||||||
|
|
||||||
|
old.setDymlti1(data.getDymlti1());
|
||||||
|
|
||||||
|
old.setDymlt2(data.getDymlt2());
|
||||||
|
|
||||||
|
final Adv3 test = Repository.save(old);
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
return test;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public AppUser getUser() {
|
||||||
|
AppUser user = userService.getLoggedInUser();
|
||||||
|
return user;
|
||||||
|
|
||||||
|
}}
|
||||||
@ -0,0 +1,157 @@
|
|||||||
|
package com.realnet.angulardatatype.Services;
|
||||||
|
import com.realnet.angulardatatype.Repository.Adv4Repository;
|
||||||
|
import com.realnet.angulardatatype.Entity.Adv4
|
||||||
|
;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.angulardatatype.Entity.Listtest;
|
||||||
|
import com.realnet.angulardatatype.Services.ListtestService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.realnet.angulardatatype.Entity.Listtest;
|
||||||
|
import com.realnet.angulardatatype.Services.ListtestService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class Adv4Service {
|
||||||
|
@Autowired
|
||||||
|
private Adv4Repository Repository;
|
||||||
|
@Autowired
|
||||||
|
private AppUserServiceImpl userService;
|
||||||
|
@Autowired
|
||||||
|
private RealmService realmService;@Autowired
|
||||||
|
private ListtestService atocserv;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ListtestService atc2serv;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Adv4 Savedata(Adv4 data) {
|
||||||
|
|
||||||
|
|
||||||
|
if (data.getAtoc() != null) {
|
||||||
|
try {
|
||||||
|
int atocId = Integer.valueOf(data.getAtoc());
|
||||||
|
Listtest get = atocserv.getdetailsbyId(atocId);
|
||||||
|
if (get != null) {
|
||||||
|
|
||||||
|
data.setAtocname(get.getName());
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
System.out.println(" atocId is not integer..");
|
||||||
|
// Invalid integer string — ignore or log
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (data.getAtc2() != null) {
|
||||||
|
try {
|
||||||
|
int atc2Id = Integer.valueOf(data.getAtc2());
|
||||||
|
Listtest get = atc2serv.getdetailsbyId(atc2Id);
|
||||||
|
if (get != null) {
|
||||||
|
|
||||||
|
data.setAtc2name(get.getName());
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
System.out.println(" atc2Id is not integer..");
|
||||||
|
// Invalid integer string — ignore or log
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
data.setCreatedBy(getUser().getUserId());
|
||||||
|
data.setAccountId(getUser().getAccount().getAccount_id());
|
||||||
|
Adv4 save = Repository.save(data);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// get all with pagination
|
||||||
|
public Page<Adv4> getAllWithPagination(Pageable page) {
|
||||||
|
return Repository.findAll(page, getUser().getUserId());
|
||||||
|
}
|
||||||
|
public List<Adv4> getdetails() {
|
||||||
|
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
|
||||||
|
List<Adv4> all = Repository.findAll(getUser().getUserId());
|
||||||
|
|
||||||
|
return all ; }
|
||||||
|
|
||||||
|
|
||||||
|
public Adv4 getdetailsbyId(Integer id) {
|
||||||
|
return Repository.findById(id).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void delete_by_id(Integer id) {
|
||||||
|
Repository.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Adv4 update(Adv4 data,Integer id) {
|
||||||
|
Adv4 old = Repository.findById(id).get();
|
||||||
|
old.setAtoc(data.getAtoc());
|
||||||
|
|
||||||
|
old.setAtc2(data.getAtc2());
|
||||||
|
|
||||||
|
old.setAtdy1(data.getAtdy1());
|
||||||
|
|
||||||
|
old.setAtdy2(data.getAtdy2());
|
||||||
|
|
||||||
|
old.setSupport(data.getSupport());
|
||||||
|
|
||||||
|
final Adv4 test = Repository.save(old);
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
return test;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public AppUser getUser() {
|
||||||
|
AppUser user = userService.getLoggedInUser();
|
||||||
|
return user;
|
||||||
|
|
||||||
|
}}
|
||||||
@ -0,0 +1,143 @@
|
|||||||
|
package com.realnet.angulardatatype.Services;
|
||||||
|
import com.realnet.angulardatatype.Repository.Adv5Repository;
|
||||||
|
import com.realnet.angulardatatype.Entity.Adv5
|
||||||
|
;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 Adv5Service {
|
||||||
|
@Autowired
|
||||||
|
private Adv5Repository Repository;
|
||||||
|
@Autowired
|
||||||
|
private AppUserServiceImpl userService;
|
||||||
|
@Autowired
|
||||||
|
private RealmService realmService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Adv5 Savedata(Adv5 data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
data.setCreatedBy(getUser().getUserId());
|
||||||
|
data.setAccountId(getUser().getAccount().getAccount_id());
|
||||||
|
Adv5 save = Repository.save(data);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// get all with pagination
|
||||||
|
public Page<Adv5> getAllWithPagination(Pageable page) {
|
||||||
|
return Repository.findAll(page, getUser().getUserId());
|
||||||
|
}
|
||||||
|
public List<Adv5> getdetails() {
|
||||||
|
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
|
||||||
|
List<Adv5> all = Repository.findAll(getUser().getUserId());
|
||||||
|
|
||||||
|
return all ; }
|
||||||
|
|
||||||
|
|
||||||
|
public Adv5 getdetailsbyId(Integer id) {
|
||||||
|
return Repository.findById(id).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void delete_by_id(Integer id) {
|
||||||
|
Repository.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Adv5 update(Adv5 data,Integer id) {
|
||||||
|
Adv5 old = Repository.findById(id).get();
|
||||||
|
old.setName(data.getName());
|
||||||
|
|
||||||
|
old.setSupport(data.getSupport());
|
||||||
|
|
||||||
|
old.setAge(data.getAge());
|
||||||
|
|
||||||
|
old.setAge2(data.getAge2());
|
||||||
|
|
||||||
|
old.setAddition(data.getAddition());
|
||||||
|
|
||||||
|
old.setSubtration(data.getSubtration());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
final Adv5 test = Repository.save(old);
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
return test;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public AppUser getUser() {
|
||||||
|
AppUser user = userService.getLoggedInUser();
|
||||||
|
return user;
|
||||||
|
|
||||||
|
}}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
package com.realnet.angulardatatype.Services;
|
||||||
|
import com.realnet.angulardatatype.Repository.ListtestRepository;
|
||||||
|
import com.realnet.angulardatatype.Entity.Listtest
|
||||||
|
;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 ListtestService {
|
||||||
|
@Autowired
|
||||||
|
private ListtestRepository Repository;
|
||||||
|
@Autowired
|
||||||
|
private AppUserServiceImpl userService;
|
||||||
|
@Autowired
|
||||||
|
private RealmService realmService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Listtest Savedata(Listtest data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
data.setCreatedBy(getUser().getUserId());
|
||||||
|
data.setAccountId(getUser().getAccount().getAccount_id());
|
||||||
|
Listtest save = Repository.save(data);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// get all with pagination
|
||||||
|
public Page<Listtest> getAllWithPagination(Pageable page) {
|
||||||
|
return Repository.findAll(page, getUser().getUserId());
|
||||||
|
}
|
||||||
|
public List<Listtest> getdetails() {
|
||||||
|
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
|
||||||
|
List<Listtest> all = Repository.findAll(getUser().getUserId());
|
||||||
|
|
||||||
|
return all ; }
|
||||||
|
|
||||||
|
|
||||||
|
public Listtest getdetailsbyId(Integer id) {
|
||||||
|
return Repository.findById(id).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void delete_by_id(Integer id) {
|
||||||
|
Repository.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Listtest update(Listtest data,Integer id) {
|
||||||
|
Listtest old = Repository.findById(id).get();
|
||||||
|
old.setName(data.getName());
|
||||||
|
|
||||||
|
old.setDescription(data.getDescription());
|
||||||
|
|
||||||
|
final Listtest test = Repository.save(old);
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
return test;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public AppUser getUser() {
|
||||||
|
AppUser user = userService.getLoggedInUser();
|
||||||
|
return user;
|
||||||
|
|
||||||
|
}}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package com.realnet.angulardatatype.Services;
|
||||||
|
import java.util.*;
|
||||||
|
import com.realnet.angulardatatype.Repository.ListtestRepository;
|
||||||
|
import com.realnet.angulardatatype.Entity.Listtest;
|
||||||
|
|
||||||
|
import com.realnet.angulardatatype.Entity.Listtest_ListFilter1;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class Listtest_ListFilter1Service {
|
||||||
|
@Autowired
|
||||||
|
private ListtestRepository Repository;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public List<Listtest_ListFilter1> getlistbuilder() {
|
||||||
|
List<Listtest> list= Repository.findAll();
|
||||||
|
ArrayList<Listtest_ListFilter1> l = new ArrayList<>();
|
||||||
|
for (Listtest data : list) {
|
||||||
|
{
|
||||||
|
Listtest_ListFilter1 dummy = new Listtest_ListFilter1();
|
||||||
|
dummy.setId(data.getId());
|
||||||
|
dummy.setName(data.getName());
|
||||||
|
l.add(dummy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return l;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public List<Listtest_ListFilter1> getlistbuilderparam( ) {
|
||||||
|
List<Listtest> list= Repository.findAll();
|
||||||
|
ArrayList<Listtest_ListFilter1> l = new ArrayList<>();
|
||||||
|
for (Listtest data : list) {
|
||||||
|
{
|
||||||
|
Listtest_ListFilter1 dummy = new Listtest_ListFilter1();
|
||||||
|
dummy.setId(data.getId());
|
||||||
|
dummy.setName(data.getName());
|
||||||
|
l.add(dummy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return l;}
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.realnet.angulardatatype.Services;
|
||||||
|
import com.realnet.angulardatatype.Repository.SupportRepository;
|
||||||
|
import com.realnet.angulardatatype.Entity.Support;
|
||||||
|
import java.util.List;
|
||||||
|
import com.realnet.users.entity1.AppUser;
|
||||||
|
import com.realnet.users.service1.AppUserServiceImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SupportInsertService1 {
|
||||||
|
@Autowired
|
||||||
|
private SupportRepository Repository;
|
||||||
|
@Autowired
|
||||||
|
private AppUserServiceImpl userService;
|
||||||
|
|
||||||
|
|
||||||
|
public Support insertaction(Support support ) {
|
||||||
|
|
||||||
|
|
||||||
|
support.setUpdatedBy(getUser().getUserId());
|
||||||
|
support.setCreatedBy(getUser().getUserId());
|
||||||
|
support.setAccountId(getUser().getAccount().getAccount_id());
|
||||||
|
support.setDescription("textarea");
|
||||||
|
final Support save = Repository.save(support);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
public AppUser getUser() {
|
||||||
|
AppUser user = userService.getLoggedInUser();
|
||||||
|
return user;
|
||||||
|
|
||||||
|
}}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
package com.realnet.angulardatatype.Services;
|
||||||
|
import com.realnet.angulardatatype.Repository.SupportRepository;
|
||||||
|
import com.realnet.angulardatatype.Entity.Support
|
||||||
|
;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 SupportService {
|
||||||
|
@Autowired
|
||||||
|
private SupportRepository Repository;
|
||||||
|
@Autowired
|
||||||
|
private AppUserServiceImpl userService;
|
||||||
|
@Autowired
|
||||||
|
private RealmService realmService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Support Savedata(Support data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
data.setCreatedBy(getUser().getUserId());
|
||||||
|
data.setAccountId(getUser().getAccount().getAccount_id());
|
||||||
|
Support save = Repository.save(data);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// get all with pagination
|
||||||
|
public Page<Support> getAllWithPagination(Pageable page) {
|
||||||
|
return Repository.findAll(page, getUser().getUserId());
|
||||||
|
}
|
||||||
|
public List<Support> getdetails() {
|
||||||
|
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
|
||||||
|
List<Support> all = Repository.findAll(getUser().getUserId());
|
||||||
|
|
||||||
|
return all ; }
|
||||||
|
|
||||||
|
|
||||||
|
public Support getdetailsbyId(Integer id) {
|
||||||
|
return Repository.findById(id).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void delete_by_id(Integer id) {
|
||||||
|
Repository.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Support update(Support data,Integer id) {
|
||||||
|
Support old = Repository.findById(id).get();
|
||||||
|
old.setName(data.getName());
|
||||||
|
|
||||||
|
old.setDescription(data.getDescription());
|
||||||
|
|
||||||
|
final Support test = Repository.save(old);
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
return test;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public AppUser getUser() {
|
||||||
|
AppUser user = userService.getLoggedInUser();
|
||||||
|
return user;
|
||||||
|
|
||||||
|
}}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
package com.realnet.angulardatatype.Services;
|
||||||
|
import com.realnet.angulardatatype.Repository.SupportRepository;
|
||||||
|
import com.realnet.angulardatatype.Entity.Support;import java.util.List;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import com.realnet.angulardatatype.Entity.Ad8;
|
||||||
|
import com.realnet.angulardatatype.Repository.Ad8Repository; import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SupportUpdateService1 {
|
||||||
|
@Autowired
|
||||||
|
private SupportRepository Repository;
|
||||||
|
@Autowired
|
||||||
|
private Ad8Repository ad8repository;
|
||||||
|
|
||||||
|
|
||||||
|
public ResponseEntity<?> updateaction(Integer id, Support support ) {
|
||||||
|
Integer i = 0; Ad8 ad8 = ad8repository.findById(id).get();
|
||||||
|
List<Support> list = new ArrayList<>();
|
||||||
|
|
||||||
|
Object SupportObject = ad8.getSupport();
|
||||||
|
|
||||||
|
if (SupportObject instanceof List<?>) {
|
||||||
|
// If it's a list, cast and add all elements to the list
|
||||||
|
list.addAll((List<Support>) SupportObject);
|
||||||
|
} else if (SupportObject instanceof Support) {
|
||||||
|
// If it's a single Childb object, add it to the list
|
||||||
|
list.add((Support) SupportObject);
|
||||||
|
} for (Support li : list) { Support old = Repository.findById(li.getId()).get();
|
||||||
|
|
||||||
|
old.setDescription(support.getDescription());
|
||||||
|
old.setName("text");
|
||||||
|
final Support supportdata = Repository.save(old);
|
||||||
|
i++;} return new ResponseEntity<>(i+" updated", HttpStatus.OK);
|
||||||
|
}}
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
package com.realnet.angulardatatype.Services;
|
||||||
|
import com.realnet.angulardatatype.Repository.TestRepository;
|
||||||
|
import com.realnet.angulardatatype.Entity.Test
|
||||||
|
;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 TestService {
|
||||||
|
@Autowired
|
||||||
|
private TestRepository Repository;
|
||||||
|
@Autowired
|
||||||
|
private AppUserServiceImpl userService;
|
||||||
|
@Autowired
|
||||||
|
private RealmService realmService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Test Savedata(Test data) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
data.setCreatedBy(getUser().getUserId());
|
||||||
|
data.setAccountId(getUser().getAccount().getAccount_id());
|
||||||
|
Test save = Repository.save(data);
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// get all with pagination
|
||||||
|
public Page<Test> getAllWithPagination(Pageable page) {
|
||||||
|
return Repository.findAll(page, getUser().getUserId());
|
||||||
|
}
|
||||||
|
public List<Test> getdetails() {
|
||||||
|
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
|
||||||
|
List<Test> all = Repository.findAll(getUser().getUserId());
|
||||||
|
|
||||||
|
return all ; }
|
||||||
|
|
||||||
|
|
||||||
|
public Test getdetailsbyId(Integer id) {
|
||||||
|
return Repository.findById(id).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void delete_by_id(Integer id) {
|
||||||
|
Repository.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Test update(Test data,Integer id) {
|
||||||
|
Test old = Repository.findById(id).get();
|
||||||
|
old.setName(data.getName());
|
||||||
|
|
||||||
|
old.setDescription(data.getDescription());
|
||||||
|
|
||||||
|
old.setPassword_field(data.getPassword_field());
|
||||||
|
|
||||||
|
final Test test = Repository.save(old);
|
||||||
|
data.setUpdatedBy(getUser().getUserId());
|
||||||
|
return test;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public AppUser getUser() {
|
||||||
|
AppUser user = userService.getLoggedInUser();
|
||||||
|
return user;
|
||||||
|
|
||||||
|
}}
|
||||||
22
testalladvrb003-testdb-d/authsec_mysql/mysql/wf_table/wf_table.sql
Executable file
22
testalladvrb003-testdb-d/authsec_mysql/mysql/wf_table/wf_table.sql
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
CREATE TABLE testdb.Adv1(id BIGINT NOT NULL AUTO_INCREMENT, video_field2 VARCHAR(400), video_field VARCHAR(400), audio_field2 VARCHAR(400), ismale VARCHAR(400), fileupload_field2 VARCHAR(400), fileupload_field VARCHAR(400), imageupload_field VARCHAR(400), audio_field VARCHAR(400), idfemale VARCHAR(400), test1 bit(1), t1 bit(1), imageupload_field2 VARCHAR(400), PRIMARY KEY (id));
|
||||||
|
|
||||||
|
CREATE TABLE testdb.Adv3(id BIGINT NOT NULL AUTO_INCREMENT, datagrid_field2 VARCHAR(400), country VARCHAR(400), dynamic VARCHAR(400), dymlt2 VARCHAR(400), dymlti1 VARCHAR(400), stmlit VARCHAR(400), stmmlt2 VARCHAR(400), state VARCHAR(400), datagrid_field VARCHAR(400), dy2 int, dy1 int, PRIMARY KEY (id));
|
||||||
|
|
||||||
|
CREATE TABLE testdb.Support(id BIGINT NOT NULL AUTO_INCREMENT, description VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));
|
||||||
|
|
||||||
|
CREATE TABLE testdb.Adv4(id BIGINT NOT NULL AUTO_INCREMENT, onetoone VARCHAR(400), atdy1 VARCHAR(400), atdy2 VARCHAR(400), atoc int, atc2 int, PRIMARY KEY (id));
|
||||||
|
|
||||||
|
CREATE TABLE testdb.Adv5(id BIGINT NOT NULL AUTO_INCREMENT, onetomanyextension VARCHAR(400), subtration VARCHAR(400), value_list_field VARCHAR(400), value_list_field2 VARCHAR(400), age int, age2 int, name VARCHAR(400), addition VARCHAR(400), PRIMARY KEY (id));
|
||||||
|
|
||||||
|
CREATE TABLE testdb.Ad6(id BIGINT NOT NULL AUTO_INCREMENT, checkout_field VARCHAR(400), description VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));
|
||||||
|
|
||||||
|
CREATE TABLE testdb.Ad7(id BIGINT NOT NULL AUTO_INCREMENT, button_field2 VARCHAR(400), button_field VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));
|
||||||
|
|
||||||
|
CREATE TABLE testdb.Ad8(id BIGINT NOT NULL AUTO_INCREMENT, onetomanyextension VARCHAR(400), buttonupdate VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));
|
||||||
|
|
||||||
|
CREATE TABLE testdb.Ad9(id BIGINT NOT NULL AUTO_INCREMENT, approved_field VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));
|
||||||
|
|
||||||
|
CREATE TABLE testdb.Test(id BIGINT NOT NULL AUTO_INCREMENT, description VARCHAR(400), password_field VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));
|
||||||
|
|
||||||
|
CREATE TABLE testdb.Listtest(id BIGINT NOT NULL AUTO_INCREMENT, description VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user