Skip to content

Commit

Permalink
Merge pull request #14 from datagrove/createConnectedAccount
Browse files Browse the repository at this point in the history
Create connected account for sellers
  • Loading branch information
r-southworth authored Mar 18, 2024
2 parents 19aed6f + 0c2680e commit 69adadb
Show file tree
Hide file tree
Showing 15 changed files with 600 additions and 675 deletions.
14 changes: 8 additions & 6 deletions src/components/posts/CreateNewPost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ export const CreateNewPost: Component = () => {
});
});

createEffect(() => {
if(selectedTaxCode() !== undefined) {
console.log("Tax Code: " + selectedTaxCode()!.value);
}
});
// createEffect(() => {
// if(selectedTaxCode() !== undefined) {
// console.log("Tax Code: " + selectedTaxCode()!.value);
// }
// });

createEffect(async () => {
const { data, error } = await supabase.auth.getSession();
Expand All @@ -170,7 +170,9 @@ export const CreateNewPost: Component = () => {
if (providers.length === 0) {
alert(t("messages.onlyProvider"));
window.location.href = `/${lang}/provider/createaccount`;
} else {
} else if (providers[0].stripe_connected_account_id === null) {
alert(t("messages.noStripeAccount"));
window.location.href = `/${lang}/provider/profile`;
}
}
} catch (error) {
Expand Down
93 changes: 0 additions & 93 deletions src/components/users/ClientRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export const ClientRegistration: Component = () => {
const [firstName, setFirstName] = createSignal<string>("");
const [lastName, setLastName] = createSignal<string>("");

const regularExpressionPhone = new RegExp("^[0-9]{8}$");

createEffect(async () => {
const { data, error } = await supabase.auth.getSession();
setSession(data.session);
Expand Down Expand Up @@ -116,97 +114,6 @@ export const ClientRegistration: Component = () => {
console.log("Other error: " + error);
}

// //Minor Municipality
// try {
// const { data: minorMunicipality, error: errorMinorMunicipality } =
// await supabase.from("minor_municipality").select("*");
// if (errorMinorMunicipality) {
// console.log("supabase error: " + errorMinorMunicipality.message);
// } else {
// document
// .getElementById("MajorMunicipality")
// ?.addEventListener("change", () => {
// let municipalitySelect = document.getElementById(
// "MinorMunicipality"
// ) as HTMLSelectElement;
//
// let length = municipalitySelect?.length;
//
// for (let i = length - 1; i > -1; i--) {
// if (municipalitySelect.options[i].value !== "") {
// municipalitySelect.remove(i);
// }
// }
//
// let filteredMunicipality = minorMunicipality.filter(
// (municipality) =>
// municipality.major_municipality ==
// (
// document.getElementById(
// "MajorMunicipality"
// ) as HTMLSelectElement
// )?.value
// );
// filteredMunicipality.forEach((municipality) => {
// let municipalityOption = new Option(
// municipality.minor_municipality,
// municipality.id
// );
// document
// .getElementById("MinorMunicipality")
// ?.append(municipalityOption);
// });
// });
// }
// } catch (error) {
// console.log("Other error: " + error);
// }
//
// //Governing District
// try {
// const { data: governingDistrict, error: errorGoverningDistrict } =
// await supabase.from("governing_district").select("*");
// if (errorGoverningDistrict) {
// console.log("supabase error: " + errorGoverningDistrict.message);
// } else {
// document
// .getElementById("MinorMunicipality")
// ?.addEventListener("change", () => {
// let districtSelect = document.getElementById(
// "GoverningDistrict"
// ) as HTMLSelectElement;
//
// let length = districtSelect?.length;
//
// for (let i = length - 1; i > -1; i--) {
// if (districtSelect.options[i].value !== "") {
// districtSelect.remove(i);
// }
// }
//
// let filteredDistrict = governingDistrict.filter(
// (district) =>
// district.minor_municipality ==
// (
// document.getElementById(
// "MinorMunicipality"
// ) as HTMLSelectElement
// )?.value
// );
// filteredDistrict.forEach((district) => {
// let districtOption = new Option(
// district.governing_district,
// district.id
// );
// document
// .getElementById("GoverningDistrict")
// ?.append(districtOption);
// });
// });
// }
// } catch (error) {
// console.log("Other error: " + error);
// }
} else {
alert(t("messages.createClientAccount"));
location.href = `/${lang}/login`;
Expand Down
Loading

0 comments on commit 69adadb

Please sign in to comment.