krona-front/dist/assets/HelpDeskModule-BIrYP26C.js

1 line
No EOL
14 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{f as e,h as t,i as n,r,s as i,t as a}from"./useToast-CS8pZhce.js";import{B as o,F as s,U as c,b as l,j as u,m as d,r as f,t as p,y as m}from"./index-CrJKtV0u.js";import{u as h}from"./mockData-DAqQG5te.js";var g=t(e(),1),_=i(),v=h.map((e,t)=>({...e,status:t===0?`in_progress`:t===1?`new`:`resolved`,internalNotes:[{text:`Проверили чек в кассе — соусы действительно не были вложены комплектовщиком смены.`,author:`Менеджер смены`,time:`Вчера 16:35`}],publicReplies:[{text:`Здравствуйте, Анна! Приносим искренние извинения за ситуацию.`,author:`Поддержка Кроны`,time:`Вчера 16:40`}]})),y=[`Алина Соколова`,`Артем Васильев`,`Екатерина Иванова`,`Сергей Петров (Старший менеджер)`],b=()=>{let{showToast:e}=a(),[t,i]=(0,g.useState)(v),[h,b]=(0,g.useState)(null),[x,S]=(0,g.useState)(``),[C,w]=(0,g.useState)(`all`),[T,E]=(0,g.useState)(`public`),[D,O]=(0,g.useState)(``),k=t.filter(e=>{let t=C===`all`||e.status===C,n=!x||e.subject.toLowerCase().includes(x.toLowerCase())||e.clientName.toLowerCase().includes(x.toLowerCase())||e.id.toLowerCase().includes(x.toLowerCase());return t&&n}),A=e=>{switch(e){case`urgent`:return(0,_.jsx)(r,{variant:`danger`,size:`sm`,children:`Срочно (15 мин SLA)`});case`high`:return(0,_.jsx)(r,{variant:`warning`,size:`sm`,children:`Высокий`});case`medium`:return(0,_.jsx)(r,{variant:`gold`,size:`sm`,children:`Средний`});default:return(0,_.jsx)(r,{variant:`neutral`,size:`sm`,children:`Обычный`})}},j=e=>{switch(e){case`new`:return(0,_.jsx)(r,{variant:`neutral`,size:`sm`,children:`Новый`});case`in_progress`:return(0,_.jsx)(r,{variant:`warning`,size:`sm`,children:`В работе`});case`waiting`:return(0,_.jsx)(r,{variant:`info`,size:`sm`,children:`Ожидает ответа`});case`resolved`:return(0,_.jsx)(r,{variant:`green`,size:`sm`,children:`Решен`});case`closed`:return(0,_.jsx)(r,{variant:`gray`,size:`sm`,children:`Закрыт`})}},M=e=>e<=0?(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[11px] font-bold text-rose-600 bg-rose-500/10 px-2 py-0.5 rounded border border-rose-500/30`,children:[(0,_.jsx)(c,{className:`w-3 h-3`}),` SLA: Нарушен!`]}):e<15?(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[11px] font-bold text-rose-600 bg-rose-500/10 px-2 py-0.5 rounded border border-rose-500/30`,children:[(0,_.jsx)(o,{className:`w-3 h-3`}),` SLA: `,e,` мин осталось`]}):e<=60?(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[11px] font-medium text-amber-600 bg-amber-500/10 px-2 py-0.5 rounded border border-amber-500/30`,children:[(0,_.jsx)(o,{className:`w-3 h-3`}),` SLA: `,e,` мин`]}):(0,_.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[11px] font-medium text-emerald-700 bg-emerald-500/10 px-2 py-0.5 rounded border border-emerald-500/30`,children:[(0,_.jsx)(o,{className:`w-3 h-3`}),` SLA: `,Math.floor(e/60),`ч `,e%60,`м`]}),N=(t,n)=>{i(e=>e.map(e=>e.id===t?{...e,status:n}:e)),h&&h.id===t&&b({...h,status:n}),e({title:`Статус обновлен`,message:`Тикет переведен в статус «${n}»`,type:`success`})},P=(t,n)=>{i(e=>e.map(e=>e.id===t?{...e,assignee:n}:e)),h&&h.id===t&&b({...h,assignee:n}),e({title:`Ответственный назначен`,message:`Назначен сотрудник: ${n}`,type:`info`})};return(0,_.jsxs)(`div`,{className:`space-y-4 animate-fade-in`,children:[(0,_.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,_.jsxs)(`div`,{children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`h2`,{className:`text-sm font-bold text-krona-primary`,children:`HelpDesk & Центр решения обращений и жалоб гостей`}),(0,_.jsx)(p,{level:`target`,size:`sm`})]}),(0,_.jsx)(`p`,{className:`text-xs text-krona-secondary mt-0.5`,children:`Очередь обращений, контроль жестких SLA нормативов, база знаний и AI-рекомендации`})]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,_.jsx)(r,{variant:`danger`,size:`md`,children:`1 срочный тикет`}),(0,_.jsx)(r,{variant:`green`,size:`md`,children:`SLA 98.4% выполнения`})]})]}),(0,_.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,_.jsx)(`div`,{className:`flex items-center gap-1.5 overflow-x-auto text-xs`,children:[{id:`all`,label:`Все обращения`},{id:`new`,label:`Новые`},{id:`in_progress`,label:`В работе`},{id:`waiting`,label:`Ожидают`},{id:`resolved`,label:`Решенные`}].map(e=>(0,_.jsx)(`button`,{onClick:()=>w(e.id),className:`px-3 py-1.5 rounded-lg font-medium transition-colors whitespace-nowrap ${C===e.id?`bg-[#2F684C] text-white shadow-sm`:`bg-krona-surface text-krona-secondary hover:text-krona-primary border border-krona-border`}`,children:e.label},e.id))}),(0,_.jsxs)(`div`,{className:`relative w-64`,children:[(0,_.jsx)(l,{className:`w-3.5 h-3.5 absolute left-2.5 top-2.5 text-krona-secondary`}),(0,_.jsx)(`input`,{type:`text`,value:x,onChange:e=>S(e.target.value),placeholder:`Поиск обращений...`,className:`w-full pl-8 pr-3 py-1.5 text-xs bg-krona-surface border border-krona-border rounded-lg text-krona-primary placeholder:text-krona-secondary focus:outline-none focus:border-krona-green`})]})]}),(0,_.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:k.map(e=>(0,_.jsxs)(`div`,{onClick:()=>b(e),className:`p-4 rounded-xl border border-krona-border bg-krona-surface hover:border-krona-border-strong shadow-krona-soft cursor-pointer transition-all flex flex-col justify-between space-y-3`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between mb-1.5`,children:[(0,_.jsx)(`span`,{className:`font-mono font-bold text-xs text-krona-secondary`,children:e.id}),(0,_.jsxs)(`div`,{className:`flex items-center gap-1`,children:[j(e.status),A(e.priority)]})]}),(0,_.jsx)(`h4`,{className:`text-xs font-bold text-krona-primary leading-snug line-clamp-2`,children:e.subject}),(0,_.jsxs)(`div`,{className:`space-y-1 text-xs text-krona-secondary border-t border-krona-border/40 pt-2.5 mt-2.5`,children:[(0,_.jsxs)(`div`,{className:`flex justify-between`,children:[(0,_.jsx)(`span`,{children:`Клиент:`}),(0,_.jsx)(`span`,{className:`font-medium text-krona-primary`,children:e.clientName})]}),(0,_.jsxs)(`div`,{className:`flex justify-between`,children:[(0,_.jsx)(`span`,{children:`Канал:`}),(0,_.jsx)(`span`,{className:`capitalize`,children:e.channel})]}),(0,_.jsxs)(`div`,{className:`flex justify-between`,children:[(0,_.jsx)(`span`,{children:`Ответственный:`}),(0,_.jsx)(`span`,{className:`font-medium text-krona-primary truncate max-w-[140px]`,children:e.assignee})]})]})]}),(0,_.jsxs)(`div`,{className:`pt-2 border-t border-krona-border/40 flex items-center justify-between`,children:[M(e.slaMinutesLeft),(0,_.jsx)(`span`,{className:`text-xs text-krona-green font-medium hover:underline`,children:`Открыть →`})]})]},e.id))}),h&&(0,_.jsx)(f,{isOpen:!!h,onClose:()=>b(null),title:`Обращение: ${h.id}`,subtitle:`Клиент: ${h.clientName} • ${h.createdTime}`,maxWidth:`lg`,children:(0,_.jsxs)(`div`,{className:`space-y-4 text-xs`,children:[(0,_.jsxs)(`div`,{className:`p-3 bg-krona-workspace rounded-xl border border-krona-border grid grid-cols-1 sm:grid-cols-3 gap-3`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{className:`text-[10px] text-krona-secondary block mb-1`,children:`Статус инцидента:`}),(0,_.jsxs)(`select`,{value:h.status,onChange:e=>N(h.id,e.target.value),className:`w-full p-1.5 bg-krona-surface border border-krona-border rounded-lg text-xs font-semibold text-krona-primary focus:outline-none`,children:[(0,_.jsx)(`option`,{value:`new`,children:`Новый`}),(0,_.jsx)(`option`,{value:`in_progress`,children:`В работе`}),(0,_.jsx)(`option`,{value:`waiting`,children:`Ожидает ответа`}),(0,_.jsx)(`option`,{value:`resolved`,children:`Решен`}),(0,_.jsx)(`option`,{value:`closed`,children:`Закрыт`})]})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{className:`text-[10px] text-krona-secondary block mb-1`,children:`Назначить сотрудника:`}),(0,_.jsx)(`select`,{value:h.assignee,onChange:e=>P(h.id,e.target.value),className:`w-full p-1.5 bg-krona-surface border border-krona-border rounded-lg text-xs font-semibold text-krona-primary focus:outline-none`,children:y.map(e=>(0,_.jsx)(`option`,{value:e,children:e},e))})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`label`,{className:`text-[10px] text-krona-secondary block mb-1`,children:`Контроль SLA:`}),(0,_.jsx)(`div`,{children:M(h.slaMinutesLeft)})]})]}),(0,_.jsxs)(`div`,{className:`p-3 bg-krona-surface rounded-xl border border-krona-border space-y-1.5`,children:[(0,_.jsx)(`h4`,{className:`font-bold text-sm text-krona-primary`,children:h.subject}),(0,_.jsxs)(`p`,{className:`text-krona-secondary leading-relaxed`,children:[`Обращение зарегистрировано через канал `,h.channel,`. Заказ привязан к локации: Красный пр-т 186а.`]})]}),(0,_.jsxs)(`div`,{className:`p-3 bg-krona-gold/10 border border-krona-gold/30 rounded-xl space-y-1.5`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-1.5 text-krona-gold-text font-bold text-xs`,children:[(0,_.jsx)(d,{className:`w-3.5 h-3.5 text-krona-gold`}),(0,_.jsx)(`span`,{children:`Рекомендация Krona AI:`})]}),(0,_.jsx)(`p`,{className:`text-krona-primary leading-relaxed`,children:`Начислить клиенту 300 бонусных баллов с извинениями и отправить курьера с недостающими соусами и комплиментом (морс 0.5л). Клиент относится к категории VIP (LTV 84 200 ₽).`})]}),(0,_.jsxs)(`div`,{className:`space-y-2`,children:[(0,_.jsx)(`h5`,{className:`font-bold text-krona-primary`,children:`История переписки и служебных заметок:`}),(0,_.jsxs)(`div`,{className:`space-y-2 max-h-48 overflow-y-auto pr-1`,children:[h.publicReplies?.map((e,t)=>(0,_.jsxs)(`div`,{className:`p-2.5 rounded-lg bg-emerald-500/5 border border-emerald-500/20 text-xs`,children:[(0,_.jsxs)(`div`,{className:`flex justify-between items-center text-[10px] text-emerald-800 dark:text-emerald-300 font-semibold mb-1`,children:[(0,_.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,_.jsx)(s,{className:`w-3 h-3`}),` Ответ гостю (`,e.author,`)`]}),(0,_.jsx)(`span`,{children:e.time})]}),(0,_.jsx)(`p`,{className:`text-krona-primary`,children:e.text})]},t)),h.internalNotes?.map((e,t)=>(0,_.jsxs)(`div`,{className:`p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/30 text-xs`,children:[(0,_.jsxs)(`div`,{className:`flex justify-between items-center text-[10px] text-amber-800 dark:text-amber-300 font-semibold mb-1`,children:[(0,_.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,_.jsx)(u,{className:`w-3 h-3`}),` Внутренняя заметка команды (`,e.author,`)`]}),(0,_.jsx)(`span`,{children:e.time})]}),(0,_.jsx)(`p`,{className:`text-krona-primary`,children:e.text})]},t))]})]}),(0,_.jsxs)(`form`,{onSubmit:t=>{if(t.preventDefault(),!D.trim()||!h)return;let n={text:D.trim(),author:`Вы (Оператор службы заботы)`,time:`Только что`},r={...h,...T===`internal`?{internalNotes:[...h.internalNotes||[],n]}:{publicReplies:[...h.publicReplies||[],n]}};i(e=>e.map(e=>e.id===h.id?r:e)),b(r),O(``),e({title:T===`internal`?`Внутренняя заметка сохранена`:`Ответ отправлен клиенту`,message:T===`internal`?`Заметка видна только сотрудникам`:`Сообщение отправлено в канал связи гостя`,type:`success`})},className:`space-y-2 pt-2 border-t border-krona-border`,children:[(0,_.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,_.jsxs)(`div`,{className:`flex items-center gap-1 bg-krona-workspace p-0.5 rounded-lg border border-krona-border text-[11px]`,children:[(0,_.jsxs)(`button`,{type:`button`,onClick:()=>E(`public`),className:`px-2.5 py-1 rounded transition-colors flex items-center gap-1 ${T===`public`?`bg-[#2F684C] text-white shadow-sm font-medium`:`text-krona-secondary`}`,children:[(0,_.jsx)(s,{className:`w-3 h-3`}),` Публичный ответ клиенту`]}),(0,_.jsxs)(`button`,{type:`button`,onClick:()=>E(`internal`),className:`px-2.5 py-1 rounded transition-colors flex items-center gap-1 ${T===`internal`?`bg-amber-600 text-white shadow-sm font-medium`:`text-krona-secondary`}`,children:[(0,_.jsx)(u,{className:`w-3 h-3`}),` Внутренняя заметка (для коллег)`]})]})}),(0,_.jsxs)(`div`,{className:`flex gap-2`,children:[(0,_.jsx)(`input`,{type:`text`,value:D,onChange:e=>O(e.target.value),placeholder:T===`public`?`Напишите публичный ответ клиенту...`:`Напишите служебную заметку для коллег...`,className:`flex-1 p-2 bg-krona-workspace border border-krona-border rounded-lg text-xs text-krona-primary focus:outline-none focus:border-krona-green`}),(0,_.jsxs)(n,{type:`submit`,variant:T===`internal`?`gold`:`primary`,size:`sm`,className:`px-3`,children:[(0,_.jsx)(m,{className:`w-3.5 h-3.5 mr-1`}),T===`internal`?`Сохранить заметку`:`Отправить ответ`]})]})]})]})})]})};export{b as HelpDeskModule};