PageSourceSearch

https://directory.herplan.org/assets/PathwayDesignationDetail-2f269700.js

js herplan.org collected 2026-09-25 02:32:56 UTC 7,201 bytes, 109 lines download raw bytes

1import{g as t,af as N,c as E,r as o,j as e}from"./index-c3583149.js";import{a as s}from"./index-196fb7c4.js";import{p as G,q as H,n as V}from"./useAdminPathways-97c68ffa.js";import{C as W}from"./ConfirmModal-f1843749.js";import{L as J,a as K}from"./index-d1c0a02a.js";import{P as Q,a as X,j as Y,B,C as Z,F as p,L as u,I as f,m as T,T as _,k as ee}from"./common.styles-ac44832d.js";import{A as se}from"./arrow-left-a72c65ba.js";import{T as ne}from"./trash-2-17444490.js";import{S as ae}from"./save-5a6d56f9.js";import"./list-checks-08c81a95.js";import"./useMutation-69b09b1c.js";import"./Modal.styles-78fd50f6.js";import"./triangle-alert-6b419c2b.js";import"./info-1683ec57.js";import"./search-92768975.js";const te=t.button`
2  display: flex;
3  align-items: center;
4  gap: ${s.spacing.sm};
5  padding: 0;
6  border: none;
7  background: none;
8  color: ${s.colors.textSecondary};
9  font-size: 14px;
10  cursor: pointer;
11  transition: color ${s.transitions.fast};
12
13  &:hover {
14    color: ${s.colors.primary};
15  }
16
17  svg {
18    width: 18px;
19    height: 18px;
20  }
21`,ie=t.div`
22  display: flex;
23  flex-direction: column;
24  gap: ${s.spacing.sm};
25`,re=t.div`
26  display: grid;
27  grid-template-columns: repeat(2, 1fr);
28  gap: ${s.spacing.lg};
29
30  @media (max-width: 768px) {
31    grid-template-columns: 1fr;
32  }
33`,oe=t.div`
34  grid-column: 1 / -1;
35`,le=t.div`
36  display: flex;
37  gap: ${s.spacing.sm};
38`,ce=t(f)`
39  flex: 1;
40`,de=t.button`
41  padding: ${s.spacing.sm} ${s.spacing.md};
42  background: ${s.colors.bgSecondary};
43  border: 1px solid ${s.colors.border};
44  border-radius: ${s.borderRadius.md};
45  color: ${s.colors.textSecondary};
46  font-size: 12px;
47  cursor: pointer;
48  white-space: nowrap;
49  transition: all ${s.transitions.fast};
50
51  &:hover {
52    background: ${s.colors.bgHover};
53    color: ${s.colors.primary};
54  }
55`,y=t.span`
56  display: block;
57  font-size: 12px;
58  color: ${s.colors.textMuted};
59  margin-top: 4px;
60`,ge=t.div`
61  display: flex;
62  align-items: center;
63  gap: ${s.spacing.md};
64`,pe=t.span`
65  font-size: 14px;
66  color: ${l=>l.$active?s.colors.success:s.colors.textSecondary};
67  font-weight: 500;
68`,ue=t.div`
69  display: flex;
70  gap: ${s.spacing.xl};
71  padding: ${s.spacing.md};
72  margin-top: ${s.spacing.lg};
73  background: ${s.colors.bgSecondary};
74  border-radius: ${s.borderRadius.md};
75  font-size: 13px;
76`,I=t.div`
77  display: flex;
78  flex-direction: column;
79  gap: 2px;
80
81  span:first-child {
82    font-weight: 500;
83    color: ${s.colors.textMuted};
84    font-size: 11px;
85    text-transform: uppercase;
86    letter-spacing: 0.5px;
87  }
88
89  span:last-child {
90    color: ${s.colors.textSecondary};
91  }
92`,me=t.div`
93  margin-top: ${s.spacing.lg};
94  padding-top: ${s.spacing.lg};
95  border-top: 1px solid ${s.colors.borderLight};
96`,he=t.h3`
97  font-size: 14px;
98  font-weight: 600;
99  color: ${s.colors.textPrimary};
100  margin: 0 0 ${s.spacing.md} 0;
101`,xe=t.div`
102  display: flex;
103  flex-wrap: wrap;
104  gap: ${s.spacing.sm};
105`,fe=t.span`
106  font-size: 13px;
107  color: ${s.colors.textMuted};
108  font-style: italic;
109`,U=l=>l?new Date(l).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-",Ie=()=>{var L,P;const{desId:l}=N(),v=E(),[a,$]=o.useState({}),[z,w]=o.useState(!1),[M,S]=o.useState(!1),[g,m]=o.useState({}),[h,b]=o.useState({}),{data:i,isLoading:O}=G(l),j=H(),C=V();o.useEffect(()=>{i&&$({name:i.name||"",slug:i.slug||"",description:i.description||"",iconUrl:i.iconUrl||"",isActive:i.isActive!==!1,sortOrder:i.sortOrder||0})},[i]);const c=o.useCallback((n,r)=>{$(x=>({...x,[n]:r})),w(!0)},[]),k=o.useCallback(n=>{var r,x;b(d=>({...d,[n]:!0})),n==="name"&&!((r=a.name)!=null&&r.trim())?m(d=>({...d,name:"Name is required"})):n==="slug"&&!((x=a.slug)!=null&&x.trim())?m(d=>({...d,slug:"Slug is required"})):m(d=>({...d,[n]:null}))},[a]),R=o.useCallback(()=>{const n=(a.name||"").toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim();c("slug",n)},[a.name,c]),D=((L=a.name)==null?void 0:L.trim())&&((P=a.slug)==null?void 0:P.trim()),q=async()=>{var n,r;if(b({name:!0,slug:!0}),!D){m({name:(n=a.name)!=null&&n.trim()?null:"Name is required",slug:(r=a.slug)!=null&&r.trim()?null:"Slug is required"});return}await j.mutateAsync({id:l,data:a}),w(!1)},F=async()=>{await C.mutateAsync(l),v("/admin/pathways/designations")};if(O)return e.jsx(J,{});if(!i)return e.jsx("div",{children:"Designation not found"});const A=i.designationPathways||[];return e.jsxs("div",{children:[e.jsxs(Q,{children:[e.jsxs(ie,{children:[e.jsxs(te,{onClick:()=>v("/admin/pathways/designations"),children:[e.jsx(se,{})," Back to Designations"]}),e.jsx(X,{children:i.name||"Designation"})]}),e.jsxs(Y,{children:[e.jsxs(B,{$variant:"secondary",onClick:()=>S(!0),children:[e.jsx(ne,{}),"Delete"]}),e.jsxs(B,{onClick:q,disabled:!z||!D||j.isPending,children:[e.jsx(ae,{}),j.isPending?"Saving...":"Save Changes"]})]})]}),e.jsxs(Z,{children:[e.jsxs(re,{children:[e.jsxs(p,{children:[e.jsx(u,{children:"Name *"}),e.jsx(f,{value:a.name||"",onChange:n=>c("name",n.target.value),onBlur:()=>k("name"),placeholder:"Designation name",$error:h.name&&g.name}),h.name&&g.name&&e.jsx(T,{children:g.name})]}),e.jsxs(p,{children:[e.jsx(u,{children:"Slug *"}),e.jsxs(le,{children:[e.jsx(ce,{value:a.slug||"",onChange:n=>c("slug",n.target.value),onBlur:()=>k("slug"),placeholder:"designation-slug",$error:h.slug&&g.slug}),e.jsx(de,{type:"button",onClick:R,children:"Generate"})]}),h.slug&&g.slug?e.jsx(T,{children:g.slug}):e.jsx(y,{children:"URL-friendly identifier"})]}),e.jsx(oe,{children:e.jsxs(p,{children:[e.jsx(u,{children:"Description"}),e.jsx(_,{value:a.description||"",onChange:n=>c("description",n.target.value),placeholder:"Brief description of this designation...",rows:3})]})}),e.jsxs(p,{children:[e.jsx(u,{children:"Icon URL"}),e.jsx(f,{value:a.iconUrl||"",onChange:n=>c("iconUrl",n.target.value),placeholder:"https://example.com/icon.png"}),e.jsx(y,{children:"Optional icon image URL"})]}),e.jsxs(p,{children:[e.jsx(u,{children:"Sort Order"}),e.jsx(f,{type:"number",value:a.sortOrder||0,onChange:n=>c("sortOrder",parseInt(n.target.value)||0),placeholder:"0"})]}),e.jsxs(p,{children:[e.jsx(u,{children:"Status"}),e.jsxs(ge,{children:[e.jsx(K,{checked:a.isActive,onChange:()=>c("isActive",!a.isActive)}),e.jsx(pe,{$active:a.isActive,children:a.isActive?"Active":"Inactive"})]})]})]}),e.jsxs(me,{children:[e.jsx(he,{children:"Linked Pathways"}),A.length>0?e.jsx(xe,{children:A.map(n=>{const r=n.pathway||n;return e.jsx(ee,{$color:"info",children:r.title||r.name||"Unknown"},r.id||n.pathwayId)})}):e.jsx(fe,{children:"No pathways are currently linked to this designation."}),e.jsx(y,{children:"Pathways are linked from each pathway's detail page."})]}),e.jsxs(ue,{children:[e.jsxs(I,{children:[e.jsx("span",{children:"Created"}),e.jsx("span",{children:U(i.createdAt)})]}),e.jsxs(I,{children:[e.jsx("span",{children:"Last Updated"}),e.jsx("span",{children:U(i.updatedAt)})]})]})]}),e.jsx(W,{isOpen:M,onClose:()=>S(!1),onConfirm:F,title:"Delete Designation",message:`Are you sure you want to delete "${i.name}"? This may affect pathways and quiz results. This action cannot be undone.`,confirmLabel:"Delete",variant:"danger",loading:C.isPending})]})};export{Ie 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.