|
|
@ -36,9 +36,6 @@
|
|
|
|
value['questions'] = element["questions"];
|
|
|
|
value['questions'] = element["questions"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
value.questions.forEach(question => {
|
|
|
|
|
|
|
|
value['answers'].push({'name': question.name, 'option': question.options[0]['name']});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
update_price(value);
|
|
|
|
update_price(value);
|
|
|
|
update_example(value);
|
|
|
|
update_example(value);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -114,10 +111,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
let url = window.location.origin + window.location.pathname + "?" + urlParams.toString();
|
|
|
|
let url = window.location.origin + window.location.pathname + "?" + urlParams.toString();
|
|
|
|
|
|
|
|
|
|
|
|
navigator.clipboard.writeText(url);
|
|
|
|
|
|
|
|
window.history.replaceState( {} , document.title, url);
|
|
|
|
window.history.replaceState( {} , document.title, url);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function save_clipboard() {
|
|
|
|
|
|
|
|
save();
|
|
|
|
|
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
|
|
|
|
|
|
let url = window.location.origin + window.location.pathname + "?" + urlParams.toString();
|
|
|
|
|
|
|
|
navigator.clipboard.writeText(url);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function update_commission_type(commission: Commission) {
|
|
|
|
function update_commission_type(commission: Commission) {
|
|
|
|
types.forEach(element => {
|
|
|
|
types.forEach(element => {
|
|
|
|
if(element["name"] == commission.type) {
|
|
|
|
if(element["name"] == commission.type) {
|
|
|
@ -155,7 +158,28 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function load() {
|
|
|
|
async function load() {
|
|
|
|
window.location.href = await navigator.clipboard.readText();
|
|
|
|
let url = await navigator.clipboard.readText();
|
|
|
|
|
|
|
|
window.history.replaceState( {} , document.title, url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
|
|
|
|
|
|
urlParams.forEach((value, key) => {
|
|
|
|
|
|
|
|
if(key == "commissions") {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
commissions = JSON.parse(value);
|
|
|
|
|
|
|
|
commissions.forEach(value => {
|
|
|
|
|
|
|
|
types.forEach(element => {
|
|
|
|
|
|
|
|
if(element["name"] == value.type) {
|
|
|
|
|
|
|
|
value['questions'] = element["questions"];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
update_price(value);
|
|
|
|
|
|
|
|
update_example(value);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} catch(msg) {
|
|
|
|
|
|
|
|
error = "The selected preset link failed to load. It may be from an old version of the commission picker."
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function createNew() {
|
|
|
|
function createNew() {
|
|
|
@ -183,6 +207,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
function clear() {
|
|
|
|
function clear() {
|
|
|
|
commissions = [];
|
|
|
|
commissions = [];
|
|
|
|
|
|
|
|
total = 0;
|
|
|
|
save();
|
|
|
|
save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -203,7 +228,7 @@
|
|
|
|
<section class="container bg-slate-800 rounded-lg shadow-lg p-5 flex flex-col w-full gap-10">
|
|
|
|
<section class="container bg-slate-800 rounded-lg shadow-lg p-5 flex flex-col w-full gap-10">
|
|
|
|
<div class="flex flex-col lg:flex-row gap-5 lg:gap-1 flex-wrap -ml-2 -mr-2">
|
|
|
|
<div class="flex flex-col lg:flex-row gap-5 lg:gap-1 flex-wrap -ml-2 -mr-2">
|
|
|
|
<span class="flex-grow"><Button added_classes="w-full" on:click={createNew}>➕ Add Commission</Button></span>
|
|
|
|
<span class="flex-grow"><Button added_classes="w-full" on:click={createNew}>➕ Add Commission</Button></span>
|
|
|
|
<span><Button on:click={save}>💾 Save to Clipboard</Button></span>
|
|
|
|
<span><Button on:click={save_clipboard}>💾 Save to Clipboard</Button></span>
|
|
|
|
<span><Button on:click={load}>📋 Load from Clipboard</Button></span>
|
|
|
|
<span><Button on:click={load}>📋 Load from Clipboard</Button></span>
|
|
|
|
<span><Button on:click={clear}>❌ Clear</Button></span>
|
|
|
|
<span><Button on:click={clear}>❌ Clear</Button></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|