diff --git a/src/public/scripts/selectAssetForm.js b/src/public/scripts/selectAssetForm.js new file mode 100644 index 0000000..6908766 --- /dev/null +++ b/src/public/scripts/selectAssetForm.js @@ -0,0 +1,31 @@ +const assetForms = [ + "create-other-asset-form", + "create-saving-asset-form", + "create-stock-asset-form" +]; + +/** + * selectAssetForm changes which form is displayed + * to create specified assets. + * @param {string} assetId + */ +function selectAssetForm(assetFormId) { + for (let i = 0; i < assetForms.length; i++) { + if (assetForms[i] == assetFormId) { + document.getElementById(assetFormId).style.display = "block"; + } else { + document.getElementById(assetForms[i]).style.display = "none"; + } + } +} + +/** + * resetRadio to default to other asset type. + */ +function resetRadio() { + document.getElementById("asset-other").checked = true; + document.getElementById("asset-saving").checked = false; + document.getElementById("asset-stock").checked = false; +} + +resetRadio(); diff --git a/src/router/user.js b/src/router/user.js index 407aca9..d534590 100644 --- a/src/router/user.js +++ b/src/router/user.js @@ -14,7 +14,21 @@ module.exports = (middleware, users) => { }); router.get('/assets', (req, res) => { - res.render('assets', { user: req.user }); + let assets = [ + { + name: "hello my name is braeden! abc!", + value: 1123.50, + }, + { + name: "asset 2", + value: 321.05, + }, + { + name: "asset 3", + value: 666, + }, + ]; + res.render('assets', { user: req.user, assets: assets }); return res.status(status.Ok); }); diff --git a/src/views/assets.ejs b/src/views/assets.ejs index a926f36..10ae035 100644 --- a/src/views/assets.ejs +++ b/src/views/assets.ejs @@ -2,8 +2,179 @@ <%- include("./partials/header") %> - The Assets Page + + + + + Create New Asset + + + Cancel + + + + + + Asset Type + + + + Other Assets + + + + Savings + + + + Stocks + + + + + + + + + + Asset Name + + + Asset Value + + + Date of Purchase + + + Description + + + + + Clear + + + Create + + + + + + + + + + Savings Name + + + Savings Value + + + + + Clear + + + Create + + + + + + + + + + + Stock Ticker + + + Price per Share + + + Quantity of Shares + + + Date of Purchase + + + + + Clear + + + Create + + + + + + + + + Assets: + <%= assets.length %> + + + Total Value: + + + $<%= assets.reduce((total, e) => total + e.value, 0).toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}) %> + + + + + + + Back to Dashboard + + + Add New Asset + + + + + + + + <% if (assets.length == 0) { %> + + + You have no assets, create a new asset above. + + + <% } %> + <% assets.forEach((asset) => { %> + + + + Icon + <%= asset.name %> + + + + $<%= asset.value.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}) %> + + + + + <% }) %> + + + <%- include("./partials/navBar") %> <%- include("./partials/footer") %> \ No newline at end of file