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