| 4 | } from './utils.js'; |
| 5 | |
| 6 | export function whoami() { |
| 7 | $d.append(`<br><br><div class="profile editPhoto" data-uid="${firebase.auth().getUid()}"> |
| 8 | <h3 style="text-align: center;"><strong>${displayName}'S PROFILE</strong></h3> |
| 9 | <div id="profileChange"></div> |
| 10 | <div class="profileData" style="float: left;max-width: 250px;"><small style="text-align: left;">USERNAME:</small> |
| 11 | <p class="highlight" style="text-align: left;">${displayName}<span style="color: rgba(159, 159, 159, 0.64);">#${tagNo}</span></p> |
| 12 | <hr /><small style="text-align: left;">SECURITY CLEARANCE LEVEL:</small> |
| 13 | <p class="highlight" style="text-align: left;">${clearance}</p> |
| 14 | <hr /><small>PERSONNEL CLASSIFICATION:</small> |
| 15 | <p class="highlight">${classification}</p> |
| 16 | <hr /><small style="text-align: left;">STAFF TITLE:</small> |
| 17 | <p class="highlight" style="text-align: left;">${title}</p> |
| 18 | <hr /><small style="text-align: left;">WORKING SITE:</small> |
| 19 | <p class="highlight" style="text-align: left;">${site}</p> |
| 20 | <hr /> |
| 21 | <p style="text-align: left;"> </p> |
| 22 | </div> |
| 23 | <div style="clear: both;"> </div> |
| 24 | <h3 style="text-align: center;"><strong>CONFIDENTIAL INFORMATION</strong></h3> |
| 25 | <small style="text-align: left;">EMAIL ADDRESS:</small> |
| 26 | <p class="highlight" style="text-align: left;">${firebase.auth().currentUser.email}</p> |
| 27 | <hr /> |
| 28 | <small style="text-align: left;">USER ID:</small> |
| 29 | <p class="highlight" style="text-align: left;">${tag}</p> |
| 30 | <hr /> |
| 31 | <small style="text-align: left;">DATE OF JOINING THE FOUNDATION:</small> |
| 32 | <p class="highlight" style="text-align: left;">${new Date(firebase.auth().currentUser.metadata.creationTime).toLocaleDateString("en-US")}</p> |
| 33 | <hr /> |
| 34 | <small style="text-align: left;">LAST LOGIN TIME:</small> |
| 35 | <p class="highlight" style="text-align: left;">${new Date(firebase.auth().currentUser.metadata.lastSignInTime).toLocaleString('en-US')}</p> |
| 36 | <hr /> |
| 37 | </div><br>`) |
| 38 | var storageRef = firebase.storage() |
| 39 | storageRef.ref(`user/${firebase.auth().getUid()}/pfp/pfp.jpg`).getDownloadURL().then((url) => { |
| 40 | console.log(url); |
| 41 | $d.find("#profileChange").replaceWith(`<img class="profilePic" id="${profileListing}-profile" style="float: right; position: relative; width: 200px; height: 228px;" src="${url}" />`) |
| 42 | $d.find(`#${profileListing}-profile`).on('load', function() { |
| 43 | if ($(this).parent(".editPhoto").is(":visible") == false) { |
| 44 | $(this).parent(".editPhoto").show() |
| 45 | $d.append(`${holder} `) |
| 46 | cmdShow() |
| 47 | btnShow() |
| 48 | $("#cmdIframe").contents().scrollTop($("#cmdIframe").contents().scrollTop() + 100) |
| 49 | } |
| 50 | }); |
| 51 | }).catch((error) => { |
| 52 | if (error.code == "storage/object-not-found") { |
| 53 | $d.find("#profileChange").replaceWith(`<div class="upload" style="float: right;position: relative;">Click to add a profile picture<br><b>+</b><br><small>File should not exceed 20 MB</small><input class="file_upload" type="file" accept="image/*" onchange="parent.uploadfile(this)" onclick="this.value=null;" /></div>`) |
| 54 | } |
| 55 | $d.find(".profile").show() |
| 56 | $d.append(`${holder} `) |
| 57 | cmdShow() |
| 58 | btnShow() |
| 59 | $("#cmdIframe").contents().scrollTop($("#cmdIframe").contents().scrollTop() + 100) |
| 60 | }) |
| 61 | } |