1import{r as l,C as e}from"./vendor-core-kDn7q5nn.js";import{g as D,d0 as U,ds as W,aN as M,dJ as P,dW as z,aq as Z,f9 as ee,dI as G,dZ as X,fa as te,e4 as ie,ae as se,eG as ne,e5 as re,i as ae,dX as oe,dY as ce,h as le,P as de,b2 as pe,d_ as w,ak as ue,$ as O,A as B,aM as fe,aL as ge,fb as me}from"./app-shared-D9Va_FlY.js";import{F as V}from"./index-DWcLyEJP.js";import{S as Q}from"./SettingRow-DCJKnRYv.js";import{av as R,s as y,l as xe,r as q,aY as he,q as Y,Q as ye,D as je,B as L,j as ke,aC as ve,i as _e,aS as Se,g as be,M as F,I as H,aW as we,aX as Te,a4 as Ce,di as Ee,a5 as $}from"./antd-DUwX4n57.js";import{u as Qe,a as Ae}from"./PropertyStatsContext-fiOExTqe.js";import{P as Re}from"./index-DVMF40E5.js";import{u as Pe,S as Ie,a as Me}from"./index-Cp1actIa.js";import{S as Le}from"./index-DBFHv1qZ.js";import{d as De,V as Oe}from"./VerificationModeSelect-DUsnzPni.js";import{u as Be}from"./useDirtyState-IZQSP_hZ.js";import{u as Ve}from"./PropertyHeaderExtrasContext-BHbpETXB.js";import"./pro-components-U2bZqxZr.js";import"./mapbox-DrKvbh0K.js";import"./xlsx-DLNWaC59.js";import"./calendar-C0yHFNg9.js";import"./iso-3166-D9CfHPRA.js";import"./charts-B4kAPUKr.js";import"./html2canvas-CBrSDip1.js";const{Text:qe,Paragraph:N}=Y,Fe=({propertyId:n})=>{const{t}=D(["properties","common"]),r=U(),[a,i]=l.useState(!1),[T,g]=l.useState(!1),[C,m]=l.useState(!1),[j]=R.useForm(),f=W({queryKey:P.ticketQr(n),queryFn:()=>M.getTicketQr(n),staleTime:5*60*1e3,onError:()=>y.error(t("properties:ticketQr.loadError"))}),d=f.isLoading,s=f.data??null,p=o=>r.setQueryData(P.ticketQr(n),o),v=async o=>{i(!0);try{const u=await M.setTicketQr(n,o);p(u),y.success(t("common:saved"))}catch{y.error(t("properties:ticketQr.saveError"))}finally{i(!1)}},_=()=>{F.confirm({title:t("properties:ticketQr.rotateConfirmTitle"),content:t("properties:ticketQr.rotateConfirm"),okText:t("properties:ticketQr.rotateOk"),okButtonProps:{danger:!0},cancelText:t("common:cancel"),onOk:async()=>{try{const o=await M.rotateTicketQr(n);p(o),y.success(t("properties:ticketQr.rotated"))}catch{y.error(t("properties:ticketQr.saveError"))}}})},S=async()=>{if(s!=null&&s.public_url)try{await navigator.clipboard.writeText(s.public_url),y.success(t("properties:ticketQr.copied"))}catch{y.error(t("properties:ticketQr.copyError"))}},E=async o=>{var u;m(!0);try{const{runId:x}=await Z.runExport({key:"qrcode.ticket-poster",format:"pdf",filters:{property_id:n,title:o.title,...(u=o.description)!=null&&u.trim()?{description:o.description.trim()}:{}},selfNotify:!0});g(!1),ee(x)}catch{y.error(t("properties:ticketQr.posterError"))}finally{m(!1)}},k=()=>{var x;const o=(x=document.getElementById(`ticket-qr-canvas-${n}`))==null?void 0:x.querySelector("canvas");if(!o)return;const u=document.createElement("a");u.download=`ticket-qr-${n}.png`,u.href=o.toDataURL("image/png"),u.click()};return d?e.jsx(xe,{active:!0,paragraph:{rows:2}}):e.jsxs("div",{children:[e.jsxs(q,{align:"center",style:{marginBottom:8},children:[e.jsx(he,{checked:(s==null?void 0:s.enabled)??!1,loading:a,onChange:v}),e.jsx(qe,{strong:!0,children:t("properties:ticketQr.toggleLabel")})]}),e.jsx(N,{type:"secondary",style:{marginBottom:12},children:t("properties:ticketQr.description")}),(s==null?void 0:s.enabled)&&e.jsxs(e.Fragment,{children:[s.public_url&&e.jsx("div",{id:`ticket-qr-canvas-${n}`,style:{display:"none"},"aria-hidden":"true",children:e.jsx(ye,{value:s.public_url,size:512,errorLevel:"H"})}),e.jsxs(q,{wrap:!0,children:[e.jsx(je,{menu:{items:[{key:"qr",icon:e.jsx(z,{size:16}),label:t("properties:ticketQr.downloadQr"),onClick:k},{key:"poster",icon:e.jsx(ve,{}),label:t("properties:ticketQr.downloadPoster"),onClick:()=>g(!0)}]},children:e.jsx(L,{type:"primary",icon:e.jsx(ke,{}),children:t("properties:ticketQr.downloads")})}),s.public_url&&e.jsx(L,{icon:e.jsx(_e,{}),onClick:S,children:t("properties:ticketQr.copy")}),e.jsx(L,{icon:e.jsx(Se,{}),onClick:_,children:t("properties:ticketQr.rotateButton")})]})]}),s&&!s.enabled&&s.token&&e.jsx(be,{type:"info",showIcon:!0,message:t("properties:ticketQr.disabledHint")}),e.jsxs(F,{title:t("properties:ticketQr.posterModalTitle"),open:T,onCancel:()=>g(!1),onOk:()=>j.submit(),okText:t("properties:ticketQr.posterCreate"),confirmLoading:C,destroyOnHidden:!0,children:[e.jsx(N,{type:"secondary",children:t("properties:ticketQr.posterModalHint")}),e.jsxs(R,{form:j,layout:"vertical",onFinish:E,initialValues:{title:t("properties:ticketQr.posterDefaultTitle")},children:[e.jsx(R.Item,{name:"title",label:t("properties:ticketQr.posterTitleLabel"),rules:[{required:!0,min:3,max:120}],children:e.jsx(H,{maxLength:120})}),e.jsx(R.Item,{name:"description",label:t("properties:ticketQr.posterDescriptionLabel"),children:e.jsx(H.TextArea,{rows:3,maxLength:600})})]})]})]})},He=()=>e.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 11-2.83 2.83l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 11-4 0v-.09A1.65 1.65 0 009
119.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 11-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 110-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 112.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 114 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 112.83 2.83l-.06.06A1.65 1.65 0 0019.4 9a1.65 1.65 0 001.51 1H21a2 2 0 110 4h-.09a1.65 1.65 0 00-1.51 1z"})]}),$e=()=>e.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 8a6 6 0 10-12 0c0 7-3 9-3 9h18s-3-2-3-9"}),e.jsx("path",{d:"M13.73 21a2 2 0 01-3.46 0"})]}),Ne=({getPropertyData:n,activated:t,children:r})=>{const{t:a}=D(["common","portal","properties"]),{property:i}=G(),{saveIncidentConfig:T,saveLocationVerification:g}=X(),C=U(),m=te("incident_classification"),j=!!(m!=null&&m.enabled),f=De(i,"incidents"),{values:d,isDirty:s,updateValue:p,markSaved:v,reset:_}=Be({aiClassification:(i==null?void 0:i.ai_incident_classification)??!1,incidentRuleId:(i==null?void 0:i.incident_rule_id)??null,activated:t,verification:f}),{release:S}=ie({isDirty:s,confirm:{title:a("portal:propertyEdit.discardTitle",{defaultValue:"Ãnderungen verwerfen?"}),content:a("portal:propertyEdit.discardBody",{defaultValue:"Deine Eingaben zu diesem Objekt gehen verloren."}),okText:a("portal:propertyEdit.discard",{defaultValue:"Verwerfen"}),cancelText:a("portal:propertyEdit.discardCancel",{defaultValue:"Bleiben"})}}),[E,k]=l.useState(!1),[o,u]=l.useState({}),x=l.useCallback(h=>{u(A=>({...A,[h]:!A[h]}))},[]);l.useEffect(()=>{i&&p("aiClassification",i.ai_incident_classification??!1)},[i==null?void 0:i.ai_incident_classification]),l.useEffect(()=>{i&&p("incidentRuleId",i.incident_rule_id??null)},[i==null?void 0:i.incident_rule_id]),l.useEffect(()=>{p("activated",t)},[t]),l.useEffect(()=>{p("verification",f)},[f]);const c=async()=>{if(!i)return!1;try{return k(!0),d.verification!==f&&await g(i.property_id,{incidents:d.verification,forms:d.verification}),await T(i.property_id,{show_incidents:d.activated,ai_incident_classification:d.aiClassification,incident_rule_id:d.incidentRuleId??null}),S(),v(),n(!0),C.invalidateQueries({queryKey:P.similarityAll(i.property_id)}),y.success(a("common:saved")),!0}catch(h){const{message:A}=h;return y.error(a(A)),!1}finally{k(!1)}},{secondLevelPlural:b,secondLevelPluralKnown:I}=se(),{applyToAll:J}=Pe({property:i,section:"incidents",isDirty:s,saveSection:c});return i?e.jsxs(Re,{onSave:c,isDirty:s,saving:E,onSaveAll:J,saveAllLabel:a(re("portal:property.saveActions.applyAll",I),{secondLevel:b}),onDiscard:_,headerExtra:e.jsxs(e.Fragment,{children:[e.jsx(Ie,{propertyId:i.property_id,section:"incidents"}),e.jsx(Me,{property:i,section:"incidents",isDirty:s,saveSection:c})]}),children:[e.jsxs("div",{style:{opacity:t?1:.4,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"},children:[e.jsxs(Q,{id:"config",icon:e.jsx(He,{}),title:a("portal:property.settingsAccordion.incidents"),hint:a("portal:property.settingsAccordion.incidentsDesc"),open:o,onToggle:x,children:[e.jsx(Oe,{value:d.verification,onChange:h=>p("verification",h)}),e.jsx(Le,{title:a("portal:property.incidents.aiClassificationTitle"),desc:a(j?"portal:property.incidents.aiClassificationDescription":"portal:property.incidents.aiClassificationTenantOff"),checked:j&&d.aiClassification,disabled:!j,onChange:h=>p("aiClassification",h)})]}),e.jsx(Q,{id:"reaction",icon:e.jsx($e,{}),title:a("portal:reactionRule.sectionTitle",{defaultValue:"Benachrichtigungen"}),hint:a("portal:reactionRule.sectionHintIncidents",{defaultValue:"Welcher Workflow bei neuen Meldungen läuft"}),open:o,onToggle:x,children:e.jsxs("div",{className:"setting-row",children:[e.jsxs("div",{className:"setting-row__body",children:[e.jsx("div",{className:"setting-row__title-line",children:e.jsx("span",{className:"setting-row__title",children:a("portal:reactionDefaults.slots.incidentReaction.label",{defaultValue:"Meldungen"})})}),e.jsx("p",{className:"setting-row__desc",children:a("portal:reactionRule.sectionDescIncidents",{defaultValue:"Gilt für neue und klassifizierte Meldungen dieses Objekts. Ohne eigene Auswahl greift der Objekt- bzw. Mandanten-Standard."})})]}),e.jsx(ne,{triggerType:"incident.reaction",slot:"incident.reaction",propertyId:i.property_id,propertyUuid:i.unique_prop_id,value:d.incidentRuleId,onChange:h=>p("incidentRuleId",h),defaultLabel:a("portal:reactionRule.default")})]})})]}),r]}):null},{Text:Ke,Link:K}=Y,pt=()=>{var u,x;const{t:n}=D(["common","portal","onboarding","properties"]),t=ae(),{property:r}=G(),{setFlag:a}
1=oe(),{refreshProperty:i}=ce();X();const T=le(de.UPDATE_PROPERTIES),[g,C]=l.useState((r==null?void 0:r.show_incidents)??!1),{setActive:m}=Qe(),{overview:j}=Ae(),[f,d]=l.useState({}),s=c=>d(b=>({...b,[c]:!b[c]}));l.useEffect(()=>(m(!0),()=>m(!1)),[m]);const{setExtras:p,clearExtras:v}=Ve(),_=l.useMemo(()=>e.jsx(pe,{docKey:"propertyIncidents",size:"middle"}),[]);l.useEffect(()=>(p(_),v),[p,v,_]);const S=W({queryKey:P.incidentSettings((r==null?void 0:r.property_id)??0),enabled:!!r,staleTime:5*60*1e3,queryFn:async()=>{const[c,b]=await Promise.all([fe.list(),ge.templates.listSummary({maxAgeMs:me})]);return{cats:c,temps:b.filter(I=>I.is_published)}},onError:()=>{}}),E=((u=S.data)==null?void 0:u.cats)??[],k=((x=S.data)==null?void 0:x.temps)??[];l.useEffect(()=>{C((r==null?void 0:r.show_incidents)??!1)},[r==null?void 0:r.show_incidents]);const o=async c=>{r&&await a(r,"show_incidents",c)};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24},children:[!g&&e.jsx(V,{on:!1,onToggle:()=>o(!0),label:n(`portal:${w.show_incidents.labelKey}`,{defaultValue:w.show_incidents.labelDefault}),icon:w.show_incidents.icon(17),activateButton:!0,maxWidth:480}),g&&j&&e.jsx(we,{gutter:[24,24],align:"top",children:e.jsx(Te,{xs:24,lg:12,children:e.jsx(ue,{overview:j,linkParams:r?{property:r.property_id}:void 0,navigateOnClick:!0,stacked:!0,only:["incidents"]})})}),e.jsxs(Ne,{getPropertyData:i,activated:g,setActivated:o,children:[r&&T&&e.jsx(Q,{id:"ticketQr",icon:e.jsx(z,{size:16}),title:n("properties:ticketQr.sectionTitle"),hint:n("properties:ticketQr.sectionDesc"),open:f,onToggle:s,children:e.jsx("div",{style:{padding:16},children:e.jsx(Fe,{propertyId:r.property_id})})}),e.jsx(Q,{id:"categories",icon:e.jsx(Ee,{}),title:n("onboarding:setup.meldungen.categoriesTitle"),hint:n("portal:property.incidents.settingsLinksHint"),open:f,onToggle:s,children:e.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start"},children:[e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:E.map(c=>e.jsx(Ce,{color:c.color??void 0,children:c.name},c.id))}),e.jsx(K,{onClick:()=>t(O(B.SETTINGS_CATALOGS,{tab:"incident-categories"})),children:n("portal:property.incidents.linkCategories")})]})}),e.jsx(Q,{id:"forms",icon:e.jsx($,{}),title:n("onboarding:setup.meldungen.formsTitle"),hint:n("portal:property.incidents.settingsLinksHint"),open:f,onToggle:s,children:e.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start"},children:[k.length===0?e.jsx(Ke,{type:"secondary",children:n("onboarding:setup.meldungen.formsEmpty")}):e.jsx("ul",{style:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:6},children:k.slice(0,6).map(c=>e.jsxs("li",{style:{display:"flex",alignItems:"center",gap:8},title:c.name,children:[e.jsx($,{"aria-hidden":"true"}),e.jsx("span",{children:c.name})]},c.id))}),e.jsx(K,{onClick:()=>t(O(B.SETTINGS_TEMPLATES,{tab:"forms"})),children:n("portal:property.incidents.linkForms")})]})}),g&&e.jsx(V,{on:!0,onToggle:()=>o(!1),label:n(`portal:${w.show_incidents.labelKey}`,{defaultValue:w.show_incidents.labelDefault}),icon:w.show_incidents.icon(17),confirmOff:!0})]})]})};export{pt 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.