feat: Add create button visibility control to CrudDataTable and integrate permission checks in project management
This commit is contained in:
parent
ef77c1e6f1
commit
5b030b84c9
@ -24,6 +24,7 @@
|
||||
/>
|
||||
<slot name="header-actions">
|
||||
<Button
|
||||
v-if="showCreateButton"
|
||||
:label="createLabel"
|
||||
icon="pi pi-plus"
|
||||
@click="$emit('create')"
|
||||
@ -217,6 +218,10 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
showCreateButton: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showEditButton: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
data-source="/api/contacts"
|
||||
storage-key="contactTableColumns"
|
||||
:show-view-button="canView"
|
||||
:show-create-button="canCreate"
|
||||
:show-edit-button="canEdit"
|
||||
:show-delete-button="canDelete"
|
||||
:show-export-button="canExport"
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
data-source="/api/projects"
|
||||
storage-key="projectTableColumns"
|
||||
:show-view-button="canView"
|
||||
:show-create-button="canCreate"
|
||||
:show-edit-button="canEdit"
|
||||
:show-delete-button="canDelete"
|
||||
:show-export-button="canExport"
|
||||
@ -850,6 +851,7 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { useToast } from 'primevue/usetoast'
|
||||
import { usePermissionStore } from '../stores/permissions'
|
||||
import CrudDataTable from '../components/CrudDataTable.vue'
|
||||
import Dialog from 'primevue/dialog'
|
||||
import Button from 'primevue/button'
|
||||
@ -873,6 +875,7 @@ import GitContributionChart from '../components/GitContributionChart.vue'
|
||||
import DocumentUpload from '../components/DocumentUpload.vue'
|
||||
|
||||
const toast = useToast()
|
||||
const permissionStore = usePermissionStore()
|
||||
const tableRef = ref(null)
|
||||
const projectDialog = ref(false)
|
||||
const viewDialog = ref(false)
|
||||
@ -912,11 +915,12 @@ const gitProviders = [
|
||||
{ label: 'Lokal', value: 'local' }
|
||||
]
|
||||
|
||||
// Permission checks (will be replaced with actual permission checks)
|
||||
const canView = computed(() => true)
|
||||
const canEdit = computed(() => true)
|
||||
const canDelete = computed(() => true)
|
||||
const canExport = computed(() => true)
|
||||
// Permission checks
|
||||
const canView = computed(() => permissionStore.canView('projects'))
|
||||
const canCreate = computed(() => permissionStore.canCreate('projects'))
|
||||
const canEdit = computed(() => permissionStore.canEdit('projects'))
|
||||
const canDelete = computed(() => permissionStore.canDelete('projects'))
|
||||
const canExport = computed(() => permissionStore.canExport('projects'))
|
||||
|
||||
// Column definitions
|
||||
const projectColumns = ref([
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user