PageSourceSearch

https://www.keyzy.com/_next/static/chunks/pages/dashboard/financial-details/other-0a4ebd279c66102a.js

js keyzy.com collected 2026-10-08 07:31:42 UTC 15,884 bytes, 2 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9405],{14514:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/financial-details/other",function(){return t(35574)}])},42319:function(e,n,t){"use strict";t.d(n,{X:function(){return o}});var r=t(47752),o={EMPLOYMENT_CONTRACT:r.Z.dashboard.financialDetails.other.employer,SOLE_TRADER_OR_PARTNERSHIP:r.Z.dashboard.financialDetails.other.soleTrader,LIMITED_COMPANY:r.Z.dashboard.financialDetails.other.ltd,BENEFITS:r.Z.dashboard.financialDetails.other.benefits,PENSION:r.Z.dashboard.financialDetails.other.pension,OTHER:r.Z.dashboard.financialDetails.other.other}},35574:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return U}});var r=t(85893),o=t(67294),a=t(9008),i=t.n(a),s=t(63074),c=t(89708),l=t(34051),u=t.n(l),d=t(11163),f=t(87536),p=t(70295),h=t(21430),m=t(4571),v=t(47752),y=t(1061),x=t(88767),b=t(62738),g=t(68774),I=t(71663),_=t(34680),O=t(42319),j=t(75755),N=t(95496),w=t(9188),S=t(16477);function E(e,n,t,r,o,a,i){try{var s=e[a](i),c=s.value}catch(l){return void t(l)}s.done?n(c):Promise.resolve(c).then(r,o)}function T(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function k(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){T(e,n,t[n])}))}return e}var P=function(){var e,n,t=(0,d.useRouter)(),a=(0,b.G)(),i=a.applicantId,s=a.applicationId,c=(0,o.useState)(!1),l=c[0],T=c[1],P=(0,I.Q)(),D=P.createNavigationData,M=P.setFormIsDirty,R=P.showModal,C=P.confirmModalData,Z=P.setModalActionData,A=(0,x.useQueryClient)();A.setDefaultOptions({queries:{cacheTime:1/0}});var L=A.getQueryData(["selectedIncomes",i]),Y=(0,x.useMutation)(g.MQ,{onSuccess:function(e,n){var r,o;(null===n||void 0===n||null===(r=n.data)||void 0===r||null===(o=r.preferences)||void 0===o?void 0:o.hasOtherIncomes)?t.push({pathname:null===O.X||void 0===O.X?void 0:O.X[null===W||void 0===W?void 0:W[0]],query:{applicantId:i,sourceType:W}}):(null===B||void 0===B||B.incomes.forEach(function(){var e,n=(e=u().mark((function e(n){return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.is_primary||"SUMMARY"===n.source_type){e.next=3;break}return e.next=3,(0,g.Th)({applicationId:s,applicantId:i,data:{income:{id:n.id}}});case 3:case"end":return e.stop()}}),e)})),function(){var n=this,t=arguments;return new Promise((function(r,o){var a=e.apply(n,t);function i(e){E(a,r,o,i,s,"next",e)}function s(e){E(a,r,o,i,s,"throw",e)}i(void 0)}))});return function(e){return n.apply(this,arguments)}}()),A.removeQueries(["selectedIncomes",i]),t.push({pathname:v.Z.dashboard.root,hash:"application-progress"}))}}),X=Y.mutate,B=(0,x.useQuery)(["applicant",i],(function(){return(0,g.h$)(String(s),String(i))}),{enabled:!l&&"string"===typeof s&&"string"===typeof i,onSuccess:function(e){var n=e;if(Object.keys(e).length>0&&D((0,_.C$)({applicant:e,selectedOptions:e.has_other_incomes?W:void 0,navigationVariant:"financialDetails"})),!l){var t=n.incomes.filter((function(e){return!e.is_primary}));if(t){var r=[];t.forEach((function(e){return"SUMMARY"!==e.source_type&&r.push(e.source_type)})),t&&V({hasOtherIncomes:null===(null===n||void 0===n?void 0:n.has_other_incomes)?void 0:(null===n||void 0===n?void 0:n.has_other_incomes)?"1":"0",otherSourceType:L||r})}T(!0)}}}).data,F=(0,f.cI)({resolver:(0,N.X)(j.Xd),shouldUnregister:!0,defaultValues:{otherSourceType:L}}),Q=F.handleSubmit,H=F.register,q=F.watch,V=F.reset,G=F.formState,U=G.errors,$=G.isDirty;(0,o.useEffect)((function(){M&&M($)}),[$]);var J=[{name:"cancelButton",title:"Cancel",link:"/",variant:"white",showIcon:!1,onClick:function(){return Z&&Z({})}},{name:"ok",title:"Ok",link:"/",variant:"orange",showIcon:!0,onClick:function(){t.push(C),Z&&Z({})}}],W=q("otherSourceType"),z=q("hasOtherIncomes");return(0,o.useEffect)((function(){B&&W&&(D((0,_.C$)({applicant:k({},B),selectedOptions:"1"===z?W:void 0,navigationVariant:"financialDetails"})),"0"===z?A.removeQueries("selectedIncomes"):A.setQueryData(["selectedIncomes",B.id],W))}),[B,W,z,A]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(S.Z,{name:"confirm",show:!!R,title:"Are you sure?",text:"You\u2019ve made changes to this form. If you go back they won\u2019t be saved. But don\u2019t worry, you can still come back here and enter them again.",actionButtons:J}),(0,r.jsx)("form",{onSubmit:Q((function(e){var n=e.hasOtherIncomes;X({applicationId:s,applicantId:i,data:{preferences:{hasOtherIncomes:"1"===n}}})})),autoComplete:"off",children:(0,r.jsxs)("div",{className:"flex flex-col max-w-2xl mx-auto mt-16 lg:mt-0",children:[(0,r.jsx)(w.Z,{title:"".concat(null===B||void 0===B?void 0:B.first_name," ").concat(null===B||void 0===B?void 0:B.last_name," financial details"),subtitle:"Other sources of income",image:"/icons/income.svg"}),(0,r.jsxs)("div",{className:"form-container",children:[(0,r.jsx)("p",{className:"pr-4 text-lg font-bold",children:"Do you have other sources of income?"}),(0,r.jsx)(y.Z,k({noPadding:!0,options:[{value:"1",caption:"Yes"},{value:"0",caption:"No"}]},H("hasOtherIncomes",{required:!0}),{error:null===U||void 0===U||null===(e=U.hasOtherIncomes)||void 0===e?void 0:e.message,noMargin:null===z||"0"===z})),(0,r.jsxs)("div",{className:"".concat("1"===z?"inline-block":"isHidden"),children:[(0,r.jsx)("div",{className:"text-lg font-bold text-grey-800",children:"Other sources of income"}),(0,r.jsx)("div",{className:"mb-4 text-sm text-grey-500",children:"You can select multiple options"}),(0,r.jsx)("div",{className:"sourceType",children:(0,r.jsx)(y.Z,k({},H("otherSourceType"),{noPadding:!0,isMultiple:!0,options:[{value:"EMPLOYMENT_CONTRACT",caption:"Income from an employer"},{value:"SOLE_TRADER_OR_PARTNERSHIP",caption:"Sole trader / Partnerships"},{value:"LIMITED_COMPANY",caption:"Limited company"}
1,{value:"BENEFITS",caption:"Benefits"},{value:"PENSION",caption:"Pension"},{value:"OTHER",caption:"Other"}],error:null===(n=null===U||void 0===U?void 0:U.otherSourceType)||void 0===n?void 0:n.message,className:"basis-[calc(100%)]",noMargin:!0}))})]})]}),(0,r.jsxs)("div",{className:"form-button-container",children:[(0,r.jsx)(p.Z,{prefix:(0,r.jsx)(m.Z,{className:"mr-3"}),onClick:function(){return Z&&Z({pathname:v.Z.dashboard.financialDetails.primary})},type:"button",variant:"outline",children:"Go back"}),(0,r.jsx)(p.Z,{type:"submit",suffix:(0,r.jsx)(h.Z,{className:"ml-3 "}),children:"Next"})]})]})})]})},D=P,M=t(91050),R=t(56229),C=t(35982),Z=t(10546),A=t(41352);function L(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Y(e,n,t,r,o,a,i){try{var s=e[a](i),c=s.value}catch(l){return void t(l)}s.done?n(c):Promise.resolve(c).then(r,o)}function X(e){return function(){var n=this,t=arguments;return new Promise((function(r,o){var a=e.apply(n,t);function i(e){Y(a,r,o,i,s,"next",e)}function s(e){Y(a,r,o,i,s,"throw",e)}i(void 0)}))}}function B(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function F(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){B(e,n,t[n])}))}return e}function Q(e){return function(e){if(Array.isArray(e))return L(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"===typeof e)return L(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return L(e,n)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var H=function(){var e,n,t=(0,d.useRouter)(),a=(0,M.a)().user,i=(0,R.P)().rentalApplicants,s=t.query.applicantId,c=null===a||void 0===a?void 0:a.application_id,l=null===i||void 0===i?void 0:i.find((function(e){return e.id===s})),x=(0,o.useState)(!1),b=x[0],_=x[1],E=(0,o.useState)([]),T=E[0],k=E[1],P=(0,I.Q)(),D=P.createNavigationData,L=P.setFormIsDirty,Y=P.showModal,B=P.confirmModalData,H=P.setModalActionData,q=(0,o.useRef)(!0);(0,o.useEffect)((function(){return q.current=!0,function(){q.current=!1}}),[]);var V=(0,f.cI)({resolver:(0,N.X)(j.hs,{abortEarly:!1})}),G=V.handleSubmit,U=V.register,$=V.watch,J=V.setValue,W=V.formState,z=W.errors,K=W.isDirty;(0,o.useEffect)((function(){if(c&&s&&l){var e=!1,n=function(){var n=X(u().mark((function n(){var t,r,o;return u().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,(0,g.kW)(c,s);case 3:if(t=n.sent,!e&&q.current){n.next=6;break}return n.abrupt("return");case 6:D((0,C.p)(F({},l,{incomes:t}))),o=null!==(r=null===t||void 0===t?void 0:t.filter((function(e){return!e.is_primary})))&&void 0!==r?r:[],k(o),o.length>0?(J("hasOtherIncomes","1"),J("otherSourceType",o.map((function(e){return e.source_type})))):!1===l.has_other_source_of_income&&J("hasOtherIncomes","0"),n.next=16;break;case 13:n.prev=13,n.t0=n.catch(0),console.error("Failed to fetch income:",n.t0);case 16:case"end":return n.stop()}}),n,null,[[0,13]])})));return function(){return n.apply(this,arguments)}}();return n(),function(){e=!0}}}),[c,s,null===l||void 0===l?void 0:l.id]);var ee=(0,o.useState)(!1),ne=ee[0],te=ee[1];(0,o.useEffect)((function(){null===L||void 0===L||L(K)}),[K,L]);var re=[{name:"cancelButton",title:"Cancel",link:"/",variant:"white",showIcon:!1,onClick:function(){return null===H||void 0===H?void 0:H({})}},{name:"ok",title:"Ok",link:"/",variant:"orange",showIcon:!0,onClick:function(){t.push(B),null===H||void 0===H||H({})}}],oe=Z.w.reduce((function(e,n,t){return e[n]=t,e}),{}),ae=$("hasOtherIncomes"),ie=function(){var e=X(u().mark((function e(n){var r,o,a,i,d,f,p,h,m,y,x,b;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.hasOtherIncomes,o=n.otherSourceType,c&&s&&l){e.next=3;break}return e.abrupt("return");case 3:if(te(!1),_(!0),e.prev=5,"0"!==r){e.next=14;break}return e.next=9,(0,g.JR)({applicantId:s,applicationId:c,details:{has_other_source_of_income:!1}});case 9:return e.next=11,Promise.all(T.map((function(e){return(0,g.RG)({applicationId:c,applicantId:s,incomeId:e.id})})));case 11:t.push({pathname:v.Z.dashboard.root}),e.next=34;break;case 14:return d=T.map((function(e){return e.source_type})),p=(f=null!==o&&void 0!==o?o:[]).filter((function(e){return!d.includes(e)})),h=d.filter((function(e){return!f.includes(e)})),e.next=21,(0,g.JR)({applicantId:s,applicationId:c,details:{has_other_source_of_income:!0}});case 21:return e.next=23,Promise.all(Q(p.map((function(e){return(0,g.Lo)({applicationId:c,applicantId:s,data:{source_type:e,is_primary:!1}})}))).concat(Q(T.filter((function(e){return h.includes(e.source_type)})).map((function(e){return(0,g.RG)({applicationId:c,applicantId:s,incomeId:e.id})})))));case 23:return e.next=25,(0,g.kW)(c,s);case 25:if(m=e.sent,D((0,C.p)(F({},l,{incomes:m}))),0!==(x=null!==(y=null===m||void 0===m?void 0:m.filter((function(e){return!e.is_primary})))&&void 0!==y?y:[]).length){e.next=32;break}return t.push({pathname:v.Z.dashboard.root}),e.abrupt("return");case 32:b=x.sort((function(e,n){var t,r;return(null!==(t=oe[e.source_type])&&void 0!==t?t:1/0)-(null!==(r=oe[n.source_type])&&void 0!==r?r:1/0)})),t.push({pathname:null===O.X||void 0===O.X?void 0:O.X[null===(a=b[0])||void 0===a?void 0:a.source_type],query:{applicantId:s,sourceType:null===(i=b[0])||void 0===i?void 0:i.source_type}});case 34:e.next=40;break;case 36:e.prev=36,e.t0=e.catch(5),console.error("Submit failed:",e.t0),te(!0);case 40:return e.prev=40,_(!1),e.finish(40);case 43:case"end":return e.stop()}}
1),e,null,[[5,36,40,43]])})));return function(n){return e.apply(this,arguments)}}();return(0,o.useEffect)((function(){"0"===ae&&J("otherSourceType",[],{shouldValidate:!1,shouldDirty:!1})}),[ae]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(S.Z,{name:"confirm",show:!!Y,title:"Are you sure?",text:"You've made changes to this form. If you go back they won't be saved. But don't worry, you can still come back here and enter them again.",actionButtons:re}),(0,r.jsx)("form",{onSubmit:G(ie),autoComplete:"off",children:(0,r.jsxs)("div",{className:"flex flex-col max-w-2xl mx-auto mt-16 lg:mt-0",children:[(0,r.jsx)(w.Z,{title:"".concat(null===l||void 0===l?void 0:l.first_name," ").concat(null===l||void 0===l?void 0:l.last_name," financial details"),subtitle:"Other sources of income",image:"/icons/income.svg"}),(0,r.jsxs)("div",{className:"form-container sourceType",children:[(0,r.jsx)("p",{className:"pr-4 text-lg font-bold",children:"Do you have other sources of income?"}),(0,r.jsx)(y.Z,F({noPadding:!0,options:[{value:"1",caption:"Yes"},{value:"0",caption:"No"}]},U("hasOtherIncomes",{required:!0}),{error:null===z||void 0===z||null===(e=z.hasOtherIncomes)||void 0===e?void 0:e.message,noMargin:null===ae||"0"===ae,labelClassName:"rounded-full"})),"1"===ae&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-lg font-bold text-grey-800",children:"Other sources of income"}),(0,r.jsx)("div",{className:"mb-4 text-sm text-grey-500",children:"You can select multiple options"}),(0,r.jsx)("div",{className:"sourceType",children:(0,r.jsx)(y.Z,F({},U("otherSourceType"),{noPadding:!0,isMultiple:!0,options:[{value:"EMPLOYMENT_CONTRACT",caption:"Income from an employer"},{value:"SOLE_TRADER_OR_PARTNERSHIP",caption:"Sole trader / Partnerships"},{value:"LIMITED_COMPANY",caption:"Limited company"},{value:"BENEFITS",caption:"Benefits"},{value:"PENSION",caption:"Pension"},{value:"OTHER",caption:"Other"}],error:null===(n=null===z||void 0===z?void 0:z.otherSourceType)||void 0===n?void 0:n.message,className:"basis-[calc(100%)]",noMargin:!0,hasCheckboxIcon:!0,labelClassName:"rounded-full"}))})]})]}),(0,r.jsxs)("div",{className:"form-button-container",children:[(0,r.jsx)(p.Z,{prefix:(0,r.jsx)(m.Z,{className:"mr-3"}),onClick:function(){return null===H||void 0===H?void 0:H({pathname:v.Z.dashboard.financialDetails.primary})},type:"button",variant:"outline",className:"rounded-full",children:"Go back"}),(0,r.jsxs)("div",{className:"flex flex-col w-full sm:w-0",children:[(0,r.jsx)("div",{className:"flex justify-end ",children:(0,r.jsx)(p.Z,{type:"submit",suffix:(0,r.jsx)(h.Z,{className:"ml-3 "}),className:"rounded-full",isLoading:b,children:"Next"})}),ne&&(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("p",{className:"text-error-value",children:"Something went wrong, please try again."}),(0,r.jsx)(A.Z,{className:"ml-2 text-error-value",onClick:function(){te(!1)}})]})]})]})]})})]})},q=H,V=t(74085),G=function(){var e=(0,M.a)().user,n=(0,R.P)({redirectOnUnauth:!1}).rentalApplication,t=(0,d.useRouter)();return(0,o.useEffect)((function(){"rental"!==(null===e||void 0===e?void 0:e.application_type)||(0,V.X)(n)||t.push("/dashboard")}),[n,t,e]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i(),{children:(0,r.jsx)("title",{children:"Financial details"})}),(0,r.jsx)("div",{children:"rental"===(null===e||void 0===e?void 0:e.application_type)?(0,r.jsx)(q,{}):(0,r.jsx)(D,{})})]})};G.getLayout=function(e){return(0,r.jsx)(c.L,{navigationVariant:"personalDetails",withConfirmModal:!0,children:(0,r.jsx)(s.Z,{children:e})})};var U=G}},function(e){e.O(0,[4885,3061,7851,7536,939,3978,4298,7630,8318,4325,9774,2888,179],(function(){return n=14514,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
2//# sourceMappingURL=other-0a4ebd279c66102a.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.