wip: boarding

This commit is contained in:
Andras Bacsai
2023-08-22 17:44:49 +02:00
parent 2414ddd360
commit b39ca51d41
71 changed files with 694 additions and 137 deletions

View File

@@ -29,7 +29,7 @@ class Create extends Component
'personal_team' => false,
]);
auth()->user()->teams()->attach($team, ['role' => 'admin']);
session(['currentTeam' => $team]);
refreshSession();
return redirect()->route('team.show');
} catch (\Throwable $th) {
return general_error_handler($th, $this);

View File

@@ -9,7 +9,7 @@ class Delete extends Component
{
public function delete()
{
$currentTeam = auth()->user()->currentTeam();
$currentTeam = currentTeam();
$currentTeam->delete();
$team = auth()->user()->teams()->first();
@@ -24,7 +24,7 @@ class Delete extends Component
}
});
session(['currentTeam' => $team]);
refreshSession();
return redirect()->route('team.show');
}
}

View File

@@ -19,7 +19,7 @@ class Form extends Component
public function mount()
{
$this->team = auth()->user()->currentTeam();
$this->team = currentTeam();
}
public function submit()
@@ -27,7 +27,7 @@ class Form extends Component
$this->validate();
try {
$this->team->save();
session(['currentTeam' => $this->team]);
refreshSession();
$this->emit('reloadWindow');
} catch (\Throwable $th) {
return general_error_handler($th, $this);

View File

@@ -18,6 +18,6 @@ class Invitations extends Component
public function refreshInvitations()
{
$this->invitations = TeamInvitation::whereTeamId(auth()->user()->currentTeam()->id)->get();
$this->invitations = TeamInvitation::whereTeamId(currentTeam()->id)->get();
}
}

View File

@@ -35,9 +35,9 @@ class InviteLink extends Component
return general_error_handler(that: $this, customErrorMessage: "$this->email must be registered first (or activate transactional emails to invite via email).");
}
$member_emails = auth()->user()->currentTeam()->members()->get()->pluck('email');
$member_emails = currentTeam()->members()->get()->pluck('email');
if ($member_emails->contains($this->email)) {
return general_error_handler(that: $this, customErrorMessage: "$this->email is already a member of " . auth()->user()->currentTeam()->name . ".");
return general_error_handler(that: $this, customErrorMessage: "$this->email is already a member of " . currentTeam()->name . ".");
}
$invitation = TeamInvitation::whereEmail($this->email);
@@ -53,7 +53,7 @@ class InviteLink extends Component
}
TeamInvitation::firstOrCreate([
'team_id' => auth()->user()->currentTeam()->id,
'team_id' => currentTeam()->id,
'uuid' => $uuid,
'email' => $this->email,
'role' => $this->role,

View File

@@ -11,19 +11,19 @@ class Member extends Component
public function makeAdmin()
{
$this->member->teams()->updateExistingPivot(auth()->user()->currentTeam()->id, ['role' => 'admin']);
$this->member->teams()->updateExistingPivot(currentTeam()->id, ['role' => 'admin']);
$this->emit('reloadWindow');
}
public function makeReadonly()
{
$this->member->teams()->updateExistingPivot(auth()->user()->currentTeam()->id, ['role' => 'member']);
$this->member->teams()->updateExistingPivot(currentTeam()->id, ['role' => 'member']);
$this->emit('reloadWindow');
}
public function remove()
{
$this->member->teams()->detach(auth()->user()->currentTeam());
$this->member->teams()->detach(currentTeam());
$this->emit('reloadWindow');
}
}

View File

@@ -62,7 +62,7 @@ class Create extends Component
} else {
$this->storage->endpoint = $this->endpoint;
}
$this->storage->team_id = auth()->user()->currentTeam()->id;
$this->storage->team_id = currentTeam()->id;
$this->storage->testConnection();
$this->emit('success', 'Connection is working. Tested with "ListObjectsV2" action.');
$this->storage->save();