Cook the Books

Populator for Cook the Books.

by mikerourke

HTML

<div id="wrapper">
  <div class="control">
    <p>
      Paste your jsonstore.io endpoint in the input below and press the "Populate Data" button
    </p>
    <p>
      If you don't have an endpoint yet, get one from <a href="https://www.jsonstore.io/" target="_blank">here</a>
    </p>
  </div>
  <div class="control">
    <input id="endpoint" />
  </div>
  <div class="control">
    <button id="populate">Populate Data</button>
    <button id="reset">Reset</button>
  </div>
  <div class="control">
    <span>Status: </span><span id="status">Pending</span>
  </div>
</div>

CSS

#wrapper {
  margin: 16px;
}

#endpoint {
  width: 100%;
}

.control {
  margin: 8px;
  width: inherit;
}

JavaScript

var transactionsData = [
  {
    "id": 1000,
    "transactionDate": "2017-08-02",
    "toFrom": "Uncle Buck's Insurance",
    "type": "Withdrawal",
    "category": "Insurance",
    "rawAmount": -1200,
    "cookedAmount": -1000,
    "description": "Insurance for business"
  },
  {
    "id": 1001,
    "transactionDate": "2017-08-03",
    "toFrom": "Plane Ticket Jubilee",
    "type": "Withdrawal",
    "category": "Travelling",
    "rawAmount": -602,
    "cookedAmount": -557,
    "description": "Travel to a client site for business"
  },
  {
    "id": 1002,
    "transactionDate": "2017-08-03",
    "toFrom": "Derek Schuff",
    "type": "Deposit",
    "category": "Sales Revenue",
    "rawAmount": 2378,
    "cookedAmount": 2600,
    "description": "Sold some stuff"
  },
  {
    "id": 1003,
    "transactionDate": "2017-08-06",
    "toFrom": "The Legitimate Inn",
    "type": "Withdrawal",
    "category": "Hotels",
    "rawAmount": -525,
    "cookedAmount": -450,
    "description": "Three night stay for a conference or something"
  },
  {
    "id": 1004,
    "transactionDate": "2017-08-11",
    "toFrom": "Limin Zhu",
    "type": "Deposit",
    "category": "Sales Revenue",
    "rawAmount": 5904,
    "cookedAmount": 7250,
    "description": "Sold some stuff"
  },
  {
    "id": 1005,
    "transactionDate": "2017-08-14",
    "toFrom": "Benjamin Bouvier",
    "type": "Deposit",
    "category": "Sales Revenue",
    "rawAmount": 5390,
    "cookedAmount": 5805,
    "description": "Sold some stuff"
  },
  {
    "id": 1006,
    "transactionDate": "2017-08-16",
    "toFrom": "Uncle Buck's Computer Warehouse",
    "type": "Withdrawal",
    "category": "Computer & Internet",
    "rawAmount": -350,
    "cookedAmount": -250,
    "description": "New keyboard"
  },
  {
    "id": 1007,
    "transactionDate": "2017-09-01",
    "toFrom": "The Food Restaurant",
    "type": "Withdrawal",
    "category": "Meals & Entertainment",
    "rawAmount": -127,
    "cookedAmount": -102,
    "description":...