@ -4,6 +4,7 @@
import words from "$lib/en-lang.json";
let total = 0;
let error = null;
let lang = words["calculator"];
let types = lang["types"];
@ -25,23 +26,29 @@
const urlParams = new URLSearchParams(window.location.search);
urlParams.forEach((value, key) => {
if(key == "commissions") {
commissions = JSON.parse(value);
commissions.forEach(value => {
types.forEach(element => {
if(element["name"] == value.type) {
value['questions'] = element["questions"];
}
try {
commissions = JSON.parse(value);
commissions.forEach(value => {
types.forEach(element => {
if(element["name"] == value.type) {
value['questions'] = element["questions"];
}
});
value.questions.forEach(question => {
value['answers'].push({ 'name' : question . name , 'option' : question . options [ 0 ][ 'name' ]} );
});
update_price(value);
update_example(value);
console.log(value.example);
});
value.questions.forEach(question => {
value['answers'].push({ 'name' : question . name , 'option' : question . options [ 0 ][ 'name' ]} );
});
update_price(value);
update_example(value);
console.log(value.example);
});
} catch(msg) {
error = "The selected preset link failed to load. It may be from an old version of the commission picker. It has been replaced with the default preset below."
}
}
});
if(commissions.length == 0) base();
if(commissions.length == 0) {
base();
}
}
function update_example(commission: Commission) {
@ -200,6 +207,12 @@
< / div >
< / section >
{ #if error }
< section class = "bg-slate-800 text-yellow-500 font-bold rounded-lg shadow-lg p-5 flex flex-col gap-5" >
⚠️ { error }
< / section >
{ /if }
{ #each [... commissions ]. reverse () as commission }
< section class = "flex gap-5" >
< div class = "w-3/5 bg-slate-800 rounded-lg shadow-lg p-5 flex flex-col gap-5" >