ソースを参照

Add some very basic functionality to the account strand.

Lee Morgan 5 年 前
コミット
37dc49d6ed

+ 18 - 1
views/dashboardPage/bundle.js

@@ -2945,7 +2945,24 @@ module.exports = transactionFilter;
 },{}],20:[function(require,module,exports){
 let account = {
     display: function(){
-        console.log("account page");
+        document.getElementById("accountStrandTitle").innerText = merchant.name;
+        document.getElementById("accountShowPassword").onclick = ()=>{this.togglePassword()};
+    },
+
+    togglePassword: function(){
+        let passBox = document.getElementById("changePasswordBox");
+        let button = document.getElementById("accountShowPassword");
+
+        if(passBox.style.display === "none"){
+            passBox.style.display = "flex";
+            button.innerText = "HIDE PASSWORD";
+        }else{
+            passBox.style.display = "none";
+            button.innerText = "CHANGE PASSWORD";
+            document.getElementById("accountCurrentPassword").value = "";
+            document.getElementById("accountNewPassword").value = "";
+            document.getElementById("accountConfirmPassword").value = "";
+        }
     }
 }
 

+ 21 - 1
views/dashboardPage/ejs/strands/account.ejs

@@ -1,5 +1,25 @@
 <div id="accountStrand" class="strand">
     <div class="strandHead">
-        <h1 id="accountStrandtitle" class="strandTitle">ACCOUNT</h1>
+        <h1 id="accountStrandTitle" class="strandTitle"></h1>
+    </div>
+
+    <label>EMAIL
+        <input id="accountEmail" type="email">
+    </label>
+
+    <button id="accountShowPassword" class="button">CHANGE PASSWORD</button>
+
+    <div id="changePasswordBox" style="display:none;">
+        <label>CURRENT PASSWORD
+            <input id="accountCurrentPassword" type="password">
+        </label>
+
+        <label>NEW PASSWORD
+            <input id="accountNewPassword" type="password">
+        </label>
+
+        <label>CONFIRM NEW PASSWORD
+            <input id="accountConfirmPassword" type="password">
+        </label>
     </div>
 </div>

+ 18 - 1
views/dashboardPage/js/strands/account.js

@@ -1,6 +1,23 @@
 let account = {
     display: function(){
-        console.log("account page");
+        document.getElementById("accountStrandTitle").innerText = merchant.name;
+        document.getElementById("accountShowPassword").onclick = ()=>{this.togglePassword()};
+    },
+
+    togglePassword: function(){
+        let passBox = document.getElementById("changePasswordBox");
+        let button = document.getElementById("accountShowPassword");
+
+        if(passBox.style.display === "none"){
+            passBox.style.display = "flex";
+            button.innerText = "HIDE PASSWORD";
+        }else{
+            passBox.style.display = "none";
+            button.innerText = "CHANGE PASSWORD";
+            document.getElementById("accountCurrentPassword").value = "";
+            document.getElementById("accountNewPassword").value = "";
+            document.getElementById("accountConfirmPassword").value = "";
+        }
     }
 }