-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: #94 require billing name and email on team creation
- Loading branch information
1 parent
d2d1263
commit a57f2b1
Showing
6 changed files
with
111 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
@@ -1,36 +1,39 @@ | ||
<script setup> | ||
import {ref, onMounted, reactive, onActivated} from 'vue'; | ||
import { ref, onMounted, reactive, onActivated } from "vue"; | ||
import InputLabel from "@/Components/InputLabel.vue"; | ||
import InputError from "@/Components/InputError.vue"; | ||
const props = defineProps({ | ||
'error': String, | ||
}) | ||
error: String, | ||
}); | ||
const slot = ref(null); | ||
const state = reactive({ | ||
domId: '' | ||
domId: "", | ||
}); | ||
onMounted(() => { | ||
state.domId = 'f-' + Math.random().toString(36).slice(2); | ||
slot.value.children[0]?.setAttribute('id', state.domId); | ||
}) | ||
state.domId = "f-" + Math.random().toString(36).slice(2); | ||
slot.value.children[0]?.setAttribute("id", state.domId); | ||
}); | ||
</script> | ||
<template> | ||
<div v-auto-animate> | ||
<InputLabel :for="state.domId"> | ||
<slot name="label" /> | ||
</InputLabel> | ||
<div v-auto-animate> | ||
<InputLabel :for="state.domId"> | ||
<slot name="label" /> | ||
</InputLabel> | ||
<div ref="slot"> | ||
<slot /> | ||
</div> | ||
<div ref="slot"> | ||
<slot /> | ||
</div> | ||
<div v-if="$slots.hint" class="text-sm text-gray-500 pt-2"> | ||
<slot name="hint" /> | ||
</div> | ||
<InputError :message="$props.error" class="mt-2" /> | ||
</div> | ||
</template> | ||
<InputError :message="$props.error" class="mt-2" /> | ||
</div> | ||
</template> |
This file contains 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 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 |
---|---|---|
@@ -1,28 +1,58 @@ | ||
<script setup> | ||
import { useForm } from '@inertiajs/vue3'; | ||
import FormSection from '@/Components/FormSection.vue'; | ||
import InputError from '@/Components/InputError.vue'; | ||
import InputLabel from '@/Components/InputLabel.vue'; | ||
import PrimaryButton from '@/Components/PrimaryButton.vue'; | ||
import TextInput from '@/Components/TextInput.vue'; | ||
import { useForm } from "@inertiajs/vue3"; | ||
import FormSection from "@/Components/FormSection.vue"; | ||
import InputError from "@/Components/InputError.vue"; | ||
import InputLabel from "@/Components/InputLabel.vue"; | ||
import PrimaryButton from "@/Components/PrimaryButton.vue"; | ||
import TextInput from "@/Components/TextInput.vue"; | ||
import FormField from "@/Components/FormField.vue"; | ||
import ActionSection from "@/Components/ActionSection.vue"; | ||
const form = useForm({ | ||
name: '', | ||
name: "", | ||
billing_name: "", | ||
billing_email: "", | ||
}); | ||
const createTeam = () => { | ||
form.post(route('teams.store'), { | ||
errorBag: 'createTeam', | ||
form.post(route("teams.store"), { | ||
errorBag: "createTeam", | ||
preserveScroll: true, | ||
}); | ||
}; | ||
</script> | ||
|
||
<template> | ||
<FormSection @submitted="createTeam"> | ||
<template #title> | ||
Team Details | ||
<ActionSection> | ||
<template #title> Customer Details </template> | ||
|
||
<template #description> | ||
Invoices and receipts will be sent to the specified E-Mail address. | ||
</template> | ||
|
||
<template #content> | ||
<FormField class="col-span-4" :error="form.errors.billing_name"> | ||
<template #label> Business Name </template> | ||
|
||
<TextInput v-model="form.billing_name" class="w-full" /> | ||
</FormField> | ||
|
||
<FormField class="col-span-4" :error="form.errors.billing_email"> | ||
<template #label> Business Email </template> | ||
|
||
<TextInput v-model="form.billing_email" class="w-full" /> | ||
|
||
<template #hint> | ||
E-Mails should be unique. You can use '+' sign to use the | ||
same email for multiple teams. For example, | ||
[email protected] | ||
</template> | ||
</FormField> | ||
</template> | ||
</ActionSection> | ||
|
||
<FormSection @submitted="createTeam"> | ||
<template #title> Team Details </template> | ||
|
||
<template #description> | ||
Create a new team to collaborate with others on projects. | ||
|
@@ -33,10 +63,16 @@ const createTeam = () => { | |
<InputLabel value="Team Owner" /> | ||
|
||
<div class="flex items-center mt-2"> | ||
<img class="object-cover w-12 h-12 rounded-full" :src="$page.props.auth.user.profile_photo_url" :alt="$page.props.auth.user.name"> | ||
<img | ||
class="object-cover w-12 h-12 rounded-full" | ||
:src="$page.props.auth.user.profile_photo_url" | ||
:alt="$page.props.auth.user.name" | ||
/> | ||
|
||
<div class="ms-4 leading-tight"> | ||
<div class="text-gray-900 dark:text-white">{{ $page.props.auth.user.name }}</div> | ||
<div class="text-gray-900 dark:text-white"> | ||
{{ $page.props.auth.user.name }} | ||
</div> | ||
<div class="text-sm text-gray-700 dark:text-gray-300"> | ||
{{ $page.props.auth.user.email }} | ||
</div> | ||
|
@@ -57,8 +93,11 @@ const createTeam = () => { | |
</div> | ||
</template> | ||
|
||
<template #actions> | ||
<PrimaryButton :class="{ 'opacity-25': form.processing }" :disabled="form.processing"> | ||
<template #submit> | ||
<PrimaryButton | ||
:class="{ 'opacity-25': form.processing }" | ||
:disabled="form.processing" | ||
> | ||
Create | ||
</PrimaryButton> | ||
</template> | ||
|