32 lines
4.9 KiB
JavaScript
32 lines
4.9 KiB
JavaScript
import { s as subscribe } from "../../../chunks/utils.js";
|
|
import { c as create_ssr_component, e as escape, a as add_attribute, b as each } from "../../../chunks/ssr.js";
|
|
import { w as walletStore } from "../../../chunks/walletStoreFix.js";
|
|
import "../../../chunks/splitExpenseUtils.js";
|
|
import "@stellar/stellar-sdk";
|
|
const Page = create_ssr_component(($$result, $$props, $$bindings, slots) => {
|
|
let $$unsubscribe_walletStore;
|
|
$$unsubscribe_walletStore = subscribe(walletStore, (value) => value);
|
|
let amount = "";
|
|
let title = "";
|
|
let memo = "";
|
|
let participants = [
|
|
{
|
|
address: "",
|
|
name: "You (me)",
|
|
share: "50"
|
|
}
|
|
];
|
|
let validationErrors = {};
|
|
$$unsubscribe_walletStore();
|
|
return `<div class="container mx-auto p-4"><h1 class="text-3xl font-bold mb-6" data-svelte-h="svelte-s6mdkh">Split Expense</h1> ${``} <div class="card bg-base-100 shadow-xl"><div class="card-body">${validationErrors.general ? `<div class="alert alert-error mb-4"><svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg> <span>${escape(validationErrors.general)}</span></div>` : ``} ${validationErrors.balance ? `<div class="alert alert-warning mb-4"><svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"></path></svg> <span>${escape(validationErrors.balance)}</span></div>` : ``} <form><div class="form-control mb-4"><label class="label" for="title" data-svelte-h="svelte-g6qrgd"><span class="label-text">Expense Title</span></label> <input id="title" type="text" class="input input-bordered" placeholder="Dinner, Movie tickets, etc." required${add_attribute("value", title, 0)}></div> <div class="form-control mb-4"><label class="label" for="amount" data-svelte-h="svelte-hseqzp"><span class="label-text">Total Amount</span></label> <div class="input-group"><input id="amount" type="number" class="input input-bordered w-full" placeholder="0.00" step="0.0000001" min="0" required${add_attribute("value", amount, 0)}> <span class="bg-base-300 px-3 flex items-center" data-svelte-h="svelte-11zzajg">XLM</span></div></div> <div class="form-control mb-6"><label class="label" for="memo" data-svelte-h="svelte-1aiinm4"><span class="label-text">Memo (Optional)</span></label> <input id="memo" type="text" class="input input-bordered" placeholder="Add a note about this expense" maxlength="28"${add_attribute("value", memo, 0)}></div> <div class="divider" data-svelte-h="svelte-sfo16o">Participants</div> ${each(participants, (participant, index) => {
|
|
return `<div class="flex gap-2 mb-4"><div class="flex-1"><label class="label" for="${"participant-name-" + escape(index, true)}" data-svelte-h="svelte-3xp6mw"><span class="label-text">Name</span></label> <input id="${"participant-name-" + escape(index, true)}" type="text" class="input input-bordered w-full" placeholder="Name" ${index === 0 ? "disabled" : ""} required${add_attribute("value", participant.name, 0)}></div> <div class="flex-1"><label class="label" for="${"participant-address-" + escape(index, true)}" data-svelte-h="svelte-zkz058"><span class="label-text">Address</span></label> <input id="${"participant-address-" + escape(index, true)}" type="text" class="${[
|
|
"input input-bordered w-full",
|
|
validationErrors[`participant_${index}`] ? "input-error" : ""
|
|
].join(" ").trim()}" placeholder="Stellar address" ${index === 0 ? "disabled" : ""} ${index !== 0 ? "required" : ""}${add_attribute("value", participant.address, 0)}> ${validationErrors[`participant_${index}`] ? `<div class="mt-1"><span class="label-text-alt text-error">${escape(validationErrors[`participant_${index}`])}</span> </div>` : ``}</div> <div class="w-20"><label class="label" for="${"participant-share-" + escape(index, true)}" data-svelte-h="svelte-1j6am6x"><span class="label-text">Share %</span></label> <div class="flex"><input id="${"participant-share-" + escape(index, true)}" type="number" class="input input-bordered w-full" min="1" max="100" required${add_attribute("value", participant.share, 0)}> </div></div> ${``} <div class="flex items-end mb-2"><button type="button" class="btn btn-square btn-outline btn-sm" ${index === 0 ? "disabled" : ""} data-svelte-h="svelte-91xz6l">✕
|
|
</button></div> </div>`;
|
|
})} <button type="button" class="btn btn-outline btn-sm mb-6" data-svelte-h="svelte-16lxws3">+ Add participant</button> <div class="form-control mt-6"><button type="submit" class="btn btn-primary" ${"disabled"}>${`${`Create & Share Split Expense`}`}</button></div></form></div></div></div>`;
|
|
});
|
|
export {
|
|
Page as default
|
|
};
|