2754 lines
161 KiB
HTML
2754 lines
161 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="fi" class="dark">
|
||
<head>
|
||
<meta charset="UTF-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<title>Toiminnanohjaus – Asiakastyöt & Tehtävät (Kanban)</title>
|
||
<script src="https://cdn.tailwindcss.com"></script>
|
||
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script>
|
||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet" />
|
||
<script>
|
||
tailwind.config = {
|
||
darkMode: 'class',
|
||
theme: {
|
||
extend: {
|
||
fontFamily: {
|
||
sans: ['Inter', 'system-ui', 'sans-serif'],
|
||
},
|
||
colors: {
|
||
primary: {
|
||
50: '#eef2ff',
|
||
100: '#e0e7ff',
|
||
200: '#c7d2fe',
|
||
300: '#a5b4fc',
|
||
400: '#818cf8',
|
||
500: '#6366f1',
|
||
600: '#4338ca',
|
||
700: '#3730a3',
|
||
800: '#312e81',
|
||
900: '#252262',
|
||
950: '#181642',
|
||
},
|
||
},
|
||
},
|
||
},
|
||
};
|
||
</script>
|
||
<style>
|
||
[x-cloak] { display: none !important; }
|
||
body { font-family: 'Inter', system-ui, sans-serif; }
|
||
.kanban-scroll::-webkit-scrollbar { height: 10px; width: 8px; }
|
||
.kanban-scroll::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.18); border-radius: 9999px; }
|
||
.kanban-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.28); border-radius: 9999px; }
|
||
.kanban-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.45); }
|
||
.priority-stripe-immediate {
|
||
background: repeating-linear-gradient(-45deg, #dc2626, #dc2626 5px, #ea580c 5px, #ea580c 10px);
|
||
}
|
||
</style>
|
||
</head>
|
||
<body
|
||
x-data="kanbanApp()"
|
||
@click="closeAllPopovers()"
|
||
@keydown.escape.window="closeAllPopovers()"
|
||
class="min-h-screen flex flex-col bg-[#e5e7eb] text-neutral-900 dark:bg-[#5a5e60] dark:text-neutral-100 transition-colors duration-150"
|
||
>
|
||
|
||
<!-- YLÄPALKKI (Indigo bg-primary-950) -->
|
||
<header class="bg-primary-950 text-white shadow-md border-b border-primary-900 shrink-0 z-30">
|
||
<div class="max-w-full mx-auto px-3 sm:px-5 py-2 flex items-center justify-between gap-3">
|
||
<div class="flex items-center gap-4 min-w-0">
|
||
<div class="flex items-center gap-2 font-extrabold tracking-tight text-base shrink-0">
|
||
<span class="w-7 h-7 rounded-lg bg-primary-600 flex items-center justify-center text-white shadow-inner">
|
||
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><rect x="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="3" width="7" height="7" rx="1.5"/><rect x="3" y="14" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/></svg>
|
||
</span>
|
||
<span>Toiminnanohjaus</span>
|
||
</div>
|
||
|
||
<nav aria-label="Päävalikko" class="hidden md:flex items-center gap-1 text-xs font-medium text-indigo-100">
|
||
<a href="#" class="px-2.5 py-1.5 rounded-md bg-primary-800 text-white font-semibold">Työt (Kanban)</a>
|
||
<a href="#" class="px-2.5 py-1.5 rounded-md hover:bg-primary-900 transition">Tehtäväkalenteri</a>
|
||
<a href="#" class="px-2.5 py-1.5 rounded-md hover:bg-primary-900 transition">Tuntikirjaus</a>
|
||
<a href="#" class="px-2.5 py-1.5 rounded-md hover:bg-primary-900 transition">Asiakkaat & Myynti</a>
|
||
<a href="#" class="px-2.5 py-1.5 rounded-md hover:bg-primary-900 transition">Laskutus</a>
|
||
</nav>
|
||
</div>
|
||
|
||
<div class="flex items-center gap-2 shrink-0">
|
||
<!-- Teeman vaihto -->
|
||
<button
|
||
type="button"
|
||
@click="toggleTheme()"
|
||
:aria-pressed="darkMode.toString()"
|
||
class="inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-primary-900 hover:bg-primary-800 text-indigo-100 text-xs font-medium border border-primary-800 transition focus:outline-2 focus:outline-white"
|
||
>
|
||
<svg x-show="darkMode" class="w-3.5 h-3.5 text-amber-300" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32 1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"/></svg>
|
||
<svg x-show="!darkMode" x-cloak class="w-3.5 h-3.5 text-indigo-200" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/></svg>
|
||
<span x-text="darkMode ? 'Vaalea tila' : 'Tumma tila'"></span>
|
||
</button>
|
||
|
||
<!-- Käyttäjäprofiili -->
|
||
<div class="hidden sm:flex items-center gap-2 pl-2 border-l border-primary-800 text-xs">
|
||
<span class="w-7 h-7 rounded-full bg-indigo-500/30 border border-indigo-400/40 flex items-center justify-center font-bold text-white">JM</span>
|
||
<span class="font-medium text-indigo-100">Jussi Mäkelä</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
<!-- TYÖKALUPALKKI -->
|
||
<section aria-label="Taulun suodattimet ja näkymäasetukset" class="bg-white/95 dark:bg-[#222427] border-b border-neutral-300 dark:border-[#36393f] px-3 sm:px-5 py-2 shadow-xs shrink-0 z-20">
|
||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||
<!-- Vasen: Tauluvalitsin + Näkymäputki + Pikasuodattimet -->
|
||
<div class="flex flex-wrap items-center gap-2">
|
||
<!-- Taulun valinta -->
|
||
<div class="flex items-center gap-1.5">
|
||
<label for="boardSelect" class="text-xs font-semibold text-neutral-600 dark:text-neutral-300">Taulu:</label>
|
||
<select
|
||
id="boardSelect"
|
||
x-model="boardFilter"
|
||
aria-label="Valitse taulu"
|
||
class="text-xs font-bold rounded-lg px-2.5 py-1.5 bg-neutral-100 dark:bg-[#18191b] border border-neutral-300 dark:border-[#3e4249] text-neutral-900 dark:text-white focus:outline-2 focus:outline-primary-600"
|
||
>
|
||
<option value="my">Oma taulu (Jussi Mäkelä)</option>
|
||
<option value="person_anna">Henkilö: Anna Korhonen</option>
|
||
<option value="unit_print">Palvelulinja: Painotuotanto</option>
|
||
<option value="unit_media">Palvelulinja: Mediatuotanto</option>
|
||
<option value="all">Kaikki työt (Yritys)</option>
|
||
</select>
|
||
</div>
|
||
|
||
<!-- Näkymäputki -->
|
||
<div class="inline-flex rounded-lg bg-neutral-100 dark:bg-[#18191b] p-0.5 border border-neutral-300 dark:border-[#3e4249]" role="group" aria-label="Näkymäputki">
|
||
<button
|
||
type="button"
|
||
@click="pipelineView = 'production'"
|
||
:class="pipelineView === 'production' ? 'bg-white dark:bg-[#2f3237] text-neutral-900 dark:text-white shadow-2xs font-bold' : 'text-neutral-600 dark:text-neutral-300 font-medium hover:text-neutral-900 dark:hover:text-white'"
|
||
class="px-2.5 py-1 rounded-md text-xs transition"
|
||
>
|
||
Päivittäinen työputki
|
||
</button>
|
||
<button
|
||
type="button"
|
||
@click="pipelineView = 'sales'"
|
||
:class="pipelineView === 'sales' ? 'bg-white dark:bg-[#2f3237] text-neutral-900 dark:text-white shadow-2xs font-bold' : 'text-neutral-600 dark:text-neutral-300 font-medium hover:text-neutral-900 dark:hover:text-white'"
|
||
class="px-2.5 py-1 rounded-md text-xs transition inline-flex items-center gap-1"
|
||
>
|
||
<span>Myynti & Tarjoukset</span>
|
||
<span class="px-1.5 py-0.2 rounded-full text-[10px] bg-indigo-100 text-indigo-900 dark:bg-indigo-950 dark:text-indigo-200 font-bold" x-text="quoteCount()"></span>
|
||
</button>
|
||
<button
|
||
type="button"
|
||
@click="pipelineView = 'full'"
|
||
:class="pipelineView === 'full' ? 'bg-white dark:bg-[#2f3237] text-neutral-900 dark:text-white shadow-2xs font-bold' : 'text-neutral-600 dark:text-neutral-300 font-medium hover:text-neutral-900 dark:hover:text-white'"
|
||
class="px-2.5 py-1 rounded-md text-xs transition"
|
||
>
|
||
Täysi tilaputki
|
||
</button>
|
||
</div>
|
||
|
||
<!-- Pikasuodattimet -->
|
||
<button
|
||
type="button"
|
||
@click="filterUrgent = !filterUrgent"
|
||
:aria-pressed="filterUrgent.toString()"
|
||
:class="filterUrgent ? 'ring-2 ring-red-500 bg-red-50 dark:bg-red-950/60 text-red-900 dark:text-red-200' : 'bg-neutral-50 dark:bg-[#18191b] text-neutral-700 dark:text-neutral-200 hover:bg-neutral-100 dark:hover:bg-[#2c2f34]'"
|
||
class="inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-semibold border border-neutral-300 dark:border-[#3e4249] transition"
|
||
>
|
||
<span class="w-2 h-2 rounded-full bg-red-500"></span>
|
||
<span>Vain kiireelliset</span>
|
||
</button>
|
||
|
||
<button
|
||
type="button"
|
||
@click="filterOverdue = !filterOverdue"
|
||
:aria-pressed="filterOverdue.toString()"
|
||
:class="filterOverdue ? 'ring-2 ring-amber-500 bg-amber-50 dark:bg-amber-950/60 text-amber-900 dark:text-amber-200' : 'bg-neutral-50 dark:bg-[#18191b] text-neutral-700 dark:text-neutral-200 hover:bg-neutral-100 dark:hover:bg-[#2c2f34]'"
|
||
class="inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg text-xs font-semibold border border-neutral-300 dark:border-[#3e4249] transition"
|
||
>
|
||
<svg class="w-3.5 h-3.5 text-amber-500" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
|
||
<span>Myöhässä</span>
|
||
</button>
|
||
|
||
<span role="status" class="text-[11px] font-medium text-neutral-500 dark:text-neutral-400 pl-0.5" x-text="`Näytetään ${filteredCards().length} korttia`"></span>
|
||
</div>
|
||
|
||
<!-- Oikea: Normaali / Tiivis + Pikavastaanotto -->
|
||
<div class="flex flex-wrap items-center gap-2">
|
||
<div class="inline-flex rounded-lg bg-neutral-100 dark:bg-[#18191b] p-0.5 border border-neutral-300 dark:border-[#3e4249]" role="group" aria-label="Korttien tiheys">
|
||
<button
|
||
type="button"
|
||
@click="density = 'normal'"
|
||
:class="density === 'normal' ? 'bg-white dark:bg-[#2f3237] text-neutral-900 dark:text-white shadow-2xs font-bold' : 'text-neutral-600 dark:text-neutral-300 font-medium hover:text-neutral-900 dark:hover:text-white'"
|
||
class="px-2.5 py-1 rounded-md text-xs transition"
|
||
>
|
||
Normaali
|
||
</button>
|
||
<button
|
||
type="button"
|
||
@click="density = 'compact'"
|
||
:class="density === 'compact' ? 'bg-white dark:bg-[#2f3237] text-neutral-900 dark:text-white shadow-2xs font-bold' : 'text-neutral-600 dark:text-neutral-300 font-medium hover:text-neutral-900 dark:hover:text-white'"
|
||
class="px-2.5 py-1 rounded-md text-xs transition"
|
||
>
|
||
Tiivis
|
||
</button>
|
||
</div>
|
||
|
||
<button
|
||
type="button"
|
||
@click="openQuickIntake()"
|
||
class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-bold bg-primary-600 hover:bg-primary-700 text-white shadow-sm transition focus:outline-2 focus:outline-primary-400"
|
||
>
|
||
<svg class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
|
||
<span>Uusi työ / Pikavastaanotto</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- KANBAN-TYÖPÖYTÄ -->
|
||
<main id="main-content" class="flex-1 overflow-x-auto kanban-scroll p-3 sm:p-4">
|
||
<h1 class="sr-only">Asiakastyöt ja tehtävät – Kanban-työtaulu</h1>
|
||
|
||
<div class="flex items-start gap-2.5 min-h-[calc(100vh-132px)] pb-6">
|
||
<template x-for="col in activeColumns()" :key="col.id">
|
||
<section
|
||
:aria-label="col.title"
|
||
:style="columnBodyStyle(col.id)"
|
||
:class="density === 'compact' ? (col.kind === 'ongoing' ? 'w-[250px]' : 'w-[234px]') : (col.kind === 'ongoing' ? 'w-[268px]' : 'w-[252px]')"
|
||
class="shrink-0 rounded-xl border flex flex-col shadow-md transition-colors relative"
|
||
>
|
||
<!-- SARAKKEEN OTSIKKOPALKKI: AINA YKSI RIVI (h-10) -->
|
||
<div
|
||
:style="columnHeaderStyle(col.id)"
|
||
class="h-10 px-2.5 rounded-t-[11px] flex items-center justify-between gap-1.5 border-b relative select-none"
|
||
>
|
||
<!-- Vasen: Ikoni + Otsikko -->
|
||
<div class="flex items-center gap-1.5 min-w-0">
|
||
<span class="shrink-0" x-html="col.iconSvg"></span>
|
||
<h2 class="text-[13px] font-bold tracking-tight truncate" x-text="col.title"></h2>
|
||
</div>
|
||
|
||
<!-- Oikea: Kompakti pudotusvalikko (Kiire) + Listakohtainen järjestys (⇅/📅) + Paletti + Laskuri -->
|
||
<div class="flex items-center gap-0.5 shrink-0">
|
||
<template x-if="col.isUrgentLane">
|
||
<div class="relative" @click.stop>
|
||
<button
|
||
type="button"
|
||
@click="urgentMenuOpen = !urgentMenuOpen; activePicker = null; activeSortMenuCol = null"
|
||
:aria-expanded="urgentMenuOpen.toString()"
|
||
aria-label="Valitse Kiire-listaan nostettavat prioriteetit"
|
||
title="Valitse listaan nostettavat prioriteetit"
|
||
class="w-6 h-6 rounded inline-flex items-center justify-center hover:bg-black/15 dark:hover:bg-white/15 transition"
|
||
>
|
||
<svg class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="6 9 12 15 18 9"/></svg>
|
||
</button>
|
||
|
||
<div
|
||
x-show="urgentMenuOpen"
|
||
x-cloak
|
||
role="menu"
|
||
class="absolute right-0 top-8 z-50 w-52 rounded-xl bg-white dark:bg-[#282a2e] text-neutral-900 dark:text-neutral-100 border border-neutral-300 dark:border-[#3e4249] shadow-2xl p-1.5 space-y-0.5"
|
||
>
|
||
<div class="px-2 py-1 text-[10px] font-bold uppercase tracking-wider text-neutral-500 dark:text-neutral-400">
|
||
Nosta listaan prioriteetit:
|
||
</div>
|
||
<template x-for="opt in thresholdOptions" :key="opt.key">
|
||
<button
|
||
type="button"
|
||
role="menuitemradio"
|
||
:aria-checked="(urgentThreshold === opt.key).toString()"
|
||
@click="setUrgentThreshold(opt.key)"
|
||
class="w-full flex items-center justify-between px-2.5 py-1.5 rounded-lg text-xs font-medium hover:bg-neutral-100 dark:hover:bg-[#34373d] transition text-left"
|
||
>
|
||
<span x-text="opt.label"></span>
|
||
<span x-show="urgentThreshold === opt.key" class="text-primary-600 dark:text-indigo-400 font-bold">✓</span>
|
||
</button>
|
||
</template>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<!-- Listakohtainen järjestysvalitsin (Oma järjestys vs. Eräpäivä) -->
|
||
<div class="relative" @click.stop>
|
||
<button
|
||
type="button"
|
||
@click="toggleSortMenu(col.id)"
|
||
:aria-expanded="(activeSortMenuCol === col.id).toString()"
|
||
:aria-label="`Listan ${col.title} järjestys: ${columnSortMode(col.id) === 'dueDate' ? 'Eräpäivän mukaan' : 'Oma järjestys'}`"
|
||
:title="columnSortMode(col.id) === 'dueDate' ? 'Järjestys: Eräpäivän mukaan' : 'Järjestys: Oma järjestys'"
|
||
:class="columnSortMode(col.id) === 'dueDate' ? 'bg-black/20 dark:bg-white/25 ring-1 ring-current/40' : 'hover:bg-black/15 dark:hover:bg-white/15'"
|
||
class="w-6 h-6 rounded inline-flex items-center justify-center transition"
|
||
>
|
||
<svg x-show="columnSortMode(col.id) !== 'dueDate'" class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/></svg>
|
||
<svg x-show="columnSortMode(col.id) === 'dueDate'" x-cloak class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><rect x="3" y="4" width="18" height="18" rx="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>
|
||
</button>
|
||
|
||
<div
|
||
x-show="activeSortMenuCol === col.id"
|
||
x-cloak
|
||
role="menu"
|
||
class="absolute right-0 top-8 z-50 w-56 rounded-xl bg-white dark:bg-[#282a2e] text-neutral-900 dark:text-neutral-100 border border-neutral-300 dark:border-[#3e4249] shadow-2xl p-1.5 space-y-0.5"
|
||
>
|
||
<div class="px-2 py-1 text-[10px] font-bold uppercase tracking-wider text-neutral-500 dark:text-neutral-400">
|
||
Listan järjestys:
|
||
</div>
|
||
<button
|
||
type="button"
|
||
role="menuitemradio"
|
||
:aria-checked="(columnSortMode(col.id) === 'manual').toString()"
|
||
@click="setColumnSort(col.id, 'manual')"
|
||
class="w-full flex items-center justify-between px-2.5 py-1.5 rounded-lg text-xs font-medium hover:bg-neutral-100 dark:hover:bg-[#34373d] transition text-left"
|
||
>
|
||
<span class="flex items-center gap-1.5">
|
||
<svg class="w-3.5 h-3.5 text-neutral-500" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m7 15 5 5 5-5"/><path d="m7 9 5-5 5 5"/></svg>
|
||
<span>Oma järjestys (Raahattava)</span>
|
||
</span>
|
||
<span x-show="columnSortMode(col.id) === 'manual'" class="text-primary-600 dark:text-indigo-400 font-bold">✓</span>
|
||
</button>
|
||
<button
|
||
type="button"
|
||
role="menuitemradio"
|
||
:aria-checked="(columnSortMode(col.id) === 'dueDate').toString()"
|
||
@click="setColumnSort(col.id, 'dueDate')"
|
||
class="w-full flex items-center justify-between px-2.5 py-1.5 rounded-lg text-xs font-medium hover:bg-neutral-100 dark:hover:bg-[#34373d] transition text-left"
|
||
>
|
||
<span class="flex items-center gap-1.5">
|
||
<svg class="w-3.5 h-3.5 text-amber-500" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="4" width="18" height="18" rx="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>
|
||
<span>Eräpäivän mukaan</span>
|
||
</span>
|
||
<span x-show="columnSortMode(col.id) === 'dueDate'" class="text-primary-600 dark:text-indigo-400 font-bold">✓</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Listan otsikon värivalitsin -->
|
||
<button
|
||
type="button"
|
||
@click.stop="openPicker($event, 'column', col.id)"
|
||
:aria-label="`Vaihda listan ${col.title} otsikkoväri`"
|
||
title="Vaihda listan otsikkoväri (RGB)"
|
||
class="w-6 h-6 rounded inline-flex items-center justify-center hover:bg-black/15 dark:hover:bg-white/15 transition"
|
||
>
|
||
<svg class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"/></svg>
|
||
</button>
|
||
|
||
<!-- Korttimäärä -->
|
||
<span
|
||
:style="columnPillStyle(col.id)"
|
||
class="inline-flex items-center justify-center min-w-5 h-5 px-1.5 rounded-full text-[11px] font-extrabold border ml-0.5"
|
||
x-text="cardsForColumn(col).length"
|
||
></span>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- SARAKKEEN KORTIT -->
|
||
<div
|
||
@dragover.prevent="handleColumnDragOver($event, col)"
|
||
@dragleave="handleDragLeave($event, col)"
|
||
@drop.prevent="handleDrop($event, col)"
|
||
:class="[
|
||
density === 'compact' ? 'p-1.5 gap-1.5' : 'p-2 gap-2',
|
||
dragOverColId === col.id && !dropTargetCardId ? 'ring-2 ring-inset ring-indigo-400 bg-indigo-500/10 rounded-b-xl' : ''
|
||
]"
|
||
class="flex flex-col min-h-[120px] flex-1 transition-all"
|
||
>
|
||
<template x-if="cardsForColumn(col).length === 0">
|
||
<div class="rounded-lg border border-dashed border-neutral-400/40 dark:border-[#363938] p-3 text-center text-[11px] text-neutral-500 dark:text-neutral-400">
|
||
<span x-text="dragOverColId === col.id ? 'Pudota kortti tähän' : 'Ei kortteja'"></span>
|
||
</div>
|
||
</template>
|
||
|
||
<template x-for="card in cardsForColumn(col)" :key="card.id">
|
||
<div
|
||
@dragover.prevent.stop="handleCardDragOver($event, col, card)"
|
||
:class="draggedCardId === card.id ? 'opacity-45 scale-[0.98]' : ''"
|
||
class="relative transition-all"
|
||
>
|
||
<!-- Pudotusviiva yläpuolella -->
|
||
<div
|
||
x-show="dropTargetCardId === card.id && dropPosition === 'before' && draggedCardId !== card.id"
|
||
x-cloak
|
||
class="h-1 -mt-1 mb-1 rounded-full bg-indigo-400 shadow-[0_0_8px_rgba(129,140,248,0.9)] pointer-events-none"
|
||
></div>
|
||
|
||
<!-- ========================================================= -->
|
||
<!-- TYYPPI 3: PUTKEEN NOSTETTU TEHTÄVÄKORTTI (PIN) -->
|
||
<!-- ========================================================= -->
|
||
<template x-if="card.cardType === 'promoted_task'">
|
||
<article class="rounded-xl border-2 border-dashed border-indigo-400 dark:border-indigo-400/80 bg-white dark:bg-[#282a2e] shadow-md overflow-hidden transition">
|
||
<div
|
||
draggable="true"
|
||
@dragstart="handleDragStart($event, card)"
|
||
@dragend="handleDragEnd()"
|
||
@click="openCardModal(card)"
|
||
title="Klikkaa avataksesi tehtäväkortin tai raahaa siirtääksesi"
|
||
class="px-2.5 py-1 bg-indigo-600 text-white flex items-center justify-between gap-1.5 cursor-grab active:cursor-grabbing select-none"
|
||
>
|
||
<div class="flex items-center gap-1 text-[10px] font-extrabold tracking-wide uppercase truncate">
|
||
<svg class="w-3 h-3 opacity-75 shrink-0" viewBox="0 0 24 24" fill="currentColor"><circle cx="9" cy="6" r="1.5"/><circle cx="15" cy="6" r="1.5"/><circle cx="9" cy="12" r="1.5"/><circle cx="15" cy="12" r="1.5"/><circle cx="9" cy="18" r="1.5"/><circle cx="15" cy="18" r="1.5"/></svg>
|
||
<svg class="w-3 h-3 shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><line x1="12" y1="17" x2="12" y2="22"/><path d="M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"/></svg>
|
||
<span class="truncate">TEHTÄVÄ • PIN</span>
|
||
</div>
|
||
<button
|
||
type="button"
|
||
@click.stop="unpinTask(card.id)"
|
||
title="Vapauta tehtävä työputkesta takaisin sopimuskortille"
|
||
class="inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-white/20 hover:bg-white/30 text-[10px] font-bold transition shrink-0 cursor-pointer"
|
||
>
|
||
<span>Vapauta</span>
|
||
</button>
|
||
</div>
|
||
|
||
<div :class="density === 'compact' ? 'p-1.5 space-y-1' : 'p-2.5 space-y-2'">
|
||
<div class="text-[10px] font-semibold text-indigo-700 dark:text-indigo-300 truncate" :title="card.parentJobTitle" x-text="`🔗 ${card.parentJobTitle}`"></div>
|
||
|
||
<h3 class="m-0">
|
||
<button
|
||
type="button"
|
||
@click="openCardModal(card)"
|
||
@mouseenter="showTooltip($event, card.title)"
|
||
@mouseleave="hideTooltip()"
|
||
class="w-full text-left text-[13px] font-bold text-neutral-900 dark:text-white truncate hover:underline focus:outline-2 focus:outline-primary-500 rounded"
|
||
x-text="card.title"
|
||
></button>
|
||
</h3>
|
||
|
||
<div class="flex items-center justify-between gap-1 text-[10px]">
|
||
<span class="inline-flex items-center gap-1 font-semibold text-neutral-700 dark:text-neutral-200 bg-neutral-100 dark:bg-[#1e2023] px-1.5 py-0.5 rounded">
|
||
<span class="w-4 h-4 rounded-full bg-indigo-600 text-white text-[9px] font-bold flex items-center justify-center" x-text="initials(card.assignee)"></span>
|
||
<span x-text="firstName(card.assignee)"></span>
|
||
</span>
|
||
<div class="flex items-center gap-1">
|
||
<span :class="priorityClass(card.priority)" class="px-1.5 py-0.5 rounded border text-[10px] font-bold" x-text="priorityLabel(card.priority)"></span>
|
||
<span x-show="density === 'compact'" class="text-[10px] font-semibold text-neutral-500 dark:text-neutral-400" x-text="card.dueDate"></span>
|
||
</div>
|
||
</div>
|
||
|
||
<template x-if="density === 'normal'">
|
||
<div class="pt-1.5 border-t border-neutral-200 dark:border-[#36393f] flex items-center justify-between gap-1 text-[10px]">
|
||
<span class="text-neutral-500 dark:text-neutral-400 font-medium" x-text="`${card.dueDate} • ${fmtHours(card.loggedHours)}/${fmtHours(card.estimatedHours)} h`"></span>
|
||
<select
|
||
:aria-label="`Siirrä tehtävä ${card.title}`"
|
||
@change="moveCard(card.id, $event.target.value)"
|
||
class="text-[10px] bg-neutral-100 dark:bg-[#1e2023] border border-neutral-300 dark:border-[#3e4249] rounded px-1.5 py-0.5 text-neutral-800 dark:text-neutral-200 max-w-[105px]"
|
||
>
|
||
<template x-for="optCol in allMovableColumns()" :key="optCol.id">
|
||
<option :value="optCol.id" :selected="optCol.id === activeColIdForCard(card)" x-text="optCol.title"></option>
|
||
</template>
|
||
</select>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
</article>
|
||
</template>
|
||
|
||
<!-- ========================================================= -->
|
||
<!-- TYYPPI 2: JATKUVA / LIVE -SOPIMUSKORTTI -->
|
||
<!-- ========================================================= -->
|
||
<template x-if="card.cardType === 'ongoing_live' || card.cardType === 'ongoing_contract'">
|
||
<article class="rounded-xl border border-neutral-300 dark:border-[#36393f] bg-white dark:bg-[#282a2e] shadow-sm overflow-hidden">
|
||
<div
|
||
draggable="true"
|
||
@dragstart="handleDragStart($event, card)"
|
||
@dragend="handleDragEnd()"
|
||
@click="openCardModal(card)"
|
||
:style="cardHeaderStyle(card)"
|
||
title="Klikkaa avataksesi kortin tai raahaa muuttaaksesi järjestystä"
|
||
class="px-2 py-1 flex items-center justify-between gap-1 cursor-grab active:cursor-grabbing select-none"
|
||
>
|
||
<div class="flex items-center gap-1 min-w-0">
|
||
<svg class="w-3 h-3 opacity-70 shrink-0" viewBox="0 0 24 24" fill="currentColor"><circle cx="9" cy="6" r="1.5"/><circle cx="15" cy="6" r="1.5"/><circle cx="9" cy="12" r="1.5"/><circle cx="15" cy="12" r="1.5"/><circle cx="9" cy="18" r="1.5"/><circle cx="15" cy="18" r="1.5"/></svg>
|
||
<span class="text-[11px] font-extrabold tracking-tight truncate" x-text="card.customer"></span>
|
||
</div>
|
||
<div class="flex items-center gap-1 shrink-0">
|
||
<span :style="cardPillStyle(card)" class="text-[10px] font-bold px-1.5 py-0.2 rounded" x-text="card.number"></span>
|
||
<button
|
||
type="button"
|
||
@click.stop="openPicker($event, 'card', card.id)"
|
||
:aria-label="`Vaihda asiakkaan ${card.customer} otsikkoväri`"
|
||
class="p-0.5 rounded hover:bg-black/15 dark:hover:bg-white/15 cursor-pointer"
|
||
>
|
||
<svg class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"/></svg>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div :class="density === 'compact' ? 'p-1.5 space-y-1.5' : 'p-2.5 space-y-2'">
|
||
<h3 class="m-0">
|
||
<button
|
||
type="button"
|
||
@click="openCardModal(card)"
|
||
@mouseenter="showTooltip($event, card.title)"
|
||
@mouseleave="hideTooltip()"
|
||
class="w-full text-left text-[13px] font-bold text-neutral-900 dark:text-white truncate hover:underline focus:outline-2 focus:outline-primary-500 rounded"
|
||
x-text="card.title"
|
||
></button>
|
||
</h3>
|
||
|
||
<!-- TIIVIS NÄKYMÄ: Vastuuhenkilö + Jaksomäärä + Avauspainike samalla rivillä -->
|
||
<template x-if="density === 'compact'">
|
||
<div class="space-y-1.5">
|
||
<div class="flex items-center justify-between gap-1 text-[10px]">
|
||
<div class="flex items-center gap-1 min-w-0">
|
||
<span class="inline-flex items-center gap-1 font-semibold text-neutral-700 dark:text-neutral-200 bg-neutral-100 dark:bg-[#1e2023] px-1.5 py-0.5 rounded shrink-0">
|
||
<span class="w-4 h-4 rounded-full bg-primary-600 text-white text-[9px] font-bold flex items-center justify-center" x-text="initials(card.assignee)"></span>
|
||
<span x-text="firstName(card.assignee)"></span>
|
||
</span>
|
||
<span class="px-1.5 py-0.5 rounded bg-purple-100 text-purple-900 dark:bg-purple-950/90 dark:text-purple-200 font-bold truncate" x-text="`${completedSubCount(card)}/${card.subItems.length} jaksoa`"></span>
|
||
</div>
|
||
<button
|
||
type="button"
|
||
@click="toggleExpand(card.id)"
|
||
:aria-expanded="isExpanded(card.id).toString()"
|
||
class="px-1.5 py-0.5 rounded bg-neutral-100 dark:bg-[#1e2023] hover:bg-neutral-200 dark:hover:bg-[#32353b] text-[10px] font-bold text-neutral-700 dark:text-neutral-200 shrink-0 transition"
|
||
>
|
||
<span x-text="`${completedSubCount(card)}/${card.subItems.length} ${isExpanded(card.id) ? '▴' : '▾'}`"></span>
|
||
</button>
|
||
</div>
|
||
|
||
<div x-show="isExpanded(card.id)" x-cloak class="pt-1 border-t border-neutral-200 dark:border-[#36393f] space-y-1.5">
|
||
<ul class="space-y-1">
|
||
<template x-for="sub in card.subItems" :key="sub.id">
|
||
<li class="p-1.5 rounded-md bg-neutral-50 dark:bg-[#1b1c1f] border border-neutral-200 dark:border-[#32353b] text-[11px] space-y-1">
|
||
<label class="flex items-start gap-1.5 cursor-pointer">
|
||
<input type="checkbox" :checked="sub.done" @change="toggleSubItem(card.id, sub.id)" class="mt-0.5 rounded border-neutral-400 text-emerald-600" />
|
||
<span :class="sub.done ? 'line-through text-neutral-400' : 'text-neutral-800 dark:text-neutral-200 font-medium'" class="leading-tight" x-text="sub.label"></span>
|
||
</label>
|
||
<div class="pl-5 flex items-center justify-between gap-1">
|
||
<button
|
||
type="button"
|
||
@click="togglePinSubItem(card.id, sub.id)"
|
||
:class="sub.pinnedCardId ? 'bg-amber-600/20 text-amber-800 dark:text-amber-300 border-amber-500/40' : 'bg-indigo-600/20 text-indigo-800 dark:text-indigo-300 border-indigo-500/40'"
|
||
class="inline-flex items-center gap-1 px-1.5 py-0.2 rounded text-[10px] font-bold border"
|
||
x-text="sub.pinnedCardId ? '📌 Vapauta' : '📌 Putkeen'"
|
||
></button>
|
||
</div>
|
||
</li>
|
||
</template>
|
||
</ul>
|
||
<div class="flex gap-1">
|
||
<input
|
||
type="text"
|
||
x-model="inlineSubInputs[card.id]"
|
||
@keydown.enter.prevent="addInlineSubItem(card.id)"
|
||
placeholder="+ Uusi jakso..."
|
||
class="flex-1 min-w-0 px-2 py-0.5 text-[11px] rounded border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#16171a]"
|
||
/>
|
||
<button type="button" @click="addInlineSubItem(card.id)" class="px-2 py-0.5 rounded bg-primary-600 text-white text-[11px] font-bold">+</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<!-- NORMAALI NÄKYMÄ -->
|
||
<template x-if="density === 'normal'">
|
||
<div class="space-y-2">
|
||
<div class="flex items-center justify-between gap-1 text-[10px]">
|
||
<span class="inline-flex items-center gap-1 font-semibold text-neutral-700 dark:text-neutral-200 bg-neutral-100 dark:bg-[#1e2023] px-1.5 py-0.5 rounded">
|
||
<span class="w-4 h-4 rounded-full bg-primary-600 text-white text-[9px] font-bold flex items-center justify-center" x-text="initials(card.assignee)"></span>
|
||
<span x-text="firstName(card.assignee)"></span>
|
||
</span>
|
||
<span class="px-1.5 py-0.5 rounded bg-purple-100 text-purple-900 dark:bg-purple-950/90 dark:text-purple-200 font-bold" x-text="`${completedSubCount(card)}/${card.subItems.length} jaksoa`"></span>
|
||
</div>
|
||
|
||
<!-- Seuraava vuorossa -->
|
||
<template x-if="nextSubItem(card)">
|
||
<div class="p-2 rounded-lg bg-neutral-100 dark:bg-[#1e2023] border border-neutral-200 dark:border-[#36393f] space-y-1.5">
|
||
<div class="text-[10px] font-bold uppercase tracking-wider text-neutral-500 dark:text-neutral-400">Seuraava vuorossa:</div>
|
||
<div class="text-xs font-semibold text-neutral-900 dark:text-neutral-100 leading-snug" x-text="nextSubItem(card).label"></div>
|
||
<div class="flex flex-wrap items-center gap-1.5 pt-0.5">
|
||
<button
|
||
type="button"
|
||
@click="toggleSubItem(card.id, nextSubItem(card).id)"
|
||
class="px-2 py-1 rounded bg-emerald-700 hover:bg-emerald-600 text-white text-[10px] font-bold transition"
|
||
>
|
||
Kuittaa valmiiksi ✓
|
||
</button>
|
||
<template x-if="nextSubItem(card).flexible">
|
||
<button
|
||
type="button"
|
||
@click="togglePinSubItem(card.id, nextSubItem(card).id)"
|
||
:class="nextSubItem(card).pinnedCardId ? 'bg-amber-600 hover:bg-amber-500' : 'bg-indigo-600 hover:bg-indigo-500'"
|
||
class="px-2 py-1 rounded text-white text-[10px] font-bold transition"
|
||
x-text="nextSubItem(card).pinnedCardId ? 'Vapauta PIN' : 'Nosta putkeen ↗'"
|
||
></button>
|
||
</template>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<!-- Laajenna koko jakso-/tehtävälista + pikalisäys -->
|
||
<div class="pt-1 border-t border-neutral-200 dark:border-[#36393f]">
|
||
<button
|
||
type="button"
|
||
@click="toggleExpand(card.id)"
|
||
:aria-expanded="isExpanded(card.id).toString()"
|
||
class="w-full flex items-center justify-between px-1.5 py-0.5 rounded text-[11px] font-semibold text-neutral-700 dark:text-neutral-200 hover:bg-neutral-100 dark:hover:bg-[#32353b] transition"
|
||
>
|
||
<span x-text="`Kaikki jaksot & tehtävät (${completedSubCount(card)}/${card.subItems.length})`"></span>
|
||
<span x-text="isExpanded(card.id) ? '▴' : '▾'"></span>
|
||
</button>
|
||
|
||
<div x-show="isExpanded(card.id)" x-cloak class="mt-1.5 space-y-1.5">
|
||
<ul class="space-y-1.5">
|
||
<template x-for="sub in card.subItems" :key="sub.id">
|
||
<li class="p-1.5 rounded-md bg-neutral-50 dark:bg-[#1b1c1f] border border-neutral-200 dark:border-[#32353b] text-xs space-y-1">
|
||
<label class="flex items-start gap-2 cursor-pointer">
|
||
<input type="checkbox" :checked="sub.done" @change="toggleSubItem(card.id, sub.id)" class="mt-0.5 rounded border-neutral-400 text-emerald-600" />
|
||
<span :class="sub.done ? 'line-through text-neutral-400' : 'text-neutral-800 dark:text-neutral-200 font-medium'" class="leading-tight" x-text="sub.label"></span>
|
||
</label>
|
||
<div class="pl-5 flex items-center justify-between gap-1">
|
||
<button
|
||
type="button"
|
||
@click="togglePinSubItem(card.id, sub.id)"
|
||
:class="sub.pinnedCardId ? 'bg-amber-600/20 text-amber-800 dark:text-amber-300 border-amber-500/40' : 'bg-indigo-600/20 text-indigo-800 dark:text-indigo-300 border-indigo-500/40'"
|
||
class="inline-flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-bold border hover:opacity-90 transition"
|
||
x-text="sub.pinnedCardId ? '📌 Putkessa (Vapauta)' : '📌 Nosta putkeen'"
|
||
></button>
|
||
<span x-show="sub.assignee" class="text-[9px] font-semibold text-neutral-500 dark:text-neutral-400" x-text="firstName(sub.assignee)"></span>
|
||
</div>
|
||
</li>
|
||
</template>
|
||
</ul>
|
||
|
||
<!-- Suora pikalisäys jatkuvan työn kortille -->
|
||
<div class="pt-1 border-t border-neutral-200 dark:border-[#32353b] space-y-1">
|
||
<div class="flex gap-1">
|
||
<input
|
||
type="text"
|
||
x-model="inlineSubInputs[card.id]"
|
||
@keydown.enter.prevent="addInlineSubItem(card.id)"
|
||
placeholder="+ Uusi tehtävä / jakso..."
|
||
:aria-label="`Lisää uusi tehtävä tai jakso työlle ${card.title}`"
|
||
class="flex-1 min-w-0 px-2 py-1 text-[11px] rounded border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#16171a] text-neutral-900 dark:text-white"
|
||
/>
|
||
<button
|
||
type="button"
|
||
@click="addInlineSubItem(card.id)"
|
||
class="px-2 py-1 rounded bg-primary-600 hover:bg-primary-700 text-white text-[11px] font-bold shrink-0"
|
||
>
|
||
+
|
||
</button>
|
||
</div>
|
||
<label class="flex items-center gap-1.5 text-[10px] text-neutral-600 dark:text-neutral-300 cursor-pointer select-none">
|
||
<input type="checkbox" x-model="inlineSubPin[card.id]" class="rounded border-neutral-400 text-indigo-600" />
|
||
<span>Nosta heti työputkeen (PIN)</span>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
</article>
|
||
</template>
|
||
|
||
<!-- ========================================================= -->
|
||
<!-- TYYPPI 1: TAVALLINEN ASIAKASTYÖKORTTI -->
|
||
<!-- ========================================================= -->
|
||
<template x-if="card.cardType === 'job'">
|
||
<article class="rounded-xl border border-neutral-300 dark:border-[#36393f] bg-white dark:bg-[#282a2e] shadow-sm overflow-hidden transition">
|
||
<!-- Asiakaskohtainen värillinen otsikkopalkki (Vetokahva + Klikkaus avaa modaalin) -->
|
||
<div
|
||
draggable="true"
|
||
@dragstart="handleDragStart($event, card)"
|
||
@dragend="handleDragEnd()"
|
||
@click="openCardModal(card)"
|
||
:style="cardHeaderStyle(card)"
|
||
title="Klikkaa avataksesi asiakastyön muokkausnäkymän tai raahaa siirtääksesi"
|
||
class="px-2 py-1 flex items-center justify-between gap-1 cursor-grab active:cursor-grabbing select-none"
|
||
>
|
||
<div class="flex items-center gap-1 min-w-0">
|
||
<svg class="w-3 h-3 opacity-70 shrink-0" viewBox="0 0 24 24" fill="currentColor"><circle cx="9" cy="6" r="1.5"/><circle cx="15" cy="6" r="1.5"/><circle cx="9" cy="12" r="1.5"/><circle cx="15" cy="12" r="1.5"/><circle cx="9" cy="18" r="1.5"/><circle cx="15" cy="18" r="1.5"/></svg>
|
||
<span class="text-[11px] font-extrabold tracking-tight truncate" x-text="card.customer"></span>
|
||
</div>
|
||
<div class="flex items-center gap-1 shrink-0">
|
||
<span :style="cardPillStyle(card)" class="text-[10px] font-bold px-1.5 py-0.2 rounded" x-text="card.number"></span>
|
||
<button
|
||
type="button"
|
||
@click.stop="openPicker($event, 'card', card.id)"
|
||
:aria-label="`Vaihda asiakkaan ${card.customer} otsikkoväri`"
|
||
class="p-0.5 rounded hover:bg-black/15 dark:hover:bg-white/15 cursor-pointer"
|
||
>
|
||
<svg class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"/></svg>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div :class="density === 'compact' ? 'p-1.5 space-y-1.5' : 'p-2.5 space-y-2'">
|
||
<!-- Työn nimi (katkeaa kolmella pisteellä + hover tooltip + klikkaus avaa modaalin) -->
|
||
<h3 class="m-0">
|
||
<button
|
||
type="button"
|
||
@click="openCardModal(card)"
|
||
@mouseenter="showTooltip($event, card.title)"
|
||
@mouseleave="hideTooltip()"
|
||
class="w-full text-left text-[13px] font-bold text-neutral-900 dark:text-white truncate hover:underline focus:outline-2 focus:outline-primary-500 rounded"
|
||
x-text="card.title"
|
||
></button>
|
||
</h3>
|
||
|
||
<!-- TIIVIS NÄKYMÄ (Kuvakaappauksen 3-rivinen kompakti kortti: vastuuhenkilö + prioriteetti + 1/2 ▾ samalla rivillä) -->
|
||
<template x-if="density === 'compact'">
|
||
<div class="space-y-1.5">
|
||
<div class="flex items-center justify-between gap-1 text-[10px]">
|
||
<div class="flex items-center gap-1 min-w-0">
|
||
<span class="inline-flex items-center gap-1 font-semibold text-neutral-700 dark:text-neutral-200 bg-neutral-100 dark:bg-[#1e2023] px-1.5 py-0.5 rounded shrink-0">
|
||
<span class="w-4 h-4 rounded-full bg-primary-600 text-white text-[9px] font-bold flex items-center justify-center" x-text="initials(card.assignee)"></span>
|
||
<span x-text="firstName(card.assignee)"></span>
|
||
</span>
|
||
<span
|
||
:class="priorityClass(card.priority)"
|
||
class="px-1.5 py-0.5 rounded border text-[10px] font-bold shrink-0 inline-flex items-center gap-1"
|
||
>
|
||
<span x-show="card.priority === 'Immediate'" class="w-2 h-2 rounded-full priority-stripe-immediate"></span>
|
||
<span x-text="priorityLabel(card.priority)"></span>
|
||
</span>
|
||
</div>
|
||
|
||
<button
|
||
type="button"
|
||
@click="toggleExpand(card.id)"
|
||
:aria-expanded="isExpanded(card.id).toString()"
|
||
:aria-label="`Näytä tehtävät (${doneTaskCount(card)}/${(card.tasks || []).length})`"
|
||
class="px-1.5 py-0.5 rounded bg-neutral-100 dark:bg-[#1e2023] hover:bg-neutral-200 dark:hover:bg-[#32353b] text-[10px] font-bold text-neutral-700 dark:text-neutral-200 shrink-0 transition"
|
||
>
|
||
<span x-text="`${doneTaskCount(card)}/${(card.tasks || []).length} ${isExpanded(card.id) ? '▴' : '▾'}`"></span>
|
||
</button>
|
||
</div>
|
||
|
||
<div x-show="isExpanded(card.id)" x-cloak class="pt-1 border-t border-neutral-200 dark:border-[#36393f]">
|
||
<ul class="space-y-1">
|
||
<template x-for="t in (card.tasks || [])" :key="t.id">
|
||
<li class="flex items-center justify-between gap-1.5 px-2 py-1 rounded bg-neutral-50 dark:bg-[#1b1c1f] border border-neutral-200 dark:border-[#32353b] text-[11px]">
|
||
<label class="flex items-center gap-1.5 cursor-pointer min-w-0 flex-1">
|
||
<input
|
||
type="checkbox"
|
||
:checked="t.status === 'Done'"
|
||
@change="toggleJobTask(card.id, t.id)"
|
||
class="rounded border-neutral-400 text-emerald-600 shrink-0"
|
||
/>
|
||
<span
|
||
:class="t.status === 'Done' ? 'line-through text-neutral-400' : 'text-neutral-800 dark:text-neutral-200 font-medium'"
|
||
class="truncate"
|
||
x-text="t.title"
|
||
></span>
|
||
</label>
|
||
<span class="text-[9px] font-semibold text-neutral-500 dark:text-neutral-400 shrink-0" x-text="firstName(t.assignee)"></span>
|
||
</li>
|
||
</template>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<!-- NORMAALI NÄKYMÄ -->
|
||
<template x-if="density === 'normal'">
|
||
<div class="space-y-2">
|
||
<!-- Vastuuhenkilö + Prioriteetti + Palveluyksikkö -->
|
||
<div class="flex items-center justify-between gap-1 text-[10px]">
|
||
<span class="inline-flex items-center gap-1 font-semibold text-neutral-700 dark:text-neutral-200 bg-neutral-100 dark:bg-[#1e2023] px-1.5 py-0.5 rounded shrink-0">
|
||
<span class="w-4 h-4 rounded-full bg-primary-600 text-white text-[9px] font-bold flex items-center justify-center" x-text="initials(card.assignee)"></span>
|
||
<span x-text="firstName(card.assignee)"></span>
|
||
</span>
|
||
|
||
<div class="flex items-center gap-1 min-w-0">
|
||
<span
|
||
class="px-1.5 py-0.5 rounded bg-neutral-100 dark:bg-[#1e2023] text-neutral-600 dark:text-neutral-300 font-medium truncate"
|
||
x-text="card.serviceUnit"
|
||
></span>
|
||
<span
|
||
:class="priorityClass(card.priority)"
|
||
class="px-1.5 py-0.5 rounded border text-[10px] font-bold shrink-0 inline-flex items-center gap-1"
|
||
>
|
||
<span x-show="card.priority === 'Immediate'" class="w-2 h-2 rounded-full priority-stripe-immediate"></span>
|
||
<span x-text="priorityLabel(card.priority)"></span>
|
||
</span>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Määräaika, tunnit ja siirtovalikko -->
|
||
<div class="flex items-center justify-between gap-1 text-[10px] text-neutral-500 dark:text-neutral-400">
|
||
<div class="flex items-center gap-1.5">
|
||
<span
|
||
:class="card.isOverdue ? 'text-red-600 dark:text-red-400 font-bold' : 'font-medium'"
|
||
x-text="card.isOverdue ? `⚠ Myöhässä (${card.dueDate})` : `DL ${card.dueDate}`"
|
||
></span>
|
||
<span>•</span>
|
||
<span x-text="`${fmtHours(card.loggedHours)}/${fmtHours(card.estimatedHours)} h`"></span>
|
||
</div>
|
||
<select
|
||
:aria-label="`Siirrä työ ${card.title}`"
|
||
@change="moveCard(card.id, $event.target.value)"
|
||
class="text-[10px] bg-neutral-100 dark:bg-[#1e2023] border border-neutral-300 dark:border-[#3e4249] rounded px-1.5 py-0.5 text-neutral-800 dark:text-neutral-200 max-w-[100px]"
|
||
>
|
||
<template x-for="optCol in allMovableColumns()" :key="optCol.id">
|
||
<option :value="optCol.id" :selected="optCol.id === activeColIdForCard(card)" x-text="optCol.title"></option>
|
||
</template>
|
||
</select>
|
||
</div>
|
||
|
||
<!-- Laajennettava tehtävälista suoraan kortin sisälle -->
|
||
<div class="pt-1 border-t border-neutral-200 dark:border-[#36393f]">
|
||
<button
|
||
type="button"
|
||
@click="toggleExpand(card.id)"
|
||
:aria-expanded="isExpanded(card.id).toString()"
|
||
class="w-full flex items-center justify-between px-1.5 py-0.5 rounded text-[11px] font-semibold text-neutral-700 dark:text-neutral-200 hover:bg-neutral-100 dark:hover:bg-[#32353b] transition"
|
||
>
|
||
<span>Tehtävät (<span x-text="`${doneTaskCount(card)}/${(card.tasks || []).length}`"></span>)</span>
|
||
<span x-text="isExpanded(card.id) ? '▴' : '▾'"></span>
|
||
</button>
|
||
|
||
<div x-show="isExpanded(card.id)" x-cloak class="mt-1.5 space-y-1">
|
||
<ul class="space-y-1">
|
||
<template x-for="t in (card.tasks || [])" :key="t.id">
|
||
<li class="flex items-center justify-between gap-1.5 px-2 py-1 rounded bg-neutral-50 dark:bg-[#1b1c1f] border border-neutral-200 dark:border-[#32353b] text-[11px]">
|
||
<label class="flex items-center gap-1.5 cursor-pointer min-w-0 flex-1">
|
||
<input
|
||
type="checkbox"
|
||
:checked="t.status === 'Done'"
|
||
@change="toggleJobTask(card.id, t.id)"
|
||
class="rounded border-neutral-400 text-emerald-600 shrink-0"
|
||
/>
|
||
<span
|
||
:class="t.status === 'Done' ? 'line-through text-neutral-400' : 'text-neutral-800 dark:text-neutral-200 font-medium'"
|
||
class="truncate"
|
||
x-text="t.title"
|
||
></span>
|
||
</label>
|
||
<span class="text-[9px] font-semibold text-neutral-500 dark:text-neutral-400 shrink-0" x-text="firstName(t.assignee)"></span>
|
||
</li>
|
||
</template>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
</article>
|
||
</template>
|
||
|
||
<!-- Pudotusviiva alapuolella -->
|
||
<div
|
||
x-show="dropTargetCardId === card.id && dropPosition === 'after' && draggedCardId !== card.id"
|
||
x-cloak
|
||
class="h-1 mt-1 -mb-1 rounded-full bg-indigo-400 shadow-[0_0_8px_rgba(129,140,248,0.9)] pointer-events-none"
|
||
></div>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
</section>
|
||
</template>
|
||
</div>
|
||
</main>
|
||
|
||
<!-- TÄYSI KORTTIMODAALI: KAKSIPULSTAINEN ASIAKASTYÖN TYÖTILA (65% / 35%) -->
|
||
<dialog
|
||
x-ref="cardModal"
|
||
aria-labelledby="cardModalTitle"
|
||
@close="selectedCard = null"
|
||
class="rounded-2xl p-0 w-full max-w-5xl bg-white dark:bg-[#222427] text-neutral-900 dark:text-neutral-100 border border-neutral-300 dark:border-[#3e4249] shadow-2xl backdrop:bg-black/70"
|
||
>
|
||
<template x-if="selectedCard">
|
||
<div class="flex flex-col max-h-[92vh]">
|
||
<!-- YLÄPALKKI: Numero, Asiakas + Otsikkoväri, Tila, Prioriteetti -->
|
||
<div
|
||
:style="selectedCard.cardType === 'promoted_task' ? 'background-color:#4338ca;color:#ffffff;' : cardHeaderStyle(selectedCard)"
|
||
class="px-5 py-3 flex flex-wrap items-center justify-between gap-3 border-b border-black/15 shrink-0"
|
||
>
|
||
<div class="flex flex-wrap items-center gap-2.5 min-w-0 flex-1">
|
||
<span class="text-xs font-extrabold uppercase tracking-wider px-2 py-0.5 rounded bg-black/25 shrink-0" x-text="selectedCard.number || 'TEHTÄVÄ • PIN'"></span>
|
||
<span id="cardModalTitle" class="text-sm font-extrabold truncate" x-text="selectedCard.customer"></span>
|
||
<template x-if="selectedCard.cardType !== 'promoted_task'">
|
||
<button
|
||
type="button"
|
||
@click.stop="openPicker($event, 'card', selectedCard.id)"
|
||
title="Vaihda asiakkaan tai kortin otsikkoväri"
|
||
class="inline-flex items-center gap-1 px-2 py-0.5 rounded bg-black/20 hover:bg-black/30 text-[11px] font-semibold transition"
|
||
>
|
||
<svg class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2"><circle cx="13.5" cy="6.5" r=".5" fill="currentColor"/><circle cx="17.5" cy="10.5" r=".5" fill="currentColor"/><circle cx="8.5" cy="7.5" r=".5" fill="currentColor"/><circle cx="6.5" cy="12.5" r=".5" fill="currentColor"/><path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z"/></svg>
|
||
<span>Väri</span>
|
||
</button>
|
||
</template>
|
||
</div>
|
||
|
||
<!-- Tila- ja Prioriteettivalinnat suoraan yläpalkissa -->
|
||
<div class="flex flex-wrap items-center gap-2 shrink-0">
|
||
<div class="flex items-center gap-1 bg-black/20 px-2 py-1 rounded-lg">
|
||
<label for="modalStatusSelect" class="text-[11px] font-bold opacity-85">Tila:</label>
|
||
<select
|
||
id="modalStatusSelect"
|
||
:value="selectedCard.status"
|
||
@change="updateModalStatus($event.target.value)"
|
||
class="bg-transparent text-xs font-extrabold cursor-pointer focus:outline-none"
|
||
>
|
||
<option value="Prospect" class="bg-[#282a2e] text-white">Prospekti</option>
|
||
<option value="Tentative" class="bg-[#282a2e] text-white">Alustava</option>
|
||
<option value="QuoteRequest" class="bg-[#282a2e] text-white">Tarjouspyyntö</option>
|
||
<option value="Order" class="bg-[#282a2e] text-white">Jonossa (Tilaus)</option>
|
||
<option value="InProduction" class="bg-[#282a2e] text-white">Työn alla (Tuotannossa)</option>
|
||
<option value="OnHold" class="bg-[#282a2e] text-white">Odottaa asiakasta</option>
|
||
<option value="Done" class="bg-[#282a2e] text-white">Valmis (Lukitsee tunnit/kulut)</option>
|
||
<option value="Invoiced" class="bg-[#282a2e] text-white">Lasku luotu</option>
|
||
<option value="Billed" class="bg-[#282a2e] text-white">Laskutettu</option>
|
||
<option value="Ongoing" class="bg-[#282a2e] text-white">Jatkuva / Kausi</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="flex items-center gap-1 bg-black/20 px-2 py-1 rounded-lg">
|
||
<label for="modalPrioSelect" class="text-[11px] font-bold opacity-85">Prioriteetti:</label>
|
||
<select
|
||
id="modalPrioSelect"
|
||
:value="selectedCard.priority"
|
||
@change="changePriority(selectedCard.id, $event.target.value); logChange('Prioriteetti', priorities[$event.target.value].label)"
|
||
class="bg-transparent text-xs font-extrabold cursor-pointer focus:outline-none"
|
||
>
|
||
<template x-for="(pObj, pKey) in priorities" :key="pKey">
|
||
<option :value="pKey" class="bg-[#282a2e] text-white" x-text="pObj.label"></option>
|
||
</template>
|
||
</select>
|
||
</div>
|
||
|
||
<button
|
||
type="button"
|
||
@click="$refs.cardModal.close()"
|
||
aria-label="Sulje kortti"
|
||
class="p-1.5 rounded-lg bg-black/20 hover:bg-black/35 transition"
|
||
>
|
||
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Lukitusvaroitus kun työ on Valmis / Laskutettu -->
|
||
<div
|
||
x-show="['Done', 'Invoiced', 'Billed'].includes(selectedCard.status)"
|
||
x-cloak
|
||
role="status"
|
||
class="px-5 py-2 bg-amber-100 dark:bg-amber-950/90 text-amber-950 dark:text-amber-200 border-b border-amber-300 dark:border-amber-800 text-xs font-semibold flex items-center justify-between gap-2 shrink-0"
|
||
>
|
||
<span>🔒 Työ on merkitty valmiiksi – tunnit ja kulut on lukittu laskutusta varten.</span>
|
||
<button
|
||
type="button"
|
||
@click="updateModalStatus('InProduction')"
|
||
class="px-2.5 py-1 rounded bg-amber-800 text-white text-[11px] font-bold hover:bg-amber-700"
|
||
>
|
||
Avaa lukitus (Johto)
|
||
</button>
|
||
</div>
|
||
|
||
<!-- KAKSIPULSTAINEN RUNKO (65% Vasen / 35% Oikea) -->
|
||
<div class="flex-1 overflow-y-auto p-5 grid grid-cols-1 lg:grid-cols-12 gap-5">
|
||
<!-- VASEN PÄÄPALSTA (8 / 12 saraketta ~ 65%) -->
|
||
<div class="lg:col-span-8 space-y-5">
|
||
<!-- Inline-muokattava työn nimiotsikko -->
|
||
<div>
|
||
<label for="modalTitleInput" class="block text-[10px] font-bold uppercase tracking-wider text-neutral-500 dark:text-neutral-400 mb-1">Asiakastyön nimi (klikattavissa muokkaukseen)</label>
|
||
<input
|
||
id="modalTitleInput"
|
||
type="text"
|
||
x-model="selectedCard.title"
|
||
@change="logChange('Työn nimi', selectedCard.title); toast('Työn nimi tallennettu.')"
|
||
class="w-full px-3 py-2 text-base font-extrabold rounded-xl border border-transparent hover:border-neutral-300 dark:hover:border-[#4b5058] focus:border-primary-500 bg-neutral-100/70 dark:bg-[#18191b] text-neutral-900 dark:text-white focus:outline-none transition"
|
||
/>
|
||
</div>
|
||
|
||
<!-- Kuvaus & Sisäinen työohjeistus -->
|
||
<div class="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||
<div>
|
||
<label for="modalDescription" class="block text-xs font-bold text-neutral-700 dark:text-neutral-200 mb-1">Työn kuvaus</label>
|
||
<textarea
|
||
id="modalDescription"
|
||
rows="3"
|
||
x-model="selectedCard.description"
|
||
@change="logChange('Työn kuvaus', 'Päivitetty'); toast('Kuvaus tallennettu.')"
|
||
placeholder="Kirjaa asiakkaan tilauksen tarkempi kuvaus, mitat ja toimitussisältö..."
|
||
class="w-full p-2.5 text-xs rounded-xl border border-neutral-300 dark:border-[#3e4249] bg-neutral-50 dark:bg-[#18191b] text-neutral-900 dark:text-neutral-100 focus:border-primary-500 focus:outline-none"
|
||
></textarea>
|
||
</div>
|
||
<div>
|
||
<label for="modalInstructions" class="block text-xs font-bold text-neutral-700 dark:text-neutral-200 mb-1">Sisäinen työohjeistus & huomiot</label>
|
||
<textarea
|
||
id="modalInstructions"
|
||
rows="3"
|
||
x-model="selectedCard.instructions"
|
||
@change="logChange('Työohjeistus', 'Päivitetty'); toast('Työohjeistus tallennettu.')"
|
||
placeholder="Esim. materiaalitiedot, laskutusohje, yhteyshenkilön toiveet..."
|
||
class="w-full p-2.5 text-xs rounded-xl border border-neutral-300 dark:border-[#3e4249] bg-amber-50/40 dark:bg-[#1e1d19] text-neutral-900 dark:text-neutral-100 focus:border-primary-500 focus:outline-none"
|
||
></textarea>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Tiedostolinkit (Drive, Dropbox ym.) -->
|
||
<div class="p-3.5 rounded-xl bg-neutral-50 dark:bg-[#1b1c1f] border border-neutral-200 dark:border-[#36393f] space-y-2.5">
|
||
<div class="flex items-center justify-between">
|
||
<h3 class="text-xs font-bold uppercase tracking-wider text-neutral-600 dark:text-neutral-300">Tiedostolinkit (Drive, Dropbox, aineistot)</h3>
|
||
<button
|
||
type="button"
|
||
@click="addingLink = !addingLink"
|
||
class="text-xs font-bold text-primary-600 dark:text-indigo-400 hover:underline"
|
||
>
|
||
+ Lisää linkki
|
||
</button>
|
||
</div>
|
||
|
||
<div x-show="addingLink" x-cloak class="grid grid-cols-1 sm:grid-cols-12 gap-2 p-2 rounded-lg bg-white dark:bg-[#141518] border border-neutral-300 dark:border-[#3e4249]">
|
||
<input type="text" x-model="newLinkTitle" placeholder="Linkin otsikko (esim. Painoaineisto PDF)" class="sm:col-span-5 px-2.5 py-1.5 text-xs rounded border border-neutral-300 dark:border-[#4b5058] bg-neutral-50 dark:bg-[#18191b]" />
|
||
<input type="url" x-model="newLinkUrl" placeholder="https://drive.google.com/..." class="sm:col-span-5 px-2.5 py-1.5 text-xs rounded border border-neutral-300 dark:border-[#4b5058] bg-neutral-50 dark:bg-[#18191b]" />
|
||
<button type="button" @click="addCardLink()" class="sm:col-span-2 px-2.5 py-1.5 rounded bg-primary-600 hover:bg-primary-700 text-white text-xs font-bold">Lisää</button>
|
||
</div>
|
||
|
||
<ul class="space-y-1.5">
|
||
<template x-for="(lnk, lIdx) in (selectedCard.links || [])" :key="lIdx">
|
||
<li class="flex items-center justify-between gap-2 px-2.5 py-1.5 rounded-lg bg-white dark:bg-[#25272b] border border-neutral-200 dark:border-[#36393f] text-xs">
|
||
<a :href="lnk.url" target="_blank" rel="noopener" class="inline-flex items-center gap-1.5 font-semibold text-primary-700 dark:text-indigo-300 hover:underline truncate">
|
||
<span>🔗</span>
|
||
<span x-text="lnk.title"></span>
|
||
</a>
|
||
<button type="button" @click="removeCardLink(lIdx)" aria-label="Poista linkki" class="text-neutral-400 hover:text-red-500 text-xs font-bold px-1">✕</button>
|
||
</li>
|
||
</template>
|
||
<template x-if="!selectedCard.links || selectedCard.links.length === 0">
|
||
<li class="text-[11px] text-neutral-500 dark:text-neutral-400">Ei tallennettuja aineistolinkkejä.</li>
|
||
</template>
|
||
</ul>
|
||
</div>
|
||
|
||
<!-- TEHTÄVÄT / JAKSOT + TYÖNKULKUPOHJAT -->
|
||
<div class="p-3.5 rounded-xl bg-neutral-50 dark:bg-[#1b1c1f] border border-neutral-200 dark:border-[#36393f] space-y-3">
|
||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||
<div>
|
||
<h3 class="text-xs font-bold uppercase tracking-wider text-neutral-700 dark:text-neutral-200" x-text="selectedCard.subItems ? 'Jatkuvan työn jaksot & tehtävät' : 'Asiakastyön tehtävät'"></h3>
|
||
<p class="text-[11px] text-neutral-500 dark:text-neutral-400" x-text="selectedCard.subItems ? 'Kuittaa valmiiksi tai nosta joustava tehtävä työputkeen (PIN).' : 'Hallitse työvaiheita, tekijöitä, määräpäiviä ja tarkistuslistoja.'"></p>
|
||
</div>
|
||
|
||
<!-- Työnkulkupohjan valitsin -->
|
||
<div class="flex items-center gap-1.5">
|
||
<select
|
||
x-model="selectedWorkflowTemplate"
|
||
aria-label="Valitse työnkulkupohja"
|
||
class="px-2 py-1 text-[11px] rounded-lg border border-neutral-300 dark:border-[#4b5058] bg-white dark:bg-[#18191b] text-neutral-800 dark:text-neutral-200"
|
||
>
|
||
<option value="">+ Lisää työnkulkupohjasta...</option>
|
||
<option value="suurkuva">Suurkuvatulostus & asennus (4 vaihetta)</option>
|
||
<option value="video">Videotuotanto (Suunnittelu → Kuvaus → Edit → Toimitus)</option>
|
||
<option value="some">Kuukausisometuotanto (Ideointi → Tuotanto → Julkaisu)</option>
|
||
</select>
|
||
<button
|
||
type="button"
|
||
x-show="selectedWorkflowTemplate"
|
||
@click="applyWorkflowTemplate()"
|
||
class="px-2.5 py-1 rounded-lg bg-indigo-600 hover:bg-indigo-500 text-white text-[11px] font-bold"
|
||
>
|
||
Luo
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Tavallisen työn tehtävät (muokattava tila, tekijä, määräpäivä, tarkistuslista) -->
|
||
<template x-if="selectedCard.tasks">
|
||
<ul class="space-y-2">
|
||
<template x-for="t in selectedCard.tasks" :key="t.id">
|
||
<li class="p-2.5 rounded-xl bg-white dark:bg-[#25272b] border border-neutral-200 dark:border-[#36393f] space-y-2 text-xs">
|
||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||
<div class="flex items-center gap-2 min-w-0 flex-1">
|
||
<input type="checkbox" :checked="t.status === 'Done'" @change="toggleJobTask(selectedCard.id, t.id)" class="rounded border-neutral-400 text-emerald-600" />
|
||
<input
|
||
type="text"
|
||
x-model="t.title"
|
||
class="flex-1 min-w-0 bg-transparent font-bold text-neutral-900 dark:text-white focus:outline-none focus:underline"
|
||
/>
|
||
</div>
|
||
|
||
<div class="flex flex-wrap items-center gap-1.5 shrink-0">
|
||
<select
|
||
x-model="t.status"
|
||
aria-label="Tehtävän tila"
|
||
class="px-1.5 py-0.5 text-[11px] font-semibold rounded border border-neutral-300 dark:border-[#454952] bg-neutral-50 dark:bg-[#18191b]"
|
||
>
|
||
<option value="Waiting">Odottaa</option>
|
||
<option value="InProgress">Työn alla</option>
|
||
<option value="InReview">Tarkastettavana</option>
|
||
<option value="Done">Valmis</option>
|
||
</select>
|
||
|
||
<select
|
||
x-model="t.assignee"
|
||
aria-label="Tehtävän tekijä"
|
||
class="px-1.5 py-0.5 text-[11px] font-semibold rounded border border-neutral-300 dark:border-[#454952] bg-neutral-50 dark:bg-[#18191b]"
|
||
>
|
||
<option value="Jussi Mäkelä">Jussi Mäkelä</option>
|
||
<option value="Anna Korhonen">Anna Korhonen</option>
|
||
<option value="Mikko Salonen">Mikko Salonen</option>
|
||
<option value="Ei tekijää">Ei tekijää</option>
|
||
</select>
|
||
|
||
<input
|
||
type="text"
|
||
x-model="t.dueDate"
|
||
placeholder="pp.kk."
|
||
aria-label="Tehtävän määräpäivä"
|
||
class="w-16 px-1.5 py-0.5 text-[11px] rounded border border-neutral-300 dark:border-[#454952] bg-neutral-50 dark:bg-[#18191b] text-center"
|
||
/>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Tarkistuslistan alikohdat (todo) -->
|
||
<div class="pl-6 space-y-1">
|
||
<template x-for="(chk, cIdx) in (t.checklist || [])" :key="cIdx">
|
||
<label class="flex items-center gap-1.5 text-[11px] text-neutral-600 dark:text-neutral-300 cursor-pointer">
|
||
<input type="checkbox" x-model="chk.done" class="rounded border-neutral-400 text-indigo-600" />
|
||
<span :class="chk.done ? 'line-through text-neutral-400' : ''" x-text="chk.text"></span>
|
||
</label>
|
||
</template>
|
||
<div class="flex items-center gap-1.5 pt-0.5">
|
||
<input
|
||
type="text"
|
||
x-model="taskChecklistInputs[t.id]"
|
||
@keydown.enter.prevent="addChecklistItem(t)"
|
||
placeholder="+ Lisää tarkistuslistan kohta..."
|
||
class="flex-1 px-2 py-0.5 text-[11px] rounded border border-dashed border-neutral-300 dark:border-[#454952] bg-transparent"
|
||
/>
|
||
<button type="button" @click="addChecklistItem(t)" class="text-[10px] font-bold text-indigo-500 hover:underline px-1">Lisää</button>
|
||
</div>
|
||
</div>
|
||
</li>
|
||
</template>
|
||
</ul>
|
||
</template>
|
||
|
||
<!-- Jatkuvan työn jaksot & tehtävät -->
|
||
<template x-if="selectedCard.subItems">
|
||
<ul class="space-y-2">
|
||
<template x-for="sub in selectedCard.subItems" :key="sub.id">
|
||
<li class="p-2.5 rounded-xl bg-white dark:bg-[#25272b] border border-neutral-200 dark:border-[#36393f] flex flex-wrap items-center justify-between gap-2 text-xs">
|
||
<label class="flex items-center gap-2.5 cursor-pointer min-w-0 flex-1">
|
||
<input type="checkbox" :checked="sub.done" @change="toggleSubItem(selectedCard.id, sub.id)" class="rounded border-neutral-400 text-emerald-600" />
|
||
<input
|
||
type="text"
|
||
x-model="sub.label"
|
||
:class="sub.done ? 'line-through text-neutral-400' : 'font-semibold'"
|
||
class="flex-1 min-w-0 bg-transparent focus:outline-none focus:underline"
|
||
/>
|
||
</label>
|
||
<div class="flex items-center gap-2 shrink-0">
|
||
<select
|
||
x-model="sub.assignee"
|
||
aria-label="Tekijä"
|
||
class="px-1.5 py-0.5 text-[11px] rounded border border-neutral-300 dark:border-[#454952] bg-neutral-50 dark:bg-[#18191b]"
|
||
>
|
||
<option value="Jussi Mäkelä">Jussi Mäkelä</option>
|
||
<option value="Anna Korhonen">Anna Korhonen</option>
|
||
<option value="Mikko Salonen">Mikko Salonen</option>
|
||
</select>
|
||
<button
|
||
type="button"
|
||
@click="togglePinSubItem(selectedCard.id, sub.id)"
|
||
:class="sub.pinnedCardId ? 'bg-amber-600 hover:bg-amber-500' : 'bg-indigo-600 hover:bg-indigo-500'"
|
||
class="px-2.5 py-1 rounded text-[11px] font-bold text-white transition"
|
||
x-text="sub.pinnedCardId ? '📌 Vapauta putkesta' : '📌 Nosta putkeen ↗'"
|
||
></button>
|
||
</div>
|
||
</li>
|
||
</template>
|
||
</ul>
|
||
</template>
|
||
|
||
<!-- Pikalisää uusi tehtävä / jakso modaalissa -->
|
||
<div class="pt-2 border-t border-neutral-200 dark:border-[#36393f] space-y-2">
|
||
<div class="flex flex-wrap gap-2">
|
||
<input
|
||
type="text"
|
||
x-model="newModalTaskTitle"
|
||
@keydown.enter.prevent="addModalTask()"
|
||
:placeholder="selectedCard.subItems ? 'Lisää uusi jakso tai tehtävä (esim. Vko 51 julkaisu)...' : 'Lisää uusi tehtävä tälle asiakastyölle...'"
|
||
aria-label="Uuden tehtävän nimi"
|
||
class="flex-1 min-w-[200px] px-3 py-1.5 text-xs rounded-lg border border-neutral-300 dark:border-[#4b5058] bg-white dark:bg-[#18191b] text-neutral-900 dark:text-white"
|
||
/>
|
||
<select
|
||
x-model="newModalTaskAssignee"
|
||
aria-label="Uuden tehtävän tekijä"
|
||
class="px-2.5 py-1.5 text-xs rounded-lg border border-neutral-300 dark:border-[#4b5058] bg-white dark:bg-[#18191b]"
|
||
>
|
||
<option value="Jussi Mäkelä">Jussi Mäkelä</option>
|
||
<option value="Anna Korhonen">Anna Korhonen</option>
|
||
<option value="Mikko Salonen">Mikko Salonen</option>
|
||
</select>
|
||
<button
|
||
type="button"
|
||
@click="addModalTask()"
|
||
class="px-3.5 py-1.5 rounded-lg bg-primary-600 hover:bg-primary-700 text-white text-xs font-bold"
|
||
>
|
||
+ Lisää
|
||
</button>
|
||
</div>
|
||
<template x-if="selectedCard.subItems">
|
||
<label class="flex items-center gap-2 text-xs text-neutral-700 dark:text-neutral-300 cursor-pointer">
|
||
<input type="checkbox" x-model="newModalTaskPin" class="rounded border-neutral-400 text-indigo-600" />
|
||
<span>Nosta uusi tehtävä samalla työputkeen omana korttinaan (PIN)</span>
|
||
</label>
|
||
</template>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- VÄLILEHDET: TUNTIKIRJAUKSET / KULUT / MUUTOSHISTORIA -->
|
||
<div class="rounded-xl bg-neutral-50 dark:bg-[#1b1c1f] border border-neutral-200 dark:border-[#36393f] overflow-hidden">
|
||
<div class="flex border-b border-neutral-200 dark:border-[#36393f] bg-neutral-100 dark:bg-[#16171a] text-xs font-bold">
|
||
<button
|
||
type="button"
|
||
@click="modalTab = 'hours'"
|
||
:class="modalTab === 'hours' ? 'bg-white dark:bg-[#222427] text-primary-600 dark:text-indigo-400 border-b-2 border-primary-600' : 'text-neutral-600 dark:text-neutral-400'"
|
||
class="px-4 py-2.5 transition"
|
||
>
|
||
⏱ Tuntikirjaukset (<span x-text="fmtHours(selectedCard.loggedHours)"></span> h)
|
||
</button>
|
||
<button
|
||
type="button"
|
||
@click="modalTab = 'expenses'"
|
||
:class="modalTab === 'expenses' ? 'bg-white dark:bg-[#222427] text-primary-600 dark:text-indigo-400 border-b-2 border-primary-600' : 'text-neutral-600 dark:text-neutral-400'"
|
||
class="px-4 py-2.5 transition"
|
||
>
|
||
🧾 Kulut (<span x-text="(selectedCard.expenses || []).length"></span>)
|
||
</button>
|
||
<button
|
||
type="button"
|
||
@click="modalTab = 'history'"
|
||
:class="modalTab === 'history' ? 'bg-white dark:bg-[#222427] text-primary-600 dark:text-indigo-400 border-b-2 border-primary-600' : 'text-neutral-600 dark:text-neutral-400'"
|
||
class="px-4 py-2.5 transition"
|
||
>
|
||
📜 Muutoshistoria (<span x-text="(selectedCard.history || []).length"></span>)
|
||
</button>
|
||
</div>
|
||
|
||
<!-- Tuntien pikakirjaus -->
|
||
<div x-show="modalTab === 'hours'" class="p-3.5 space-y-2.5 text-xs">
|
||
<div class="flex flex-wrap items-center gap-2">
|
||
<input type="number" step="0.25" min="0.25" max="24" x-model.number="quickHoursAmount" aria-label="Tuntimäärä" class="w-20 px-2.5 py-1.5 rounded-lg border border-neutral-300 dark:border-[#4b5058] bg-white dark:bg-[#18191b] font-bold" />
|
||
<input type="text" x-model="quickHoursNote" placeholder="Selite (esim. Taitto ja vedostus)" class="flex-1 min-w-[160px] px-2.5 py-1.5 rounded-lg border border-neutral-300 dark:border-[#4b5058] bg-white dark:bg-[#18191b]" />
|
||
<button
|
||
type="button"
|
||
@click="addQuickHours()"
|
||
:disabled="['Done', 'Invoiced', 'Billed'].includes(selectedCard.status)"
|
||
class="px-3 py-1.5 rounded-lg bg-emerald-700 hover:bg-emerald-600 disabled:opacity-40 text-white font-bold"
|
||
>
|
||
+ Kirjaa tunnit
|
||
</button>
|
||
</div>
|
||
<div class="text-[11px] text-neutral-500 dark:text-neutral-400">
|
||
Yhteensä kirjattu: <strong x-text="fmtHours(selectedCard.loggedHours)"></strong> h / Arvio: <strong x-text="fmtHours(selectedCard.estimatedHours)"></strong> h.
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Kulut -->
|
||
<div x-show="modalTab === 'expenses'" x-cloak class="p-3.5 space-y-2.5 text-xs">
|
||
<div class="flex flex-wrap items-center gap-2">
|
||
<input type="text" x-model="quickExpenseDesc" placeholder="Kulu (esim. Tulostusmedia / Matkakulut 45 km)" class="flex-1 min-w-[180px] px-2.5 py-1.5 rounded-lg border border-neutral-300 dark:border-[#4b5058] bg-white dark:bg-[#18191b]" />
|
||
<input type="number" step="0.01" x-model.number="quickExpenseAmount" placeholder="€ ALV 0" class="w-24 px-2.5 py-1.5 rounded-lg border border-neutral-300 dark:border-[#4b5058] bg-white dark:bg-[#18191b]" />
|
||
<button
|
||
type="button"
|
||
@click="addQuickExpense()"
|
||
:disabled="['Done', 'Invoiced', 'Billed'].includes(selectedCard.status)"
|
||
class="px-3 py-1.5 rounded-lg bg-primary-600 hover:bg-primary-700 disabled:opacity-40 text-white font-bold"
|
||
>
|
||
+ Lisää kulu
|
||
</button>
|
||
</div>
|
||
<ul class="space-y-1">
|
||
<template x-for="(exp, eIdx) in (selectedCard.expenses || [])" :key="eIdx">
|
||
<li class="flex justify-between px-2.5 py-1.5 rounded bg-white dark:bg-[#25272b] border border-neutral-200 dark:border-[#36393f]">
|
||
<span x-text="exp.desc"></span>
|
||
<span class="font-bold" x-text="canSeeMoney ? `${Number(exp.amount).toFixed(2).replace('.', ',')} €` : 'Piilotettu (rahaoikeus)'"></span>
|
||
</li>
|
||
</template>
|
||
</ul>
|
||
</div>
|
||
|
||
<!-- Muutoshistoria -->
|
||
<div x-show="modalTab === 'history'" x-cloak class="p-3.5 space-y-1.5 text-xs max-h-40 overflow-y-auto">
|
||
<template x-for="(h, hIdx) in (selectedCard.history || [])" :key="hIdx">
|
||
<div class="flex items-center justify-between gap-2 text-[11px] py-1 border-b border-neutral-200/70 dark:border-[#2e3137]">
|
||
<span><strong x-text="h.user"></strong>: <span x-text="h.text"></span></span>
|
||
<span class="text-neutral-400 shrink-0" x-text="h.time"></span>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- OIKEA SIVUPALSTA (4 / 12 saraketta ~ 35%): KAIKKI METATIEDOT MUOKATTAVINA -->
|
||
<aside class="lg:col-span-4 space-y-4 text-xs">
|
||
<!-- 1. Asiakas, yhteyshenkilö ja laskutusyksikkö -->
|
||
<div class="p-3.5 rounded-xl bg-neutral-100 dark:bg-[#18191b] border border-neutral-200 dark:border-[#36393f] space-y-2.5">
|
||
<h3 class="text-[10px] font-extrabold uppercase tracking-wider text-neutral-500 dark:text-neutral-400">Asiakas & Laskutusyksikkö</h3>
|
||
|
||
<div>
|
||
<label for="modalCustomer" class="block text-[11px] font-semibold mb-1">Asiakas</label>
|
||
<select
|
||
id="modalCustomer"
|
||
x-model="selectedCard.customer"
|
||
@change="logChange('Asiakas', selectedCard.customer)"
|
||
class="w-full px-2.5 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a] font-bold"
|
||
>
|
||
<template x-for="cust in Object.keys(customerContacts)" :key="cust">
|
||
<option :value="cust" x-text="cust"></option>
|
||
</template>
|
||
</select>
|
||
</div>
|
||
|
||
<div>
|
||
<label for="modalCustContact" class="block text-[11px] font-semibold mb-1">Asiakkaan yhteyshenkilö</label>
|
||
<select
|
||
id="modalCustContact"
|
||
x-model="selectedCard.customerContact"
|
||
@change="logChange('Asiakkaan yhteyshenkilö', selectedCard.customerContact)"
|
||
class="w-full px-2.5 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a]"
|
||
>
|
||
<option value="">-- Valitse yhteyshenkilö --</option>
|
||
<template x-for="c in (customerContacts[selectedCard.customer] || [])" :key="c">
|
||
<option :value="c" x-text="c"></option>
|
||
</template>
|
||
</select>
|
||
</div>
|
||
|
||
<div>
|
||
<label for="modalBillingUnit" class="block text-[11px] font-semibold mb-1">Laskutusyksikkö</label>
|
||
<select
|
||
id="modalBillingUnit"
|
||
x-model="selectedCard.billingUnit"
|
||
@change="logChange('Laskutusyksikkö', selectedCard.billingUnit)"
|
||
class="w-full px-2.5 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a]"
|
||
>
|
||
<option value="Päälaskutus (Verkkolasku)">Päälaskutus (Verkkolasku)</option>
|
||
<option value="Markkinointiosasto">Markkinointiosasto</option>
|
||
<option value="Kalusto & Kunnossapito">Kalusto & Kunnossapito</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 2. Oma tiimi (Jäsenet) -->
|
||
<div class="p-3.5 rounded-xl bg-neutral-100 dark:bg-[#18191b] border border-neutral-200 dark:border-[#36393f] space-y-2.5">
|
||
<h3 class="text-[10px] font-extrabold uppercase tracking-wider text-neutral-500 dark:text-neutral-400">Oma tiimi & Jäsenet</h3>
|
||
|
||
<div class="grid grid-cols-2 gap-2">
|
||
<div>
|
||
<label for="modalAssignee" class="block text-[11px] font-semibold mb-1">Vastuuhenkilö</label>
|
||
<select id="modalAssignee" x-model="selectedCard.assignee" @change="logChange('Vastuuhenkilö', selectedCard.assignee)" class="w-full px-2 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a] font-semibold">
|
||
<option value="Jussi Mäkelä">Jussi Mäkelä</option>
|
||
<option value="Anna Korhonen">Anna Korhonen</option>
|
||
<option value="Mikko Salonen">Mikko Salonen</option>
|
||
</select>
|
||
</div>
|
||
<div>
|
||
<label for="modalContactUser" class="block text-[11px] font-semibold mb-1">Kontaktihenkilö</label>
|
||
<select id="modalContactUser" x-model="selectedCard.contactUser" @change="logChange('Kontaktihenkilö', selectedCard.contactUser)" class="w-full px-2 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a]">
|
||
<option value="Jussi Mäkelä">Jussi Mäkelä</option>
|
||
<option value="Anna Korhonen">Anna Korhonen</option>
|
||
<option value="Mikko Salonen">Mikko Salonen</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div>
|
||
<label for="modalBiller" class="block text-[11px] font-semibold mb-1">Laskuttaja</label>
|
||
<select id="modalBiller" x-model="selectedCard.billerUser" @change="logChange('Laskuttaja', selectedCard.billerUser)" class="w-full px-2 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a]">
|
||
<option value="Jussi Mäkelä">Jussi Mäkelä</option>
|
||
<option value="Anna Korhonen">Anna Korhonen</option>
|
||
<option value="Johto / Hallinto">Johto / Hallinto</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 3. Palveluyksiköt & Tagit -->
|
||
<div class="p-3.5 rounded-xl bg-neutral-100 dark:bg-[#18191b] border border-neutral-200 dark:border-[#36393f] space-y-2.5">
|
||
<h3 class="text-[10px] font-extrabold uppercase tracking-wider text-neutral-500 dark:text-neutral-400">Palveluyksiköt & Tagit</h3>
|
||
|
||
<div>
|
||
<label for="modalUnit" class="block text-[11px] font-semibold mb-1">Pääpalveluyksikkö</label>
|
||
<select id="modalUnit" x-model="selectedCard.serviceUnit" @change="logChange('Palveluyksikkö', selectedCard.serviceUnit)" class="w-full px-2.5 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a] font-semibold">
|
||
<option value="Painotuotanto">Painotuotanto</option>
|
||
<option value="Mediatuotanto">Mediatuotanto</option>
|
||
<option value="Markkinointi">Markkinointi</option>
|
||
<option value="Verkkosivut">Verkkosivut</option>
|
||
<option value="Ohjelmistot">Ohjelmistot</option>
|
||
<option value="Ylläpitopalvelut">Ylläpitopalvelut</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div>
|
||
<label class="block text-[11px] font-semibold mb-1">Tagit</label>
|
||
<div class="flex flex-wrap gap-1 mb-1.5">
|
||
<template x-for="(tag, tIdx) in (selectedCard.tags || [])" :key="tag">
|
||
<span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[11px] font-bold bg-indigo-100 text-indigo-900 dark:bg-indigo-950 dark:text-indigo-200 border border-indigo-300 dark:border-indigo-700">
|
||
<span x-text="tag"></span>
|
||
<button type="button" @click="removeTag(tIdx)" aria-label="Poista tagi" class="hover:text-red-500">×</button>
|
||
</span>
|
||
</template>
|
||
</div>
|
||
<div class="flex gap-1">
|
||
<input
|
||
type="text"
|
||
x-model="newTagInput"
|
||
@keydown.enter.prevent="addTag()"
|
||
placeholder="Lisää tagi (esim. Yliteippaus)..."
|
||
class="flex-1 px-2 py-1 text-[11px] rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a]"
|
||
/>
|
||
<button type="button" @click="addTag()" class="px-2 py-1 rounded-lg bg-neutral-700 text-white text-[11px] font-bold">+</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 4. Aikataulu & Laji -->
|
||
<div class="p-3.5 rounded-xl bg-neutral-100 dark:bg-[#18191b] border border-neutral-200 dark:border-[#36393f] space-y-2.5">
|
||
<h3 class="text-[10px] font-extrabold uppercase tracking-wider text-neutral-500 dark:text-neutral-400">Aikataulu & Laji</h3>
|
||
|
||
<div>
|
||
<label for="modalKind" class="block text-[11px] font-semibold mb-1">Kesto / Laji</label>
|
||
<select id="modalKind" x-model="selectedCard.jobKind" @change="logChange('Laji', selectedCard.jobKind)" class="w-full px-2.5 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a]">
|
||
<option value="OneOff">Kertaluonteinen</option>
|
||
<option value="Service">Palvelutyö (pieni)</option>
|
||
<option value="FixedTerm">Määräaikainen (Kausi)</option>
|
||
<option value="Ongoing">Toistaiseksi jatkuva</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="grid grid-cols-2 gap-2">
|
||
<div>
|
||
<label for="modalStartsOn" class="block text-[11px] font-semibold mb-1">Alkamispäivä</label>
|
||
<input id="modalStartsOn" type="text" x-model="selectedCard.startsOn" placeholder="pp.kk." class="w-full px-2 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a]" />
|
||
</div>
|
||
<div>
|
||
<label for="modalDueOn" class="block text-[11px] font-semibold mb-1">Määräaika</label>
|
||
<input id="modalDueOn" type="text" x-model="selectedCard.dueDate" @change="logChange('Määräaika', selectedCard.dueDate)" class="w-full px-2 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a] font-bold" />
|
||
</div>
|
||
</div>
|
||
|
||
<div class="grid grid-cols-2 gap-2">
|
||
<div>
|
||
<label for="modalPlanned" class="block text-[11px] font-semibold mb-1">Suunniteltu jakso</label>
|
||
<input id="modalPlanned" type="text" x-model="selectedCard.plannedWindow" placeholder="esim. Vko 49" class="w-full px-2 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a]" />
|
||
</div>
|
||
<div>
|
||
<label for="modalEstHours" class="block text-[11px] font-semibold mb-1">Arvioidut tunnit</label>
|
||
<input id="modalEstHours" type="number" step="0.5" x-model.number="selectedCard.estimatedHours" class="w-full px-2 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a] font-bold" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- 5. Laskutus & Raha (Roolioikeuksien mukaan) -->
|
||
<div class="p-3.5 rounded-xl bg-neutral-100 dark:bg-[#18191b] border border-neutral-200 dark:border-[#36393f] space-y-2.5">
|
||
<div class="flex items-center justify-between">
|
||
<h3 class="text-[10px] font-extrabold uppercase tracking-wider text-neutral-500 dark:text-neutral-400">Laskutus & Raha</h3>
|
||
<button
|
||
type="button"
|
||
@click="canSeeMoney = !canSeeMoney"
|
||
class="text-[10px] font-semibold text-indigo-600 dark:text-indigo-400 hover:underline"
|
||
x-text="canSeeMoney ? '👁 Rahaoikeus: Päällä' : '🙈 Rahaoikeus: Pois'"
|
||
></button>
|
||
</div>
|
||
|
||
<div>
|
||
<label for="modalPaymentBasis" class="block text-[11px] font-semibold mb-1">Maksuperuste</label>
|
||
<select id="modalPaymentBasis" x-model="selectedCard.paymentBasis" @change="logChange('Maksuperuste', selectedCard.paymentBasis)" class="w-full px-2.5 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a]">
|
||
<option value="Hourly">Tuntityö</option>
|
||
<option value="FixedQuote">Kiinteä tarjouksen perusteella</option>
|
||
<option value="PriceList">Kiinteä hinnasto</option>
|
||
<option value="MonthlyFee">Kiinteä kk-laskutus</option>
|
||
<option value="NotBillable">Ei laskutettava</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div x-show="canSeeMoney" class="grid grid-cols-2 gap-2">
|
||
<div>
|
||
<label for="modalQuoted" class="block text-[11px] font-semibold mb-1" x-text="selectedCard.paymentBasis === 'MonthlyFee' ? 'Kuukausihinta (€)' : 'Tarjous / Budjetti (€)'"></label>
|
||
<input id="modalQuoted" type="number" step="10" x-model.number="selectedCard.quotedAmount" class="w-full px-2 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a] font-bold" />
|
||
</div>
|
||
<div>
|
||
<label for="modalPoRef" class="block text-[11px] font-semibold mb-1">Asiakkaan viite (PO)</label>
|
||
<input id="modalPoRef" type="text" x-model="selectedCard.customerReference" placeholder="PO-1234" class="w-full px-2 py-1.5 rounded-lg border border-neutral-300 dark:border-[#454952] bg-white dark:bg-[#24262a]" />
|
||
</div>
|
||
</div>
|
||
<div x-show="!canSeeMoney" class="p-2 rounded bg-neutral-200/70 dark:bg-[#24262a] text-[11px] text-neutral-500 dark:text-neutral-400">
|
||
Tarjous- ja laskutussummat on piilotettu käyttäjäroolilta (2.3 Rahamäärien näkyvyys).
|
||
</div>
|
||
</div>
|
||
</aside>
|
||
</div>
|
||
|
||
<!-- ALATUNNISTE -->
|
||
<div class="px-5 py-3 bg-neutral-100 dark:bg-[#18191b] border-t border-neutral-200 dark:border-[#36393f] flex items-center justify-between gap-2 shrink-0">
|
||
<span class="text-[11px] text-neutral-500 dark:text-neutral-400">Muutokset tallentuvat asiakastyölle ja kirjautuvat muutoshistoriaan.</span>
|
||
<button
|
||
type="button"
|
||
@click="$refs.cardModal.close(); toast('Asiakastyön muutokset tallennettu.')"
|
||
class="px-4 py-1.5 rounded-lg bg-primary-600 hover:bg-primary-700 text-white text-xs font-bold shadow-sm"
|
||
>
|
||
Tallenna & Sulje
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</dialog>
|
||
|
||
<!-- HOVER-TOOLTIP PITKILLE OTSIKOILLE -->
|
||
<div
|
||
x-show="tooltip.visible"
|
||
x-cloak
|
||
role="tooltip"
|
||
:style="`left: ${tooltip.x}px; top: ${tooltip.y}px;`"
|
||
class="fixed z-50 max-w-xs px-2.5 py-1.5 rounded-lg bg-neutral-900 text-white text-xs font-medium shadow-xl border border-neutral-700 pointer-events-none leading-snug"
|
||
x-text="tooltip.text"
|
||
></div>
|
||
|
||
<!-- KELLUVA VÄRIVALITSIN (COLOR PICKER + RGB + PIKAVÄRIT) -->
|
||
<div
|
||
x-show="activePicker !== null"
|
||
x-cloak
|
||
@click.stop
|
||
role="dialog"
|
||
aria-label="Otsikon taustavärin valitsin"
|
||
:style="`left: ${pickerPos.x}px; top: ${pickerPos.y}px;`"
|
||
class="fixed z-50 w-72 rounded-xl bg-white dark:bg-[#282a2e] border border-neutral-300 dark:border-[#3e4249] shadow-2xl p-3.5 space-y-3"
|
||
>
|
||
<div class="flex items-center justify-between">
|
||
<span class="text-xs font-bold text-neutral-900 dark:text-white" x-text="pickerTitle"></span>
|
||
<button type="button" @click="activePicker = null" aria-label="Sulje värivalitsin" class="p-1 rounded text-neutral-400 hover:text-neutral-700 dark:hover:text-white">
|
||
<svg class="w-3.5 h-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
|
||
</button>
|
||
</div>
|
||
|
||
<div>
|
||
<div class="text-[11px] font-medium text-neutral-500 dark:text-neutral-400 mb-1.5">Pikavärit</div>
|
||
<div class="grid grid-cols-6 gap-1.5">
|
||
<template x-for="swatch in presetColors" :key="swatch">
|
||
<button
|
||
type="button"
|
||
@click="setPickerHex(swatch)"
|
||
:aria-label="`Valitse väri ${swatch}`"
|
||
:style="`background-color: ${swatch};`"
|
||
class="w-full h-6 rounded-md border border-black/20 hover:scale-105 transition shadow-2xs"
|
||
></button>
|
||
</template>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="pt-2 border-t border-neutral-200 dark:border-[#36393f] space-y-2.5">
|
||
<div class="flex items-center justify-between gap-2">
|
||
<label for="nativeColorPicker" class="text-[11px] font-medium text-neutral-700 dark:text-neutral-300">Vapaa värivalitsin:</label>
|
||
<div class="flex items-center gap-2">
|
||
<span class="text-[11px] font-mono text-neutral-500 dark:text-neutral-400 uppercase" x-text="pickerHex"></span>
|
||
<input
|
||
type="color"
|
||
id="nativeColorPicker"
|
||
:value="pickerHex"
|
||
@input="setPickerHex($event.target.value)"
|
||
class="w-8 h-7 rounded cursor-pointer border border-neutral-300 dark:border-[#4b5058] bg-transparent p-0"
|
||
/>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="grid grid-cols-3 gap-2">
|
||
<div>
|
||
<label for="rgbR" class="block text-[10px] font-bold text-neutral-500 dark:text-neutral-400 mb-0.5">R (0–255)</label>
|
||
<input type="number" id="rgbR" min="0" max="255" x-model.number="pickerRgb.r" @input="updateHexFromRgb()" class="w-full px-2 py-1 text-xs font-mono rounded-md border border-neutral-300 dark:border-[#4b5058] bg-neutral-50 dark:bg-[#18191b] text-neutral-900 dark:text-white" />
|
||
</div>
|
||
<div>
|
||
<label for="rgbG" class="block text-[10px] font-bold text-neutral-500 dark:text-neutral-400 mb-0.5">G (0–255)</label>
|
||
<input type="number" id="rgbG" min="0" max="255" x-model.number="pickerRgb.g" @input="updateHexFromRgb()" class="w-full px-2 py-1 text-xs font-mono rounded-md border border-neutral-300 dark:border-[#4b5058] bg-neutral-50 dark:bg-[#18191b] text-neutral-900 dark:text-white" />
|
||
</div>
|
||
<div>
|
||
<label for="rgbB" class="block text-[10px] font-bold text-neutral-500 dark:text-neutral-400 mb-0.5">B (0–255)</label>
|
||
<input type="number" id="rgbB" min="0" max="255" x-model.number="pickerRgb.b" @input="updateHexFromRgb()" class="w-full px-2 py-1 text-xs font-mono rounded-md border border-neutral-300 dark:border-[#4b5058] bg-neutral-50 dark:bg-[#18191b] text-neutral-900 dark:text-white" />
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div x-show="pickerType === 'card'" class="pt-2 border-t border-neutral-200 dark:border-[#36393f]">
|
||
<label class="flex items-center gap-2 text-xs text-neutral-700 dark:text-neutral-300 cursor-pointer">
|
||
<input type="checkbox" x-model="saveCustomerDefault" class="rounded border-neutral-300 text-primary-600 focus:ring-primary-600" />
|
||
<span>Tallenna asiakkaan oletusväriksi</span>
|
||
</label>
|
||
</div>
|
||
|
||
<div class="flex justify-end gap-1.5 pt-1">
|
||
<button type="button" @click="activePicker = null" class="px-2.5 py-1 text-xs font-medium rounded-md border border-neutral-300 dark:border-[#4b5058] text-neutral-700 dark:text-neutral-200 hover:bg-neutral-100 dark:hover:bg-[#32353b]">
|
||
Peruuta
|
||
</button>
|
||
<button type="button" @click="applyPickedColor()" class="px-3 py-1 text-xs font-semibold rounded-md bg-primary-600 hover:bg-primary-700 text-white">
|
||
Käytä väriä
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- PIKAVASTAANOTTOMODAALI -->
|
||
<dialog x-ref="intakeDialog" aria-labelledby="intakeTitle" class="rounded-2xl p-0 w-full max-w-md bg-white dark:bg-[#282a2e] text-neutral-900 dark:text-neutral-100 border border-neutral-300 dark:border-[#3e4249] shadow-2xl backdrop:bg-black/60">
|
||
<form @submit.prevent="submitIntake()" class="p-5 space-y-4">
|
||
<div class="flex items-center justify-between border-b border-neutral-200 dark:border-[#36393f] pb-3">
|
||
<h2 id="intakeTitle" class="text-base font-bold">Uusi työ / Pikavastaanotto</h2>
|
||
<button type="button" @click="$refs.intakeDialog.close()" aria-label="Sulje ikkuna" class="p-1 rounded-lg text-neutral-400 hover:text-neutral-700 dark:hover:text-white">
|
||
<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
|
||
</button>
|
||
</div>
|
||
|
||
<div class="space-y-3">
|
||
<div>
|
||
<label for="intakeCustomer" class="block text-xs font-semibold mb-1">Asiakas *</label>
|
||
<select id="intakeCustomer" x-model="intakeForm.customer" required class="w-full px-3 py-2 text-xs rounded-lg border border-neutral-300 dark:border-[#4b5058] bg-neutral-50 dark:bg-[#18191b] text-neutral-900 dark:text-white">
|
||
<template x-for="cust in Object.keys(customerContacts)" :key="cust">
|
||
<option :value="cust" x-text="cust"></option>
|
||
</template>
|
||
</select>
|
||
</div>
|
||
|
||
<div>
|
||
<div class="flex items-center justify-between mb-1">
|
||
<label for="intakeContact" class="text-xs font-semibold">Asiakkaan kontaktihenkilö</label>
|
||
<button type="button" @click="intakeForm.addingNewContact = !intakeForm.addingNewContact" class="text-[11px] font-semibold text-primary-600 dark:text-indigo-400 hover:underline">
|
||
+ Pikalisää uusi
|
||
</button>
|
||
</div>
|
||
<select id="intakeContact" x-model="intakeForm.contact" class="w-full px-3 py-2 text-xs rounded-lg border border-neutral-300 dark:border-[#4b5058] bg-neutral-50 dark:bg-[#18191b] text-neutral-900 dark:text-white">
|
||
<option value="">-- Ei valittua yhteyshenkilöä --</option>
|
||
<template x-for="c in (customerContacts[intakeForm.customer] || [])" :key="c">
|
||
<option :value="c" x-text="c"></option>
|
||
</template>
|
||
</select>
|
||
<div x-show="intakeForm.addingNewContact" x-cloak class="mt-2">
|
||
<input type="text" x-model="intakeForm.newContact" placeholder="Uusi kontakti (esim. Ville Virtanen, 040 123 4567)" class="w-full px-3 py-1.5 text-xs rounded-lg border border-indigo-400 dark:border-indigo-500 bg-indigo-50/40 dark:bg-[#1e2026] text-neutral-900 dark:text-white" />
|
||
</div>
|
||
</div>
|
||
|
||
<div>
|
||
<label for="intakeName" class="block text-xs font-semibold mb-1">Asiakastyön nimi *</label>
|
||
<input type="text" id="intakeName" x-model="intakeForm.title" required placeholder="esim. Pakettiauton kylkiteippaukset" class="w-full px-3 py-2 text-xs rounded-lg border border-neutral-300 dark:border-[#4b5058] bg-neutral-50 dark:bg-[#18191b] text-neutral-900 dark:text-white" />
|
||
</div>
|
||
|
||
<div class="grid grid-cols-2 gap-3">
|
||
<div>
|
||
<label for="intakeUnit" class="block text-xs font-semibold mb-1">Palveluyksikkö *</label>
|
||
<select id="intakeUnit" x-model="intakeForm.serviceUnit" class="w-full px-3 py-2 text-xs rounded-lg border border-neutral-300 dark:border-[#4b5058] bg-neutral-50 dark:bg-[#18191b] text-neutral-900 dark:text-white">
|
||
<option value="Painotuotanto">Painotuotanto</option>
|
||
<option value="Mediatuotanto">Mediatuotanto</option>
|
||
<option value="Markkinointi">Markkinointi</option>
|
||
<option value="Verkkosivut">Verkkosivut</option>
|
||
</select>
|
||
</div>
|
||
<div>
|
||
<label for="intakeAssignee" class="block text-xs font-semibold mb-1">Oma vastuuhenkilö *</label>
|
||
<select id="intakeAssignee" x-model="intakeForm.assignee" class="w-full px-3 py-2 text-xs rounded-lg border border-neutral-300 dark:border-[#4b5058] bg-neutral-50 dark:bg-[#18191b] text-neutral-900 dark:text-white">
|
||
<option value="Jussi Mäkelä">Jussi Mäkelä</option>
|
||
<option value="Anna Korhonen">Anna Korhonen</option>
|
||
<option value="Mikko Salonen">Mikko Salonen</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="grid grid-cols-2 gap-3">
|
||
<div>
|
||
<label for="intakeStatus" class="block text-xs font-semibold mb-1">Alkutila</label>
|
||
<select id="intakeStatus" x-model="intakeForm.status" class="w-full px-3 py-2 text-xs rounded-lg border border-neutral-300 dark:border-[#4b5058] bg-neutral-50 dark:bg-[#18191b] text-neutral-900 dark:text-white">
|
||
<option value="Tentative">Alustava</option>
|
||
<option value="QuoteRequest">Tarjouspyyntö</option>
|
||
<option value="Order">Jonossa (Tilaus)</option>
|
||
<option value="InProduction">Työn alla (Tuotannossa)</option>
|
||
</select>
|
||
</div>
|
||
<div>
|
||
<label for="intakePrio" class="block text-xs font-semibold mb-1">Prioriteetti</label>
|
||
<select id="intakePrio" x-model="intakeForm.priority" class="w-full px-3 py-2 text-xs rounded-lg border border-neutral-300 dark:border-[#4b5058] bg-neutral-50 dark:bg-[#18191b] text-neutral-900 dark:text-white">
|
||
<option value="Normal">Normaali</option>
|
||
<option value="First">Ensin</option>
|
||
<option value="Urgent">Kiire</option>
|
||
<option value="Immediate">Heti</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="flex justify-end gap-2 pt-3 border-t border-neutral-200 dark:border-[#36393f]">
|
||
<button type="button" @click="$refs.intakeDialog.close()" class="px-3 py-1.5 text-xs font-medium rounded-lg border border-neutral-300 dark:border-[#4b5058] text-neutral-700 dark:text-neutral-200 hover:bg-neutral-100 dark:hover:bg-[#32353b]">
|
||
Peruuta
|
||
</button>
|
||
<button type="submit" class="px-4 py-1.5 text-xs font-bold rounded-lg bg-primary-600 hover:bg-primary-700 text-white shadow-sm">
|
||
Tallenna työ
|
||
</button>
|
||
</div>
|
||
</form>
|
||
</dialog>
|
||
|
||
<!-- STATUS-ILMOITUS (TOAST) -->
|
||
<div x-show="toastMessage" x-cloak role="status" aria-live="polite" class="fixed bottom-4 right-4 z-50 px-3.5 py-2 rounded-xl bg-neutral-900 text-white text-xs font-medium shadow-xl border border-neutral-700" x-text="toastMessage"></div>
|
||
|
||
<script>
|
||
function kanbanApp() {
|
||
return {
|
||
darkMode: true,
|
||
boardFilter: 'my',
|
||
pipelineView: 'production',
|
||
density: 'normal',
|
||
filterUrgent: false,
|
||
filterOverdue: false,
|
||
urgentThreshold: 'Urgent',
|
||
urgentMenuOpen: false,
|
||
activeSortMenuCol: null,
|
||
selectedCard: null,
|
||
modalTab: 'hours',
|
||
canSeeMoney: true,
|
||
newModalTaskTitle: '',
|
||
newModalTaskAssignee: 'Jussi Mäkelä',
|
||
newModalTaskPin: false,
|
||
inlineSubInputs: {},
|
||
inlineSubPin: {},
|
||
taskChecklistInputs: {},
|
||
selectedWorkflowTemplate: '',
|
||
addingLink: false,
|
||
newLinkTitle: '',
|
||
newLinkUrl: '',
|
||
newTagInput: '',
|
||
quickHoursAmount: 1.5,
|
||
quickHoursNote: '',
|
||
quickExpenseDesc: '',
|
||
quickExpenseAmount: 0,
|
||
columnSortModes: {
|
||
QuotesCombined: 'manual',
|
||
Prospect: 'manual',
|
||
Tentative: 'manual',
|
||
QuoteRequest: 'manual',
|
||
Order: 'manual',
|
||
InProduction: 'manual',
|
||
InProductionUrgent: 'manual',
|
||
OnHold: 'manual',
|
||
Done: 'manual',
|
||
Invoiced: 'manual',
|
||
Billed: 'manual',
|
||
Ongoing: 'manual'
|
||
},
|
||
expandedIds: ['ongoing-futsal', 'ongoing-ht'],
|
||
|
||
draggedCardId: null,
|
||
dragOverColId: null,
|
||
dropTargetCardId: null,
|
||
dropPosition: 'before',
|
||
|
||
activePicker: null,
|
||
pickerType: null,
|
||
pickerTargetId: null,
|
||
pickerTitle: '',
|
||
pickerHex: '#1d4ed8',
|
||
pickerRgb: { r: 29, g: 78, b: 216 },
|
||
pickerPos: { x: 200, y: 120 },
|
||
saveCustomerDefault: true,
|
||
|
||
tooltip: { visible: false, text: '', x: 0, y: 0 },
|
||
toastMessage: '',
|
||
toastTimer: null,
|
||
|
||
presetColors: [
|
||
'#1d4ed8', '#23476a', '#0f5c63', '#14532d', '#047857', '#3b2d5e',
|
||
'#7c2d2d', '#b91c1c', '#9a3412', '#78350f', '#b45309', '#374151'
|
||
],
|
||
|
||
thresholdOptions: [
|
||
{ key: 'Immediate', minRank: 5, label: 'Vain Heti' },
|
||
{ key: 'Urgent', minRank: 4, label: 'Kiire & Heti' },
|
||
{ key: 'First', minRank: 3, label: 'Ensin, Kiire & Heti' }
|
||
],
|
||
|
||
priorities: {
|
||
Immediate: { label: 'Heti', rank: 5, badge: 'bg-orange-100 text-red-950 border-orange-400 dark:bg-orange-950 dark:text-orange-200 dark:border-orange-700' },
|
||
Urgent: { label: 'Kiire', rank: 4, badge: 'bg-red-100 text-red-900 border-red-300 dark:bg-red-950 dark:text-red-200 dark:border-red-800' },
|
||
First: { label: 'Ensin', rank: 3, badge: 'bg-amber-100 text-amber-950 border-amber-300 dark:bg-amber-950 dark:text-amber-200 dark:border-amber-800' },
|
||
Normal: { label: 'Normaali', rank: 2, badge: 'bg-emerald-100 text-emerald-900 border-emerald-300 dark:bg-emerald-950 dark:text-emerald-200 dark:border-emerald-800' },
|
||
Waiting: { label: 'Odottaa', rank: 1, badge: 'bg-blue-100 text-blue-900 border-blue-300 dark:bg-blue-950 dark:text-blue-200 dark:border-blue-800' }
|
||
},
|
||
|
||
columnColors: {
|
||
QuotesCombined: '#4338ca',
|
||
Prospect: '#374151',
|
||
Tentative: '#4338ca',
|
||
QuoteRequest: '#6d28d9',
|
||
Order: '#23476a',
|
||
InProduction: '#1d4ed8',
|
||
InProductionUrgent: '#1d4ed8',
|
||
OnHold: '#78350f',
|
||
Done: '#14532d',
|
||
Invoiced: '#0f5c63',
|
||
Billed: '#065f46',
|
||
Ongoing: '#3b2d5e'
|
||
},
|
||
|
||
customerColors: {
|
||
'Ässä KP Oy': '#991b1b',
|
||
'Stokker Oy': '#9a3412',
|
||
'HT-Asennus Oy': '#1e40af',
|
||
'Loimaan Kaupunki': '#065f46',
|
||
'Agrikumppani Oy': '#3f6212',
|
||
'AU Futsal': '#4c1d95',
|
||
'Pöytyän kunta': '#0f5c63',
|
||
'Convert Tampere': '#374151',
|
||
'Kieku Oy': '#4338ca',
|
||
'MHY.fi': '#14532d'
|
||
},
|
||
|
||
customerContacts: {
|
||
'Ässä KP Oy': ['Kalle Lehtinen (Työnjohto)', 'Sami Korhonen (Kalusto)'],
|
||
'Stokker Oy': ['Pekka Nieminen (Markkinointi)'],
|
||
'HT-Asennus Oy': ['Heikki Tuominen (Toimitusjohtaja)'],
|
||
'Loimaan Kaupunki': ['Sari Koskinen (Viestintä)'],
|
||
'Agrikumppani Oy': ['Antti Rantanen (Myynti)'],
|
||
'AU Futsal': ['Matti Laine (Otteluvastaava)'],
|
||
'Pöytyän kunta': ['Tuula Hakala (Viestintäpäällikkö)'],
|
||
'Convert Tampere': ['Jari Koski (Tuotanto)'],
|
||
'Kieku Oy': ['Mikko Toivonen (Tuoteomistaja)'],
|
||
'MHY.fi': ['Laura Salo (Markkinointi)']
|
||
},
|
||
|
||
intakeForm: {
|
||
customer: 'Ässä KP Oy',
|
||
contact: '',
|
||
addingNewContact: false,
|
||
newContact: '',
|
||
title: '',
|
||
serviceUnit: 'Painotuotanto',
|
||
assignee: 'Jussi Mäkelä',
|
||
status: 'Order',
|
||
priority: 'Normal'
|
||
},
|
||
|
||
columns: [
|
||
{ id: 'QuotesCombined', status: 'QuoteRequest', title: 'Tarjoukset', kind: 'production_quotes', statuses: ['Prospect', 'Tentative', 'QuoteRequest'], iconSvg: '<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg>' },
|
||
{ id: 'Prospect', status: 'Prospect', title: 'Prospekti', kind: 'sales', iconSvg: '<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>' },
|
||
{ id: 'Tentative', status: 'Tentative', title: 'Alustava', kind: 'sales', iconSvg: '<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>' },
|
||
{ id: 'QuoteRequest', status: 'QuoteRequest', title: 'Tarjouspyyntö', kind: 'sales', iconSvg: '<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg>' },
|
||
{ id: 'Order', status: 'Order', title: 'Jonossa', kind: 'production', iconSvg: '<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/></svg>' },
|
||
{ id: 'InProduction', status: 'InProduction', title: 'Työn alla', kind: 'production', isNormalLane: true, iconSvg: '<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><polygon points="10 8 16 12 10 16 10 8"/></svg>' },
|
||
{ id: 'InProductionUrgent', status: 'InProduction', title: 'Työn alla • Kiire', kind: 'production', isUrgentLane: true, iconSvg: '<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"/></svg>' },
|
||
{ id: 'OnHold', status: 'OnHold', title: 'Odottaa asiakasta', kind: 'production', iconSvg: '<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>' },
|
||
{ id: 'Done', status: 'Done', title: 'Valmis • Laskuta', kind: 'production', iconSvg: '<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>' },
|
||
{ id: 'Invoiced', status: 'Invoiced', title: 'Lasku luotu', kind: 'billing', iconSvg: '<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="5" width="20" height="14" rx="2"/><line x1="2" y1="10" x2="22" y2="10"/></svg>' },
|
||
{ id: 'Billed', status: 'Billed', title: 'Laskutettu', kind: 'billing', iconSvg: '<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="20 6 9 17 4 12"/></svg>' },
|
||
{ id: 'Ongoing', status: 'Ongoing', title: 'Jatkuvat & Kausi', kind: 'ongoing', iconSvg: '<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m17 2 4 4-4 4"/><path d="M3 11v-1a4 4 0 0 1 4-4h14"/><path d="m7 22-4-4 4-4"/><path d="M21 13v1a4 4 0 0 1-4 4H3"/></svg>' }
|
||
],
|
||
|
||
cards: [
|
||
{
|
||
id: 'quote-201', cardType: 'job', boardPosition: 10, number: '2026-0155', customer: 'Kieku Oy',
|
||
title: 'Tuottajasovellus – muutos 2 ja raportointinäkymä',
|
||
serviceUnit: 'Verkkosivut', status: 'Prospect', priority: 'Normal',
|
||
dueDate: '10.12.', isOverdue: false, loggedHours: 0.0, estimatedHours: 16.0,
|
||
assignee: 'Jussi Mäkelä', members: ['Jussi Mäkelä'],
|
||
tasks: [
|
||
{ id: 'qt-1', title: 'Vaatimusmäärittelyn läpikäynti', assignee: 'Jussi Mäkelä', status: 'InProgress', dueDate: '05.12.', checklist: [] },
|
||
{ id: 'qt-2', title: 'Työmääräarvion koostaminen', assignee: 'Jussi Mäkelä', status: 'Waiting', dueDate: '10.12.', checklist: [] }
|
||
]
|
||
},
|
||
{
|
||
id: 'quote-202', cardType: 'job', boardPosition: 20, number: '2026-0152', customer: 'Pöytyän kunta',
|
||
title: 'Yritysvideot – 3 osainen esittelysarja (Alustava)',
|
||
serviceUnit: 'Mediatuotanto', status: 'Tentative', priority: 'First',
|
||
dueDate: '06.12.', isOverdue: false, loggedHours: 1.0, estimatedHours: 24.0,
|
||
assignee: 'Jussi Mäkelä', members: ['Jussi Mäkelä', 'Anna Korhonen'],
|
||
tasks: [
|
||
{ id: 'qt-3', title: 'Kuvauspaikkojen kartoitus', assignee: 'Anna Korhonen', status: 'Done', dueDate: '02.12.', checklist: [] },
|
||
{ id: 'qt-4', title: 'Käsikirjoitusluonnos ja tarjouslaskenta', assignee: 'Jussi Mäkelä', status: 'InProgress', dueDate: '06.12.', checklist: [] }
|
||
]
|
||
},
|
||
{
|
||
id: 'quote-203', cardType: 'job', boardPosition: 30, number: '2026-0149', customer: 'MHY.fi',
|
||
title: 'Messuseinäkkeet ja roll-upit kevään metsämessuille',
|
||
serviceUnit: 'Painotuotanto', status: 'QuoteRequest', priority: 'Normal',
|
||
dueDate: '04.12.', isOverdue: false, loggedHours: 0.5, estimatedHours: 6.0,
|
||
assignee: 'Jussi Mäkelä', members: ['Jussi Mäkelä'],
|
||
tasks: [
|
||
{ id: 'qt-5', title: 'Materiaalivaihtoehtojen hinnoittelu', assignee: 'Jussi Mäkelä', status: 'Done', dueDate: '01.12.', checklist: [] },
|
||
{ id: 'qt-6', title: 'Tarjouksen lähetys asiakkaalle', assignee: 'Jussi Mäkelä', status: 'Waiting', dueDate: '04.12.', checklist: [] }
|
||
]
|
||
},
|
||
{
|
||
id: 'job-101', cardType: 'job', boardPosition: 10, number: '2026-0141', customer: 'Ässä KP Oy',
|
||
title: 'Kaivuriteipit ja turvamerkinnät (Volvo EC220)',
|
||
serviceUnit: 'Painotuotanto', status: 'Order', priority: 'Urgent',
|
||
dueDate: '03.12.', isOverdue: false, loggedHours: 0.5, estimatedHours: 4.0,
|
||
assignee: 'Jussi Mäkelä', members: ['Jussi Mäkelä'],
|
||
tasks: [
|
||
{ id: 't-1', title: 'Aineiston tarkistus ja leikkuulinjat', assignee: 'Jussi Mäkelä', status: 'Done', dueDate: '01.12.', checklist: [] },
|
||
{ id: 't-2', title: 'Suurkuvatulostus ja laminointi', assignee: 'Jussi Mäkelä', status: 'Waiting', dueDate: '02.12.', checklist: [] },
|
||
{ id: 't-3', title: 'Asennus asiakkaan hallilla', assignee: 'Jussi Mäkelä', status: 'Waiting', dueDate: '03.12.', checklist: [] }
|
||
]
|
||
},
|
||
{
|
||
id: 'job-102', cardType: 'job', boardPosition: 20, number: '2026-0145', customer: 'Agrikumppani Oy',
|
||
title: 'Brodeeratut lippikset 50 kpl ja työvaatepainatukset',
|
||
serviceUnit: 'Painotuotanto', status: 'Order', priority: 'Normal',
|
||
dueDate: '11.12.', isOverdue: false, loggedHours: 0.0, estimatedHours: 3.0,
|
||
assignee: 'Anna Korhonen', members: ['Anna Korhonen', 'Jussi Mäkelä'],
|
||
tasks: [
|
||
{ id: 't-4', title: 'Logon vektorointi ja vedos', assignee: 'Anna Korhonen', status: 'Waiting', dueDate: '08.12.', checklist: [] },
|
||
{ id: 't-5', title: 'Siirtokuvien prässäys', assignee: 'Anna Korhonen', status: 'Waiting', dueDate: '11.12.', checklist: [] }
|
||
]
|
||
},
|
||
{
|
||
id: 'job-105', cardType: 'job', boardPosition: 10, number: '2026-0142', customer: 'Stokker Oy',
|
||
title: 'Joulukuvasto 1 – A4 32-sivuinen taitto ja painatus',
|
||
serviceUnit: 'Painotuotanto', status: 'InProduction', priority: 'First',
|
||
dueDate: '05.12.', isOverdue: false, loggedHours: 4.5, estimatedHours: 10.0,
|
||
assignee: 'Jussi Mäkelä', members: ['Jussi Mäkelä', 'Anna Korhonen'],
|
||
tasks: [
|
||
{ id: 't-11', title: 'Tuotekuvien syväys', assignee: 'Anna Korhonen', status: 'Done', dueDate: '01.12.', checklist: [] },
|
||
{ id: 't-12', title: 'Sivujen 1–16 taitto', assignee: 'Jussi Mäkelä', status: 'Done', dueDate: '02.12.', checklist: [] },
|
||
{ id: 't-13', title: 'Sivujen 17–32 taitto', assignee: 'Jussi Mäkelä', status: 'InProgress', dueDate: '04.12.', checklist: [] },
|
||
{ id: 't-14', title: 'Paino-PDF ja vedostus', assignee: 'Jussi Mäkelä', status: 'Waiting', dueDate: '05.12.', checklist: [] }
|
||
]
|
||
},
|
||
{
|
||
id: 'job-106', cardType: 'job', boardPosition: 20, number: '2026-0150', customer: 'Loimaan Kaupunki',
|
||
title: 'Tapahtumakalenterin ulkoasupäivitys ja saavutettavuus',
|
||
serviceUnit: 'Verkkosivut', status: 'InProduction', priority: 'Normal',
|
||
dueDate: '12.12.', isOverdue: false, loggedHours: 3.0, estimatedHours: 8.0,
|
||
assignee: 'Anna Korhonen', members: ['Anna Korhonen', 'Jussi Mäkelä'],
|
||
tasks: [
|
||
{ id: 't-15', title: 'Värikontrastien tarkistus', assignee: 'Anna Korhonen', status: 'Done', dueDate: '05.12.', checklist: [] },
|
||
{ id: 't-16', title: 'Mobiilinäkymän korjaukset', assignee: 'Anna Korhonen', status: 'InProgress', dueDate: '12.12.', checklist: [] }
|
||
]
|
||
},
|
||
{
|
||
id: 'promoted-ht-vko49', cardType: 'promoted_task', boardPosition: 30,
|
||
parentJobId: 'ongoing-ht', parentTaskId: 'ot-ht-1',
|
||
parentJobTitle: 'HT-Asennus Oy • Somemarkkinointi',
|
||
customer: 'HT-Asennus Oy',
|
||
title: 'Vko 49 somejulkaisu: Talvihuoltokampanja ja kuvaus',
|
||
serviceUnit: 'Markkinointi', status: 'InProduction', priority: 'Normal',
|
||
dueDate: '04.12.', isOverdue: false, loggedHours: 1.5, estimatedHours: 3.0,
|
||
assignee: 'Jussi Mäkelä', members: ['Jussi Mäkelä']
|
||
},
|
||
{
|
||
id: 'job-103', cardType: 'job', boardPosition: 10, number: '2026-0138', customer: 'Ässä KP Oy',
|
||
title: 'Punainen pitkä Vito – täysyliteippaus ja heijastimet',
|
||
serviceUnit: 'Painotuotanto', status: 'InProduction', priority: 'Immediate',
|
||
dueDate: '29.11.', isOverdue: true, loggedHours: 6.5, estimatedHours: 8.0,
|
||
assignee: 'Jussi Mäkelä', members: ['Jussi Mäkelä'],
|
||
tasks: [
|
||
{ id: 't-6', title: 'Kylkiteippien tulostus', assignee: 'Jussi Mäkelä', status: 'Done', dueDate: '27.11.', checklist: [] },
|
||
{ id: 't-7', title: 'Oikean kyljen ja perän asennus', assignee: 'Jussi Mäkelä', status: 'InProgress', dueDate: '29.11.', checklist: [] },
|
||
{ id: 't-8', title: 'Viimeistely ja luovutus', assignee: 'Jussi Mäkelä', status: 'Waiting', dueDate: '29.11.', checklist: [] }
|
||
]
|
||
},
|
||
{
|
||
id: 'job-104', cardType: 'job', boardPosition: 20, number: '2026-0148', customer: 'Ässä KP Oy',
|
||
title: 'Transporter huoltoauton pikateippaus ennen katsastusta',
|
||
serviceUnit: 'Painotuotanto', status: 'InProduction', priority: 'Urgent',
|
||
dueDate: '01.12.', isOverdue: false, loggedHours: 2.0, estimatedHours: 4.5,
|
||
assignee: 'Jussi Mäkelä', members: ['Jussi Mäkelä'],
|
||
tasks: [
|
||
{ id: 't-9', title: 'Tarraleikkaus Rolandilla', assignee: 'Jussi Mäkelä', status: 'Done', dueDate: '30.11.', checklist: [] },
|
||
{ id: 't-10', title: 'Teippien asennus', assignee: 'Jussi Mäkelä', status: 'InProgress', dueDate: '01.12.', checklist: [] }
|
||
]
|
||
},
|
||
{
|
||
id: 'job-107', cardType: 'job', boardPosition: 10, number: '2026-0134', customer: 'Loimaan Kaupunki',
|
||
title: 'Matkailuesitteen karttaliitteet ja vedoshyväksyntä',
|
||
serviceUnit: 'Markkinointi', status: 'OnHold', priority: 'Normal',
|
||
dueDate: '08.12.', isOverdue: false, loggedHours: 3.5, estimatedHours: 5.0,
|
||
assignee: 'Jussi Mäkelä', members: ['Jussi Mäkelä'],
|
||
tasks: [
|
||
{ id: 't-17', title: 'Vedos lähetetty asiakkaalle', assignee: 'Jussi Mäkelä', status: 'Done', dueDate: '28.11.', checklist: [] },
|
||
{ id: 't-18', title: 'Painatus hyväksynnän jälkeen', assignee: 'Jussi Mäkelä', status: 'Waiting', dueDate: '08.12.', checklist: [] }
|
||
]
|
||
},
|
||
{
|
||
id: 'job-108', cardType: 'job', boardPosition: 10, number: '2026-0129', customer: 'Convert Tampere',
|
||
title: 'Vihkot, käyntikortit ja tarrat (toimitettu)',
|
||
serviceUnit: 'Painotuotanto', status: 'Done', priority: 'Normal',
|
||
dueDate: '27.11.', isOverdue: false, loggedHours: 7.5, estimatedHours: 7.5,
|
||
assignee: 'Jussi Mäkelä', members: ['Jussi Mäkelä'],
|
||
tasks: [
|
||
{ id: 't-19', title: 'Painatus ja viimeistely', assignee: 'Jussi Mäkelä', status: 'Done', dueDate: '26.11.', checklist: [] },
|
||
{ id: 't-20', title: 'Toimitus ja kuittaus', assignee: 'Jussi Mäkelä', status: 'Done', dueDate: '27.11.', checklist: [] }
|
||
]
|
||
},
|
||
{
|
||
id: 'ongoing-futsal', cardType: 'ongoing_live', boardPosition: 10, number: '2026-0088', customer: 'AU Futsal',
|
||
title: 'Futsal – LIVE – Kausi 26–27 (Monikameratuotanto)',
|
||
serviceUnit: 'Mediatuotanto', status: 'Ongoing', priority: 'Normal',
|
||
dueDate: 'Kausi 26–27', isOverdue: false, loggedHours: 18.0, estimatedHours: 60.0,
|
||
assignee: 'Jussi Mäkelä', members: ['Jussi Mäkelä', 'Anna Korhonen'],
|
||
subItems: [
|
||
{ id: 'of-1', label: 'SU 20.9. klo 14:00 AU – FC Kemi', done: true, flexible: false, assignee: 'Jussi Mäkelä' },
|
||
{ id: 'of-2', label: 'LA 10.10. klo 15:00 AU – KF Kosova', done: true, flexible: false, assignee: 'Jussi Mäkelä' },
|
||
{ id: 'of-3', label: 'SU 6.12. klo 13:00 AU – Riemu', done: false, flexible: false, assignee: 'Jussi Mäkelä' },
|
||
{ id: 'of-4', label: 'LA 12.12. klo 15:00 AU – SoVo', done: false, flexible: false, assignee: 'Anna Korhonen' }
|
||
]
|
||
},
|
||
{
|
||
id: 'ongoing-ht', cardType: 'ongoing_contract', boardPosition: 20, number: '2026-0092', customer: 'HT-Asennus Oy',
|
||
title: 'Kuukausisopimus: Somemarkkinointi ja sisällöntuotanto',
|
||
serviceUnit: 'Markkinointi', status: 'Ongoing', priority: 'Normal',
|
||
dueDate: 'Jatkuva kk', isOverdue: false, loggedHours: 6.5, estimatedHours: 12.0,
|
||
assignee: 'Jussi Mäkelä', members: ['Jussi Mäkelä'],
|
||
subItems: [
|
||
{ id: 'ot-ht-1', label: 'Vko 49 somejulkaisu: Talvihuoltokampanja', done: false, flexible: true, assignee: 'Jussi Mäkelä', pinnedCardId: 'promoted-ht-vko49' },
|
||
{ id: 'ot-ht-2', label: 'Vko 50 somejulkaisu: Joulutervehdys & referenssi', done: false, flexible: true, assignee: 'Jussi Mäkelä', pinnedCardId: null },
|
||
{ id: 'ot-ht-3', label: 'Kuukausiraportti ja mainosbudjetin tarkistus', done: false, flexible: true, assignee: 'Jussi Mäkelä', pinnedCardId: null }
|
||
]
|
||
}
|
||
],
|
||
|
||
// --- KORTTIMODAALI & TÄYSI ASIAKASTYÖN MUOKKAUS ---
|
||
openCardModal(card) {
|
||
this.hideTooltip();
|
||
if (!card.description) card.description = 'Asiakkaan tilauksen tarkempi erittely ja toimitussisältö.';
|
||
if (!card.instructions) card.instructions = 'Tarkista aineisto ennen tulostusta/julkaisua. Kirjaa tunnit tehtäväkohtaisesti.';
|
||
if (!card.customerContact) card.customerContact = (this.customerContacts[card.customer] && this.customerContacts[card.customer][0]) || '';
|
||
if (!card.billingUnit) card.billingUnit = 'Päälaskutus (Verkkolasku)';
|
||
if (!card.contactUser) card.contactUser = card.assignee;
|
||
if (!card.billerUser) card.billerUser = 'Jussi Mäkelä';
|
||
if (!card.jobKind) card.jobKind = card.subItems ? 'Ongoing' : 'OneOff';
|
||
if (!card.startsOn) card.startsOn = '24.11.';
|
||
if (!card.plannedWindow) card.plannedWindow = 'Vko 49';
|
||
if (!card.paymentBasis) card.paymentBasis = card.subItems ? 'MonthlyFee' : 'Hourly';
|
||
if (card.quotedAmount === undefined) card.quotedAmount = 1250;
|
||
if (!card.customerReference) card.customerReference = '';
|
||
if (!card.tags) card.tags = [card.serviceUnit, '2026'];
|
||
if (!card.links) card.links = [{ title: 'Asiakkaan aineistokansio (Drive)', url: 'https://drive.google.com' }];
|
||
if (!card.expenses) card.expenses = [];
|
||
if (!card.history) card.history = [{ user: 'Jussi Mäkelä', text: 'Asiakastyö luotu järjestelmään', time: '24.11. klo 09:15' }];
|
||
|
||
this.selectedCard = card;
|
||
this.newModalTaskTitle = '';
|
||
this.newModalTaskAssignee = card.assignee || 'Jussi Mäkelä';
|
||
this.newModalTaskPin = false;
|
||
this.selectedWorkflowTemplate = '';
|
||
this.addingLink = false;
|
||
this.modalTab = 'hours';
|
||
this.$refs.cardModal.showModal();
|
||
},
|
||
|
||
logChange(field, value) {
|
||
if (!this.selectedCard) return;
|
||
if (!this.selectedCard.history) this.selectedCard.history = [];
|
||
this.selectedCard.history.unshift({
|
||
user: 'Jussi Mäkelä',
|
||
text: `${field} → ${value}`,
|
||
time: 'Juuri nyt'
|
||
});
|
||
},
|
||
|
||
updateModalStatus(newStatus) {
|
||
if (!this.selectedCard) return;
|
||
this.selectedCard.status = newStatus;
|
||
this.logChange('Tila', newStatus);
|
||
this.toast(newStatus === 'Done' ? 'Työ merkitty valmiiksi (tunnit ja kulut lukittu).' : `Tila päivitetty: ${newStatus}`);
|
||
},
|
||
|
||
addModalTask() {
|
||
if (!this.selectedCard || !this.newModalTaskTitle.trim()) return;
|
||
const title = this.newModalTaskTitle.trim();
|
||
const assignee = this.newModalTaskAssignee || this.selectedCard.assignee;
|
||
|
||
if (this.selectedCard.subItems) {
|
||
const newSubId = 'sub-' + Date.now();
|
||
this.selectedCard.subItems.push({
|
||
id: newSubId,
|
||
label: title,
|
||
done: false,
|
||
flexible: true,
|
||
assignee,
|
||
pinnedCardId: null
|
||
});
|
||
this.logChange('Lisätty jakso/tehtävä', title);
|
||
if (this.newModalTaskPin) {
|
||
this.togglePinSubItem(this.selectedCard.id, newSubId);
|
||
} else {
|
||
this.toast(`Tehtävä lisätty jatkuvalle työlle: "${title}".`);
|
||
}
|
||
} else if (this.selectedCard.tasks) {
|
||
this.selectedCard.tasks.push({
|
||
id: 't-' + Date.now(),
|
||
title,
|
||
assignee,
|
||
status: 'Waiting',
|
||
dueDate: this.selectedCard.dueDate || '15.12.',
|
||
checklist: []
|
||
});
|
||
this.logChange('Lisätty tehtävä', title);
|
||
this.toast(`Uusi tehtävä lisätty: "${title}".`);
|
||
}
|
||
|
||
this.newModalTaskTitle = '';
|
||
this.newModalTaskPin = false;
|
||
},
|
||
|
||
addInlineSubItem(cardId) {
|
||
const text = (this.inlineSubInputs[cardId] || '').trim();
|
||
if (!text) return;
|
||
const card = this.cards.find(c => c.id === cardId);
|
||
if (!card || !card.subItems) return;
|
||
|
||
const newSubId = 'sub-' + Date.now();
|
||
card.subItems.push({
|
||
id: newSubId,
|
||
label: text,
|
||
done: false,
|
||
flexible: true,
|
||
assignee: card.assignee,
|
||
pinnedCardId: null
|
||
});
|
||
this.inlineSubInputs[cardId] = '';
|
||
|
||
if (this.inlineSubPin[cardId]) {
|
||
this.inlineSubPin[cardId] = false;
|
||
this.togglePinSubItem(cardId, newSubId);
|
||
} else {
|
||
this.toast(`Lisätty tehtävä/jakso kortille "${card.title}".`);
|
||
}
|
||
},
|
||
|
||
addChecklistItem(task) {
|
||
const text = (this.taskChecklistInputs[task.id] || '').trim();
|
||
if (!text) return;
|
||
if (!task.checklist) task.checklist = [];
|
||
task.checklist.push({ text, done: false });
|
||
this.taskChecklistInputs[task.id] = '';
|
||
},
|
||
|
||
applyWorkflowTemplate() {
|
||
if (!this.selectedCard || !this.selectedWorkflowTemplate) return;
|
||
const templates = {
|
||
suurkuva: ['Aineiston tarkistus ja leikkuulinjat', 'Suurkuvatulostus', 'Laminointi ja leikkaus', 'Asennus / Luovutus'],
|
||
video: ['Käsikirjoitus ja kuvaussuunnitelma', 'Kuvauspäivä', 'Editointi ja äänimiksaus', 'Asiakasvedos ja toimitus'],
|
||
some: ['Kuukauden julkaisuideointi', 'Kuvien ja tekstien tuotanto', 'Asiakashyväksyntä ja ajastus']
|
||
};
|
||
const steps = templates[this.selectedWorkflowTemplate] || [];
|
||
steps.forEach((stepTitle, idx) => {
|
||
if (this.selectedCard.subItems) {
|
||
this.selectedCard.subItems.push({
|
||
id: `wf-${Date.now()}-${idx}`,
|
||
label: stepTitle,
|
||
done: false,
|
||
flexible: true,
|
||
assignee: this.selectedCard.assignee,
|
||
pinnedCardId: null
|
||
});
|
||
} else if (this.selectedCard.tasks) {
|
||
this.selectedCard.tasks.push({
|
||
id: `wf-${Date.now()}-${idx}`,
|
||
title: stepTitle,
|
||
assignee: this.selectedCard.assignee,
|
||
status: 'Waiting',
|
||
dueDate: this.selectedCard.dueDate || '15.12.',
|
||
checklist: []
|
||
});
|
||
}
|
||
});
|
||
this.logChange('Työnkulkupohja', `${steps.length} vaihetta lisätty`);
|
||
this.selectedWorkflowTemplate = '';
|
||
this.toast(`Lisätty ${steps.length} vaihetta työnkulkupohjasta.`);
|
||
},
|
||
|
||
addCardLink() {
|
||
if (!this.selectedCard || !this.newLinkTitle.trim()) return;
|
||
if (!this.selectedCard.links) this.selectedCard.links = [];
|
||
this.selectedCard.links.push({
|
||
title: this.newLinkTitle.trim(),
|
||
url: this.newLinkUrl.trim() || 'https://drive.google.com'
|
||
});
|
||
this.logChange('Linkki lisätty', this.newLinkTitle.trim());
|
||
this.newLinkTitle = '';
|
||
this.newLinkUrl = '';
|
||
this.addingLink = false;
|
||
this.toast('Tiedostolinkki lisätty.');
|
||
},
|
||
|
||
removeCardLink(idx) {
|
||
if (!this.selectedCard || !this.selectedCard.links) return;
|
||
this.selectedCard.links.splice(idx, 1);
|
||
},
|
||
|
||
addTag() {
|
||
if (!this.selectedCard || !this.newTagInput.trim()) return;
|
||
if (!this.selectedCard.tags) this.selectedCard.tags = [];
|
||
const t = this.newTagInput.trim();
|
||
if (!this.selectedCard.tags.includes(t)) {
|
||
this.selectedCard.tags.push(t);
|
||
this.logChange('Tagi lisätty', t);
|
||
}
|
||
this.newTagInput = '';
|
||
},
|
||
|
||
removeTag(idx) {
|
||
if (!this.selectedCard || !this.selectedCard.tags) return;
|
||
this.selectedCard.tags.splice(idx, 1);
|
||
},
|
||
|
||
addQuickHours() {
|
||
if (!this.selectedCard || !this.quickHoursAmount || this.quickHoursAmount <= 0) return;
|
||
this.selectedCard.loggedHours = Number(this.selectedCard.loggedHours || 0) + Number(this.quickHoursAmount);
|
||
this.logChange('Tuntikirjaus', `+${this.fmtHours(this.quickHoursAmount)} h (${this.quickHoursNote || 'Tuotantotyö'})`);
|
||
this.toast(`Kirjattu ${this.fmtHours(this.quickHoursAmount)} h työlle.`);
|
||
this.quickHoursNote = '';
|
||
},
|
||
|
||
addQuickExpense() {
|
||
if (!this.selectedCard || !this.quickExpenseDesc.trim()) return;
|
||
if (!this.selectedCard.expenses) this.selectedCard.expenses = [];
|
||
this.selectedCard.expenses.push({
|
||
desc: this.quickExpenseDesc.trim(),
|
||
amount: Number(this.quickExpenseAmount || 0)
|
||
});
|
||
this.logChange('Kulu lisätty', this.quickExpenseDesc.trim());
|
||
this.toast('Kulu kirjattu asiakastyölle.');
|
||
this.quickExpenseDesc = '';
|
||
this.quickExpenseAmount = 0;
|
||
},
|
||
|
||
toggleTheme() {
|
||
this.darkMode = !this.darkMode;
|
||
document.documentElement.classList.toggle('dark', this.darkMode);
|
||
},
|
||
|
||
closeAllPopovers() {
|
||
this.activePicker = null;
|
||
this.urgentMenuOpen = false;
|
||
this.activeSortMenuCol = null;
|
||
},
|
||
|
||
toast(msg) {
|
||
this.toastMessage = msg;
|
||
clearTimeout(this.toastTimer);
|
||
this.toastTimer = setTimeout(() => { this.toastMessage = ''; }, 3200);
|
||
},
|
||
|
||
showTooltip(e, text) {
|
||
const rect = e.currentTarget.getBoundingClientRect();
|
||
this.tooltip = {
|
||
visible: true,
|
||
text,
|
||
x: Math.min(window.innerWidth - 330, Math.max(10, rect.left)),
|
||
y: Math.max(10, rect.top - 36)
|
||
};
|
||
},
|
||
|
||
hideTooltip() {
|
||
this.tooltip.visible = false;
|
||
},
|
||
|
||
// --- SARAKKEET, JÄRJESTYS & SUODATUS ---
|
||
columnSortMode(colId) {
|
||
return this.columnSortModes[colId] || 'manual';
|
||
},
|
||
|
||
toggleSortMenu(colId) {
|
||
this.urgentMenuOpen = false;
|
||
this.activePicker = null;
|
||
this.activeSortMenuCol = this.activeSortMenuCol === colId ? null : colId;
|
||
},
|
||
|
||
setColumnSort(colId, mode) {
|
||
this.columnSortModes[colId] = mode;
|
||
this.activeSortMenuCol = null;
|
||
const col = this.columns.find(c => c.id === colId);
|
||
this.toast(`Listan "${col ? col.title : ''}" järjestys: ${mode === 'dueDate' ? 'Eräpäivän mukaan (kiireisin ensin)' : 'Oma järjestys (raahattava)'}.`);
|
||
},
|
||
|
||
parseDueTimestamp(card) {
|
||
if (!card.dueDate) return Number.MAX_SAFE_INTEGER;
|
||
const m = card.dueDate.match(/^(\d{1,2})\.(\d{1,2})\.?$/);
|
||
if (!m) return Number.MAX_SAFE_INTEGER - 1;
|
||
const day = parseInt(m[1], 10);
|
||
const month = parseInt(m[2], 10);
|
||
const year = month >= 9 ? 2026 : 2027;
|
||
return new Date(year, month - 1, day).getTime();
|
||
},
|
||
|
||
activeColumns() {
|
||
if (this.pipelineView === 'sales') {
|
||
return this.columns.filter(c => c.kind === 'sales');
|
||
}
|
||
if (this.pipelineView === 'production') {
|
||
return this.columns.filter(c => c.kind === 'production_quotes' || c.kind === 'production' || c.kind === 'ongoing');
|
||
}
|
||
return this.columns.filter(c => c.kind !== 'production_quotes');
|
||
},
|
||
|
||
allMovableColumns() {
|
||
return this.columns.filter(c => c.kind !== 'ongoing' && (this.pipelineView === 'production' ? c.kind !== 'sales' : c.kind !== 'production_quotes'));
|
||
},
|
||
|
||
// --- DRAG & DROP ---
|
||
handleDragStart(e, card) {
|
||
this.hideTooltip();
|
||
this.draggedCardId = card.id;
|
||
if (e.dataTransfer) {
|
||
e.dataTransfer.effectAllowed = 'move';
|
||
e.dataTransfer.setData('text/plain', card.id);
|
||
}
|
||
},
|
||
|
||
handleColumnDragOver(e, col) {
|
||
const dragged = this.cards.find(c => c.id === this.draggedCardId);
|
||
if (!dragged) return;
|
||
if (col.kind === 'ongoing' && dragged.status !== 'Ongoing') return;
|
||
if (col.kind !== 'ongoing' && dragged.status === 'Ongoing') return;
|
||
e.dataTransfer.dropEffect = 'move';
|
||
this.dragOverColId = col.id;
|
||
this.dropTargetCardId = null;
|
||
},
|
||
|
||
handleCardDragOver(e, col, targetCard) {
|
||
const dragged = this.cards.find(c => c.id === this.draggedCardId);
|
||
if (!dragged || dragged.id === targetCard.id) return;
|
||
if (col.kind === 'ongoing' && dragged.status !== 'Ongoing') return;
|
||
if (col.kind !== 'ongoing' && dragged.status === 'Ongoing') return;
|
||
|
||
e.dataTransfer.dropEffect = 'move';
|
||
this.dragOverColId = col.id;
|
||
this.dropTargetCardId = targetCard.id;
|
||
const rect = e.currentTarget.getBoundingClientRect();
|
||
this.dropPosition = (e.clientY - rect.top) < rect.height / 2 ? 'before' : 'after';
|
||
},
|
||
|
||
handleDragLeave(e, col) {
|
||
if (this.dragOverColId === col.id && !e.currentTarget.contains(e.relatedTarget)) {
|
||
this.dragOverColId = null;
|
||
this.dropTargetCardId = null;
|
||
}
|
||
},
|
||
|
||
handleDrop(e, col) {
|
||
const cardId = this.draggedCardId || (e.dataTransfer && e.dataTransfer.getData('text/plain'));
|
||
const targetCardId = this.dropTargetCardId;
|
||
const pos = this.dropPosition;
|
||
|
||
this.dragOverColId = null;
|
||
this.draggedCardId = null;
|
||
this.dropTargetCardId = null;
|
||
|
||
if (!cardId) return;
|
||
const dragged = this.cards.find(c => c.id === cardId);
|
||
if (!dragged) return;
|
||
if (col.kind === 'ongoing' && dragged.status !== 'Ongoing') return;
|
||
if (col.kind !== 'ongoing' && dragged.status === 'Ongoing') return;
|
||
|
||
const currentColId = this.activeColIdForCard(dragged);
|
||
const sameColumn = currentColId === col.id;
|
||
|
||
if (!sameColumn && col.kind !== 'ongoing') {
|
||
this.moveCard(cardId, col.id, true);
|
||
}
|
||
|
||
const listAfterMove = this.cardsForColumn(col).filter(c => c.id !== cardId);
|
||
let insertIdx = listAfterMove.length;
|
||
if (targetCardId) {
|
||
const targetIdx = listAfterMove.findIndex(c => c.id === targetCardId);
|
||
if (targetIdx !== -1) {
|
||
insertIdx = pos === 'before' ? targetIdx : targetIdx + 1;
|
||
}
|
||
}
|
||
listAfterMove.splice(insertIdx, 0, dragged);
|
||
listAfterMove.forEach((c, idx) => {
|
||
c.boardPosition = (idx + 1) * 10;
|
||
});
|
||
|
||
const switchedFromDueDate = this.columnSortMode(col.id) === 'dueDate';
|
||
if (switchedFromDueDate) {
|
||
this.columnSortModes[col.id] = 'manual';
|
||
}
|
||
|
||
if (sameColumn) {
|
||
this.toast(switchedFromDueDate
|
||
? `Järjestys päivitetty (lista vaihdettu tilaan: Oma järjestys).`
|
||
: `Kortin paikka päivitetty listassa "${col.title}".`);
|
||
} else if (switchedFromDueDate) {
|
||
this.toast(`Siirretty sarakkeeseen "${col.title}" (järjestys: Oma järjestys).`);
|
||
}
|
||
},
|
||
|
||
handleDragEnd() {
|
||
this.draggedCardId = null;
|
||
this.dragOverColId = null;
|
||
this.dropTargetCardId = null;
|
||
},
|
||
|
||
quoteCount() {
|
||
return this.cards.filter(c => ['Prospect', 'Tentative', 'QuoteRequest'].includes(c.status)).length;
|
||
},
|
||
|
||
filteredCards() {
|
||
return this.cards.filter(card => {
|
||
if (this.boardFilter === 'my') {
|
||
if (card.assignee !== 'Jussi Mäkelä' && !(card.members || []).includes('Jussi Mäkelä')) return false;
|
||
} else if (this.boardFilter === 'person_anna') {
|
||
if (card.assignee !== 'Anna Korhonen' && !(card.members || []).includes('Anna Korhonen')) return false;
|
||
} else if (this.boardFilter === 'unit_print') {
|
||
if (card.serviceUnit !== 'Painotuotanto') return false;
|
||
} else if (this.boardFilter === 'unit_media') {
|
||
if (card.serviceUnit !== 'Mediatuotanto') return false;
|
||
}
|
||
|
||
if (this.filterUrgent && !['Immediate', 'Urgent'].includes(card.priority)) return false;
|
||
if (this.filterOverdue && !card.isOverdue) return false;
|
||
return true;
|
||
});
|
||
},
|
||
|
||
minUrgentRank() {
|
||
const found = this.thresholdOptions.find(o => o.key === this.urgentThreshold);
|
||
return found ? found.minRank : 4;
|
||
},
|
||
|
||
cardsForColumn(col) {
|
||
const minRank = this.minUrgentRank();
|
||
const matching = this.filteredCards().filter(c => {
|
||
const rank = (this.priorities[c.priority] || this.priorities.Normal).rank;
|
||
if (col.statuses) {
|
||
return col.statuses.includes(c.status);
|
||
}
|
||
if (col.isUrgentLane) {
|
||
return c.status === 'InProduction' && rank >= minRank;
|
||
}
|
||
if (col.isNormalLane) {
|
||
return c.status === 'InProduction' && rank < minRank;
|
||
}
|
||
return c.status === col.status;
|
||
});
|
||
|
||
const sortMode = this.columnSortMode(col.id);
|
||
return [...matching].sort((a, b) => {
|
||
if (sortMode === 'dueDate') {
|
||
const diff = this.parseDueTimestamp(a) - this.parseDueTimestamp(b);
|
||
if (diff !== 0) return diff;
|
||
}
|
||
return (a.boardPosition || 0) - (b.boardPosition || 0);
|
||
});
|
||
},
|
||
|
||
activeColIdForCard(card) {
|
||
if (this.pipelineView === 'production' && ['Prospect', 'Tentative', 'QuoteRequest'].includes(card.status)) {
|
||
return 'QuotesCombined';
|
||
}
|
||
if (card.status === 'InProduction') {
|
||
const rank = (this.priorities[card.priority] || this.priorities.Normal).rank;
|
||
return rank >= this.minUrgentRank() ? 'InProductionUrgent' : 'InProduction';
|
||
}
|
||
return card.status;
|
||
},
|
||
|
||
// --- KORTTIEN TOIMINNOT ---
|
||
setUrgentThreshold(key) {
|
||
this.urgentThreshold = key;
|
||
this.urgentMenuOpen = false;
|
||
const opt = this.thresholdOptions.find(o => o.key === key);
|
||
this.toast(`Kiire-listaan nousevat nyt: ${opt ? opt.label : key}`);
|
||
},
|
||
|
||
toggleExpand(id) {
|
||
const idx = this.expandedIds.indexOf(id);
|
||
if (idx >= 0) this.expandedIds.splice(idx, 1);
|
||
else this.expandedIds.push(id);
|
||
},
|
||
|
||
isExpanded(id) {
|
||
return this.expandedIds.includes(id);
|
||
},
|
||
|
||
changePriority(cardId, newPrio) {
|
||
const card = this.cards.find(c => c.id === cardId);
|
||
if (!card) return;
|
||
card.priority = newPrio;
|
||
const rank = this.priorities[newPrio].rank;
|
||
if (card.status === 'InProduction') {
|
||
const lane = rank >= this.minUrgentRank() ? 'Työn alla • Kiire' : 'Työn alla';
|
||
this.toast(`Prioriteetti: ${this.priorities[newPrio].label} → sarake "${lane}"`);
|
||
} else {
|
||
this.toast(`Prioriteetti vaihdettu: ${this.priorities[newPrio].label}`);
|
||
}
|
||
},
|
||
|
||
moveCard(cardId, targetColId) {
|
||
const card = this.cards.find(c => c.id === cardId);
|
||
const col = this.columns.find(c => c.id === targetColId);
|
||
if (!card || !col || col.kind === 'ongoing') return;
|
||
|
||
const minRank = this.minUrgentRank();
|
||
const rank = (this.priorities[card.priority] || this.priorities.Normal).rank;
|
||
card.status = col.status;
|
||
|
||
if (col.isUrgentLane && rank < minRank) {
|
||
card.priority = this.urgentThreshold;
|
||
this.toast(`Siirretty Kiire-listaan (prioriteetti nostettu: ${this.priorities[card.priority].label}).`);
|
||
} else if (col.isNormalLane && rank >= minRank) {
|
||
card.priority = 'Normal';
|
||
this.toast(`Siirretty normaalille Työn alla -listalle.`);
|
||
} else {
|
||
this.toast(`Siirretty sarakkeeseen: ${col.title}`);
|
||
}
|
||
|
||
if (card.cardType === 'promoted_task') {
|
||
const parent = this.cards.find(c => c.id === card.parentJobId);
|
||
const sub = parent?.subItems?.find(s => s.id === card.parentTaskId);
|
||
if (sub) sub.done = col.status === 'Done';
|
||
}
|
||
},
|
||
|
||
toggleJobTask(cardId, taskId) {
|
||
const card = this.cards.find(c => c.id === cardId);
|
||
const task = card?.tasks?.find(t => t.id === taskId);
|
||
if (task) task.status = task.status === 'Done' ? 'InProgress' : 'Done';
|
||
},
|
||
|
||
toggleSubItem(cardId, subId) {
|
||
const card = this.cards.find(c => c.id === cardId);
|
||
const sub = card?.subItems?.find(s => s.id === subId);
|
||
if (!sub) return;
|
||
sub.done = !sub.done;
|
||
if (sub.pinnedCardId) {
|
||
const pinned = this.cards.find(c => c.id === sub.pinnedCardId);
|
||
if (pinned) pinned.status = sub.done ? 'Done' : 'InProduction';
|
||
}
|
||
this.toast(sub.done ? `Kuitattu valmiiksi: ${sub.label}` : `Palautettu avoimeksi: ${sub.label}`);
|
||
},
|
||
|
||
togglePinSubItem(ongoingId, subId) {
|
||
const parent = this.cards.find(c => c.id === ongoingId);
|
||
const sub = parent?.subItems?.find(s => s.id === subId);
|
||
if (!parent || !sub) return;
|
||
|
||
if (sub.pinnedCardId) {
|
||
this.unpinTask(sub.pinnedCardId);
|
||
return;
|
||
}
|
||
|
||
const newId = 'promoted-' + Date.now();
|
||
sub.pinnedCardId = newId;
|
||
this.cards.unshift({
|
||
id: newId,
|
||
cardType: 'promoted_task',
|
||
boardPosition: 5,
|
||
parentJobId: parent.id,
|
||
parentTaskId: sub.id,
|
||
parentJobTitle: `${parent.customer} • ${parent.title}`,
|
||
customer: parent.customer,
|
||
title: sub.label,
|
||
serviceUnit: parent.serviceUnit,
|
||
status: sub.done ? 'Done' : 'InProduction',
|
||
priority: 'Normal',
|
||
dueDate: 'Tämä vko',
|
||
isOverdue: false,
|
||
loggedHours: 0.0,
|
||
estimatedHours: 2.5,
|
||
assignee: sub.assignee || parent.assignee,
|
||
members: [...parent.members]
|
||
});
|
||
this.toast(`Tehtävä nostettu työputkeen (PIN): "${sub.label}"`);
|
||
},
|
||
|
||
unpinTask(promotedId) {
|
||
const idx = this.cards.findIndex(c => c.id === promotedId);
|
||
if (idx === -1) return;
|
||
const promoted = this.cards[idx];
|
||
const parent = this.cards.find(c => c.id === promoted.parentJobId);
|
||
const sub = parent?.subItems?.find(s => s.id === promoted.parentTaskId);
|
||
if (sub) sub.pinnedCardId = null;
|
||
this.cards.splice(idx, 1);
|
||
this.toast(`Tehtävä vapautettu työputkesta takaisin sopimuskortille.`);
|
||
},
|
||
|
||
// --- PIKAVASTAANOTTO ---
|
||
openQuickIntake() {
|
||
this.intakeForm.title = '';
|
||
this.intakeForm.addingNewContact = false;
|
||
this.intakeForm.newContact = '';
|
||
this.$refs.intakeDialog.showModal();
|
||
},
|
||
|
||
submitIntake() {
|
||
const f = this.intakeForm;
|
||
if (!f.title.trim()) return;
|
||
if (f.addingNewContact && f.newContact.trim()) {
|
||
if (!this.customerContacts[f.customer]) this.customerContacts[f.customer] = [];
|
||
this.customerContacts[f.customer].push(f.newContact.trim());
|
||
}
|
||
const num = `2026-0${160 + this.cards.length}`;
|
||
this.cards.unshift({
|
||
id: 'job-' + Date.now(),
|
||
cardType: 'job',
|
||
boardPosition: 5,
|
||
number: num,
|
||
customer: f.customer,
|
||
customerContact: f.addingNewContact && f.newContact.trim() ? f.newContact.trim() : f.contact,
|
||
title: f.title.trim(),
|
||
serviceUnit: f.serviceUnit,
|
||
status: f.status,
|
||
priority: f.priority,
|
||
dueDate: '16.12.',
|
||
isOverdue: false,
|
||
loggedHours: 0.0,
|
||
estimatedHours: 4.0,
|
||
assignee: f.assignee,
|
||
members: [f.assignee],
|
||
tasks: [{ id: 't-' + Date.now(), title: 'Työn aloitus ja valmistelu', assignee: f.assignee, status: 'Waiting', dueDate: '16.12.', checklist: [] }]
|
||
});
|
||
if (['Tentative', 'QuoteRequest'].includes(f.status) && this.pipelineView === 'production') {
|
||
this.pipelineView = 'sales';
|
||
}
|
||
this.$refs.intakeDialog.close();
|
||
this.toast(`Luotu työ ${num}: "${f.title.trim()}" (vastuu: ${f.assignee}).`);
|
||
},
|
||
|
||
// --- VÄRIVALITSIN & KONTRASTILASKENTA ---
|
||
hexToRgb(hex) {
|
||
const clean = (hex || '#1d4ed8').replace('#', '');
|
||
const full = clean.length === 3 ? clean.split('').map(c => c + c).join('') : clean.padEnd(6, '0');
|
||
const n = parseInt(full, 16);
|
||
return { r: (n >> 16) & 255, g: (n >> 8) & 255, b: n & 255 };
|
||
},
|
||
|
||
rgbToHex(r, g, b) {
|
||
const h = v => Math.max(0, Math.min(255, Math.round(v || 0))).toString(16).padStart(2, '0');
|
||
return `#${h(r)}${h(g)}${h(b)}`;
|
||
},
|
||
|
||
isLightHex(hex) {
|
||
const { r, g, b } = this.hexToRgb(hex);
|
||
const [sr, sg, sb] = [r, g, b].map(v => {
|
||
const c = v / 255;
|
||
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
||
});
|
||
return (0.2126 * sr + 0.7152 * sg + 0.0722 * sb) > 0.36;
|
||
},
|
||
|
||
columnHeaderStyle(colId) {
|
||
const hex = this.columnColors[colId] || '#1d4ed8';
|
||
const light = this.isLightHex(hex);
|
||
return `background-color: ${hex}; color: ${light ? '#111827' : '#ffffff'}; border-color: ${light ? 'rgba(0,0,0,0.16)' : 'rgba(255,255,255,0.22)'};`;
|
||
},
|
||
|
||
columnPillStyle(colId) {
|
||
const hex = this.columnColors[colId] || '#1d4ed8';
|
||
const light = this.isLightHex(hex);
|
||
return `background-color: ${light ? 'rgba(0,0,0,0.12)' : 'rgba(255,255,255,0.18)'}; border-color: ${light ? 'rgba(0,0,0,0.18)' : 'rgba(255,255,255,0.28)'};`;
|
||
},
|
||
|
||
columnBodyStyle(colId) {
|
||
const hex = this.columnColors[colId] || '#1d4ed8';
|
||
const { r, g, b } = this.hexToRgb(hex);
|
||
if (this.darkMode) {
|
||
const br = Math.round(22 * 0.89 + r * 0.11);
|
||
const bg = Math.round(22 * 0.89 + g * 0.11);
|
||
const bb = Math.round(14 * 0.89 + b * 0.11);
|
||
const er = Math.round(42 * 0.85 + r * 0.15);
|
||
const eg = Math.round(43 * 0.85 + g * 0.15);
|
||
const eb = Math.round(35 * 0.85 + b * 0.15);
|
||
return `background-color: rgb(${br},${bg},${bb}); border-color: rgb(${er},${eg},${eb});`;
|
||
} else {
|
||
const br = Math.round(246 * 0.92 + r * 0.08);
|
||
const bg = Math.round(247 * 0.92 + g * 0.08);
|
||
const bb = Math.round(249 * 0.92 + b * 0.08);
|
||
const er = Math.round(209 * 0.88 + r * 0.12);
|
||
const eg = Math.round(213 * 0.88 + g * 0.12);
|
||
const eb = Math.round(219 * 0.88 + b * 0.12);
|
||
return `background-color: rgb(${br},${bg},${bb}); border-color: rgb(${er},${eg},${eb});`;
|
||
}
|
||
},
|
||
|
||
cardHeaderStyle(card) {
|
||
const hex = card.customHex || this.customerColors[card.customer] || '#23476a';
|
||
const light = this.isLightHex(hex);
|
||
return `background-color: ${hex}; color: ${light ? '#111827' : '#ffffff'};`;
|
||
},
|
||
|
||
cardPillStyle(card) {
|
||
const hex = card.customHex || this.customerColors[card.customer] || '#23476a';
|
||
const light = this.isLightHex(hex);
|
||
return `background-color: ${light ? 'rgba(0,0,0,0.12)' : 'rgba(255,255,255,0.2)'};`;
|
||
},
|
||
|
||
openPicker(e, type, targetId) {
|
||
this.urgentMenuOpen = false;
|
||
this.activeSortMenuCol = null;
|
||
this.pickerType = type;
|
||
this.pickerTargetId = targetId;
|
||
this.activePicker = targetId;
|
||
|
||
let hex = '#1d4ed8';
|
||
if (type === 'column') {
|
||
const col = this.columns.find(c => c.id === targetId);
|
||
this.pickerTitle = `Listan väri: ${col ? col.title : ''}`;
|
||
hex = this.columnColors[targetId] || '#1d4ed8';
|
||
} else {
|
||
const card = this.cards.find(c => c.id === targetId);
|
||
this.pickerTitle = `Kortin otsikkoväri`;
|
||
hex = (card && (card.customHex || this.customerColors[card.customer])) || '#23476a';
|
||
}
|
||
|
||
this.setPickerHex(hex);
|
||
const rect = e.currentTarget.getBoundingClientRect();
|
||
this.pickerPos = {
|
||
x: Math.min(window.innerWidth - 300, Math.max(12, rect.left - 210)),
|
||
y: Math.min(window.innerHeight - 310, rect.bottom + 6)
|
||
};
|
||
},
|
||
|
||
setPickerHex(hex) {
|
||
this.pickerHex = hex;
|
||
this.pickerRgb = this.hexToRgb(hex);
|
||
},
|
||
|
||
updateHexFromRgb() {
|
||
this.pickerHex = this.rgbToHex(this.pickerRgb.r, this.pickerRgb.g, this.pickerRgb.b);
|
||
},
|
||
|
||
applyPickedColor() {
|
||
const hex = this.pickerHex;
|
||
const { r, g, b } = this.pickerRgb;
|
||
if (this.pickerType === 'column') {
|
||
this.columnColors[this.pickerTargetId] = hex;
|
||
this.toast(`Listan otsikkoväri päivitetty (RGB ${r}, ${g}, ${b}).`);
|
||
} else if (this.pickerType === 'card') {
|
||
const card = this.cards.find(c => c.id === this.pickerTargetId);
|
||
if (card) {
|
||
if (this.saveCustomerDefault) {
|
||
this.customerColors[card.customer] = hex;
|
||
this.cards.forEach(c => { if (c.customer === card.customer) delete c.customHex; });
|
||
this.toast(`Asiakkaan "${card.customer}" oletusväri päivitetty.`);
|
||
} else {
|
||
card.customHex = hex;
|
||
this.toast(`Kortin otsikkoväri päivitetty.`);
|
||
}
|
||
}
|
||
}
|
||
this.activePicker = null;
|
||
},
|
||
|
||
// --- FORMATOINTIAPURIT ---
|
||
initials(name) {
|
||
return (name || '??').split(' ').map(p => p[0]).join('').toUpperCase().slice(0, 2);
|
||
},
|
||
firstName(name) {
|
||
return (name || '').split(' ')[0];
|
||
},
|
||
fmtHours(val) {
|
||
return Number(val || 0).toString().replace('.', ',');
|
||
},
|
||
priorityLabel(key) {
|
||
return (this.priorities[key] || this.priorities.Normal).label;
|
||
},
|
||
priorityClass(key) {
|
||
return (this.priorities[key] || this.priorities.Normal).badge;
|
||
},
|
||
doneTaskCount(card) {
|
||
return (card.tasks || []).filter(t => t.status === 'Done').length;
|
||
},
|
||
completedSubCount(card) {
|
||
return (card.subItems || []).filter(s => s.done).length;
|
||
},
|
||
nextSubItem(card) {
|
||
return (card.subItems || []).find(s => !s.done) || null;
|
||
}
|
||
};
|
||
}
|
||
</script>
|
||
</body>
|
||
</html> |