Laravel Jetstream install

This commit is contained in:
Benjamin Takats
2022-11-29 17:42:58 +01:00
parent 17cfffc817
commit 9e56453d46
127 changed files with 5887 additions and 197 deletions

View File

@@ -0,0 +1,36 @@
<x-jet-form-section submit="createTeam">
<x-slot name="title">
{{ __('Team Details') }}
</x-slot>
<x-slot name="description">
{{ __('Create a new team to collaborate with others on projects.') }}
</x-slot>
<x-slot name="form">
<div class="col-span-6">
<x-jet-label value="{{ __('Team Owner') }}" />
<div class="flex items-center mt-2">
<img class="w-12 h-12 rounded-full object-cover" src="{{ $this->user->profile_photo_url }}" alt="{{ $this->user->name }}">
<div class="ml-4 leading-tight">
<div>{{ $this->user->name }}</div>
<div class="text-gray-700 text-sm">{{ $this->user->email }}</div>
</div>
</div>
</div>
<div class="col-span-6 sm:col-span-4">
<x-jet-label for="name" value="{{ __('Team Name') }}" />
<x-jet-input id="name" type="text" class="mt-1 block w-full" wire:model.defer="state.name" autofocus />
<x-jet-input-error for="name" class="mt-2" />
</div>
</x-slot>
<x-slot name="actions">
<x-jet-button>
{{ __('Create') }}
</x-jet-button>
</x-slot>
</x-jet-form-section>

View File

@@ -0,0 +1,13 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Create Team') }}
</h2>
</x-slot>
<div>
<div class="max-w-7xl mx-auto py-10 sm:px-6 lg:px-8">
@livewire('teams.create-team-form')
</div>
</div>
</x-app-layout>

View File

@@ -0,0 +1,42 @@
<x-jet-action-section>
<x-slot name="title">
{{ __('Delete Team') }}
</x-slot>
<x-slot name="description">
{{ __('Permanently delete this team.') }}
</x-slot>
<x-slot name="content">
<div class="max-w-xl text-sm text-gray-600">
{{ __('Once a team is deleted, all of its resources and data will be permanently deleted. Before deleting this team, please download any data or information regarding this team that you wish to retain.') }}
</div>
<div class="mt-5">
<x-jet-danger-button wire:click="$toggle('confirmingTeamDeletion')" wire:loading.attr="disabled">
{{ __('Delete Team') }}
</x-jet-danger-button>
</div>
<!-- Delete Team Confirmation Modal -->
<x-jet-confirmation-modal wire:model="confirmingTeamDeletion">
<x-slot name="title">
{{ __('Delete Team') }}
</x-slot>
<x-slot name="content">
{{ __('Are you sure you want to delete this team? Once a team is deleted, all of its resources and data will be permanently deleted.') }}
</x-slot>
<x-slot name="footer">
<x-jet-secondary-button wire:click="$toggle('confirmingTeamDeletion')" wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-jet-secondary-button>
<x-jet-danger-button class="ml-3" wire:click="deleteTeam" wire:loading.attr="disabled">
{{ __('Delete Team') }}
</x-jet-danger-button>
</x-slot>
</x-jet-confirmation-modal>
</x-slot>
</x-jet-action-section>

View File

@@ -0,0 +1,23 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Team Settings') }}
</h2>
</x-slot>
<div>
<div class="max-w-7xl mx-auto py-10 sm:px-6 lg:px-8">
@livewire('teams.update-team-name-form', ['team' => $team])
@livewire('teams.team-member-manager', ['team' => $team])
@if (Gate::check('delete', $team) && ! $team->personal_team)
<x-jet-section-border />
<div class="mt-10 sm:mt-0">
@livewire('teams.delete-team-form', ['team' => $team])
</div>
@endif
</div>
</div>
</x-app-layout>

View File

@@ -0,0 +1,256 @@
<div>
@if (Gate::check('addTeamMember', $team))
<x-jet-section-border />
<!-- Add Team Member -->
<div class="mt-10 sm:mt-0">
<x-jet-form-section submit="addTeamMember">
<x-slot name="title">
{{ __('Add Team Member') }}
</x-slot>
<x-slot name="description">
{{ __('Add a new team member to your team, allowing them to collaborate with you.') }}
</x-slot>
<x-slot name="form">
<div class="col-span-6">
<div class="max-w-xl text-sm text-gray-600">
{{ __('Please provide the email address of the person you would like to add to this team.') }}
</div>
</div>
<!-- Member Email -->
<div class="col-span-6 sm:col-span-4">
<x-jet-label for="email" value="{{ __('Email') }}" />
<x-jet-input id="email" type="email" class="mt-1 block w-full" wire:model.defer="addTeamMemberForm.email" />
<x-jet-input-error for="email" class="mt-2" />
</div>
<!-- Role -->
@if (count($this->roles) > 0)
<div class="col-span-6 lg:col-span-4">
<x-jet-label for="role" value="{{ __('Role') }}" />
<x-jet-input-error for="role" class="mt-2" />
<div class="relative z-0 mt-1 border border-gray-200 rounded-lg cursor-pointer">
@foreach ($this->roles as $index => $role)
<button type="button" class="relative px-4 py-3 inline-flex w-full rounded-lg focus:z-10 focus:outline-none focus:border-blue-300 focus:ring focus:ring-blue-200 {{ $index > 0 ? 'border-t border-gray-200 rounded-t-none' : '' }} {{ ! $loop->last ? 'rounded-b-none' : '' }}"
wire:click="$set('addTeamMemberForm.role', '{{ $role->key }}')">
<div class="{{ isset($addTeamMemberForm['role']) && $addTeamMemberForm['role'] !== $role->key ? 'opacity-50' : '' }}">
<!-- Role Name -->
<div class="flex items-center">
<div class="text-sm text-gray-600 {{ $addTeamMemberForm['role'] == $role->key ? 'font-semibold' : '' }}">
{{ $role->name }}
</div>
@if ($addTeamMemberForm['role'] == $role->key)
<svg class="ml-2 h-5 w-5 text-green-400" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" stroke="currentColor" viewBox="0 0 24 24"><path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
@endif
</div>
<!-- Role Description -->
<div class="mt-2 text-xs text-gray-600 text-left">
{{ $role->description }}
</div>
</div>
</button>
@endforeach
</div>
</div>
@endif
</x-slot>
<x-slot name="actions">
<x-jet-action-message class="mr-3" on="saved">
{{ __('Added.') }}
</x-jet-action-message>
<x-jet-button>
{{ __('Add') }}
</x-jet-button>
</x-slot>
</x-jet-form-section>
</div>
@endif
@if ($team->teamInvitations->isNotEmpty() && Gate::check('addTeamMember', $team))
<x-jet-section-border />
<!-- Team Member Invitations -->
<div class="mt-10 sm:mt-0">
<x-jet-action-section>
<x-slot name="title">
{{ __('Pending Team Invitations') }}
</x-slot>
<x-slot name="description">
{{ __('These people have been invited to your team and have been sent an invitation email. They may join the team by accepting the email invitation.') }}
</x-slot>
<x-slot name="content">
<div class="space-y-6">
@foreach ($team->teamInvitations as $invitation)
<div class="flex items-center justify-between">
<div class="text-gray-600">{{ $invitation->email }}</div>
<div class="flex items-center">
@if (Gate::check('removeTeamMember', $team))
<!-- Cancel Team Invitation -->
<button class="cursor-pointer ml-6 text-sm text-red-500 focus:outline-none"
wire:click="cancelTeamInvitation({{ $invitation->id }})">
{{ __('Cancel') }}
</button>
@endif
</div>
</div>
@endforeach
</div>
</x-slot>
</x-jet-action-section>
</div>
@endif
@if ($team->users->isNotEmpty())
<x-jet-section-border />
<!-- Manage Team Members -->
<div class="mt-10 sm:mt-0">
<x-jet-action-section>
<x-slot name="title">
{{ __('Team Members') }}
</x-slot>
<x-slot name="description">
{{ __('All of the people that are part of this team.') }}
</x-slot>
<!-- Team Member List -->
<x-slot name="content">
<div class="space-y-6">
@foreach ($team->users->sortBy('name') as $user)
<div class="flex items-center justify-between">
<div class="flex items-center">
<img class="w-8 h-8 rounded-full" src="{{ $user->profile_photo_url }}" alt="{{ $user->name }}">
<div class="ml-4">{{ $user->name }}</div>
</div>
<div class="flex items-center">
<!-- Manage Team Member Role -->
@if (Gate::check('addTeamMember', $team) && Laravel\Jetstream\Jetstream::hasRoles())
<button class="ml-2 text-sm text-gray-400 underline" wire:click="manageRole('{{ $user->id }}')">
{{ Laravel\Jetstream\Jetstream::findRole($user->membership->role)->name }}
</button>
@elseif (Laravel\Jetstream\Jetstream::hasRoles())
<div class="ml-2 text-sm text-gray-400">
{{ Laravel\Jetstream\Jetstream::findRole($user->membership->role)->name }}
</div>
@endif
<!-- Leave Team -->
@if ($this->user->id === $user->id)
<button class="cursor-pointer ml-6 text-sm text-red-500" wire:click="$toggle('confirmingLeavingTeam')">
{{ __('Leave') }}
</button>
<!-- Remove Team Member -->
@elseif (Gate::check('removeTeamMember', $team))
<button class="cursor-pointer ml-6 text-sm text-red-500" wire:click="confirmTeamMemberRemoval('{{ $user->id }}')">
{{ __('Remove') }}
</button>
@endif
</div>
</div>
@endforeach
</div>
</x-slot>
</x-jet-action-section>
</div>
@endif
<!-- Role Management Modal -->
<x-jet-dialog-modal wire:model="currentlyManagingRole">
<x-slot name="title">
{{ __('Manage Role') }}
</x-slot>
<x-slot name="content">
<div class="relative z-0 mt-1 border border-gray-200 rounded-lg cursor-pointer">
@foreach ($this->roles as $index => $role)
<button type="button" class="relative px-4 py-3 inline-flex w-full rounded-lg focus:z-10 focus:outline-none focus:border-blue-300 focus:ring focus:ring-blue-200 {{ $index > 0 ? 'border-t border-gray-200 rounded-t-none' : '' }} {{ ! $loop->last ? 'rounded-b-none' : '' }}"
wire:click="$set('currentRole', '{{ $role->key }}')">
<div class="{{ $currentRole !== $role->key ? 'opacity-50' : '' }}">
<!-- Role Name -->
<div class="flex items-center">
<div class="text-sm text-gray-600 {{ $currentRole == $role->key ? 'font-semibold' : '' }}">
{{ $role->name }}
</div>
@if ($currentRole == $role->key)
<svg class="ml-2 h-5 w-5 text-green-400" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" stroke="currentColor" viewBox="0 0 24 24"><path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
@endif
</div>
<!-- Role Description -->
<div class="mt-2 text-xs text-gray-600">
{{ $role->description }}
</div>
</div>
</button>
@endforeach
</div>
</x-slot>
<x-slot name="footer">
<x-jet-secondary-button wire:click="stopManagingRole" wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-jet-secondary-button>
<x-jet-button class="ml-3" wire:click="updateRole" wire:loading.attr="disabled">
{{ __('Save') }}
</x-jet-button>
</x-slot>
</x-jet-dialog-modal>
<!-- Leave Team Confirmation Modal -->
<x-jet-confirmation-modal wire:model="confirmingLeavingTeam">
<x-slot name="title">
{{ __('Leave Team') }}
</x-slot>
<x-slot name="content">
{{ __('Are you sure you would like to leave this team?') }}
</x-slot>
<x-slot name="footer">
<x-jet-secondary-button wire:click="$toggle('confirmingLeavingTeam')" wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-jet-secondary-button>
<x-jet-danger-button class="ml-3" wire:click="leaveTeam" wire:loading.attr="disabled">
{{ __('Leave') }}
</x-jet-danger-button>
</x-slot>
</x-jet-confirmation-modal>
<!-- Remove Team Member Confirmation Modal -->
<x-jet-confirmation-modal wire:model="confirmingTeamMemberRemoval">
<x-slot name="title">
{{ __('Remove Team Member') }}
</x-slot>
<x-slot name="content">
{{ __('Are you sure you would like to remove this person from the team?') }}
</x-slot>
<x-slot name="footer">
<x-jet-secondary-button wire:click="$toggle('confirmingTeamMemberRemoval')" wire:loading.attr="disabled">
{{ __('Cancel') }}
</x-jet-secondary-button>
<x-jet-danger-button class="ml-3" wire:click="removeTeamMember" wire:loading.attr="disabled">
{{ __('Remove') }}
</x-jet-danger-button>
</x-slot>
</x-jet-confirmation-modal>
</div>

View File

@@ -0,0 +1,50 @@
<x-jet-form-section submit="updateTeamName">
<x-slot name="title">
{{ __('Team Name') }}
</x-slot>
<x-slot name="description">
{{ __('The team\'s name and owner information.') }}
</x-slot>
<x-slot name="form">
<!-- Team Owner Information -->
<div class="col-span-6">
<x-jet-label value="{{ __('Team Owner') }}" />
<div class="flex items-center mt-2">
<img class="w-12 h-12 rounded-full object-cover" src="{{ $team->owner->profile_photo_url }}" alt="{{ $team->owner->name }}">
<div class="ml-4 leading-tight">
<div>{{ $team->owner->name }}</div>
<div class="text-gray-700 text-sm">{{ $team->owner->email }}</div>
</div>
</div>
</div>
<!-- Team Name -->
<div class="col-span-6 sm:col-span-4">
<x-jet-label for="name" value="{{ __('Team Name') }}" />
<x-jet-input id="name"
type="text"
class="mt-1 block w-full"
wire:model.defer="state.name"
:disabled="! Gate::check('update', $team)" />
<x-jet-input-error for="name" class="mt-2" />
</div>
</x-slot>
@if (Gate::check('update', $team))
<x-slot name="actions">
<x-jet-action-message class="mr-3" on="saved">
{{ __('Saved.') }}
</x-jet-action-message>
<x-jet-button>
{{ __('Save') }}
</x-jet-button>
</x-slot>
@endif
</x-jet-form-section>