From 2bad8433667c659d01ac5dba3d57389fccdf10e0 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Mon, 9 Mar 2020 21:02:25 -0400 Subject: [PATCH] start --- js/002-config/fc-js-init.js | 1 + src/uncategorized/costsBudget.js | 48 ++++++++++++++++++++++++++++++++ src/uncategorized/costsBudget.tw | 3 ++ 3 files changed, 52 insertions(+) create mode 100644 src/uncategorized/costsBudget.js diff --git a/js/002-config/fc-js-init.js b/js/002-config/fc-js-init.js index c1925ba032b..d4c4b37a5f0 100644 --- a/js/002-config/fc-js-init.js +++ b/js/002-config/fc-js-init.js @@ -19,6 +19,7 @@ App.UI = {}; App.UI.DOM = {}; App.UI.View = {}; App.UI.SlaveInteract = {}; +App.UI.Budget = {}; App.Update = {}; App.Utils = {}; App.Interact = {}; diff --git a/src/uncategorized/costsBudget.js b/src/uncategorized/costsBudget.js new file mode 100644 index 00000000000..3206bc65993 --- /dev/null +++ b/src/uncategorized/costsBudget.js @@ -0,0 +1,48 @@ +App.UI.Budget.Cost = function () { + let items = []; + let el = document.createElement('p'); + let table = document.createElement("TABLE"); + table.className = "finances"; + table.style.textAlign = "right"; + table.style.borderCollapse = "separate"; + table.style.borderSpacing = "5px"; + table.style.borderStyle = "hidden"; + table.style.emptyCells = "hide"; + table.style.width = "75%"; + table.style.borderStyle = "solid"; + table.style.borderWidth = "1px"; + table.style.borderColor = "white"; + + + let header = table.createTHead(); + let row = header.insertRow(0); + let cell = row.insertCell(0); + + cell.textContent = "Penthouse"; + cell = row.insertCell(1); + cell.textContent = "Income"; + cell = row.insertCell(2); + cell.textContent = "Expense"; + cell = row.insertCell(3); + cell.textContent = "Totals"; + el.appendChild(table); + return jQuery('#costTable').empty().append(el); + + + + const generateRow = function (category, title) { + const income = "lastWeeksCashIncome"; + const expenses = "lastWeeksCashExpenses"; + const profits = "lastWeeksCashProfits"; + + if (V[income][category] || V[expenses][category] || V.showAllEntries.costsBudget) { + V[profits][category] = V[income][category] + V[expenses][category]; + return `<tr>\ + <td>${title}</td>\ + <td>${cashFormatColor(V[income][category])}</td>\ + <td>${cashFormatColor(-Math.abs(V[expenses][category]))}</td>\ + <td>${cashFormatColor(V[profits][category])}</td>\ + </tr>`; + } + }; +}; diff --git a/src/uncategorized/costsBudget.tw b/src/uncategorized/costsBudget.tw index feedbdd88c7..c419422d9ba 100644 --- a/src/uncategorized/costsBudget.tw +++ b/src/uncategorized/costsBudget.tw @@ -12,6 +12,9 @@ <<set $showAllEntries = {costsBudget: 0, repBudget: 0}>> <</if>> +<span id="costTable"></span> +<script>App.UI.Budget.Cost()</script> + <div class="scene-intro"> Here you can view many of the financial details of your arcology, <<= properTitle()>>. The detailed list of slaves and their costs (food, hormones) that you may remember can now be found in the "Slave maintenance" link. Other links will allow you to directly control areas of your arcology to adjust spending to suit your tastes. </div> -- GitLab