6 files changed
+357
-350
No files matched your search
+9
-329
@@ -2,156 +2,7 @@
|
|||||||
<%- include("./partials/header") %>
|
<%- include("./partials/header") %>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<!-- Create Asset popup Modal -->
|
<%- include("./partials/createAsset", { icons: icons }) %>
|
||||||
<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>
|
|
||||||
|
|
||||||
<% if (errMessage != "") { %>
|
<% 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>
|
<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>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% assets.forEach((asset) => { %>
|
<% assets.forEach((asset) => { %>
|
||||||
<!-- Clickable asset list item -->
|
<%- include("./partials/assetPreview", { asset: asset }); %>
|
||||||
<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>
|
|
||||||
|
|
||||||
<!-- Confirm delete asset modal -->
|
<%- include("./partials/assetDelete", { asset: asset }); %>
|
||||||
<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>
|
|
||||||
|
|
||||||
<!-- View/edit popup modal for asset -->
|
<%- include("./partials/assetModify", { asset: 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>
|
|
||||||
<% }) %>
|
<% }) %>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
@@ -382,11 +61,12 @@
|
|||||||
<script src="/static/scripts/assetManager.js"></script>
|
<script src="/static/scripts/assetManager.js"></script>
|
||||||
<script>
|
<script>
|
||||||
// Ensure all assets popup modals are locked and reset on page load
|
// Ensure all assets popup modals are locked and reset on page load
|
||||||
<% assets.forEach((asset) => { %>
|
let assets = <%- JSON.stringify(assets) %>;
|
||||||
lockAsset("<%= asset._id %>", "<%= asset.icon %>");
|
assets.forEach((asset) => {
|
||||||
<% }) %>
|
lockAsset(asset._id, asset.icon);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<%- include("./partials/navBar") %>
|
<%- include("./partials/navBar") %>
|
||||||
<%- include("./partials/scriptLoader") %>
|
<%- include("./partials/scriptLoader") %>
|
||||||
<%- include("./partials/footer") %>
|
<%- include("./partials/footer") %>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -1,26 +1,27 @@
|
|||||||
<div class="fixed end-6 bottom-20 group">
|
<div class="fixed end-6 bottom-20 group">
|
||||||
<div id="factMenu" class="absolute right-0 bottom-full mb-2 hidden">
|
<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">
|
<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>
|
<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">
|
<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>
|
<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>
|
</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">
|
||||||
|
<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 Fact</span>
|
||||||
|
</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">
|
|
||||||
<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 Fact</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class="mt-16">
|
<footer class="mt-16">
|
||||||
<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">
|
<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">
|
||||||
<div class="container mx-auto">
|
<div class="container mx-auto">
|
||||||
<p>© 2025 RCalculator. All rights reserved.</p>
|
<p>© 2025 RCalculator. All rights reserved.</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</footer>
|
||||||
</footer>
|
|
||||||
|
<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 src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||||
<script src="/static/scripts/footer.js"></script>
|
<script src="/static/scripts/footer.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in new issue
Block a user