updating alerts ui/ux
This commit is contained in:
@@ -7,6 +7,8 @@ const {
|
|||||||
getAllTransactions,
|
getAllTransactions,
|
||||||
updatePaymentStatus,
|
updatePaymentStatus,
|
||||||
deleteTransaction,
|
deleteTransaction,
|
||||||
|
getTransactionWithPagination,
|
||||||
|
removeTransation,
|
||||||
} = require("../controllers/transaction");
|
} = require("../controllers/transaction");
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ const pool = mysql.createPool({
|
|||||||
host: "localhost",
|
host: "localhost",
|
||||||
user: "root",
|
user: "root",
|
||||||
database: "Marketplace",
|
database: "Marketplace",
|
||||||
password: "12345678"
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// const pool = mysql.createPool(
|
// const pool = mysql.createPool(
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ const ProductDetail = () => {
|
|||||||
const [reviews, setReviews] = useState([]);
|
const [reviews, setReviews] = useState([]);
|
||||||
const [showReviewForm, setShowReviewForm] = useState(false);
|
const [showReviewForm, setShowReviewForm] = useState(false);
|
||||||
const [showAlert, setShowAlert] = useState(false);
|
const [showAlert, setShowAlert] = useState(false);
|
||||||
|
const [showAlert1, setShowAlert1] = useState(false);
|
||||||
|
|
||||||
const storedUser = JSON.parse(sessionStorage.getItem("user"));
|
const storedUser = JSON.parse(sessionStorage.getItem("user"));
|
||||||
|
|
||||||
const toggleFavorite = async (id) => {
|
const toggleFavorite = async (id) => {
|
||||||
@@ -303,6 +305,12 @@ const ProductDetail = () => {
|
|||||||
onClose={() => setShowAlert(false)}
|
onClose={() => setShowAlert(false)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{showAlert1 && (
|
||||||
|
<FloatingAlert
|
||||||
|
message="Product added to transaction!"
|
||||||
|
onClose={() => setShowAlert1(false)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="flex flex-col md:flex-row gap-8">
|
<div className="flex flex-col md:flex-row gap-8">
|
||||||
<div className="md:w-3/5">
|
<div className="md:w-3/5">
|
||||||
@@ -438,13 +446,8 @@ const ProductDetail = () => {
|
|||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
alert("Transaction created successfully!");
|
setShowAlert1(true);
|
||||||
} else {
|
|
||||||
throw new Error(
|
|
||||||
result.message || "Failed to create transaction",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle contact options visibility
|
// Toggle contact options visibility
|
||||||
setShowContactOptions(!showContactOptions);
|
setShowContactOptions(!showContactOptions);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ CREATE TABLE Review (
|
|||||||
|
|
||||||
-- Transaction Entity (Many-to-One with User, Many-to-One with Product)
|
-- Transaction Entity (Many-to-One with User, Many-to-One with Product)
|
||||||
CREATE TABLE Transaction (
|
CREATE TABLE Transaction (
|
||||||
TransactionID INT PRIMARY KEY,
|
TransactionID INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
UserID INT,
|
UserID INT,
|
||||||
ProductID INT,
|
ProductID INT,
|
||||||
Date DATETIME DEFAULT CURRENT_TIMESTAMP,
|
Date DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
|||||||
Reference in New Issue
Block a user