CLASSROOMIO-T-6: Dashboard, courses page and other tabs
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
export default (currency: string | undefined) => {
|
||||
return new Intl.NumberFormat('en-US', {
|
||||
style: 'currency',
|
||||
currency: currency,
|
||||
minimumFractionDigits: 2,
|
||||
});
|
||||
};
|
||||
@@ -28,10 +28,8 @@ const resetValidationSchema = z.object({
|
||||
const onboardingValidationSchema = {
|
||||
stepOne: z.object({
|
||||
fullname: z.string().min(1, { message: 'Enter your fullname' }),
|
||||
role: z.string({
|
||||
required_error: 'Please select a goal',
|
||||
invalid_type_error: 'Please select a goal',
|
||||
}),
|
||||
orgName: z.string().min(1, { message: 'Enter your organisation name' }),
|
||||
siteName: z.string().min(1, { message: 'Enter your site name' }),
|
||||
}),
|
||||
stepTwo: z.object({
|
||||
goal: z
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import { supabase } from '../../functions/supabase';
|
||||
import { orgs, currentOrg } from '../../store/org';
|
||||
|
||||
export async function getOrganizations(userId) {
|
||||
const { data, error } = await supabase
|
||||
.from('organizationmember')
|
||||
.select(
|
||||
`
|
||||
id,
|
||||
profile_id,
|
||||
organization (
|
||||
id,
|
||||
name,
|
||||
siteName
|
||||
)
|
||||
`
|
||||
)
|
||||
.eq('profile_id', userId);
|
||||
|
||||
const orgsArray = [];
|
||||
if (data.length) {
|
||||
data.forEach((orgMember) => {
|
||||
orgsArray.push({
|
||||
id: orgMember?.organization?.id,
|
||||
name: orgMember?.organization?.name,
|
||||
siteName: orgMember?.organization?.siteName,
|
||||
});
|
||||
});
|
||||
|
||||
orgs.set(orgsArray);
|
||||
currentOrg.set(orgsArray[0]);
|
||||
}
|
||||
|
||||
return {
|
||||
orgs: orgsArray,
|
||||
currentOrg: orgsArray[0],
|
||||
error,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export const orgs = writable([]);
|
||||
export const currentOrg = writable({});
|
||||
Reference in New Issue
Block a user