Skip to content

Commit

Permalink
Changed the results table's showing trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
FiniteVoid committed Nov 13, 2023
1 parent 858aec4 commit efb720b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion AutumnCalc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h3 class="title">Printing Cost Calculator</h3>
</div>

<div class="container mt-5 mb-5 resultsContainer hiddenResultsContainer" id="resultsContainer">
<h2 class="subtitle text-center">Results</h2>
<h2 class="subtitle text-center">Calculation Results</h2>
<table class="table table-hover table-responsive table-bordered" id="resultsTable">
<thead class="table-dark">
<tr>
Expand Down
17 changes: 5 additions & 12 deletions AutumnCalc/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ tippy('.infoBtn', {

// First form
document.querySelector('#royaltyCalculator').addEventListener('submit', function (e) {
container = document.querySelector('#resultsContainer');
container.classList.remove('hiddenResultsContainer');
container.classList.add('fade-in');
e.preventDefault();
handleTable();
});
Expand Down Expand Up @@ -46,20 +49,11 @@ function handleTable() {
showODS = document.querySelector('#showODS').checked;

table = document.querySelector('#resultsTable');
container = document.querySelector('#resultsContainer');

// I first gotta make table visible by setting its display to table
container.classList.remove('hiddenResultsContainer');
container.classList.add('fade-in');


tbody = document.querySelector('#resultsBody');
// I will first remove all rows (non-header) from the table
// Remove all rows except the first one to keep the table header
while (table.rows.length > 1) {
table.deleteRow(1);
}
// Then I will add the rows based on the values of showAmazon and showODS (First row is always there)
// 4 Columns are Print Provider, Minimum List Price, Print Cost, Estimated Royalty
{
var cost = 'N/A';
var minLP = 'N/A';
Expand All @@ -83,9 +77,8 @@ function handleTable() {
row.insertCell(3).innerHTML = royalty;
}


// If the user wants to see the other options, show them
if (showAmazon) {
// I will add the row for Amazon
var cost = 'N/A';
var minLP = 'N/A';
var royalty = 'N/A';
Expand Down

0 comments on commit efb720b

Please sign in to comment.