Other permissions changed

This commit is contained in:
Simon Pocrnjič
2025-10-31 12:26:58 +01:00
parent 07b1deda21
commit 0d9c8c8b30
7 changed files with 180 additions and 133 deletions
@@ -36,6 +36,7 @@ const props = defineProps({
all_segments: { type: Array, default: () => [] },
templates: { type: Array, default: () => [] }, // active document templates (latest per slug)
edit: { type: Boolean, default: () => false },
createDoc: { type: Boolean, default: () => false },
});
// Debug: log incoming contract balances (remove after fix)
@@ -485,7 +486,7 @@ const closePaymentsDialog = () => {
>
Opis</FwbTableHeadCell
>
<FwbTableHeadCell class="w-px" v-if="edit" />
<FwbTableHeadCell class="w-px" />
</FwbTableHead>
<FwbTableBody>
<template v-for="(c, i) in contracts" :key="c.uuid || i">
@@ -702,7 +703,7 @@ const closePaymentsDialog = () => {
</Dropdown>
</div>
</FwbTableCell>
<FwbTableCell class="text-right whitespace-nowrap" v-if="edit">
<FwbTableCell class="text-right whitespace-nowrap">
<Dropdown align="right" width="56">
<template #trigger>
<button
@@ -718,23 +719,25 @@ const closePaymentsDialog = () => {
</template>
<template #content>
<!-- Urejanje -->
<div
class="px-3 pt-2 pb-1 text-[11px] uppercase tracking-wide text-gray-400"
>
Urejanje
</div>
<button
type="button"
class="w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-2"
v-if="c.active"
@click="onEdit(c)"
>
<FontAwesomeIcon
:icon="faPenToSquare"
class="h-4 w-4 text-gray-600"
/>
<span>Uredi</span>
</button>
<template v-if="edit">
<div
class="px-3 pt-2 pb-1 text-[11px] uppercase tracking-wide text-gray-400"
>
Urejanje
</div>
<button
type="button"
class="w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-2"
v-if="c.active"
@click="onEdit(c)"
>
<FontAwesomeIcon
:icon="faPenToSquare"
class="h-4 w-4 text-gray-600"
/>
<span>Uredi</span>
</button>
</template>
<button
type="button"
class="w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-2"
@@ -747,46 +750,50 @@ const closePaymentsDialog = () => {
<div class="my-1 border-t border-gray-100" />
<!-- Dokumenti -->
<div
class="px-3 pt-2 pb-1 text-[11px] uppercase tracking-wide text-gray-400"
>
Dokument
</div>
<button
type="button"
class="w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-2"
:disabled="generating[c.uuid] || !templates || templates.length === 0"
@click="openGenerateDialog(c)"
>
<FontAwesomeIcon
:icon="generating[c.uuid] ? faSpinner : faFileWord"
class="h-4 w-4 text-gray-600"
:class="generating[c.uuid] ? 'animate-spin' : ''"
/>
<span>{{
generating[c.uuid]
? "Generiranje..."
: templates && templates.length
? "Generiraj dokument"
: "Ni predlog"
}}</span>
</button>
<a
v-if="generatedDocs[c.uuid]?.path"
:href="'/storage/' + generatedDocs[c.uuid].path"
target="_blank"
class="w-full px-3 py-2 text-left text-sm text-indigo-600 hover:bg-indigo-50 flex items-center gap-2"
>
<FontAwesomeIcon :icon="faFileWord" class="h-4 w-4" />
<span>Prenesi zadnji</span>
</a>
<div
v-if="generationError[c.uuid]"
class="px-3 py-2 text-xs text-rose-600 whitespace-pre-wrap"
>
{{ generationError[c.uuid] }}
</div>
<div class="my-1 border-t border-gray-100" />
<template v-if="createDoc">
<div
class="px-3 pt-2 pb-1 text-[11px] uppercase tracking-wide text-gray-400"
>
Dokument
</div>
<button
type="button"
class="w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-2"
:disabled="
generating[c.uuid] || !templates || templates.length === 0
"
@click="openGenerateDialog(c)"
>
<FontAwesomeIcon
:icon="generating[c.uuid] ? faSpinner : faFileWord"
class="h-4 w-4 text-gray-600"
:class="generating[c.uuid] ? 'animate-spin' : ''"
/>
<span>{{
generating[c.uuid]
? "Generiranje..."
: templates && templates.length
? "Generiraj dokument"
: "Ni predlog"
}}</span>
</button>
<a
v-if="generatedDocs[c.uuid]?.path"
:href="'/storage/' + generatedDocs[c.uuid].path"
target="_blank"
class="w-full px-3 py-2 text-left text-sm text-indigo-600 hover:bg-indigo-50 flex items-center gap-2"
>
<FontAwesomeIcon :icon="faFileWord" class="h-4 w-4" />
<span>Prenesi zadnji</span>
</a>
<div
v-if="generationError[c.uuid]"
class="px-3 py-2 text-xs text-rose-600 whitespace-pre-wrap"
>
{{ generationError[c.uuid] }}
</div>
<div class="my-1 border-t border-gray-100" />
</template>
<!-- Predmeti -->
<div
class="px-3 pt-2 pb-1 text-[11px] uppercase tracking-wide text-gray-400"
@@ -797,6 +804,7 @@ const closePaymentsDialog = () => {
type="button"
class="w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-2"
@click="openObjectsList(c)"
:edit="edit"
>
<FontAwesomeIcon :icon="faCircleInfo" class="h-4 w-4 text-gray-600" />
<span>Seznam predmetov</span>
@@ -835,66 +843,76 @@ const closePaymentsDialog = () => {
<FontAwesomeIcon :icon="faPlus" class="h-4 w-4 text-gray-600" />
<span>Dodaj plačilo</span>
</button>
<template v-if="edit">
<div class="my-1 border-t border-gray-100" />
<!-- Arhiviranje / Ponovna aktivacija -->
<div
class="px-3 pt-2 pb-1 text-[11px] uppercase tracking-wide text-gray-400"
>
{{ c.active ? "Arhiviranje" : "Ponovna aktivacija" }}
</div>
<div class="my-1 border-t border-gray-100" />
<!-- Arhiviranje / Ponovna aktivacija -->
<div
class="px-3 pt-2 pb-1 text-[11px] uppercase tracking-wide text-gray-400"
>
{{ c.active ? "Arhiviranje" : "Ponovna aktivacija" }}
</div>
<button
v-if="c.active"
type="button"
class="w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-2"
@click="
router.post(
route('clientCase.contract.archive', {
client_case: client_case.uuid,
uuid: c.uuid,
}),
{},
{
preserveScroll: true,
only: ['contracts', 'activities', 'documents'],
}
)
"
>
<FontAwesomeIcon :icon="faBoxArchive" class="h-4 w-4 text-gray-600" />
<span>Arhiviraj</span>
</button>
<button
v-else
type="button"
class="w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-2"
@click="
router.post(
route('clientCase.contract.archive', {
client_case: client_case.uuid,
uuid: c.uuid,
}),
{ reactivate: true },
{
preserveScroll: true,
only: ['contracts', 'activities', 'documents'],
}
)
"
>
<FontAwesomeIcon :icon="faBoxArchive" class="h-4 w-4 text-gray-600" />
<span>Ponovno aktiviraj</span>
</button>
<div class="my-1 border-t border-gray-100" />
<!-- Destruktivno -->
<button
type="button"
class="w-full px-3 py-2 text-left text-sm text-red-700 hover:bg-red-50 flex items-center gap-2"
@click="onDelete(c)"
>
<FontAwesomeIcon :icon="faTrash" class="h-4 w-4 text-red-600" />
<span>Izbriši</span>
</button>
<button
v-if="c.active"
type="button"
class="w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-2"
@click="
router.post(
route('clientCase.contract.archive', {
client_case: client_case.uuid,
uuid: c.uuid,
}),
{},
{
preserveScroll: true,
only: ['contracts', 'activities', 'documents'],
}
)
"
>
<FontAwesomeIcon
:icon="faBoxArchive"
class="h-4 w-4 text-gray-600"
/>
<span>Arhiviraj</span>
</button>
<button
v-else
type="button"
class="w-full px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-50 flex items-center gap-2"
@click="
router.post(
route('clientCase.contract.archive', {
client_case: client_case.uuid,
uuid: c.uuid,
}),
{ reactivate: true },
{
preserveScroll: true,
only: ['contracts', 'activities', 'documents'],
}
)
"
>
<FontAwesomeIcon
:icon="faBoxArchive"
class="h-4 w-4 text-gray-600"
/>
<span>Ponovno aktiviraj</span>
</button>
</template>
<template v-if="edit">
<div class="my-1 border-t border-gray-100" />
<!-- Destruktivno -->
<button
type="button"
class="w-full px-3 py-2 text-left text-sm text-red-700 hover:bg-red-50 flex items-center gap-2"
@click="onDelete(c)"
>
<FontAwesomeIcon :icon="faTrash" class="h-4 w-4 text-red-600" />
<span>Izbriši</span>
</button>
</template>
</template>
</Dropdown>
</FwbTableCell>
@@ -947,6 +965,7 @@ const closePaymentsDialog = () => {
@close="closeObjectsList"
:client_case="client_case"
:contract="selectedContract"
:edit="edit"
/>
<PaymentDialog
@@ -960,6 +979,7 @@ const closePaymentsDialog = () => {
:show="showPaymentsDialog"
:contract="selectedContract"
@close="closePaymentsDialog"
:edit="edit"
/>
<!-- Generate document dialog -->