Compare commits
7 Commits
e5902706f1
...
2968bcf3f8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2968bcf3f8 | ||
|
|
ad0f7a7a01 | ||
|
|
368b0a7cf7 | ||
|
|
aa375ce0da | ||
|
|
340e16c610 | ||
|
|
33b236d881 | ||
| fb7704027b |
|
|
@ -27,7 +27,7 @@ public function index(Client $client, Request $request)
|
||||||
->where('person.full_name', 'ilike', '%'.$search.'%')
|
->where('person.full_name', 'ilike', '%'.$search.'%')
|
||||||
->groupBy('clients.id');
|
->groupBy('clients.id');
|
||||||
})
|
})
|
||||||
->where('clients.active', 1)
|
//->where('clients.active', 1)
|
||||||
// Use LEFT JOINs for aggregated data to avoid subqueries
|
// Use LEFT JOINs for aggregated data to avoid subqueries
|
||||||
->leftJoin('client_cases', 'client_cases.client_id', '=', 'clients.id')
|
->leftJoin('client_cases', 'client_cases.client_id', '=', 'clients.id')
|
||||||
->leftJoin('contracts', function ($join) {
|
->leftJoin('contracts', function ($join) {
|
||||||
|
|
@ -51,7 +51,7 @@ public function index(Client $client, Request $request)
|
||||||
|
|
||||||
return Inertia::render('Client/Index', [
|
return Inertia::render('Client/Index', [
|
||||||
'clients' => $query
|
'clients' => $query
|
||||||
->paginate($request->integer('per_page', 15))
|
->paginate($request->integer('per_page', default: 100))
|
||||||
->withQueryString(),
|
->withQueryString(),
|
||||||
'filters' => $request->only(['search']),
|
'filters' => $request->only(['search']),
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -118,10 +118,10 @@ public function handle(SmsService $sms): void
|
||||||
if ($template && $case) {
|
if ($template && $case) {
|
||||||
$note = '';
|
$note = '';
|
||||||
if ($log->status === 'sent') {
|
if ($log->status === 'sent') {
|
||||||
$note = sprintf('Št: %s | Telo: %s', (string) $this->to, (string) $this->content);
|
$note = sprintf('Tel: %s | Telo: %s', (string) $this->to, (string) $this->content);
|
||||||
} elseif ($log->status === 'failed') {
|
} elseif ($log->status === 'failed') {
|
||||||
$note = sprintf(
|
$note = sprintf(
|
||||||
'Št: %s | Telo: %s | Napaka: %s',
|
'Tel: %s | Telo: %s | Napaka: %s',
|
||||||
(string) $this->to,
|
(string) $this->to,
|
||||||
(string) $this->content,
|
(string) $this->content,
|
||||||
'SMS ni bil poslan!'
|
'SMS ni bil poslan!'
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('person_addresses', function (Blueprint $table) {
|
||||||
|
$table->dropIndex('person_addresses_search_vector_idx');
|
||||||
|
$table->dropColumn('search_vector');
|
||||||
|
|
||||||
|
|
||||||
|
$table->string('post_code', 50)->nullable()->change();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add a generated tsvector column for fulltext search
|
||||||
|
DB::statement("
|
||||||
|
ALTER TABLE person_addresses
|
||||||
|
ADD COLUMN search_vector tsvector
|
||||||
|
GENERATED ALWAYS AS (
|
||||||
|
to_tsvector('simple',
|
||||||
|
coalesce(address, '') || ' ' ||
|
||||||
|
coalesce(post_code, '') || ' ' ||
|
||||||
|
coalesce(city, '')
|
||||||
|
)
|
||||||
|
) STORED
|
||||||
|
");
|
||||||
|
|
||||||
|
// Create GIN index on the tsvector column for fast fulltext search
|
||||||
|
DB::statement('CREATE INDEX person_addresses_search_vector_idx ON person_addresses USING GIN(search_vector)');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('person_addresses', function (Blueprint $table) {
|
||||||
|
$table->string('post_code', 20)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -69,7 +69,7 @@ const maxWidthClass = computed(() => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Dialog v-model:open="open">
|
<Dialog v-model:open="open">
|
||||||
<DialogContent :class="maxWidthClass">
|
<DialogContent class="overflow-auto max-h-3/4" :class="maxWidthClass">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>
|
<DialogTitle>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
|
|
|
||||||
|
|
@ -6,34 +6,40 @@ import {
|
||||||
DialogFooter,
|
DialogFooter,
|
||||||
DialogHeader,
|
DialogHeader,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
} from '@/Components/ui/dialog';
|
} from "@/Components/ui/dialog";
|
||||||
import { Button } from '@/Components/ui/button';
|
import { Button } from "@/Components/ui/button";
|
||||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
||||||
import { faTrashCan, faTriangleExclamation } from '@fortawesome/free-solid-svg-icons';
|
import { faTrashCan, faTriangleExclamation } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from "vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
show: { type: Boolean, default: false },
|
show: { type: Boolean, default: false },
|
||||||
title: { type: String, default: 'Izbriši' },
|
title: { type: String, default: "Izbriši" },
|
||||||
message: { type: String, default: 'Ali ste prepričani, da želite izbrisati ta element?' },
|
message: {
|
||||||
confirmText: { type: String, default: 'Izbriši' },
|
type: String,
|
||||||
cancelText: { type: String, default: 'Prekliči' },
|
default: "Ali ste prepričani, da želite izbrisati ta element?",
|
||||||
|
},
|
||||||
|
confirmText: { type: String, default: "Izbriši" },
|
||||||
|
cancelText: { type: String, default: "Prekliči" },
|
||||||
processing: { type: Boolean, default: false },
|
processing: { type: Boolean, default: false },
|
||||||
itemName: { type: String, default: null }, // Optional name to show in confirmation
|
itemName: { type: String, default: null }, // Optional name to show in confirmation
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['update:show', 'close', 'confirm']);
|
const emit = defineEmits(["update:show", "close", "confirm"]);
|
||||||
|
|
||||||
const open = ref(props.show);
|
const open = ref(props.show);
|
||||||
|
|
||||||
watch(() => props.show, (newVal) => {
|
watch(
|
||||||
|
() => props.show,
|
||||||
|
(newVal) => {
|
||||||
open.value = newVal;
|
open.value = newVal;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
watch(open, (newVal) => {
|
watch(open, (newVal) => {
|
||||||
emit('update:show', newVal);
|
emit("update:show", newVal);
|
||||||
if (!newVal) {
|
if (!newVal) {
|
||||||
emit('close');
|
emit("close");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -42,7 +48,7 @@ const onClose = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onConfirm = () => {
|
const onConfirm = () => {
|
||||||
emit('confirm');
|
emit("confirm");
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -59,8 +65,13 @@ const onConfirm = () => {
|
||||||
<DialogDescription>
|
<DialogDescription>
|
||||||
<div class="flex items-start gap-4 pt-4">
|
<div class="flex items-start gap-4 pt-4">
|
||||||
<div class="flex-shrink-0">
|
<div class="flex-shrink-0">
|
||||||
<div class="flex items-center justify-center h-12 w-12 rounded-full bg-red-100">
|
<div
|
||||||
<FontAwesomeIcon :icon="faTriangleExclamation" class="h-6 w-6 text-red-600" />
|
class="flex items-center justify-center h-12 w-12 rounded-full bg-red-100"
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon
|
||||||
|
:icon="faTriangleExclamation"
|
||||||
|
class="h-6 w-6 text-red-600"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1 space-y-2">
|
<div class="flex-1 space-y-2">
|
||||||
|
|
@ -70,9 +81,7 @@ const onConfirm = () => {
|
||||||
<p v-if="itemName" class="text-sm font-medium text-gray-900">
|
<p v-if="itemName" class="text-sm font-medium text-gray-900">
|
||||||
{{ itemName }}
|
{{ itemName }}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-sm text-gray-500">
|
<p class="text-sm text-gray-500">Ta dejanje ni mogoče razveljaviti.</p>
|
||||||
Ta dejanje ni mogoče razveljaviti.
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
|
|
@ -82,15 +91,10 @@ const onConfirm = () => {
|
||||||
<Button variant="outline" @click="onClose" :disabled="processing">
|
<Button variant="outline" @click="onClose" :disabled="processing">
|
||||||
{{ cancelText }}
|
{{ cancelText }}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button variant="destructive" @click="onConfirm" :disabled="processing">
|
||||||
variant="destructive"
|
|
||||||
@click="onConfirm"
|
|
||||||
:disabled="processing"
|
|
||||||
>
|
|
||||||
{{ confirmText }}
|
{{ confirmText }}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ const maxWidthClass = computed(() => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Dialog v-model:open="open">
|
<Dialog v-model:open="open">
|
||||||
<DialogContent :class="maxWidthClass">
|
<DialogContent class="overflow-auto max-h-3/4" :class="maxWidthClass">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>
|
<DialogTitle>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,27 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import CreateDialog from '@/Components/Dialogs/CreateDialog.vue'
|
import CreateDialog from "@/Components/Dialogs/CreateDialog.vue";
|
||||||
import { useForm } from 'vee-validate'
|
import { useForm } from "vee-validate";
|
||||||
import { toTypedSchema } from '@vee-validate/zod'
|
import { toTypedSchema } from "@vee-validate/zod";
|
||||||
import * as z from 'zod'
|
import * as z from "zod";
|
||||||
import { ref, watch } from 'vue'
|
import { ref, watch } from "vue";
|
||||||
import { router } from '@inertiajs/vue3'
|
import { router } from "@inertiajs/vue3";
|
||||||
import { FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/Components/ui/form'
|
import {
|
||||||
import { Input } from '@/Components/ui/input'
|
FormControl,
|
||||||
import { Textarea } from '@/Components/ui/textarea'
|
FormField,
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/Components/ui/select'
|
FormItem,
|
||||||
import { Switch } from '@/Components/ui/switch'
|
FormLabel,
|
||||||
|
FormMessage,
|
||||||
|
} from "@/Components/ui/form";
|
||||||
|
import { Input } from "@/Components/ui/input";
|
||||||
|
import { Textarea } from "@/Components/ui/textarea";
|
||||||
|
import {
|
||||||
|
Select,
|
||||||
|
SelectContent,
|
||||||
|
SelectItem,
|
||||||
|
SelectTrigger,
|
||||||
|
SelectValue,
|
||||||
|
} from "@/Components/ui/select";
|
||||||
|
import { Switch } from "@/Components/ui/switch";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
show: { type: Boolean, default: false },
|
show: { type: Boolean, default: false },
|
||||||
|
|
@ -17,112 +29,128 @@ const props = defineProps({
|
||||||
// Optional list of contracts to allow attaching the document directly to a contract
|
// Optional list of contracts to allow attaching the document directly to a contract
|
||||||
// Each item should have at least: { uuid, reference }
|
// Each item should have at least: { uuid, reference }
|
||||||
contracts: { type: Array, default: () => [] },
|
contracts: { type: Array, default: () => [] },
|
||||||
})
|
});
|
||||||
const emit = defineEmits(['close', 'uploaded'])
|
const emit = defineEmits(["close", "uploaded"]);
|
||||||
|
|
||||||
const MAX_SIZE = 25 * 1024 * 1024 // 25MB
|
const MAX_SIZE = 25 * 1024 * 1024; // 25MB
|
||||||
const ALLOWED_EXTS = ['doc','docx','pdf','txt','csv','xls','xlsx','jpeg','jpg','png']
|
const ALLOWED_EXTS = [
|
||||||
|
"doc",
|
||||||
|
"docx",
|
||||||
|
"pdf",
|
||||||
|
"txt",
|
||||||
|
"csv",
|
||||||
|
"xls",
|
||||||
|
"xlsx",
|
||||||
|
"jpeg",
|
||||||
|
"jpg",
|
||||||
|
"png",
|
||||||
|
];
|
||||||
|
|
||||||
const formSchema = toTypedSchema(z.object({
|
const formSchema = toTypedSchema(
|
||||||
name: z.string().min(1, 'Ime je obvezno'),
|
z.object({
|
||||||
|
name: z.string().min(1, "Ime je obvezno"),
|
||||||
description: z.string().optional(),
|
description: z.string().optional(),
|
||||||
file: z.instanceof(File).refine((file) => file.size > 0, 'Izberite datoteko'),
|
file: z.instanceof(File).refine((file) => file.size > 0, "Izberite datoteko"),
|
||||||
is_public: z.boolean().default(true),
|
is_public: z.boolean().default(true),
|
||||||
contract_uuid: z.string().nullable().optional(),
|
contract_uuid: z.string().nullable().optional(),
|
||||||
}))
|
})
|
||||||
|
);
|
||||||
|
|
||||||
const form = useForm({
|
const form = useForm({
|
||||||
validationSchema: formSchema,
|
validationSchema: formSchema,
|
||||||
initialValues: {
|
initialValues: {
|
||||||
name: '',
|
name: "",
|
||||||
description: '',
|
description: "",
|
||||||
file: null,
|
file: null,
|
||||||
is_public: true,
|
is_public: true,
|
||||||
contract_uuid: null,
|
contract_uuid: null,
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
const localError = ref('')
|
const localError = ref("");
|
||||||
|
|
||||||
watch(() => props.show, (v) => {
|
watch(
|
||||||
if (!v) return
|
() => props.show,
|
||||||
localError.value = ''
|
(v) => {
|
||||||
form.resetForm()
|
if (!v) return;
|
||||||
})
|
localError.value = "";
|
||||||
|
form.resetForm();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const onFileChange = (e) => {
|
const onFileChange = (e) => {
|
||||||
localError.value = ''
|
localError.value = "";
|
||||||
const f = e.target.files?.[0]
|
const f = e.target.files?.[0];
|
||||||
if (!f) {
|
if (!f) {
|
||||||
form.setFieldValue('file', null)
|
form.setFieldValue("file", null);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
const ext = (f.name.split('.').pop() || '').toLowerCase()
|
const ext = (f.name.split(".").pop() || "").toLowerCase();
|
||||||
if (!ALLOWED_EXTS.includes(ext)) {
|
if (!ALLOWED_EXTS.includes(ext)) {
|
||||||
localError.value = 'Nepodprta vrsta datoteke. Dovoljeno: ' + ALLOWED_EXTS.join(', ')
|
localError.value = "Nepodprta vrsta datoteke. Dovoljeno: " + ALLOWED_EXTS.join(", ");
|
||||||
e.target.value = ''
|
e.target.value = "";
|
||||||
form.setFieldValue('file', null)
|
form.setFieldValue("file", null);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
if (f.size > MAX_SIZE) {
|
if (f.size > MAX_SIZE) {
|
||||||
localError.value = 'Datoteka je prevelika. Največja velikost je 25MB.'
|
localError.value = "Datoteka je prevelika. Največja velikost je 25MB.";
|
||||||
e.target.value = ''
|
e.target.value = "";
|
||||||
form.setFieldValue('file', null)
|
form.setFieldValue("file", null);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
form.setFieldValue('file', f)
|
form.setFieldValue("file", f);
|
||||||
if (!form.values.name) {
|
if (!form.values.name) {
|
||||||
form.setFieldValue('name', f.name.replace(/\.[^.]+$/, ''))
|
form.setFieldValue("name", f.name.replace(/\.[^.]+$/, ""));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const submit = form.handleSubmit(async (values) => {
|
const submit = form.handleSubmit(async (values) => {
|
||||||
localError.value = ''
|
localError.value = "";
|
||||||
if (!values.file) {
|
if (!values.file) {
|
||||||
localError.value = 'Prosimo izberite datoteko.'
|
localError.value = "Prosimo izberite datoteko.";
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
const ext = (values.file.name.split('.').pop() || '').toLowerCase()
|
const ext = (values.file.name.split(".").pop() || "").toLowerCase();
|
||||||
if (!ALLOWED_EXTS.includes(ext)) {
|
if (!ALLOWED_EXTS.includes(ext)) {
|
||||||
localError.value = 'Nepodprta vrsta datoteke. Dovoljeno: ' + ALLOWED_EXTS.join(', ')
|
localError.value = "Nepodprta vrsta datoteke. Dovoljeno: " + ALLOWED_EXTS.join(", ");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
if (values.file.size > MAX_SIZE) {
|
if (values.file.size > MAX_SIZE) {
|
||||||
localError.value = 'Datoteka je prevelika. Največja velikost je 25MB.'
|
localError.value = "Datoteka je prevelika. Največja velikost je 25MB.";
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const formData = new FormData()
|
const formData = new FormData();
|
||||||
formData.append('name', values.name)
|
formData.append("name", values.name);
|
||||||
formData.append('description', values.description || '')
|
formData.append("description", values.description || "");
|
||||||
formData.append('file', values.file)
|
formData.append("file", values.file);
|
||||||
formData.append('is_public', values.is_public ? '1' : '0')
|
formData.append("is_public", values.is_public ? "1" : "0");
|
||||||
if (values.contract_uuid) {
|
if (values.contract_uuid) {
|
||||||
formData.append('contract_uuid', values.contract_uuid)
|
formData.append("contract_uuid", values.contract_uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
router.post(props.postUrl, formData, {
|
router.post(props.postUrl, formData, {
|
||||||
forceFormData: true,
|
forceFormData: true,
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
emit('uploaded')
|
emit("uploaded");
|
||||||
emit('close')
|
emit("close");
|
||||||
form.resetForm()
|
form.resetForm();
|
||||||
},
|
},
|
||||||
onError: (errors) => {
|
onError: (errors) => {
|
||||||
// Set form errors if any
|
// Set form errors if any
|
||||||
if (errors.name) form.setFieldError('name', errors.name)
|
if (errors.name) form.setFieldError("name", errors.name);
|
||||||
if (errors.description) form.setFieldError('description', errors.description)
|
if (errors.description) form.setFieldError("description", errors.description);
|
||||||
if (errors.file) form.setFieldError('file', errors.file)
|
if (errors.file) form.setFieldError("file", errors.file);
|
||||||
if (errors.contract_uuid) form.setFieldError('contract_uuid', errors.contract_uuid)
|
if (errors.contract_uuid) form.setFieldError("contract_uuid", errors.contract_uuid);
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
const close = () => emit('close')
|
const close = () => emit("close");
|
||||||
|
|
||||||
const onConfirm = () => {
|
const onConfirm = () => {
|
||||||
submit()
|
submit();
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -137,7 +165,11 @@ const onConfirm = () => {
|
||||||
@confirm="onConfirm"
|
@confirm="onConfirm"
|
||||||
>
|
>
|
||||||
<form @submit.prevent="submit" class="space-y-4">
|
<form @submit.prevent="submit" class="space-y-4">
|
||||||
<FormField v-if="props.contracts && props.contracts.length" v-slot="{ value, handleChange }" name="contract_uuid">
|
<FormField
|
||||||
|
v-if="props.contracts && props.contracts.length"
|
||||||
|
v-slot="{ value, handleChange }"
|
||||||
|
name="contract_uuid"
|
||||||
|
>
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>Pripiši k</FormLabel>
|
<FormLabel>Pripiši k</FormLabel>
|
||||||
<Select :model-value="value" @update:model-value="handleChange">
|
<Select :model-value="value" @update:model-value="handleChange">
|
||||||
|
|
@ -148,11 +180,7 @@ const onConfirm = () => {
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem :value="null">Primer</SelectItem>
|
<SelectItem :value="null">Primer</SelectItem>
|
||||||
<SelectItem
|
<SelectItem v-for="c in props.contracts" :key="c.uuid" :value="c.uuid">
|
||||||
v-for="c in props.contracts"
|
|
||||||
:key="c.uuid"
|
|
||||||
:value="c.uuid"
|
|
||||||
>
|
|
||||||
Pogodba: {{ c.reference }}
|
Pogodba: {{ c.reference }}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
|
|
@ -165,7 +193,11 @@ const onConfirm = () => {
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>Ime</FormLabel>
|
<FormLabel>Ime</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input id="doc_name" v-bind="componentField" />
|
<Input
|
||||||
|
id="doc_name"
|
||||||
|
v-bind="componentField"
|
||||||
|
class="w-full max-w-full overflow-hidden text-ellipsis"
|
||||||
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
@ -184,29 +216,24 @@ const onConfirm = () => {
|
||||||
<FormField v-slot="{ value, handleChange }" name="file">
|
<FormField v-slot="{ value, handleChange }" name="file">
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>Datoteka (max 25MB)</FormLabel>
|
<FormLabel>Datoteka (max 25MB)</FormLabel>
|
||||||
<FormControl>
|
<FormControl class="flex w-full">
|
||||||
<Input
|
<Input
|
||||||
id="doc_file"
|
id="doc_file"
|
||||||
type="file"
|
type="file"
|
||||||
@change="onFileChange"
|
@change="onFileChange"
|
||||||
accept=".doc,.docx,.pdf,.txt,.csv,.xls,.xlsx,.jpeg,.jpg,.png"
|
accept=".doc,.docx,.pdf,.txt,.csv,.xls,.xlsx,.jpeg,.jpg,.png"
|
||||||
|
class="min-w-0 w-full"
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
<div v-if="localError" class="text-sm text-red-600 mt-1">{{ localError }}</div>
|
<div v-if="localError" class="text-sm text-red-600 mt-1">{{ localError }}</div>
|
||||||
<div v-if="value" class="text-sm text-gray-600 mt-1">
|
|
||||||
Izbrana datoteka: {{ value.name }} ({{ (value.size / 1024).toFixed(2) }} KB)
|
|
||||||
</div>
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
<FormField v-slot="{ value, handleChange }" name="is_public">
|
<FormField v-slot="{ value, handleChange }" name="is_public">
|
||||||
<FormItem class="flex flex-row items-start space-x-3 space-y-0">
|
<FormItem class="flex flex-row items-start space-x-3 space-y-0">
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Switch
|
<Switch :model-value="value" @update:model-value="handleChange" />
|
||||||
:model-value="value"
|
|
||||||
@update:model-value="handleChange"
|
|
||||||
/>
|
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<div class="space-y-1 leading-none">
|
<div class="space-y-1 leading-none">
|
||||||
<FormLabel>Javno</FormLabel>
|
<FormLabel>Javno</FormLabel>
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,219 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { ref, computed, watch } from "vue";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
|
DialogDescription,
|
||||||
DialogHeader,
|
DialogHeader,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
} from '@/Components/ui/dialog'
|
} from "@/Components/ui/dialog";
|
||||||
import { Button } from '@/Components/ui/button'
|
import { Button } from "@/Components/ui/button";
|
||||||
|
import { Badge } from "../ui/badge";
|
||||||
|
import { Loader2 } from "lucide-vue-next";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
show: { type: Boolean, default: false },
|
show: { type: Boolean, default: false },
|
||||||
src: { type: String, default: '' },
|
src: { type: String, default: "" },
|
||||||
title: { type: String, default: 'Dokument' }
|
title: { type: String, default: "Dokument" },
|
||||||
})
|
mimeType: { type: String, default: "" },
|
||||||
const emit = defineEmits(['close'])
|
filename: { type: String, default: "" },
|
||||||
|
});
|
||||||
|
const emit = defineEmits(["close"]);
|
||||||
|
|
||||||
|
const textContent = ref("");
|
||||||
|
const loading = ref(false);
|
||||||
|
const previewGenerating = ref(false);
|
||||||
|
const previewError = ref("");
|
||||||
|
|
||||||
|
const fileExtension = computed(() => {
|
||||||
|
if (props.filename) {
|
||||||
|
return props.filename.split(".").pop()?.toLowerCase() || "";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
});
|
||||||
|
|
||||||
|
const viewerType = computed(() => {
|
||||||
|
const ext = fileExtension.value;
|
||||||
|
const mime = props.mimeType.toLowerCase();
|
||||||
|
|
||||||
|
if (ext === "pdf" || mime === "application/pdf") return "pdf";
|
||||||
|
// DOCX/DOC files are converted to PDF by backend - treat as PDF viewer
|
||||||
|
if (["doc", "docx"].includes(ext) || mime.includes("word") || mime.includes("msword"))
|
||||||
|
return "docx";
|
||||||
|
if (["jpg", "jpeg", "png", "gif", "webp"].includes(ext) || mime.startsWith("image/"))
|
||||||
|
return "image";
|
||||||
|
if (["txt", "csv", "xml"].includes(ext) || mime.startsWith("text/")) return "text";
|
||||||
|
|
||||||
|
return "unsupported";
|
||||||
|
});
|
||||||
|
|
||||||
|
const loadTextContent = async () => {
|
||||||
|
if (!props.src || viewerType.value !== "text") return;
|
||||||
|
loading.value = true;
|
||||||
|
try {
|
||||||
|
const response = await axios.get(props.src);
|
||||||
|
textContent.value = response.data;
|
||||||
|
} catch (e) {
|
||||||
|
textContent.value = "Napaka pri nalaganju vsebine.";
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// For DOCX files, the backend converts to PDF. If the preview isn't ready yet (202 status),
|
||||||
|
// we poll until it's available.
|
||||||
|
const docxPreviewUrl = ref("");
|
||||||
|
const loadDocxPreview = async () => {
|
||||||
|
if (!props.src || viewerType.value !== "docx") return;
|
||||||
|
|
||||||
|
previewGenerating.value = true;
|
||||||
|
previewError.value = "";
|
||||||
|
docxPreviewUrl.value = "";
|
||||||
|
|
||||||
|
const maxRetries = 15;
|
||||||
|
const retryDelay = 2000; // 2 seconds between retries
|
||||||
|
|
||||||
|
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
||||||
|
try {
|
||||||
|
const response = await axios.head(props.src, { validateStatus: () => true });
|
||||||
|
|
||||||
|
if (response.status >= 200 && response.status < 300) {
|
||||||
|
// Preview is ready
|
||||||
|
docxPreviewUrl.value = props.src;
|
||||||
|
previewGenerating.value = false;
|
||||||
|
return;
|
||||||
|
} else if (response.status === 202) {
|
||||||
|
// Preview is being generated, wait and retry
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
||||||
|
} else {
|
||||||
|
// Other error
|
||||||
|
previewError.value = "Napaka pri nalaganju predogleda.";
|
||||||
|
previewGenerating.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
previewError.value = "Napaka pri nalaganju predogleda.";
|
||||||
|
previewGenerating.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Max retries reached
|
||||||
|
previewError.value = "Predogled ni na voljo. Prosimo poskusite znova kasneje.";
|
||||||
|
previewGenerating.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => [props.show, props.src],
|
||||||
|
([show]) => {
|
||||||
|
if (show && viewerType.value === "text") {
|
||||||
|
loadTextContent();
|
||||||
|
}
|
||||||
|
if (show && viewerType.value === "docx") {
|
||||||
|
loadDocxPreview();
|
||||||
|
}
|
||||||
|
// Reset states when dialog closes
|
||||||
|
if (!show) {
|
||||||
|
previewGenerating.value = false;
|
||||||
|
previewError.value = "";
|
||||||
|
docxPreviewUrl.value = "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Dialog :open="show" @update:open="(open) => !open && $emit('close')">
|
<Dialog :open="show" @update:open="(open) => !open && $emit('close')">
|
||||||
<DialogContent class="max-w-4xl">
|
<DialogContent class="max-w-full xl:max-w-7xl">
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>{{ props.title }}</DialogTitle>
|
<DialogTitle>
|
||||||
|
{{ title }}
|
||||||
|
</DialogTitle>
|
||||||
|
<DialogDescription>
|
||||||
|
<Badge>
|
||||||
|
{{ fileExtension }}
|
||||||
|
</Badge>
|
||||||
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<div class="h-[70vh]">
|
|
||||||
<iframe v-if="props.src" :src="props.src" class="w-full h-full rounded border" />
|
<div class="h-[70vh] overflow-auto">
|
||||||
|
<!-- PDF Viewer (browser native) -->
|
||||||
|
<template v-if="viewerType === 'pdf' && props.src">
|
||||||
|
<iframe
|
||||||
|
:src="props.src"
|
||||||
|
class="w-full h-full rounded border"
|
||||||
|
type="application/pdf"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- DOCX Viewer (converted to PDF by backend) -->
|
||||||
|
<template v-else-if="viewerType === 'docx'">
|
||||||
|
<!-- Loading/generating state -->
|
||||||
|
<div
|
||||||
|
v-if="previewGenerating"
|
||||||
|
class="flex flex-col items-center justify-center h-full gap-4"
|
||||||
|
>
|
||||||
|
<Loader2 class="h-8 w-8 animate-spin text-indigo-600" />
|
||||||
|
<span class="text-gray-500">Priprava predogleda dokumenta...</span>
|
||||||
|
</div>
|
||||||
|
<!-- Error state -->
|
||||||
|
<div
|
||||||
|
v-else-if="previewError"
|
||||||
|
class="flex flex-col items-center justify-center h-full gap-4 text-gray-500"
|
||||||
|
>
|
||||||
|
<span>{{ previewError }}</span>
|
||||||
|
<Button as="a" :href="props.src" target="_blank" variant="outline">
|
||||||
|
Prenesi datoteko
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<!-- Preview ready -->
|
||||||
|
<iframe
|
||||||
|
v-else-if="docxPreviewUrl"
|
||||||
|
:src="docxPreviewUrl"
|
||||||
|
class="w-full h-full rounded border"
|
||||||
|
type="application/pdf"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- Image Viewer -->
|
||||||
|
<template v-else-if="viewerType === 'image' && props.src">
|
||||||
|
<img
|
||||||
|
:src="props.src"
|
||||||
|
:alt="props.title"
|
||||||
|
class="max-w-full max-h-full mx-auto object-contain"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- Text/CSV/XML Viewer -->
|
||||||
|
<template v-else-if="viewerType === 'text'">
|
||||||
|
<div v-if="loading" class="flex items-center justify-center h-full">
|
||||||
|
<div class="animate-pulse text-gray-500">Nalaganje...</div>
|
||||||
|
</div>
|
||||||
|
<pre
|
||||||
|
v-else
|
||||||
|
class="p-4 bg-gray-50 dark:bg-gray-900 rounded border text-sm overflow-auto h-full whitespace-pre-wrap wrap-break-word"
|
||||||
|
>{{ textContent }}</pre
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- Unsupported -->
|
||||||
|
<template v-else-if="viewerType === 'unsupported'">
|
||||||
|
<div
|
||||||
|
class="flex flex-col items-center justify-center h-full gap-4 text-gray-500"
|
||||||
|
>
|
||||||
|
<span>Predogled ni na voljo za to vrsto datoteke.</span>
|
||||||
|
<Button as="a" :href="props.src" target="_blank" variant="outline">
|
||||||
|
Prenesi datoteko
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- No source -->
|
||||||
<div v-else class="text-sm text-gray-500">Ni dokumenta za prikaz.</div>
|
<div v-else class="text-sm text-gray-500">Ni dokumenta za prikaz.</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex justify-end mt-4">
|
<div class="flex justify-end mt-4">
|
||||||
<Button type="button" variant="outline" @click="$emit('close')">Zapri</Button>
|
<Button type="button" variant="outline" @click="$emit('close')">Zapri</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,7 @@ const switchToTab = (tab) => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Tabs v-model="activeTab" class="mt-2">
|
<Tabs v-model="activeTab" class="mt-2">
|
||||||
<TabsList class="flex w-full bg-white gap-2 p-1">
|
<TabsList class="flex flex-row flex-wrap bg-white gap-2 p-1">
|
||||||
<TabsTrigger
|
<TabsTrigger
|
||||||
value="person"
|
value="person"
|
||||||
class="border border-gray-200 data-[state=active]:bg-primary-50 data-[state=active]:text-primary-700 flex-1 py-2"
|
class="border border-gray-200 data-[state=active]:bg-primary-50 data-[state=active]:text-primary-700 flex-1 py-2"
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,13 @@ import {
|
||||||
} from "@/Components/ui/dropdown-menu";
|
} from "@/Components/ui/dropdown-menu";
|
||||||
import { Card } from "@/Components/ui/card";
|
import { Card } from "@/Components/ui/card";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../ui/button";
|
||||||
import { EllipsisVertical, MessageSquare, MessageSquareText } from "lucide-vue-next";
|
import {
|
||||||
|
CircleCheckBigIcon,
|
||||||
|
CircleCheckIcon,
|
||||||
|
EllipsisVertical,
|
||||||
|
MessageSquare,
|
||||||
|
MessageSquareText,
|
||||||
|
} from "lucide-vue-next";
|
||||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../ui/tooltip";
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../ui/tooltip";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
|
@ -79,8 +85,9 @@ const handleSms = (phone) => emit("sms", phone);
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="font-medium leading-relaxed p-1">
|
<p class="font-medium leading-relaxed p-1 flex gap-1 items-center">
|
||||||
{{ phone.nu }}
|
{{ phone.nu }}
|
||||||
|
<CircleCheckBigIcon color="#3e9392" size="20" v-if="phone.validated" />
|
||||||
</p>
|
</p>
|
||||||
<p class="text-sm text-muted-foreground p-1" v-if="phone.description">
|
<p class="text-sm text-muted-foreground p-1" v-if="phone.description">
|
||||||
{{ phone.description }}
|
{{ phone.description }}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch, computed } from "vue";
|
import { ref, watch, computed } from "vue";
|
||||||
|
import axios from "axios";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
|
|
@ -301,28 +302,14 @@ const updateSmsFromSelection = async () => {
|
||||||
const url = route("clientCase.sms.preview", {
|
const url = route("clientCase.sms.preview", {
|
||||||
client_case: props.clientCaseUuid,
|
client_case: props.clientCaseUuid,
|
||||||
});
|
});
|
||||||
const res = await fetch(url, {
|
const { data } = await axios.post(url, {
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"X-Requested-With": "XMLHttpRequest",
|
|
||||||
"X-CSRF-TOKEN":
|
|
||||||
document.querySelector('meta[name="csrf-token"]')?.getAttribute("content") ||
|
|
||||||
"",
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
template_id: form.values.template_id,
|
template_id: form.values.template_id,
|
||||||
contract_uuid: form.values.contract_uuid || null,
|
contract_uuid: form.values.contract_uuid || null,
|
||||||
}),
|
|
||||||
credentials: "same-origin",
|
|
||||||
});
|
});
|
||||||
if (res.ok) {
|
|
||||||
const data = await res.json();
|
|
||||||
if (typeof data?.content === "string" && data.content.trim() !== "") {
|
if (typeof data?.content === "string" && data.content.trim() !== "") {
|
||||||
form.setFieldValue("message", data.content);
|
form.setFieldValue("message", data.content);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// ignore and fallback
|
// ignore and fallback
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,8 @@ const store = async () => {
|
||||||
return `${y}-${m}-${day}`;
|
return `${y}-${m}-${day}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const contractUuids = Array.isArray(form.contract_uuids) && form.contract_uuids.length > 0
|
const contractUuids =
|
||||||
|
Array.isArray(form.contract_uuids) && form.contract_uuids.length > 0
|
||||||
? form.contract_uuids
|
? form.contract_uuids
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
|
@ -175,9 +176,9 @@ const autoMailRequiresContract = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const contractItems = computed(() => {
|
const contractItems = computed(() => {
|
||||||
return pageContracts.value.map(c => ({
|
return pageContracts.value.map((c) => ({
|
||||||
value: c.uuid,
|
value: c.uuid,
|
||||||
label: `${c.reference}${c.name ? ` - ${c.name}` : ''}`
|
label: `${c.reference}${c.name ? ` - ${c.name}` : ""}`,
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -188,7 +189,10 @@ const autoMailDisabled = computed(() => {
|
||||||
if (form.contract_uuids && form.contract_uuids.length > 1) return true;
|
if (form.contract_uuids && form.contract_uuids.length > 1) return true;
|
||||||
|
|
||||||
// Disable if template requires contract but none selected
|
// Disable if template requires contract but none selected
|
||||||
if (autoMailRequiresContract.value && (!form.contract_uuids || form.contract_uuids.length === 0)) {
|
if (
|
||||||
|
autoMailRequiresContract.value &&
|
||||||
|
(!form.contract_uuids || form.contract_uuids.length === 0)
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,7 +206,10 @@ const autoMailDisabledHint = computed(() => {
|
||||||
return "Avtomatska e-pošta ni na voljo pri več pogodbah.";
|
return "Avtomatska e-pošta ni na voljo pri več pogodbah.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autoMailRequiresContract.value && (!form.contract_uuids || form.contract_uuids.length === 0)) {
|
if (
|
||||||
|
autoMailRequiresContract.value &&
|
||||||
|
(!form.contract_uuids || form.contract_uuids.length === 0)
|
||||||
|
) {
|
||||||
return "Ta e-poštna predloga zahteva pogodbo. Najprej izberite pogodbo.";
|
return "Ta e-poštna predloga zahteva pogodbo. Najprej izberite pogodbo.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -373,8 +380,12 @@ watch(
|
||||||
:clearable="true"
|
:clearable="true"
|
||||||
:show-selected-chips="true"
|
:show-selected-chips="true"
|
||||||
/>
|
/>
|
||||||
<p v-if="form.contract_uuids && form.contract_uuids.length > 1" class="text-xs text-muted-foreground">
|
<p
|
||||||
Bo ustvarjenih {{ form.contract_uuids.length }} aktivnosti (ena za vsako pogodbo).
|
v-if="form.contract_uuids && form.contract_uuids.length > 1"
|
||||||
|
class="text-xs text-muted-foreground"
|
||||||
|
>
|
||||||
|
Bo ustvarjenih {{ form.contract_uuids.length }} aktivnosti (ena za vsako
|
||||||
|
pogodbo).
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -383,7 +394,7 @@ watch(
|
||||||
<Textarea
|
<Textarea
|
||||||
id="activityNote"
|
id="activityNote"
|
||||||
v-model="form.note"
|
v-model="form.note"
|
||||||
class="block w-full"
|
class="block w-full max-h-72"
|
||||||
placeholder="Opomba"
|
placeholder="Opomba"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -412,10 +423,7 @@ watch(
|
||||||
<div v-if="showSendAutoMail()" class="space-y-2">
|
<div v-if="showSendAutoMail()" class="space-y-2">
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<div class="flex items-center space-x-2">
|
<div class="flex items-center space-x-2">
|
||||||
<Switch
|
<Switch v-model="form.send_auto_mail" :disabled="autoMailDisabled" />
|
||||||
v-model="form.send_auto_mail"
|
|
||||||
:disabled="autoMailDisabled"
|
|
||||||
/>
|
|
||||||
<Label class="cursor-pointer">Send auto email</Label>
|
<Label class="cursor-pointer">Send auto email</Label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -423,7 +431,14 @@ watch(
|
||||||
{{ autoMailDisabledHint }}
|
{{ autoMailDisabledHint }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div v-if="templateAllowsAttachments && form.contract_uuids && form.contract_uuids.length === 1" class="mt-3">
|
<div
|
||||||
|
v-if="
|
||||||
|
templateAllowsAttachments &&
|
||||||
|
form.contract_uuids &&
|
||||||
|
form.contract_uuids.length === 1
|
||||||
|
"
|
||||||
|
class="mt-3"
|
||||||
|
>
|
||||||
<label class="inline-flex items-center gap-2">
|
<label class="inline-flex items-center gap-2">
|
||||||
<Switch v-model="form.attach_documents" />
|
<Switch v-model="form.attach_documents" />
|
||||||
<span class="text-sm">Dodaj priponke iz izbrane pogodbe</span>
|
<span class="text-sm">Dodaj priponke iz izbrane pogodbe</span>
|
||||||
|
|
@ -445,21 +460,28 @@ watch(
|
||||||
<div
|
<div
|
||||||
v-for="doc in availableContractDocs"
|
v-for="doc in availableContractDocs"
|
||||||
:key="doc.uuid || doc.id"
|
:key="doc.uuid || doc.id"
|
||||||
class="flex items-center gap-2 text-sm"
|
class="flex items-center max-w-sm gap-2 text-sm"
|
||||||
>
|
>
|
||||||
<Switch
|
<Switch
|
||||||
:model-value="form.attachment_document_ids.includes(doc.id)"
|
:model-value="form.attachment_document_ids.includes(doc.id)"
|
||||||
@update:model-value="(checked) => {
|
@update:model-value="
|
||||||
|
(checked) => {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
if (!form.attachment_document_ids.includes(doc.id)) {
|
if (!form.attachment_document_ids.includes(doc.id)) {
|
||||||
form.attachment_document_ids.push(doc.id);
|
form.attachment_document_ids.push(doc.id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
form.attachment_document_ids = form.attachment_document_ids.filter(id => id !== doc.id);
|
form.attachment_document_ids = form.attachment_document_ids.filter(
|
||||||
|
(id) => id !== doc.id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}"
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
<span>{{ doc.original_name || doc.name }}</span>
|
<div class="wrap-anywhere">
|
||||||
|
<p>
|
||||||
|
{{ doc.original_name || doc.name }}
|
||||||
|
</p>
|
||||||
<span class="text-xs text-gray-400"
|
<span class="text-xs text-gray-400"
|
||||||
>({{ doc.extension?.toUpperCase() || "" }},
|
>({{ doc.extension?.toUpperCase() || "" }},
|
||||||
{{ (doc.size / 1024 / 1024).toFixed(2) }} MB)</span
|
{{ (doc.size / 1024 / 1024).toFixed(2) }} MB)</span
|
||||||
|
|
@ -467,6 +489,7 @@ watch(
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div
|
<div
|
||||||
v-if="availableContractDocs.length === 0"
|
v-if="availableContractDocs.length === 0"
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ const onDocSaved = () => {
|
||||||
router.reload({ only: ["documents"] });
|
router.reload({ only: ["documents"] });
|
||||||
};
|
};
|
||||||
|
|
||||||
const viewer = ref({ open: false, src: "", title: "" });
|
const viewer = ref({ open: false, src: "", title: "", mimeType: "", filename: "" });
|
||||||
const openViewer = (doc) => {
|
const openViewer = (doc) => {
|
||||||
const kind = classifyDocument(doc);
|
const kind = classifyDocument(doc);
|
||||||
const isContractDoc = (doc?.documentable_type || "").toLowerCase().includes("contract");
|
const isContractDoc = (doc?.documentable_type || "").toLowerCase().includes("contract");
|
||||||
|
|
@ -122,7 +122,13 @@ const openViewer = (doc) => {
|
||||||
client_case: props.client_case.uuid,
|
client_case: props.client_case.uuid,
|
||||||
document: doc.uuid,
|
document: doc.uuid,
|
||||||
});
|
});
|
||||||
viewer.value = { open: true, src: url, title: doc.original_name || doc.name };
|
viewer.value = {
|
||||||
|
open: true,
|
||||||
|
src: url,
|
||||||
|
title: doc.name || doc.original_name,
|
||||||
|
mimeType: doc.mime_type || "",
|
||||||
|
filename: doc.original_name || doc.name || "",
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
const url =
|
const url =
|
||||||
isContractDoc && doc.contract_uuid
|
isContractDoc && doc.contract_uuid
|
||||||
|
|
@ -140,6 +146,8 @@ const openViewer = (doc) => {
|
||||||
const closeViewer = () => {
|
const closeViewer = () => {
|
||||||
viewer.value.open = false;
|
viewer.value.open = false;
|
||||||
viewer.value.src = "";
|
viewer.value.src = "";
|
||||||
|
viewer.value.mimeType = "";
|
||||||
|
viewer.value.filename = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
const clientDetails = ref(false);
|
const clientDetails = ref(false);
|
||||||
|
|
@ -482,6 +490,8 @@ const submitAttachSegment = () => {
|
||||||
:show="viewer.open"
|
:show="viewer.open"
|
||||||
:src="viewer.src"
|
:src="viewer.src"
|
||||||
:title="viewer.title"
|
:title="viewer.title"
|
||||||
|
:mime-type="viewer.mimeType"
|
||||||
|
:filename="viewer.filename"
|
||||||
@close="closeViewer"
|
@close="closeViewer"
|
||||||
/>
|
/>
|
||||||
</AppLayout>
|
</AppLayout>
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,8 @@ import CreateDialog from "@/Components/Dialogs/CreateDialog.vue";
|
||||||
import DataTable from "@/Components/DataTable/DataTableNew2.vue";
|
import DataTable from "@/Components/DataTable/DataTableNew2.vue";
|
||||||
import { hasPermission } from "@/Services/permissions";
|
import { hasPermission } from "@/Services/permissions";
|
||||||
import { Button } from "@/Components/ui/button";
|
import { Button } from "@/Components/ui/button";
|
||||||
import { Card, CardHeader, CardTitle, CardContent } from "@/Components/ui/card";
|
import { CardTitle } from "@/Components/ui/card";
|
||||||
import { Input } from "@/Components/ui/input";
|
import { Input } from "@/Components/ui/input";
|
||||||
import ActionMenuItem from "@/Components/DataTable/ActionMenuItem.vue";
|
|
||||||
import { faPlus } from "@fortawesome/free-solid-svg-icons";
|
|
||||||
import {
|
import {
|
||||||
Select,
|
Select,
|
||||||
SelectContent,
|
SelectContent,
|
||||||
|
|
@ -27,8 +25,7 @@ import {
|
||||||
import { useForm } from "vee-validate";
|
import { useForm } from "vee-validate";
|
||||||
import { toTypedSchema } from "@vee-validate/zod";
|
import { toTypedSchema } from "@vee-validate/zod";
|
||||||
import * as z from "zod";
|
import * as z from "zod";
|
||||||
import ActionMessage from "@/Components/ActionMessage.vue";
|
import { Plus, UsersRoundIcon } from "lucide-vue-next";
|
||||||
import { Mail, Plug2Icon, Plus, UsersRoundIcon } from "lucide-vue-next";
|
|
||||||
import { Separator } from "@/Components/ui/separator";
|
import { Separator } from "@/Components/ui/separator";
|
||||||
import AppCard from "@/Components/app/ui/card/AppCard.vue";
|
import AppCard from "@/Components/app/ui/card/AppCard.vue";
|
||||||
|
|
||||||
|
|
@ -162,7 +159,7 @@ const fmtCurrency = (v) => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AppLayout>
|
<AppLayout title="Clients">
|
||||||
<template #header> </template>
|
<template #header> </template>
|
||||||
<div class="py-6">
|
<div class="py-6">
|
||||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||||
|
|
@ -201,6 +198,7 @@ const fmtCurrency = (v) => {
|
||||||
:show-pagination="false"
|
:show-pagination="false"
|
||||||
:show-toolbar="true"
|
:show-toolbar="true"
|
||||||
:hoverable="true"
|
:hoverable="true"
|
||||||
|
:page-size="100"
|
||||||
row-key="uuid"
|
row-key="uuid"
|
||||||
:striped="true"
|
:striped="true"
|
||||||
empty-text="Ni najdenih naročnikov."
|
empty-text="Ni najdenih naročnikov."
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ const props = defineProps({
|
||||||
completed_mode: { type: Boolean, default: false },
|
completed_mode: { type: Boolean, default: false },
|
||||||
});
|
});
|
||||||
|
|
||||||
const viewer = reactive({ open: false, src: "", title: "" });
|
const viewer = reactive({ open: false, src: "", title: "", mimeType: "", filename: "" });
|
||||||
function openViewer(doc) {
|
function openViewer(doc) {
|
||||||
const kind = classifyDocument(doc);
|
const kind = classifyDocument(doc);
|
||||||
const isContractDoc = (doc?.documentable_type || "").toLowerCase().includes("contract");
|
const isContractDoc = (doc?.documentable_type || "").toLowerCase().includes("contract");
|
||||||
|
|
@ -85,6 +85,8 @@ function openViewer(doc) {
|
||||||
viewer.open = true;
|
viewer.open = true;
|
||||||
viewer.src = url;
|
viewer.src = url;
|
||||||
viewer.title = doc.original_name || doc.name;
|
viewer.title = doc.original_name || doc.name;
|
||||||
|
viewer.mimeType = doc.mime_type || "";
|
||||||
|
viewer.filename = doc.original_name || doc.name || "";
|
||||||
} else {
|
} else {
|
||||||
const url =
|
const url =
|
||||||
isContractDoc && doc.contract_uuid
|
isContractDoc && doc.contract_uuid
|
||||||
|
|
@ -102,6 +104,8 @@ function openViewer(doc) {
|
||||||
function closeViewer() {
|
function closeViewer() {
|
||||||
viewer.open = false;
|
viewer.open = false;
|
||||||
viewer.src = "";
|
viewer.src = "";
|
||||||
|
viewer.mimeType = "";
|
||||||
|
viewer.filename = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatAmount(val) {
|
function formatAmount(val) {
|
||||||
|
|
@ -610,6 +614,8 @@ const clientSummary = computed(() => {
|
||||||
:show="viewer.open"
|
:show="viewer.open"
|
||||||
:src="viewer.src"
|
:src="viewer.src"
|
||||||
:title="viewer.title"
|
:title="viewer.title"
|
||||||
|
:mime-type="viewer.mimeType"
|
||||||
|
:filename="viewer.filename"
|
||||||
@close="closeViewer"
|
@close="closeViewer"
|
||||||
/>
|
/>
|
||||||
<ActivityDrawer
|
<ActivityDrawer
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user