1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6642],{8113:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>q,getStatusIcontext:()=>L});var a=n(37876),l=n(10469),s=n(76222),i=n(45338),r=n(15280),d=n(71826),o=n(30604),c=n(28077),u=n(8071),x=n(38164),m=n(56073),v=n(55185),p=n(18751),g=n(15039),h=n.n(g),f=n(10042),y=n(76571),j=n(89099),_=n(14232),N=n(54141),b=n(18935),w=n(36768),k=n(32847),A=n(77888),S=n(98303);let D=e=>{let{items:t,modalTitle:n,onClose:s}=e,[i,r]=(0,_.useState)("main"),d=t[0],o=()=>{r("main"),null==s||s()};return(0,_.useEffect)(()=>{var e,t;if(null==d||null==(e=d.data)?void 0:e.created_at){let e=new Date,n=new Date(null==d||null==(t=d.data)?void 0:t.created_at);if(3>Math.ceil((e.getTime()-n.getTime())/864e5))return void r("error")}},[null==d?void 0:d.data.created_at]),(0,a.jsx)(k.B,{onClose:o,className:"text-center",children:(0,a.jsxs)("div",{className:"space-y-7",children:[(0,a.jsx)("div",{className:"w-max mx-auto",children:"error"===i?(0,a.jsx)("img",{src:S.A.src,alt:"",className:"align-center w-14 h-14 mx-auto"}):l.O.lock("#EA157F","35")}),(0,a.jsx)("div",{className:"w-[23.75rem] mx-auto h-10 text-center text-black text-xl font-bold ",children:"error"===i?"We are sorry...":n}),(0,a.jsx)("p",{className:"text-[#7B7F99] text-[12px] font-semibold flex flex-col gap-3",children:"error"===i?(0,a.jsxs)("span",{children:["This Fixed Savings cannot be broken because it was created less than ",(0,a.jsx)("span",{className:"text-text-primary",children:"3 days"})," ago."]}):(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsxs)("span",{children:["Breaking your savings early will incur a"," ",(0,a.jsx)("span",{className:"text-text-primary",children:"25% penalty charges "})," ","on the interest accrued."]}),(0,a.jsx)("span",{children:"Are you sure you want to break this savings plan?"})]})}),(0,a.jsxs)("div",{className:"text-center text-slate-500 text-sm font-medium font-['Plus Jakarta Sans'] leading-[1.3rem] ",children:[(0,a.jsx)(A.A,{Text:"error"===i?"Dismiss":"Yes, Break Savings",onclickAction:"error"===i?o:()=>{let e=new Date,t=new Date(null==d?void 0:d.data.created_at);if(3>Math.ceil((e.getTime()-t.getTime())/864e5))return void r("error");null==d||d.handleBreakSavings()},variant:"black"}),"error"!==i&&(0,a.jsx)(A.A,{Text:"No, cancel",onclickAction:o,variant:"white",className:"mt-2"})]})]})})};var F=n(35971),T=n(57370),B=n(97874),C=n(55051),P=n(74695),E=n(55182),I=n(47007);let M=e=>{var t,n;let{previewData:l,setCurrentView:s}=e,{breakSavings:i}=(0,x.bF)(),[r,d]=(0,_.useState)(),[o,c]=(0,_.useState)([]),u=(0,P.d4)(C.$0),{showModal:v}=(0,w.h)(),{isLoading:p,data:g,refresh:h,error:f}=(0,B.A)({phoneNumber:(null==u?void 0:u.mobile)||(null==u?void 0:u.phone),sphinx:!0});return(0,_.useEffect)(()=>{(null==o?void 0:o.length)===4&&(()=>{let e={savingsId:null==l?void 0:l.id,keyboard:null==g?void 0:g.id,pin_indexes:o.join(";")};i.mutateAsync(e).then(e=>{var t;I.AE.trackSavingsBroken({product_name:"Saving",category:"".concat(null==l?void 0:l.savingsType," savings"),company_name:"KongaPay",amount:(null==l||null==(t=l.config)?void 0:t.deposited_amount)||0,platform:"web",created_at:new Date}),s("success")}).catch(e=>{h(),v([],T.A,()=>{},"Breaking Savings failed",e),I.AE.trackKSaveBreakageFailed({product_name:"Saving",category:"".concat(null==l?void 0:l.savingsType," savings"),company_name:"KongaPay",amount:(null==l?void 0:l.target_amount)||0,payment_mode:"wallet",platform:"web",created_at:new Date})})})()},[o]),(0,_.useEffect)(()=>{c([])},[p]),(0,a.jsx)(E.A,{isLoading:p,isLoadingSave:p||i.isPending,amount:(0,m.mn)(Number(null==l||null==(t=l.config)?void 0:t.deposited_amount)/100),text1:null==l?void 0:l.name,text2:"Break",totalAmount:Number(null==l||null==(n=l.config)?void 0:n.deposited_amount)/100||0,selectedIndexes:o,setPin:d,keypadData:g,setSelectedIndexes:c,error:f,hideSummary:!0})};var G=n(27048);let q=()=>{var e,t,n,g,k,S,T,B,C,P,E,I,q,W,K,O,R,z,Y,Z,V,X,H,J;let[$,Q]=(0,_.useState)(0),[U,ee]=(0,_.useState)("overview"),et=(0,j.useRouter)(),{showModal:en,hideModal:ea}=(0,w.h)(),{data:el,isLoading:es}=(0,x.xx)(Number(null==et||null==(e=et.query)?void 0:e.id)),{data:ei,isLoading:er}=(0,x.tZ)({savingsId:Number(null==et||null==(t=et.query)?void 0:t.id),offset:30*$,status:null==el?void 0:el.status}),ed=()=>{ee("confirmBreak"),ea()};return(0,a.jsx)(r.e,{children:(0,a.jsx)(i.G,{className:" !pt-0 ",children:(0,a.jsxs)("div",{className:"max-w-[36.25rem] mx-auto relative mt-6",children:[(0,a.jsxs)("div",{className:"mb-4 flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>
1"overview"===U?et.push("/savings"):ee("overview"),className:"flex items-center border-2 p-2 rounded-full",children:(0,a.jsx)(v.A,{})}),(0,a.jsx)("p",{className:"text-xl font-semibold",children:"Savings Details"})]}),es?(0,a.jsx)(d.A,{}):(0,a.jsxs)(a.Fragment,{children:["success"===U&&(0,a.jsx)(G.z,{transactionType:"savings",activeOrderDetails:{identifier:null==el?void 0:el.name,beneficiaryName:null==el?void 0:el.name,amount:(null==el||null==(n=el.config)?void 0:n.deposited_amount)/100,paymentType:"savings",providerImage:null===N.A||void 0===N.A?void 0:N.A.src},orderResPonse:{transaction_reference:null==el?void 0:el.name},title:"Savings Plan Created!",subText:"".concat(null==el?void 0:el.name," created successfully"),hideShareReceipt:!0}),"confirmBreak"===U&&(0,a.jsx)(M,{previewData:el,setCurrentView:ee}),"details"===U&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(F.A,{saving_name:null==el?void 0:el.name,icon:(null==el||null==(g=el.saving_type)?void 0:g.includes("Fixed"))?(0,a.jsx)(s.A.lockCheck,{}):(0,a.jsx)(s.A.targeted,{}),savingsType:(null==el||null==(k=el.saving_type)?void 0:k.includes("Fixed"))?"fixed":"targeted",saving_type_id:null==el?void 0:el.saving_type_id,target_amount:(null==el||null==(S=el.config)?void 0:S.deposited_amount)/100,created_at:null==el?void 0:el.created_at,mature_date:null==el||null==(T=el.config)?void 0:T.mature_date,interestRate:"".concat(null==el||null==(B=el.config)?void 0:B.interest_rate,"% p.a"),expectedAmount:(null==el||null==(C=el.config)?void 0:C.expected_amount)/100,setCurrentView:ee}),(0,a.jsx)(A.A,{Text:"Dismiss",onclickAction:()=>ee("overview"),variant:"black",className:"mt-6"})]}),"overview"===U&&(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(null==el?void 0:el.status)!=="locked"&&(0,a.jsxs)("p",{className:"text-xs font-medium text-[#202020] flex items-center gap-1 bg-[#FEF1F7] rounded-lg px-2 py-1 text-left",children:[(0,a.jsx)(p.A,{weight:"fill",size:16,color:"#EA157F"})," ",(0,a.jsx)("span",{children:"Your savings have been successfully credited to your Account."})]}),(0,a.jsx)(o.A,{id:null==et||null==(P=et.query)?void 0:P.id,title:null==el?void 0:el.name,status:(null==el?void 0:el.status)==="locked"?"active":null==el?void 0:el.status,amount:(null==el||null==(E=el.config)?void 0:E.deposited_amount)/100,interest:(null==el||null==(I=el.config)?void 0:I.accrued_interest)/100,startDate:null==el?void 0:el.created_at,endDate:(null==el||null==(q=el.config)?void 0:q.mature_date)?(0,f.GP)((0,y.qg)(null==el||null==(W=el.config)?void 0:W.mature_date,"dd-MM-yyyy",new Date),"yyyy-MM-dd"):"",breakDate:(null==el?void 0:el.status)==="broken"&&(null==ei||null==(K=ei.savings_details)?void 0:K.updated_at),noLink:!0,showSubInterest:!0})]}),(null==el?void 0:el.status)==="broken"&&(0,a.jsx)(c.Zp,{children:(0,a.jsxs)(c.Wu,{className:"p-3 space-y-4",children:[(0,a.jsx)(F.p,{label:{text:"Interest Rate",content:(0,a.jsx)("span",{children:(null==ei||null==(O=ei.savings_details)?void 0:O.updated_at)&&(0,f.GP)(new Date(null==ei||null==(R=ei.savings_details)?void 0:R.updated_at),"dd/MM/yyyy")})}}),(0,a.jsx)(F.p,{label:{text:"Interest earned",content:(0,a.jsxs)("span",{children:["NGN"," ",(0,m.ek)((null==el||null==(z=el.config)?void 0:z.accrued_interest)/100)]})}}),(0,a.jsx)(F.p,{label:{text:"Amount Withdrawn",subText:"Principal Amount plus interest earned",showDismiss:!0,content:(0,a.jsxs)("span",{className:"text-text-success",children:["NGN"," ",(null==el||null==(Y=el.config)?void 0:Y.deposited_amount)?(0,m.ek)((Number(null==el||null==(Z=el.config)?void 0:Z.deposited_amount)+Number(null==el||null==(V=el.config)?void 0:V.accrued_interest))/100):0]})}})]})}),(0,a.jsxs)("div",{className:h()("flex ",(null==el||null==(H=el.saving_type)||null==(X=H.toLowerCase())?void 0:X.includes("fixed"))?" gap-1.5":"grid-cols-3"),children:[(0,a.jsx)("button",{onClick:()=>{ee("details")},className:"flex justify-center flex-1 bg-bg-primary-alt group rounded-lg px-2 py-3",children:(0,a.jsxs)("span",{className:"flex flex-col justify-center gap-2 font-bold items-center group-hover:opacity-60 cursor-pointer",children:[l.O.details(),(0,a.jsx)("span",{children:"Details"})]})}),(null==el?void 0:el.status)==="locked"&&(0,a.jsx)("button",{onClick:(null==el?void 0:el.status)==="locked"?()=>{var e;en([{savingsId:null==et||null==(e=et.query)?void 0:e.id,data:el,handleBreakSavings:ed}],D,()=>{},"Break Savings")}:()=>{},className:"flex justify-center flex-1 bg-bg-primary-alt group rounded-lg px-2 py-3",children:(0,a.jsx)("span",{className:"flex flex-col w-max ustify-center gap-2 font-bold items-center group-hover:opacity-60 cursor-pointer",children:(0,a.jsxs)(a.Fragment,{children:[s.A.lockKey(),(0,a.jsx)("span",{children:"Break"})]})})})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("h2",{className:"text-6xl font-medium",children:"Transaction History"}),(0,a.jsx)(c.Zp,{onClick:()=>{},children:(0,a.jsx)(c.Wu,{className:"p-3 space-y-8",children:er?(0,a.jsx)(d.A,{}):null==ei||null==(J=ei.transactions)?void 0:J.map(e=>{var t;let n="credit"==e.transaction_type||"interest"==e.transaction_type||"interest_earned"==e.transaction_type;return(0,m.qY)(null==e?void 0:e.status),(0,a.jsxs)("div",{className:"flex items-center w-full gap-2",children:[(0,a.jsx)("div",{className:"border rounded-full bg-white overflow-hidden w-10 h-10 flex-shrink-0",children:(0,a.jsx)("img",{src:null===N.A||void 0===N.A?void 0:N.A.src,alt:"KongaPay",className:"w-full h-auto object-cover"})}),(0,a.jsxs)("div",{className:"flex flex-1 items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-xs font-semibold",children:null!=(t=L(e.transaction_type))?t:e.transaction_type}),(0,a.jsx)("small",{className:"text-6xl text-[#7B7F99]",children:(0,f.GP)(new Date(null==e?void 0:e.created_at),"dd/MM/yyyy, hh:mm a")})]}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)(u.g,{amount:Number(n?((null==e?void 0:e.amount)/100).toFixed(2):-((null==e?void 0:e.amount)/100).toFixed(2)),size:"xs",show:!0}
1),(0,a.jsx)(b.A,{text:null==e?void 0:e.status,radius:"rounded-full",variant:"Green",style:"light"})]})]})]},null==e?void 0:e.id)})})})]})]})]})]})})})},L=e=>{switch(e.toLowerCase()){case"credit":return"Savings Credited";case"debit":return"Withdrawal";case"tax":return"Withholding tax";case"fee":return"Breaking Fee";case"interest_earned":return"Accrued Interest";case"interest_payment":case"interest":return"Interest";default:return null}}},29884:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/savings-new/[id]",function(){return n(8113)}])}},e=>{e.O(0,[2366,4587,7248,7235,9970,7796,1842,618,5053,686,7301,469,3704,9072,1129,4681,5280,5023,189,7681,604,636,6593,8792],()=>e(e.s=29884)),_N_E=e.O()}]);
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.