@ -42,6 +42,7 @@
console.log(value.example);
});
} catch(msg) {
commissions = [];
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."
}
}
@ -56,10 +57,10 @@
let lastAnswer = commission.answers[commission.answers.length - 1];
let example = "";
commission.example = "";
let type = types.filter(value => {
let typeFound = types.filter(value => {
return value['name'] == commission.type;
});
type = type[0];
let type = typeFound [0];
let count = 0;
commission.questions.forEach(value => {
@ -215,35 +216,37 @@
{ #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" >
< div class = "flex justify-between" >
< h3 class = "text-xl font-bold flex gap-5" > { commission . name } < p class = "bg-green-500 py-1 text-sm px-5 rounded-lg" > ${ commission . price } </ p ></ h3 >
< span >
< Button on:click = {() => { remove ( commission . name )}} > 🗑️</Button >
< / span >
< / div >
< form class = "flex flex-col gap-10" on:change = {() => { update_example ( commission )}} >
< div class = "flex flex-col gap-1" >
< label for = { commission . type } > Type of commission </ label >
< select class = "bg-slate-600 p-2 rounded-lg" bind:value = { commission . type } on:change= {() => { update_commission_type ( commission )}} >
{ #each types as question }
< option value = { question . name } > { question . name } </option >
{ /each }
< / select >
< div class = "w-3/5" >
< div class = "bg-slate-800 rounded-lg shadow-lg p-5 flex flex-col gap-5" >
< div class = "flex justify-between" >
< h3 class = "text-xl font-bold flex gap-5" > { commission . name } < p class = "bg-green-500 py-1 text-sm px-5 rounded-lg" > ${ commission . price } </ p ></ h3 >
< span >
< Button on:click = {() => { remove ( commission . name )}} > 🗑️</Button >
< / span >
< / div >
{#each commission . questions as question , key }
< form class = "flex flex-col gap-10" on:change = {() => { update_example ( commission )}} >
< div class = "flex flex-col gap-1" >
< label for = { commission . answers [ key ][ 'option' ]} > { question . name } </ label>
< select class = "bg-slate-600 p-2 rounded-lg" bind:value = { commission . answers [ key ][ 'option' ] } on:change= {() => { update_ pri ce( commission )}} >
{ #each question. options as op tion}
< option value = { option. name } > { option . name } | $ { option . price } </ option>
< label for = { commission . type } > Type of commission </ label >
< select class = "bg-slate-600 p-2 rounded-lg" bind:value = { commission . type } on:change= {() => { update_commission_type ( commission )}} >
{ #each types as question }
< option value = { question . name } > { question . name } </option >
{ /each }
< / select >
< / div >
{ /each }
< / form >
{ #each commission . questions as question , key }
< div class = "flex flex-col gap-1" >
< label for = { commission . answers [ key ][ 'option' ]} > { question . name } </label >
< select class = "bg-slate-600 p-2 rounded-lg" bind:value = { commission . answers [ key ][ 'option' ]} on:change= {() => { update_price ( commission )}} >
{ #each question . options as option }
< option value = { option . name } > { option . name } | $ { option . price } </ option >
{ /each }
< / select >
< / div >
{ /each }
< / form >
< / div >
< / div >
< div class = "w-2/5" >