diff --git a/models/Transaction.js b/models/Transaction.js index 41c7a1f..cd94bca 100644 --- a/models/Transaction.js +++ b/models/Transaction.js @@ -1 +1,29 @@ // Adding / Spending Balance History + +const mongoose = require("mongoose"); +var Float = require("mongoose-float").loadType(mongoose); + +const TransactionSchema = new mongoose.Schema({ + details: { + type: String, + required: true, + }, + amount: { + type: Float, + required: true, + }, + opration: { + type: String, + required: true + }, + user: { + type: mongoose.Schema.Types.ObjectId, + ref: 'User', + }, + createdAt: { + type: Date, + default: Date.now, + }, +}); + +module.exports = mongoose.model("Transaction", TransactionSchema); diff --git a/public/css/style.css b/public/css/style.css index 0b99841..811a777 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -1,2081 +1 @@ -/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ - -html { - line-height: 1.15; - -webkit-text-size-adjust: 100% -} - -body { - margin: 0 -} - -main { - display: block -} - -h1 { - font-size: 2em; - margin: .67em 0 -} - -hr { - box-sizing: content-box; - height: 0; - overflow: visible -} - -pre { - font-family: monospace, monospace; - font-size: 1em -} - -a { - background-color: transparent -} - -abbr[title] { - border-bottom: none; - text-decoration: underline; - -webkit-text-decoration: underline dotted; - text-decoration: underline dotted -} - -b, -strong { - font-weight: bolder -} - -code, -kbd, -samp { - font-family: monospace, monospace; - font-size: 1em -} - -small { - font-size: 80% -} - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline -} - -sub { - bottom: -.25em -} - -sup { - top: -.5em -} - -img { - border-style: none -} - -button, -input, -optgroup, -select, -textarea { - font-family: inherit; - font-size: 100%; - line-height: 1.15; - margin: 0 -} - -button, -input { - overflow: visible -} - -button, -select { - text-transform: none -} - -[type=button], -[type=reset], -[type=submit], -button { - -webkit-appearance: button -} - -[type=button]::-moz-focus-inner, -[type=reset]::-moz-focus-inner, -[type=submit]::-moz-focus-inner, -button::-moz-focus-inner { - border-style: none; - padding: 0 -} - -[type=button]:-moz-focusring, -[type=reset]:-moz-focusring, -[type=submit]:-moz-focusring, -button:-moz-focusring { - outline: 1px dotted ButtonText -} - -fieldset { - padding: .35em .75em .625em -} - -legend { - box-sizing: border-box; - color: inherit; - display: table; - max-width: 100%; - padding: 0; - white-space: normal -} - -progress { - vertical-align: baseline -} - -textarea { - overflow: auto -} - -[type=checkbox], -[type=radio] { - box-sizing: border-box; - padding: 0 -} - -[type=number]::-webkit-inner-spin-button, -[type=number]::-webkit-outer-spin-button { - height: auto -} - -[type=search] { - -webkit-appearance: textfield; - outline-offset: -2px -} - -[type=search]::-webkit-search-decoration { - -webkit-appearance: none -} - -::-webkit-file-upload-button { - -webkit-appearance: button; - font: inherit -} - -details { - display: block -} - -summary { - display: list-item -} - -[hidden], -template { - display: none -} - -blockquote, -dd, -dl, -figure, -h1, -h2, -h3, -h4, -h5, -h6, -hr, -p, -pre { - margin: 0 -} - -button { - background-color: transparent; - background-image: none -} - -button:focus { - outline: 1px dotted; - outline: 5px auto -webkit-focus-ring-color -} - -fieldset, -ol, -ul { - margin: 0; - padding: 0 -} - -ol, -ul { - list-style: none -} - -html { - font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; - line-height: 1.5 -} - -*, -:after, -:before { - box-sizing: border-box; - border: 0 solid #e2e8f0 -} - -hr { - border-top-width: 1px -} - -img { - border-style: solid -} - -textarea { - resize: vertical -} - -input::-moz-placeholder, -textarea::-moz-placeholder { - color: #a0aec0 -} - -input:-ms-input-placeholder, -textarea:-ms-input-placeholder { - color: #a0aec0 -} - -input::-ms-input-placeholder, -textarea::-ms-input-placeholder { - color: #a0aec0 -} - -input::placeholder, -textarea::placeholder { - color: #a0aec0 -} - -[role=button], -button { - cursor: pointer -} - -table { - border-collapse: collapse -} - -h1, -h2, -h3, -h4, -h5, -h6 { - font-size: inherit; - font-weight: inherit -} - -a { - color: inherit; - text-decoration: inherit -} - -button, -input, -optgroup, -select, -textarea { - padding: 0; - line-height: inherit; - color: inherit -} - -code, -kbd, -pre, -samp { - font-family: Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace -} - -audio, -canvas, -embed, -iframe, -img, -object, -svg, -video { - display: block; - vertical-align: middle -} - -img, -video { - max-width: 100%; - height: auto -} - -body, -html { - margin: 0; - padding: 0; - width: 100%; - height: 100%; - overflow-x: hidden; - box-sizing: border-box; - background-color: #e2e8f0 -} - -.chartjs-container { - position: relative; - margin: auto; - height: 75vh; - width: 75vw -} - -.container { - width: 100% -} - -@media (min-width:640px) { - .container { - max-width: 640px - } -} - -@media (min-width:768px) { - .container { - max-width: 768px - } -} - -@media (min-width:1024px) { - .container { - max-width: 1024px - } -} - -@media (min-width:1280px) { - .container { - max-width: 1280px - } -} - -.symbolicon { - font-size: 72px; - background: -webkit-linear-gradient(#eee, #333); - background-clip: text; - -webkit-background-clip: text; - -webkit-text-fill-color: transparent -} - -.min-w { - min-width: 400px -} - -@media (max-width:400px) { - .min-w { - min-width: 300px - } -} - -.space-y-5>:not(template)~:not(template) { - --space-y-reverse: 0; - margin-top: calc(1.25rem*(1 - var(--space-y-reverse))); - margin-bottom: calc(1.25rem*var(--space-y-reverse)) -} - -.space-y-10>:not(template)~:not(template) { - --space-y-reverse: 0; - margin-top: calc(2.5rem*(1 - var(--space-y-reverse))); - margin-bottom: calc(2.5rem*var(--space-y-reverse)) -} - -.appearance-none { - -webkit-appearance: none; - -moz-appearance: none; - appearance: none -} - -.bg-transparent { - background-color: transparent -} - -.bg-white { - --bg-opacity: 1; - background-color: #fff; - background-color: rgba(255, 255, 255, var(--bg-opacity)) -} - -.bg-gray-100 { - --bg-opacity: 1; - background-color: #f7fafc; - background-color: rgba(247, 250, 252, var(--bg-opacity)) -} - -.bg-gray-200 { - --bg-opacity: 1; - background-color: #edf2f7; - background-color: rgba(237, 242, 247, var(--bg-opacity)) -} - -.bg-gray-300 { - --bg-opacity: 1; - background-color: #e2e8f0; - background-color: rgba(226, 232, 240, var(--bg-opacity)) -} - -.bg-gray-700 { - --bg-opacity: 1; - background-color: #4a5568; - background-color: rgba(74, 85, 104, var(--bg-opacity)) -} - -.bg-gray-900 { - --bg-opacity: 1; - background-color: #1a202c; - background-color: rgba(26, 32, 44, var(--bg-opacity)) -} - -.bg-red-200 { - --bg-opacity: 1; - background-color: #fed7d7; - background-color: rgba(254, 215, 215, var(--bg-opacity)) -} - -.bg-red-900 { - --bg-opacity: 1; - background-color: #742a2a; - background-color: rgba(116, 42, 42, var(--bg-opacity)) -} - -.bg-yellow-200 { - --bg-opacity: 1; - background-color: #fefcbf; - background-color: rgba(254, 252, 191, var(--bg-opacity)) -} - -.bg-yellow-500 { - --bg-opacity: 1; - background-color: #ecc94b; - background-color: rgba(236, 201, 75, var(--bg-opacity)) -} - -.bg-green-200 { - --bg-opacity: 1; - background-color: #c6f6d5; - background-color: rgba(198, 246, 213, var(--bg-opacity)) -} - -.bg-teal-500 { - --bg-opacity: 1; - background-color: #38b2ac; - background-color: rgba(56, 178, 172, var(--bg-opacity)) -} - -.bg-blue-400 { - --bg-opacity: 1; - background-color: #63b3ed; - background-color: rgba(99, 179, 237, var(--bg-opacity)) -} - -.bg-blue-500 { - --bg-opacity: 1; - background-color: #4299e1; - background-color: rgba(66, 153, 225, var(--bg-opacity)) -} - -.bg-blue-600 { - --bg-opacity: 1; - background-color: #3182ce; - background-color: rgba(49, 130, 206, var(--bg-opacity)) -} - -.bg-blue-800 { - --bg-opacity: 1; - background-color: #2c5282; - background-color: rgba(44, 82, 130, var(--bg-opacity)) -} - -.bg-secondary-100 { - --bg-opacity: 1; - background-color: #e2e2d5; - background-color: rgba(226, 226, 213, var(--bg-opacity)) -} - -.bg-tempc-400 { - --bg-opacity: 1; - background-color: #266fea; - background-color: rgba(38, 111, 234, var(--bg-opacity)) -} - -.bg-tempc-500 { - --bg-opacity: 1; - background-color: #41d7aa; - background-color: rgba(65, 215, 170, var(--bg-opacity)) -} - -.hover\:bg-white:hover { - --bg-opacity: 1; - background-color: #fff; - background-color: rgba(255, 255, 255, var(--bg-opacity)) -} - -.hover\:bg-gray-200:hover { - --bg-opacity: 1; - background-color: #edf2f7; - background-color: rgba(237, 242, 247, var(--bg-opacity)) -} - -.hover\:bg-red-400:hover { - --bg-opacity: 1; - background-color: #fc8181; - background-color: rgba(252, 129, 129, var(--bg-opacity)) -} - -.hover\:bg-yellow-600:hover { - --bg-opacity: 1; - background-color: #d69e2e; - background-color: rgba(214, 158, 46, var(--bg-opacity)) -} - -.hover\:bg-green-400:hover { - --bg-opacity: 1; - background-color: #68d391; - background-color: rgba(104, 211, 145, var(--bg-opacity)) -} - -.hover\:bg-teal-500:hover { - --bg-opacity: 1; - background-color: #38b2ac; - background-color: rgba(56, 178, 172, var(--bg-opacity)) -} - -.hover\:bg-blue-400:hover { - --bg-opacity: 1; - background-color: #63b3ed; - background-color: rgba(99, 179, 237, var(--bg-opacity)) -} - -.hover\:bg-blue-500:hover { - --bg-opacity: 1; - background-color: #4299e1; - background-color: rgba(66, 153, 225, var(--bg-opacity)) -} - -.hover\:bg-blue-700:hover { - --bg-opacity: 1; - background-color: #2b6cb0; - background-color: rgba(43, 108, 176, var(--bg-opacity)) -} - -.hover\:bg-indigo-700:hover { - --bg-opacity: 1; - background-color: #4c51bf; - background-color: rgba(76, 81, 191, var(--bg-opacity)) -} - -.focus\:bg-gray-200:focus { - --bg-opacity: 1; - background-color: #edf2f7; - background-color: rgba(237, 242, 247, var(--bg-opacity)) -} - -.hover\:bg-opacity-50:hover { - --bg-opacity: 0.5 -} - -.border-gray-100 { - --border-opacity: 1; - border-color: #f7fafc; - border-color: rgba(247, 250, 252, var(--border-opacity)) -} - -.border-gray-200 { - --border-opacity: 1; - border-color: #edf2f7; - border-color: rgba(237, 242, 247, var(--border-opacity)) -} - -.border-gray-400 { - --border-opacity: 1; - border-color: #cbd5e0; - border-color: rgba(203, 213, 224, var(--border-opacity)) -} - -.border-red-600 { - --border-opacity: 1; - border-color: #e53e3e; - border-color: rgba(229, 62, 62, var(--border-opacity)) -} - -.border-yellow-600 { - --border-opacity: 1; - border-color: #d69e2e; - border-color: rgba(214, 158, 46, var(--border-opacity)) -} - -.border-green-400 { - --border-opacity: 1; - border-color: #68d391; - border-color: rgba(104, 211, 145, var(--border-opacity)) -} - -.border-green-600 { - --border-opacity: 1; - border-color: #38a169; - border-color: rgba(56, 161, 105, var(--border-opacity)) -} - -.border-teal-500 { - --border-opacity: 1; - border-color: #38b2ac; - border-color: rgba(56, 178, 172, var(--border-opacity)) -} - -.border-blue-500 { - --border-opacity: 1; - border-color: #4299e1; - border-color: rgba(66, 153, 225, var(--border-opacity)) -} - -.border-blue-600 { - --border-opacity: 1; - border-color: #3182ce; - border-color: rgba(49, 130, 206, var(--border-opacity)) -} - -.border-purple-700 { - --border-opacity: 1; - border-color: #6b46c1; - border-color: rgba(107, 70, 193, var(--border-opacity)) -} - -.hover\:border-green-400:hover { - --border-opacity: 1; - border-color: #68d391; - border-color: rgba(104, 211, 145, var(--border-opacity)) -} - -.hover\:border-blue-600:hover { - --border-opacity: 1; - border-color: #3182ce; - border-color: rgba(49, 130, 206, var(--border-opacity)) -} - -.rounded-sm { - border-radius: .125rem -} - -.rounded { - border-radius: .25rem -} - -.rounded-lg { - border-radius: .5rem -} - -.rounded-full { - border-radius: 9999px -} - -.rounded-t { - border-top-left-radius: .25rem; - border-top-right-radius: .25rem -} - -.rounded-b-lg { - border-bottom-right-radius: .5rem; - border-bottom-left-radius: .5rem -} - -.border-4 { - border-width: 4px -} - -.border-8 { - border-width: 8px -} - -.border { - border-width: 1px -} - -.border-b-2 { - border-bottom-width: 2px -} - -.border-l-8 { - border-left-width: 8px -} - -.border-b { - border-bottom-width: 1px -} - -.cursor-pointer { - cursor: pointer -} - -.block { - display: block -} - -.inline-block { - display: inline-block -} - -.inline { - display: inline -} - -.flex { - display: flex -} - -.inline-flex { - display: inline-flex -} - -.table { - display: table -} - -.grid { - display: grid -} - -.hidden { - display: none -} - -.flex-row { - flex-direction: row -} - -.flex-col { - flex-direction: column -} - -.flex-wrap { - flex-wrap: wrap -} - -.items-center { - align-items: center -} - -.justify-start { - justify-content: flex-start -} - -.justify-end { - justify-content: flex-end -} - -.justify-center { - justify-content: center -} - -.justify-between { - justify-content: space-between -} - -.justify-around { - justify-content: space-around -} - -.flex-auto { - flex: 1 1 auto -} - -.flex-grow { - flex-grow: 1 -} - -.flex-shrink-0 { - flex-shrink: 0 -} - -.font-normal { - font-weight: 400 -} - -.font-medium { - font-weight: 500 -} - -.font-semibold { - font-weight: 600 -} - -.font-bold { - font-weight: 700 -} - -.font-extrabold { - font-weight: 800 -} - -.h-4 { - height: 1rem -} - -.h-5 { - height: 1.25rem -} - -.h-6 { - height: 1.5rem -} - -.h-8 { - height: 2rem -} - -.h-10 { - height: 2.5rem -} - -.h-16 { - height: 4rem -} - -.h-20 { - height: 5rem -} - -.h-64 { - height: 16rem -} - -.h-auto { - height: auto -} - -.h-full { - height: 100% -} - -.text-xs { - font-size: .75rem -} - -.text-sm { - font-size: .875rem -} - -.text-base { - font-size: 1rem -} - -.text-lg { - font-size: 1.125rem -} - -.text-xl { - font-size: 1.25rem -} - -.text-2xl { - font-size: 1.5rem -} - -.text-3xl { - font-size: 1.875rem -} - -.text-4xl { - font-size: 2.25rem -} - -.text-5xl { - font-size: 3rem -} - -.text-6xl { - font-size: 4rem -} - -.leading-none { - line-height: 1 -} - -.leading-tight { - line-height: 1.25 -} - -.leading-normal { - line-height: 1.5 -} - -.m-4 { - margin: 1rem -} - -.m-8 { - margin: 2rem -} - -.-m-4 { - margin: -1rem -} - -.mx-2 { - margin-left: .5rem; - margin-right: .5rem -} - -.my-4 { - margin-top: 1rem; - margin-bottom: 1rem -} - -.my-6 { - margin-top: 1.5rem; - margin-bottom: 1.5rem -} - -.my-8 { - margin-top: 2rem; - margin-bottom: 2rem -} - -.mx-auto { - margin-left: auto; - margin-right: auto -} - -.-mx-8 { - margin-left: -2rem; - margin-right: -2rem -} - -.mb-0 { - margin-bottom: 0 -} - -.ml-0 { - margin-left: 0 -} - -.mt-1 { - margin-top: .25rem -} - -.mr-1 { - margin-right: .25rem -} - -.mb-1 { - margin-bottom: .25rem -} - -.ml-1 { - margin-left: .25rem -} - -.mt-2 { - margin-top: .5rem -} - -.mr-2 { - margin-right: .5rem -} - -.mb-2 { - margin-bottom: .5rem -} - -.ml-2 { - margin-left: .5rem -} - -.mt-3 { - margin-top: .75rem -} - -.mb-3 { - margin-bottom: .75rem -} - -.ml-3 { - margin-left: .75rem -} - -.mt-4 { - margin-top: 1rem -} - -.mb-4 { - margin-bottom: 1rem -} - -.ml-4 { - margin-left: 1rem -} - -.mt-6 { - margin-top: 1.5rem -} - -.mr-6 { - margin-right: 1.5rem -} - -.mb-6 { - margin-bottom: 1.5rem -} - -.mt-8 { - margin-top: 2rem -} - -.mb-8 { - margin-bottom: 2rem -} - -.mb-10 { - margin-bottom: 2.5rem -} - -.mt-12 { - margin-top: 3rem -} - -.max-w-xs { - max-width: 20rem -} - -.max-w-sm { - max-width: 24rem -} - -.max-w-4xl { - max-width: 56rem -} - -.max-w-6xl { - max-width: 72rem -} - -.min-h-full { - min-height: 100% -} - -.min-h-screen { - min-height: 100vh -} - -.min-w-0 { - min-width: 0 -} - -.object-cover { - -o-object-fit: cover; - object-fit: cover -} - -.focus\:outline-none:focus, -.outline-none { - outline: 0 -} - -.overflow-hidden { - overflow: hidden -} - -.overflow-x-auto { - overflow-x: auto -} - -.p-0 { - padding: 0 -} - -.p-1 { - padding: .25rem -} - -.p-2 { - padding: .5rem -} - -.p-4 { - padding: 1rem -} - -.p-5 { - padding: 1.25rem -} - -.py-1 { - padding-top: .25rem; - padding-bottom: .25rem -} - -.py-2 { - padding-top: .5rem; - padding-bottom: .5rem -} - -.px-2 { - padding-left: .5rem; - padding-right: .5rem -} - -.py-3 { - padding-top: .75rem; - padding-bottom: .75rem -} - -.px-3 { - padding-left: .75rem; - padding-right: .75rem -} - -.py-4 { - padding-top: 1rem; - padding-bottom: 1rem -} - -.px-4 { - padding-left: 1rem; - padding-right: 1rem -} - -.py-5 { - padding-top: 1.25rem; - padding-bottom: 1.25rem -} - -.px-5 { - padding-left: 1.25rem; - padding-right: 1.25rem -} - -.py-6 { - padding-top: 1.5rem; - padding-bottom: 1.5rem -} - -.px-6 { - padding-left: 1.5rem; - padding-right: 1.5rem -} - -.py-8 { - padding-top: 2rem; - padding-bottom: 2rem -} - -.px-8 { - padding-left: 2rem; - padding-right: 2rem -} - -.py-10 { - padding-top: 2.5rem; - padding-bottom: 2.5rem -} - -.px-10 { - padding-left: 2.5rem; - padding-right: 2.5rem -} - -.py-16 { - padding-top: 4rem; - padding-bottom: 4rem -} - -.pt-0 { - padding-top: 0 -} - -.pt-2 { - padding-top: .5rem -} - -.pb-2 { - padding-bottom: .5rem -} - -.pl-2 { - padding-left: .5rem -} - -.pr-4 { - padding-right: 1rem -} - -.pb-4 { - padding-bottom: 1rem -} - -.pt-6 { - padding-top: 1.5rem -} - -.pb-8 { - padding-bottom: 2rem -} - -.pt-10 { - padding-top: 2.5rem -} - -.pr-10 { - padding-right: 2.5rem -} - -.pb-10 { - padding-bottom: 2.5rem -} - -.pl-10 { - padding-left: 2.5rem -} - -.pt-20 { - padding-top: 5rem -} - -.pt-32 { - padding-top: 8rem -} - -.placeholder-gray-400::-moz-placeholder { - --placeholder-opacity: 1; - color: #cbd5e0; - color: rgba(203, 213, 224, var(--placeholder-opacity)) -} - -.placeholder-gray-400:-ms-input-placeholder { - --placeholder-opacity: 1; - color: #cbd5e0; - color: rgba(203, 213, 224, var(--placeholder-opacity)) -} - -.placeholder-gray-400::-ms-input-placeholder { - --placeholder-opacity: 1; - color: #cbd5e0; - color: rgba(203, 213, 224, var(--placeholder-opacity)) -} - -.placeholder-gray-400::placeholder { - --placeholder-opacity: 1; - color: #cbd5e0; - color: rgba(203, 213, 224, var(--placeholder-opacity)) -} - -.fixed { - position: fixed -} - -.absolute { - position: absolute -} - -.relative { - position: relative -} - -.inset-0 { - top: 0; - right: 0; - bottom: 0; - left: 0 -} - -.top-0 { - top: 0 -} - -.right-0 { - right: 0 -} - -.bottom-0 { - bottom: 0 -} - -.left-0 { - left: 0 -} - -.shadow { - box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px 0 rgba(0, 0, 0, .06) -} - -.shadow-md { - box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -1px rgba(0, 0, 0, .06) -} - -.shadow-lg { - box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05) -} - -.shadow-2xl { - box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .25) -} - -.hover\:shadow-md:hover { - box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -1px rgba(0, 0, 0, .06) -} - -.hover\:shadow-lg:hover { - box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05) -} - -.hover\:shadow-inner:hover { - box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, .06) -} - -.focus\:shadow-outline:focus { - box-shadow: 0 0 0 3px rgba(66, 153, 225, .5) -} - -.fill-current { - fill: currentColor -} - -.text-left { - text-align: left -} - -.text-center { - text-align: center -} - -.text-right { - text-align: right -} - -.text-black { - --text-opacity: 1; - color: #000; - color: rgba(0, 0, 0, var(--text-opacity)) -} - -.text-white { - --text-opacity: 1; - color: #fff; - color: rgba(255, 255, 255, var(--text-opacity)) -} - -.text-gray-500 { - --text-opacity: 1; - color: #a0aec0; - color: rgba(160, 174, 192, var(--text-opacity)) -} - -.text-gray-600 { - --text-opacity: 1; - color: #718096; - color: rgba(113, 128, 150, var(--text-opacity)) -} - -.text-gray-700 { - --text-opacity: 1; - color: #4a5568; - color: rgba(74, 85, 104, var(--text-opacity)) -} - -.text-gray-800 { - --text-opacity: 1; - color: #2d3748; - color: rgba(45, 55, 72, var(--text-opacity)) -} - -.text-gray-900 { - --text-opacity: 1; - color: #1a202c; - color: rgba(26, 32, 44, var(--text-opacity)) -} - -.text-red-600 { - --text-opacity: 1; - color: #e53e3e; - color: rgba(229, 62, 62, var(--text-opacity)) -} - -.text-red-700 { - --text-opacity: 1; - color: #c53030; - color: rgba(197, 48, 48, var(--text-opacity)) -} - -.text-yellow-700 { - --text-opacity: 1; - color: #b7791f; - color: rgba(183, 121, 31, var(--text-opacity)) -} - -.text-green-700 { - --text-opacity: 1; - color: #2f855a; - color: rgba(47, 133, 90, var(--text-opacity)) -} - -.text-green-900 { - --text-opacity: 1; - color: #22543d; - color: rgba(34, 84, 61, var(--text-opacity)) -} - -.text-teal-500 { - --text-opacity: 1; - color: #38b2ac; - color: rgba(56, 178, 172, var(--text-opacity)) -} - -.text-blue-200 { - --text-opacity: 1; - color: #bee3f8; - color: rgba(190, 227, 248, var(--text-opacity)) -} - -.text-blue-700 { - --text-opacity: 1; - color: #2b6cb0; - color: rgba(43, 108, 176, var(--text-opacity)) -} - -.text-secondary-200 { - --text-opacity: 1; - color: #888883; - color: rgba(136, 136, 131, var(--text-opacity)) -} - -.text-tempc-200 { - --text-opacity: 1; - color: #e93434; - color: rgba(233, 52, 52, var(--text-opacity)) -} - -.text-tempc-400 { - --text-opacity: 1; - color: #266fea; - color: rgba(38, 111, 234, var(--text-opacity)) -} - -.text-tempc-500 { - --text-opacity: 1; - color: #41d7aa; - color: rgba(65, 215, 170, var(--text-opacity)) -} - -.hover\:text-black:hover { - --text-opacity: 1; - color: #000; - color: rgba(0, 0, 0, var(--text-opacity)) -} - -.hover\:text-white:hover { - --text-opacity: 1; - color: #fff; - color: rgba(255, 255, 255, var(--text-opacity)) -} - -.hover\:text-gray-900:hover { - --text-opacity: 1; - color: #1a202c; - color: rgba(26, 32, 44, var(--text-opacity)) -} - -.hover\:text-red-500:hover { - --text-opacity: 1; - color: #f56565; - color: rgba(245, 101, 101, var(--text-opacity)) -} - -.hover\:text-yellow-500:hover { - --text-opacity: 1; - color: #ecc94b; - color: rgba(236, 201, 75, var(--text-opacity)) -} - -.hover\:text-green-500:hover { - --text-opacity: 1; - color: #48bb78; - color: rgba(72, 187, 120, var(--text-opacity)) -} - -.focus\:text-black:focus { - --text-opacity: 1; - color: #000; - color: rgba(0, 0, 0, var(--text-opacity)) -} - -.focus\:text-gray-900:focus { - --text-opacity: 1; - color: #1a202c; - color: rgba(26, 32, 44, var(--text-opacity)) -} - -.uppercase { - text-transform: uppercase -} - -.underline { - text-decoration: underline -} - -.tracking-wide { - letter-spacing: .025em -} - -.tracking-wider { - letter-spacing: .05em -} - -.tracking-widest { - letter-spacing: .1em -} - -.whitespace-no-wrap { - white-space: nowrap -} - -.break-words { - overflow-wrap: break-word -} - -.w-4 { - width: 1rem -} - -.w-5 { - width: 1.25rem -} - -.w-6 { - width: 1.5rem -} - -.w-10 { - width: 2.5rem -} - -.w-16 { - width: 4rem -} - -.w-20 { - width: 5rem -} - -.w-24 { - width: 6rem -} - -.w-32 { - width: 8rem -} - -.w-auto { - width: auto -} - -.w-1\/2 { - width: 50% -} - -.w-2\/3 { - width: 66.666667% -} - -.w-2\/5 { - width: 40% -} - -.w-full { - width: 100% -} - -.w-screen { - width: 100vw -} - -.gap-4 { - grid-gap: 1rem; - gap: 1rem -} - -.gap-8 { - grid-gap: 2rem; - gap: 2rem -} - -.gap-10 { - grid-gap: 2.5rem; - gap: 2.5rem -} - -.grid-flow-col { - grid-auto-flow: column -} - -.grid-cols-2 { - grid-template-columns: repeat(2, minmax(0, 1fr)) -} - -.grid-cols-3 { - grid-template-columns: repeat(3, minmax(0, 1fr)) -} - -.grid-rows-2 { - grid-template-rows: repeat(2, minmax(0, 1fr)) -} - -.grid-rows-4 { - grid-template-rows: repeat(4, minmax(0, 1fr)) -} - -.transform { - --transform-translate-x: 0; - --transform-translate-y: 0; - --transform-rotate: 0; - --transform-skew-x: 0; - --transform-skew-y: 0; - --transform-scale-x: 1; - --transform-scale-y: 1; - transform: translateX(var(--transform-translate-x)) translateY(var(--transform-translate-y)) rotate(var(--transform-rotate)) skewX(var(--transform-skew-x)) skewY(var(--transform-skew-y)) scaleX(var(--transform-scale-x)) scaleY(var(--transform-scale-y)) -} - -.hover\:scale-125:hover { - --transform-scale-x: 1.25; - --transform-scale-y: 1.25 -} - -.transition { - transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform -} - -.ease-in { - transition-timing-function: cubic-bezier(.4, 0, 1, 1) -} - -.ease-out { - transition-timing-function: cubic-bezier(0, 0, .2, 1) -} - -.duration-200 { - transition-duration: .2s -} - -.duration-300 { - transition-duration: .3s -} - -.duration-500 { - transition-duration: .5s -} - -@-webkit-keyframes spin { - 0% { - transform: rotate(0deg) - } - to { - transform: rotate(1turn) - } -} - -@keyframes spin { - 0% { - transform: rotate(0deg) - } - to { - transform: rotate(1turn) - } -} - -@-webkit-keyframes ping { - 0% { - transform: scale(1); - opacity: 1 - } - 75%, - to { - transform: scale(2); - opacity: 0 - } -} - -@keyframes ping { - 0% { - transform: scale(1); - opacity: 1 - } - 75%, - to { - transform: scale(2); - opacity: 0 - } -} - -@-webkit-keyframes pulse { - 0%, - to { - opacity: 1 - } - 50% { - opacity: .5 - } -} - -@keyframes pulse { - 0%, - to { - opacity: 1 - } - 50% { - opacity: .5 - } -} - -@-webkit-keyframes bounce { - 0%, - to { - transform: translateY(-25%); - -webkit-animation-timing-function: cubic-bezier(.8, 0, 1, 1); - animation-timing-function: cubic-bezier(.8, 0, 1, 1) - } - 50% { - transform: translateY(0); - -webkit-animation-timing-function: cubic-bezier(0, 0, .2, 1); - animation-timing-function: cubic-bezier(0, 0, .2, 1) - } -} - -@keyframes bounce { - 0%, - to { - transform: translateY(-25%); - -webkit-animation-timing-function: cubic-bezier(.8, 0, 1, 1); - animation-timing-function: cubic-bezier(.8, 0, 1, 1) - } - 50% { - transform: translateY(0); - -webkit-animation-timing-function: cubic-bezier(0, 0, .2, 1); - animation-timing-function: cubic-bezier(0, 0, .2, 1) - } -} - -@media (min-width:640px) { - .sm\:container { - width: 100%; - max-width: 640px - } - @media (min-width:768px) { - .sm\:container { - max-width: 768px - } - } - @media (min-width:1024px) { - .sm\:container { - max-width: 1024px - } - } - @media (min-width:1280px) { - .sm\:container { - max-width: 1280px - } - } - .sm\:h-20 { - height: 5rem - } - .sm\:px-6 { - padding-left: 1.5rem; - padding-right: 1.5rem - } - .sm\:px-8 { - padding-left: 2rem; - padding-right: 2rem - } - .sm\:no-underline { - text-decoration: none - } -} - -@media (min-width:768px) { - .md\:container { - width: 100% - } - @media (min-width:640px) { - .md\:container { - max-width: 640px - } - } - @media (min-width:768px) { - .md\:container { - max-width: 768px - } - } - @media (min-width:1024px) { - .md\:container { - max-width: 1024px - } - } - @media (min-width:1280px) { - .md\:container { - max-width: 1280px - } - } - .md\:block { - display: block - } - .md\:inline-block { - display: inline-block - } - .md\:flex { - display: flex - } - .md\:hidden { - display: none - } - .md\:flex-row { - flex-direction: row - } - .md\:items-center { - align-items: center - } - .md\:justify-center { - justify-content: center - } - .md\:h-screen { - height: 100vh - } - .md\:text-sm { - font-size: .875rem - } - .md\:text-xl { - font-size: 1.25rem - } - .md\:text-2xl { - font-size: 1.5rem - } - .md\:text-3xl { - font-size: 1.875rem - } - .md\:mx-auto { - margin-left: auto; - margin-right: auto - } - .md\:ml-56 { - margin-left: 14rem - } - .md\:ml-64 { - margin-left: 16rem - } - .md\:ml-auto { - margin-left: auto - } - .md\:px-2 { - padding-left: .5rem; - padding-right: .5rem - } - .md\:px-8 { - padding-left: 2rem; - padding-right: 2rem - } - .md\:px-10 { - padding-left: 2.5rem; - padding-right: 2.5rem - } - .md\:py-12 { - padding-top: 3rem; - padding-bottom: 3rem - } - .md\:pb-0 { - padding-bottom: 0 - } - .md\:fixed { - position: fixed - } - .md\:top-0 { - top: 0 - } - .md\:left-0 { - left: 0 - } - .md\:line-through { - text-decoration: line-through - } - .md\:break-all { - word-break: break-all - } - .md\:w-56 { - width: 14rem - } - .md\:w-1\/2 { - width: 50% - } - .md\:w-4\/5 { - width: 80% - } - .md\:z-50 { - z-index: 50 - } - .md\:gap-4 { - grid-gap: 1rem; - gap: 1rem - } - .md\:grid-cols-3 { - grid-template-columns: repeat(3, minmax(0, 1fr)) - } - .md\:grid-cols-4 { - grid-template-columns: repeat(4, minmax(0, 1fr)) - } - .md\:col-span-4 { - grid-column: span 4/span 4 - } - .md\:grid-rows-1 { - grid-template-rows: repeat(1, minmax(0, 1fr)) - } - .md\:grid-rows-3 { - grid-template-rows: repeat(3, minmax(0, 1fr)) - } -} - -@media (min-width:1024px) { - .lg\:container { - width: 100% - } - @media (min-width:640px) { - .lg\:container { - max-width: 640px - } - } - @media (min-width:768px) { - .lg\:container { - max-width: 768px - } - } - @media (min-width:1024px) { - .lg\:container { - max-width: 1024px - } - } - @media (min-width:1280px) { - .lg\:container { - max-width: 1280px - } - } - .lg\:block { - display: block - } - .lg\:grid { - display: grid - } - .lg\:items-start { - align-items: flex-start - } - .lg\:items-center { - align-items: center - } - .lg\:justify-center { - justify-content: center - } - .lg\:text-sm { - font-size: .875rem - } - .lg\:text-base { - font-size: 1rem - } - .lg\:text-lg { - font-size: 1.125rem - } - .lg\:text-3xl { - font-size: 1.875rem - } - .lg\:text-4xl { - font-size: 2.25rem - } - .lg\:text-5xl { - font-size: 3rem - } - .lg\:text-6xl { - font-size: 4rem - } - .lg\:ml-64 { - margin-left: 16rem - } - .lg\:p-6 { - padding: 1.5rem - } - .lg\:px-10 { - padding-left: 2.5rem; - padding-right: 2.5rem - } - .lg\:text-center { - text-align: center - } - .lg\:underline { - text-decoration: underline - } - .lg\:w-64 { - width: 16rem - } - .lg\:w-1\/4 { - width: 25% - } - .lg\:w-3\/5 { - width: 60% - } - .lg\:grid-cols-2 { - grid-template-columns: repeat(2, minmax(0, 1fr)) - } - .lg\:grid-cols-3 { - grid-template-columns: repeat(3, minmax(0, 1fr)) - } - .lg\:grid-cols-4 { - grid-template-columns: repeat(4, minmax(0, 1fr)) - } - .lg\:grid-rows-2 { - grid-template-rows: repeat(2, minmax(0, 1fr)) - } - .lg\:grid-rows-3 { - grid-template-rows: repeat(3, minmax(0, 1fr)) - } - .lg\:row-span-2 { - grid-row: span 2/span 2 - } -} - -@media (min-width:1280px) { - .xl\:container { - width: 100% - } - @media (min-width:640px) { - .xl\:container { - max-width: 640px - } - } - @media (min-width:768px) { - .xl\:container { - max-width: 768px - } - } - @media (min-width:1024px) { - .xl\:container { - max-width: 1024px - } - } - @media (min-width:1280px) { - .xl\:container { - max-width: 1280px - } - } - .xl\:text-2xl { - font-size: 1.5rem - } - .xl\:no-underline { - text-decoration: none - } -} \ No newline at end of file +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}[hidden],template{display:none}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}button{background-color:transparent;background-image:none}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}fieldset,ol,ul{margin:0;padding:0}ol,ul{list-style:none}html{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}*,:after,:before{box-sizing:border-box;border:0 solid #e2e8f0}hr{border-top-width:1px}img{border-style:solid}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#a0aec0}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#a0aec0}input::-ms-input-placeholder,textarea::-ms-input-placeholder{color:#a0aec0}input::placeholder,textarea::placeholder{color:#a0aec0}[role=button],button{cursor:pointer}table{border-collapse:collapse}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}button,input,optgroup,select,textarea{padding:0;line-height:inherit;color:inherit}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}body,html{margin:0;padding:0;width:100%;height:100%;overflow-x:hidden;box-sizing:border-box;background-color:#e2e8f0}.chartjs-container{position:relative;margin:auto;height:75vh;width:75vw}.tradebyte-logo{color:#1955e4;text-shadow:1px 2px 40px rgba(0,0,0,.5)}.line{border:1.5px solid #8e9aad}.user-profile{border-radius:100px;border:10px solid #1955e4;width:130px;height:130px}.tick{height:22px;width:22px;border-radius:50%;background-color:#38cda0;color:#fff}.tick-background{background:#a9f7e6;border-radius:29px;color:#1b9b7f}.tab-color{border-radius:10px;border-color:#1955e4}.tab-color,.view-link{color:#1955e4}.view-link:hover{color:#0d338a}.button{background-color:#1955e4}.button:hover{background-color:#0d338a}.table-content{overflow:scroll;overflow-x:scroll;overflow-y:auto}.transaction-companySymbol{color:#000;font-weight:700;font-size:1.1rem}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}.symbolicon{font-size:72px;background:-webkit-linear-gradient(#eee,#333);background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent}.min-w{min-width:400px}@media (max-width:400px){.min-w{min-width:300px}}.space-y-5>:not(template)~:not(template){--space-y-reverse:0;margin-top:calc(1.25rem*(1 - var(--space-y-reverse)));margin-bottom:calc(1.25rem*var(--space-y-reverse))}.space-y-10>:not(template)~:not(template){--space-y-reverse:0;margin-top:calc(2.5rem*(1 - var(--space-y-reverse)));margin-bottom:calc(2.5rem*var(--space-y-reverse))}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.bg-white{--bg-opacity:1;background-color:#fff;background-color:rgba(255,255,255,var(--bg-opacity))}.bg-gray-100{--bg-opacity:1;background-color:#f7fafc;background-color:rgba(247,250,252,var(--bg-opacity))}.bg-gray-200{--bg-opacity:1;background-color:#edf2f7;background-color:rgba(237,242,247,var(--bg-opacity))}.bg-gray-300{--bg-opacity:1;background-color:#e2e8f0;background-color:rgba(226,232,240,var(--bg-opacity))}.bg-gray-700{--bg-opacity:1;background-color:#4a5568;background-color:rgba(74,85,104,var(--bg-opacity))}.bg-gray-900{--bg-opacity:1;background-color:#1a202c;background-color:rgba(26,32,44,var(--bg-opacity))}.bg-red-200{--bg-opacity:1;background-color:#fed7d7;background-color:rgba(254,215,215,var(--bg-opacity))}.bg-red-900{--bg-opacity:1;background-color:#742a2a;background-color:rgba(116,42,42,var(--bg-opacity))}.bg-yellow-200{--bg-opacity:1;background-color:#fefcbf;background-color:rgba(254,252,191,var(--bg-opacity))}.bg-yellow-500{--bg-opacity:1;background-color:#ecc94b;background-color:rgba(236,201,75,var(--bg-opacity))}.bg-green-200{--bg-opacity:1;background-color:#c6f6d5;background-color:rgba(198,246,213,var(--bg-opacity))}.bg-teal-500{--bg-opacity:1;background-color:#38b2ac;background-color:rgba(56,178,172,var(--bg-opacity))}.bg-blue-400{--bg-opacity:1;background-color:#63b3ed;background-color:rgba(99,179,237,var(--bg-opacity))}.bg-blue-600{--bg-opacity:1;background-color:#3182ce;background-color:rgba(49,130,206,var(--bg-opacity))}.bg-blue-800{--bg-opacity:1;background-color:#2c5282;background-color:rgba(44,82,130,var(--bg-opacity))}.bg-secondary-100{--bg-opacity:1;background-color:#e2e2d5;background-color:rgba(226,226,213,var(--bg-opacity))}.bg-tempc-400{--bg-opacity:1;background-color:#266fea;background-color:rgba(38,111,234,var(--bg-opacity))}.bg-tempc-500{--bg-opacity:1;background-color:#41d7aa;background-color:rgba(65,215,170,var(--bg-opacity))}.hover\:bg-white:hover{--bg-opacity:1;background-color:#fff;background-color:rgba(255,255,255,var(--bg-opacity))}.hover\:bg-red-400:hover{--bg-opacity:1;background-color:#fc8181;background-color:rgba(252,129,129,var(--bg-opacity))}.hover\:bg-yellow-600:hover{--bg-opacity:1;background-color:#d69e2e;background-color:rgba(214,158,46,var(--bg-opacity))}.hover\:bg-green-400:hover{--bg-opacity:1;background-color:#68d391;background-color:rgba(104,211,145,var(--bg-opacity))}.hover\:bg-teal-500:hover{--bg-opacity:1;background-color:#38b2ac;background-color:rgba(56,178,172,var(--bg-opacity))}.hover\:bg-blue-100:hover{--bg-opacity:1;background-color:#ebf8ff;background-color:rgba(235,248,255,var(--bg-opacity))}.hover\:bg-blue-400:hover{--bg-opacity:1;background-color:#63b3ed;background-color:rgba(99,179,237,var(--bg-opacity))}.hover\:bg-blue-500:hover{--bg-opacity:1;background-color:#4299e1;background-color:rgba(66,153,225,var(--bg-opacity))}.hover\:bg-blue-700:hover{--bg-opacity:1;background-color:#2b6cb0;background-color:rgba(43,108,176,var(--bg-opacity))}.hover\:bg-indigo-700:hover{--bg-opacity:1;background-color:#4c51bf;background-color:rgba(76,81,191,var(--bg-opacity))}.focus\:bg-blue-200:focus{--bg-opacity:1;background-color:#bee3f8;background-color:rgba(190,227,248,var(--bg-opacity))}.hover\:bg-opacity-50:hover{--bg-opacity:0.5}.border-gray-200{--border-opacity:1;border-color:#edf2f7;border-color:rgba(237,242,247,var(--border-opacity))}.border-gray-300{--border-opacity:1;border-color:#e2e8f0;border-color:rgba(226,232,240,var(--border-opacity))}.border-gray-400{--border-opacity:1;border-color:#cbd5e0;border-color:rgba(203,213,224,var(--border-opacity))}.border-red-600{--border-opacity:1;border-color:#e53e3e;border-color:rgba(229,62,62,var(--border-opacity))}.border-yellow-600{--border-opacity:1;border-color:#d69e2e;border-color:rgba(214,158,46,var(--border-opacity))}.border-green-400{--border-opacity:1;border-color:#68d391;border-color:rgba(104,211,145,var(--border-opacity))}.border-green-600{--border-opacity:1;border-color:#38a169;border-color:rgba(56,161,105,var(--border-opacity))}.border-teal-500{--border-opacity:1;border-color:#38b2ac;border-color:rgba(56,178,172,var(--border-opacity))}.border-blue-500{--border-opacity:1;border-color:#4299e1;border-color:rgba(66,153,225,var(--border-opacity))}.hover\:border-green-400:hover{--border-opacity:1;border-color:#68d391;border-color:rgba(104,211,145,var(--border-opacity))}.hover\:border-blue-600:hover{--border-opacity:1;border-color:#3182ce;border-color:rgba(49,130,206,var(--border-opacity))}.rounded-sm{border-radius:.125rem}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.rounded-full{border-radius:9999px}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.border-4{border-width:4px}.border-8{border-width:8px}.border{border-width:1px}.border-b-2{border-bottom-width:2px}.border-l-8{border-left-width:8px}.border-b{border-bottom-width:1px}.cursor-pointer{cursor:pointer}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-around{justify-content:space-around}.flex-auto{flex:1 1 auto}.flex-grow{flex-grow:1}.flex-shrink-0{flex-shrink:0}.font-normal{font-weight:400}.font-medium{font-weight:500}.font-semibold{font-weight:600}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-10{height:2.5rem}.h-16{height:4rem}.h-20{height:5rem}.h-64{height:16rem}.h-auto{height:auto}.h-full{height:100%}.text-xs{font-size:.75rem}.text-sm{font-size:.875rem}.text-base{font-size:1rem}.text-lg{font-size:1.125rem}.text-xl{font-size:1.25rem}.text-2xl{font-size:1.5rem}.text-3xl{font-size:1.875rem}.text-4xl{font-size:2.25rem}.text-5xl{font-size:3rem}.leading-none{line-height:1}.leading-tight{line-height:1.25}.leading-normal{line-height:1.5}.m-4{margin:1rem}.m-8{margin:2rem}.-m-4{margin:-1rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.mx-20{margin-left:5rem;margin-right:5rem}.my-64{margin-top:16rem;margin-bottom:16rem}.mx-auto{margin-left:auto;margin-right:auto}.-mx-8{margin-left:-2rem;margin-right:-2rem}.mb-0{margin-bottom:0}.ml-0{margin-left:0}.mt-1{margin-top:.25rem}.mr-1{margin-right:.25rem}.mb-1{margin-bottom:.25rem}.ml-1{margin-left:.25rem}.mt-2{margin-top:.5rem}.mr-2{margin-right:.5rem}.mb-2{margin-bottom:.5rem}.ml-2{margin-left:.5rem}.mt-3{margin-top:.75rem}.mb-3{margin-bottom:.75rem}.ml-3{margin-left:.75rem}.mt-4{margin-top:1rem}.mb-4{margin-bottom:1rem}.ml-4{margin-left:1rem}.mt-6{margin-top:1.5rem}.mr-6{margin-right:1.5rem}.mb-6{margin-bottom:1.5rem}.mt-8{margin-top:2rem}.mb-8{margin-bottom:2rem}.mt-10{margin-top:2.5rem}.mb-10{margin-bottom:2.5rem}.mt-12{margin-top:3rem}.mb-24{margin-bottom:6rem}.max-w-xs{max-width:20rem}.max-w-sm{max-width:24rem}.max-w-4xl{max-width:56rem}.max-w-6xl{max-width:72rem}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.min-w-0{min-width:0}.object-cover{-o-object-fit:cover;object-fit:cover}.focus\:outline-none:focus,.outline-none{outline:0}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.px-3{padding-left:.75rem;padding-right:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.px-8{padding-left:2rem;padding-right:2rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.py-16{padding-top:4rem;padding-bottom:4rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pb-2{padding-bottom:.5rem}.pl-2{padding-left:.5rem}.pr-4{padding-right:1rem}.pb-4{padding-bottom:1rem}.pt-6{padding-top:1.5rem}.pb-8{padding-bottom:2rem}.pt-10{padding-top:2.5rem}.pb-10{padding-bottom:2.5rem}.pl-10{padding-left:2.5rem}.pt-20{padding-top:5rem}.placeholder-gray-400::-moz-placeholder{--placeholder-opacity:1;color:#cbd5e0;color:rgba(203,213,224,var(--placeholder-opacity))}.placeholder-gray-400:-ms-input-placeholder{--placeholder-opacity:1;color:#cbd5e0;color:rgba(203,213,224,var(--placeholder-opacity))}.placeholder-gray-400::-ms-input-placeholder{--placeholder-opacity:1;color:#cbd5e0;color:rgba(203,213,224,var(--placeholder-opacity))}.placeholder-gray-400::placeholder{--placeholder-opacity:1;color:#cbd5e0;color:rgba(203,213,224,var(--placeholder-opacity))}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.top-0{top:0}.right-0{right:0}.bottom-0{bottom:0}.left-0{left:0}.shadow{box-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px 0 rgba(0,0,0,.06)}.shadow-md{box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06)}.shadow-lg{box-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -2px rgba(0,0,0,.05)}.shadow-xl{box-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 10px 10px -5px rgba(0,0,0,.04)}.shadow-2xl{box-shadow:0 25px 50px -12px rgba(0,0,0,.25)}.hover\:shadow-md:hover{box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06)}.hover\:shadow-lg:hover{box-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -2px rgba(0,0,0,.05)}.hover\:shadow-inner:hover{box-shadow:inset 0 2px 4px 0 rgba(0,0,0,.06)}.focus\:shadow-outline:focus{box-shadow:0 0 0 3px rgba(66,153,225,.5)}.fill-current{fill:currentColor}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-black{--text-opacity:1;color:#000;color:rgba(0,0,0,var(--text-opacity))}.text-white{--text-opacity:1;color:#fff;color:rgba(255,255,255,var(--text-opacity))}.text-gray-500{--text-opacity:1;color:#a0aec0;color:rgba(160,174,192,var(--text-opacity))}.text-gray-600{--text-opacity:1;color:#718096;color:rgba(113,128,150,var(--text-opacity))}.text-gray-700{--text-opacity:1;color:#4a5568;color:rgba(74,85,104,var(--text-opacity))}.text-gray-800{--text-opacity:1;color:#2d3748;color:rgba(45,55,72,var(--text-opacity))}.text-gray-900{--text-opacity:1;color:#1a202c;color:rgba(26,32,44,var(--text-opacity))}.text-red-600{--text-opacity:1;color:#e53e3e;color:rgba(229,62,62,var(--text-opacity))}.text-red-700{--text-opacity:1;color:#c53030;color:rgba(197,48,48,var(--text-opacity))}.text-yellow-700{--text-opacity:1;color:#b7791f;color:rgba(183,121,31,var(--text-opacity))}.text-green-600{--text-opacity:1;color:#38a169;color:rgba(56,161,105,var(--text-opacity))}.text-green-700{--text-opacity:1;color:#2f855a;color:rgba(47,133,90,var(--text-opacity))}.text-green-900{--text-opacity:1;color:#22543d;color:rgba(34,84,61,var(--text-opacity))}.text-teal-500{--text-opacity:1;color:#38b2ac;color:rgba(56,178,172,var(--text-opacity))}.text-blue-200{--text-opacity:1;color:#bee3f8;color:rgba(190,227,248,var(--text-opacity))}.text-blue-700{--text-opacity:1;color:#2b6cb0;color:rgba(43,108,176,var(--text-opacity))}.text-secondary-200{--text-opacity:1;color:#888883;color:rgba(136,136,131,var(--text-opacity))}.text-tempc-400{--text-opacity:1;color:#266fea;color:rgba(38,111,234,var(--text-opacity))}.text-tempc-500{--text-opacity:1;color:#41d7aa;color:rgba(65,215,170,var(--text-opacity))}.hover\:text-black:hover{--text-opacity:1;color:#000;color:rgba(0,0,0,var(--text-opacity))}.hover\:text-white:hover{--text-opacity:1;color:#fff;color:rgba(255,255,255,var(--text-opacity))}.hover\:text-gray-900:hover{--text-opacity:1;color:#1a202c;color:rgba(26,32,44,var(--text-opacity))}.hover\:text-red-500:hover{--text-opacity:1;color:#f56565;color:rgba(245,101,101,var(--text-opacity))}.hover\:text-yellow-500:hover{--text-opacity:1;color:#ecc94b;color:rgba(236,201,75,var(--text-opacity))}.hover\:text-green-500:hover{--text-opacity:1;color:#48bb78;color:rgba(72,187,120,var(--text-opacity))}.hover\:text-blue-800:hover{--text-opacity:1;color:#2c5282;color:rgba(44,82,130,var(--text-opacity))}.focus\:text-black:focus{--text-opacity:1;color:#000;color:rgba(0,0,0,var(--text-opacity))}.focus\:text-blue-900:focus{--text-opacity:1;color:#2a4365;color:rgba(42,67,101,var(--text-opacity))}.uppercase{text-transform:uppercase}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.whitespace-no-wrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-10{width:2.5rem}.w-16{width:4rem}.w-24{width:6rem}.w-32{width:8rem}.w-auto{width:auto}.w-1\/2{width:50%}.w-2\/3{width:66.666667%}.w-2\/5{width:40%}.w-4\/5{width:80%}.w-full{width:100%}.w-screen{width:100vw}.gap-4{grid-gap:1rem;gap:1rem}.gap-8{grid-gap:2rem;gap:2rem}.gap-10{grid-gap:2.5rem;gap:2.5rem}.grid-flow-col{grid-auto-flow:column}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-rows-2{grid-template-rows:repeat(2,minmax(0,1fr))}.grid-rows-4{grid-template-rows:repeat(4,minmax(0,1fr))}.transform{--transform-translate-x:0;--transform-translate-y:0;--transform-rotate:0;--transform-skew-x:0;--transform-skew-y:0;--transform-scale-x:1;--transform-scale-y:1;transform:translateX(var(--transform-translate-x)) translateY(var(--transform-translate-y)) rotate(var(--transform-rotate)) skewX(var(--transform-skew-x)) skewY(var(--transform-skew-y)) scaleX(var(--transform-scale-x)) scaleY(var(--transform-scale-y))}.hover\:scale-125:hover{--transform-scale-x:1.25;--transform-scale-y:1.25}.transition{transition-property:background-color,border-color,color,fill,stroke,opacity,box-shadow,transform}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}@-webkit-keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@-webkit-keyframes ping{0%{transform:scale(1);opacity:1}75%,to{transform:scale(2);opacity:0}}@keyframes ping{0%{transform:scale(1);opacity:1}75%,to{transform:scale(2);opacity:0}}@-webkit-keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}@-webkit-keyframes bounce{0%,to{transform:translateY(-25%);-webkit-animation-timing-function:cubic-bezier(.8,0,1,1);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:translateY(0);-webkit-animation-timing-function:cubic-bezier(0,0,.2,1);animation-timing-function:cubic-bezier(0,0,.2,1)}}@keyframes bounce{0%,to{transform:translateY(-25%);-webkit-animation-timing-function:cubic-bezier(.8,0,1,1);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:translateY(0);-webkit-animation-timing-function:cubic-bezier(0,0,.2,1);animation-timing-function:cubic-bezier(0,0,.2,1)}}@media (min-width:640px){.sm\:container{width:100%;max-width:640px}@media (min-width:768px){.sm\:container{max-width:768px}}@media (min-width:1024px){.sm\:container{max-width:1024px}}@media (min-width:1280px){.sm\:container{max-width:1280px}}.sm\:h-20{height:5rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:px-8{padding-left:2rem;padding-right:2rem}}@media (min-width:768px){.md\:container{width:100%}@media (min-width:640px){.md\:container{max-width:640px}}@media (min-width:768px){.md\:container{max-width:768px}}@media (min-width:1024px){.md\:container{max-width:1024px}}@media (min-width:1280px){.md\:container{max-width:1280px}}.md\:block{display:block}.md\:inline-block{display:inline-block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:flex-row{flex-direction:row}.md\:items-center{align-items:center}.md\:justify-center{justify-content:center}.md\:h-screen{height:100vh}.md\:text-sm{font-size:.875rem}.md\:text-xl{font-size:1.25rem}.md\:text-2xl{font-size:1.5rem}.md\:text-3xl{font-size:1.875rem}.md\:mx-auto{margin-left:auto;margin-right:auto}.md\:ml-56{margin-left:14rem}.md\:ml-64{margin-left:16rem}.md\:ml-auto{margin-left:auto}.md\:px-2{padding-left:.5rem;padding-right:.5rem}.md\:px-8{padding-left:2rem;padding-right:2rem}.md\:px-10{padding-left:2.5rem;padding-right:2.5rem}.md\:py-12{padding-top:3rem;padding-bottom:3rem}.md\:pb-0{padding-bottom:0}.md\:fixed{position:fixed}.md\:top-0{top:0}.md\:left-0{left:0}.md\:break-all{word-break:break-all}.md\:w-56{width:14rem}.md\:w-1\/2{width:50%}.md\:w-4\/5{width:80%}.md\:z-50{z-index:50}.md\:gap-4{grid-gap:1rem;gap:1rem}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:col-span-4{grid-column:span 4/span 4}.md\:grid-rows-1{grid-template-rows:repeat(1,minmax(0,1fr))}.md\:grid-rows-3{grid-template-rows:repeat(3,minmax(0,1fr))}}@media (min-width:1024px){.lg\:container{width:100%}@media (min-width:640px){.lg\:container{max-width:640px}}@media (min-width:768px){.lg\:container{max-width:768px}}@media (min-width:1024px){.lg\:container{max-width:1024px}}@media (min-width:1280px){.lg\:container{max-width:1280px}}.lg\:block{display:block}.lg\:grid{display:grid}.lg\:items-start{align-items:flex-start}.lg\:items-center{align-items:center}.lg\:justify-center{justify-content:center}.lg\:text-sm{font-size:.875rem}.lg\:text-base{font-size:1rem}.lg\:text-lg{font-size:1.125rem}.lg\:text-3xl{font-size:1.875rem}.lg\:text-4xl{font-size:2.25rem}.lg\:text-5xl{font-size:3rem}.lg\:text-6xl{font-size:4rem}.lg\:ml-64{margin-left:16rem}.lg\:p-6{padding:1.5rem}.lg\:px-10{padding-left:2.5rem;padding-right:2.5rem}.lg\:text-center{text-align:center}.lg\:w-64{width:16rem}.lg\:w-1\/4{width:25%}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-rows-2{grid-template-rows:repeat(2,minmax(0,1fr))}.lg\:grid-rows-3{grid-template-rows:repeat(3,minmax(0,1fr))}.lg\:row-span-2{grid-row:span 2/span 2}}@media (min-width:1280px){.xl\:container{width:100%}@media (min-width:640px){.xl\:container{max-width:640px}}@media (min-width:768px){.xl\:container{max-width:768px}}@media (min-width:1024px){.xl\:container{max-width:1024px}}@media (min-width:1280px){.xl\:container{max-width:1280px}}} \ No newline at end of file diff --git a/public/css/tailwind.css b/public/css/tailwind.css index 985abac..629c605 100644 --- a/public/css/tailwind.css +++ b/public/css/tailwind.css @@ -4,40 +4,104 @@ html, body { - margin: 0; - padding: 0; - width: 100%; - height: 100%; - overflow-x: hidden; - box-sizing: border-box; - background-color: rgb(226, 232, 240); + margin: 0; + padding: 0; + width: 100%; + height: 100%; + overflow-x: hidden; + box-sizing: border-box; + background-color: rgb(226, 232, 240); } .chartjs-container { - position: relative; - margin: auto; - height: 75vh; - width: 75vw; + position: relative; + margin: auto; + height: 75vh; + width: 75vw; +} + +.tradebyte-logo { + color: #1955e4; + text-shadow: 1px 2px 40px rgba(0, 0, 0, 0.5); +} + +.line { + border: 1.5px solid #8e9aad; +} + +.user-profile { + border-radius: 100px; + border: 10px solid #1955e4; + width: 130px; + height: 130px; +} + +.tick { + height: 22px; + width: 22px; + border-radius: 50%; + background-color: #38cda0; + color: white; +} + +.tick-background { + background: #a9f7e6; + border-radius: 29px; + color: #1b9b7f; +} + +.tab-color { + border-radius: 10px; + border-color: #1955e4; + color: #1955e4; +} + +.view-link { + color: #1955e4; +} + +.view-link:hover { + color: #0d338a; +} + +.button { + background-color: #1955e4; +} + +.button:hover { + background-color: #0d338a; +} + +.table-content { + overflow: scroll; + overflow-x: scroll; + overflow-y: auto; +} + +.transaction-companySymbol { + color: rgb(0, 0, 0); + font-weight: 700; + font-size: 1.1rem; } @tailwind components; .symbolicon { - font-size: 72px; - background: -webkit-linear-gradient(#eee, #333); - background-clip: text; - -webkit-background-clip: text; - -webkit-text-fill-color: transparent; + font-size: 72px; + background: -webkit-linear-gradient(#eee, #333); + background-clip: text; + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; } -.min-w{ - min-width: 400px; +.min-w { + min-width: 400px; } -@media (max-width:400px){ - .min-w{ - min-width: 300px; - } +@media (max-width: 400px) { + .min-w { + min-width: 300px; + } } -@tailwind utilities; \ No newline at end of file +@tailwind utilities; diff --git a/routes/api/addBalance.js b/routes/api/addBalance.js index bd75df5..cef6d55 100644 --- a/routes/api/addBalance.js +++ b/routes/api/addBalance.js @@ -4,6 +4,7 @@ const express = require("express"); const router = express.Router(); const { ensureAuth, ensureGuest } = require("../../middleware/auth"); const User = require("../../models/User"); +const Transaction = require("../../models/Transaction"); // @desc // Add Balance page // @route GET / @@ -25,19 +26,36 @@ router.post("/", ensureAuth, async(req, res) => { // why ensureGuest here? let amount = Number(req.body.addAmount); // type cast amount to number as body parser take it as string let finalAmont = amount + req.user.balance; + + try { + // Updating balance to user's schema. + req.body.user = req.user.id; + const updateBalance = await User.findOneAndUpdate( + { _id: req.user.id }, + { balance: finalAmont }, + { + new: true, // it will create a new one, if it doesn't exist + runValidators: true, // it check weather the fields are valid or not + } + ); + // Adding new transaction details on Transaction Schema. + const transactionDetails = 'Balance Added to Wallet' + const transactionOpration = 'Deposit' + const transactionUser = req.user.id + const updateTransactoin = await Transaction.create( + { details: transactionDetails, + amount: amount, + opration: transactionOpration, + user: transactionUser + }) + + console.log(updateTransactoin); + res.redirect("/done"); + } catch (err) { + console.error(err); + res.render("error/500"); + } - try { - req.body.user = req.user.id; - const updateBalance = await User.findOneAndUpdate({ _id: req.user.id }, { balance: finalAmont }, { - new: true, // it will create a new one, if it doesn't exist - runValidators: true, // it check weather the fields are valid or not - }); - console.log(updateBalance); - res.redirect("/"); - } catch (err) { - console.error(err); - res.render("error/500"); - } }); module.exports = router; \ No newline at end of file diff --git a/routes/api/cart.js b/routes/api/cart.js index a2ac132..39b6e49 100644 --- a/routes/api/cart.js +++ b/routes/api/cart.js @@ -35,25 +35,37 @@ router.get("/:symbol", ensureAuth, async (req, res) => { // @desc To buy // @route POST /cart/buy router.post("/buy", ensureAuth, async (req, res) => { - let data = req.body; - let user = req.user; - let stockPrice = data.stockPrice; - let noOfStock = data.noOfStock; - let totalAmount = parseFloat(stockPrice * noOfStock).toFixed(4); + const user = req.user; + const symbol = req.body.companySymbol; + const { latestPrice } = await getPrice(symbol);; + const noOfStock = req.body.noOfStock; + const totalAmount = parseFloat(latestPrice * noOfStock).toFixed(4); + + const data = { + companySymbol: symbol, + stockPrice: latestPrice, + noOfStock: noOfStock, + totalAmount: totalAmount, + } + + console.log(data) try { if (totalAmount > req.user.balance) { let ExtraBalance = totalAmount - req.user.balance; - res.render("transaction", { + res.render("transaction/transaction", { + layout: "layouts/app", + href: "/buy", ExtraBalance, message: "Insufficent Balance", }); } else { - res.render("transaction", { + res.render("transaction/transaction", { data, user, - totalAmount, message: "Order Review", + layout: "layouts/app", + href: "/buy", }); } } catch (err) { diff --git a/routes/api/portfolio.js b/routes/api/portfolio.js index 6a92f72..090f60f 100644 --- a/routes/api/portfolio.js +++ b/routes/api/portfolio.js @@ -10,6 +10,7 @@ const totalData = require("../../config/data-total.json"); // @route GET /portfolio // @access Private router.get("/", ensureAuth, (req, res) => { + let user = req.user; let avatar = req.user.image; res .status(200) diff --git a/routes/api/transaction.js b/routes/api/transaction.js index 7353194..2ad10e6 100644 --- a/routes/api/transaction.js +++ b/routes/api/transaction.js @@ -4,6 +4,8 @@ const express = require("express"); const router = express.Router(); const { ensureAuth } = require("../../middleware/auth"); const User = require("../../models/User"); +const Transaction = require("../../models/Transaction"); +const getPrice = require("../../helpers/getPrice"); // @desc To Buy Transaction Page // @route POST transaction/confirm @@ -14,6 +16,8 @@ router.put("/confirm", ensureAuth, async (req, res) => { req.body.user = req.user.id; + console.log(req.body) + const updatedUser = await User.findOneAndUpdate( { _id: req.user.id }, { balance: balance, $push: { stock: req.body } }, @@ -22,7 +26,22 @@ router.put("/confirm", ensureAuth, async (req, res) => { runValidators: true, // it check weather the fields are valid or not } ); - console.log(updatedUser); + + // Add data transaction + // Adding new transaction details on Transaction Schema. + const transactionDetails = `Added ${req.body.noOfStock} ${req.body.companySymbol} stock` + const transactionOpration = 'Debited'; + const transactionUser = req.user.id; + const transactionAmount = Number(req.body.totalAmount); + + const updateTransactoin = await Transaction.create( + { details: transactionDetails, + amount: transactionAmount, + opration: transactionOpration, + user: transactionUser + }); + + console.log(updateTransactoin); res.redirect("/done"); } catch (err) { console.error(err); @@ -30,4 +49,77 @@ router.put("/confirm", ensureAuth, async (req, res) => { } }); +// @desc To View Transaction History +// @route POST /transaction +// @access Private +router.get('/', ensureAuth, async (req,res) => { + const user = req.user; + try { + const transactions = await Transaction.find({ user: req.user.id }) + .populate('user') + .sort({ created: 'desc'}) + .lean() + + res.render('transaction/history', { + transactions, + user, + layout: "layouts/app", + href: "/transaction", + }) + } catch (err) { + console.error(err) + res.render('error/500') + } +}); + +// @desc To Sell Stock +// @route POST /transaction/sell +// @access Private +router.post("/sell/:id", ensureAuth, async (req,res) => { + try { + const user = await User.findById(req.user.id) + + // get number of stocks and amount of stock + user.stock.forEach( async (stock) => { + if(stock._id == req.params.id) { + // Adding new transaction details on Transaction Schema. + const transactionDetails = `Sold ${stock.noOfStock} stock of ${stock.companySymbol}` + const transactionOpration = 'Credit'; + const transactionUser = req.user.id; + + // update balance get real time update + const { high } = await getPrice(stock.companySymbol); + const totalAmount = high * stock.noOfStock + const newBalance = req.user.balance + totalAmount + + // Added to Transaction + const updateTransaction = await Transaction.create( + { details: transactionDetails, + amount: totalAmount, + opration: transactionOpration, + user: transactionUser + }); + + // Update the User Balance and Deleted the Sold Stock + const updatedBalance = await User.findOneAndUpdate( + { _id: req.user.id }, + { balance: newBalance, $pull: { stock: { _id: req.params.id } } } + ); + + console.log(updatedBalance) + console.log(updateTransaction) + console.log(newBalance) + } + }); + + + + res.redirect('/done'); + } catch (err) { + console.error(err) + res.render('error/500') + } +}); + + module.exports = router; diff --git a/views/addBalance.ejs b/views/addBalance.ejs index 3bc4e8e..41cebc0 100644 --- a/views/addBalance.ejs +++ b/views/addBalance.ejs @@ -1,26 +1,25 @@ -
-
-
-

AddBalance -

-
-
-
-

Your Current Balance: - <%= user.balance%> -

-
-
-
-
- - - -
-
-
+
+
+
+

Add Balance

+
+
+ +
+

Your Current Balance: <%= user.balance%>

+
+
+ + + +
+
+
-
-
\ No newline at end of file + + diff --git a/views/cart.ejs b/views/cart.ejs index e803775..c8e6270 100644 --- a/views/cart.ejs +++ b/views/cart.ejs @@ -1,7 +1,20 @@
-
+ + + +

Buy Stock : \ No newline at end of file + diff --git a/views/partials/_nav.ejs b/views/partials/_nav.ejs index e6bd0dd..34738a9 100644 --- a/views/partials/_nav.ejs +++ b/views/partials/_nav.ejs @@ -1,57 +1,82 @@ +
-
-

- Tradebyte -

- -
-
+ +

diff --git a/views/portfolio.ejs b/views/portfolio.ejs index bc86792..06120fb 100644 --- a/views/portfolio.ejs +++ b/views/portfolio.ejs @@ -1,16 +1,22 @@ -
-
- +
+
+ - + -
-

- TradeByte -

-
+
+ Hello, + +
+ +
- +
@@ -34,7 +40,7 @@ d="M55.146,51.887L41.588,37.786c3.486-4.144,5.396-9.358,5.396-14.786c0-12.682-10.318-23-23-23s-23,10.318-23,23 s10.318,23,23,23c4.761,0,9.298-1.436,13.177-4.162l13.661,14.208c0.571,0.593,1.339,0.92,2.162,0.92 c0.779,0,1.518-0.297,2.079-0.837C56.255,54.982,56.293,53.08,55.146,51.887z M23.984,6c9.374,0,17,7.626,17,17s-7.626,17-17,17 s-17-7.626-17-17S14.61,6,23.984,6z" /> - +
    @@ -86,29 +92,32 @@
    - + -

    Overview

    - -
    +

    Overview

    + +
    - + -
    - +
    + -
    -
    - +
    +
    + -

    Trade History

    - View All >Trade History + View All >
    -
    +
    @@ -159,7 +168,7 @@ btc/usd

    - - - - - - - - - - + <% user.stock.forEach( (stock) => { %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + <% }) %>
    + @@ -182,7 +191,7 @@ Jan 8, 2020

    +

    Bitterx

    @@ -193,7 +202,7 @@

    + @@ -228,7 +237,7 @@

    + @@ -251,7 +260,7 @@ Jan 8, 2020

    +

    Bitterx

    @@ -262,7 +271,7 @@

    + @@ -286,18 +295,18 @@ Jan 21, 2020

    +

    Gdax

    +

    btc/usd

    + @@ -332,7 +341,7 @@

    + @@ -357,12 +366,12 @@ -
    +
    -

    Stock Status

    - Stock Status + View All >
    @@ -395,6 +404,11 @@ > status +
    + Number Of Stock + @@ -406,313 +420,83 @@

    - Gdax + <%= stock.companySymbol %>

    - $11111 + <% currentPrice = 500 %> $<%= currentPrice %>

    - 0.2334 - <% + if(price < 0) { %> <% color="red" %> + $<%= price.toPrecision(4) %> - - -

    -
    -

    - +639 -

    -
    - - - -
    -

    - Gdax1 -

    -
    -

    - $11112 -

    -
    -

    - 0.2334 - <% color="green" %> + $<%= price.toPrecision(4) %> - - -

    -
    -

    - -639 + <% } %>

    - - - -
    -

    - Gdax -

    -
    -

    - $11111 -

    -
    -

    - 0.2334 - - - -

    -

    - +639 -

    -
    - - - -
    -

    - Gdax -

    -
    -

    - $11111 -

    -
    -

    - 0.2334 - - - + <% if(stock.stockPrice > currentPrice) { %> <% loss = + stock.stockPrice - currentPrice %> <% status = + (loss/stock.stockPrice) * 100 %> <% } else + if(stock.stockPrice < currentPrice) { %> <% gain = + currentPrice - stock.stockPrice %> <% status = + (gain/stock.stockPrice) * 100 %> <% } %> + <%= status.toPrecision(4) %>%

    -

    - -119 -

    -
    - - - -

    - Gdax -

    -
    -

    - $11111 -

    -
    -

    - 0.2334 - - - + <%= stock.noOfStock %>

    -

    - +639 -

    -
    - - - -
    -

    - Gdax -

    -
    -

    - $11111 -

    -
    -

    - 0.2334 - - - -

    -
    -

    - -339 -

    -
    - - - + +
    @@ -733,8 +517,6 @@
    - - \ No newline at end of file + + diff --git a/views/transaction/history.ejs b/views/transaction/history.ejs new file mode 100644 index 0000000..ff446ae --- /dev/null +++ b/views/transaction/history.ejs @@ -0,0 +1,46 @@ +
    +
    +
    +

    Transaction History

    +
    +
    + +
    +

    Current Balance: <%= user.balance%>

    + + + + + + + + + + + + <% transactions.forEach( (stock) => { %> + + + + + + + <% }) %> + + +
    DateOprationAmountDetails
    +

    <%= stock.createdAt %>

    +
    +

    <%= stock.opration %>

    +
    +

    <%= stock.amount %>

    +
    +

    <%= stock.details %>

    +
    +
    + + <%- include('../partials/_footer.ejs') %> + +
    + + \ No newline at end of file diff --git a/views/transaction.ejs b/views/transaction/transaction.ejs similarity index 95% rename from views/transaction.ejs rename to views/transaction/transaction.ejs index a00a53e..6540d2b 100644 --- a/views/transaction.ejs +++ b/views/transaction/transaction.ejs @@ -4,7 +4,6 @@

    Please Add <%= ExtraBalance %> or more to complete the Transaction.

    <% } else { %>

    <%= message %>

    -<% } %>

    Your Balance: <%= user.balance%>


    @@ -43,8 +42,10 @@ readonly type="Number" name="totalAmount" - value="<%= totalAmount%>" + value="<%= data.totalAmount%>" /> + +<% } %> \ No newline at end of file diff --git a/views/view.ejs b/views/view.ejs index 8ea3537..1f85585 100644 --- a/views/view.ejs +++ b/views/view.ejs @@ -1,185 +1,153 @@
    -
    -

    - TradeByte -

    -
    - - -
    -
    -
    -

    - <%= assetName %> -

    -

    - Sector: - <%= Sector %> -

    -
    -
    -

    - <%= latestPrice%> -

    -
    + + +
    +
    +
    +

    <%= assetName %>

    +

    + Sector: + <%= Sector %> +

    +
    +
    +

    <%= latestPrice%>

    +
    +
    +

    Price Summary

    +
    +
    +
    +
    +

    + Today's High +

    +

    <%= high %>

    +
    +
    +

    + Today's Low +

    +

    <%= low %>

    +
    +
    +

    + 52 Week High +

    +

    <%= weeksHigh %>

    +
    +
    +

    + 52 Week Low +

    +

    <%= weeksLow %>

    +
    -

    Price Summary

    -
    -
    -
    -
    -

    - Today's High -

    -

    - <%= high %> -

    -
    -
    -

    - Today's Low -

    -

    - <%= low %> -

    -
    -
    -

    - 52 Week High -

    -

    - <%= weeksHigh %> -

    -
    -
    -

    - 52 Week Low -

    -

    - <%= weeksLow %> -

    -
    -
    -
    -
    +
    +
    -

    Overview

    -
    - -
    +

    Overview

    +
    + +
    -

    Company Essentials

    -
    -
    -
    -
    -

    - Market Cap -

    -

    - <%= MarketCap %> -

    -
    -
    -

    EBITDA

    -

    - <%= Ebitda %> -

    -
    -
    -

    P/E

    -

    - <%= PERatio %> -

    -
    -
    -

    P/B

    -

    - <%= PriceToBookRatio %> -

    -
    -
    -

    - EPS(TTM) -

    -

    - <%= EPS %> -

    -
    -
    -

    - Div. Yield -

    -

    - <%= DividendYield %> -

    -
    -
    -

    - Book Value -

    -

    - <%= BookValue %> -

    -
    -
    -

    - Revenue(TTM) -

    -

    - <%= RevenueTTM %> -

    -
    -
    -
    -
    -
    - -
    + + - +
    \ No newline at end of file + let datesList = <%- JSON.stringify(dates) %>; + let closingList = <%- JSON.stringify(closing) %>; + var ctx = document.getElementById('chart').getContext('2d'); + var myChart = new Chart(ctx, { + type: 'line', + data: { + labels: datesList, closingList, + datasets: [{ + label: <%- JSON.stringify(symbol) %>, + data: closingList, + borderColor: "#3e95cd", + backgroundColor: "rgba(118,152,255,0.4)" + }] + }, + options: { + responsive: true, + maintainAspectRatio: false, + }, + }); +