Added "auto_mailer" to mail profile so user can select which profiles are appropriate for auto mails to cliens through activities

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Simon Pocrnjič
2026-05-11 22:12:57 +02:00
parent e3bc5da7e3
commit 32fe2fbc9b
8 changed files with 75 additions and 2 deletions
@@ -99,6 +99,7 @@ const form = useForm({
from_address: "",
from_name: "",
priority: 10,
auto_mailer: false,
});
function openCreate() {
@@ -120,6 +121,7 @@ function openEdit(p) {
form.from_address = p.from_address || "";
form.from_name = p.from_name || "";
form.priority = p.priority ?? 10;
form.auto_mailer = p.auto_mailer ?? false;
editTarget.value = p;
signatureItems.value = signatureFromObject(p.signature);
editOpen.value = true;
@@ -159,6 +161,7 @@ function submitEdit() {
from_address: form.from_address,
from_name: form.from_name || null,
priority: form.priority,
auto_mailer: form.auto_mailer,
signature: signatureToObject(),
};
if (form.password && form.password.trim() !== "") {
@@ -181,6 +184,12 @@ function toggleActive(p) {
.then(() => window.location.reload());
}
function toggleAutoMailer(p) {
window.axios
.post(route("admin.mail-profiles.toggle-auto-mailer", p.id))
.then(() => window.location.reload());
}
function testConnection(p) {
window.axios
.post(route("admin.mail-profiles.test", p.id))
@@ -238,6 +247,7 @@ const statusClass = (p) => {
<TableHead class="text-center">Port</TableHead>
<TableHead class="text-center">Enc</TableHead>
<TableHead class="text-center">Aktivno</TableHead>
<TableHead class="text-center">Auto-mailer</TableHead>
<TableHead class="text-center">Status</TableHead>
<TableHead>Zadnji uspeh</TableHead>
<TableHead>Napaka</TableHead>
@@ -261,6 +271,12 @@ const statusClass = (p) => {
@update:model-value="() => toggleActive(p)"
/>
</TableCell>
<TableCell class="text-center">
<Switch
:default-value="p.auto_mailer"
@update:model-value="() => toggleAutoMailer(p)"
/>
</TableCell>
<TableCell class="text-center">
<Badge
v-if="p.test_status === 'success'"
@@ -382,6 +398,14 @@ const statusClass = (p) => {
<Label for="create-priority">Prioriteta</Label>
<Input id="create-priority" v-model.number="form.priority" type="number" />
</div>
<div class="flex items-center gap-3">
<Switch
id="create-auto-mailer"
:model-value="form.auto_mailer"
@update:model-value="(val) => (form.auto_mailer = val)"
/>
<Label for="create-auto-mailer">Auto-mailer</Label>
</div>
</div>
<div class="space-y-2">
@@ -487,6 +511,14 @@ const statusClass = (p) => {
<Label for="edit-priority">Prioriteta</Label>
<Input id="edit-priority" v-model.number="form.priority" type="number" />
</div>
<div class="flex items-center gap-3">
<Switch
id="edit-auto-mailer"
:model-value="form.auto_mailer"
@update:model-value="(val) => (form.auto_mailer = val)"
/>
<Label for="edit-auto-mailer">Auto-mailer</Label>
</div>
</div>
<div class="space-y-2">