From ead73863120b3c7b6a23a81a4dee7dfcaf71185f Mon Sep 17 00:00:00 2001 From: Jun Huang Date: Sat, 8 Apr 2023 20:23:11 -0700 Subject: [PATCH] Fix Issue #2 --- README.md | 2 +- src/ui.js | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f89e209..1b9d57d 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This is a CRM built with in HTML/CSS/JS. This webapp helps our business departme Your job is to fix 4 issues: 1. ~~[Company Names are Missing](https://github.com/developer-job-simulation/javascript-crm/issues/1)~~ -1. [Display Dates in 24-hour Time Format](https://github.com/developer-job-simulation/javascript-crm/issues/2) +1. ~~[Display Dates in 24-hour Time Format](https://github.com/developer-job-simulation/javascript-crm/issues/2)~~ 1. [Display Revenue Numbers in a Human Readable Format](https://github.com/developer-job-simulation/javascript-crm/issues/3) 1. [Make Table Look Prettier](https://github.com/developer-job-simulation/javascript-crm/issues/4) diff --git a/src/ui.js b/src/ui.js index 5682dea..c5e216f 100644 --- a/src/ui.js +++ b/src/ui.js @@ -1,11 +1,11 @@ -import {fetchCompanies} from "./api"; +import { fetchCompanies } from "./api"; import { ACCOUNT_EXECUTIVE_FIELD_NAME, COMPANIES_TABLE_HEADERS, COMPANY_NAME_FIELD_NAME, CREATED_AT_FIELD_NAME, REVENUE_YTD_FIELD_NAME, - STATUS_FIELD_NAME + STATUS_FIELD_NAME, } from "./constants"; export const makeTable = async () => { @@ -20,12 +20,13 @@ export const makeTable = async () => { companiesToDisplay.push(COMPANIES_TABLE_HEADERS); // Here we simply rearrange company fields in the order in which we want to display them in UI - companies.map(company => { + companies.map((company) => { const row = []; + const HHMMDateFormat = company[CREATED_AT_FIELD_NAME].slice(11, -4); row.push( company[COMPANY_NAME_FIELD_NAME], company[STATUS_FIELD_NAME], - company[CREATED_AT_FIELD_NAME], + HHMMDateFormat, company[REVENUE_YTD_FIELD_NAME], company[ACCOUNT_EXECUTIVE_FIELD_NAME] ); @@ -36,12 +37,12 @@ export const makeTable = async () => { const table = document.createElement("table"); document.body.appendChild(table); // Drew the main table node on the document - companiesToDisplay.forEach(row => { + companiesToDisplay.forEach((row) => { const tr = table.insertRow(); //Create a new row - row.forEach(column => { + row.forEach((column) => { const td = tr.insertCell(); td.innerText = column; // Take string from placeholder variable and append it to node }); }); -}; \ No newline at end of file +};