Add more permissions
This commit is contained in:
@@ -13,11 +13,12 @@ import DocumentEditDialog from "@/Components/DocumentEditDialog.vue";
|
||||
import DocumentUploadDialog from "@/Components/DocumentUploadDialog.vue";
|
||||
import DocumentViewerDialog from "@/Components/DocumentViewerDialog.vue";
|
||||
import { classifyDocument } from "@/Services/documents";
|
||||
import { router, useForm } from "@inertiajs/vue3";
|
||||
import { router, useForm, usePage } from "@inertiajs/vue3";
|
||||
import { AngleDownIcon, AngleUpIcon } from "@/Utilities/Icons";
|
||||
import Pagination from "@/Components/Pagination.vue";
|
||||
import ConfirmDialog from "@/Components/ConfirmDialog.vue";
|
||||
import DialogModal from "@/Components/DialogModal.vue";
|
||||
import { hasPermission } from "@/Services/permissions";
|
||||
|
||||
const props = defineProps({
|
||||
client: Object,
|
||||
@@ -35,6 +36,7 @@ const props = defineProps({
|
||||
contract_doc_templates: { type: Array, default: () => [] },
|
||||
});
|
||||
|
||||
const page = usePage();
|
||||
const showUpload = ref(false);
|
||||
const openUpload = () => {
|
||||
showUpload.value = true;
|
||||
@@ -47,20 +49,25 @@ const onUploaded = () => {
|
||||
router.reload({ only: ["documents"] });
|
||||
};
|
||||
|
||||
// Expose as a callable computed: use in templates as hasPerm('permission-slug')
|
||||
const hasPerm = computed(() => (permission) =>
|
||||
hasPermission(page.props.auth?.user, permission)
|
||||
);
|
||||
|
||||
// Document edit dialog state
|
||||
const showDocEdit = ref(false)
|
||||
const editingDoc = ref(null)
|
||||
const showDocEdit = ref(false);
|
||||
const editingDoc = ref(null);
|
||||
const openDocEdit = (doc) => {
|
||||
editingDoc.value = doc
|
||||
showDocEdit.value = true
|
||||
}
|
||||
editingDoc.value = doc;
|
||||
showDocEdit.value = true;
|
||||
};
|
||||
const closeDocEdit = () => {
|
||||
showDocEdit.value = false
|
||||
editingDoc.value = null
|
||||
}
|
||||
showDocEdit.value = false;
|
||||
editingDoc.value = null;
|
||||
};
|
||||
const onDocSaved = () => {
|
||||
router.reload({ only: ['documents'] })
|
||||
}
|
||||
router.reload({ only: ["documents"] });
|
||||
};
|
||||
|
||||
const viewer = ref({ open: false, src: "", title: "" });
|
||||
const openViewer = (doc) => {
|
||||
@@ -236,7 +243,11 @@ const submitAttachSegment = () => {
|
||||
class="bg-white overflow-hidden shadow-xl sm:rounded-lg border-l-4 border-blue-400"
|
||||
>
|
||||
<div class="mx-auto max-w-4x1 p-3">
|
||||
<PersonInfoGrid :types="types" :person="client.person" />
|
||||
<PersonInfoGrid
|
||||
:types="types"
|
||||
:person="client.person"
|
||||
:edit="hasPerm('client-edit')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -274,6 +285,7 @@ const submitAttachSegment = () => {
|
||||
:types="types"
|
||||
tab-color="red-600"
|
||||
:person="client_case.person"
|
||||
:person-edit="hasPerm('person-edit')"
|
||||
:enable-sms="true"
|
||||
:client-case-uuid="client_case.uuid"
|
||||
/>
|
||||
@@ -289,7 +301,7 @@ const submitAttachSegment = () => {
|
||||
<SectionTitle>
|
||||
<template #title> Pogodbe </template>
|
||||
</SectionTitle>
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="flex items-center gap-2" v-if="hasPerm('contract-edit')">
|
||||
<FwbButton @click="openDrawerCreateContract">Nova</FwbButton>
|
||||
<FwbButton
|
||||
color="light"
|
||||
@@ -311,6 +323,7 @@ const submitAttachSegment = () => {
|
||||
:contract_types="contract_types"
|
||||
:segments="segments"
|
||||
:templates="contract_doc_templates"
|
||||
:edit="hasPerm('contract-edit')"
|
||||
@edit="openDrawerEditContract"
|
||||
@delete="requestDeleteContract"
|
||||
@add-activity="openDrawerAddActivity"
|
||||
@@ -330,7 +343,11 @@ const submitAttachSegment = () => {
|
||||
</SectionTitle>
|
||||
<FwbButton @click="openDrawerAddActivity">Nova</FwbButton>
|
||||
</div>
|
||||
<ActivityTable :client_case="client_case" :activities="activities" />
|
||||
<ActivityTable
|
||||
:client_case="client_case"
|
||||
:activities="activities"
|
||||
:edit="hasPerm('activity-edit')"
|
||||
/>
|
||||
<Pagination
|
||||
:links="activities.links"
|
||||
:from="activities.from"
|
||||
|
||||
Reference in New Issue
Block a user