Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JunYuHuang committed Apr 9, 2023
1 parent e38f020 commit ead7386
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
15 changes: 8 additions & 7 deletions src/ui.js
Original file line number Diff line number Diff line change
@@ -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 () => {
Expand All @@ -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]
);
Expand All @@ -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 <tr> node
});
});
};
};

0 comments on commit ead7386

Please sign in to comment.