Compare commits

...
Author SHA1 Message Date
Nícolas Agostini b1743d91c4 Merge branch 'dev' into fix/planDetail-padding 2025-05-16 12:26:28 -07:00
nicoagostini 5d67f4f5ed fix/planDetail padding fixed to avoid overlap 2025-05-16 12:25:29 -07:00
nicoagostini 505f0484bc fix/planDetail.ejs padding adjusted to fix overlap 2025-05-16 12:14:42 -07:00
Joaquin cc63b83288 fix/fixed spacing in planDetail page 2025-05-16 12:09:46 -07:00
knighthawk4227 0eaa82b121 padding for mobile 2025-05-16 12:02:06 -07:00
Joaquin 03b0dd8fa6 fix/fixed navbar pop-up element shadow 2025-05-16 11:57:53 -07:00
Joaquin 6faa951636 fix/fixed navbar pop-up element shadow 2025-05-16 11:56:06 -07:00
Nícolas Agostini 58a6e4724f Merge pull request #32 from JoaquinPar/refactor/ai-challenge2
refactor/ai-challenge2 removed from pages where the user is not logge…
2025-05-16 11:48:48 -07:00
nicoagostini f5f1516a76 refactor/ai-challenge2 removed from pages where the user is not logged in 2025-05-16 11:47:40 -07:00
knighthawk4227 692f195e27 google chrome browser fix 2025-05-16 11:25:08 -07:00
knighthawk4227 5ec2de0631 dashboard changed for mobile 2025-05-16 10:50:47 -07:00
Joaquin 59f8677e7c solved merge conflicts 2025-05-16 10:48:19 -07:00
SowinskiBraeden 450e46f9e5 Merge pull request #30 from JoaquinPar/update/password_security
update/password security
2025-05-15 13:38:17 -07:00
SowinskiBraeden 3940089fa6 update/password security 2025-05-15 08:20:28 -07:00
knighthawk4227 0834723c99 Merge branch 'dev' into feature/dashboardInfo 2025-05-14 21:51:26 -07:00
knighthawk4227 1acb749f1f name of js file 2025-05-14 21:50:41 -07:00
knighthawk4227 563fa502d1 progress bar on dashboard & number formatting 2025-05-14 21:47:50 -07:00
SowinskiBraeden aa9e412fa1 Merge pull request #29 from JoaquinPar/refactor/assets
Refactor/assets
2025-05-14 15:06:00 -07:00
SowinskiBraeden 60238b7a9a add dropdown scripts 2025-05-14 15:05:14 -07:00
SowinskiBraeden 61db8e162f Merge dev into refactor/assets 2025-05-14 14:46:34 -07:00
SowinskiBraeden 1c5031f48c split assets into partials 2025-05-14 14:43:34 -07:00
SowinskiBraeden b040f12eaf split assets into partials 2025-05-14 14:43:17 -07:00
nicoagostini 4a02b75a4d fix/Footer scripts moved to a dedicated file 2025-05-14 12:53:58 -07:00
SowinskiBraeden 34c6dd2c66 Merge pull request #28 from JoaquinPar/fix/account_details_update
Fix/account details update
2025-05-14 12:16:34 -07:00
SowinskiBraeden 1f3109a68f Merge branch 'dev' of github.com:JoaquinPar/2800-202510-BBY14 into fix/account_details_update 2025-05-14 12:13:04 -07:00
SowinskiBraeden 9ae23ce25e fix account details not updating + update personal info 2025-05-14 12:12:48 -07:00
Nícolas Agostini c41f38ce6b Merge pull request #27 from JoaquinPar/feature/ai-challenge2
Feature/ai challenge2
2025-05-14 11:24:40 -07:00
Nícolas Agostini 5771f1372f Merge branch 'dev' into feature/ai-challenge2 2025-05-14 11:24:31 -07:00
nicoagostini 73d61d76de feature/AI feature updated to accept user input 2025-05-14 11:22:28 -07:00
nicoagostini 50e2d95fda feature/AI feature updated to accept user input 2025-05-14 11:21:10 -07:00
24 changed files with 843 additions and 606 deletions

No files matched your search

+27 -4
View File
@@ -11,6 +11,7 @@
"dependencies": {
"@google/genai": "^0.14.0",
"bcrypt": "^5.1.1",
"check-password-strength": "^3.0.0",
"connect-mongo": "^5.1.0",
"crypto": "^1.0.1",
"dotenv": "^16.5.0",
@@ -20,7 +21,7 @@
"joi": "^17.13.3",
"mongodb": "^6.16.0",
"nodemailer": "^7.0.3",
"sweetalert2": "^11.21.0"
"sweetalert2": "^11.6.13"
},
"devDependencies": {
"nodemon": "^3.1.10"
@@ -446,6 +447,15 @@
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/check-password-strength": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/check-password-strength/-/check-password-strength-3.0.0.tgz",
"integrity": "sha512-XIBvWpb7/RI2DO05tMixE4WbFFvEC7ls/jr1VSrWgXvlCmdiH2fsdkixG0cNGs1uIXwoSqJ75T3s9H/TlJV6Cw==",
"license": "MIT",
"dependencies": {
"escape-string-regexp": "^5.0.0"
}
},
"node_modules/chokidar": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
@@ -769,6 +779,18 @@
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
"license": "MIT"
},
"node_modules/escape-string-regexp": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz",
"integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==",
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
@@ -2430,9 +2452,10 @@
}
},
"node_modules/sweetalert2": {
"version": "11.21.0",
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.21.0.tgz",
"integrity": "sha512-fiEK7SqRY/QD/wC2uqEHlfYGZ7qe2UcyQbJpbpj4YRVqplBgcI+euPZLZL+evLINcvbtXmL1SFUdZHKqBHGAAQ==",
"version": "11.6.13",
"resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.6.13.tgz",
"integrity": "sha512-n5yVF0FNx1lm4XzpPyb1HIaiptzODfVyeCzmB809tpK+1bPdoKoevKOxYjrtId75DV7xuIp4r6cjn8xUAB8dPQ==",
"license": "MIT",
"funding": {
"type": "individual",
"url": "https://github.com/sponsors/limonte"
+2 -1
View File
@@ -20,6 +20,7 @@
"dependencies": {
"@google/genai": "^0.14.0",
"bcrypt": "^5.1.1",
"check-password-strength": "^3.0.0",
"connect-mongo": "^5.1.0",
"crypto": "^1.0.1",
"dotenv": "^16.5.0",
@@ -29,7 +30,7 @@
"joi": "^17.13.3",
"mongodb": "^6.16.0",
"nodemailer": "^7.0.3",
"sweetalert2": "^11.21.0"
"sweetalert2": "^11.6.13"
},
"devDependencies": {
"nodemon": "^3.1.10"
+9 -1
View File
@@ -1,5 +1,5 @@
const { passwordStrength } = require("check-password-strength");
const status = require("../util/statuses");
const session = require("express-session");
const bcrypt = require('bcrypt');
const joi = require("joi");
const salt = 12;
@@ -99,6 +99,14 @@ module.exports = (users) => {
return res.redirect("/signup");
}
let strength = passwordStrength(req.body.password);
if (strength.id < 2) {
req.session.errMessage = `Password ${strength.value}`;
res.status(status.BadRequest);
return res.redirect("/signup");
}
let hashedPassword = await bcrypt.hashSync(req.body.password, salt);
users.insertOne({
+1
View File
@@ -66,6 +66,7 @@ module.exports = (users) => {
}
});
//Reset link verifies information from user and checks token
router.post('/resetLink', async (req, res) => {
const { token, password, confirmPassword, } = req.body;
const passwordSchema = joi.object({
+1 -2
View File
@@ -27,7 +27,6 @@ const createMiddleware = (users) => {
if (!req.session.user) {
let user = await users.findOne({ _id: new ObjectId(req.session.userId) }).then((user) => user);
if (!user) {
return req.session.destroy((err) => {
if (err) {
@@ -49,7 +48,7 @@ const createMiddleware = (users) => {
console.error("Failed to save session: ", err);
return req.session.destroy((err) => {
req.session.errMessage = "An error occured, please login again.";
req.session.errMessage = "Failed to save session, please login again.";
if (err) {
console.error("Failed to destroy session: ", err);
+15
View File
@@ -0,0 +1,15 @@
document.addEventListener("DOMContentLoaded", () => {
const number = document.querySelectorAll(".planGoal");
number.forEach(value => {
num = parseFloat(value.textContent);
if (num >= 999999) {
value.textContent = (num /= 1000000).toFixed(2) + "M";
console.log(value.textContent);
} else if (num > 999) {
value.textContent = (num /= 1000).toFixed(2) + "K";
} else {
return num;
}
});
});
+70
View File
@@ -0,0 +1,70 @@
const factButton = document.getElementById("factButton");
const factMenu = document.getElementById("factMenu");
const factInput = document.getElementById("factInput");
const factSubmitButton = document.getElementById("factSubmitButton");
var path = window.location.pathname;
var page = path.split("/").pop();
if(page !== "login" && page !== "signup" && page !== "forgotPassword" && page !== "") {
factButton.classList.remove("hidden");
}
factButton.addEventListener("click", () => {
factMenu.classList.toggle("hidden");
});
factSubmitButton.addEventListener("click", () => {
fetch("/fact", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
fact: factInput.value,
}),
})
.then(response => response.json())
.then(data => {
Swal.fire('Here is a fact!', data.fact, 'success');
})
.catch(error => {
console.error("Error fetching fact:", error);
Swal.fire('Error fetching fact', 'Please try again later', 'error');
});
});
document.addEventListener("DOMContentLoaded", () => {
const drawer = document.getElementById("drawer-navigation");
const toggle = document.getElementById("drawer-toggle");
function openDrawer() {
drawer.classList.remove("translate-x-full");
// Add backdrop
const backdrop = document.createElement("div");
backdrop.className = "fixed inset-0 bg-gray-900/50 z-30 drawer-backdrop";
document.body.appendChild(backdrop);
// Optional: prevent scroll
document.body.classList.add("overflow-hidden");
backdrop.addEventListener("click", closeDrawer);
}
function closeDrawer() {
drawer.classList.add("translate-x-full");
const backdrop = document.querySelector(".drawer-backdrop");
if (backdrop) backdrop.remove();
document.body.classList.remove("overflow-hidden");
}
toggle.addEventListener("click", openDrawer);
// Also close on X button if needed
const closeBtn = drawer.querySelector("[data-drawer-hide]");
if (closeBtn) {
closeBtn.addEventListener("click", closeDrawer);
}
});
+14 -2
View File
@@ -11,6 +11,7 @@ function lockAccount() {
document.getElementById("password").disabled = true;
document.getElementById("repassword").disabled = true;
document.getElementById("save-account").classList.add("cursor-not-allowed");
document.getElementById("save-account").classList.remove("cursor-pointer");
document.getElementById("edit-account").innerHTML = "Edit";
document.getElementById("edit-account").onclick = unlockAccount;
@@ -30,7 +31,12 @@ function lockPersonal() {
document.getElementById("ms-married").disabled = true;
document.getElementById("ms-divorced").disabled = true;
document.getElementById("ms-widowed").disabled = true;
document.getElementById("income").disabled = true;
document.getElementById("expenses").disabled = true;
document.getElementById("assets").disabled = true;
document.getElementById("liabilities").disabled = true;
document.getElementById("save-personal").classList.add("cursor-not-allowed");
document.getElementById("save-personal").classList.remove("cursor-pointer");
document.getElementById("edit-personal").innerHTML = "Edit";
document.getElementById("edit-personal").onclick = unlockPersonal;
@@ -42,11 +48,12 @@ function lockPersonal() {
*/
function unlockAccount() {
document.getElementById("save-account").disabled = false;
// document.getElementById("email").disabled = false;
document.getElementById("email").disabled = false;
document.getElementById("name").disabled = false;
document.getElementById("password").disabled = false;
document.getElementById("repassword").disabled = false;
document.getElementById("save-account").classList.remove("cursor-not-allowed");
document.getElementById("save-account").classList.add("cursor-pointer");
document.getElementById("edit-account").innerHTML = "Cancel changes";
document.getElementById("edit-account").onclick = lockAccount;
@@ -64,7 +71,12 @@ function unlockPersonal() {
document.getElementById("ms-married").disabled = false;
document.getElementById("ms-divorced").disabled = false;
document.getElementById("ms-widowed").disabled = false;
document.getElementById("income").disabled = false;
document.getElementById("expenses").disabled = false;
document.getElementById("assets").disabled = false;
document.getElementById("liabilities").disabled = false;
document.getElementById("save-personal").classList.remove("cursor-not-allowed");
document.getElementById("save-personal").classList.add("cursor-pointer");
document.getElementById("edit-personal").innerHTML = "Cancel changes";
document.getElementById("edit-personal").onclick = lockPersonal;
@@ -72,4 +84,4 @@ function unlockPersonal() {
// On page load, ensure forms are locked and reset
lockAccount();
// lockPersonal();
lockPersonal();
+140 -28
View File
@@ -56,6 +56,12 @@ const getAssetSchema = (type) => {
return assetSchema;
}
/**
* Function takes in a number and formats it to currency
* @param {integer}
* @returns nuber formatted in currency
*/
/**
* @param {function} middleware handler
* @param {MongoClient.collection} users db collection
@@ -72,6 +78,7 @@ module.exports = (middleware, users, plans, assets) => {
router.use(middleware);
router.get('/home', async (req, res) => {
let user = req.session.user._id;
// if no session with geoData
if (!req.session.geoData) {
req.session.geoData = {
@@ -79,10 +86,13 @@ module.exports = (middleware, users, plans, assets) => {
toCurrencyRates: [],
};
}
let planSchema = await plans.find({ userId: new ObjectId(user) }).project({
name: 1, retirementAssets: 1, progress: 1, _id: 1,
}).toArray();
res.render('dashboard', {
user: req.session.user,
geoData: req.session.geoData });
geoData: req.session.geoData,
plans: planSchema, });
return res.status(status.Ok);
});
@@ -103,18 +113,17 @@ module.exports = (middleware, users, plans, assets) => {
try {
const userPlansFromDB = await plans.find({ userId: new ObjectId(req.session.userId) }).toArray();
// Use a for...of loop for proper async/await behavior in series for updates
for (const plan of userPlansFromDB) {
const percentage = await calculatePlanProgress(plan, assets, req.session.userId);
await updatePlanProgressInDB(plan._id, percentage, plans); // Pass the 'plans' collection
const percentage = await calculatePlanProgress(plan, assets, req.session.user._id);
await updatePlanProgressInDB(plan._id, percentage, plans);
}
// Re-fetch plans to get updated progress for rendering
const updatedUserPlans = await plans.find({ userId: new ObjectId(req.session.userId) }).toArray();
const updatedUserPlans = await plans.find({ userId: new ObjectId(req.session.user._id) }).toArray();
res.render('plans', {
user: req.session.user,
plans: updatedUserPlans, // Send the most up-to-date plans
plans: updatedUserPlans,
geoData: req.session.geoData
});
} catch (err) {
@@ -143,16 +152,9 @@ module.exports = (middleware, users, plans, assets) => {
return res.status(status.NotFound).redirect('/plans');
}
// The plan.progress should be up-to-date from the database as it was updated in the /plans route
// or when assets/plans are modified. If an immediate recalculation for this specific view is absolutely needed,
// (e.g., if assets were modified without an immediate plan progress update elsewhere),
// you could do it here:
// const currentProgress = await calculatePlanProgress(plan, assets, req.session.user._id);
// plan.progress = currentProgress; // This would only update the 'plan' object for this render, not in DB
res.render('planDetail', {
user: req.session.user,
plan: plan, // This plan object will have the progress from the database
plan: plan,
geoData: req.session.geoData,
assets: userAssets,
suggestions: await suggestions.generateSuggestions(),
@@ -219,9 +221,10 @@ module.exports = (middleware, users, plans, assets) => {
}
});
router.get('/pun', async (req, res) => {
const pun = await suggestions.generatePun();
return res.status(status.Ok).json({ pun });
router.post('/fact', async (req, res) => {
const factInput = req.body.fact;
const fact = await suggestions.generateFact(factInput);
return res.status(status.Ok).json({ fact });
});
router.get('/more', (req, res) => {
@@ -273,10 +276,12 @@ module.exports = (middleware, users, plans, assets) => {
const validationOptions = { convert: true, abortEarly: false };
const { error, value } = questionnaireSchema.validate(req.body, validationOptions);
let referrer = req.get('Referrer') || "/home";
if (error) {
console.error("Questionnaire validation error:", error.details);
req.session.errMessage = "Invalid input: " + error.details.map(d => d.message.replace(/"/g, '')).join(', ');
res.status(status.BadRequest).redirect("/questionnaire");
let redirect = referrer.includes("?profile") ? "/questionnaire?profile" : "/questionnaire";
res.status(status.BadRequest).redirect(redirect);
return;
}
@@ -305,20 +310,34 @@ module.exports = (middleware, users, plans, assets) => {
console.log(`User questionnaire data unchanged (already up-to-date): ${req.session.userId}`);
}
req.session.user.financialData = true;
req.session.errMessage = "";
req.session.save(err => {
req.session.user = null; // set user to null so middleware updates user
req.session.save((err) => {
if (err) {
res.status(status.InternalServerError).redirect("/plans");
console.error("Failed to save session: ", err);
return req.session.destroy((err) => {
req.session.errMessage = "Failed to save session, please login again.";
if (err) {
console.error("Failed to destroy session: ", err);
}
res.status(status.Ok).redirect("/plans");
res.status(status.InternalServerError);
return res.redirect("/login");
});
}
let redirect = referrer.includes("?profile") ? "/profile" :
referrer != "/home" ? "/plans" : referrer;
return res.status(status.Ok).redirect(redirect);
});
}).catch(err => {
console.error("Error updating questionnaire in database:", err);
req.session.errMessage = "An error occurred while saving your information. Please try again.";
res.status(status.InternalServerError).redirect("/questionnaire");
let redirect = referrer.includes("?profile") ? "/questionnaire?profile" : "/questionnaire";
res.status(status.InternalServerError).redirect(redirect);
});
});
@@ -339,6 +358,7 @@ module.exports = (middleware, users, plans, assets) => {
}
let update = {
email: req.body.email,
name: req.body.name,
};
@@ -366,7 +386,25 @@ module.exports = (middleware, users, plans, assets) => {
}
req.session.errMessage = "";
req.session.user = null; // set user to null so middleware updates user
req.session.save((err) => {
if (err) {
console.error("Failed to save session: ", err);
return req.session.destroy((err) => {
req.session.errMessage = "Failed to save session, please login again.";
if (err) {
console.error("Failed to destroy session: ", err);
}
res.status(status.InternalServerError);
return res.redirect("/login");
});
}
return res.status(status.Ok).redirect("/profile");
});
}).catch(err => {
console.error("Error updating account in database:", err);
req.session.errMessage = "An error occurred while saving your information. Please try again.";
@@ -374,7 +412,81 @@ module.exports = (middleware, users, plans, assets) => {
});
});
router.post("/createAsset", async (req, res) => {
router.post("/updatePersonal", (req, res) => {
const questionnaireSchema = joi.object({
dob: joi.date().required(),
education: joi.string().valid('primary', 'secondary', 'tertiary', 'postgraduate').required(),
maritalStatus: joi.string().valid('single', 'married', 'divorced', 'widowed').required(),
income: joi.number().min(0).required(),
expenses: joi.number().min(0).required(),
assets: joi.number().min(0).required(),
liabilities: joi.number().min(0).required(),
});
const validationOptions = { convert: true, abortEarly: false };
const { error, value } = questionnaireSchema.validate(req.body, validationOptions);
if (error) {
console.error("Personal info validation error:", error.details);
req.session.errMessage = "Invalid input: " + error.details.map(d => d.message.replace(/"/g, '')).join(', ');
res.status(status.BadRequest).redirect("/profile");
return;
}
users.updateOne(
{ _id: new ObjectId(req.session.userId) },
{
$set: {
financialData: true,
dob: value.dob,
education: value.education,
maritalStatus: value.maritalStatus,
income: value.income,
expenses: value.expenses,
assets: value.assets,
liabilities: value.liabilities,
}
}
).then((result) => {
if (result.matchedCount === 0) {
console.log(`User not found during personal info update: ${req.session.userId}`);
req.session.errMessage = "User session invalid. Please log in again.";
res.status(status.NotFound).redirect("/login");
return;
}
if (result.modifiedCount === 0 && result.matchedCount === 1) {
console.log(`User personal info unchanged (already up-to-date): ${req.session.userId}`);
}
req.session.errMessage = "";
req.session.user = null; // set user to null so middleware updates user
req.session.save((err) => {
if (err) {
console.error("Failed to save session: ", err);
return req.session.destroy((err) => {
req.session.errMessage = "Failed to save session, please login again.";
if (err) {
console.error("Failed to destroy session: ", err);
}
res.status(status.InternalServerError);
return res.redirect("/login");
});
}
return res.status(status.Ok).redirect("/profile");
});
}).catch(err => {
console.error("Error updating personal info in database:", err);
req.session.errMessage = "An error occurred while saving your information. Please try again.";
res.status(status.InternalServerError).redirect("/profile");
});
});
router.post("/createAsset", (req, res) => {
// Create asset, each asset has different data structure based on type
const type = req.body.type;
const assetSchema = getAssetSchema(type);
@@ -420,7 +532,7 @@ module.exports = (middleware, users, plans, assets) => {
return res.status(status.Ok).redirect("/assets");
});
router.post("/updateAsset", async (req, res) => {
router.post("/updateAsset", (req, res) => {
const type = req.body.type;
const assetSchema = getAssetSchema(type);
+3 -3
View File
@@ -2,10 +2,10 @@ const { GoogleGenAI } = require("@google/genai");
const ai = new GoogleGenAI({ apiKey: process.env.GOOGLE_API_KEY });
async function generatePun() {
async function generateFact(factInput) {
const response = await ai.models.generateContent({
model: "gemini-2.0-flash",
contents: "Return a funny pun about investments, answer the pun only, no additional text.",
contents: `Generate a concise investment fact about "${factInput}". If "${factInput}" is not directly investment-related, provide a general, useful investment fact instead. Deliver only the fact itself, with no extra text or explanation.`,
});
return response.text;
}
@@ -19,6 +19,6 @@ async function generateSuggestions() {
}
module.exports = {
generatePun,
generateFact,
generateSuggestions
};
+8 -328
View File
@@ -2,156 +2,7 @@
<%- include("./partials/header") %>
<main class="pt-26">
<!-- Create Asset popup Modal -->
<dialog id="create-asset-modal" class="w-lg mx-auto bg-white p-8 mt-10 rounded-lg shadow-md">
<div class="flex flex-row justify-between">
<h2 class="text-lg font-bold mb-2">Create New Asset</h2>
<form method="dialog">
<button
onclick="resetAll()"
type="submit"
class="text-center py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Cancel
</button>
</form>
</div>
<div class="my-4">
<label class="block text-sm font-medium text-gray-700">Asset Type</label>
<div class="mt-1 space-x-4">
<label class="inline-flex items-center">
<input checked onclick="selectAssetForm('create-other-asset-form')" id="asset-other" type="radio" name="type" value="other" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 cursor-pointer">
<span class="ml-2 text-sm text-gray-700">Other Assets</span>
</label>
<label class="inline-flex items-center">
<input onclick="selectAssetForm('create-saving-asset-form')" id="asset-saving" type="radio" name="type" value="saving" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 cursor-pointer">
<span class="ml-2 text-sm text-gray-700">Savings</span>
</label>
<label class="inline-flex items-center">
<input onclick="selectAssetForm('create-stock-asset-form')" id="asset-stock" type="radio" name="type" value="stock" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 cursor-pointer">
<span class="ml-2 text-sm text-gray-700">Stocks</span>
</label>
</div>
</div>
<!-- Create other asset form -->
<form method="POST" action="/createAsset" id="create-other-asset-form">
<input style="display: none;" id="type" value="other" name="type" type="text">
<input style="display: none;" id="icon" value="Other" name="icon" type="text">
<label for="name" class="block text-sm font-medium text-gray-700 mt-2">Select an Icon</label>
<div class="flex items-center">
<button id="dropdown-icon-button" value="" data-dropdown-toggle="dropdown-icons" class="shrink-0 z-10 inline-flex items-center py-2.5 px-4 text-sm font-medium text-center border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" type="button">
<img src="/static/svgs/icons/Other.svg" class="h-4 w-4 me-2" alt="Other"> Other
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
</svg>
</button>
<div id="dropdown-icons" class="overflow-y-auto h-40 z-10 hidden bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-32 dark:bg-gray-700">
<ul id="dropdown" class="py-2 text-sm text-gray-700 dark:text-gray-200" aria-labelledby="dropdown-icon-button">
<% icons.forEach(icon => { %>
<li>
<button onclick="selectIcon(this)" type="button" value="<%= icon %>" class="inline-flex w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-600 dark:hover:text-white" role="menuitem">
<span class="inline-flex items-center">
<img src="/static/svgs/icons/<%= icon %>.svg" class="h-4 w-4 me-2" alt="<%= icon %>"> (<%= icon %>)
</span>
</button>
</li>
<% }); %>
</ul>
</div>
</div>
<label for="name" class="block text-sm font-medium text-gray-700 mt-2">Asset Name</label>
<input required id="name" type="text" name="name" minlength="3" maxlength="30" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<label for="value" class="block text-sm font-medium text-gray-700 mt-2">Asset Value</label>
<input required placeholder="CAD" min="0" id="value" type="number" name="value" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<label for="purchaseDate" class="block text-sm font-medium text-gray-700 mt-2">Date of Purchase</label>
<input required type="date" id="purchaseDate" name="purchaseDate" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<label for="description" class="block text-sm font-medium text-gray-700 mt-2">Description</label>
<textarea maxlength="240" id="description" name="description" rows="4" cols="50" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"></textarea>
<div class="mt-6 flex flex-row justify-between">
<button
type="reset"
onclick="document.getElementById('create-other-asset-form').reset()"
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Clear
</button>
<button
type="submit"
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Create
</button>
</div>
</form>
<!-- Create savings asset form -->
<form style="display: none;" method="POST" action="/createAsset" id="create-saving-asset-form">
<input style="display: none;" value="saving" name="type" type="text">
<label for="name" class="block text-sm font-medium text-gray-700 mt-2">Savings Name</label>
<input required id="name" type="text" name="name" minlength="3" maxlength="30" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<label for="value" class="block text-sm font-medium text-gray-700 mt-2">Savings Value</label>
<input required placeholder="CAD" min="0" id="value" type="number" name="value" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<div class="mt-6 flex flex-row justify-between">
<button
type="reset"
onclick="document.getElementById('create-saving-asset-form').reset()"
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Clear
</button>
<button
type="submit"
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Create
</button>
</div>
</form>
<!-- Create stock asset form -->
<form style="display: none;" method="POST" action="/createAsset" id="create-stock-asset-form">
<input style="display: none;" value="stock" name="type" type="text">
<label for="ticker" class="block text-sm font-medium text-gray-700 mt-2">Stock Ticker</label>
<input required id="ticker" type="text" name="ticker" minlength="3" maxlength="5" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<label for="price" class="block text-sm font-medium text-gray-700 mt-2">Price per Share</label>
<input required placeholder="CAD" min="0" id="price" type="number" name="price" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<label for="quantity" class="block text-sm font-medium text-gray-700 mt-2">Quantity of Shares</label>
<input required type="number" min="1" id="quantity" name="quantity" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<label for="purchaseDate" class="block text-sm font-medium text-gray-700 mt-2">Date of Purchase</label>
<input required type="date" id="purchaseDate" name="purchaseDate" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<div class="mt-6 flex flex-row justify-between">
<button
type="reset"
onclick="document.getElementById('create-stock-asset-form').reset()"
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Clear
</button>
<button
type="submit"
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Create
</button>
</div>
</form>
</dialog>
<%- include("./partials/createAsset", { icons: icons }) %>
<% if (errMessage != "") { %>
<div class="max-w-md mx-auto mb-10 rounded-lg shadow-md text-white font-bold bg-red-400 py-4 text-center"><%= errMessage %></div>
@@ -196,183 +47,11 @@
</div>
<% } %>
<% assets.forEach((asset) => { %>
<!-- Clickable asset list item -->
<div class="mt-4 max-w-md mx-auto bg-white rounded-lg shadow-md">
<button onclick="document.getElementById('<%= asset._id %>-modal').showModal()" style="width: 100%; height: 100%;" class="px-4 py-4 cursor-pointer">
<div class="flex flex-row justify-between">
<div class="flex flex-row justify-between">
<div class="mx-2">
<img src="/static/svgs/icons/<%= asset.icon %>.svg" class="h-6 w-6 me-2" alt="<%= asset.icon %>">
</div>
<div class="mx-2"><h3><%= asset.name %></h3></div>
</div>
<div>
<h3><strong>
$<%= asset.value.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}) %>
</strong></h3>
</div>
</div>
</button>
</div>
<%- include("./partials/assetPreview", { asset: asset }); %>
<!-- Confirm delete asset modal -->
<dialog id="<%= asset._id %>-delete-modal" class="w-lg mx-auto bg-transparent p-8 mt-10 rounded-lg shadow-md">
<div class="relative p-4 w-full max-w-md h-full md:h-auto">
<!-- Modal content -->
<div class="relative p-4 text-center bg-white rounded-lg shadow dark:bg-gray-800 sm:p-5">
<form method="dialog">
<button type="submit" class="text-gray-400 absolute top-2.5 right-2.5 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white">
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
<span class="sr-only">Close modal</span>
</button>
</form>
<svg class="text-gray-400 dark:text-gray-500 w-11 h-11 mb-3.5 mx-auto" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z" clip-rule="evenodd"></path></svg>
<p class="mb-4 text-gray-500 dark:text-gray-300">Are you sure you want to delete this item?</p>
<div class="flex justify-center items-center space-x-4">
<div style="width: 100%;">
<form method="dialog" style="width: 100%;">
<button
type="submit"
class="py-2 px-3 text-sm font-medium text-gray-500 bg-white rounded-lg border border-gray-200 hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-primary-300 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"
>
No, cancel
</button>
</form>
</div>
<div style="width: 100%;">
<form method="POST" action="/deleteAsset">
<input id="id-delete-<%= asset._id %>" name="id" type="text" hidden value="<%= asset._id %>">
<button
type="submit"
class="py-2 px-3 text-sm font-medium text-center text-white bg-red-600 rounded-lg hover:bg-red-700 focus:ring-4 focus:outline-none focus:ring-red-300 dark:bg-red-500 dark:hover:bg-red-600 dark:focus:ring-red-900"
>
Yes, I'm sure
</button>
</form>
</div>
</div>
</div>
</div>
</dialog>
<%- include("./partials/assetDelete", { asset: asset }); %>
<!-- View/edit popup modal for asset -->
<dialog id="<%= asset._id %>-modal" class="w-lg mx-auto bg-white p-8 mt-10 rounded-lg shadow-md">
<div class="flex flex-row justify-between">
<div style="width: 45%;">
<form method="dialog" style="width: 100%;">
<button
style="width: 100%;"
onclick="lockAsset('<%= asset._id %>', '<%= asset.icon %>')"
type="submit"
class="text-center w-sm py-2 py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Close
</button>
</form>
</div>
<div style="width: 45%;">
<button
style="width: 100%;"
type="submit"
class="text-center w-sm py-2 py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 cursor-pointer"
onclick="document.getElementById('<%= asset._id %>-delete-modal').showModal()"
>
Delete
</button>
</div>
</div>
<br>
<div class="flex flex-row justify-between">
<% if (asset.type == "other") { %>
<div class="flex items-center">
<button id="dropdown-icon-button-<%= asset._id %>" value="" data-dropdown-toggle="dropdown-icons-<%= asset._id %>" class="shrink-0 z-10 inline-flex items-center py-2.5 px-4 text-sm font-medium text-center border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none" type="button">
<img src="/static/svgs/icons/<%= asset.icon %>.svg" class="h-4 w-4 me-2" alt="<%= asset.icon %>"> <%= asset.icon %>
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
</svg>
</button>
<div id="dropdown-icons-<%= asset._id %>" class="overflow-y-auto h-40 z-10 hidden bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-32 dark:bg-gray-700">
<ul id="dropdown-<%= asset._id %>" class="py-2 text-sm text-gray-700 dark:text-gray-200" aria-labelledby="dropdown-icon-button-<%= asset._id %>">
<% icons.forEach(icon => { %>
<li>
<button onclick="selectIcon(this, '<%= asset._id %>')" type="button" value="<%= icon %>" class="inline-flex w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-600 dark:hover:text-white" role="menuitem">
<span class="inline-flex items-center">
<img src="/static/svgs/icons/<%= icon %>.svg" class="h-4 w-4 me-2" alt="<%= icon %>"> (<%= icon %>)
</span>
</button>
</li>
<% }); %>
</ul>
</div>
</div>
<% } else { %>
<button disabled class="inline-flex items-center py-2.5 px-10 text-sm font-medium text-center border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none" type="button">
<img src="/static/svgs/icons/<%= asset.icon %>.svg" class="h-4 w-4" alt="<%= asset.icon %>">
</button>
<% } %>
<h2 class="text-xl font-medium tracking-tight leading-none mt-3"><%= String(asset.type).charAt(0).toUpperCase() + String(asset.type).slice(1); %> Asset</h2>
<div>
<button
id="edit-<%= asset._id %>"
onclick="unlockAsset('<%= asset._id %>')"
class="py-3 px-8 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Edit
</button>
</div>
</div>
<br>
<form id="<%= asset._id %>-form" method="POST" action="/updateAsset">
<input id="type-<%= asset._id %>" name="type" type="text" hidden value="<%= asset.type %>">
<input id="id-<%= asset._id %>" name="id" type="text" hidden value="<%= asset._id %>">
<input id="userId-<%= asset.userId %>" name="userId" type="text" hidden value="<%= asset.userId %>">
<input id="icon-<%= asset._id %>" name="icon" type="text" hidden value="<%= asset.icon %>">
<% if (asset.type != "stock") { %>
<label for="name" class="block text-sm font-medium text-gray-700 mt-6">Name</label>
<input id="name-<%= asset._id %>" disabled type="text" name="name" value="<%= asset.name %>" class="mt-1 mb-2 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<% } else { %>
<label for="ticker" class="block text-sm font-medium text-gray-700 mt-2">Stock Ticker</label>
<input id="ticker-<%= asset._id %>" disabled type="text" name="ticker" value="<%= asset.ticker %>" class="mt-1 mb-2 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<% } %>
<hr class="h-px mt-6 mb-4 bg-gray-500 border-0 mx-10">
<% if (asset.type != "stock") { %>
<label for="value" class="block text-sm font-medium text-gray-700">Value</label>
<input id="value-<%= asset._id %>" disabled type="number" name="value" value="<%= asset.value %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<% } else { %>
<label for="price" class="block text-sm font-medium text-gray-700 mt-2">Price per Share</label>
<input id="price-<%= asset._id %>" disabled type="number" name="price" value="<%= asset.price %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<label for="quantity" class="block text-sm font-medium text-gray-700 mt-2">Quantity of Shares</label>
<input id="quantity-<%= asset._id %>" disabled type="number" name="quantity" value="<%= asset.quantity %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<% } %>
<% if (asset.type == "other") { %>
<label for="description" class="block text-sm font-medium text-gray-700 mt-2">Description</label>
<textarea disabled maxlength="240" id="description-<%= asset._id %>" name="description" rows="4" cols="50" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none"><%= asset.description %></textarea>
<% } %>
<% if (asset.type != "saving") { %>
<label for="purchaseDate" class="block text-sm font-medium text-gray-700 mt-2">Purchased on</label>
<input id="purchaseDate-<%= asset._id %>" disabled type="date" name="purchaseDate" value="<%= asset.purchaseDate %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<% } %>
<br>
<small class="block text-sm font-medium text-gray-700">Last Modified: <%= asset.updatedAt %></small>
<br>
<div>
<button id="save-<%= asset._id %>" disabled type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-not-allowed">
Save
</button>
</div>
</form>
</dialog>
<%- include("./partials/assetModify", { asset: asset }); %>
<% }) %>
</section>
</main>
@@ -382,9 +61,10 @@
<script src="/static/scripts/assetManager.js"></script>
<script>
// Ensure all assets popup modals are locked and reset on page load
<% assets.forEach((asset) => { %>
lockAsset("<%= asset._id %>", "<%= asset.icon %>");
<% }) %>
let assets = <%- JSON.stringify(assets) %>;
assets.forEach((asset) => {
lockAsset(asset._id, asset.icon);
});
</script>
<%- include("./partials/navBar") %>
+7 -98
View File
@@ -11,108 +11,17 @@
class="text-center cursor-pointer min-w-[150px] bg-green-600 px-4 py-2 text-white rounded hover:bg-green-800"
type="button">Create new plan </a>
</div>
<!--This is the cards for plans and other things-->
<div class="mt-4">
<!--box to put logo icon if we want on in a box-->
<!-- <div -->
<!-- class="bg-clip-border mx-4 rounded-xl overflow-hidden bg-gradient-to-tr from-blue-600 to-blue-400 text-white shadow-blue-500/40 shadow-lg absolute mt-2 grid h-16 w-16 place-items-center"> -->
<!-- </div> -->
<!--This is the cards for plans and other things-->
<div class="">
<div class="mb-12 grid gap-y-10 gap-x-6 md:grid-cols-2 mr-3 ml-3 xl:grid-cols-4">
<!--box to put logo icon if we want on in a box-->
<div class=" relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
<!-- <div -->
<!-- class="bg-clip-border mx-4 rounded-xl overflow-hidden bg-gradient-to-tr from-blue-600 to-blue-400 text-white shadow-blue-500/40 shadow-lg absolute mt-2 grid h-16 w-16 place-items-center"> -->
<!-- </div> -->
<div class="p-4 flex items-center justify-between">
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
Retirement goal</p>
<h4
class="block text-right antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900">
$53k</h4>
</div>
<div class="border-t border-blue-gray-50 p-10">
<p
class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
<strong class="text-green-500">Make this percent bar or graph or
something
</strong>&nbsp;than lastweek
</p>
</div>
</div>
<div class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
<div class="p-4 flex items-center justify-between">
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
Retirement goal</p>
<h4
class="block text-right antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900">
$53k</h4>
</div>
<div class="border-t border-blue-gray-50 p-10">
<p
class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
<strong class="text-green-500">Make this percent bar or graph or
something
</strong>&nbsp;than last
week
</p>
</div>
</div>
<div class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
<!-- <div -->
<!-- class="bg-clip-border mx-4 rounded-xl overflow-hidden bg-gradient-to-tr from-green-600 to-green-400 text-white shadow-green-500/40 shadow-lg absolute -mt-4 grid h-16 w-16 place-items-center"> -->
<!-- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" -->
<!-- class="w-6 h-6 text-white"> -->
<!-- <path -->
<!-- d="M6.25 6.375a4.125 4.125 0 118.25 0 4.125 4.125 0 01-8.25 0zM3.25 19.125a7.125 7.125 0 0114.25 0v.003l-.001.119a.75.75 0 01-.363.63 13.067 13.067 0 01-6.761 1.873c-2.472 0-4.786-.684-6.76-1.873a.75.75 0 01-.364-.63l-.001-.122zM19.75 7.5a.75.75 0 00-1.5 0v2.25H16a.75.75 0 000 1.5h2.25v2.25a.75.75 0 001.5 0v-2.25H22a.75.75 0 000-1.5h-2.25V7.5z"> -->
<!-- </path> -->
<!-- </svg> -->
<!-- </div> -->
<!-- we can use this later if needed not sure what it shoudl be for right now. -->
<!-- <div class="p-4 text-right"> -->
<!-- <p class="block antialiased font-sans text-sm leading-normal font-normal text-blue-gray-600">New Clients -->
<!-- </p> -->
<!-- <h4 -->
<!-- class="block antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900"> -->
<!-- 3,462</h4> -->
<!-- </div> -->
<!-- <div class="border-t border-blue-gray-50 p-4"> -->
<!-- <p class="block antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600"> -->
<!-- <strong class="text-red-500">-2%</strong>&nbsp;than yesterday -->
<!-- </p> -->
<!-- </div> -->
<!-- </div> -->
<div
class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
<div
class="relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md">
<div class="p-4 flex items-center justify-between">
<p class="font-sans text-2xl leading-normal font-normal text-blue-gray-600">
Retirement goal</p>
<h4
class="block text-right antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900">
$53k</h4>
</div>
<div class="border-t border-blue-gray-50 p-10">
<p
class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
<strong class="text-green-500">Make this percent bar or
graph or something
</strong>&nbsp;than last
week
</p>
</div>
</div>
</div>
</div>
</div>
<div class="text-blue-gray-600">
</div>
<div class="flex justify-center sm:px-6 w-full ">
<div class="mb-12 grid gap-y-4 gap-x-6 md:grid-cols-2 ">
<% plans.forEach(plan=> { %>
<%- include('./partials/dashboardBox.ejs', {plan: plan}) %>
<% }); %>
</div>
</div>
</main>
<script src="/static/scripts/dollarFormat.js"></script>
<%- include("./partials/navBar") %>
<%- include("./partials/scriptLoader") %>
<%- include("./partials/footer") %>
+22 -18
View File
@@ -1,33 +1,37 @@
<%- include("./partials/fileHeader") %>
<%- include("./partials/headerStart") %>
<main>
<div class="flex justify-center items-center h-screen">
<main class="pt-12 bg-slate-100 min-h-screen">
<div class="flex justify-center items-center py-10">
<form action="/auth/resetPass" method="POST">
<div class="w-96 p-6 shadow-1g bg-white rounded-md">
<h1 class="text-3xl block text-center font-semibold">Reset Password</h1>
<hr class="mt-3">
<div class="w-96 p-8 bg-white rounded-lg shadow-xl border border-slate-200">
<h1 class="text-3xl block text-center font-semibold text-slate-700">Reset Password</h1>
<hr class="mt-4 mb-6 border-slate-300">
<% if (!reset ) { %>
<div class="mt-3">
<label for="email" class="block text-base mb-2">Email</label>
<div class="mt-4">
<label for="email" class="block text-base mb-2 text-slate-600">Email</label>
<input type="text" id="email" name="email"
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
class="border border-slate-300 focus:border-indigo-500 w-full rounded-md text-base px-3 py-2 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-colors duration-200"
placeholder="Enter Email" />
</div>
<% } else { %>
<div class="mt-3">
<h1 class="text-2xl block text-center font-bold text-red-600"> Reset link sent. </h1>
<div class="mt-4 text-center">
<h2 class="text-xl font-semibold text-green-600">Reset link sent.</h2>
<p class="text-sm text-slate-600 mt-2">Please check your email inbox (and spam folder).</p>
</div>
<% } %>
<!---->
<div class="text-red-800 font-bold" id="forgor">
<%= error%>
</div>
<% if (typeof error !== 'undefined' && error && error.length > 0) { %>
<div class="mt-3 text-red-600 font-semibold text-sm" id="forgor"><%= error %></div>
<% } else if (!reset) { %>
<div class="mt-3 h-5" id="forgor"></div> <% /* Placeholder for layout consistency */ %>
<% } %>
<% if (!reset) { %>
<div class="mt-5">
<div class="mt-6">
<button type="submit"
class="cursor-pointer border-2 border-gray-600 bg-blue-600 text-white py-1 w-full rounded-md hover:bg-transparent hover:text-indigo-700 font-semibold">Send
reset Link</button>
class="border-2 border-indigo-600 bg-indigo-600 text-white py-2 w-full rounded-md hover:bg-indigo-700 hover:border-indigo-700 font-semibold transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">Send Reset Link</button>
</div>
<% } %>
</div>
@@ -35,4 +39,4 @@
</div>
</main>
<%- include("./partials/footer") %> <%- include("./partials/footer") %>
<%- include("./partials/footer") %>
+26 -22
View File
@@ -1,41 +1,45 @@
<%- include("./partials/fileHeader") %>
<%- include("./partials/headerStart") %>
<main class="pt-24">
<div class="flex justify-center items-center">
<main class="pt-12 bg-slate-100 min-h-screen">
<div class="flex justify-center items-center py-10">
<form action="/login" method="POST">
<div class="w-96 p-6 shadow-1g bg-white rounded-md">
<h1 class="text-3xl block text-center font-semibold">Login</h1>
<hr class="mt-3">
<div class="mt-3">
<label for="email" class="block text-base mb-2">Email</label>
<div class="w-96 p-8 bg-white rounded-lg shadow-xl border border-slate-200">
<h1 class="text-3xl block text-center font-semibold text-slate-700">Login</h1>
<hr class="mt-4 mb-6 border-slate-300">
<div class="mt-4">
<label for="email" class="block text-base mb-2 text-slate-600">Email</label>
<input type="text" id="email" name="email"
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
class="border border-slate-300 focus:border-indigo-500 w-full rounded-md text-base px-3 py-2 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-colors duration-200"
placeholder="Enter Email" />
</div>
<div class="mt-3">
<label for="password" class="block text-base mb-2">Password</label>
<div class="mt-4">
<label for="password" class="block text-base mb-2 text-slate-600">Password</label>
<input type="password" id="password" name="password"
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
class="border border-slate-300 focus:border-indigo-500 w-full rounded-md text-base px-3 py-2 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-colors duration-200"
placeholder="Enter Password" />
</div>
<div class="text-red-800 font-bold" id="forgor"> <%= errMessage %></div>
<div class="mt-3 flex justify-between items-center">
<div>
<input type="checkbox">
<label>Remember me</label>
<% if (errMessage && errMessage.length > 0) { %>
<div class="mt-3 text-red-600 font-semibold text-sm" id="forgor"> <%= errMessage %></div>
<% } else { %>
<div class="mt-3 h-5" id="forgor"></div> <% /* Placeholder to maintain layout when no error */ %>
<% } %>
<div class="mt-4 flex justify-between items-center">
<div class="flex items-center">
<input type="checkbox" id="rememberMe" class="h-4 w-4 text-indigo-600 border-slate-300 rounded focus:ring-indigo-500">
<label for="rememberMe" class="ml-2 text-sm text-slate-600">Remember me</label>
</div>
<div>
<a href="/forgotPassword" class="text-indigo-600 font-semibold">Forgot Password? </a>
<a href="/forgotPassword" class="text-sm text-indigo-600 hover:text-indigo-500 font-semibold transition-colors duration-200">Forgot Password? </a>
</div>
</div>
<div class="mt-5">
<div class="mt-6">
<button type="submit"
class="border-2 border-gray-600 bg-blue-600 text-white py-1 w-full rounded-md hover:bg-transparent hover:text-indigo-700 font-semibold">Login</button>
class="border-2 border-indigo-600 bg-indigo-600 text-white py-2 w-full rounded-md hover:bg-indigo-700 hover:border-indigo-700 font-semibold transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">Login</button>
</div>
<div class="mt-5 block justify-between items-center">
<label>Don't have an account?</label>
<a href="/signup" class="text-indigo-600 font-semibold">Register</a>
<div class="mt-6 text-center">
<span class="text-sm text-slate-600">Don't have an account?</span>
<a href="/signup" class="text-sm text-indigo-600 hover:text-indigo-500 font-semibold ml-1 transition-colors duration-200">Register</a>
</div>
</div>
</form>
+39
View File
@@ -0,0 +1,39 @@
<!-- Confirm delete asset modal -->
<dialog id="<%= asset._id %>-delete-modal" class="w-lg mx-auto bg-transparent p-8 mt-10 rounded-lg shadow-md">
<div class="relative p-4 w-full max-w-md h-full md:h-auto">
<!-- Modal content -->
<div class="relative p-4 text-center bg-white rounded-lg shadow dark:bg-gray-800 sm:p-5">
<form method="dialog">
<button type="submit" class="text-gray-400 absolute top-2.5 right-2.5 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white">
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
<span class="sr-only">Close modal</span>
</button>
</form>
<svg class="text-gray-400 dark:text-gray-500 w-11 h-11 mb-3.5 mx-auto" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z" clip-rule="evenodd"></path></svg>
<p class="mb-4 text-gray-500 dark:text-gray-300">Are you sure you want to delete this item?</p>
<div class="flex justify-center items-center space-x-4">
<div style="width: 100%;">
<form method="dialog" style="width: 100%;">
<button
type="submit"
class="py-2 px-3 text-sm font-medium text-gray-500 bg-white rounded-lg border border-gray-200 hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-primary-300 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600"
>
No, cancel
</button>
</form>
</div>
<div style="width: 100%;">
<form method="POST" action="/deleteAsset">
<input id="id-delete-<%= asset._id %>" name="id" type="text" hidden value="<%= asset._id %>">
<button
type="submit"
class="py-2 px-3 text-sm font-medium text-center text-white bg-red-600 rounded-lg hover:bg-red-700 focus:ring-4 focus:outline-none focus:ring-red-300 dark:bg-red-500 dark:hover:bg-red-600 dark:focus:ring-red-900"
>
Yes, I'm sure
</button>
</form>
</div>
</div>
</div>
</div>
</dialog>
+119
View File
@@ -0,0 +1,119 @@
<!-- View/edit popup modal for asset -->
<dialog id="<%= asset._id %>-modal" class="w-lg mx-auto bg-white p-8 mt-10 rounded-lg shadow-md">
<div class="flex flex-row justify-between">
<div style="width: 45%;">
<form method="dialog" style="width: 100%;">
<button
style="width: 100%;"
onclick="lockAsset('<%= asset._id %>', '<%= asset.icon %>')"
type="submit"
class="text-center w-sm py-2 py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Close
</button>
</form>
</div>
<div style="width: 45%;">
<button
style="width: 100%;"
type="submit"
class="text-center w-sm py-2 py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 cursor-pointer"
onclick="document.getElementById('<%= asset._id %>-delete-modal').showModal()"
>
Delete
</button>
</div>
</div>
<br>
<div class="flex flex-row justify-between">
<% if (asset.type == "other") { %>
<div class="flex items-center">
<button id="dropdown-icon-button-<%= asset._id %>" value="" data-dropdown-toggle="dropdown-icons-<%= asset._id %>" class="shrink-0 z-10 inline-flex items-center py-2.5 px-4 text-sm font-medium text-center border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none" type="button">
<img src="/static/svgs/icons/<%= asset.icon %>.svg" class="h-4 w-4 me-2" alt="<%= asset.icon %>"> <%= asset.icon %>
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
</svg>
</button>
<div id="dropdown-icons-<%= asset._id %>" class="overflow-y-auto h-40 z-10 hidden bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-32 dark:bg-gray-700">
<ul id="dropdown-<%= asset._id %>" class="py-2 text-sm text-gray-700 dark:text-gray-200" aria-labelledby="dropdown-icon-button-<%= asset._id %>">
<% icons.forEach(icon => { %>
<li>
<button onclick="selectIcon(this, '<%= asset._id %>')" type="button" value="<%= icon %>" class="inline-flex w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-600 dark:hover:text-white" role="menuitem">
<span class="inline-flex items-center">
<img src="/static/svgs/icons/<%= icon %>.svg" class="h-4 w-4 me-2" alt="<%= icon %>"> (<%= icon %>)
</span>
</button>
</li>
<% }); %>
</ul>
</div>
</div>
<% } else { %>
<button disabled class="inline-flex items-center py-2.5 px-10 text-sm font-medium text-center border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none" type="button">
<img src="/static/svgs/icons/<%= asset.icon %>.svg" class="h-4 w-4" alt="<%= asset.icon %>">
</button>
<% } %>
<h2 class="text-xl font-medium tracking-tight leading-none mt-3"><%= String(asset.type).charAt(0).toUpperCase() + String(asset.type).slice(1); %> Asset</h2>
<div>
<button
id="edit-<%= asset._id %>"
onclick="unlockAsset('<%= asset._id %>')"
class="py-3 px-8 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Edit
</button>
</div>
</div>
<br>
<form id="<%= asset._id %>-form" method="POST" action="/updateAsset">
<input id="type-<%= asset._id %>" name="type" type="text" hidden value="<%= asset.type %>">
<input id="id-<%= asset._id %>" name="id" type="text" hidden value="<%= asset._id %>">
<input id="userId-<%= asset.userId %>" name="userId" type="text" hidden value="<%= asset.userId %>">
<input id="icon-<%= asset._id %>" name="icon" type="text" hidden value="<%= asset.icon %>">
<% if (asset.type != "stock") { %>
<label for="name" class="block text-sm font-medium text-gray-700 mt-6">Name</label>
<input id="name-<%= asset._id %>" disabled type="text" name="name" value="<%= asset.name %>" class="mt-1 mb-2 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<% } else { %>
<label for="ticker" class="block text-sm font-medium text-gray-700 mt-2">Stock Ticker</label>
<input id="ticker-<%= asset._id %>" disabled type="text" name="ticker" value="<%= asset.ticker %>" class="mt-1 mb-2 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<% } %>
<hr class="h-px mt-6 mb-4 bg-gray-500 border-0 mx-10">
<% if (asset.type != "stock") { %>
<label for="value" class="block text-sm font-medium text-gray-700">Value</label>
<input id="value-<%= asset._id %>" disabled type="number" name="value" value="<%= asset.value %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<% } else { %>
<label for="price" class="block text-sm font-medium text-gray-700 mt-2">Price per Share</label>
<input id="price-<%= asset._id %>" disabled type="number" name="price" value="<%= asset.price %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<label for="quantity" class="block text-sm font-medium text-gray-700 mt-2">Quantity of Shares</label>
<input id="quantity-<%= asset._id %>" disabled type="number" name="quantity" value="<%= asset.quantity %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<% } %>
<% if (asset.type == "other") { %>
<label for="description" class="block text-sm font-medium text-gray-700 mt-2">Description</label>
<textarea disabled maxlength="240" id="description-<%= asset._id %>" name="description" rows="4" cols="50" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none"><%= asset.description %></textarea>
<% } %>
<% if (asset.type != "saving") { %>
<label for="purchaseDate" class="block text-sm font-medium text-gray-700 mt-2">Purchased on</label>
<input id="purchaseDate-<%= asset._id %>" disabled type="date" name="purchaseDate" value="<%= asset.purchaseDate %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<% } %>
<br>
<small class="block text-sm font-medium text-gray-700">Last Modified: <%= asset.updatedAt %></small>
<br>
<div>
<button id="save-<%= asset._id %>" disabled type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-not-allowed">
Save
</button>
</div>
</form>
</dialog>
+18
View File
@@ -0,0 +1,18 @@
<!-- Clickable asset list item -->
<div class="mt-4 max-w-md mx-auto bg-white rounded-lg shadow-md">
<button onclick="document.getElementById('<%= asset._id %>-modal').showModal()" style="width: 100%; height: 100%;" class="px-4 py-4 cursor-pointer">
<div class="flex flex-row justify-between">
<div class="flex flex-row justify-between">
<div class="mx-2">
<img src="/static/svgs/icons/<%= asset.icon %>.svg" class="h-6 w-6 me-2" alt="<%= asset.icon %>">
</div>
<div class="mx-2"><h3><%= asset.name %></h3></div>
</div>
<div>
<h3><strong>
$<%= asset.value.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}) %>
</strong></h3>
</div>
</div>
</button>
</div>
+150
View File
@@ -0,0 +1,150 @@
<!-- Create Asset popup Modal -->
<dialog id="create-asset-modal" class="w-lg mx-auto bg-white p-8 mt-10 rounded-lg shadow-md">
<div class="flex flex-row justify-between">
<h2 class="text-lg font-bold mb-2">Create New Asset</h2>
<form method="dialog">
<button
onclick="resetAll()"
type="submit"
class="text-center py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Cancel
</button>
</form>
</div>
<div class="my-4">
<label class="block text-sm font-medium text-gray-700">Asset Type</label>
<div class="mt-1 space-x-4">
<label class="inline-flex items-center">
<input checked onclick="selectAssetForm('create-other-asset-form')" id="asset-other" type="radio" name="type" value="other" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 cursor-pointer">
<span class="ml-2 text-sm text-gray-700">Other Assets</span>
</label>
<label class="inline-flex items-center">
<input onclick="selectAssetForm('create-saving-asset-form')" id="asset-saving" type="radio" name="type" value="saving" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 cursor-pointer">
<span class="ml-2 text-sm text-gray-700">Savings</span>
</label>
<label class="inline-flex items-center">
<input onclick="selectAssetForm('create-stock-asset-form')" id="asset-stock" type="radio" name="type" value="stock" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 cursor-pointer">
<span class="ml-2 text-sm text-gray-700">Stocks</span>
</label>
</div>
</div>
<!-- Create other asset form -->
<form method="POST" action="/createAsset" id="create-other-asset-form">
<input style="display: none;" id="type" value="other" name="type" type="text">
<input style="display: none;" id="icon" value="Other" name="icon" type="text">
<label for="name" class="block text-sm font-medium text-gray-700 mt-2">Select an Icon</label>
<div class="flex items-center">
<button id="dropdown-icon-button" value="" data-dropdown-toggle="dropdown-icons" class="shrink-0 z-10 inline-flex items-center py-2.5 px-4 text-sm font-medium text-center border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" type="button">
<img src="/static/svgs/icons/Other.svg" class="h-4 w-4 me-2" alt="Other"> Other
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
</svg>
</button>
<div id="dropdown-icons" class="overflow-y-auto h-40 z-10 hidden bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-32 dark:bg-gray-700">
<ul id="dropdown" class="py-2 text-sm text-gray-700 dark:text-gray-200" aria-labelledby="dropdown-icon-button">
<% icons.forEach(icon => { %>
<li>
<button onclick="selectIcon(this)" type="button" value="<%= icon %>" class="inline-flex w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-600 dark:hover:text-white" role="menuitem">
<span class="inline-flex items-center">
<img src="/static/svgs/icons/<%= icon %>.svg" class="h-4 w-4 me-2" alt="<%= icon %>"> (<%= icon %>)
</span>
</button>
</li>
<% }); %>
</ul>
</div>
</div>
<label for="name" class="block text-sm font-medium text-gray-700 mt-2">Asset Name</label>
<input required id="name" type="text" name="name" minlength="3" maxlength="30" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<label for="value" class="block text-sm font-medium text-gray-700 mt-2">Asset Value</label>
<input required placeholder="CAD" min="0" id="value" type="number" name="value" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<label for="purchaseDate" class="block text-sm font-medium text-gray-700 mt-2">Date of Purchase</label>
<input required type="date" id="purchaseDate" name="purchaseDate" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<label for="description" class="block text-sm font-medium text-gray-700 mt-2">Description</label>
<textarea maxlength="240" id="description" name="description" rows="4" cols="50" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"></textarea>
<div class="mt-6 flex flex-row justify-between">
<button
type="reset"
onclick="document.getElementById('create-other-asset-form').reset()"
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Clear
</button>
<button
type="submit"
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Create
</button>
</div>
</form>
<!-- Create savings asset form -->
<form style="display: none;" method="POST" action="/createAsset" id="create-saving-asset-form">
<input style="display: none;" value="saving" name="type" type="text">
<label for="name" class="block text-sm font-medium text-gray-700 mt-2">Savings Name</label>
<input required id="name" type="text" name="name" minlength="3" maxlength="30" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<label for="value" class="block text-sm font-medium text-gray-700 mt-2">Savings Value</label>
<input required placeholder="CAD" min="0" id="value" type="number" name="value" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<div class="mt-6 flex flex-row justify-between">
<button
type="reset"
onclick="document.getElementById('create-saving-asset-form').reset()"
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Clear
</button>
<button
type="submit"
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Create
</button>
</div>
</form>
<!-- Create stock asset form -->
<form style="display: none;" method="POST" action="/createAsset" id="create-stock-asset-form">
<input style="display: none;" value="stock" name="type" type="text">
<label for="ticker" class="block text-sm font-medium text-gray-700 mt-2">Stock Ticker</label>
<input required id="ticker" type="text" name="ticker" minlength="3" maxlength="5" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<label for="price" class="block text-sm font-medium text-gray-700 mt-2">Price per Share</label>
<input required placeholder="CAD" min="0" id="price" type="number" name="price" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<label for="quantity" class="block text-sm font-medium text-gray-700 mt-2">Quantity of Shares</label>
<input required type="number" min="1" id="quantity" name="quantity" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<label for="purchaseDate" class="block text-sm font-medium text-gray-700 mt-2">Date of Purchase</label>
<input required type="date" id="purchaseDate" name="purchaseDate" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<div class="mt-6 flex flex-row justify-between">
<button
type="reset"
onclick="document.getElementById('create-stock-asset-form').reset()"
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Clear
</button>
<button
type="submit"
class="text-center w-sm py-2 mx-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer"
>
Create
</button>
</div>
</form>
</dialog>
+35
View File
@@ -0,0 +1,35 @@
<div class="mt-12">
<a href="/plans/<%=plan._id%>">
<div class=" relative flex flex-col bg-clip-border rounded-xl bg-white text-gray-700 shadow-md w-full min-h-[130px] min-w-[340px]
md:min-h-[220px] md:min-w-[500px]">
<!-- <div -->
<!-- class="bg-clip-border mx-4 rounded-xl overflow-hidden bg-gradient-to-tr from-blue-600 to-blue-400 text-white shadow-blue-500/40 shadow-lg absolute mt-2 grid h-16 w-16 place-items-center"> -->
<!-- </div> -->
<div class="p-4 flex items-center justify-between">
<p class="font-sans text-2xl leading-normal font-bold text-blue-gray-600">
<%= plan.name %>
</p>
<h4
class="planGoal block text-right antialiased tracking-normal font-sans text-2xl font-semibold leading-snug text-blue-gray-900">
<%= plan.retirementAssets %>
</h4>
</div>
<div class="border-t border-blue-gray-50 p-10">
<div class="float-left font-bold">
<p class=" antialiased font-sans text-base leading-relaxed font-normal text-blue-gray-600">
Status bar:
</p>
</div>
<strong class="text-green-500">
<div class="float-right mb-2">
<%=Math.floor(plan.progress) %>% complete
</div>
<div class="bg-gray-400 mt-7">
<div class="bg-green-600 h-2.5 rounded-full dark:bg-green-500"
style="width: <%= plan.progress %>%;"></div>
</div>
</div>
</div>
</a>
</div>
+14 -19
View File
@@ -1,33 +1,28 @@
<div data-dial-init class="fixed end-6 bottom-20 group">
<button type="button" id="punButton" class="flex items-center justify-center text-white bg-blue-700 rounded-full w-14 h-14 hover:bg-blue-800 dark:bg-blue-600 dark:hover:bg-blue-700 focus:ring-4 focus:ring-blue-300 focus:outline-none dark:focus:ring-blue-800">
<div class="fixed end-6 bottom-20 group">
<div id="factMenu" class="absolute right-0 bottom-full mb-2 hidden">
<div id="factContainer" class="bg-white p-4 rounded-lg shadow-md dark:bg-gray-700 w-64">
<p class="mb-2 text-sm text-gray-700 dark:text-gray-300">Insert the kind of short fact you would like to know more about:</p>
<input type="text" id="factInput" placeholder="Enter your topic here" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-600 dark:border-gray-500 dark:text-white dark:placeholder-gray-400">
<button type="button" id="factSubmitButton" class="mt-3 w-full px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-700">Submit</button>
</div>
</div>
<button type="button" id="factButton" class="flex items-center justify-center text-white bg-blue-700 rounded-full w-14 h-14 hover:bg-blue-800 dark:bg-blue-600 dark:hover:bg-blue-700 focus:ring-4 focus:ring-blue-300 focus:outline-none dark:focus:ring-blue-800 hidden">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"></path></svg>
<span class="sr-only">Get a Pun</span>
<span class="sr-only">Get a Fact</span>
</button>
</div>
<footer>
<div class="fixed bottom-0 left-0 z-50 hidden lg:block w-full h-16 bg-gray-800 border-t border-gray-700 p-6 text-center text-gray-400 text-sm">
<footer class="mt-16">
<div class="fixed bottom-0 left-0 z-30 hidden lg:block w-full h-16 bg-gray-800 border-t border-gray-700 p-6 text-center text-gray-400 text-sm">
<div class="container mx-auto">
<p>&copy; 2025 RCalculator. All rights reserved.</p>
</div>
</div>
</footer>
<script src="/static/scripts/footer.js"></script>
<script src="https://cdn.jsdelivr.net/npm/flowbite@3.1.2/dist/flowbite.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
const punButton = document.getElementById("punButton");
punButton.addEventListener("click", () => {
fetch("/pun")
.then(response => response.json())
.then(data => {
Swal.fire('Here is a pun!', data.pun, 'success');
})
.catch(error => {
console.error("Error fetching pun:", error);
Swal.fire('Error fetching pun', 'Please try again later', 'error');
});
});
</script>
</body>
</html>
+5 -5
View File
@@ -1,6 +1,6 @@
<header>
<nav class="fixed bg-gray-800 border-b border-gray-700 z-50">
<nav class="fixed bg-gray-800 border-b border-gray-700 z-30">
<div class="w-screen flex flex-col md:flex-row flex-wrap items-center justify-between p-3">
<a href="/home" class="flex xl:w-[320px] items-center space-x-3 rtl:space-x-reverse">
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/rekor.png" class="h-8" alt="Flowbite Logo" />
@@ -86,7 +86,7 @@
</li>
<li>
<div class="text-center">
<button class="flex flex-row text-white hover:bg-blue-700 focus:ring-4 focus:ring-blue-300 font-medium rounded-full text-sm focus:outline-none dark:focus:ring-blue-800" type="button" data-drawer-target="drawer-navigation" data-drawer-show="drawer-navigation" data-drawer-placement="right" aria-controls="drawer-navigation">
<button class="flex flex-row text-white hover:bg-blue-700 focus:ring-4 focus:ring-blue-300 font-medium rounded-full text-sm focus:outline-none dark:focus:ring-blue-800" type="button" id="drawer-toggle" data-drawer-target="drawer-navigation" data-drawer-placement="right" aria-controls="drawer-navigation">
<svg class="w-[30px] h-[30px] text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 24 24">
<path fill-rule="evenodd" d="M12 20a7.966 7.966 0 0 1-5.002-1.756l.002.001v-.683c0-1.794 1.492-3.25 3.333-3.25h3.334c1.84 0 3.333 1.456 3.333 3.25v.683A7.966 7.966 0 0 1 12 20ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10c0 5.5-4.44 9.963-9.932 10h-.138C6.438 21.962 2 17.5 2 12Zm10-5c-1.84 0-3.333 1.455-3.333 3.25S10.159 13.5 12 13.5c1.84 0 3.333-1.455 3.333-3.25S13.841 7 12 7Z" clip-rule="evenodd"/>
</svg>
@@ -101,7 +101,9 @@
</div>
<!-- drawer component -->
<div id="drawer-navigation" class="hidden lg:block fixed top-0 right-0 z-40 w-64 h-screen p-4 overflow-y-auto transition-transform translate-x-full bg-white dark:bg-gray-800" tabindex="-1" aria-labelledby="drawer-navigation-label">
</div>
</nav>
<div id="drawer-navigation" class="lg:block fixed top-0 right-0 z-60 w-64 h-screen p-4 overflow-y-auto transition-transform translate-x-full bg-white dark:bg-gray-800" tabindex="-1" aria-labelledby="drawer-navigation-label">
<h5 id="drawer-navigation-label" class="text-base font-semibold text-gray-500 uppercase dark:text-gray-400"><%= user.name %></h5>
<button type="button" data-drawer-hide="drawer-navigation" aria-controls="drawer-navigation" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 absolute top-2.5 end-2.5 inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white" >
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
@@ -144,6 +146,4 @@
</ul>
</div>
</div>
</div>
</nav>
</header>
+1 -1
View File
@@ -1,7 +1,7 @@
<%- include("./partials/fileHeader") %>
<%- include("./partials/header") %>
<main class="container mx-auto p-4">
<main class="container mx-auto p-4 p-28">
<h2 class="text-xl text-white font-semibold mb-4">Welcome: <%= user.name %></h2>
<div class="max-w-lg mx-auto bg-white p-6 sm:p-8 rounded-xl shadow-lg space-y-6 dark:bg-gray-800">
+91 -50
View File
@@ -62,7 +62,7 @@
<input id="name" disabled type="text" name="name" value="<%= user.name %>" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<label for="password" class="block text-sm font-medium text-gray-700">New password</label>
<input id="password" disabled type="password" name="password" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<input id="password" disabled type="password" name="password" minlength="8" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<label for="repassword" class="block text-sm font-medium text-gray-700">Confirm new password</label>
<input id="repassword" disabled type="password" name="repassword" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
@@ -73,6 +73,96 @@
</form>
</div>
<!-- Questionnare details -->
<div class="mb-10 max-w-md mx-auto bg-white p-8 rounded-lg shadow-md">
<div class="flex flex-row justify-between">
<h3 class="pt-2 pr-2 pb-2">Personal information</h3>
<% if (user.financialData) { %>
<button id="edit-personal" onclick="unlockPersonal()" class="py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">Edit</button>
<% } %>
</div>
<% if (user.financialData) { %>
<form action="/updatePersonal" method="post" class="space-y-4" id="personal-form">
<div>
<label for="dob" class="block text-sm font-medium text-gray-700">Date of Birth</label>
<input
disabled
id="dob"
type="date"
name="dob"
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none"
<% let year = typeof(user.dob) == "object" ? user.dob.getFullYear() : user.dob.split('-')[0]; %>
<% let month = typeof(user.dob) == "object" ? user.dob.getMonth() : user.dob.split('-')[1] - 1; %>
<% let day = typeof(user.dob) == "object" ? user.dob.getDate() + 1 : user.dob.split('-')[2].split('T')[0];%>
<% let d = new Date(parseInt(year), parseInt(month), parseInt(day)); %>
value="<%= d.getFullYear() + "-" + ("0"+(d.getMonth()+1)).slice(-2) + "-" + ("0" + d.getDate()).slice(-2); %>"
>
</div>
<div>
<label for="education" class="block text-sm font-medium text-gray-700">Education</label>
<select disabled id="education" name="education" id="education" class="mt-1 block w-full px-3 py-2 border border-gray-300 bg-white rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<option <%= user.education == "primary" ? 'selected' : '' %> value="primary">Primary (Elementary)</option>
<option <%= user.education == "secondary" ? 'selected' : '' %> value="secondary">Secondary (High School)</option>
<option <%= user.education == "tertiary" ? 'selected' : '' %> value="tertiary">Tertiary (College/University)</option>
<option <%= user.education == "postgraduate" ? 'selected' : '' %> value="postgraduate">Postgraduate (Master's/PhD)</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700">Marital Status</label>
<div class="mt-1 space-x-4">
<label class="inline-flex items-center">
<input disabled <%= user.maritalStatus == "single" ? 'checked' : '' %> id="ms-single" type="radio" name="maritalStatus" value="single" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<span class="ml-2 text-sm text-gray-700">Single</span>
</label>
<label class="inline-flex items-center">
<input disabled <%= user.maritalStatus == "married" ? 'checked' : '' %> id="ms-married" type="radio" name="maritalStatus" value="married" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<span class="ml-2 text-sm text-gray-700">Married</span>
</label>
<label class="inline-flex items-center">
<input disabled <%= user.maritalStatus == "divorced" ? 'checked' : '' %> id="ms-divorced" type="radio" name="maritalStatus" value="divorced" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<span class="ml-2 text-sm text-gray-700">Divorced</span>
</label>
<label class="inline-flex items-center">
<input disabled <%= user.maritalStatus == "widowed" ? 'checked' : '' %> id="ms-widowed" type="radio" name="maritalStatus" value="widowed" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<span class="ml-2 text-sm text-gray-700">Widowed</span>
</label>
</div>
</div>
<div>
<label for="income" class="block text-sm font-medium text-gray-700">Annual Gross Income</label>
<input disabled value="<%= user.income %>" id="income" type="number" name="income" min="0" placeholder="e.g., 50000" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
</div>
<div>
<label for="expenses" class="block text-sm font-medium text-gray-700">Monthly Expenses</label>
<input disabled value="<%= user.expenses %>" id="expenses" type="number" name="expenses" min="0" placeholder="e.g., 2000" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
</div>
<div>
<label for="assets" class="block text-sm font-medium text-gray-700">Net Worth</label>
<input disabled value="<%= user.assets %>" id="assets" type="number" name="assets" min="0" placeholder="Estimated Net Worth" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
</div>
<div>
<label for="liabilities" class="block text-sm font-medium text-gray-700">Liabilities</label>
<input disabled value="<%= user.liabilities %>" id="liabilities" type="number" name="liabilities" min="0" placeholder="Estimated Liabilities" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
</div>
<div>
<button id="save-personal" disabled type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-not-allowed">Save</button>
</div>
</form>
<% } else { %>
<div>
<a href="/questionnaire?profile" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-pointer">Answer Questionnare</a>
</div>
<% } %>
</div>
<!-- Delete account -->
<div class="flex flex-row justify-center mx-auto p8">
<button
type="submit"
@@ -83,55 +173,6 @@
</button>
</div>
<!--
<div class="mb-10 max-w-md mx-auto bg-white p-8 rounded-lg shadow-md">
<div class="flex flex-row justify-between">
<h3 class="pt-2 pr-2 pb-2">Personal information</h3>
<button onclick="unlockPersonal()" class="py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">Edit</button>
</div>
<form action="/updatePersonal" method="post" class="space-y-4" id="personal-form">
<div>
<label for="dob" class="block text-sm font-medium text-gray-700">Date of Birth</label>
<input id="dob" disabled type="date" name="dob" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
</div>
<div>
<label for="education" class="block text-sm font-medium text-gray-700">Education</label>
<select disabled name="education" id="education" class="mt-1 block w-full px-3 py-2 border border-gray-300 bg-white rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<option value="primary">Primary (Elementary)</option>
<option value="secondary">Secondary (High School)</option>
<option value="tertiary">Tertiary (College/University)</option>
<option value="postgraduate">Postgraduate (Master's/PhD)</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700">Marital Status</label>
<div class="mt-1 space-x-4">
<label class="inline-flex items-center">
<input disabled id="ms-single" type="radio" name="maritalStatus" value="single" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<span class="ml-2 text-sm text-gray-700">Single</span>
</label>
<label class="inline-flex items-center">
<input disabled id="ms-married" type="radio" name="maritalStatus" value="married" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<span class="ml-2 text-sm text-gray-700">Married</span>
</label>
<label class="inline-flex items-center">
<input disabled id="ms-divorced" type="radio" name="maritalStatus" value="divorced" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<span class="ml-2 text-sm text-gray-700">Divorced</span>
</label>
<label class="inline-flex items-center">
<input disabled id="ms-widowed" type="radio" name="maritalStatus" value="widowed" class="form-radio h-4 w-4 text-indigo-600 border-gray-300 focus:ring-indigo-500 disabled:border-gray-200 disabled:bg-gray-50 disabled:text-gray-500 disabled:shadow-none">
<span class="ml-2 text-sm text-gray-700">Widowed</span>
</label>
</div>
</div>
<div>
<button id="save-personal" disabled type="submit" class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 cursor-not-allowed">Save</button>
</div>
</form>
</div> -->
<div class="mt-24"></div>
</main>
+26 -24
View File
@@ -1,44 +1,46 @@
<%- include("./partials/fileHeader") %>
<%- include("./partials/headerStart") %>
<main class="pt-24">
<div class="flex justify-center items-center">
<main class="pt-12 bg-slate-100 min-h-screen">
<div class="flex justify-center items-center py-10">
<form action="/signup" method="POST">
<div class="w-96 p-6 shadow-1g bg-white rounded-md">
<h1 class="text-3xl block text-center font-semibold">Signup</h1>
<hr class="mt-3">
<div class="mt-3">
<label for="name" class="block text-base mb-2">Name</label>
<div class="w-96 p-8 bg-white rounded-lg shadow-xl border border-slate-200">
<h1 class="text-3xl block text-center font-semibold text-slate-700">Signup</h1>
<hr class="mt-4 mb-6 border-slate-300">
<div class="mt-4">
<label for="name" class="block text-base mb-2 text-slate-600">Name</label>
<input type="text" id="name" name="name"
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
class="border border-slate-300 focus:border-indigo-500 w-full rounded-md text-base px-3 py-2 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-colors duration-200"
placeholder="Enter Name" />
</div>
<div class="mt-3">
<label for="email" class="block text-base mb-2">Email</label>
<div class="mt-4">
<label for="email" class="block text-base mb-2 text-slate-600">Email</label>
<input type="email" id="email" name="email"
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
class="border border-slate-300 focus:border-indigo-500 w-full rounded-md text-base px-3 py-2 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-colors duration-200"
placeholder="Enter Email" />
</div>
<div class="mt-3">
<label for="password" class="block text-base mb-2">Password</label>
<div class="mt-4">
<label for="password" class="block text-base mb-2 text-slate-600">Password</label>
<input type="password" id="password" name="password"
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
class="border border-slate-300 focus:border-indigo-500 w-full rounded-md text-base px-3 py-2 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-colors duration-200"
placeholder="Enter Password" />
<label for="password" class="block text-base mb-2 mt-3">Re-type Password</label>
<label for="repassword" class="block text-base mb-2 mt-3 text-slate-600">Re-type Password</label>
<input type="password" id="repassword" name="repassword"
class="border focus:border-gray-600 w-full rounded-md text-base px-2 py-1 focus:outline-none focus:ring-0 "
class="border border-slate-300 focus:border-indigo-500 w-full rounded-md text-base px-3 py-2 focus:outline-none focus:ring-1 focus:ring-indigo-500 transition-colors duration-200"
placeholder="Enter Password" />
</div>
<div class="text-red-800 font-bold " id="forgor">
<%= errMessage %>
</div>
<div class="mt-5">
<% if (errMessage && errMessage.length > 0) { %>
<div class="mt-3 text-red-600 font-semibold text-sm" id="forgor"> <%= errMessage %></div>
<% } else { %>
<div class="mt-3 h-5" id="forgor"></div> <% /* Placeholder to maintain layout when no error */ %>
<% } %>
<div class="mt-6">
<button type="submit"
class="border-2 border-gray-600 bg-blue-600 text-white py-1 w-full rounded-md hover:bg-transparent hover:text-indigo-700 font-semibold">Signup</button>
class="border-2 border-indigo-600 bg-indigo-600 text-white py-2 w-full rounded-md hover:bg-indigo-700 hover:border-indigo-700 font-semibold transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">Signup</button>
</div>
<div class="mt-5 block justify-between items-center">
<label>Already have an account?</label>
<a href="/login" class="text-indigo-600 font-semibold">Login</a>
<div class="mt-6 text-center">
<span class="text-sm text-slate-600">Already have an account?</span>
<a href="/login" class="text-sm text-indigo-600 hover:text-indigo-500 font-semibold ml-1 transition-colors duration-200">Login</a>
</div>
</div>
</form>