email support

This commit is contained in:
Simon Pocrnjič
2025-10-11 17:20:05 +02:00
parent 7c7defb6c5
commit 1b615163be
23 changed files with 3183 additions and 28 deletions
+12
View File
@@ -10,6 +10,7 @@ import {
faBars,
faGears,
faKey,
faEnvelope,
} from "@fortawesome/free-solid-svg-icons";
import Dropdown from "@/Components/Dropdown.vue";
import DropdownLink from "@/Components/DropdownLink.vue";
@@ -96,6 +97,17 @@ const navGroups = computed(() => [
icon: faFileWord,
active: ["admin.document-templates.index"],
},
{
key: "admin.email-templates.index",
label: "Email predloge",
route: "admin.email-templates.index",
icon: faEnvelope,
active: [
"admin.email-templates.index",
"admin.email-templates.create",
"admin.email-templates.edit",
],
},
{
key: "admin.mail-profiles.index",
label: "Mail profili",
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,68 @@
<script setup>
import AdminLayout from "@/Layouts/AdminLayout.vue";
import { Head, Link } from "@inertiajs/vue3";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { faPlus, faPenToSquare, faTrash } from "@fortawesome/free-solid-svg-icons";
const props = defineProps({
templates: { type: Array, default: () => [] },
});
function destroyTemplate(tpl) {
if (!confirm(`Delete template "${tpl.name}"?`)) return;
window.axios
.delete(route("admin.email-templates.destroy", tpl.id))
.then(() => window.location.reload());
}
</script>
<template>
<AdminLayout title="Email predloge">
<Head title="Email predloge" />
<div class="flex items-center justify-between mb-6">
<h1 class="text-xl font-semibold text-gray-800">Email predloge</h1>
<Link
:href="route('admin.email-templates.create')"
class="inline-flex items-center gap-2 px-4 py-2 rounded-md bg-indigo-600 text-white text-sm font-medium hover:bg-indigo-500 shadow"
>
<FontAwesomeIcon :icon="faPlus" class="w-4 h-4" /> Nova predloga
</Link>
</div>
<div class="rounded-lg border bg-white overflow-hidden shadow-sm">
<table class="w-full text-sm">
<thead class="bg-gray-50 text-gray-600 text-xs uppercase tracking-wider">
<tr>
<th class="px-3 py-2 text-left">Ime</th>
<th class="px-3 py-2 text-left">Ključ</th>
<th class="px-3 py-2 text-left">Entities</th>
<th class="px-3 py-2 text-left">Aktivno</th>
<th class="px-3 py-2 text-left">Akcije</th>
</tr>
</thead>
<tbody>
<tr v-for="t in templates" :key="t.id" class="border-t last:border-b hover:bg-gray-50">
<td class="px-3 py-2 font-medium text-gray-800">{{ t.name }}</td>
<td class="px-3 py-2 text-gray-600">{{ t.key }}</td>
<td class="px-3 py-2 text-gray-600">{{ (t.entity_types || []).join(', ') }}</td>
<td class="px-3 py-2">{{ t.active ? 'da' : 'ne' }}</td>
<td class="px-3 py-2 flex items-center gap-2">
<Link
:href="route('admin.email-templates.edit', t.id)"
class="inline-flex items-center gap-1 text-xs px-2 py-1 rounded border text-indigo-600 border-indigo-300 bg-indigo-50 hover:bg-indigo-100"
>
<FontAwesomeIcon :icon="faPenToSquare" class="w-3.5 h-3.5" /> Uredi
</Link>
<button
@click="destroyTemplate(t)"
class="inline-flex items-center gap-1 text-xs px-2 py-1 rounded border text-rose-700 border-rose-300 bg-rose-50 hover:bg-rose-100"
>
<FontAwesomeIcon :icon="faTrash" class="w-3.5 h-3.5" /> Izbriši
</button>
</td>
</tr>
</tbody>
</table>
</div>
</AdminLayout>
</template>
@@ -11,6 +11,7 @@ import {
faArrowsRotate,
faToggleOn,
faToggleOff,
faPaperPlane,
} from "@fortawesome/free-solid-svg-icons";
const props = defineProps({
@@ -64,6 +65,12 @@ function testConnection(p) {
.then(() => window.location.reload());
}
function sendTestEmail(p) {
window.axios
.post(route("admin.mail-profiles.send-test", p.id))
.then(() => window.location.reload());
}
const statusClass = (p) => {
if (p.test_status === "success") return "text-emerald-600";
if (p.test_status === "failed") return "text-rose-600";
@@ -145,6 +152,13 @@ const statusClass = (p) => {
>
<FontAwesomeIcon :icon="faFlask" class="w-3.5 h-3.5" /> Test
</button>
<button
@click="sendTestEmail(p)"
class="inline-flex items-center gap-1 text-xs px-2 py-1 rounded border text-emerald-700 border-emerald-300 bg-emerald-50 hover:bg-emerald-100"
title="Pošlji testni email"
>
<FontAwesomeIcon :icon="faPaperPlane" class="w-3.5 h-3.5" /> Pošlji test
</button>
<button
class="inline-flex items-center gap-1 text-xs px-2 py-1 rounded border text-indigo-600 border-indigo-300 bg-indigo-50 hover:bg-indigo-100"
>