From 182cb2751059b085751c2c70181a62ddcf9eb4c2 Mon Sep 17 00:00:00 2001 From: garimasingh22 <44470092+garimasingh22@users.noreply.github.com> Date: Fri, 28 Aug 2020 12:04:52 +0530 Subject: [PATCH 1/2] #65 add searchbox in market --- views/market.ejs | 86 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 3 deletions(-) diff --git a/views/market.ejs b/views/market.ejs index ee4c282..8ad93f0 100644 --- a/views/market.ejs +++ b/views/market.ejs @@ -1,9 +1,45 @@
-
-

Favorite Stocks

+
+
+ +

Favorite Stocks

+
+ + +
+
+
+ + +
+ +
    + + +
    +
    -
    +
    <% for(var i=0; i < compactData.length; i++) { %> @@ -141,3 +177,47 @@ } } + + + + \ No newline at end of file From 5bfc47fe855b0c4f6a694909502e84e6e521fd7e Mon Sep 17 00:00:00 2001 From: garimasingh22 <44470092+garimasingh22@users.noreply.github.com> Date: Fri, 28 Aug 2020 12:27:05 +0530 Subject: [PATCH 2/2] portfolio search by company name --- views/portfolio.ejs | 77 ++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/views/portfolio.ejs b/views/portfolio.ejs index 8f79d21..a5069d0 100644 --- a/views/portfolio.ejs +++ b/views/portfolio.ejs @@ -1,13 +1,11 @@
    -
    - +
    + - + -
    - Hello, + Hello,
    -
    +
    +
    - + -
    -
    +
    +
     -
    -
    +
    +

    - $ 40,342.04 + $ 40,342.04

    Profit / Loss -
    +
    - + -
    -
    +
    +
     -
    -
    +
    +

    - $40,342.04 + $40,342.04

    $ Balance -
    -
    +
    +
    @@ -117,14 +111,13 @@
    - + -
    -
    - -

    Trade History

    - View All > +
    + +

    Trade History

    + View All >
    @@ -542,10 +535,22 @@ //sample data const dataset = <%- JSON.stringify(totalData) %>; +// when symbol matches + let data = dataset.filter(function(el) { return el.Symbol.includes(value.toUpperCase()) }) +// when no symbol matches + + if (data.length === 0) { + +let data1 = dataset.filter(function(el) { + return (el["Company Name"].toLowerCase().includes(value.toLowerCase())) +}) +data = data1; +} + let list = ""; if (value === "") { list = ""; @@ -555,4 +560,4 @@ for (i = 0; i <= (n - 1); i++) { let item = data[i]; list += `
  • ${item.Symbol}
  • ` } document.getElementById('search-result').innerHTML = list ;console.log(data) }) - + \ No newline at end of file