fix: allow invitations via email
This commit is contained in:
parent
0ddd5f0a79
commit
ca934e7cdf
@ -17,6 +17,10 @@ class InviteLink extends Component
|
||||
public string $email;
|
||||
public string $role = 'member';
|
||||
|
||||
protected $rules = [
|
||||
'email' => 'required|email',
|
||||
'role' => 'required|string',
|
||||
];
|
||||
public function mount()
|
||||
{
|
||||
$this->email = isDev() ? 'test3@example.com' : '';
|
||||
@ -34,6 +38,7 @@ public function viaLink()
|
||||
private function generate_invite_link(bool $sendEmail = false)
|
||||
{
|
||||
try {
|
||||
$this->validate();
|
||||
$member_emails = currentTeam()->members()->get()->pluck('email');
|
||||
if ($member_emails->contains($this->email)) {
|
||||
return handleError(livewire: $this, customErrorMessage: "$this->email is already a member of " . currentTeam()->name . ".");
|
||||
|
@ -1,14 +1,18 @@
|
||||
<div>
|
||||
<form wire:submit='viaLink' class="flex flex-col gap-2 lg:items-center lg:flex-row">
|
||||
<x-forms.input id="email" type="email" name="email" placeholder="Email" />
|
||||
<x-forms.select id="role" name="role">
|
||||
<form wire:submit='viaLink' class="flex flex-col items-start gap-2 lg:items-end lg:flex-row">
|
||||
<div class="flex w-full gap-2">
|
||||
<x-forms.input id="email" type="email" label="Email" name="email" placeholder="Email" required />
|
||||
<x-forms.select id="role" name="role" label="Role">
|
||||
<option value="owner">Owner</option>
|
||||
<option value="admin">Admin</option>
|
||||
<option value="member">Member</option>
|
||||
</x-forms.select>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<x-forms.button type="submit">Generate Invitation Link</x-forms.button>
|
||||
@if (is_transactional_emails_active())
|
||||
<x-forms.button wire:click.prevent='viaEmail'>Send Invitation Email</x-forms.button>
|
||||
<x-forms.button wire:click.prevent='viaEmail'>Send Invitation via Email</x-forms.button>
|
||||
@endif
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user