Advanced updated

- missing chain reaction on the advanced page
This commit is contained in:
José Valdiviesso 2018-01-20 02:20:05 +00:00
parent 27a69d8ecb
commit 6045f3267f
7 changed files with 903 additions and 16 deletions

View File

@ -541,7 +541,7 @@ router.get('/:id',function(req, res, next){
if (!ck.space) { res.cookie('space', 'null', { maxAge: 31556952000, }); var space = "null"; }
if (!ck.indyTax) { res.cookie('indyTax', 0, { maxAge: 31556952000, }); var indyTax = 0; }
if (!ck.duration) { res.cookie('duration', 10080, { maxAge: 31556952000, }); var duration = 10080; }
if (!ck.adv-cycles) { res.cookie('adv-cycles', 50, { maxAge: 31556952000, }); var cycles = 50; }
if (!ck.cycles) { res.cookie('cycles', 50, { maxAge: 31556952000, }); var cycles = 50; }
if (!ck.system) { res.cookie('system', 'Basgerin', { maxAge: 31556952000, }); var syst = "Basgerin" }
//set internal vars to use cookie values
@ -587,8 +587,8 @@ router.get('/:id',function(req, res, next){
} else {
var duration = 10080;
}
if (ck.adv-cycles >= 1 && ck.adv-cycles <= 300) {
var cycles = ck.adv-cycles
if (ck.cycles >= 1 && ck.cycles <= 300) {
var cycles = ck.cycles
} else {
var cycles = 50;
}
@ -669,6 +669,8 @@ router.get('/:id',function(req, res, next){
let taxtotal = {};
var outArr = [];
let outtotal = {};
var repArr = [];
let reptotal = {};
//START build new BP array with prices
var itembp = {};
@ -687,6 +689,14 @@ router.get('/:id',function(req, res, next){
res.status(404);
res.render('error');
}else{
var advsettings = {};
advsettings.cycles = Math.round(cycles);
advsettings.ctime = Math.round(cycles * bonus.time);
advsettings.tcycles = Math.floor(ck.duration / advsettings.ctime);
let prodData = {};
prodData.name = getItemName(itemData,itembp._id);
prodData.url = req.url;
if(itembp.type === "simple"){
//build input array
@ -710,21 +720,286 @@ router.get('/:id',function(req, res, next){
inptotal.qt += elem.qt;
inptotal.price += elem.price;
});
inptotal.price = numeral(inptotal.price).format('0,0.00');
inptotal.pricestr = numeral(inptotal.price).format('0,0.00');
//build output array
let elem = itembp.output;
let outrow = {};
outrow.id = elem.id;
outrow.name = getItemName(itemData,elem.id);
outrow.qt = Math.ceil(elem.qt * cycles);
outrow.price = outrow.qt * getItem(itemData,elem.id).sell;
outrow.pricestr = numeral(outrow.qt * getItem(itemData,elem.id).sell).format('0,0.00');
outArr.push(outrow);
outtotal = {
"name": "TOTAL",
"qt": 0,
"price": 0
}
outArr.forEach(function(elem){
outtotal.qt += elem.qt;
outtotal.price += elem.price;
});
outtotal.pricestr = numeral(outtotal.price).format('0,0.00');
//build tax array
//build output array
let taxrow = {};
taxrow.name = "Cost Index";
taxrow.perc = costIndex;
taxrow.price = outtotal.price * costIndex;
taxrow.pricestr = numeral(outtotal.price * costIndex).format('0,0.00');
taxArr.push(taxrow);
let taxrow2 = {};
taxrow2.name = "Industrial Tax";
taxrow2.perc = indyTax;
taxrow2.price = taxrow.price * (indyTax/100);
taxrow2.pricestr = numeral(taxrow.price * (indyTax/100)).format('0,0.00');
taxArr.push(taxrow2);
taxtotal = {
"name": "TOTAL",
"price": 0
}
taxArr.forEach(function(elem){
taxtotal.price += elem.price;
});
taxtotal.pricestr = numeral(taxtotal.price).format('0,0.00');
//build report array
let reprow = {};
reprow.type = "Input Materials"
reprow.price = -inptotal.price * advsettings.tcycles;
reprow.pricestr = numeral(-inptotal.price * advsettings.tcycles).format('0,0.00');
repArr.push(reprow);
reprow = {};
reprow.type = "Taxes"
reprow.price = -taxtotal.price * advsettings.tcycles;
reprow.pricestr = numeral(-taxtotal.price * advsettings.tcycles).format('0,0.00');
repArr.push(reprow);
reprow = {};
reprow.type = "Output Materials"
reprow.price = outtotal.price * advsettings.tcycles;
reprow.pricestr = numeral(outtotal.price * advsettings.tcycles).format('0,0.00');
repArr.push(reprow);
reptotal = {
"type": "TOTAL",
"price": outtotal.price * advsettings.tcycles - inptotal.price * advsettings.tcycles - taxtotal.price * advsettings.tcycles
}
reptotal.pricestr = numeral(reptotal.price).format('0,0.00');
}else if(itembp.type === "complex"){
if(req.query.chain){
prodData.name = "Still working on the chain version of these, sorry :(";
}else{
//build input array
itembp.inputs.forEach(function(elem){
let inrow = {};
inrow.id = elem.id;
inrow.name = getItemName(itemData,elem.id);
inrow.qt = Math.ceil(elem.qt * cycles * bonus.mat);
inrow.price = inrow.qt * getItem(itemData,elem.id).buy;
inrow.pricestr = numeral(inrow.qt * getItem(itemData,elem.id).buy).format('0,0.00');
inpArr.push(inrow);
});
inptotal = {
"name": "TOTAL",
"qt": 0,
"price": 0
};
inpArr.forEach(function(elem){
inptotal.qt += elem.qt;
inptotal.price += elem.price;
});
inptotal.pricestr = numeral(inptotal.price).format('0,0.00');
//build output array
let elem = itembp.output;
let outrow = {};
outrow.id = elem.id;
outrow.name = getItemName(itemData,elem.id);
outrow.qt = Math.ceil(elem.qt * cycles);
outrow.price = outrow.qt * getItem(itemData,elem.id).sell;
outrow.pricestr = numeral(outrow.qt * getItem(itemData,elem.id).sell).format('0,0.00');
outArr.push(outrow);
outtotal = {
"name": "TOTAL",
"qt": 0,
"price": 0
}
outArr.forEach(function(elem){
outtotal.qt += elem.qt;
outtotal.price += elem.price;
});
outtotal.pricestr = numeral(outtotal.price).format('0,0.00');
//build tax array
let taxrow = {};
taxrow.name = "Cost Index";
taxrow.perc = costIndex;
taxrow.price = outtotal.price * costIndex;
taxrow.pricestr = numeral(outtotal.price * costIndex).format('0,0.00');
taxArr.push(taxrow);
let taxrow2 = {};
taxrow2.name = "Industrial Tax";
taxrow2.perc = indyTax;
taxrow2.price = taxrow.price * (indyTax/100);
taxrow2.pricestr = numeral(taxrow.price * (indyTax/100)).format('0,0.00');
taxArr.push(taxrow2);
taxtotal = {
"name": "TOTAL",
"price": 0
}
taxArr.forEach(function(elem){
taxtotal.price += elem.price;
});
taxtotal.pricestr = numeral(taxtotal.price).format('0,0.00');
//build report array
let reprow = {};
reprow.type = "Input Materials"
reprow.price = -inptotal.price * advsettings.tcycles;
reprow.pricestr = numeral(-inptotal.price * advsettings.tcycles).format('0,0.00');
repArr.push(reprow);
reprow = {};
reprow.type = "Taxes"
reprow.price = -taxtotal.price * advsettings.tcycles;
reprow.pricestr = numeral(-taxtotal.price * advsettings.tcycles).format('0,0.00');
repArr.push(reprow);
reprow = {};
reprow.type = "Output Materials"
reprow.price = outtotal.price * advsettings.tcycles;
reprow.pricestr = numeral(outtotal.price * advsettings.tcycles).format('0,0.00');
repArr.push(reprow);
reptotal = {
"type": "TOTAL",
"price": outtotal.price * advsettings.tcycles - inptotal.price * advsettings.tcycles - taxtotal.price * advsettings.tcycles
}
reptotal.pricestr = numeral(reptotal.price).format('0,0.00');
}
}else if(itembp.type === "unrefined"){
//build input array
itembp.inputs.forEach(function(elem){
let inrow = {};
inrow.id = elem.id;
inrow.name = getItemName(itemData,elem.id);
inrow.qt = Math.ceil(elem.qt * cycles * bonus.mat);
inrow.price = inrow.qt * getItem(itemData,elem.id).buy;
inrow.pricestr = numeral(inrow.qt * getItem(itemData,elem.id).buy).format('0,0.00');
inpArr.push(inrow);
});
inptotal = {
"name": "TOTAL",
"qt": 0,
"price": 0
};
inpArr.forEach(function(elem){
inptotal.qt += elem.qt;
inptotal.price += elem.price;
});
inptotal.pricestr = numeral(inptotal.price).format('0,0.00');
//build output array
let elem = itembp.output;
let outrow = {};
outrow.id = elem.id;
outrow.name = getItemName(itemData,elem.id);
outrow.qt = Math.ceil(elem.qt * cycles);
outrow.price = outrow.qt * getItem(itemData,elem.id).sell;
outrow.pricestr = numeral(outrow.qt * getItem(itemData,elem.id).sell).format('0,0.00');
outArr.push(outrow);
outtotal = {
"name": "TOTAL",
"qt": 0,
"price": 0
}
outArr.forEach(function(elem){
outtotal.qt += elem.qt;
outtotal.price += elem.price;
});
outtotal.pricestr = numeral(outtotal.price).format('0,0.00');
//build tax array
let taxrow = {};
taxrow.name = "Cost Index";
taxrow.perc = costIndex;
taxrow.price = outtotal.price * costIndex;
taxrow.pricestr = numeral(outtotal.price * costIndex).format('0,0.00');
taxArr.push(taxrow);
let taxrow2 = {};
taxrow2.name = "Industrial Tax";
taxrow2.perc = indyTax;
taxrow2.price = taxrow.price * (indyTax/100);
taxrow2.pricestr = numeral(taxrow.price * (indyTax/100)).format('0,0.00');
taxArr.push(taxrow2);
taxtotal = {
"name": "TOTAL",
"price": 0
}
taxArr.forEach(function(elem){
taxtotal.price += elem.price;
});
taxtotal.pricestr = numeral(taxtotal.price).format('0,0.00');
//build report array
let reprow = {};
reprow.type = "Input Materials"
reprow.price = -inptotal.price * advsettings.tcycles;
reprow.pricestr = numeral(-inptotal.price * advsettings.tcycles).format('0,0.00');
repArr.push(reprow);
reprow = {};
reprow.type = "Taxes"
reprow.price = -taxtotal.price * advsettings.tcycles;
reprow.pricestr = numeral(-taxtotal.price * advsettings.tcycles).format('0,0.00');
repArr.push(reprow);
reprow = {};
reprow.type = "Output Materials"
reprow.price = outtotal.price * advsettings.tcycles;
reprow.pricestr = numeral(outtotal.price * advsettings.tcycles).format('0,0.00');
repArr.push(reprow);
reptotal = {
"type": "TOTAL",
"price": outtotal.price * advsettings.tcycles - inptotal.price * advsettings.tcycles - taxtotal.price * advsettings.tcycles
}
reptotal.pricestr = numeral(reptotal.price).format('0,0.00');
}
let prodData = {};
prodData.name = getItemName(itemData,itembp._id);
res.render('comp-adv', { title: prodData.name + ' Reaction', comp: true, data: prodData, intable: inpArr, intt: inptotal, sett: ck });
res.render('comp-adv', { title: prodData.name + ' Reaction', comp: true, data: prodData, intable: inpArr, intt: inptotal, outtable: outArr, outtt: outtotal, taxtable: taxArr, taxtt: taxtotal, reptable: repArr, reptt: reptotal, sett: ck, advsett: advsettings });
}
});
});

View File

@ -25,6 +25,30 @@ function getItem(data, id) {
}
}
function isEmpty(obj) {
for(var key in obj) {
if(obj.hasOwnProperty(key))
return false;
}
return true;
}
function getItemName(items,id) {
for (let i = 0; i < items.length; i++) {
if (items[i]._id === id) {
return items[i].name;
}
}
}
function getItemID(items,name) {
for (let i = 0; i < items.length; i++) {
if (items[i].name === name) {
return items[i]._id;
}
}
}
/* GET comp page. */
router.get('/', function(req, res, next) {
@ -364,4 +388,276 @@ router.get('/', function(req, res, next) {
});
});
router.get('/:id',function(req, res, next){
const reqid = parseInt(req.params.id);
//set cookies if not found
var ck = req.cookies;
//console.log(ck);
if (!ck.input) { res.cookie('input', 'buy', { maxAge: 31556952000, }); var imeth = "buy"; }
if (!ck.output) { res.cookie('output', 'sell', { maxAge: 31556952000, }); var ometh = "sell"; }
if (!ck.skill) { res.cookie('skill', 5, { maxAge: 31556952000, }); var skill = 5; }
if (!ck.facility) { res.cookie('facility', 'large', { maxAge: 31556952000, }); var facility = "large"; }
if (!ck.rig) { res.cookie('rig', 1, { maxAge: 31556952000, }); var rig = 1; var rige = true; }
if (!ck.space) { res.cookie('space', 'null', { maxAge: 31556952000, }); var space = "null"; }
if (!ck.indyTax) { res.cookie('indyTax', 0, { maxAge: 31556952000, }); var indyTax = 0; }
if (!ck.duration) { res.cookie('duration', 10080, { maxAge: 31556952000, }); var duration = 10080; }
if (!ck.cycles) { res.cookie('cycles', 50, { maxAge: 31556952000, }); var cycles = 50; }
if (!ck.system) { res.cookie('system', 'Basgerin', { maxAge: 31556952000, }); var syst = "Basgerin" }
//set internal vars to use cookie values
if (ck.input.toLowerCase() === "buy" || ck.input.toLowerCase() === "sell") {
var imeth = ck.input.toLowerCase();
} else {
var imeth = "buy";
}
if (ck.output.toLowerCase() === "buy" || ck.output.toLowerCase() === "sell") {
var ometh = ck.output.toLowerCase();
} else {
var ometh = "sell";
}
if (parseInt(ck.skill) >= 0 && parseInt(ck.skill) <= 5) {
var skill = parseInt(ck.skill);
} else {
var skill = 5;
}
if (ck.facility.toLowerCase() === "med" || ck.facility.toLowerCase() === "large") {
var facility = ck.facility.toLowerCase();
} else {
var facility = "large";
}
if (parseInt(ck.rig) >= 0 && parseInt(ck.rig) <= 2) {
var rig = parseInt(ck.rig);
var rige = true;
} else {
var rig = 1;
var rige = true;
}
if (ck.space.toLowerCase() === "low" || ck.space.toLowerCase() === "null") {
var space = ck.space.toLowerCase();
} else {
var space = "null";
}
if (ck.indyTax >= 0 && ck.indyTax <= 50) {
var indyTax = ck.indyTax
} else {
var indyTax = 0;
}
if (ck.duration >= 1 && ck.duration <= 43200) {
var duration = ck.duration
} else {
var duration = 10080;
}
if (ck.cycles >= 1 && ck.cycles <= 300) {
var cycles = ck.cycles
} else {
var cycles = 50;
}
if (ck.system) {
var re = /^[a-zA-Z0-9-]+$/;
if (re.test(ck.system)) {
var syst = ck.system;
} else {
var syst = 'Basgerin';
}
}
//calc bonus with opts
var matb = 1;
var time = 180;
var bonus = {};
//default is Skill (Reactions) 5, Large facility & T1 rig in NullSec
//calc material bonus
if (rig === 1 && space === "null") {
matb = 1 - (2 * 1.1) / 100
} else if (rig === 1 && space === "low") {
matb = 1 - 2 / 100
} else if (rig === 2 && space === "null") {
matb = 1 - (2.4 * 1.1) / 100
} else if (rig === 2 && space === "low") {
matb = 1 - 2.4 / 100
} else {
matb = 1;
}
//calc time bonus
time = 180 * (1 - (4 * skill) / 100); //skill bonus
//facility bonus
if (facility === "med") {
time = time * (1 - 0)
} else if (facility === "large") {
time = time * (1 - (25 / 100))
}
//rig bonus
if (rig === 1 && space === "null") {
time = time * (1 - (20 * 1.1 / 100))
} else if (rig === 1 && space === "low") {
time = time * (1 - (20 / 100))
} else if (rig === 2 && space === "null") {
time = time * (1 - (24 * 1.1 / 100))
} else if (rig === 2 && space === "low") {
time = time * (1 - (24 / 100))
} else {
time = time;
}
//final result
bonus = {
"mat": matb,
"time": time
}
let querry = ['items', 'bp-hybrid', 'systems'];
async.map(querry, function(coll, callback) {
mongo.connect(svurl, function(err, db) {
if (err) {
console.log(err);
} else {
db.collection(coll).find().toArray(function(err, res) {
callback(null, res);
db.close();
});
}
});
}, function(err, results) {
let itemData = results[0];
let reac = results[1];
let systems = results[2];
//get cost index
var costIndex = getCostIndex(systems, syst);
//define vars for information
var inpArr = [];
let inptotal = {};
var taxArr = [];
let taxtotal = {};
var outArr = [];
let outtotal = {};
var repArr = [];
let reptotal = {};
//START build new BP array with prices
var itembp = {};
for(let i=0;i<reac.length;i++){
if(reac[i]._id === reqid){
itembp = reac[i];
}
}
if(isEmpty(itembp)){
var err = new Error('Item not found!!');
err.status = 404;
res.locals.message = err.message;
// render the error page
res.status(404);
res.render('error');
}else{
var advsettings = {};
advsettings.cycles = Math.round(cycles);
advsettings.ctime = Math.round(cycles * bonus.time);
advsettings.tcycles = Math.floor(ck.duration / advsettings.ctime);
let prodData = {};
prodData.name = getItemName(itemData,itembp._id);
prodData.url = req.url;
//build input array
itembp.inputs.forEach(function(elem){
let inrow = {};
inrow.id = elem.id;
inrow.name = getItemName(itemData,elem.id);
inrow.qt = Math.ceil(elem.qt * cycles * bonus.mat);
inrow.price = inrow.qt * getItem(itemData,elem.id).buy;
inrow.pricestr = numeral(inrow.qt * getItem(itemData,elem.id).buy).format('0,0.00');
inpArr.push(inrow);
});
inptotal = {
"name": "TOTAL",
"qt": 0,
"price": 0
};
inpArr.forEach(function(elem){
inptotal.qt += elem.qt;
inptotal.price += elem.price;
});
inptotal.pricestr = numeral(inptotal.price).format('0,0.00');
//build output array
let elem = itembp.output;
let outrow = {};
outrow.id = elem.id;
outrow.name = getItemName(itemData,elem.id);
outrow.qt = Math.ceil(elem.qt * cycles);
outrow.price = outrow.qt * getItem(itemData,elem.id).sell;
outrow.pricestr = numeral(outrow.qt * getItem(itemData,elem.id).sell).format('0,0.00');
outArr.push(outrow);
outtotal = {
"name": "TOTAL",
"qt": 0,
"price": 0
}
outArr.forEach(function(elem){
outtotal.qt += elem.qt;
outtotal.price += elem.price;
});
outtotal.pricestr = numeral(outtotal.price).format('0,0.00');
//build tax array
let taxrow = {};
taxrow.name = "Cost Index";
taxrow.perc = costIndex;
taxrow.price = outtotal.price * costIndex;
taxrow.pricestr = numeral(outtotal.price * costIndex).format('0,0.00');
taxArr.push(taxrow);
let taxrow2 = {};
taxrow2.name = "Industrial Tax";
taxrow2.perc = indyTax;
taxrow2.price = taxrow.price * (indyTax/100);
taxrow2.pricestr = numeral(taxrow.price * (indyTax/100)).format('0,0.00');
taxArr.push(taxrow2);
taxtotal = {
"name": "TOTAL",
"price": 0
}
taxArr.forEach(function(elem){
taxtotal.price += elem.price;
});
taxtotal.pricestr = numeral(taxtotal.price).format('0,0.00');
//build report array
let reprow = {};
reprow.type = "Input Materials"
reprow.price = -inptotal.price * advsettings.tcycles;
reprow.pricestr = numeral(-inptotal.price * advsettings.tcycles).format('0,0.00');
repArr.push(reprow);
reprow = {};
reprow.type = "Taxes"
reprow.price = -taxtotal.price * advsettings.tcycles;
reprow.pricestr = numeral(-taxtotal.price * advsettings.tcycles).format('0,0.00');
repArr.push(reprow);
reprow = {};
reprow.type = "Output Materials"
reprow.price = outtotal.price * advsettings.tcycles;
reprow.pricestr = numeral(outtotal.price * advsettings.tcycles).format('0,0.00');
repArr.push(reprow);
reptotal = {
"type": "TOTAL",
"price": outtotal.price * advsettings.tcycles - inptotal.price * advsettings.tcycles - taxtotal.price * advsettings.tcycles
}
reptotal.pricestr = numeral(reptotal.price).format('0,0.00');
res.render('hyb-adv', { title: prodData.name + ' Reaction', hyb: true, data: prodData, intable: inpArr, intt: inptotal, outtable: outArr, outtt: outtotal, taxtable: taxArr, taxtt: taxtotal, reptable: repArr, reptt: reptotal, sett: ck, advsett: advsettings });
}
});
});
module.exports = router;

View File

@ -66,4 +66,38 @@ router.get('/set', function(req, res, next) {
res.end();
});
router.get('/comp-adv/set', function(req, res, next) {
let ck = req.query;
if (parseInt(ck.cycles) >= 1 && parseInt(ck.cycles) <= 300) {
res.cookie('cycles', parseInt(ck.cycles), { maxAge: 31556952000, });
} else {
res.cookie('cyckes', 50, { maxAge: 31556952000, });
}
let url = "/composite/" + ck.url.substr(1);
//reply
res.redirect(302, url);
res.end();
});
router.get('/hyb-adv/set', function(req, res, next) {
let ck = req.query;
if (parseInt(ck.cycles) >= 1 && parseInt(ck.cycles) <= 300) {
res.cookie('cycles', parseInt(ck.cycles), { maxAge: 31556952000, });
} else {
res.cookie('cyckes', 50, { maxAge: 31556952000, });
}
let url = "/hybrid/" + ck.url.substr(1);
//reply
res.redirect(302, url);
res.end();
});
module.exports = router;

View File

@ -48,6 +48,28 @@
</tbody>
</table>
</div>
<div class="row mt-4">
<form action="/settings/comp-adv/set" method="get" id="advsettings"><input type="hidden" name="url" form="advsettings" value="{{data.url}}"/></form>
<table class="table table-sm table-bordered text-center">
<thead>
<th># Runs per cycle</th>
<th>Cycle time</th>
<th>Total time</th>
<th># Cycles</th>
<th>Save</th>
</thead>
<tbody>
<tr class="">
<td><input id="cycles" form="advsettings" name="cycles" placeholder="50" type="number" min="1" max="300" value="{{advsett.cycles}}" class="here" aria-describedby="cyclesHelpBlock" required="required"></td>
<td>{{advsett.ctime}} Minutes</td>
<td>{{sett.duration}} Minutes</td>
<td>{{advsett.tcycles}}</td>
<td><button name="submit" form="advsettings" type="submit" class="btn btn-sm btn-primary">Save</button></td>
</tr>
</tbody>
</table>
</form>
</div>
<div class="row mt-5">
<div class="col-6">
<div class="card w-100">
@ -73,7 +95,7 @@
<tr>
<th>{{intt.name}}</td>
<th>{{intt.qt}}</td>
<th class="isk">{{intt.price}}</td>
<th class="isk">{{intt.pricestr}}</td>
</tr>
</tfoot>
</table>
@ -82,6 +104,28 @@
<div class="card-header bg-danger text-white text-center w-100">
TAXES
</div>
<table width="100%" class="table table-sm table-bordered text-center">
<thead>
<th>Name</th>
<th>Percentage</th>
<th>Price</th>
</thead>
<tbody>
{{#taxtable}}
<tr class="">
<td>{{name}}</td>
<td>{{perc}} %</td>
<td class="isk">{{pricestr}}</td>
</tr>
{{/taxtable}}
</tbody>
<tfoot>
<tr>
<th colspan="2">{{taxtt.name}}</td>
<th class="isk">{{taxtt.pricestr}}</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="col-6">
@ -89,9 +133,56 @@
<div class="card-header bg-success text-white text-center w-100">
OUTPUTS
</div>
<table width="100%" class="table table-sm table-bordered text-center">
<thead>
<th>Name</th>
<th>Quantity</th>
<th>Price</th>
</thead>
<tbody>
{{#outtable}}
<tr class="">
<td>{{name}}</td>
<td>{{qt}}</td>
<td class="isk">{{pricestr}}</td>
</tr>
{{/outtable}}
</tbody>
<tfoot>
<tr>
<th>{{outtt.name}}</td>
<th>{{outtt.qt}}</td>
<th class="isk">{{outtt.pricestr}}</td>
</tr>
</tfoot>
</table>
</div>
<div class="card w-100 mt-4">
<div class="card-header bg-info text-white text-center w-100">
PROFIT REPORT
</div>
<table width="100%" class="table table-sm table-bordered text-center">
<thead>
<th>Type</th>
<th>Price</th>
</thead>
<tbody>
{{#reptable}}
<tr class="">
<td>{{type}}</td>
<td class="isk">{{pricestr}}</td>
</tr>
{{/reptable}}
</tbody>
<tfoot>
<tr>
<th>{{reptt.type}}</td>
<th class="isk">{{reptt.pricestr}}</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>

View File

@ -134,7 +134,7 @@
</thead>
<tbody>
{{#ctable}}
<tr class="text-white {{#if pos}}bg-success{{/if}}{{#if neg}}bg-danger{{/if}}">
<tr class="text-white {{#if pos}}bg-success{{/if}}{{#if neg}}bg-danger{{/if}} link-row" data-href='/composite/{{id}}'>
<td>{{name}}</td>
<td class="isk">{{i}}</td>
<td class="isk">{{tax}}</td>
@ -162,7 +162,7 @@
</thead>
<tbody>
{{#chtable}}
<tr class="text-white {{#if pos}}bg-success{{/if}}{{#if neg}}bg-danger{{/if}}">
<tr class="text-white {{#if pos}}bg-success{{/if}}{{#if neg}}bg-danger{{/if}} link-row" data-href='/composite/{{id}}?chain=true'>
<td>{{name}}</td>
<td class="isk">{{i}}</td>
<td class="isk">{{tax}}</td>
@ -190,7 +190,7 @@
</thead>
<tbody>
{{#untable}}
<tr class="text-white {{#if pos}}bg-success{{/if}}{{#if neg}}bg-danger{{/if}}">
<tr class="text-white {{#if pos}}bg-success{{/if}}{{#if neg}}bg-danger{{/if}} link-row" data-href='/composite/{{id}}'>
<td>{{name}}</td>
<td class="isk">{{i}}</td>
<td class="isk">{{tax}}</td>

188
views/hyb-adv.hbs Normal file
View File

@ -0,0 +1,188 @@
<script>
$(document).ready(function() {
$('#stab').DataTable( {
searching: false,
info: false,
paging: false,
columnsDefs: [
null,
{ "sType": "numeric" },
{ "sType": "numeric" },
{ "sType": "numeric" },
{ "sType": "numeric" },
{ "sType": "numeric" },
null
]
} );
});
</script>
<div class="container">
<div class="row mt-4">
<h1 class="text-center w-100">{{data.name}} Reaction</h1>
</div>
<div class="row mt-4">
<table class="table table-sm table-bordered text-center">
<thead>
<th>In Method</th>
<th>Out Method</th>
<th>Reactions</th>
<th>Facility</th>
<th>Rig</th>
<th>Space</th>
<th>System</th>
<th>IndyTax</th>
<th>Build Time</th>
</thead>
<tbody>
<tr class="">
<td>{{sett.input}}</td>
<td>{{sett.output}}</td>
<td>Level {{sett.skill}}</td>
<td>{{sett.facility}} Refinery</td>
<td>T{{sett.rig}} Rig</td>
<td>{{sett.space}}sec</td>
<td>{{sett.system}}</td>
<td>{{sett.indyTax}}</td>
<td>{{sett.duration}} Minutes</td>
</tr>
</tbody>
</table>
</div>
<div class="row mt-4">
<form action="/settings/hyb-adv/set" method="get" id="advsettings"><input type="hidden" name="url" form="advsettings" value="{{data.url}}"/></form>
<table class="table table-sm table-bordered text-center">
<thead>
<th># Runs per cycle</th>
<th>Cycle time</th>
<th>Total time</th>
<th># Cycles</th>
<th>Save</th>
</thead>
<tbody>
<tr class="">
<td><input id="cycles" form="advsettings" name="cycles" placeholder="50" type="number" min="1" max="300" value="{{advsett.cycles}}" class="here" aria-describedby="cyclesHelpBlock" required="required"></td>
<td>{{advsett.ctime}} Minutes</td>
<td>{{sett.duration}} Minutes</td>
<td>{{advsett.tcycles}}</td>
<td><button name="submit" form="advsettings" type="submit" class="btn btn-sm btn-primary">Save</button></td>
</tr>
</tbody>
</table>
</form>
</div>
<div class="row mt-5">
<div class="col-6">
<div class="card w-100">
<div class="card-header bg-danger text-white text-center w-100">
INPUTS
</div>
<table width="100%" class="table table-sm table-bordered text-center">
<thead>
<th>Name</th>
<th>Quantity</th>
<th>Price</th>
</thead>
<tbody>
{{#intable}}
<tr class="">
<td>{{name}}</td>
<td>{{qt}}</td>
<td class="isk">{{pricestr}}</td>
</tr>
{{/intable}}
</tbody>
<tfoot>
<tr>
<th>{{intt.name}}</td>
<th>{{intt.qt}}</td>
<th class="isk">{{intt.pricestr}}</td>
</tr>
</tfoot>
</table>
</div>
<div class="card w-100 mt-4">
<div class="card-header bg-danger text-white text-center w-100">
TAXES
</div>
<table width="100%" class="table table-sm table-bordered text-center">
<thead>
<th>Name</th>
<th>Percentage</th>
<th>Price</th>
</thead>
<tbody>
{{#taxtable}}
<tr class="">
<td>{{name}}</td>
<td>{{perc}} %</td>
<td class="isk">{{pricestr}}</td>
</tr>
{{/taxtable}}
</tbody>
<tfoot>
<tr>
<th colspan="2">{{taxtt.name}}</td>
<th class="isk">{{taxtt.pricestr}}</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="col-6">
<div class="card w-100">
<div class="card-header bg-success text-white text-center w-100">
OUTPUTS
</div>
<table width="100%" class="table table-sm table-bordered text-center">
<thead>
<th>Name</th>
<th>Quantity</th>
<th>Price</th>
</thead>
<tbody>
{{#outtable}}
<tr class="">
<td>{{name}}</td>
<td>{{qt}}</td>
<td class="isk">{{pricestr}}</td>
</tr>
{{/outtable}}
</tbody>
<tfoot>
<tr>
<th>{{outtt.name}}</td>
<th>{{outtt.qt}}</td>
<th class="isk">{{outtt.pricestr}}</td>
</tr>
</tfoot>
</table>
</div>
<div class="card w-100 mt-4">
<div class="card-header bg-info text-white text-center w-100">
PROFIT REPORT
</div>
<table width="100%" class="table table-sm table-bordered text-center">
<thead>
<th>Type</th>
<th>Price</th>
</thead>
<tbody>
{{#reptable}}
<tr class="">
<td>{{type}}</td>
<td class="isk">{{pricestr}}</td>
</tr>
{{/reptable}}
</tbody>
<tfoot>
<tr>
<th>{{reptt.type}}</td>
<th class="isk">{{reptt.pricestr}}</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>

View File

@ -14,6 +14,9 @@
null
]
} );
$(".link-row").click(function() {
window.location = $(this).data("href");
});
});
</script>
<div class="container">
@ -61,7 +64,7 @@
</thead>
<tbody>
{{#htab}}
<tr class="text-white {{#if pos}}bg-success{{/if}}{{#if neg}}bg-danger{{/if}}">
<tr class="text-white {{#if pos}}bg-success{{/if}}{{#if neg}}bg-danger{{/if}} link-row" data-href='/hybrid/{{id}}'>
<td>{{name}}</td>
<td class="isk">{{i}}</td>
<td class="isk">{{tax}}</td>