mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-15 11:42:15 +01:00
hide actions and pages in the frontend according to permissions
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import Dropdown from '@/Components/Dropdown.vue';
|
||||
import { TrashIcon, PencilSquareIcon } from '@heroicons/vue/20/solid';
|
||||
import type { Project } from '@/utils/api';
|
||||
import { canDeleteProjects, canUpdateProjects } from '@/utils/permissions';
|
||||
const emit = defineEmits<{
|
||||
delete: [];
|
||||
edit: [];
|
||||
@@ -34,12 +35,14 @@ const props = defineProps<{
|
||||
@click.prevent="emit('delete')"
|
||||
:aria-label="'Delete Project ' + props.project.name"
|
||||
data-testid="project_delete"
|
||||
v-if="canDeleteProjects()"
|
||||
class="border-b border-card-background-separator flex items-center space-x-3 w-full px-3 py-2.5 text-start text-sm font-medium leading-5 text-white hover:bg-card-background-active focus:outline-none focus:bg-card-background-active transition duration-150 ease-in-out">
|
||||
<TrashIcon class="w-5 text-icon-active"></TrashIcon>
|
||||
<span>Delete</span>
|
||||
</button>
|
||||
<button
|
||||
@click.prevent="emit('edit')"
|
||||
v-if="canUpdateProjects()"
|
||||
:aria-label="'Edit Project ' + props.project.name"
|
||||
data-testid="project_edit"
|
||||
class="flex items-center space-x-3 w-full px-3 py-2.5 text-start text-sm font-medium leading-5 text-white hover:bg-card-background-active focus:outline-none focus:bg-card-background-active transition duration-150 ease-in-out">
|
||||
|
||||
@@ -8,6 +8,7 @@ import ProjectCreateModal from '@/Components/Common/Project/ProjectCreateModal.v
|
||||
import { storeToRefs } from 'pinia';
|
||||
import ProjectTableHeading from '@/Components/Common/Project/ProjectTableHeading.vue';
|
||||
import ProjectTableRow from '@/Components/Common/Project/ProjectTableRow.vue';
|
||||
import { canCreateProjects } from '@/utils/permissions';
|
||||
|
||||
const { projects } = storeToRefs(useProjectsStore());
|
||||
|
||||
@@ -29,8 +30,11 @@ const createProject = ref(false);
|
||||
<FolderPlusIcon
|
||||
class="w-8 text-icon-default inline pb-2"></FolderPlusIcon>
|
||||
<h3 class="text-white font-semibold">No projects found</h3>
|
||||
<p class="pb-5">Create your first project now!</p>
|
||||
<p class="pb-5" v-if="canCreateProjects()">
|
||||
Create your first project now!
|
||||
</p>
|
||||
<SecondaryButton
|
||||
v-if="canCreateProjects()"
|
||||
@click="createProject = true"
|
||||
:icon="PlusIcon"
|
||||
>Create your First Project
|
||||
|
||||
Reference in New Issue
Block a user