CLASSROOMIO-T-6: Dashboard, courses page and other tabs

This commit is contained in:
Rotimi Best
2023-01-03 09:26:08 +01:00
parent 6d89830e86
commit 1c9639725a
40 changed files with 1524 additions and 264 deletions
@@ -0,0 +1,7 @@
export default (currency: string | undefined) => {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: currency,
minimumFractionDigits: 2,
});
};
View File
+2 -4
View File
@@ -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
+39
View File
@@ -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,
};
}
+4
View File
@@ -0,0 +1,4 @@
import { writable } from 'svelte/store';
export const orgs = writable([]);
export const currentOrg = writable({});