PageSourceSearch

https://at4all.com/_next/static/chunks/5873-1be73f80c7a27a6b.js

js at4all.com collected 2026-09-24 12:12:57 UTC 11,004 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5873],{15873:(e,t,a)=>{a.r(t),a.d(t,{UPDATE_LOAN:()=>N,default:()=>_});var n=a(28888),s=a(37876),o=a(86191),r=a(31167),l=a(64177),d=a(14232),i=a(98949),c=a(71534),h=a(48230),m=a.n(h),u=a(83511),I=a(73333),p=a(99931),L=a(73678),T=a(47793),g=a(87211);a(97620);var S=a(77287),x=a(62997);function j(){let e=(0,n._)(["\n  mutation UPDATE_LOAN($Id: Int, $RequestedDate: DateTime, $LoanDate: DateTime,\n    $ReturnDate: DateTime, $StatusId: Int, $CheckInDate: DateTime, $EmailNoticeDate: DateTime,\n    $Comments: String, $CheckInAccountID: Int,\n    $LoanFacilitatorId: Int, $SurveyId: Int, $VTVRDataId: Int, $ManagerNotes: String) {\n    updateShortTermLoan(Id: $Id, RequestedDate: $RequestedDate, LoanDate: $LoanDate,\n    ReturnDate: $ReturnDate, StatusId: $StatusId, CheckInDate: $CheckInDate, EmailNoticeDate: $EmailNoticeDate,\n    Comments: $Comments, CheckInAccountID: $CheckInAccountID,\n    LoanFacilitatorId: $LoanFacilitatorId, SurveyId: $SurveyId, VTVRDataId: $VTVRDataId, ManagerNotes: $ManagerNotes)\n  }\n"]);return j=function(){return e},e}let{Title:D,ErrorText:v}=a(63200),N=(0,o.J1)(j()),f=e=>{let t=document.getElementsByClassName("p-datepicker");t.length>0&&Array.from(t).forEach(e=>{e.style.display="block"})},b=e=>{let t=(0,r.I)(x.SHORT_TERM_LOANS_QUERY,{variables:{itemId:e.loan.ItemId,status:"Out"}});return t.loading?(0,s.jsx)(c.A,{}):t.error?(0,s.jsx)(v,{children:"Data Loading Error"}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("li",{style:{listStyleType:"none"},children:[(0,s.jsx)(p.S,{checked:e.otherLoanIds.includes(e.loan.Id),value:e.loan.Id,name:"loan"+e.loan.id,onChange:t=>e.onChange(e.loan.Id)},e.loan.Id),"\xa0",(0,s.jsx)("label",{htmlFor:"loan"+e.loan.id,onClick:t=>UpdateIds(e.loan.Id),children:e.loan.ItemName})]},e.loan.Id)})},R=e=>{let[t,a]=(0,d.useState)([]),n=n=>{let s=[...t];t.includes(n)?a(s.filter(e=>e!=n)):(s.push(n),a(s)),e.onLoanIDsUpdate(s)};(0,d.useEffect)(()=>{e.onLoanIDsUpdate(t)},[t]);let{loading:o,error:l,data:i}=(0,r.I)(x.SHORT_TERM_LOANS_QUERY,{variables:{surveyId:e.surveyId,status:"Out"}});return o?(0,s.jsx)(c.A,{}):l?(0,s.jsx)(v,{children:l.message}):1==i.shortTermLoans.length?(0,s.jsx)("div",{children:"No other items found in this loan event."}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("label",{children:e.label}),(0,s.jsx)("ul",{className:"radiobutton-padding",children:i.shortTermLoans.map(a=>a.Id!=e.loanId&&(0,s.jsx)(b,{loan:a,onChange:n,otherLoanIds:t},a.Id))})]})},y=e=>{let t=new Date(Date.now()),[a,n]=(0,d.useState)(4==e.shortTermLoan.StatusId||2==e.shortTermLoan.StatusId?new Date:new Date(e.shortTermLoan.LoanDate)),[o,l]=(0,d.useState)(4==e.shortTermLoan.StatusId||2==e.shortTermLoan.StatusId?new Date(t.getFullYear(),t.getMonth(),t.getDate()+e.DefaultLoanPeriod):new Date(e.shortTermLoan.ReturnDate)),[i,h]=(0,d.useState)(4==e.shortTermLoan.StatusId||2==e.shortTermLoan.StatusId?new Date(t.getFullYear(),t.getMonth(),t.getDate()+e.DefaultLoanPeriod-5):new Date(e.shortTermLoan.EmailNoticeDate)),[m,u]=(0,d.useState)(new Date(3==e.shortTermLoan.StatusId?e.shortTermLoan.CheckInDate:"12/31/9999")),[I,L]=(0,d.useState)(!1),g=!1,S=!1;(0,d.useEffect)(()=>{e.onUpdate(a,o,i,m,I?2:1)},[a,o,i,m,I]);let j=(0,r.I)(x.SHORT_TERM_LOANS_QUERY,{variables:{itemId:e.shortTermLoan.ItemId,status:"OutorWaiting"}});return j.loading?(0,s.jsx)(c.A,{}):j.error?(0,s.jsx)(v,{children:"Data Loading Error"}):(j.data.shortTermLoans.forEach(t=>{t.Id!=e.shortTermLoan.Id&&(g=!0)}),j.data.shortTermLoans.forEach(t=>{t.Id!=e.shortTermLoan.Id&&1==t.StatusId&&(S=!0)}),g&&4==e.shortTermLoan.StatusId)?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"p-col-12",children:[(0,s.jsx)(p.S,{inputId:"ckbWaitList".concat(e.shortTermLoan.ItemId),value:e.shortTermLoan.ItemId,checked:I,onChange:e=>{L(!I)}}),(0,s.jsx)("strong",{children:(0,s.jsx)("label",{htmlFor:"ckbWaitList".concat(e.shortTermLoan.ItemId),children:" Check here if you want the recipient to be added to the waiting list for this item."})})]})}):2==e.shortTermLoan.StatusId&&S?(e.makeDisabled(),(0,s.jsx)(v,{children:"This item is still out on loan, so it cannot be taken off the waiting list."})):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"p-col-12 p-md-6 p-lg-3",children:[(0,s.jsx)("label",{htmlFor:"loanDate",children:"Loan Date"}),(0,s.jsx)("div",{children:(0,s.jsxs)("strong",{children:[(0,s.jsx)(T.V,{id:"Lo
1anDate",value:a,onChange:e=>e.target.value instanceof Date&&n(e.target.value),inputId:"loanDate",appendTo:"self",onShow:f,showOnFocus:!1,showIcon:!0}),""==a&&(0,s.jsx)(v,{children:"Loan date must be selected."}),new Date(a)=="Invalid date"&&(0,s.jsx)(v,{children:"Loan date is invalid."})]})})]}),(0,s.jsxs)("div",{className:"p-col-12 p-md-6 p-lg-3",children:[(0,s.jsx)("label",{htmlFor:"ReturnDate",children:"Due / Return Date"}),(0,s.jsx)("div",{children:(0,s.jsxs)("strong",{children:[(0,s.jsx)(T.V,{inputId:"ReturnDate",dateFormat:"mm/dd/yy",className:"p-calendar",showButtonBar:!0,showOnFocus:!1,showIcon:!0,appendTo:"self",onShow:f,placeholder:o.toString(),onChange:e=>e.target.value instanceof Date&&l(e.target.value),value:o}),""==o&&(0,s.jsx)(v,{children:"Return date must be selected."}),new Date(o)=="Invalid date"&&(0,s.jsx)(v,{children:"Return date is invalid."}),o<a&&(0,s.jsx)(v,{children:"Return date is before the loan date."})]})})]}),3==e.shortTermLoan.StatusId&&(0,s.jsxs)("div",{className:"p-col-12 p-md-6 p-lg-3",children:[(0,s.jsx)("label",{htmlFor:"checkInDate",children:"Check In Date"}),(0,s.jsx)("div",{children:(0,s.jsxs)("strong",{children:[(0,s.jsx)(T.V,{id:"CheckInDate",value:m,onChange:e=>e.target.value instanceof Date&&u(e.target.value),inputId:"checkInDate",showOnFocus:!1,appendTo:"self",showIcon:!0,onShow:f}),""==m&&(0,s.jsx)(v,{children:"Check in date must be selected."}),new Date(m)=="Invalid date"&&(0,s.jsx)(v,{children:"Check in date is invalid."})]})})]}),3!=e.shortTermLoan.StatusId&&(0,s.jsxs)("div",{className:"p-col-12 p-md-6 p-lg-3",children:[(0,s.jsx)("label",{htmlFor:"EmailReminder",children:"Email Notice"}),(0,s.jsx)("div",{children:(0,s.jsx)("strong",{children:(0,s.jsx)(T.V,{inputId:"EmailReminder",dateFormat:"mm/dd/yy",className:"p-calendar",showButtonBar:!0,showOnFocus:!1,appendTo:"self",showIcon:!0,onShow:f,placeholder:i.toString(),onChange:e=>e.target.value instanceof Date&&h(e.target.value),value:i})})})]})]})},C=e=>{let[t,a]=(0,d.useState)(e.shortTermLoan.Comments||""),[n,o]=(0,d.useState)(e.shortTermLoan.ManagerNotes||""),[l,h]=(0,d.useState)(!1);(0,d.useEffect)(()=>{e.onCommentUpdate(t,n)},[t,n]);let I=(0,r.I)(S.ONE_PROGRAM_QUERY,{variables:{id:e.shortTermLoan.ProgramId}});return I.loading?(0,s.jsx)(c.A,{}):I.error?(0,s.jsx)(v,{children:I.error.message}):(0,s.jsx)("div",{className:"p-col-12",children:(0,s.jsxs)("div",{className:"p-grid card p-card",children:[(0,s.jsx)("div",{className:"p-col-12",children:(0,s.jsxs)(D,{children:[1==e.shortTermLoan.StatusId||3==e.shortTermLoan.StatusId?"Loan Edit":"Process Loan",(0,s.jsx)(m(),{href:"/loan",prefetch:!1,legacyBehavior:!0,children:(0,s.jsx)(i.$,{type:"submit",label:"Cancel",autoFocus:!0,style:{marginLeft:"20px",verticalAlign:"Top",width:"120px"},icon:"pi pi-times",className:"p-button-danger"})})]})}),(0,s.jsxs)("div",{className:"p-col-12",children:[(0,s.jsx)(u.A,{children:e.shortTermLoan.ItemId}),(0,s.jsx)(D,{children:e.shortTermLoan.ItemName}),(0,s.jsx)("label",{children:"Loan Recipient"}),(0,s.jsx)("div",{children:(0,s.jsx)("strong",{children:e.shortTermLoan.RecipientName})})]}),(0,s.jsxs)("div",{className:"p-col-12 p-md-6 p-lg-3",children:[(0,s.jsx)("label",{children:"Loan Status"}),(0,s.jsx)("div",{children:(0,s.jsx)("strong",{children:e.shortTermLoan.StatusName})})]}),e.shortTermLoan.StatusId<5&&(0,s.jsx)(y,{DefaultLoanPeriod:I.data.program.DefaultLoanPeriod,makeDisabled:e=>h(!0),shortTermLoan:e.shortTermLoan,onUpdate:e.onUpdate}),(0,s.jsxs)("div",{className:"p-col-12",children:[(0,s.jsx)("label",{children:"Loan Comments / Shipping Instructions"}),(0,s.jsx)("div",{children:(0,s.jsx)(g.Z,{style:{width:"100%"},value:t,onChange:e=>a(e.target.value)})})]}),(0,s.jsxs)("div",{className:"p-col-12",children:[(0,s.jsx)("label",{children:"Manager Notes"}),(0,s.jsx)("div",{children:(0,s.jsx)("strong",{children:(0,s.jsx)(g.Z,{style:{width:"100%"},value:n,onChange:e=>o(e.target.value)})})})]}),(0,s.jsx)("div",{className:"p-col-12",children:(0,s.jsx)(R,{surveyId:e.shortTermLoan.LoanSurveyId,loanId:e.shortTermLoan.Id,defaultChecked:4==e.shortTermLoan.StatusId,onLoanIDsUpdate:e.onLoanIDsUpdate,label:"Check the following items from this loan event to update with the above changes."})}),!e.updateConfirmed&&(0,s.jsxs)(s.Fragment,{children:[" ",(0,s.jsx)("div",{className:"p-col-12",children:(0,s.jsx)(i.$,{type:"submit",onClick:e.onSubmit,label:"Save Loan",style:l?{display:"none"}:{}})})]})]})})},E=e=>{let t=(0,d.useContext)(L.A),[a,n]=(0,d.useState)(),[o,i]=(0,d.useState)(),[h,m]=(0,d.useState)(),[u,p]=(0,d.useState)(),[T,g]=(0,d.useState)(),[S,j]=(0,d.useState)(),[D,f]=(0,d.useState)(),[b,R]=(0,d.useState)([]),[y,E]=(0,d.useState)(!1),[_]=(0,l.n)(N,{onCompleted:()=>{w()}}),w=()=>
1{e.setToast({severity:"success",detail:"The loan was updated.",summary:"Update Successful",logmessage:"Loan id ".concat(e.query.loanId," was updated by ").concat(t.ID),redirect:{pathname:"/loan/loandetails",query:{loanId:parseInt(e.query.loanId)}}})},{loading:O,error:k,data:A}=(0,r.I)(I.SHORT_TERM_LOAN,{variables:{id:parseInt(e.query.loanId)}});if(!t)return(0,s.jsx)(v,{children:"Access Denied"});if(O)return(0,s.jsx)(c.A,{});if(k)return(0,s.jsx)(v,{children:k.message});let{editAuthorization:U,errorMessage:$}=(0,I.permissionToManageLoan)(t,A.shortTermLoan.ProgramId);return U?(0,s.jsx)(C,{shortTermLoan:A.shortTermLoan,onLoanIDsUpdate:e=>{R(e)},updateConfirmed:y,onUpdate:(e,t,a,n,s)=>{console.log(n),m(e),p(t),g(a),j(n),f(s)},onSubmit:t=>{let n;t.preventDefault();let s=[...b],r=JSON.parse(localStorage.getItem("SHORT_TERM_LOANS_QUERY"))||{},l=JSON.parse(localStorage.getItem("LOAN_STATUS_COUNTS"))||{};s.push(parseInt(e.query.loanId)),4==A.shortTermLoan.StatusId&&(n=1),2==A.shortTermLoan.StatusId&&(n=D),1==A.shortTermLoan.StatusId&&(n=1),s.forEach(t=>{_({variables:{Id:t,LoanDate:h,ReturnDate:u,EmailNoticeDate:T,CheckInDate:S,Comments:a,ManagerNotes:o,StatusId:n},refetchQueries:[{query:I.SHORT_TERM_LOAN,variables:{id:t}},{query:x.SHORT_TERM_LOANS_QUERY,variables:{itemId:A.shortTermLoan.ItemId,status:"OutorWaiting"}},{query:x.SHORT_TERM_LOANS_QUERY,variables:{itemId:A.shortTermLoan.ItemId,status:"Out"}},{query:x.SHORT_TERM_LOANS_QUERY,variables:r},{query:x.LOAN_STATUS_COUNTS,variables:l},"ONE_ITEM_QUERY"]}).catch(t=>{e.setToast({severity:"error",detail:"There was a problem saving the loan. Administrators have been notified of the problem.",summary:"Saving Failed",logmessage:JSON.stringify(t),redirect:""})})})},onCommentUpdate:(e,t)=>{n(e),i(t)}}):(0,s.jsx)(v,{children:$})};E.getInitialProps=e=>({query:e.query});let _=E}}]);

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.