switch to auth()->user from session

This commit is contained in:
Andras Bacsai
2023-08-11 17:31:53 +02:00
parent e60ec6c47e
commit 833e45155d
32 changed files with 90 additions and 77 deletions

View File

@@ -15,7 +15,7 @@
auth()->user()->currentTeam()->subscription?->lemon_status !== 'cancelled')
<div>Please cancel your subscription before delete this team (Manage My Subscription button).</div>
@else
@if (session('currentTeam')->isEmpty())
@if (auth()->user()->currentTeam()->isEmpty())
<div class="pb-4">This will delete your team. Beware! There is no coming back!</div>
<x-forms.button isError isModal modalId="deleteTeam">
Delete
@@ -25,29 +25,29 @@
<div class="pb-4">You need to delete the following resources to be able to delete the team:</div>
<h4 class="pb-4">Projects:</h4>
<ul class="pl-8 list-disc">
@foreach (session('currentTeam')->projects as $resource)
@foreach (auth()->user()->currentTeam()->projects as $resource)
<li>{{ $resource->name }}</li>
@endforeach
</ul>
<h4 class="py-4">Servers:</h4>
<ul class="pl-8 list-disc">
@foreach (session('currentTeam')->servers as $resource)
@foreach (auth()->user()->currentTeam()->servers as $resource)
<li>{{ $resource->name }}</li>
@endforeach
</ul>
<h4 class="py-4">Private Keys:</h4>
<ul class="pl-8 list-disc">
@foreach (session('currentTeam')->privateKeys as $resource)
@foreach (auth()->user()->currentTeam()->privateKeys as $resource)
<li>{{ $resource->name }}</li>
@endforeach
</ul>
<h4 class="py-4">Sources:</h4>
<ul class="pl-8 list-disc">
@foreach (session('currentTeam')->sources() as $resource)
@foreach (auth()->user()->currentTeam()->sources() as $resource)
<li>{{ $resource->name }}</li>
@endforeach
</ul>
@endif
@endif
@endif
@endif
</div>
</div>

View File

@@ -1,20 +1,22 @@
<x-layout>
<x-team.navbar :team="session('currentTeam')"/>
<x-team.navbar :team="auth()
->user()
->currentTeam()" />
<h2>Members</h2>
<div class="pt-4 overflow-hidden">
<table>
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Role</th>
<th>Actions</th>
</tr>
<tr>
<th>Name</th>
<th>Email</th>
<th>Role</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach (auth()->user()->currentTeam()->members->sortBy('name') as $member)
<livewire:team.member :member="$member" :wire:key="$member->id"/>
@endforeach
@foreach (auth()->user()->currentTeam()->members->sortBy('name') as $member)
<livewire:team.member :member="$member" :wire:key="$member->id" />
@endforeach
</tbody>
</table>
</div>
@@ -26,7 +28,7 @@
<h3>Invite a new member</h3>
@if (auth()->user()->isInstanceAdmin())
<div class="pb-4 text-xs text-warning">You need to configure <a href="/settings/emails"
class="underline text-warning">Transactional
class="underline text-warning">Transactional
Emails</a>
before
you can invite a
@@ -37,8 +39,8 @@
</div>
@endif
@endif
<livewire:team.invite-link/>
<livewire:team.invite-link />
</div>
<livewire:team.invitations :invitations="$invitations"/>
<livewire:team.invitations :invitations="$invitations" />
@endif
</x-layout>

View File

@@ -1,19 +1,25 @@
<x-layout>
<x-team.navbar :team="session('currentTeam')"/>
<x-team.navbar :team="auth()
->user()
->currentTeam()" />
<h2 class="pb-4">Notifications</h2>
<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'email' }" class="flex h-full">
<div class="flex flex-col gap-4 min-w-fit">
<a :class="activeTab === 'email' && 'text-white'"
@click.prevent="activeTab = 'email'; window.location.hash = 'email'" href="#">Email</a>
@click.prevent="activeTab = 'email'; window.location.hash = 'email'" href="#">Email</a>
<a :class="activeTab === 'discord' && 'text-white'"
@click.prevent="activeTab = 'discord'; window.location.hash = 'discord'" href="#">Discord</a>
@click.prevent="activeTab = 'discord'; window.location.hash = 'discord'" href="#">Discord</a>
</div>
<div class="w-full pl-8">
<div x-cloak x-show="activeTab === 'email'" class="h-full">
<livewire:notifications.email-settings :model="session('currentTeam')"/>
<livewire:notifications.email-settings :model="auth()
->user()
->currentTeam()" />
</div>
<div x-cloak x-show="activeTab === 'discord'">
<livewire:notifications.discord-settings :model="session('currentTeam')"/>
<livewire:notifications.discord-settings :model="auth()
->user()
->currentTeam()" />
</div>
</div>
</x-layout>

View File

@@ -1,6 +1,8 @@
<x-layout>
<x-team.navbar :team="session('currentTeam')"/>
<livewire:team.form/>
<x-team.navbar :team="auth()
->user()
->currentTeam()" />
<livewire:team.form />
@if (is_cloud())
<div class="pb-8">
<h3>Subscription</h3>
@@ -27,5 +29,5 @@
</x-forms.button>
</div>
@endif
<livewire:team.delete/>
<livewire:team.delete />
</x-layout>

View File

@@ -1,5 +1,7 @@
<x-layout>
<x-team.navbar :team="session('currentTeam')"/>
<x-team.navbar :team="auth()
->user()
->currentTeam()" />
<div class="flex items-start gap-2">
<h2 class="pb-4">S3 Storages</h2>
<x-forms.button class="btn">
@@ -8,8 +10,7 @@
</div>
<div class="grid gap-2 lg:grid-cols-2">
@forelse ($s3 as $storage)
<div x-data
x-on:click="goto('{{ $storage->uuid }}')" @class(['gap-2 border cursor-pointer box group border-transparent'])>
<div x-data x-on:click="goto('{{ $storage->uuid }}')" @class(['gap-2 border cursor-pointer box group border-transparent'])>
<div class="flex flex-col mx-6">
<div class=" group-hover:text-white">
{{ $storage->name }}
@@ -21,7 +22,7 @@
@empty
<div>
<div>No storage found.</div>
<x-use-magic-bar link="/team/storages/new"/>
<x-use-magic-bar link="/team/storages/new" />
</div>
@endforelse
</div>

View File

@@ -1,4 +1,6 @@
<x-layout>
<x-team.navbar :team="session('currentTeam')"/>
<livewire:team.storage.form :storage="$storage"/>
<x-team.navbar :team="auth()
->user()
->currentTeam()" />
<livewire:team.storage.form :storage="$storage" />
</x-layout>