PageSourceSearch

https://www.hops.org.au/static/js/5883.9edbf884.chunk.js

js hops.org.au collected 2026-10-05 20:40:52 UTC 8,957 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkhopsa=self.webpackChunkhopsa||[]).push([[5883],{75883:function(e,n,l){l.r(n),l.d(n,{default:function(){return w}});var a=l(65043),t=l(11138),i=l(91234),s=l(62147),r=l(5974),o=l(53168),d=l(53746),c=l(54934),u=l(70579);const h=e=>{const{snack:n}=(0,d.w)(),[l,t]=(0,a.useState)([]),{data:i,loading:s,error:h}=(0,c.s)({fn:()=>r.au.getKeys(),dep:[]});let m;if((0,a.useEffect)((()=>{if(i){const e=[{label:"(None)",value:null}];for(const n of i)e.push({label:n.Name,value:n.KeycafeId});t(e)}}),[i]),null!==h&&void 0!==h&&h.response){var v;if(502===(null===h||void 0===h||null===(v=h.response)||void 0===v?void 0:v.status)){var b,p,g,f,x,y;const e=null===h||void 0===h||null===(b=h.response)||void 0===b||null===(p=b.data)||void 0===p||null===(g=p.Keycafe)||void 0===g?void 0:g.ApiStatus,l=null===h||void 0===h||null===(f=h.response)||void 0===f||null===(x=f.data)||void 0===x||null===(y=x.Keycafe)||void 0===y?void 0:y.ErrorId;m=429===e?"Error - Keycafe API rate limit exceeded. Please try again later.":`Error - Keycafe API error. (${e||"Unknown"}, ${l||"Unknown"})`,n(m,"error")}}return(0,u.jsx)(o.l,{disabled:e.disabled,loading:s,error:h,name:e.name,onChange:e.onChange,options:l,required:e.required,value:e.value})};var m=l(43171),v=l(79884),b=l(16001),p=l(31233),g=l(14599);const f=e=>{var n;const[l,t]=(0,a.useState)([]),{data:i,loading:s,error:d}=(0,c.s)({fn:()=>r.cP.getUnitTypes(),dep:[]});return(0,a.useEffect)((()=>{const e=[{label:"Select...",value:null}];for(const n of i||[])e.push({label:n.Name,value:n});t(e)}),[i]),(0,u.jsx)(o.l,{disabled:e.disabled,placeholder:e.placeholder,loading:s,error:d,name:e.name,onChange:e.onChange,options:l,required:e.required,getOptionValue:e=>{var n;return null===(n=e.value)||void 0===n?void 0:n.Id},value:null===(n=e.value)||void 0===n?void 0:n.Id})};var x=l(81855),y=l(44287),j=l(91688),C=l(42401),k=l(42016),T=l(36427),I=l(29550),S=l(87768),O=l(65713),N=l(67756);var w=(0,x.A)((0,j.withRouter)((0,y.A)((e=>{const{snack:n}=(0,d.w)(),[l,o]=(0,a.useState)({}),[x,y]=(0,a.useState)(!1),j=parseInt(e.match.params.id)||null,w=(0,c.s)({fn(){return j?r.cP.getUnit(j):new Promise((e=>{e({Name:null,NameShort:null,Type:null,Parent:null,DisplayOrder:0,CheckInTime:null,CheckOutTime:null,KeycafeKeyId:null,Archived:null,ShowOnDailySheet:!1})}))},dep:[j]});(0,a.useEffect)((()=>{o(w.data||{})}),[w.data]);const A=(0,a.useCallback)(((e,n)=>o({...l,[n]:e})),[l]),P=(0,a.useCallback)((()=>o({...l,CheckInTime:null,CheckOutTime:null})),[l]),K=async()=>{var a,t;const i=j,s={...l,Type:null===(a=l.Type)||void 0===a?void 0:a.Id,Parent:(null===(t=l.Parent)||void 0===t?void 0:t.Id)||null,CheckInTime:l.CheckInTime?5===l.CheckInTime.length?`${l.CheckInTime}:00`:l.CheckInTime:null,CheckOutTime:l.CheckOutTime?5===l.CheckOutTime.length?`${l.CheckOutTime}:00`:l.CheckOutTime:null,ShowOnDailySheet:l.ShowOnDailySheet,NameShort:l.NameShort};y(!0);const o=j?r.cP.updateUnit(j,s):r.cP.createUnit(s);try{await o,j===i&&(b.A.navigate("/rb/admin/units"),n("Saved.","success"))}catch(d){j===i&&(e.snack(d),y(!1))}},U=[{label:"Name",content:(0,u.jsx)(v.A,{autoFocus:!0,disabled:x,placeholder:"Name",maxLength:250,name:"Name",onChange:A,required:!0,value:l.Name})},{label:"Short Name",content:(0,u.jsx)(v.A,{disabled:x,placeholder:"Short Name",maxLength:8,name:"NameShort",onChange:A,required:!0,value:l.NameShort})},{label:"Type",content:(0,u.jsx)(f,{disabled:x,placeholder:"Type",name:"Type",onChange:A,required:!0,value:l.Type})},{label:"Parent",content:(0,u.jsx)(g.p,{showNullOption:!0,disabled:x,isOptionDisabled:l.Id?e=>!r.cP.canUnitBeParentedTo(l,e):void 0,name:"Parent",onChange:A,value:l.Parent})},{label:"Order",content:(0,u.jsx)(s.n,{alignItems:"flex-start",children:(0,u.jsx)(v.A,{disabled:x,placeholder:"Order",name:"DisplayOrder",type:"number",onChange:A,required:!0,value:l.DisplayOrder})})},{label:"Fixed Check-In/Check-Out Times (optional)",content:(0,u.jsxs)(s.n,{alignItems:"center",columnar:!0,wrap:!0,children:[(0,u.jsx)(i.K,{disabled:x,label:"Check-In Time",fullWidth:!0,name:"CheckInTime",onChange:A,timeOnly:!0,value:l.CheckInTime}),(0,u.jsx)(p.o,{children:"to"}),(0,u.jsx)(i.K,{disabled:x,label:"Check-Out Time",fullWidth:!0,name:"CheckOutTime",onChange:A,timeOnly:!0,value:l.CheckOutTime}),(0,u.jsx)(m.A,{disabled:x,label:"Reset",onClick:P})]})},{label:"Keycafe Key",content:(0,u.jsx)(h,{name:"KeycafeKeyId",disabled:x,onChange:A,value:l.KeycafeKeyId}),hidden:!e.org.KeycafeEnabled}
1,{label:"Show on Daily Sheet",content:(0,u.jsx)(t.S,{checked:l.ShowOnDailySheet,disabled:x,label:"",name:"ShowOnDailySheet",onChange:A,value:!l.ShowOnDailySheet})},{label:"Archived",content:(0,u.jsx)(t.S,{checked:l.Archived,disabled:x,label:"Archived units are unavailable for booking.",name:"Archived",onChange:A,value:!l.Archived}),hidden:!j}];let E;if(w.loading)E=(0,u.jsx)(p.o,{children:"Loading..."});else if(w.error)E=(0,u.jsx)(I.l,{error:w.error,subject:"Unit",onRetry:w.fetch});else{var D;E=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(O.z,{children:(0,u.jsx)(N.s,{children:"Bookable Unit"})}),(0,u.jsxs)(C.R,{onSubmit:K,children:[(0,u.jsxs)("fieldset",{children:[(0,u.jsx)("legend",{children:j?null===(D=w.data)||void 0===D?void 0:D.Name:"New Bookable Unit"}),(0,u.jsx)(T.h,{data:U})]}),(0,u.jsx)("fieldset",{className:"submit_buttons",children:(0,u.jsx)(k.C,{submitting:x,onCancel:()=>b.A.navigate("/rb/admin/units")})})]})]})}return(0,u.jsxs)(s.n,{children:[(0,u.jsx)(S.B,{children:(0,u.jsx)(m.A,{uri:"/rb/admin/units",children:"All Units"})}),E]})}))))},14599:function(e,n,l){l.d(n,{p:function(){return d}});var a=l(65043),t=l(5974),i=l(53168),s=l(71686),r=l(54934),o=l(70579);const d=e=>{const{showNullOption:n,isOptionDisabled:l,onlyIncludeBookableByAuthUser:d,value:c}=e,{hasPermission:u}=(0,s.A)(),[h,m]=(0,a.useState)([]),[v]=(0,a.useState)(c),{data:b,loading:p,error:g}=(0,r.s)({fn:()=>d?t.cP.getUnitsBookableByAuthUser():t.cP.getUnits(),dep:[]}),f=(0,a.useCallback)(((e,n)=>{var a,t;return!(!d||u(472,null===(a=e.Type)||void 0===a?void 0:a.Id)||u(473,null===(t=e.Type)||void 0===t?void 0:t.Id)||e.Id===v.Id)||(null===l||void 0===l?void 0:l(e,n))}),[u,v,l,d]);return(0,a.useEffect)((()=>{if(b||v){const e=[];v&&e.push(v),b&&e.push(...b);const l=[];n&&l.push({label:"(None)",value:null});const a=t.cP.getUnitsTreeLeavesFlattened(e);for(const n of a){const e=t.cP.getUnitParentLevel(n);l.push({label:`${"-".repeat(2*e)}${n.Name}`,value:n,disabled:f(n,e)})}m(l)}}),[b,n,v,f]),(0,o.jsx)(i.l,{disabled:e.disabled,placeholder:e.placeholder,loading:p,error:!!g,name:e.name,onChange:e.onChange,options:h,required:e.required,getOptionValue:e=>{var n;return null===(n=e.value)||void 0===n?void 0:n.Id},value:null===c||void 0===c?void 0:c.Id})}},36427:function(e,n,l){l.d(n,{h:function(){return s}});var a="EditFormTableList_editFormTableList__-I3eO",t=l(98917),i=l(70579);const s=e=>{let{loading:n,error:l,data:s,labelsWidth:r,hideEmpty:o,emptyMessage:d,className:c}=e;const u=[a];return c&&u.push(c),(0,i.jsx)(t.B,{loading:n,error:l,data:s,labelsWidth:r,hideEmpty:o,emptyMessage:d,className:u.join(" "),variant:null})}},98917:function(e,n,l){l.d(n,{B:function(){return b}});var a=l(65043),t=l(33392),i=l(10559),s=l(82734),r=l(62147),o=l(90314),d=l(20804),c="TableList_actionButtons__C-7k6",u="TableList_tableList__4CjhJ",h=l(16914),m=l(31233),v=l(70579);const b=e=>{let{title:n,loading:l,error:b,data:p,onEdit:g,onDelete:f,labelsWidth:x,hideEmpty:y,emptyMessage:j,className:C,variant:k="side"}=e;const T=(p||[]).filter((e=>!e.hidden)),I=(0,a.useRef)(),S=e=>{const n=x||"24rem",l={width:n,minWidth:n};return(0,v.jsx)("th",{style:l,children:(0,v.jsxs)(r.n,{gap:.5,children:[(0,v.jsx)("p",{className:l.label,children:e.label}),e.caption?(0,v.jsx)(m.o,{color:"textSecondary",children:e.caption}):null]})})};if(!T.length&&y)return null;const O=[];if("side"===k)O.push("table-sidedisplaytable");return O.push(u),C&&O.push(C),(0,v.jsxs)(r.n,{children:[n||g||f?(0,v.jsxs)(r.n,{columnar:!0,justifyContent:"space-between",children:[(0,v.jsx)(m.o,{variant:"h3",children:n}),(0,v.jsxs)(r.n,{columnar:!0,gap:.5,wrap:!0,className:c,children:[g?(0,v.jsx)(t.$,{disabled:l||b,label:"Edit",onClick:()=>{g&&g()},startIcon:(0,v.jsx)(i.A,{})}):null,f?(0,v.jsx)(t.$,{disabled:l||b,label:"Delete",onClick:()=>{f&&f()},startIcon:(0,v.jsx)(s.A,{}),variant:"danger"}):null]})]}):null,null!==T&&void 0!==T&&T.length?(0,v.jsx)(d.X,{innerRef:I,className:O.join(" "),variant:null,children:(0,v.jsx)("tbody",{children:T.map(((e,n)=>{return(0,v.jsxs)("tr",{children:[e.label?S(e):null,(0,v.jsx)("td",{colSpan:void 0===e.label?2:null,style:e.style,children:(0,v.jsx)(r.n,{gap:.5,children:(a=e.content,l||b?(0,v.jsxs)(v.Fragment,{children:[l&&(0,v.jsx)(o.a,{disableCentre:!0,size:"small"}),b&&!l&&(0,v.jsx)(m.o,{children:"Error"})]}):("function"===typeof a&&(a=a()),"string"===typeof a&&(a=(0,h.Cx)(a)),a))})})]},n);var a}))})}):(0,v.jsx)(m.o,{children:j||"Nothing to show."})]})}}}]);
2//# sourceMappingURL=5883.9edbf884.chunk.js.map

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.