CLASSROOMIO-T-73: Fix Org site name issues
CLASSROOMIO-T-73:made the neccessary changes as noted from the review CLASSROOMIO-T-73:fixed the prettier config and saved FIX:CLASSROOMIO-T-73([BUG]Org site name),made some update to the bug fix FIX:CLASSROOMIO-T-73(ORG site name issues) Co-authored-by: Ifeanyi Nwosu <ifeanyi@digdippa.com> Co-authored-by: emmanuel <chifez1@gmail.com> Merge-request: CLASSROOMIO-MR-16 Merged-by: Best Admin <digdippa@gmail.com>
This commit is contained in:
committed by
Space Cloud
co-authored by
Ifeanyi Nwosu
parent
ed67d43b2a
commit
2a0e7d4d5c
@@ -6,6 +6,7 @@
|
||||
export let label = '';
|
||||
export let placeholder = '';
|
||||
export let value = '';
|
||||
export let name = '';
|
||||
export let onKeyDown = () => {};
|
||||
export let className = '';
|
||||
export let inputClassName = '';
|
||||
@@ -78,6 +79,7 @@
|
||||
disabled={isDisabled}
|
||||
autocomplete={autoComplete ? 'on' : 'off'}
|
||||
on:blur={onChange}
|
||||
{name}
|
||||
/>
|
||||
{#if isPassword}
|
||||
<span class="password-eye">
|
||||
|
||||
@@ -95,7 +95,9 @@
|
||||
label="Login"
|
||||
variant={VARIANTS.NONE}
|
||||
className="py-3 px-6 mx-2 app-background-color"
|
||||
onClick={() => goto('/login' + redirect)}
|
||||
onClick={() => {
|
||||
goto('/login' + redirect);
|
||||
}}
|
||||
/>
|
||||
<PrimaryButton
|
||||
label="Sign Up"
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
}
|
||||
|
||||
const maxSteps = 2;
|
||||
|
||||
let fields: OnboardingField = {
|
||||
fullname: '',
|
||||
orgName: '',
|
||||
@@ -87,15 +86,22 @@
|
||||
const payload = await response.json();
|
||||
fields.metadata = payload;
|
||||
}
|
||||
|
||||
function setOrgSiteName(orgName: string | undefined, isTouched: boolean) {
|
||||
console.log('set org name', orgName, isTouched);
|
||||
if (!orgName || isTouched) return;
|
||||
|
||||
fields.siteName = orgName
|
||||
// @ts-ignore
|
||||
.replaceAll(' ', '-')
|
||||
.toLowerCase();
|
||||
let inputElement = event?.target as HTMLInputElement;
|
||||
let value = inputElement.name;
|
||||
console.log('set org name', orgName, isTouched, value);
|
||||
if (value == 'orgname') {
|
||||
fields.siteName = orgName
|
||||
?.toLowerCase()
|
||||
?.replace(/\s+/g, '-')
|
||||
?.replace(/[^a-zA-Z0-9-]/g, '');
|
||||
} else {
|
||||
if (value == 'sitename') {
|
||||
fields.siteName = inputElement.value;
|
||||
}
|
||||
}
|
||||
console.log('set org name', orgName, isTouched, value);
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
@@ -190,6 +196,10 @@
|
||||
};
|
||||
|
||||
$: progress = Math.round((step / maxSteps) * 100);
|
||||
$: fields.siteName = fields.siteName
|
||||
?.toLowerCase()
|
||||
?.replace(/\s+/g, '-')
|
||||
?.replace(/[^a-zA-Z0-9-]/g, '');
|
||||
$: setOrgSiteName(fields.orgName, isSiteNameTouched);
|
||||
</script>
|
||||
|
||||
@@ -226,6 +236,7 @@
|
||||
<TextField
|
||||
label="Full Name"
|
||||
bind:value={fields.fullname}
|
||||
name="fullname"
|
||||
type="text"
|
||||
placeholder="e.g Joke Silva"
|
||||
className="mb-5 w-full"
|
||||
@@ -237,12 +248,15 @@
|
||||
<TextField
|
||||
label="Name of Organization"
|
||||
bind:value={fields.orgName}
|
||||
name="orgname"
|
||||
type="text"
|
||||
placeholder="e.g Education For All"
|
||||
className="mb-5 w-full"
|
||||
labelClassName="text-lg font-normal"
|
||||
errorMessage={errors.orgName}
|
||||
onChange={() => (isSiteNameTouched = true)}
|
||||
onChange={() => {
|
||||
isSiteNameTouched = true;
|
||||
}}
|
||||
/>
|
||||
|
||||
<!-- Org Site Name -->
|
||||
@@ -250,6 +264,7 @@
|
||||
label="Organisation Site name"
|
||||
helperMessage={`https://${fields.siteName || ''}.classroomio.com`}
|
||||
bind:value={fields.siteName}
|
||||
name="sitename"
|
||||
type="text"
|
||||
placeholder="e.g edforall"
|
||||
className="mb-5 w-full"
|
||||
|
||||
+10
-10
@@ -5,17 +5,17 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import { goto } from '@sapper/app';
|
||||
import TextField from '../components/Form/TextField.svelte';
|
||||
import PrimaryButton from '../components/PrimaryButton/index.svelte';
|
||||
import { getSupabase } from '../utils/functions/supabase';
|
||||
import { goto } from "@sapper/app";
|
||||
import TextField from "../components/Form/TextField.svelte";
|
||||
import PrimaryButton from "../components/PrimaryButton/index.svelte";
|
||||
import { getSupabase } from "../utils/functions/supabase";
|
||||
import {
|
||||
authValidation,
|
||||
getConfirmPasswordError,
|
||||
getDisableSubmit,
|
||||
} from '../utils/functions/validator';
|
||||
import { SIGNUP_FIELDS } from '../utils/constants/authentication';
|
||||
import AuthUI from '../components/AuthUI/index.svelte';
|
||||
} from "../utils/functions/validator";
|
||||
import { SIGNUP_FIELDS } from "../utils/constants/authentication";
|
||||
import AuthUI from "../components/AuthUI/index.svelte";
|
||||
|
||||
export let config;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
async function handleSubmit(e) {
|
||||
const validationRes = authValidation(fields);
|
||||
console.log('validationRes', validationRes);
|
||||
console.log("validationRes", validationRes);
|
||||
|
||||
if (Object.keys(validationRes).length) {
|
||||
errors = Object.assign(errors, validationRes);
|
||||
@@ -43,12 +43,12 @@
|
||||
email: fields.email,
|
||||
password: fields.password,
|
||||
});
|
||||
console.log('data', data);
|
||||
console.log("data", data);
|
||||
if (error) throw error;
|
||||
|
||||
formRef?.reset();
|
||||
|
||||
return goto('/login');
|
||||
return goto("/login");
|
||||
// success = true;
|
||||
// fields = Object.assign({}, SIGNUP_FIELDS);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user