PageSourceSearch

https://aidealer360.com/assets/Recon360Workflow-DlR0POHp.js

js aidealer360.com collected 2026-10-01 15:56:43 UTC 8,213 bytes, 6 lines download raw bytes

1import{j as e}from"./ui-vendor-B12AOeKi.js";import{r as c}from"./react-vendor-DZt7wVAJ.js";import{ai as L,q as b,B as o,P as y,D as B,m as z,ab as A,b as O,c as F,d as q,L as f,I as g,h as H,g as D,T as _}from"./index-BZo64Z7H.js";import{A as M,a as G,b as U,c as Y}from"./accordion-BZL770QS.js";import{A as Q,h as J,a as K,b as X,c as Z,d as $,e as ee,g as se,f as ae}from"./alert-dialog-Diwn5aYx.js";import{S as k,a as I,b as R,c as T,d as E}from"./select-B9Z9mxdV.js";import{R as te}from"./Recon360Shell-z3nfrVB1.js";import{b as re,e as ie,a as le}from"./useRecon360-wHE-PV_Z.js";import{m as ne,n as ce,o as oe,p as de,q as me,r as ue}from"./useRecon360Phase2-BKYb1asB.js";import{u as xe,a as he,P as pe,D as fe,d as je,C as ge}from"./core.esm-vJOjjXJR.js";import{S as Ne,v as ve,a as Se,u as Ce}from"./sortable.esm-4pArIwdV.js";import{S as we}from"./star-Df3XJJ6U.js";import{G as ye}from"./grip-vertical-CR48rr4S.js";import"./charts-vendor-B6q1L48j.js";import"./supabase-vendor-dOy44Gxq.js";import"./animation-vendor-BAVy02gd.js";import"./index-BUevatMX.js";import"./layout-grid-BAuwMpS1.js";import"./link-2-DFuIiLFx.js";import"./book-open-GOVonRIa.js";import"./AppLogo-ziNTxn37.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const De=L("StarOff",[["path",{d:"M8.34 8.34 2 9.27l5 4.87L5.82 21 12 17.77 18.18 21l-.59-3.43",ke
6y:"16m0ql"}],["path",{d:"M18.42 12.76 22 9.27l-6.91-1L12 2l-1.44 2.91",key:"1vt8nq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]),W=["used","new","cpo","service","other"];function Je(){const{data:s=[]}=re(),l=ie(),d=ne(),[m,u]=c.useState(""),[x,h]=c.useState(!1),[i,p]=c.useState(""),[n,t]=c.useState("used");c.useEffect(()=>{if(!m&&s.length>0){const r=s.find(S=>S.is_default)??s[0];u(r.id)}},[s,m]);const v=async()=>{if(!i.trim())return;const r=await d.mutateAsync({name:i.trim(),vehicle_type:n});u(r.id),h(!1),p(""),t("used")};return e.jsx(te,{title:"Workflow Builder",subtitle:"Create one or more workflows. Each work type can be mapped to any workflow.",rightActions:e.jsxs(B,{open:x,onOpenChange:h,children:[e.jsx(z,{asChild:!0,children:e.jsxs(o,{size:"sm",children:[e.jsx(A,{className:"h-4 w-4 mr-1"})," New workflow"]})}),e.jsxs(O,{children:[e.jsx(F,{children:e.jsx(q,{children:"Create workflow"})}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(f,{className:"text-xs",children:"Name"}),e.jsx(g,{value:i,onChange:r=>p(r.target.value),placeholder:"e.g. Quick Service Wash",autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx(f,{className:"text-xs",children:"Vehicle type"}),e.jsxs(k,{value:n,onValueChange:t,children:[e.jsx(I,{children:e.jsx(R,{})}),e.jsx(T,{children:W.map(r=>e.jsx(E,{value:r,children:r},r))})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The workflow will start with the 7 standard steps. You can edit, reorder, and add steps after creation."})]}
6),e.jsxs(H,{children:[e.jsx(o,{variant:"ghost",onClick:()=>h(!1),children:"Cancel"}),e.jsxs(o,{onClick:v,disabled:!i.trim()||d.isPending,children:[d.isPending&&e.jsx(y,{className:"h-4 w-4 mr-2 animate-spin"}),"Create"]})]})]})]}),children:s.length===0?e.jsxs(b,{className:"p-8 text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"No workflows yet."}),e.jsxs(o,{onClick:()=>l.mutate(),disabled:l.isPending,children:[l.isPending&&e.jsx(y,{className:"h-4 w-4 mr-2 animate-spin"}),"Create standard workflow"]})]}):e.jsx(M,{type:"single",collapsible:!0,value:m,onValueChange:u,className:"space-y-2 max-w-4xl",children:s.map(r=>e.jsx(be,{workflow:r},r.id))})})}function be({workflow:s}){const{data:l=[]}=le(s.id),d=ce(),m=oe(),u=de(),x=me(),h=ue(),[i,p]=c.useState([]),[n,t]=c.useState(s.name);c.useEffect(()=>p(l),[l]),c.useEffect(()=>t(s.name),[s.name]);const v=xe(he(pe,{activationConstraint:{distance:4}})),r=a=>{const{active:N,over:C}=a;if(!C||N.id===C.id)return;const P=i.findIndex(j=>j.id===N.id),V=i.findIndex(j=>j.id===C.id),w=Se(i,P,V);p(w),u.mutate(w.map(j=>j.id))},S=()=>{d.mutate({workflow_id:s.id,name:"New Step",position:i.length,sla_hours:24,color:"#2F80ED",is_parallel:!1,is_active:!0})};return e.jsxs(G,{value:s.id,className:"border rounded-lg bg-card px-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"flex-1 hover:no-underline py-3",children:e.jsxs("div",{className:"flex items-center gap-2 text-left",children:[e.jsx("span",{className:"font-medium",children:s.name}),s.is_default&&e.jsx(D,{variant:"secondary",className:"text-[10px]",children:"default"}),e.jsx(D,{variant:"outline",className:"text-[10px] uppercase",children:s.vehicle_type}),e.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:[l.length," step",l.length===1?"":"s"]})]})}),e.jsxs("div",{className:"flex items-center gap-1 pr-1",onClick:a=>a.stopPropagation(),children:[!s.is_default&&e.jsx(o,{size:"icon",variant:"ghost",title:"Set as default",onClick:()=>x.mutate({id:s.id,patch:{is_default:!0}}),children:e.jsx(De,{className:"h-4 w-4"})}),s.is_default&&e.jsx(o,{size:"icon",variant:"ghost",disabled:!0,title:"Default workflow",children:e.jsx(we,{className:"h-4 w-4 fill-current"})}),e.jsxs(Q,{children:[e.jsx(J,{asChild:!0,children:e.jsx(o,{size:"icon",variant:"ghost",className:"text-destructive",disabled:s.is_default,title:s.is_default?"Cannot delete default workflow":"Delete workflow",children:e.jsx(_,{className:"h-4 w-4"})})}),e.jsxs(K,{children:[e.jsxs(X,{children:[e.jsxs(Z,{children:['Delete "',s.name,'"?']}),e.jsx($,{children:"This removes the workflow from the list. It will fail if any work-type mappings or active vehicles still reference it — reassign those first."})]}),e.jsxs(ee,{children:[e.jsx(se,{children:"Cancel"}),e.jsx(ae,{onClick:()=>h.mutate(s.id),children:"Delete"})]})]})]})]})]}),e.jsxs(Y,{className:"pb-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx(f,{className:"text-xs whitespace-nowrap",children:"Name"}),e.jsx(g,{value:n,onChange:a=>t(a.target.value),onBlur:()=>n!==s.name&&n.trim()&&x.mutate({id:s.id,patch:{name:n.trim()}}),className:"max-w-sm"}),e.jsx(f,{className:"text-xs whitespace-nowrap ml-2",children:"Type"}),e.jsxs(k,{value:s.vehicle_type,onValueChange:a=>x.mutate({id:s.id,patch:{vehicle_type:a}}),children:[e.jsx(I,{className:"w-32",children:e.jsx(R,{})}),e.jsx(T,{children:W.map(a=>e.jsx(E,{value:a,children:a},a))})]})]}),e.jsx(fe,{sensors:v,collisionDetection:je,onDragEnd:r,children:e.jsx(Ne,{items:i.map(a=>a.id),strategy:ve,children:e.jsx("div",{className:"space-y-2",children:i.map(a=>e.jsx(Ae,{step:a,onChange:N=>d.mutate({id:a.id,...N}),onDelete:()=>m.mutate(a.id)},a.id))})})}),e.jsxs(o,{size:"sm",variant:"outline",onClick:S,className:"mt-3",children:[e.jsx(A,{className:"h-4 w-4 mr-1"})," Add step"]})]})]})}function Ae({step:s,onChange:l,onDelete:d}){const{attributes:m,listeners:u,setNodeRef:x,transform:h,transition:i,isDragging:p}=Ce({id:s.id}),n={transform:ge.Transform.toString(h),transition:i,opacity:p?.6:1};return e.jsxs(b,{ref:x,style:n,className:"p-3 flex items-center gap-3",children:[e.jsx("button",{...m,...u,className:"cursor-grab text-muted-foreground touch-none",children:e.jsx(ye,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1 grid grid-cols-1 md:grid-cols-12 gap-2 items-center",children:[e.jsx(g,{className:"md:col-span-5",defaultValue:s.name,onBlur:t=>t.target.value!==s.name&&l({name:t.target.value})}),e.jsxs("div",{className:"md:col-span-3 flex items-center gap-2",children:[e.jsx(f,{className:"text-xs whitespace-nowrap",children:"SLA hrs"}),e.jsx(g,{type:"number",defaultValue:s.sla_hours,onBlur:t=>Number(t.target.value)!==s.sla_hours&&l({sla_hours:Number(t.target.value)})})]}),e.jsxs("div",{className:"md:col-span-3 flex items-center gap-2",children:[e.jsx(f,{className:"text-xs",children:"Color"}),e.jsx(g,{type:"color",className:"w-16 p-1 h-9",defaultValue:s.color??"#2F80ED",onBlur:t=>t.target.value!==s.color&&l({color:t.target.value})})]}),e.jsx(o,{size:"icon",variant:"ghost",className:"md:col-span-1 text-destructive",onClick:d,children:e.jsx(_,{className:"h-4 w-4"})})]})]})}export{Je as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.