SmartCane/laravel_app/resources/views/components/project-manager-grid.blade.php
2024-05-27 14:49:44 +02:00

49 lines
2.2 KiB
PHP

@props([
/** @var \App\Livewire\Projects\ProjectManager */
'projectManager'
])
<div {{ $attributes->class(['mt-10 sm:mt-0']) }}>
<x-action-section>
<x-slot name="title">
{{ __('Manage projects') }}
</x-slot>
<x-slot name="description">
{{ __('You may delete any of your projects if they are no longer needed.') }}
</x-slot>
<x-slot name="content">
<div class="space-y-6">
<div class="flex flex-auto gap-2" x-data="{showCreateProjectInput:false}">
<x-secondary-button x-show="!showCreateProjectInput" @click="showCreateProjectInput = true">
{{ __('Create Project') }}
</x-secondary-button>
<div x-show="showCreateProjectInput" class="flex justify-center items-center gap-1">
<x-input x-ref="projectName" id="name" type="text" class="w-fit"
wire:model="formData.name"
placeholder="New Project Name"/>
<x-secondary-button @click="showCreateProjectInput = false" class="w-fit h-full">
{{ __('Cancel') }}
</x-secondary-button>
<x-button class=" h-full" wire:click="createProject">Create</x-button>
</div>
</div>
@foreach ($projectManager->projects->sortBy('name') as $project)
<div class="flex items-center justify-between">
<div class="break-all">
<a href="{!! route('project.show', [$project->name]) !!}">{{ $project->name }}</a>
</div>
<div class="flex items-center ml-2">
<button class="cursor-pointer ml-6 text-sm text-red-500"
wire:click="confirmReportDeletion({{ $project->id }})">
{{ __('Delete') }}
</button>
</div>
</div>
@endforeach
</div>
</x-slot>
</x-action-section>
</div>