fix: org improvements (#385)
* fix: verify newly added admins * allow adding of admins for paid customers * feat: permit admins to see all courses
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
import Modal from '$lib/components/Modal/index.svelte';
|
import Modal from '$lib/components/Modal/index.svelte';
|
||||||
import { t } from '$lib/utils/functions/translations';
|
import { t } from '$lib/utils/functions/translations';
|
||||||
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
|
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
|
||||||
|
import { isOrgAdmin } from '$lib/utils/store/org';
|
||||||
|
|
||||||
export let courseId = '';
|
export let courseId = '';
|
||||||
export let path = '';
|
export let path = '';
|
||||||
@@ -56,7 +57,7 @@
|
|||||||
$globalStore.isStudent = user.role_id === 3;
|
$globalStore.isStudent = user.role_id === 3;
|
||||||
|
|
||||||
filterPollsByStatus($globalStore.isStudent);
|
filterPollsByStatus($globalStore.isStudent);
|
||||||
} else if ($profile.id && $group.people.length) {
|
} else if (!$isOrgAdmin && $profile.id && $group.people.length) {
|
||||||
// Current User doesn't have permission to view
|
// Current User doesn't have permission to view
|
||||||
isPermitted = false;
|
isPermitted = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
let role = ROLE.TUTOR;
|
let role = ROLE.TUTOR;
|
||||||
let isFetching = false;
|
let isFetching = false;
|
||||||
let isLoading = false;
|
let isLoading = false;
|
||||||
let isRemoving = false;
|
let isRemoving: number | null = null;
|
||||||
|
|
||||||
async function onSendInvite() {
|
async function onSendInvite() {
|
||||||
const { hasError, error: _error, emails } = validateEmailInString(emailsStr);
|
const { hasError, error: _error, emails } = validateEmailInString(emailsStr);
|
||||||
@@ -106,8 +106,8 @@
|
|||||||
|
|
||||||
async function onRemove(id: number) {
|
async function onRemove(id: number) {
|
||||||
console.log('onRemove called');
|
console.log('onRemove called');
|
||||||
isRemoving = true;
|
isRemoving = id;
|
||||||
const { data, error } = await supabase.from('organizationmember').delete().match({ id });
|
const { error } = await supabase.from('organizationmember').delete().match({ id });
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error('onRemove:', error);
|
console.error('onRemove:', error);
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
orgTeam.update((team) => [...team.filter((member) => member.id !== id)]);
|
orgTeam.update((team) => [...team.filter((member) => member.id !== id)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
isRemoving = false;
|
isRemoving = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchTeam = async (id: string) => {
|
const fetchTeam = async (id: string) => {
|
||||||
@@ -160,7 +160,7 @@
|
|||||||
class="mb-5 w-40"
|
class="mb-5 w-40"
|
||||||
disabled={$isFreePlan}
|
disabled={$isFreePlan}
|
||||||
>
|
>
|
||||||
<!-- <SelectItem value={ROLE.ADMIN} text={ROLE_LABEL[ROLE.ADMIN]} /> -->
|
<SelectItem value={ROLE.ADMIN} text={ROLE_LABEL[ROLE.ADMIN]} />
|
||||||
<SelectItem value={ROLE.TUTOR} text={$t(ROLE_LABEL[ROLE.TUTOR])} />
|
<SelectItem value={ROLE.TUTOR} text={$t(ROLE_LABEL[ROLE.TUTOR])} />
|
||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
@@ -204,8 +204,8 @@
|
|||||||
label={$t('course.navItem.people.teams.remove')}
|
label={$t('course.navItem.people.teams.remove')}
|
||||||
variant={VARIANTS.TEXT_DANGER}
|
variant={VARIANTS.TEXT_DANGER}
|
||||||
onClick={() => onRemove(teamMember.id)}
|
onClick={() => onRemove(teamMember.id)}
|
||||||
isLoading={isRemoving}
|
isLoading={isRemoving === teamMember.id}
|
||||||
isDisabled={isRemoving}
|
isDisabled={isRemoving === teamMember.id}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -161,7 +161,8 @@
|
|||||||
.insert({
|
.insert({
|
||||||
organization_id: orgData.id,
|
organization_id: orgData.id,
|
||||||
profile_id: $profile.id,
|
profile_id: $profile.id,
|
||||||
role_id: 1
|
role_id: 1,
|
||||||
|
verified: true
|
||||||
})
|
})
|
||||||
.select();
|
.select();
|
||||||
console.log('Create organisation member', data);
|
console.log('Create organisation member', data);
|
||||||
|
|||||||
Reference in New Issue
Block a user