1import{l as J,A as u,a2 as ue,a3 as xe,ac as Fe,j as e,_ as r,F as P,am as Ie,d as O,an as Te,ao as X,ap as Y,f as q,m as G,c as I,B as f,ah as j,u as A,a6 as ne,s as S,i as $,aq as he,$ as m,ar as Be,as as $e,at as Re,au as v,av as le,S as R,aw as Z,ax as M,a as K,ay as E,az as l,aA as T,a1 as H,aB as D,aC as we,aD as ge,a5 as k,aE as z,aF as x,aG as De,aH as W,n as y,I as ie,aI as je,T as pe,b as B,h as Pe,y as ye,z as fe,E as be,aJ as V,aK as ae,G as se,Z as Me,aL as Ee,a7 as Le,aM as Ue,aN as _e,aO as He,aP as F,aQ as _,aR as Oe,H as oe,aS as qe,aT as Ge,aU as Ke,aV as Ne,aW as Qe,J as ze,aX as We,aY as Ve}from"./index-BSr7ls1f.js";import{R as Je,r as de}from"./recharts-tCXQl-pd.js";import{P as Xe,I as Ye,S as Ze,T as et,a as tt,W as at,b as st,c as nt,d as it,D as ot,C as rt,A as ct}from"./index-ZcsAHnx5.js";import{I as L,a as Se,A as Ae,b as ve,c as lt,u as pt,U as dt,d as mt,e as ut,S as xt}from"./useDashboardSidebarNav-C-DrabIl.js";import{P as ht}from"./index-DckKVwi_.js";import{S as ke}from"./index-NPTTTdsY.js";import{I as re}from"./IsString-CPk88kc1.js";import{P as gt}from"./index-DpzNNuli.js";import"./pdfjs-BXl3LOEh.js";import"./react-id-swiper-D3i2O4Xz.js";import"./react-moveable-DdmZB1CI.js";import"./isLength-CCLb_-gp.js";const jt=()=>J({mutationKey:["api-access","create"],mutationFn:async t=>await u.callFetch("POST","api-access",void 0,void 0,t,!0)}),yt=()=>J({mutationKey:["api-access","update"],mutationFn:async({id:t,body:a})=>await u.callFetch("PATCH",`api-access/${t}`,void 0,void 0,a,!0)}),ft=()=>J({mutationKey:["api-access","rotate-key"],mutationFn:async t=>await u.callFetch("PATCH",`api-access/${t}/rotate-key`,void 0,void 0,void 0,!0)}),bt=()=>J({mutationKey:["api-access","delete"],mutationFn:async t=>{await u.callFetch("DELETE",`api-access/${t}`,void 0,void 0,void 0,!0)}}),St=({successNotification:t})=>{const a=e.jsx(f,{children:e.jsx(j,{text:"application.save",type:"submit",primary:!0})}),i="settings/form",c="settings",o=(n,p)=>u.sendForm(c,p,"PATCH");return e.jsxs(e.Fragment,{children:[e.jsx(ht,{title:"application.settings"}),e.jsxs(ke,{children:[e.jsx("p",{children:r("settings.description")}),e.jsx(P,{highlight:!0,children:e.jsx(Ie,{children:e.jsx(O.ItfApiForm,{formId:"settingsForm",schemaMayBeDynamic:!1,schemaCacheEnabled:!1,loadingInfo:e.jsx(I,{transparent:!0}),schemaFetcher:()=>u.loadForm(i),sendFetcher:o,submitButton:a,onSavedSuccessfully:()=>{t("settings.saved")},onRenderFullField:G,onTranslateString:q,thirdPartyComponents:{ReactSelect:Y,ReactCreatableSelect:X,flatpickr:Te}})})})]})]})},At=t=>xe({...Fe},t),vt=ue(null,At)(St),kt=()=>{const t=A(),a=e.jsx(f,{children:e.jsx(j,{text:"application.sendInvitation",type:"submit",primary:!0})}),i="user/form/add-tenant",c="user/add-tenant";return e.jsxs(e.Fragment,{children:[e.jsx(ne,{children:r("application.addTenant")}),e.jsx(f,{children:e.jsx(j,{to:"/admin/management/clients",text:"application.back",primary:!0})}),e.jsx(P,{highlight:!0,children:e.jsx(O.ItfApiForm,{formId:"addTenantForm",schemaMayBeDynamic:!1,loadingInfo:e.jsx(I,{transparent:!0}),schemaFetcher:()=>u.loadForm(i),sendFetcher:(o,n)=>u.sendForm(c,n),submitButton:a,onSavedSuccessfully:()=>{t(S(r("application.tenantAdded"))),$.push("/admin/management/clients/list")},onRenderFullField:G,onTranslateString:q,thirdPartyComponents:{ReactSelect:Y,ReactCreatableSelect:X}})})]})},me=(t,a)=>typeof t=="number"?t:a,Ct=({user:t})=>{const{getText:a}=he(),{allowedBoxesCount:i,allowedStocksCount:c,stocks:o}=t;return o?e.jsxs("div",{className:`stock-details ${o.length>c?"stock-warning":""}`,children:[a("count")," ",o.length,"/",c,o.map(n=>e.jsxs("div",{className:`stock-details ${n.boxes.count>me(n.allowexBoxesCount,i)?"stock-warning":""}`,children:[e.jsx("strong",{children:n.name}),e.jsxs("div",{children:[n.boxes.count,"/",me(n.allowexBoxesCount,i)," ",r("application.boxesShortcut")]})]},n.id))]}):null},Ft=({tenantId:t,user:a})=>e.jsxs(e.Fragment,{children:[e.jsx(m.Header,{title:r("application.tenantStatus")}),e.jsxs(m.Content,{children:[e.jsx(Xe,{tenantId:t}),e.jsx(Ye,{tenantId:t}),e.jsx(Ze,{tenantId:t}),e.jsx(Ct,{user:a})]})]});let It=class extends Je.Component{scheme;
1constructor(a){super(a),this.scheme=new L(Re).modifyFieldStatic("status",{name:r("application.state"),field:"status",mobile:!0,defaultSort:!0,type:v.Custom,customRender:(i,c,o)=>this.getLockButton(i,c,o)}).addFieldAtTheEnd({name:r("application.actions"),field:"actions",mobile:!0,buttons:[{name:"application.settings",type:"primary",click:i=>$.push(`/admin/management/clients/${i.id}/${i.tenantId}/settings`)},{name:"application.status",type:"secondary",click:i=>this.props.showModal(e.jsx(Ft,{tenantId:i.tenantId,user:i}))}]})}getLockButton=(a,i,c)=>[le.blocked,le.preActive].includes(c.status)?e.jsx(j,{text:"application.active",success:!0,click:()=>this.props.enableUser(c.id)}):e.jsx(j,{text:"application.block",danger:!0,click:()=>this.props.blockUser(c.id)});render(){return e.jsxs(R,{children:[e.jsx(Z,{actions:e.jsx(f,{children:e.jsx(j,{text:"application.addTenant",primary:!0,to:"/admin/management/clients/add"})}),children:r("application.tenantsList")}),e.jsx(M,{scheme:this.scheme,apiEndpointSubUrl:"user/tenants"})]})}};const Tt=t=>xe({...$e,...Be},t),Bt=ue(null,Tt)(It),$t=()=>{const{userId:t,tenantId:a}=K();return!t||!a?null:e.jsx(et,{userId:t,tenantId:a,basePath:`/admin/management/clients/${t}/${a}/settings`,backTo:"/admin/management/clients/list"})},Rt=()=>e.jsxs(E,{children:[e.jsx(l,{exact:!0,path:"/admin/management/clients",render:()=>e.jsx(T,{to:"/admin/management/clients/list"})}),e.jsx(l,{path:"/admin/management/clients/add",component:kt}),e.jsx(l,{path:"/admin/management/clients/list",component:Bt}),e.jsx(l,{path:"/admin/management/clients/:userId/:tenantId/settings",component:$t})]}),wt=()=>{const t=A(),a=e.jsx(f,{children:e.jsx(j,{text:"application.save",type:"submit",primary:!0})}),i="mobile-config/form",c="mobile-config";return e.jsxs(e.Fragment,{children:[e.jsx(ne,{children:r("mobileConfig.add")}),e.jsx(R,{children:e.jsx(P,{highlight:!0,children:e.jsx(O.ItfApiForm,{formId:"addMobileConfigForm",schemaMayBeDynamic:!1,loadingInfo:e.jsx(I,{transparent:!0}),schemaFetcher:()=>u.loadForm(i),sendFetcher:(o,n)=>u.sendForm(c,n),submitButton:a,onSavedSuccessfully:()=>{t(S(r("mobileConfig.added"))),$.push("/admin/management/mobile-config/list")},onRenderFullField:G,onTranslateString:q,thirdPartyComponents:{ReactSelect:Y,ReactCreatableSelect:X}})})})]})},Dt=({configId:t})=>{const a=A(),i=e.jsx(f,{children:e.jsx(j,{text:"application.save",type:"submit",primary:!0})}),c=`mobile-config/form/${t}`,o=`mobile-config/${t}`;return e.jsxs(e.Fragment,{children:[e.jsx(m.Header,{title:r("mobileConfig.edit")}),e.jsx(m.Content,{children:e.jsx(P,{children:e.jsx(O.ItfApiForm,{formId:"editMobileConfigForm",schemaCacheEnabled:!1,schemaMayBeDynamic:!0,loadingInfo:e.jsx(I,{transparent:!0}),schemaFetcher:()=>u.loadForm(c),sendFetcher:(n,p)=>u.sendForm(o,p,"PATCH"),submitButton:i,onSavedSuccessfully:()=>{a(S(r("mobileConfig.updated"))),a(H()),a(D()),$.push("/admin/management/mobile-config/list")},onRenderFullField:G,onTranslateString:q,thirdPartyComponents:{ReactSelect:Y,ReactCreatableSelect:X}})})})]})},Pt=()=>{const t=A();he();const a=new L(we),{data:i}=ge();a.addFieldAtTheEnd({name:r("application.actions"),field:"actions",mobile:!0,buttons:[{name:"application.delete",type:"danger",click:n=>c(n)},{name:"application.edit",type:"primary",click:n=>t(k(e.jsx(Dt,{configId:n.id})))}]});const c=n=>{t(k(e.jsx(z,{mainText:"mobileConfig.deleteConfirmation",approveButtonText:"application.yes",approveAction:()=>o(n)})))},o=async n=>{await u.callFetch("DELETE",`mobile-config/${n.id}`,()=>{t(S("mobileConfig.deleted")),t(D())})};return e.jsxs(ke,{children:[e.jsx(Z,{actions:e.jsx(f,{children:e.jsx(j,{text:"mobileConfig.add",primary:!0,to:`/${x.getSlugByRole(i.role)}/management/mobile-config/add`})}),children:r("mobileConfig.list")}),e.jsx(M,{scheme:a,apiEndpointSubUrl:"mobile-config"})]})},Mt=()=>e.jsxs(E,{children:[e.jsx(l,{exact:!0,path:"/admin/management/mobile-config",render:()=>e.jsx(T,{to:"/admin/management/mobile-config/list"})}),e.jsx(l,{path:"/admin/management/mobile-config/add",component:wt}),e.jsx(l,{path:"/admin/management/mobile-config/list",component:Pt})]}),Et=t=>Array.isArray(t)?t.map(a=>
1String(a)).filter(Boolean):typeof t=="string"?t.split(",").map(a=>a.trim()).filter(Boolean):[],ce=()=>{const{t}=De();return{scopeOptions:[{value:W.BoxGroupsRead,label:t("application.apiAccessScopeBoxGroupsRead")},{value:W.BoxGroupsReadBoxes,label:t("application.apiAccessScopeBoxGroupsReadBoxes")}],normalizeScopes:Et}};var Lt=Object.defineProperty,ee=(t,a,i,c)=>{for(var o=void 0,n=t.length-1,p;n>=0;n--)(p=t[n])&&(o=p(a,i,o)||o);return o&&Lt(a,i,o),o};class N{name="";tenantId="";scopes=[];expiresAt=""}ee([re({message:y.field_required}),ie({message:y.field_required})],N.prototype,"name");ee([lt("4",{message:y.field_required}),ie({message:y.field_required})],N.prototype,"tenantId");ee([Se({message:y.field_required}),Ae(1,{message:y.field_required}),ve(W,{each:!0,message:y.field_required})],N.prototype,"scopes");ee([je(),re()],N.prototype,"expiresAt");const Ut=Pe.pre(({theme:t})=>({backgroundColor:t.colors.background.secondary,padding:t.spacing*3,borderRadius:t.radius.innerSurface,overflow:"auto",fontFamily:"monospace",fontWeight:700,margin:0,wordBreak:"break-all",whiteSpace:"pre-wrap"})),Ce=({apiKey:t,name:a,rotated:i})=>{const c=A(),o=async()=>{await navigator.clipboard.writeText(t),c(S(r("application.apiAccessCopied")))};return e.jsxs(e.Fragment,{children:[e.jsx(m.Header,{title:r(i?"application.apiAccessRotated":"application.apiAccessCreated")}),e.jsxs(m.Content,{children:[e.jsx(pe,{children:r("application.apiAccessCreatedText")}),e.jsx(pe,{children:e.jsx("strong",{children:a})}),e.jsx(Ut,{children:t})]}),e.jsxs(m.Actions,{children:[e.jsx(B,{type:"button",variant:"secondary",text:"application.apiAccessCopy",onClick:o}),e.jsx(B,{type:"button",variant:"primary",text:"application.apiAccessOk",onClick:()=>c(H())})]})]})},_t=()=>{const t=A(),{data:a=[],isLoading:i}=pt(),{scopeOptions:c}=ce(),{mutate:o,isPending:n}=jt(),{handleSubmit:p,register:g,control:b,formState:{errors:C}}=ye({mode:"onSubmit",resolver:fe(new N),defaultValues:{name:"",tenantId:"",scopes:[],expiresAt:""}}),d=s=>{s&&(t(D()),t(k(e.jsx(Ce,{apiKey:s.apiKey,name:s.name}))))},w=s=>{const h={name:s.name,tenantId:s.tenantId,scopes:s.scopes,expiresAt:s.expiresAt||void 0};o(h,{onSuccess:d})};return e.jsxs(be,{onSubmit:p(w),children:[e.jsx(m.Header,{title:r("application.newApiAccess")}),e.jsxs(m.Content,{children:[n?e.jsx(I,{overlay:!0,halfTransparent:!0}):null,e.jsxs(P,{children:[e.jsx(V,{name:"tenantId",control:b,render:({field:s,fieldState:h})=>e.jsx(ae,{name:"tenantId",label:"application.apiAccessTenant",placeholder:"application.apiAccessTenant",options:a.map(U=>({label:String(U.name),value:String(U.value)})),value:s.value,onChange:s.onChange,onBlur:s.onBlur,required:!0,isClearable:!1,disabled:i||n,error:h.error?.message})}),e.jsx(se,{label:"application.apiAccessName",placeholder:"application.apiAccessName",error:C.name?.message,disabled:n,...g("name")}),e.jsx(V,{name:"scopes",control:b,render:({field:s,fieldState:h})=>e.jsx(ae,{name:"scopes",label:"application.apiAccessScopes",placeholder:"application.apiAccessScopes",multiple:!0,options:c,value:s.value,onChange:s.onChange,onBlur:s.onBlur,required:!0,disabled:n,error:h.error?.message})}),e.jsx(se,{type:"date",label:"application.apiAccessExpiresAt",error:C.expiresAt?.message,disabled:n,...g("expiresAt")})]})]}),e.jsxs(m.Actions,{children:[e.jsx(B,{type:"button",variant:"secondary",text:"application.cancel",onClick:()=>t(H())}),e.jsx(B,{type:"submit",variant:"primary",text:"application.create",disabled:n})]})]})};var Ht=Object.defineProperty,te=(t,a,i,c)=>{for(var o=void 0,n=t.length-1,p;n>=0;n--)(p=t[n])&&(o=p(a,i,o)||o);return o&&Ht(a,i,o),o};class Q{name="";scopes=[];expiresAt=null;isActive=!0}te([re({message:y.field_required}),ie({message:y.field_required})],Q.prototype,"name");te([Se({message:y.field_required}),Ae(1,{message:y.field_required}),ve(W,{each:!0,message:y.field_required})],Q.prototype,"scopes");te([je()],Q.prototype,"expiresAt");te([Me()],Q.prototype,"isActive");const Ot=({row:t})=>{const a=A(),{scopeOptions:i,normalizeScopes:c}=ce(),{mutate:o,isPending:n}=yt(),{handleSubmit:p,register:g,control:b,formState:{errors:C}}=ye({mode:"onSubmit",resolver:fe(new Q),defaultValues:{name:t.name,scopes:c(t.scopes),expiresAt:t.expiresAt?new Date(t.expiresAt):null,isActive:t.isActive!==!1}}),d=()=>{a(H()),a(D()),a(S(r("application.apiAccessUpdated")))},w=s=>{const h={name:s.name,scopes:s.scopes,isActive:s.isActive,expiresAt:s.expiresAt?Ue(s.expiresAt):null};o({id:t.id,body:h},{onSuccess:d})};return e.jsxs(be,{onSubmit:p(w),children:[e.jsx(m.Header,{title:r("application.apiAccessEdit")}),e.jsxs(m.Content,{children:[n?e.jsx(I,{overlay:!0,halfTransparent:!0}):null,e.jsxs(P,{children:[e.jsx(se,{label:"application.apiAccessName",placeholder:"application.apiAccessName",error:C.name?.message,disabled:n,...g("name")}
1),e.jsx(V,{name:"scopes",control:b,render:({field:s,fieldState:h})=>e.jsx(ae,{name:"scopes",label:"application.apiAccessScopes",placeholder:"application.apiAccessScopes",multiple:!0,options:i,value:s.value,onChange:s.onChange,onBlur:s.onBlur,required:!0,disabled:n,error:h.error?.message})}),e.jsx(V,{name:"expiresAt",control:b,render:({field:s,fieldState:h})=>e.jsx(Ee,{name:"expiresAt",label:"application.apiAccessExpiresAt",value:s.value??void 0,onChange:([U])=>{s.onChange(U??null)},inline:!1,required:!1,error:h.error?.message})}),e.jsx(Le,{label:"application.apiAccessIsActive",error:C.isActive?.message,disabled:n,...g("isActive")})]})]}),e.jsxs(m.Actions,{children:[e.jsx(B,{type:"button",variant:"secondary",text:"application.cancel",onClick:()=>a(H())}),e.jsx(B,{type:"submit",variant:"primary",text:"application.save",disabled:n})]})]})},qt=()=>{const t=A(),{mutate:a}=ft(),{mutate:i}=bt(),{scopeOptions:c,normalizeScopes:o}=ce(),n=new L(_e).modifyFieldStatic("scopes",{customValue:s=>o(s.scopes).map(h=>c.find(U=>U.value===h)?.label??h).join(", ")}).addFieldAtTheEnd({name:r("application.actions"),field:"actions",mobile:!0,buttons:[{name:"application.edit",type:"primary",click:s=>t(k(e.jsx(Ot,{row:s})))},{name:"application.apiAccessRotateKey",type:"primary",click:s=>w(s)},{name:"application.delete",type:"danger",click:s=>p(s)}]}),p=s=>{t(k(e.jsx(z,{mainText:"application.apiAccessDeleteConfirm",approveButtonText:"application.delete",approveAction:()=>b(s)})))},g=()=>{t(S(r("application.apiAccessDeleted"))),t(D())},b=s=>{i(s.id,{onSuccess:g})},C=s=>{s&&(t(D()),setTimeout(()=>{t(k(e.jsx(Ce,{apiKey:s.apiKey,name:s.name,rotated:!0})))},350))},d=s=>{a(s.id,{onSuccess:C})},w=s=>{t(k(e.jsx(z,{mainText:"application.apiAccessRotateConfirm",approveButtonText:"application.yes",approveAction:()=>d(s)})))};return e.jsxs(e.Fragment,{children:[e.jsxs(R,{children:[e.jsx(Z,{actions:e.jsx(f,{children:e.jsx(j,{text:"application.newApiAccess",primary:!0,click:()=>t(k(e.jsx(_t,{})))})}),children:r("application.apiAccessList")}),e.jsx(M,{scheme:n,apiEndpointSubUrl:"api-access"})]}),e.jsx(tt,{forAdmin:!0})]})},Gt=()=>e.jsxs(E,{children:[e.jsx(l,{exact:!0,path:"/admin/management/api-access",render:()=>e.jsx(T,{to:"/admin/management/api-access/list"})}),e.jsx(l,{path:"/admin/management/api-access/list",component:qt})]}),Kt=()=>{const{data:t}=ge();return t?e.jsxs(E,{children:[e.jsx(l,{exact:!0,path:`/${x.getSlugByRole(t.role)}/management`,render:()=>e.jsx(T,{to:`/${x.getSlugByRole(t.role)}/management/workers`})}),e.jsx(l,{path:`/${x.getSlugByRole(t.role)}/management/workers`,component:at}),e.jsx(l,{path:`/${x.getSlugByRole(t.role)}/management/users`,component:dt}),e.jsx(l,{path:`/${x.getSlugByRole(t.role)}/management/clients`,component:Rt}),e.jsx(l,{path:`/${x.getSlugByRole(t.role)}/management/invitations`,component:mt}),e.jsx(l,{path:`/${x.getSlugByRole(t.role)}/management/sms`,component:st}),e.jsx(l,{path:`/${x.getSlugByRole(t.role)}/management/settings`,component:vt}),e.jsx(l,{path:`/${x.getSlugByRole(t.role)}/management/mobile-config`,component:Mt}),e.jsx(l,{path:`/${x.getSlugByRole(t.role)}/management/api-access`,component:Gt}),e.jsx(l,{path:`/${x.getSlugByRole(t.role)}/management/notifications`,component:nt}),e.jsx(l,{path:`/${x.getSlugByRole(t.role)}/management/system-logs`,component:it}),e.jsx(l,{path:`/${x.getSlugByRole(t.role)}/management/documents`,component:ot}),e.jsx(l,{path:`/${x.getSlugByRole(t.role)}/management/settlements`,component:rt}),e.jsx(l,{path:`/${x.getSlugByRole(t.role)}/management/companies`,render:()=>e.jsx(T,{to:`/${x.getSlugByRole(t.role)}/management/settlements`})}),e.jsx(l,{path:`/${x.getSlugByRole(t.role)}/management/attachments`,component:ct})]}):null},Nt={countPerPage:20,fields:[{name:"ID",field:"lockId",mobile:!0,searchable:!1,sortable:!1,defaultSort:!1,type:v.Text},{name:"Nazwa",field:"lockName",mobile:!0,searchable:!1,sortable:!1,defaultSort:!1,type:v.Text},{name:"Alias",field:"lockAlias",mobile:!0,searchable:!0,sortable:!1,defaultSort:!1,type:v.Text},{name:"SygnaÅ bramki",field:"rssi",mobile:!0,searchable:!1,sortable:!1,defaultSort:!1,type:v.Custom},{name:"Stan baterii",field:"electricQuantity",mobile:!0,searchable:!1,sortable:!1,defaultSort:!1,type:v.Custom}]},Qt=t=>
1He({queryKey:["lock-details",t],queryFn:async()=>{const a=await u.callFetch("get",`driver/locks/${t}`);return a||null}}),zt=({id:t})=>{const{data:a,isFetching:i}=Qt(t.toString());if(i)return e.jsxs(e.Fragment,{children:[e.jsx(m.Header,{title:r("application.lockDetails")}),e.jsx(m.Content,{children:e.jsx(I,{})})]});if(!a)return e.jsxs(e.Fragment,{children:[e.jsx(m.Header,{title:r("application.lockDetails")}),e.jsx(m.Content,{children:e.jsx(F,{type:"error",children:"WystÄ
piÅ bÅÄ
d podczas pobierania szczegóÅów"})})]});const{noKeyPwd:c,lockId:o,lockMac:n,lockName:p,lockAlias:g,electricQuantity:b}=a;return e.jsxs(e.Fragment,{children:[e.jsx(m.Header,{title:r("application.lockDetails")}),e.jsxs(m.Content,{children:[e.jsx(_,{label:"ID",content:o}),e.jsx(_,{label:"Nazwa",content:p}),e.jsx(_,{label:"Alias",content:g}),e.jsx(_,{label:"MAC",content:n}),e.jsx(_,{label:"Kod administratora",content:c}),e.jsx(_,{label:"Stan baterii",content:`${b}%`})]})]})},Wt=()=>{const t=A(),{type:a,groupOrGatewayId:i}=K(),[c,o]=de.useState(!1),n=new L(a==="gateway"?Nt:Oe);n.modifyFieldStatic("electricQuantity",{name:r("application.batteryStatus"),field:"electricQuantity",mobile:!0,defaultSort:!0,type:v.Custom,customRender:(d,w,s)=>s.electricQuantity>80?e.jsxs(F,{compact:!0,type:"success",children:[s.electricQuantity,"%"]}):s.electricQuantity>30?e.jsxs(F,{compact:!0,type:"warning",children:[s.electricQuantity,"%"]}):e.jsxs(F,{compact:!0,type:"error",children:[s.electricQuantity,"%"]})}).addFieldAtTheEnd({name:r("application.actions"),field:"actions",mobile:!0,buttons:[{name:"application.lockDetails",type:"primary",click:d=>p(d)},{name:"application.lockPasscodes",type:"secondary",click:d=>$.push(`/admin/drivers/locks/${d.lockId}/passcodes`)},{name:"application.unlock",type:"success",click:d=>g(d)},{name:"application.lock",type:"error",click:d=>b(d)}]}),a==="gateway"&&n.modifyFieldStatic("rssi",{name:"SygnaÅ bramki",field:"rssi",mobile:!0,defaultSort:!0,type:v.Custom,customRender:(d,w,s)=>s.rssi>-75?e.jsxs(F,{compact:!0,type:"success",children:["Silny (",s.rssi,")"]}):s.electricQuantity>-85?e.jsxs(F,{compact:!0,type:"warning",children:["Åredni (",s.rssi,")"]}):e.jsxs(F,{compact:!0,type:"error",children:["SÅaby (",s.rssi,")"]})});const p=d=>{t(k(e.jsx(zt,{id:d.lockId})))},g=async d=>{o(!0),await u.callFetch("PATCH",`driver/open/${d.lockId}`,()=>{t(S("application.lockOpened"))}),o(!1)},b=async d=>{o(!0),await u.callFetch("PATCH",`driver/close/${d.lockId}`,()=>{t(S("application.lockClosed"))}),o(!1)},C=de.useMemo(()=>a?a==="group"?`driver/locks/by-group/${i}`:a==="gateway"?`driver/locks/by-gateway/${i}`:"":"driver/locks",[a,i]);return e.jsxs(R,{children:[c?e.jsx(I,{halfTransparent:!0,overlay:!0}):null,e.jsx(oe,{variant:"h2",children:r("application.locks")}),e.jsx(M,{scheme:n,apiEndpointSubUrl:C||"driver/locks"})]})},Vt=()=>{const t=new L(qe);return t.addFieldAtTheEnd({name:r("application.actions"),field:"actions",mobile:!0,buttons:[{name:"application.seeLocksFromGroup",type:"success",click:a=>$.push(`/admin/drivers/locks/group/${a.groupId}`)}]}),e.jsxs(R,{children:[e.jsx(oe,{variant:"h2",children:r("application.lockGroups")}),e.jsx(M,{scheme:t,apiEndpointSubUrl:"driver/groups/"})]})},Jt=()=>{const t=new L(Ge);return t.modifyFieldStatic("isOnline",{name:r("application.isOnline"),field:"pricing",mobile:!0,defaultSort:!0,type:v.Custom,customRender:(a,i,c)=>c.isOnline?e.jsx(F,{compact:!0,type:"success",text:"application.yes"}):e.jsx(F,{compact:!0,type:"error",text:"application.no"})}).addFieldAtTheEnd({name:r("application.actions"),field:"actions",mobile:!0,buttons:[{name:"application.seeLocksFromGateway",type:"success",click:a=>$.push(`/admin/drivers/locks/gateway/${a.gatewayId}`)}]}),e.jsxs(R,{children:[e.jsx(oe,{variant:"h2",children:r("application.gateways")}),e.jsx(M,{scheme:t,apiEndpointSubUrl:"driver/gateways"})]})},Xt=()=>{const{lockId:t}=K(),a=A(),i=e.jsx(f,{children:e.jsx(j,{text:"application.add",type:"submit",primary:!0})}),c="driver/form/passcode",o=`driver/locks/${t}/passcodes`;return e.jsxs(e.Fragment,{children:[e.jsx(ne,{children:r("application.addPasscode")}),e.jsxs(R,{children:[e.jsx(f,{children:e.jsx(j,{to:`/admin/drivers/locks/${t}/passcodes`,text:"application.back",primary:!0})}),e.jsx(P,{highlight:!0,children:e.jsx(O.ItfApiForm,{formId:"addPasscodeForm",sc
1hemaMayBeDynamic:!1,loadingInfo:e.jsx(I,{transparent:!0}),schemaFetcher:()=>u.loadForm(c),sendFetcher:(n,p)=>u.sendForm(o,p),submitButton:i,onSavedSuccessfully:()=>{a(S(r("application.passcodeAdded"))),$.push(`/admin/drivers/locks/${t}/passcodes`)},onRenderFullField:G,onTranslateString:q})})]})]})},Yt=()=>{const t=A(),{lockId:a}=K(),i=new L(Ke).addFieldAtTheEnd({name:r("application.actions"),field:"actions",type:v.Custom,mobile:!0,customRender:(n,p,g)=>e.jsx(f,{noWrap:!0,children:e.jsx(B,{variant:"error",text:"application.delete",onClick:()=>c(g.keyboardPwdId)})})}),c=n=>{t(k(e.jsx(z,{mainText:r("application.confirmPasscodeDelete"),approveButtonText:"application.yes",approveAction:()=>o(n)})))},o=async n=>{await u.callFetch("DELETE",`driver/locks/${a}/passcodes/${n}`,()=>{t(S(r("application.passcodeDeleted"))),t(D())})};return a?e.jsxs(R,{children:[e.jsx(Z,{actions:e.jsx(f,{children:e.jsx(B,{variant:"primary",text:"application.addLockPasscode",to:`/admin/drivers/locks/${a}/passcodes/add`})}),children:r("application.lockPasscodes")}),e.jsx(M,{scheme:i,apiEndpointSubUrl:`driver/locks/${a}/passcodes`})]}):null},Zt=()=>{const{lockId:t}=K();return e.jsxs(E,{children:[e.jsx(l,{exact:!0,path:"/admin/drivers/locks/:lockId/passcodes",render:()=>e.jsx(T,{to:`/admin/drivers/locks/${t}/passcodes/list`})}),e.jsx(l,{path:"/admin/drivers/locks/:lockId/passcodes/add",component:Xt}),e.jsx(l,{path:"/admin/drivers/locks/:lockId/passcodes/list",component:Yt})]})},ea=()=>e.jsxs(E,{children:[e.jsx(l,{exact:!0,path:"/admin/drivers",render:()=>e.jsx(T,{to:"/admin/drivers/gateways"})}),e.jsx(l,{path:"/admin/drivers/gateways",component:Jt}),e.jsx(l,{path:"/admin/drivers/groups",component:Vt}),e.jsx(l,{path:"/admin/drivers/locks/:lockId/passcodes",component:Zt}),e.jsx(l,{path:"/admin/drivers/locks/:type?/:groupOrGatewayId?",component:Wt})]}),xa=()=>{const t=ut();return e.jsx(Ne,{sidebar:e.jsx(Ve,{groups:t}),children:e.jsx(Qe,{children:e.jsxs(E,{children:[e.jsx(l,{exact:!0,path:"/admin",render:()=>e.jsx(T,{to:ze("/admin/management/users")})}),e.jsx(l,{path:"/admin/management/",component:Kt}),e.jsx(l,{path:"/admin/profile",component:gt}),e.jsx(l,{path:"/admin/drivers",component:ea}),e.jsx(l,{path:"/admin/locations",component:xt}),e.jsx(l,{exact:!0,path:"/admin/single-rent/:orderId",component:We})]})})})};export{xa 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.