-
Notifications
You must be signed in to change notification settings - Fork 4
feat(org): create org page #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
c59cd4d
release: alpha (#61)
fu050409 3c27e24
Merge branch 'main' into alpha
fu050409 885de38
release: bump version (#63)
github-actions[bot] 9710c94
fix(lint): fix code spell check
fu050409 a243999
ci(release): remove `tailwindcss` building
fu050409 62d606c
Merge branch 'main' into alpha
fu050409 514f839
fix(profile): fix profile problem panel (#65)
fu050409 7703d20
chore: fix aur release
fu050409 ea4e3bb
Merge branch 'alpha' of github.com:swpu-acm/algohub into alpha
fu050409 2a9babd
release: bump version (#66)
github-actions[bot] a07cd8d
chore: fix code spell check
fu050409 539e48f
Merge branch 'alpha' of github.com:swpu-acm/algohub into alpha
fu050409 3cf98fb
feat: add `NProgress` bar (#67)
fu050409 053eb9a
release: bump version (#68)
github-actions[bot] d50148f
chore: fix aur ssh known hosts
fu050409 9bbb526
chore: fix version check
fu050409 7b6134b
release: alpha releases (#62)
fu050409 266bba2
chore: fix ci branches
fu050409 3f4a486
release: bump version (#96)
github-actions[bot] a8ceba7
feat(contest): support acc (#97)
fu050409 e986572
release: bump version (#98)
github-actions[bot] 802cc86
feat(org): inrt ui
luo0602141017 965d469
feat(org): inrt ui
luo0602141017 8015f9c
feat(org): inrt ui
luo0602141017 70abf22
feat(org): inrt ui
luo0602141017 10b8793
feat(org): inrt ui
luo0602141017 121e4dc
feat(org): inrt ui
luo0602141017 3487fd6
Merge branch 'main' into feat/create-org
luo0602141017 68f03b2
feat(org): inrt ui
luo0602141017 bae1615
feat(org): inrt ui
luo0602141017 8cd12ce
Merge branch 'main' into feat/create-org
fu050409 db58480
feat(org): edit org page
luo0602141017 a48deac
Merge branch 'feat/create-org' of https://github.com/swpu-acm/algohub…
luo0602141017 e1b7515
Merge branch 'main' into feat/create-org
fu050409 19eb942
feat(org): edit org page
luo0602141017 b90c8bc
Merge branch 'feat/create-org' of https://github.com/swpu-acm/algohub…
luo0602141017 9dffdc8
Update src/views/org/create.vue
fu050409 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<script setup lang="ts"> | ||
import * as api from "@/scripts/api"; | ||
import { useRouter } from 'vue-router'; | ||
import { useAccountStore } from '@/scripts/store'; | ||
import { ref } from 'vue'; | ||
import { reactive } from 'vue'; | ||
import { useToast } from 'primevue/usetoast'; | ||
|
||
|
||
const path = [{ label: 'New Organization' }]; | ||
|
||
const router = useRouter(); | ||
const toast = useToast(); | ||
|
||
const accountStore = useAccountStore(); | ||
if (!accountStore.isLoggedIn) { | ||
toast.add({ severity: 'error', summary: 'Error', detail: 'Please login first', life: 3000 }); | ||
router.push('/login'); | ||
} | ||
|
||
|
||
const initialValues = reactive({ | ||
org_name: "", | ||
contact_email: "", | ||
terms: false, | ||
}); | ||
|
||
interface OrgCreateForm<T> { | ||
org_name?: T; | ||
contact_email?: T; | ||
terms?: T; | ||
} | ||
|
||
const resolver = ({ values }: { values: OrgCreateForm<string> }) => { | ||
const errors: OrgCreateForm<{ message: string }[]> = {}; | ||
|
||
if (!values.org_name) { | ||
errors.org_name = [{ message: 'Organization Name is required.' }]; | ||
} | ||
|
||
if (!values.contact_email) { | ||
errors.contact_email = [{ message: 'Your Contact Email is required.' }]; | ||
} | ||
|
||
if (!values.terms) { | ||
errors.terms = [{ message: "You must agree to the terms and conditions." }] | ||
} | ||
|
||
return { | ||
errors | ||
}; | ||
}; | ||
|
||
const name = ref(''); | ||
const email = ref(''); | ||
const description = ref(''); | ||
const display_name = ref(''); | ||
|
||
const inProgress = ref(false); | ||
const onCreateOrg = async () => { | ||
inProgress.value = true; | ||
const res = await api.createOrganization( | ||
accountStore.auth!, | ||
{ | ||
name: name.value, | ||
description: description.value, | ||
display_name: display_name.value, | ||
}) | ||
if (!res.success) { | ||
toast.add({ severity: 'error', summary: 'Error', detail: res.message, life: 3000 }); | ||
}; | ||
inProgress.value = false; | ||
// router.push("/org/create" + res.data!.id); | ||
// TODO: redirect to organization home page | ||
} | ||
</script> | ||
|
||
|
||
|
||
<template> | ||
<div class="flex-1 flex flex-col"> | ||
<UniversalToolBar :path></UniversalToolBar> | ||
<div class="max-w-full w-[768px] md:max-w-[768px] mx-auto"> | ||
<Panel class="mt-10 w-full h-full"> | ||
<div class="flex flex-col gap-8 w-full"> | ||
<div class="mt-10 text-center"> | ||
<span class="text-gray-500 mb-4">Tell us about your organization</span> | ||
<h1 class="text-3xl font-bold">Set up your organization</h1> | ||
</div> | ||
<div class="flex flex-col"> | ||
<Form v-slot="$form" :initialValues :resolver class="flex flex-col gap-4 w-full "> | ||
<div class="card flex flex-col justify-center"> | ||
<div class="flex flex-col"> | ||
<label for="name" style="font-size: 20px;">Organization Name *</label> | ||
<InputText v-model="name" name="name"></InputText> | ||
</div> | ||
<Message v-if="$form.org_name?.invalid" severity="error" size="small" variant="simple"> | ||
{{ | ||
$form.org_name.error.message }}</Message> | ||
<div> | ||
<span class="text-gray-500 mb-4" style="font-size:13px">This will be the name of | ||
your | ||
organization on AlgoHub.</span> | ||
</div> | ||
<div class="mt-6 flex flex-col"> | ||
<label for="email" style="font-size: 20px;">Contact Email *</label> | ||
<InputText v-model="email" email="email"></InputText> | ||
</div> | ||
<Message v-if="$form.contact_email?.invalid" severity="error" size="small" | ||
variant="simple"> | ||
{{ | ||
$form.contact_email.error.message }}</Message> | ||
</div> | ||
<div class="flex flex-col gap-1 w-full"> | ||
<div class="flex items-center gap-2"> | ||
<Checkbox inputId="terms" name="terms" binary /> | ||
<label for="terms" class="text-sm">I have read and agree to the <a href="#" | ||
class="underline">Affero | ||
General Public License v3</a>.</label> | ||
</div> | ||
<Message v-if="$form.terms?.invalid" severity="error" size="small" variant="simple">{{ | ||
$form.terms.error.message }}</Message> | ||
</div> | ||
<Button @click="onCreateOrg" :loading="inProgress" label="Next"></Button> | ||
</Form> | ||
</div> | ||
</div> | ||
</Panel> | ||
</div> | ||
<UniversalFooter></UniversalFooter> | ||
</div> | ||
</template> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.