PageSourceSearch

https://at4all.com/_next/static/chunks/1007-66c15896dc9a01c5.js

js at4all.com collected 2026-09-24 12:12:51 UTC 46,284 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1007],{1007:(e,t,a)=>{let n,r,s,i,o;a.r(t),a.d(t,{ADDCLIENT2PROGRAM:()=>eb,CREATE_NOTIFICATION:()=>ex,NOTIFY_MANAGERS:()=>ey,NOTIFY_WEBSITEADMINS:()=>ej,default:()=>eM});var l=a(28888),c=a(37876),d=a(86191),m=a(31167),u=a(78248),h=a(64177),I=a(14232),p=a(48230),g=a.n(p),v=a(89099),f=a.n(v),D=a(98949),x=a(70467),y=a(37147),j=a(87211),b=a(72631),N=a(47793),S=a(25280),E=a(42523),P=a(99931),A=a(97620),C=a(77287),T=a(44867),L=a(90985),R=a(76514),w=a(62997),$=a(51688),O=a(99188),_=a(98314),k=a(74920),F=a(71534),q=a(63200),U=a(73678),B=a(89379),M=a(10475),Y=a(24704),W=a(33359),Q=a(76761),V=a(4551),H=a(78101),J=a(24421);function G(){let e=(0,l._)(["\nquery CHECKOUT_USER_QUERY($id: ID!) {\n  user(id: $id) {\n    ID\n    First\n    Last\n    Email\n    Auth {\n      isWebAdmin\n      programs\n    }\n    AtProgramIDs\n  }\n}\n"]);return G=function(){return e},e}function Z(){let e=(0,l._)(["\n    mutation CREATE_NOTIFICATION($Subject: String,\n        $Body: String,\n        $Send: Date,\n        $EmailSent: DateTime,\n        $EmailRead: DateTime,\n        $NotificationSent: DateTime,\n        $NotificationRead: DateTime,\n        $ToPersonID: Int)\n    {\n     createNotification(\n        Subject:$Subject ,\n        Body:$Body ,\n        Send:$Send ,\n        EmailSent:$EmailSent ,\n        EmailRead:$EmailRead ,\n        NotificationSent:$NotificationSent ,\n        NotificationRead:$NotificationRead ,\n        ToPersonID:$ToPersonID )\n    }\n"]);return Z=function(){return e},e}function z(){let e=(0,l._)(["\n    mutation NOTIFY_MANAGERS($Subject: String,\n        $Body: String, $ProgramID:Int)\n    {\n      notifyManagers(\n        Subject:$Subject ,\n        Body:$Body ,\n        ProgramID: $ProgramID)\n    }\n"]);return z=function(){return e},e}function K(){let e=(0,l._)(["\n    mutation NOTIFY_WEBSITEADMINS($Subject: String,\n        $Body: String)\n    {\n      notifyWebsiteAdmins(\n        Subject:$Subject ,\n        Body:$Body)\n    }\n"]);return K=function(){return e},e}function X(){let e=(0,l._)(["\n    mutation ADDCLIENT2PROGRAM($UserID:Int, $ProgramID:Int)\n    {\n      addClient2Program(UserID:$UserID, ProgramID:$ProgramID)\n    }\n"]);return X=function(){return e},e}function ee(){let e=(0,l._)(["\n mutation CREATE_LOAN_SURVEY(\n      $BenefitAreaID: Int\n      $OutcomeID: Int\n      $SatisfactionLevelID: Int\n      $EmploymentDataID: Int\n    	$Anecdote: String\n      $LoanPurposeID: Int){\n      createLoanSurvey(BenefitAreaID: $BenefitAreaID, OutcomeID: $OutcomeID,\n      SatisfactionLevelID: $SatisfactionLevelID, EmploymentDataID: $EmploymentDataID,\n      LoanPurposeID: $LoanPurposeID, Anecdote: $Anecdote)\n}\n"]);return ee=function(){return e},e}function et(){let e=(0,l._)(["\n mutation CREATE_SHORT_TERM_LOAN($RequestedDate: DateTime\n    			$LoanDate: DateTime\n          $ReturnDate: DateTime\n    			$StatusId: Int\n    			$ItemId: Int\n    			$CheckInDate: DateTime\n          $AccountId: Int\n    			$EmailNoticeDate: DateTime\n    			$Comments: String\n          $LoanFacilitatorId: Int\n    			$SurveyId: Int\n    			$VTVRDataId: Int\n    			$ManagerNotes: String){\n  createShortTermLoan(RequestedDate: $RequestedDate\n    			LoanDate: $LoanDate\n          ReturnDate: $ReturnDate\n    			StatusId: $StatusId\n    			ItemId: $ItemId\n    			CheckInDate: $CheckInDate\n          AccountId: $AccountId\n    			EmailNoticeDate: $EmailNoticeDate\n    			Comments: $Comments\n          LoanFacilitatorId: $LoanFacilitatorId\n    			SurveyId: $SurveyId\n    			VTVRDataId: $VTVRDataId\n    			ManagerNotes: $ManagerNotes)\n}"]);return et=function(){return e},e}function ea(){let e=(0,l._)(["\n  mutation CREATE_REUSE_SURVEY(\n    $benefitAreaId:Int , $performanceOutcomeId: Int, $satisfactionLevelId: Int, $at4allTransaction: Int\n  ){createReuseSurvey(benefitAreaId:$benefitAreaId performanceOutcomeId:$performanceOutcomeId,\n  satisfactionLevelId:$satisfactionLevelId at4allTransaction: $at4allTransaction){ID}\n  }"]);return ea=function(){return e},e}function en(){let e=(0,l._)(["\n  mutation CREATE_REUSE_TRANSACTION($itemId:Int, $dateCompleted: DateTime, $closedStatusId: Int, $sellingPrice: Float, $surveyId: Int, $recipientId: Int,\n         $facilitatorAccountId: Int, $comments: String, $managerNotes: String )\n  {createReuseTransaction(itemId: $itemId, dateCompleted: $dateCompleted, closedStatusId: $closedStatusId, sellingPrice: $sellingPrice, surveyId: $surveyId, recipientId: $recipientId,\n         facilitatorAccountId:  $facilitatorAccountId, comments:$comments, managerNotes:$managerNotes){TransactionID}}\n"]);return en=function(){return e},e}let{Title:er,ErrorText:es}=a(63200),ei=[],eo=[],el=[],ec=!1,ed=[],em=!1,eu=[],eh=[],eI=!1,ep=[],eg=[],ev=!1,ef={loanPurposeId:void 0,loanDate:void 0,returnDate:void 0,emailReminderDays:void 0,comments:void 0,managerComments:void 0},eD=(0,d.J1)(G()),ex=(0,d.J1)(Z()),ey=(0,d.J1)(z()),ej=(0,d.J1)(K()),eb=(0,d.J1)(X()),eN=(0,d.J1)(ee()),eS=(0,d.J1)(et()),eE=(0,d.J1)(ea()),eP=(0,d.J1)(en()),eA=e=>{let t=document.getElementsByClassName("p-datepicker");t.length>
10&&Array.from(t).forEach(e=>{e.style.display="block"})},eC=e=>{let{data:t,loading:a,error:n}=(0,m.I)(R.ONE_USER_QUERY,{variables:{id:parseInt(e.ownerId)}});return a?(0,c.jsx)(F.A,{}):n?(0,c.jsx)(es,{children:"error.message"}):(0,c.jsxs)("div",{children:["Contact ",(0,c.jsxs)("strong",{children:[t.user.First," ",t.user.Last]})," to obtain this item at...",(0,c.jsxs)("strong",{children:[!t.user.HideAddress&&(0,c.jsxs)("div",{children:[t.user.Add1," ",t.user.Add2]}),!t.user.HideEmail&&(0,c.jsx)("div",{children:t.user.Email}),!t.user.HidePhone1&&(0,c.jsx)("div",{children:t.user.Phone1}),!t.user.HidePhone2&&(0,c.jsx)("div",{children:t.user.Phone2}),!t.user.HidePhone3&&(0,c.jsx)("div",{children:t.user.Phone3})]})]})},eT=e=>{var t,a;let n=(0,I.useContext)(B.O),[r,{called:l,loading:d,data:m,error:h}]=(0,u._)(eD,{ssr:!1}),p=t=>{o!=t&&(o=t,e.onUserSelect())},g=parseInt(e.recipientId);return(!l&&g&&g>0&&r({variables:{id:g,status:"Active",clientPrograms:e.clientPrograms}}),l&&d)?(0,c.jsx)(F.A,{}):l&&h?(0,c.jsx)(es,{children:h.message}):!l||(null==m||null==(t=m.user)?void 0:t.ID)?(l&&(null==m||null==(a=m.user)?void 0:a.ID)&&p(m.user),o)?(0,c.jsxs)(c.Fragment,{children:[o.First," ",o.Last]}):i?(p(n),(0,c.jsxs)(c.Fragment,{children:[n.First," ",n.Last]})):s?(p(e.curUser),(0,c.jsxs)(c.Fragment,{children:[e.curUser.First," ",e.curUser.Last]})):(0,c.jsx)(J.A,{onUserSelect:p,multi:!1,showNew:!0}):(0,c.jsx)(es,{children:"User Error!"})},eL=e=>(0,c.jsx)(q.ItemButtons,{children:"WY"==e.state?(0,c.jsx)(k.A,{label:"Print Loan Agreement",reportName:"LT-WATR20",parameters:[{Prompt:"LoanSurveyID",value:e.surveyId.toString()}]}):(0,c.jsxs)(c.Fragment,{children:["  ",(0,c.jsx)(k.A,{label:"Print Loan Agreement (no comments)",reportName:"LTNoComments20",parameters:[{Prompt:"LoanSurveyId",value:e.surveyId.toString()}]}),(0,c.jsx)(k.A,{label:"Print Loan Agreement (with comments - 2 page)",reportName:"LTNew20",parameters:[{Prompt:"LoanSurveyId",value:e.surveyId.toString()}]}),(0,c.jsx)(k.A,{label:"Print Loan Agreement (with QR code)",reportName:"LTQR20",parameters:[{Prompt:"LoanSurveyId",value:e.surveyId.toString()}]})]})}),eR=e=>{var t;let[a,n]=(0,I.useState)(e.loanItem.loanDate),r=new Date,[i,l]=(0,I.useState)(void 0!=e.DefaultLoanPeriod?new Date(r.getFullYear(),r.getMonth(),r.getDate()+e.DefaultLoanPeriod):new Date(r.getFullYear(),r.getMonth(),r.getDate()+5)),[d,m]=(0,I.useState)(e.loanItem.emailReminderDays),[u,h]=(0,I.useState)(""),[p,g]=(0,I.useState)(""),[v,f]=(0,I.useState)(e.loanItem.waitingList),[x,b]=(0,I.useState)(e.loanItem.loanPurposeId),S="",E=(0,I.useContext)(U.R);return(void 0==e.DefaultLoanPeriod||void 0==i||ev||(l(new Date(r.getFullYear(),r.getMonth(),r.getDate()+e.DefaultLoanPeriod)),ev=!0),(0,I.useEffect)(()=>{ef.loanPurposeId&&b(ef.loanPurposeId),ef.loanDate&&n(ef.loanDate),ef.returnDate&&l(ef.returnDate),ef.emailReminderDays&&m(ef.emailReminderDays)}),(0,I.useEffect)(()=>{(()=>{let t={...e.loanItem};t.loanPurposeId=x,t.loanDate=a,t.returnDate=i,t.emailReminderDays=d,t.comments=u,t.managerComments=p,t.accessError=S,t.waitingList=v,e.onUpdate(t)})()}),""!=e.loanItem.Availability)?(0,c.jsxs)("div",{className:"p-grid",children:[(0,c.jsx)("div",{className:"p-col-12",children:(0,c.jsx)("strong",{children:e.loanItem.ItemID+" - "+e.loanItem.ItemName})}),(0,c.jsx)("div",{className:"p-col-12",children:(0,c.jsx)(es,{children:e.loanItem.Availability})}),(0,c.jsxs)("div",{className:"p-col-12",children:[(0,c.jsx)(P.S,{inputId:"ckbWaitList".concat(e.loanItem.ItemID),value:e.loanItem.ItemID,checked:v,onChange:e=>{f(!v)}}),(0,c.jsx)("strong",{children:(0,c.jsx)("label",{htmlFor:"ckbWaitList".concat(e.loanItem.ItemID),children:" Check here if you want to be added to the waiting list for this item."})})]})]}):(e.loanItem.HasAdminCheckout&&(S="This item is on administrative checkout and cannot be loaned."),!e.loanItem.RestrictedLoan||o.AtProgramIDs&&o.AtProgramIDs.split(",").includes(e.loanItem.ProgramID.toString())||(S="This item cannot be loaned to ".concat(o.First,", ").concat(o.Last,", becuase it is restricted to people at ").concat(e.loanItem.ProgramName,"\n      This item will be IGNORED in the processing of the cart.")),s||E.Auth.isWebAdmin||(null==(t=E.Auth)?void 0:t.programs.includes(e.loanItem.ProgramID))||(S="This item cannot be loaned, becuase it is part of a program you do not manage.\n        This item will be IGNORED in the processing of the cart."),(0,c.jsxs)("div",{className:"p-grid",children:[(0,c.jsx)("div",{className:"p-col-10",children:(0,c.jsx)("strong",{children:e.loanItem.ItemID+" - "+e.loanItem.ItemName})}),""!=S?(0,c.jsx)("div",{className:"p-col-12",children:(0,c.jsx)(es,{children:S})}):(0,c.jsxs)(c.Fragment,{children:[!s&&(0,c.jsx)("div",{className:"p-col-2",children:(0,c.jsxs)("a",{style:{cursor:"pointer"},onClick:()=>{e.makeItemOpenEnded(e.loanItem)},href:"#",children:[(0,c.jsx)("i",{className:"fa fa-hand-o-right","aria-hidden":!0})," Make Open-Ended"]})}),(0,c.jsxs)("div",{className:"p-col-12",children:[(0,c.jsx)("div",{className:"required",children:"Select a purpose for this loan item."}),(0,c.jsxs)("div",{children:[(0,c.jsx)(M.A,{UpdatePurpose:e=>b(e),inputId:"LoanPurpose".concat(e.loanItem.ItemID),autoFocus:"LoanPurpose"==e.myfocus,LoanPurposeID:x,style:{width:"500px"},required:!0}),void 0==x&&e.didSubmit&&(0,c.jsx)(es,{children:"Loan purpose must be selected."})]}),e.hasMultipleItems&&(0,c.jsx)(D.$,{type:"submit",onClick:()=>{e.onClone({loanPurposeId:x,loanDate:a,returnDate:i,emailReminderDays:d,comments:u,managerComments:p})},label:"Duplicate for all items"})]}),!s&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:"p-col-6 p-lg-4",children:[(0,c.jsx)("div",{children:(0,c.jsx)("label",{htmlFor:"LoanDate",children:"Loan Date"})}
1),(0,c.jsx)(N.V,{id:"LoanDate",value:a,onChange:e=>e.target.value instanceof Date&&n(e.target.value),appendTo:"self",showIcon:!0,showOnFocus:!1,onShow:eA}),""==a&&(0,c.jsx)(es,{children:"Loan date must be selected."}),new Date(a)=="Invalid date"&&(0,c.jsx)(es,{children:"Loan date is invalid."})]}),(0,c.jsxs)("div",{className:"p-col-6 p-lg-4",children:[(0,c.jsx)("div",{children:(0,c.jsx)("label",{htmlFor:"ReturnDate",children:"Return Date"})}),(0,c.jsx)(N.V,{id:"ReturnDate",dateFormat:"mm/dd/yy",className:"p-calendar",showButtonBar:!0,placeholder:i?i.toString():new Date().toString(),onChange:e=>e.target.value instanceof Date&&l(e.target.value),value:i,appendTo:"self",showOnFocus:!1,showIcon:!0,onShow:eA}),""==i&&(0,c.jsx)(es,{children:"Return date must be selected."}),new Date(i)=="Invalid date"&&(0,c.jsx)(es,{children:"Return date is invalid."}),new Date(i)<new Date(a)&&(0,c.jsx)(es,{children:"Return date is before the loan date."})]}),(0,c.jsxs)("div",{className:"p-col-12 p-lg-4",children:[(0,c.jsx)("label",{htmlFor:"EmailReminderDays",children:"Email Reminder (Days before return date.)"}),(0,c.jsx)(y.S,{keyfilter:/\d/,value:d,onChange:e=>m(e.target.value),id:"EmailReminderDays"}),""==d&&(0,c.jsx)(es,{children:"Email reminder days must be specified."}),isNaN(parseInt(d))&&(0,c.jsx)(es,{children:"Email reminder days must be an integer."})]})]}),(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsx)("label",{htmlFor:"Comments",children:"Comments / Shipping Instructons"}),(0,c.jsx)(j.Z,{style:{width:"100%"},value:u,id:"Comments",onChange:e=>h(e.target.value)})]}),(E.Auth.isWebAdmin||E.Auth.programs.includes(e.loanItem.programId))&&(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsx)("label",{htmlFor:"ManagerComments",children:"Manager Comments"}),(0,c.jsx)("div",{children:(0,c.jsx)(j.Z,{style:{width:"100%"},value:p,id:"ManagerComments",onChange:e=>g(e.target.value)})})]})]})]}))},ew=e=>{let[t,a]=(0,I.useState)(),n=(0,I.useContext)(Y.l),[r,i]=(0,I.useState)([...e.event.items]),o=a=>{let n={...e.event};n.employmentDataId=t,a&&n.items.splice(n.items.findIndex(e=>e.ItemID===a.ItemID),1,a),i(n.items)},l=e=>{ef=e};return(0,I.useEffect)(()=>{ef.loanPurposeId&&(ef={loanPurposeId:void 0,loanDate:void 0,returnDate:void 0,emailReminderDays:void 0,comments:void 0,managerComments:void 0})}),(0,c.jsx)(c.Fragment,{children:(0,c.jsx)(b.Z,{header:"Items from "+e.event.programName,children:(0,c.jsxs)("div",{children:[r&&r.map((t,a)=>(0,c.jsx)(eR,{onUpdate:o,DefaultLoanPeriod:e.event.DefaultLoanPeriod,hasMultipleItems:e.event.items.length>1,loanItem:t,didSubmit:e.didSubmit,onClone:l,myfocus:0==a?e.myfocus:"none",makeItemOpenEnded:e.makeItemOpenEnded},t.ItemID)),!s&&"NE"===n.HostState&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"p-col-3",children:(0,c.jsx)("label",{children:"Employment Information"})}),(0,c.jsx)("div",{className:"p-col-9",children:(0,c.jsx)(W.A,{EmploymentCategoryId:t,programId:e.event.programId,onChange:e=>{a(e)}})})]})]})})})},e$=e=>{let t,[a,n]=(0,I.useState)(!1),r=(0,I.useContext)(Y.l),i=[];return(0,c.jsxs)("div",{children:[e.events.map(t=>(0,c.jsx)("div",{children:(0,c.jsx)(ew,{event:t,didSubmit:a,makeItemOpenEnded:e.makeItemOpenEnded,myfocus:e.myfocus})},"".concat(t.programId).concat(t.surveyId))),s&&"NEEducation"!=r.HostState&&(0,c.jsx)("div",{children:"Clicking below initiates a request for these items.  Representatives of each loan program above will contact you with information on how to complete the loan and receive the items."}),s&&"NEEducation"==r.HostState&&(0,c.jsx)("div",{children:"Clicking below initiates a request for these items. Items will be shipped at time of request."}),eo.length>0&&(0,c.jsx)("ul",{children:eo.map((e,t)=>(0,c.jsx)("li",{children:(0,c.jsx)(es,{children:e})},t))}),(0,c.jsx)(D.$,{type:"submit",onClick:()=>{n(!0),e.events.forEach(e=>{if(!e.items.find(e=>""!=e.accessError)&&(e.items.forEach(e=>{""!=e.Availability||e.error&&""!=e.error||e.waitingList||(!e.loanPurposeId&&(i.push("Loan Purpose not selected for "+e.ItemName),t||(t="LoanPurpose".concat(e.ItemID))),""==e.loanDate&&i.push("Loan date must be selected."),new Date(e.loanDate)=="Invalid date"&&i.push("Loan date is invali
1d."),""==e.returnDate&&i.push("Return date must be selected."),new Date(e.returnDate)=="Invalid date"&&i.push("Return date is invalid."),new Date(e.returnDate)<new Date(e.loanDate)&&(i.push("Return date is before the loan date."),t||(t="ReturnDate".concat(e.ItemID))),""==e.emailReminderDays&&i.push("Email reminder days must be specified."),isNaN(parseInt(e.emailReminderDays))&&i.push("Email reminder days must be an integer."))}),i.length>0)&&(console.log("errFocus",t),""!=t)){let e=document.querySelector("#".concat(t," input"));null==e||e.focus()}}),ec=!0,0==(eo=i).length&&e.saveAndNext()},label:"Continue"})]})},eO=e=>{var t;let[a,n]=(0,I.useState)(e.item.sellingPrice||0),r="",i=(0,I.useContext)(U.R);return e.item.HasAdminCheckout&&(r="This item is on administrative checkout and cannot be marked as reuse."),!e.item.RestrictedLoan||o.AtProgramIDs&&o.AtProgramIDs.split(",").includes(e.item.ProgramID.toString())||(r="This item cannot be marked as reuse to ".concat(o.First,", ").concat(o.Last,", becuase it is restricted to people at ").concat(e.item.ProgramName,"\n      This item will be IGNORED in the processing of the cart.")),i.ID==o.ID||i.Auth.isWebAdmin||(null==(t=i.Auth)?void 0:t.programs.includes(e.item.ProgramID))||(r="This item cannot be marked as reuse, becuase it is part of a program you do not manage.\n        This item will be IGNORED in the processing of the cart."),(t=>{let n={...e.item,sellingPrice:a,accessError:t};e.onChange(n)})(r),(0,c.jsx)("div",{className:"p-grid",children:""!=r?(0,c.jsxs)("div",{className:"p-col-12",children:[(0,c.jsx)("strong",{children:e.item.ItemID+" - "+e.item.ItemName}),(0,c.jsx)(es,{children:r})]}):(0,c.jsx)(c.Fragment,{children:s?(0,c.jsx)("div",{className:"p-col-6",children:e.item.ItemID+" - "+e.item.ItemName}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)("div",{className:"p-col-6 required",children:["Selling price for ",(0,c.jsx)("strong",{children:e.item.ItemID+" - "+e.item.ItemName})]}),(0,c.jsxs)("div",{className:"p-col-6",children:["$ ",(0,c.jsx)(S.Y,{require:"true",keyfilter:"money",value:a||0,id:"SellingPrice".concat(e.item.ItemID),onChange:t=>{(t=>{let a={...e.item,sellingPrice:t,accessError:r};n(t),a.sellingPrice=t,a.accessError=r,e.onChange(a)})(t.value)},autoFocus:"SellingPrice"==e.myfocus}),e.didSubmit&&""===a&&(0,c.jsx)(es,{children:"Selling price is required.  If given away, enter 0 for the price."})]})]})})})},e_=e=>
1{let[t,a]=(0,I.useState)(new Date),[n,r]=(0,I.useState)(),[i,o]=(0,I.useState)(),[l,d]=(0,I.useState)(),[m,u]=(0,I.useState)(!0),h=()=>{let a={...e.event};a.benefitAreaId=n,a.performanceOutcomeId=i,a.satisfactionLevelId=l,a.at4allTransaction=m,a.transactiondate=t,e.onChange(a)},p=t=>{e.event.items.splice(e.event.items.findIndex(e=>e.ItemID==t.ItemID),1,t),h()};return(0,I.useEffect)(()=>{h()}),(0,c.jsx)(c.Fragment,{children:(0,c.jsxs)(b.Z,{header:"Items from ".concat(e.event.programName," ").concat(1==e.event.programId?"(Exchange Items)":"(Reassignment/Refurbishment and Repair)"),children:[e.event.items&&e.event.items.map(t=>(0,c.jsx)(eO,{item:t,onChange:p,didSubmit:e.didSubmit,myfocus:e.myfocus},t.ItemID)),!s&&(0,c.jsxs)("div",{className:"p-grid",children:[(0,c.jsx)("div",{className:"p-col-6 required",children:"Transaction Date: "}),(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsx)(N.V,{id:"TransactionDate",dateFormat:"mm/dd/yy",className:"p-calendar",showButtonBar:!0,onChange:e=>e.target.value instanceof Date&&a(e.target.value),appendTo:"self",showIcon:!0,onShow:eA,showOnFocus:!1,value:t}),new Date(t)=="Invalid date"&&(0,c.jsx)(es,{children:"Date is invalid."})]}),(0,c.jsx)("div",{className:"p-col-12",children:"Questions"}),(0,c.jsx)("div",{className:"p-col-6 required",children:"The Primary purpose for which I need an AT device or service is related to: "}),(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsx)(Q.A,{onChange:e=>r(e),value:n,inputId:"BenefitArea".concat(e.event.items[0].ItemID)}),e.didSubmit&&!n&&(0,c.jsx)(es,{children:"Please select a benefit area for the purpose of this activity."})]}),(0,c.jsx)("div",{className:"p-col-6 required",children:"Why did you choose to obtain an AT device/service from this program."}),(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsx)(V.A,{Type:"ExchangeReutilization",inputId:"Outcome".concat(e.event.items[0].ItemID),onChange:e=>o(e),value:i,uid:e.event.programId}),e.didSubmit&&!i&&(0,c.jsx)(es,{children:"Please select a performance outcome for this activity."})]}),(0,c.jsx)("div",{className:"p-col-6 required",children:"Which of the following best reflects your level of satisfaction with the services you received?"}),(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsx)(H.A,{onChange:e=>d(e),value:l,uid:e.event.programId,inputId:"SatisfactionLevel".concat(e.event.items[0].ItemID)}),e.didSubmit&&!l&&(0,c.jsx)(es,{children:"Please select a satisfaction level for this activity."})]}),(0,c.jsx)("div",{className:"p-col-6",children:"Where did this transaction take place?"}),(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsxs)("div",{className:"radiobutton-padding",children:[(0,c.jsx)(E.a,{checked:m,onChange:e=>{u(!0)},inputId:"at4allTransaction".concat(e.event.programId,"at4all")}),(0,c.jsx)("strong",{children:(0,c.jsx)("label",{htmlFor:"at4allTransaction".concat(e.event.programId,"at4all"),children:"This Website"})})]}),(0,c.jsxs)("div",{className:"radiobutton-padding",children:[(0,c.jsx)(E.a,{checked:!m,label:"",onChange:e=>{u(!1)},inputId:"at4allTransaction".concat(e.event.programId)}),(0,c.jsx)("strong",{children:(0,c.jsx)("label",{htmlFor:"at4allTransaction".concat(e.event.programId),children:"Another website (i.e. Craigslist, ebay)"})})]})]})]})]})})},ek=e=>{let t,[a,n]=(0,I.useState)(!1),r=[],i=e=>{e&&eu.splice(eu.findIndex(t=>t.programId==e.programId),1,e)};return(0,c.jsxs)("div",{children:[e.events.map(t=>(0,c.jsx)(e_,{event:t,didSubmit:a,onChange:i,myfocus:e.myfocus},t.programId)),s&&e.events.filter(e=>1!=e.programId).length>0&&(0,c.jsx)("div",{children:"Clicking below initiates a request for these items.  Representatives of each program above will contact you with information on how receive the items."}),ed.length>0&&(0,c.jsx)("ul",{children:ed.map((e,t)=>(0,c.jsx)("li",{children:(0,c.jsx)(es,{children:e})},t))}),(0,c.jsx)(D.$,{type:"submit",onClick:()=>{n(!0),e.events.forEach(e=>{e.items.find(e=>""!=e.accessError)||(s||e.benefitAreaId||(r.push("Please select a benefit area for the purpose of this activity."),t||(t="BenefitArea".concat(e.items[0].ItemID))),s||e.performanceOutcomeId||(r.push("Please select a performance outcome for this activity."),t||(t="Outcome".concat(e.items[0].ItemID))),s||e.satisfactionLevelId||(r.push("Please select a satisfaction level for this activity."),t||(t="SatisfactionLevel".concat(e.items[0].ItemID))),e.items.forEac
1h(e=>{""===e.sellingPrice&&(r.push("Selling price is required.  If given away, enter 0 for the price."),t||(t="SellingPrice".concat(e.ItemID)))}))}),0==(ed=r).length&&(em=!0,e.saveAndNext()),r.length>0&&(console.log(t),""!=t&&document.querySelector("#".concat(t," input")).focus())},label:"Continue",autoFocus:s})]})},eF=e=>{let[t,a]=(0,I.useState)(0),[n,r]=(0,I.useState)(e.item.loanDate),[s,i]=(0,I.useState)(),[o,l]=(0,I.useState)(""),[d,m]=(0,I.useState)("");return((0,I.useEffect)(()=>{(()=>{let a={...e.item};a.consumerCost=t,a.emailReminderDate=s,a.loanDate=n,a.comments=o,a.managerComments=d,e.onChange(a)})()}),""!=e.item.Availability)?(0,c.jsxs)("div",{className:"p-grid",children:[(0,c.jsx)("div",{className:"p-col-12",children:(0,c.jsx)("strong",{children:e.item.ItemID+" - "+e.item.ItemName})}),(0,c.jsx)("div",{className:"p-col-12",children:(0,c.jsxs)(es,{children:["This item is currently on loan. ",e.item.Availability]})}),(0,c.jsxs)("div",{className:"p-col-12",children:[(0,c.jsx)(P.S,{inputId:"ckbWaitList",value:e.item.ItemID,checked:waitingList,onChange:e=>{setWaitingList(!waitingList)}}),(0,c.jsx)("strong",{children:(0,c.jsx)("label",{htmlFor:"ckbWaitList",children:" Check here if you want to be added to the waiting list for this item."})})]})]}):(0,c.jsxs)("div",{className:"p-grid",children:[(0,c.jsxs)("div",{className:"p-col-6 required",children:["Cost to consumer for ",(0,c.jsx)("strong",{children:e.item.ItemName})]}),(0,c.jsxs)("div",{className:"p-col-6",children:["$ ",(0,c.jsx)(y.S,{require:"true",keyfilter:"money",value:t,onChange:e=>{a(e.target.value)},autoFocus:"consumerCost"==e.myfocus,id:"consumerCost"}),e.didSubmit&&""===t&&(0,c.jsx)(es,{children:"Cost to consumer is required."})]}),(0,c.jsx)("div",{className:"p-col-6",children:(0,c.jsx)("label",{htmlFor:"LoanDate",children:"Loan Date"})}),(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsx)(N.V,{id:"LoanDate",dateFormat:"mm/dd/yy",className:"p-calendar",showButtonBar:!0,onChange:e=>e.target.value instanceof Date&&r(e.target.value),appendTo:"self",showIcon:!0,onShow:eA,showOnFocus:!1,value:n}),new Date(n)=="Invalid date"&&(0,c.jsx)(es,{children:"Loan date is invalid."})]}),(0,c.jsx)("div",{className:"p-col-6",children:(0,c.jsx)("label",{htmlFor:"EmailReminderDate",children:"Email Reminder Date"})}),(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsx)(N.V,{id:"EmailReminderDate",dateFormat:"mm/dd/yy",className:"p-calendar",showButtonBar:!0,onChange:e=>e.target.value instanceof Date&&i(e.target.value),appendTo:"self",showIcon:!0,onShow:eA,showOnFocus:!1,value:s}),new Date(s)=="Invalid date"&&(0,c.jsx)(es,{children:"Email reminder date is invalid."})]}),(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsx)("label",{children:"Comments"}),(0,c.jsx)("div",{children:(0,c.jsx)(j.Z,{style:{width:"100%"},value:o,onChange:e=>l(e.target.value)})})]}),(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsx)("label",{children:"Manager Comments"}),(0,c.jsx)("div",{children:(0,c.jsx)(j.Z,{style:{width:"100%"},value:d,onChange:e=>m(e.target.value)})})]})]})},eq=e=>
1{let[t,a]=(0,I.useState)(),[n,r]=(0,I.useState)(),[i,o]=(0,I.useState)(),[l,d]=(0,I.useState)(!0),m=t=>{e.event.items.splice(e.event.items.findIndex(e=>e.ItemID==t.ItemID),1,t)};return(0,I.useEffect)(()=>{(()=>{let a={...e.event};a.benefitAreaId=t,a.performanceOutcomeId=n,a.satisfactionLevelId=i,e.onChange(a)})()}),(0,c.jsx)(c.Fragment,{children:(0,c.jsxs)(b.Z,{header:"Items from ".concat(e.event.programName),children:[e.event.items&&e.event.items.map((t,a)=>(0,c.jsx)(eF,{item:t,onChange:m,didSubmit:e.didSubmit,myfocus:0==a?e.myfocus:"none"},t.ItemID)),!s&&(0,c.jsxs)("div",{className:"p-grid",children:[(0,c.jsx)("div",{className:"p-col-12",children:"Questions for this Open-Ended Loan Event"}),(0,c.jsx)("div",{className:"p-col-6 required",children:"The Primary purpose for which I need an AT device or service is related to: "}),(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsx)(Q.A,{onChange:e=>a(e),value:t,inputId:"BenefitArea"}),e.didSubmit&&!t&&(0,c.jsx)(es,{children:"Please select a benefit area for the purpose of this activity."})]}),(0,c.jsx)("div",{className:"p-col-6 required",children:"Why did you choose to obtain an AT device/service from this program."}),(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsx)(V.A,{Type:"ExchangeReutilization",onChange:e=>r(e),value:n,uid:e.event.programId,inputId:"Outcome"}),e.didSubmit&&!n&&(0,c.jsx)(es,{children:"Please select a performance outcome for this activity."})]}),(0,c.jsx)("div",{className:"p-col-6 required",children:"Which of the following best reflects your level of satisfaction with the services you received?"}),(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsx)(H.A,{onChange:e=>o(e),value:i,uid:e.event.programId,inputId:"SatisfactionLevel"}),e.didSubmit&&!i&&(0,c.jsx)(es,{children:"Please select a satisfaction level for this activity."})]}),(0,c.jsx)("div",{className:"p-col-6",children:"Where did this transaction take place?"}),(0,c.jsxs)("div",{className:"p-col-6",children:[(0,c.jsxs)("div",{className:"radiobutton-padding",children:[(0,c.jsx)(E.a,{checked:l,onChange:e=>{d(!0)},inputId:"at4allTransaction".concat(e.event.programId,"at4all")}),(0,c.jsx)("strong",{children:(0,c.jsx)("label",{htmlFor:"at4allTransaction".concat(e.event.programId,"at4all"),children:"This Website"})})]}),(0,c.jsxs)("div",{className:"radiobutton-padding",children:[(0,c.jsx)(E.a,{checked:!l,label:"",onChange:e=>{d(!1)},inputId:"at4allTransaction".concat(e.event.programId)}),(0,c.jsx)("strong",{children:(0,c.jsx)("label",{htmlFor:"at4allTransaction".concat(e.event.programId),children:"Another website (i.e. Craigslist, ebay)"})})]})]})]})]})})},eU=e=>{let t,[a,n]=(0,I.useState)(!1),r=[],i=e=>{e&&eh.splice(eh.findIndex(t=>t.programId==e.programId),1,e)};return(0,c.jsxs)("div",{children:[(0,c.jsx)("ul",{children:eh.map(t=>(0,c.jsx)(eq,{event:t,didSubmit:a,onChange:i,myfocus:e.myfocus},t.programId))}),(0,c.jsx)(D.$,{type:"submit",onClick:()=>{n(!0),console.log("done. lets check",eh),e.events.forEach(e=>{s||e.benefitAreaId||(r.push("Please select a benefit area for the purpose of this activity."),t||(t="BenefitArea")),s||e.performanceOutcomeId||(r.push("Please select a performance outcome for this activity."),t||(t="Outcome")),s||e.satisfactionLevelId||(r.push("Please select a satisfaction level for this activity."),t||(t="SatisfactionLevel")),e.items.forEach(e=>{""===e.sellingPrice&&r.push("Selling price is required.  If given away, enter 0 for the price.")})}),r.length>0&&(console.log(t),""!=t&&document.querySelector("#".concat(t," input")).focus()),0==(ep=r).length&&(eI=!0,e.saveAndNext())},label:"Next"}),ep.length>0&&(0,c.jsx)("ul",{children:ep.map((e,t)=>(0,c.jsx)("li",{children:(0,c.jsx)(es,{children:e})},t))})]})},eB=e=>{let t,[a,l]=(0,I.useState)(0),d=(0,I.useContext)(U.R),m=(0,I.useContext)(B.O),[p,v]=(0,u._)(T.ALL_PROGRAMS_QUERY,{onCompleted:e=>{et(e)}}),[y,{called:j,loading:b,data:N,error:S}]=(0,u._)($.ITEM_SEARCH,{onCompleted:e=>{ea(e)}}),[E,P]=(0,h.n)(eN,{onError:e=>{eg.push({...e,location:"loan survey"})}}),[R,k]=(0,h.n)(eS,{onError:e=>{eg.push({...e,location:"short term loan"})}}),[q,M]=(0,h.n)(eE,{onError:e=>{eg.push({...e,location:"reuse survey"})}}),[W,Q]=(0,h.n)(eP,{onCompleted:e=>{Object.keys(e.data.data.ROOT_QUERY).forEach(t=>{t.match(/^allItems*/)&&delete e.data.data.ROOT_QUERY[t]})},onError:e=>{eg.push({...e,location:"reuse"})}}),[V]=(0,h.n)(eb,{onError:e=>{eg.push({...e,location:"add client"})}}),[H,{cartdata:J}]=(0,h.n)(A.UPDATE_CART_MUTATION),[G]=(0,h.n)(ex),[Z]=(0,h.n)(ey),[z]=(0,h.n)(ej),[K]=(0,u._)(C.ONE_PROGRAM_QUERY),X=(0,I.useContext)(Y.l),ee=()=>{if(!o)return void l(0);if(el.length>
10&&!ec){l(1),ev("LoanPurpose");return}if(eu.length>0&&!em){l(2),ev("SellingPrice");return}if(eh.length>0&&!eI){l(3),ev("consumerCost");return}n=!0,l(4)},et=e=>{console.log("geting program info",e),el.forEach(t=>{t.DefaultLoanPeriod=e.programs.find(e=>e.ProgramID==t.programId).DefaultLoanPeriod}),n=!1,ee()},ea=t=>{if(t){let e=[];t.allItems.Items.filter(e=>1==e.TransactionTypeID).forEach(t=>e.push({...t,loanPurposeId:void 0,loanDate:new Date,returnDate:void 0,emailReminderDays:5,error:""}));let a=[];e.forEach(e=>{a.includes(e.ProgramID)||a.push(e.ProgramID)});let n=[];a.forEach(a=>{n.push({programId:a,programName:t.allItems.Items.filter(e=>e.ProgramID==a)[0].ProgramName,items:e.filter(e=>e.ProgramID==a),saved:!1,DefaultLoanPeriod:void 0})}),n.length>0&&!v.called&&p({variables:{IDs:a,IncludeInactive:0}}),el=n;let r=t.allItems.Items.filter(e=>3==e.TransactionTypeID||4==e.TransactionTypeID);a=[],r.forEach(e=>{a.includes(e.ProgramID)||a.push(e.ProgramID)}),n=[],a.forEach(e=>{n.push({programId:e,programName:t.allItems.Items.filter(t=>t.ProgramID==e)[0].ProgramName,items:r.filter(t=>t.ProgramID==e),saved:!1,benefitAreaId:void 0,performanceOutcomeId:void 0,satisfactionLevelId:void 0,transactiondate:new Date})}),eu=n}t.allItems.Items.filter(e=>5==e.TransactionTypeID).length>0&&e.setToast({severity:"warn",detail:"Notice, demo items are not processed in the cart.",summary:"Demo Items ",logmessage:"Checkout Demo Warning",redirect:""}),n=!1,ee()},en=async()=>{if((null==ew?void 0:ew.ID)||(null==m?void 0:m.ID)){let e=[...null==ew?void 0:ew.CartItems];i&&(e=[...null==m?void 0:m.CartItems]),e=e.filter(e=>!ei.includes(e)),(null==m?void 0:m.ID)&&(null==m?void 0:m.setCart)?(e.length>0?m.setCart(e):(localStorage.removeItem("UIConsult"),m.setCart(!1)),H({variables:{UserID:o.ID,CartItems:e}})):await H({variables:{UserID:ew.ID,CartItems:e},refetchQueries:[{query:L.Z}]}),ei=[]}};(0,I.useEffect)(()=>{ei.length>0&&r&&en(),"true"==e.query.newcart&&(l(0),n=void 0,r=void 0,ei=[],o=void 0,eo=[],ec=!1,ed=[],em=!1,eh=[],eI=!1,eg=[],ef={loanPurposeId:void 0,loanDate:void 0,returnDate:void 0,emailReminderDays:void 0,comments:void 0,managerComments:void 0},f().push({pathname:"/cart/checkout",query:{}}))});let[ep,ev]=(0,I.useState)();if(!d)return(0,c.jsx)(es,{children:"Access Denied:  Please Log In"});i=!(s=!((null==(eD=d.Auth)?void 0:eD.isWebAdmin)||(null==(eA=d.Auth)?void 0:eA.programs.length)>0))&&(null==m?void 0:m.ID)>0;var eD,eA,eR,ew=d,eO=d.CartItems;if(i){if(eO=null==m?void 0:m.CartItems,!(null==m?void 0:m.CartItems)||(null==m||null==(eR=m.CartItems)?void 0:eR.length)==0&&!n)return(0,c.jsx)("div",{children:"There are no items in your cart."})}else if(!ew.CartItems||0==ew.CartItems.length&&!n)return(0,c.jsx)("div",{children:"There are no items in your cart."});if(!j&&eO&&eO.length>0&&y({variables:{itemIds:eO,showRestrictedItems:!0,sortOptions:"ProgramAsc",showAdminCheckouts:!0,take:1e4}}),j&&b)return(0,c.jsx)(F.A,{});let e_=async()=>{let e=[],t=[];el.forEach((a,n)=>{a.items.forEach(t=>{e.includes(t.loanPurposeId)||e.push(t.loanPurposeId)}),e.forEach(e=>{let n={...a,loanPurposeID:e};n.items=a.items.filter(t=>t.loanPurposeId==e),t.push(n)}),e=[]}),el=t,t.forEach(async(e,t)=>{let a=await E({variables:{Anecdote:"",BenefitAreaID:0,EmploymentDataID:e.employmentDataId||0,LoanPurposeID:e.loanPurposeID,OutcomeID:9,SatisfactionLevelID:1}});if(e.saved=!0,console.log("loansurveyid",a.data.createLoanSurvey),e.surveyId=a.data.createLoanSurvey,e.items.forEach(async n=>{if(ei.push(n.ItemID),""===n.accessError&&(""===n.Availability||""!=n.Availability&&n.waitingList)){let e=JSON.parse(localStorage.getItem("SHORT_TERM_LOANS_QUERY"))||{},t=JSON.parse(localStorage.getItem("LOAN_STATUS_COUNTS"))||{},r=await R({variables:{RequestedDate:new Date,LoanDate:s||n.waitingList?new Date("9999-12-31"):n.loanDate,ReturnDate:s||n.waitingList?new Date("9999-12-31"):n.returnDate,StatusId:n.waitingList?2:s?4:1,ItemId:n.ItemID,CheckInDate:new Date("9999-12-31"),AccountId:o.ID,EmailNoticeDate:s?new Date("9999-12-31"):new Date(n.returnDate.getFullYear(),n.returnDate.getMonth(),n.returnDate.getDate()-n.emailReminderDays),Comments:n.comments,LoanFacilitatorId:ew.ID,SurveyId:a.data.createLoanSurvey,VTVRDataId:0,ManagerNotes:n.managerComments},refetchQueries:[{query:w.SHORT_TERM_LOANS_QUERY,variables:e},{query:w.LOAN_STATUS_COUNTS,variables:t}
1]});n.loanId=r.data.createShortTermLoan}else el.splice(t,1);V({variables:{UserID:o.ID,ProgramID:e.programId}})}),s){let t=await K({variables:{id:e.items[0].ProgramID}});console.log("notifications"),G({variables:{Subject:"[".concat(X.Name," loan request received]"),Body:"Thank you for requesting a loan for ".concat(1==e.items.length?e.items[0].ItemName:"these items - "+e.items.map(e=>e.ItemName).join(","),".\n              <br /><br />\n              A request for approval for this loan has been sent to the manager responsible for the item(s) you are requesting.<br /><br />\n              ").concat(t.data.program.LoanRequestMessage?t.data.program.LoanRequestMessage:"","\n              <br /><br />\n              Thank you for requesting this loan from ").concat(e.items[0].ProgramName,".<br /><br />\n              To view your current loans, please view the 'My History' in the MY ACCOUNT link, or click on the following link to go directly to the 'My Account' page:\n              https://").concat(X.BaseUrl,"/user/userdetails?id=").concat(o.ID,"\n              "),ToPersonID:o.ID}}),Z({variables:{Subject:"[New Loan Requested]",Body:"".concat(o.First," ").concat(o.Last," has requested a loan for ").concat(1==e.items.length?e.items[0].ItemName:"these items - "+e.items.map(e=>e.ItemName).join(","),". <br /><br />\n             As the manager at ").concat(e.items[0].ProgramName,", it is your responsibility to approve the loan to complete the request.<br /><br />\n             This link will take you directly to the page to process the loan request.<br /><br />\n             https://").concat(X.BaseUrl,"/loan<br /><br />\n             You may also reach this loan request from the loan list page. <br /><br />\n             Thank you."),ProgramID:e.items[0].ProgramID}})}})},eF=async()=>{eu.forEach(async e=>{if(s&&1==e.programId)e.items.forEach(e=>{ei.push(e.ItemID)});else{let t=await q({variables:{benefitAreaId:s?0:e.benefitAreaId,performanceOutcomeId:s?16:e.performanceOutcomeId,satisfactionLevelId:s?1:e.satisfactionLevelId,at4allTransaction:e.at4allTransaction?2:1}});e.saved=!0,e.surveyId=t.data.createReuseSurvey.ID,e.items.forEach(async t=>{""===t.accessError&&(console.log(e),await W({variables:{itemId:t.ItemID,dateCompleted:e.transactiondate,closedStatusId:s?15:t.sellingPrice>0?2:6,sellingPrice:t.sellingPrice,surveyId:e.surveyId,recipientId:o.ID,facilitatorAccountId:ew.ID},refetchQueries:[{query:_.TRANSACTION_STATUS_COUNTS,variables:{programId:t.ProgramID}},{query:_.TRANSACTIONS_QUERY,variables:{programId:t.ProgramID}},{query:$.ITEM_SEARCH},{query:A.ONE_ITEM_QUERY,variables:{id:t.ItemID}}]}),V({variables:{UserID:o.ID,ProgramID:e.programId}}),s&&1!=e.programId&&(G({variables:{Subject:"[".concat(X.Name," item request received]"),Body:"Thank you for requesting a access to ".concat(1==e.items.length?e.items[0].ItemName:"these items - "+e.items.map(e=>e.ItemName).join(","),".\n                <br /><br />\n                A request for this item has been sent to the managers responsible for the item you are requesting.<br /><br />\n                Thank you for requesting this item from ").concat(e.items[0].ProgramName,".<br /><br />\n                "),ToPersonID:o.ID}}),Z({variables:{Subject:"[".concat(X.Name," Item Request]"),Body:"".concat(o.First," ").concat(o.Last," has requested ").concat(1==e.items.length?e.items[0].ItemName:"these items - "+e.items.map(e=>e.ItemName).join(","),". <br /><br />\n               As the manager at ").concat(e.items[0].ProgramName,", it is your responsibility to verify and complete the transaction.<br /><br />\n               This link will take you directly to the page to process the item request.<br /><br />\n              https://").concat(X.BaseUrl,"/item/transactionedit?surveyId=").concat(e.surveyId,"<br /><br />\n               You may also reach this loan request from the 'Reassignment, Refurbish, Repair' list page. <br /><br />\n               Thank you."),ProgramID:e.items[0].ProgramID}}))),ei.push(t.ItemID)})}})},eq=async()=>{eh.forEach(async e=>{let t=await q({variables:{benefitAreaId:s?0:e.benefitAreaId,performanceOutcomeId:s?16:e.performanceOutcomeId,satisfactionLevelId:s?1:e.satisfactionLevelId,at4allTransaction:2}});e.saved=!0,e.surveyId=t.data.createReuseSurvey.ID;let a=JSON.parse(localStorage.getItem("OPEN_ENDED_STATUS_VARIABLES"))||{},n=JSON.parse(localStorage.getItem("OPEN_ENDED_LOANS_VARIABLES"))||{};
1e.items.forEach(async r=>{await W({variables:{itemId:r.ItemID,dateCompleted:r.loanDate,closedStatusId:9,sellingPrice:parseFloat(r.consumerCost),surveyId:t.data.createReuseSurvey.ID,recipientId:o.ID,facilitatorAccountId:ew.ID,comments:r.comments,managerNotes:r.managerComments},refetchQueries:[{query:O.OPEN_ENDED_LOANS_QUERY,variables:n},{query:O.OPEN_ENDED_LOAN_STATUS_COUNT,variables:a}]}),V({variables:{UserID:o.ID,ProgramID:e.programId}}),ei.push(r.ItemID)})})};t||(t=[{name:"User",active:!0},{name:"Loan",active:el.length>0},{name:"Reuse",active:eu.length>0},{name:"OpenEndedLoan",active:eh.length>0},{name:"Confirmation",active:!1}]);let eB=r?{display:"none"}:{},eM=0==el.length||n?{display:"none"}:{},eY=0==eu.length||n?{display:"none"}:{},eW=0==eh.length||n?{display:"none"}:{},eQ=n?{}:{display:"none"};return(0,c.jsx)("div",{className:"p-col-12",children:(0,c.jsxs)("div",{className:"p-grid card p-card",children:[(0,c.jsx)("div",{className:"p-col-12",style:{marginTop:(null==m?void 0:m.ID)?"140px":"0px"},children:(0,c.jsx)(er,{children:"Checkout"})}),(0,c.jsx)("div",{className:"p-col-12"}),(0,c.jsxs)(x.n,{activeIndex:a,onTabChange:e=>{l(e.index)},children:[(0,c.jsxs)(x.g,{header:o?"Recipient Information: "+o.First+" "+o.Last:"Select Recipient",headerStyle:eB,children:[(0,c.jsx)(eT,{onUserSelect:()=>{ee()},curUser:ew,recipientId:e.query.recipientId,clientPrograms:!ew||(null==ew?void 0:ew.Auth.isWebAdmin)?[]:null==ew?void 0:ew.Auth.programs}),"\xa0",(s||i&&o)&&(0,c.jsx)(D.$,{type:"submit",onClick:()=>{ee(),console.log("user begin")},label:"Begin"})]}),(0,c.jsx)(x.g,{header:"Process Items for Short Term Loan",headerStyle:eM,contentStyle:eM,disabled:!o,children:o&&el.length>0&&(0,c.jsx)(e$,{saveAndNext:()=>{ee()},events:el,myfocus:ep,makeItemOpenEnded:e=>{let a=eh;a.find(t=>t.programId==e.ProgramID)?a.find(t=>t.programId==e.ProgramID).items.push(e):a.push({programId:e.ProgramID,programName:e.ProgramName,items:[e],saved:!1,benefitAreaId:void 0,performanceOutcomeId:void 0,satisfactionLevelId:void 0});let n=el.find(t=>t.programId==e.ProgramID).items.findIndex(t=>t.ItemID==e.ItemID);el.find(t=>t.programId==e.ProgramID).items.splice(n,1),0==el.find(t=>t.programId==e.ProgramID).items.length&&(n=el.findIndex(t=>t.programId==e.ProgramID),el.splice(n,1)),eh=a,t[3].active=!0,ee(),setTimeout(()=>{if(el.length>=0){let e=document.querySelector("[id^='LoanPurpose'] input");console.log(e),null==e||e.focus()}},750)}})}),(0,c.jsx)(x.g,{header:"Process Items for Sale/Free",headerStyle:eY,contentStyle:eY,disabled:!o,children:o&&eu.length>0&&(0,c.jsx)(ek,{saveAndNext:()=>{ee()},events:eu,myfocus:ep})}),(0,c.jsx)(x.g,{header:"Process Items for Open Ended Loan",headerStyle:eW,contentStyle:eW,disabled:!o,children:o&&eh.length>0&&(0,c.jsx)(eU,{saveAndNext:()=>{ee()},events:eh,myfocus:ep})}),(0,c.jsx)(x.g,{header:r?"Cart Processing Complete":"Verification",headerStyle:eQ,contentStyle:eQ,children:(0,c.jsxs)("div",{children:[!r&&"Almost Done!  Please review the following and click 'Process Cart' below to save all of the items.",(0,c.jsxs)("ul",{children:[n&&el.map((e,t)=>(0,c.jsxs)("li",{children:["Loan Items from ",e.programName,(0,c.jsx)("ul",{children:e.items.map(e=>(0,c.jsxs)("li",{children:[e.ItemName," ",e.accessError?e.accessError:"",e.waitingList&&" adding to waiting list.",""!=e.Availability&&!e.waitingList&&"NOT PROCESSING ITEM UNAVAILABLE"]},"loan".concat(e.ItemID)))}),e.surveyId&&e.items.filter(e=>!e.waitList).length>0&&!s&&P.called&&!P.loading&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("br",{}),(0,c.jsx)("div",{children:(0,c.jsx)("strong",{children:(0,c.jsx)(g(),{prefetch:!1,href:{pathname:"/loan/loandetails",query:{loanId:e.items[0].loanId}},children:"Loan Details"})})}),(0,c.jsx)(eL,{surveyId:e.surveyId,state:X.HostState})]})]},"loanProgram".concat(e.programId+Math.random()))),n&&eu.filter(e=>1!=e.programId).map((e,t)=>(0,c.jsxs)("li",{children:["Reuse Items from ",e.programName,(0,c.jsx)("ul",{children:e.items.map(e=>(0,c.jsxs)("li",{children:[e.ItemName,""!=e.accessError&&(0,c.jsx)("b",{children:" Ignored"})]},e.ItemID))})]},"reuse".concat(t))),n&&eu.filter(e=>1==e.programId).map((e,t)=>(0,c.jsxs)("li",{children:["Exchange Items ",s&&"(contact the owner to acquire the items)",(0,c.jsx)("ul",{children:e.items.map(e=>(0,c.jsxs)("li",{children:[e.ItemName," ",s&&(0,c.jsx)(eC,{ownerId:e.PersonID})]},e.ItemID))}),s&&(0,c.jsx)("div",{children:"*Note - This transaction is not complete as this site is not the owner.  Contact the owner to see about obtaining the item."})]},"ex".concat(t))),n&&eh.map((e,t)=>(0,c.jsxs)("li",{children:["Open Ended Loan Items from ",e.programName,(0,c.jsx)("ul",{children:e.items.map((e,t)=>(0,c.jsx)("li",{children:e.ItemName},"oei".concat(e.ItemID)))})]},"oe".concat(t)))]}),!r&&(0,c.jsx)(D.$,{type:"Submit",onClick:t=>{t.preventDefault(),eu.filter(e=>
11==e.programId).forEach(e=>{console.log("sendemail about",e,ew),z({variables:{Subject:"[".concat(X.Name," Exchange Followup]"),Body:"".concat(o.First," ").concat(o.Last," has shown interest in ").concat(1==e.items.length?e.items[0].ItemName:"these items - "+e.items.map(e=>"".concat(e.ItemName," (").concat(e.ItemID,")")).join(","),". <br /><br />\n         As the website administrator, you may be interested in following up with this person to see if an exchange took place.<br /><br />\n         ").concat(ew.Email," is their email address.\n         Thank you.")}})}),e_(),eF(),eq(),r=!0,e.setToast({severity:"success",detail:"All Cart Items Processed",summary:"Checkout Complete",logmessage:"".concat(JSON.stringify(ew)," checked out."),redirect:""})},label:"Process Cart",autoFocus:!r})]})})]})]})})};eB.getInitialProps=e=>({query:e.query});let eM=eB},10475:(e,t,a)=>{a.d(t,{A:()=>u});var n=a(28888),r=a(37876),s=a(14232),i=a(86191),o=a(31167),l=a(12912),c=a(71534);function d(){let e=(0,n._)(["\n    query LOAN_PURPOSES {\n        getLoanPurposes {\n            ID\n            Purpose\n        }\n    }\n"]);return d=function(){return e},e}let m=(0,i.J1)(d()),u=e=>
1{let[t,a]=(0,s.useState)(e.LoanPurposeID&&{ID:parseInt(e.LoanPurposeID),Purpose:"",__typeName:"LoanPurpose"});(0,s.useEffect)(()=>{e.LoanPurposeID&&a({ID:parseInt(e.LoanPurposeID),Purpose:"",__typeName:"LoanPurpose"}),e.LoanPurposeID&&e.UpdatePurpose(e.LoanPurposeID)},[e.LoanPurposeID]);let{loading:n,error:i,data:d}=(0,o.I)(m);return n?(0,r.jsx)(c.A,{}):i?(0,r.jsxs)(ErrorText,{children:["Error! ",i.message]}):(0,r.jsx)(l.m,{options:d.getLoanPurposes,id:e.inputId,inputId:e.inputId,optionLabel:"Purpose",ariaLabel:"Loan Purpose",value:t,dataKey:"ID",onChange:t=>{a(t.value),e.UpdatePurpose(t.value.ID)},autoFocus:e.autoFocus,placeholder:"Select the PRIMARY Purpose",style:e.style,required:e.required&&!1})}},33359:(e,t,a)=>{a.d(t,{A:()=>u});var n=a(28888),r=a(37876);a(14232);var s=a(86191),i=a(31167),o=a(71534),l=a(42523);function c(){let e=(0,n._)(["\n  query EMPLOYMENT_CATEGORY_QUERY {\n    employmentCategories {\n      EmploymentCategoryID\n      EmploymentCategoryName\n    }\n  }\n"]);return c=function(){return e},e}let{ErrorText:d}=a(63200),m=(0,s.J1)(c()),u=e=>{let{data:t,loading:a,error:n}=(0,i.I)(m);return a?(0,r.jsx)(o.A,{}):n?(0,r.jsx)(d,{children:n.message}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{children:"Will the loaned device(s) be used for employment purposes? "}),t.employmentCategories.map(t=>(0,r.jsxs)("div",{className:"radiobutton-padding",children:[(0,r.jsx)(l.a,{value:t.EmploymentCategoryID,checked:e.EmploymentCategoryId===t.EmploymentCategoryID,inputId:e.programId+"ec"+t.EmploymentCategoryID,name:"employment",onChange:a=>{var n;return n=t.EmploymentCategoryID,void e.onChange(n)}},t.EmploymentCategoryID),"\xa0",(0,r.jsx)("strong",{children:(0,r.jsx)("label",{htmlFor:e.programId+"ec"+t.EmploymentCategoryID,children:t.EmploymentCategoryName})})]},t.EmploymentCategoryID))]})}}}]);

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.