PageSourceSearch

https://app.getmika.de/assets/TagDimensionsListPage-BDtT1zSd.js

js getmika.de collected 2026-10-04 20:34:17 UTC 8,447 bytes, 1 lines download raw bytes

1import{u as P,R,j as e,D as A,bF as F,bs as H,ak as z,Q as w,b5 as W,U as M,W as u,bH as L,c as I,H as S,cE as B,l as E,r as D,B as k,T as f,I as O,V as N,cF as G,A as U}from"./index-7xGZQarM.js";import{u as V,a as $,M as q}from"./useMaterialTableLocalizations-DPYE8sBE.js";import{u as X,a as K,t as Q,b as J,M as Y}from"./tagDimensionSchema-CYc73qKU.js";import{u as Z}from"./useTagDimensions-DLVjyWd5.js";import{D as ee}from"./DeleteConfirmationDialog-D-pSYy0G.js";import{D as te}from"./DefaultPageLayout-bbCS046_.js";import{u as oe,C as j}from"./index.esm-DOD_RurM.js";import{t as ie}from"./zod-CERegKzJ.js";import{L as se}from"./LoadingButton-yCAXRQtY.js";import{G as g}from"./Grid2-CqkvP9PW.js";import"./FilterList-CfC8ZNfH.js";import"./Cancel-BlnYbyP5.js";import"./ChevronLeft-BypL7b9K.js";import"./ChevronRight-BZUgjbrl.js";import"./Close-NGby4exw.js";import"./Edit-m0K2sIjo.js";import"./MoreHoriz-DvzEe5W7.js";import"./MoreVert-Z1K4srxs.js";import"./Save-i4ZLZztX.js";import"./Search-YZXvKpih.js";import"./SyncAlt-DdabvHrq.js";import"./VisibilityOff-DhWxHQS9.js";import"./TableContainer-DDhXiLrJ.js";import"./Radio-XrD7-2CQ.js";import"./SwitchBase-CKLZN_1j.js";import"./Checkbox-DkzlDVTd.js";import"./AlertTitle-C9clW8Qe.js";import"./InputAdornment-CC073Qcr.js";import"./LastPage-UCOYoOOK.js";import"./TableRow-DQ4OkwtL.js";import"./TableCell-B-nUAv02.js";import"./TableHead-BpHnNk87.js";import"./TableFooter-7Ehdft4V.js";import"./FormControlLabel-DqMfjOHn.js";import"./Switch-CqhDk0KC.js";import"./Skeleton-BxdWaZFf.js";import"./TableSortLabel-oKAXVZpR.js";import"./useMobilePicker-CJCKk2wT.js";import"./index-CNDwnMCn.js";import"./DateTimePicker-CNRBlyYS.js";import"./Tabs-UUScyAjW.js";import"./KeyboardArrowRight-wCAMC8hU.js";import"./DatePicker-CoBYe_mk.js";import"./Autocomplete-B5hcJ7DM.js";import"./ListSubheader-Ck6edDXz.js";import"./ArrowBack-Dfl3xaIh.js";import"./Fab-CQzwzmnA.js";import"./createGrid-ZBMOdsSe.js";const ne=({open:s,onClose:p,tagDimension:n,onSuccess:c})=>{const{t}=P("tags"),{mutateAsync:v,isPending:h}=X(),{mutateAsync:b,isPending:C}=K(),d=!!n,{control:r,handleSubmit:T,reset:m,formState:{errors:_,isDirty:y}}=oe({resolver:ie(Q),defaultValues:{name:n?.name||"",ai_description:n?.ai_description||"",selection_method:n?.selection_method||"force_selection",datev_cost_center_number:n?.datev_cost_center_number??null}});R.useEffect(()=>{n?m({name:n.name,ai_description:n.ai_description||"",selection_method:n.selection_method,datev_cost_center_number:n.datev_cost_center_number}):s&&m({name:"",ai_description:"",selection_method:"force_selection",datev_cost_center_number:null})},[n,m,s]);const i=async o=>{if(d&&n){const l={name:o.name,ai_description:o.ai_description,selection_method:o.selection_method,datev_cost_center_number:o.datev_cost_center_number};await b({id:n.id,data:l})}else{const l={name:o.name,ai_description:o.ai_description||"",selection_method:o.selection_method,datev_cost_center_number:o.datev_cost_center_number},x=await v(l);c?.(x)}c?.(),p()},a=()=>{m(),p()};return e.jsxs(A,{open:s,onClose:a,maxWidth:"sm",fullWidth:!0,children:[e.jsx(F,{children:t(d?"tag_dimensions.form.edit_title":"tag_dimensions.form.create_title")}),e.jsxs("form",{onSubmit:T(i),children:[e.jsx(H,{children:e.jsxs(g,{container:!0,spacing:2,sx:{mt:1},children:[e.jsx(g,{size:{xs:12},children:e.jsx(j,{name:"name",control:r,render:({field:o})=>e.jsx(z,{...o,fullWidth:!0,label:t("tag_dimensions.form.name_label"),placeholder:t("tag_dimensions.form.name_placeholder"),error:!!_.name,helperText:_.name?.message,required:!0})})}),e.jsx(g,{size:{xs:12},children:e.jsx(j,{name:"ai_description",control:r,render:({field:o})=>e.jsx(z,{...o,fullWidth:!0,multiline:!0,rows:4,label:t("tag_dimensions.form.ai_description_label"),placeholder:t("tag_dimensions.form.ai_description_placeholder"),error:!!_.ai_description,helperText:_.ai_description?.message,inputProps:{maxLength:4e3}})})}),e.jsx(g,{size:{xs:12},children:e.jsx(j,{name:"selection_method",control:r,render:({field:o})=>e.jsxs(w,{fullWidth:!0,required:!0,children:[e.jsx(W,{children:t("tag_dimensions.form.selection_method_label")}),e.jsxs(M,{...o,label:t("tag_dimensions.form.selection_method_label"),children:[e.jsx(u,{value:"force_selection",children:t("tag_dimensions.form.selection_method_force_selection")}),e.jsx(u,{value:"allow_empty_no_todo",children:t("tag_dimensions.form.selection_method_allow_empty_no_todo")}),e.jsx(u,{value:"allow_empty_create_todo",children:t("tag_dimensions.form.selection_method_allow_empty_create_todo")})]})]})})}),e.jsx(g,{size:{xs:12},children:e.jsx(j,{name:"datev_cost_center_number",control:r,render:({field:o})=>e.jsxs(w,{fullWidth:!0,children:[e.jsx(W,{children:t("tag_dimensions.form.datev_cost_center_number_label")}),e.jsxs(M,{value:o.value??"",onChange:l=>{const x=l.target.value;o.onChange(x===""?null:Number(x))},label:t("tag_dimensions.form.datev_cost_center_number_label"),children:[e.jsx(u,{value:"",children:e.jsx("em",{children:t("tag_dimensions.form.datev_cost_center_number_placeholder")})}),e.jsx(u,{value:1,children:"1"}),e.jsx(u,{value:2,children:"2"})]})]})})})]})}),e.jsxs(L,{children:[e.jsx(I,{onClick:a,children:t("tag_dimensions.form.cancel")}),e.jsx(se,{type:"submit",variant:"contained",loading:h||C,disabled:d&&!y,label:t(d?"tag_dimensions.form.save":"tag_dimensions.form.create"),icon:e.jsx(S,{icon:B,size:18,color:"currentColor",strokeWidth:2})})]})]})]})},et=()=>{const{t:s}=P("tags"),p=E(),n=V(),[c,t]=D.useState(null),[v,h]=D.useState(!1),{data:b,isLoading:C}=Z(),{mutateAsync:d}=J(),r=(b?.length||0)>=Y,T=async()=>{c&&(await d(c),t(null))},m=D.useMemo(()=>[{accessorKey:"name",header:s("tag_dimensions.list.description_column"),size:400,Cell:({row:i})=>{const a=i.original;return e.jsxs(k,{children:[e.jsx(f,{variant:"body1",fontWeight:"bold",children:a.name}),a.ai_description&&e.jsx(f,{variant:"body2",color:"text.secondary",sx:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",mt:.5}
1,children:a.ai_description})]})}},{id:"datev_cost_center_number",header:s("tag_dimensions.list.datev_id_column"),size:120,Cell:({row:i})=>{const a=i.original;return e.jsx(f,{variant:"body2",children:a.datev_cost_center_number??"-"})}},{id:"tags_count",header:s("tag_dimensions.list.tags_count_column"),size:120,Cell:({row:i})=>{const a=i.original;return e.jsx(f,{variant:"body2",children:a.tag_count||0})}},{id:"actions",header:s("tag_dimensions.list.actions_column"),size:100,Cell:({row:i})=>{const a=i.original;return e.jsx(O,{size:"small",onClick:o=>{o.stopPropagation(),t(a.id)},color:"error","aria-label":s("tag_dimensions.list.delete_confirmation_title"),children:e.jsx(S,{icon:N,size:18,color:"currentColor",strokeWidth:2})})}}],[s]),_=$({localization:n,columns:m,data:b||[],enableColumnActions:!1,enableColumnFilters:!1,enableSorting:!0,enableColumnResizing:!0,layoutMode:"grid",enableBottomToolbar:!1,enableTopToolbar:!1,enablePagination:!1,enableDensityToggle:!1,enableFullScreenToggle:!1,enableHiding:!1,state:{density:"compact",isLoading:C},muiTableHeadProps:{sx:{backgroundColor:"transparent"}},muiTableHeadRowProps:{sx:{backgroundColor:"background.paper",boxShadow:"none"}},muiTableHeadCellProps:({table:i,column:a})=>({sx:{backgroundColor:"background.paper",borderRadius:0,fontWeight:i.getState().sorting.some(l=>l.id===a.id)?"bold":"normal","& .Mui-TableHeadCell-ResizeHandle-Wrapper":{opacity:0}
1}}),muiTableBodyRowProps:({row:i})=>({onClick:()=>p(`/settings/tags/${i.original.id}`),sx:{cursor:"pointer","&:hover":{backgroundColor:"background.paper"}}}),muiTablePaperProps:{elevation:0},muiTableProps:{sx:{"& .MuiTableRow-root:hover":{backgroundColor:"background.paper"}}}}),y=i=>{i&&p(`/settings/tags/${i.id}`)};return e.jsx(te,{title:s("tag_dimensions.title"),children:e.jsxs(k,{children:[e.jsx(k,{sx:{display:"flex",justifyContent:"flex-start",alignItems:"center",mb:2},children:e.jsx(I,{variant:"text",startIcon:e.jsx(S,{icon:G,size:18,color:"currentColor",strokeWidth:2}),onClick:()=>h(!0),disabled:r,children:s("tag_dimensions.list.add_tag_dimension")})}),r&&e.jsx(U,{severity:"info",sx:{mb:2},children:s("tag_dimensions.list.max_dimensions_reached")}),e.jsx(q,{table:_}),e.jsx(ne,{open:v,onClose:()=>h(!1),onSuccess:y}),e.jsx(ee,{title:s("tag_dimensions.list.delete_confirmation_title"),description:s("tag_dimensions.list.delete_confirmation_message"),isOpen:!!c,handleClose:()=>t(null),onDelete:T})]})})};export{et 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.