1 line
No EOL
11 KiB
JavaScript
1 line
No EOL
11 KiB
JavaScript
import{f as e,h as t,i as n,r,s as i}from"./useToast-CS8pZhce.js";import{t as a}from"./link-DOg0dLYA.js";import{B as o,H as s,K as c,T as l,r as u,t as d,y as f}from"./index-CrJKtV0u.js";import{l as p}from"./mockData-DAqQG5te.js";var m=t(e(),1),h=i(),g=()=>{let[e,t]=(0,m.useState)(p),[i,g]=(0,m.useState)(`kanban`),[_,v]=(0,m.useState)(null),[y,b]=(0,m.useState)([{id:`st-1`,text:`Сверить расчетную себестоимость и маржинальность`,completed:!0},{id:`st-2`,text:`Согласовать тайминг подачи с шеф-поваром`,completed:!1},{id:`st-3`,text:`Выставить предварительный счет клиенту`,completed:!1}]),[x,S]=(0,m.useState)([{id:`c-1`,author:`Ольга Власова`,text:`Клиент подтвердил количество 60 персон. Ждем аванс.`,time:`Вчера, 16:20`},{id:`c-2`,author:`Артур Ким (Шеф)`,text:`Продукты зарезервированы на основном складе.`,time:`Сегодня, 10:15`}]),[C,w]=(0,m.useState)(``),T=(n,r)=>{t(e.map(e=>e.id===n?{...e,status:r}:e)),_&&_.id===n&&v({..._,status:r})},E=e=>{b(t=>t.map(t=>t.id===e?{...t,completed:!t.completed}:t))};return(0,h.jsxs)(`div`,{className:`space-y-4 animate-fade-in`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3 bg-krona-surface p-3.5 rounded-xl border border-krona-border shadow-krona-soft`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(`h2`,{className:`text-sm font-bold text-krona-primary`,children:`Задачи, поручения и проекты команды`}),(0,h.jsx)(d,{level:`target`,size:`sm`})]}),(0,h.jsx)(`p`,{className:`text-xs text-krona-secondary mt-0.5`,children:`Канбан-доска исполнения, дедлайны, привязка к CRM и ответственные`})]}),(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsxs)(`div`,{className:`flex items-center bg-krona-workspace p-1 rounded-lg border border-krona-border text-xs`,children:[(0,h.jsx)(`button`,{onClick:()=>g(`kanban`),className:`px-3 py-1 rounded font-medium transition-colors ${i===`kanban`?`bg-[#2F684C] text-white shadow-sm`:`text-krona-secondary`}`,children:`Канбан`}),(0,h.jsx)(`button`,{onClick:()=>g(`list`),className:`px-3 py-1 rounded font-medium transition-colors ${i===`list`?`bg-[#2F684C] text-white shadow-sm`:`text-krona-secondary`}`,children:`Список`})]}),(0,h.jsxs)(n,{variant:`primary`,size:`sm`,children:[(0,h.jsx)(l,{className:`w-3.5 h-3.5 mr-1`}),`Создать задачу`]})]})]}),i===`kanban`?(0,h.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-4 gap-3.5`,children:[`todo`,`in_progress`,`review`,`done`].map(t=>{let n=e.filter(e=>e.status===t);return(0,h.jsxs)(`div`,{onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault();let n=e.dataTransfer.getData(`text/plain`);n&&T(n,t)},className:`bg-krona-workspace/80 border border-krona-border rounded-xl p-3 flex flex-col min-h-[420px]`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between pb-2 mb-2 border-b border-krona-border`,children:[(0,h.jsx)(`span`,{className:`text-xs font-bold text-krona-primary`,children:{todo:`К выполнению`,in_progress:`В работе`,review:`На проверке`,done:`Выполнено`}[t]}),(0,h.jsx)(`span`,{className:`text-xs font-mono font-bold text-krona-secondary`,children:n.length})]}),(0,h.jsx)(`div`,{className:`space-y-2.5 flex-1 overflow-y-auto`,children:n.map(e=>(0,h.jsxs)(`div`,{draggable:!0,onDragStart:t=>{t.dataTransfer.setData(`text/plain`,e.id)},onClick:()=>v(e),className:`p-3 rounded-lg border border-krona-border bg-krona-surface shadow-krona-soft space-y-2 cursor-pointer hover:border-krona-green/70 transition-all group active:scale-[0.99]`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-krona-secondary`,children:[(0,h.jsx)(`span`,{className:`font-semibold uppercase`,children:e.project}),(0,h.jsx)(r,{variant:e.priority===`high`?`danger`:`neutral`,size:`sm`,children:e.priority===`high`?`Срочно`:`Обычный`})]}),(0,h.jsx)(`h5`,{className:`text-xs font-bold text-krona-primary leading-snug group-hover:text-krona-green transition-colors`,children:e.title}),(0,h.jsxs)(`div`,{className:`flex items-center justify-between pt-1 border-t border-krona-border/60 text-[11px] text-krona-secondary`,children:[(0,h.jsx)(`span`,{children:e.assignee}),(0,h.jsxs)(`span`,{className:`flex items-center gap-1 font-mono`,children:[(0,h.jsx)(o,{className:`w-3 h-3`}),e.dueDate]})]}),t!==`done`&&(0,h.jsx)(`div`,{className:`pt-1 flex justify-end`,children:(0,h.jsx)(`button`,{onClick:n=>{n.stopPropagation(),T(e.id,t===`todo`?`in_progress`:t===`in_progress`?`review`:`done`)},className:`text-[11px] text-krona-green font-medium hover:underline`,children:`Сдвинуть вперед →`})})]},e.id))})]},t)})}):(0,h.jsx)(`div`,{className:`bg-krona-surface border border-krona-border rounded-xl shadow-krona-soft p-4`,children:(0,h.jsxs)(`table`,{className:`w-full text-left text-xs border-collapse`,children:[(0,h.jsx)(`thead`,{className:`bg-krona-workspace/80 text-krona-secondary border-b border-krona-border`,children:(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`th`,{className:`p-3 font-semibold`,children:`Название задачи`}),(0,h.jsx)(`th`,{className:`p-3 font-semibold`,children:`Проект`}),(0,h.jsx)(`th`,{className:`p-3 font-semibold`,children:`Ответственный`}),(0,h.jsx)(`th`,{className:`p-3 font-semibold`,children:`Срок`}),(0,h.jsx)(`th`,{className:`p-3 font-semibold`,children:`Приоритет`}),(0,h.jsx)(`th`,{className:`p-3 font-semibold`,children:`Статус`})]})}),(0,h.jsx)(`tbody`,{className:`divide-y divide-krona-border/50`,children:e.map(e=>(0,h.jsxs)(`tr`,{onClick:()=>v(e),className:`hover:bg-krona-workspace/50 transition-colors cursor-pointer`,children:[(0,h.jsx)(`td`,{className:`p-3 font-medium text-krona-primary`,children:e.title}),(0,h.jsx)(`td`,{className:`p-3 text-krona-secondary`,children:e.project}),(0,h.jsx)(`td`,{className:`p-3 font-medium text-krona-primary`,children:e.assignee}),(0,h.jsx)(`td`,{className:`p-3 text-krona-secondary font-mono`,children:e.dueDate}),(0,h.jsx)(`td`,{className:`p-3`,children:(0,h.jsx)(r,{variant:e.priority===`high`?`danger`:`neutral`,size:`sm`,children:e.priority===`high`?`Высокий`:`Обычный`})}),(0,h.jsx)(`td`,{className:`p-3`,children:(0,h.jsx)(r,{variant:`gold`,size:`sm`,children:e.status})})]},e.id))})]})}),_&&(0,h.jsx)(u,{isOpen:!!_,onClose:()=>v(null),title:`Задача: ${_.title}`,subtitle:`Проект: ${_.project} • Исполнитель: ${_.assignee}`,maxWidth:`lg`,footer:(0,h.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,h.jsx)(`div`,{className:`flex gap-2`,children:(0,h.jsxs)(n,{variant:`primary`,size:`sm`,onClick:()=>T(_.id,`done`),children:[(0,h.jsx)(s,{className:`w-3.5 h-3.5 mr-1`}),`Отметить выполненной`]})}),(0,h.jsx)(n,{variant:`secondary`,size:`sm`,onClick:()=>v(null),children:`Закрыть`})]}),children:(0,h.jsxs)(`div`,{className:`space-y-4 text-xs`,children:[(0,h.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 p-3 rounded-lg bg-krona-workspace border border-krona-border`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-krona-secondary block text-[10px]`,children:`Ответственный:`}),(0,h.jsx)(`span`,{className:`font-semibold text-krona-primary`,children:_.assignee})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-krona-secondary block text-[10px]`,children:`Срок завершения:`}),(0,h.jsx)(`span`,{className:`font-semibold text-krona-primary font-mono`,children:_.dueDate})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`text-krona-secondary block text-[10px]`,children:`Приоритет:`}),(0,h.jsx)(r,{variant:_.priority===`high`?`danger`:`neutral`,size:`sm`,children:_.priority===`high`?`Высокий (Срочно)`:`Обычный`})]})]}),(0,h.jsxs)(`div`,{className:`p-3 rounded-lg border border-krona-border bg-krona-surface flex items-center justify-between`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,h.jsx)(a,{className:`w-4 h-4 text-krona-gold shrink-0`}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`span`,{className:`font-bold text-krona-primary`,children:`Связанный CRM контрагент:`}),(0,h.jsx)(`div`,{className:`text-[11px] text-krona-secondary`,children:`ООО "Сибирский Ритейл" (Сделка: Банкет на 60 персон)`})]})]}),(0,h.jsx)(r,{variant:`gold`,size:`sm`,children:`CRM Link`})]}),(0,h.jsxs)(`div`,{className:`space-y-2`,children:[(0,h.jsxs)(`span`,{className:`text-[10px] font-bold uppercase tracking-wider text-krona-secondary block`,children:[`Чек-лист подзадач (`,y.filter(e=>e.completed).length,` из `,y.length,`):`]}),(0,h.jsx)(`div`,{className:`space-y-1.5 p-3 rounded-lg border border-krona-border bg-krona-workspace`,children:y.map(e=>(0,h.jsxs)(`div`,{onClick:()=>E(e.id),className:`flex items-center gap-2 cursor-pointer p-1 rounded hover:bg-krona-surface/60 transition-colors select-none`,children:[(0,h.jsx)(`div`,{className:`w-4 h-4 rounded border flex items-center justify-center transition-colors ${e.completed?`bg-krona-green border-krona-green text-white`:`border-krona-border bg-krona-surface`}`,children:e.completed&&(0,h.jsx)(c,{className:`w-3 h-3 stroke-[3]`})}),(0,h.jsx)(`span`,{className:`text-xs ${e.completed?`line-through text-krona-secondary`:`text-krona-primary`}`,children:e.text})]},e.id))})]}),(0,h.jsxs)(`div`,{className:`space-y-2`,children:[(0,h.jsxs)(`span`,{className:`text-[10px] font-bold uppercase tracking-wider text-krona-secondary block`,children:[`Обсуждение задачи (`,x.length,`):`]}),(0,h.jsx)(`div`,{className:`space-y-2 max-h-40 overflow-y-auto p-2 rounded-lg bg-krona-workspace border border-krona-border`,children:x.map(e=>(0,h.jsxs)(`div`,{className:`p-2 rounded bg-krona-surface border border-krona-border/60 text-[11px] space-y-0.5`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between text-krona-secondary`,children:[(0,h.jsx)(`span`,{className:`font-semibold text-krona-primary`,children:e.author}),(0,h.jsx)(`span`,{className:`text-[10px]`,children:e.time})]}),(0,h.jsx)(`p`,{className:`text-krona-primary`,children:e.text})]},e.id))}),(0,h.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),C.trim()&&(S(e=>[...e,{id:`c-${Date.now()}`,author:`Вы (Текущий пользователь)`,text:C,time:`Только что`}]),w(``))},className:`flex gap-2 pt-1`,children:[(0,h.jsx)(`input`,{type:`text`,value:C,onChange:e=>w(e.target.value),placeholder:`Добавить комментарий к задаче...`,className:`flex-1 bg-krona-workspace border border-krona-border rounded-lg px-3 py-1.5 text-xs text-krona-primary placeholder:text-krona-secondary focus:outline-none focus:border-krona-green`}),(0,h.jsx)(n,{type:`submit`,variant:`primary`,size:`sm`,children:(0,h.jsx)(f,{className:`w-3.5 h-3.5`})})]})]})]})})]})};export{g as TasksModule}; |