-
Notifications
You must be signed in to change notification settings - Fork 0
/
component---src-pages-console-payment-transactions-index-js-3401d5402034c420f155.js
1 lines (1 loc) · 13.9 KB
/
component---src-pages-console-payment-transactions-index-js-3401d5402034c420f155.js
1
"use strict";(self.webpackChunkkaagzi=self.webpackChunkkaagzi||[]).push([[490],{8244:function(e,t,a){a.d(t,{A:function(){return m}});var n=a(6540),r=a(7840),l="loginHero-module--infoC--c3fac",c="loginHero-module--loginHeroBanner--57e3a",i="loginHero-module--svgC--3b6fe",o="loginHero-module--svgL--0aa81",s="loginHero-module--svgR--1165a";function m(e){return n.createElement("div",Object.assign({className:c},e),n.createElement("div",{className:i},n.createElement("svg",{className:o,version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1120 880"},n.createElement("use",{href:"#svgGrass",x:"0",y:"0",width:"824",height:"824"}),n.createElement("use",{href:"#svgLeaf",x:"-120",y:"80",width:"232",height:"580"}),n.createElement("use",{href:"#svgLeaf",x:"136",y:"368",width:"144",height:"360",opacity:"0.5"})),n.createElement("svg",{className:s,version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1120 880"},n.createElement("use",{href:"#svgHeroMainBlob",x:"80",y:"-52",width:"1200",height:"960",opacity:"0.5"}),n.createElement("use",{href:"#svgHeroMainBlob",x:"200",y:"16",width:"1120",height:"800"}),n.createElement("clipPath",{id:"svgHeroMainBlobPathClip"},n.createElement("use",{href:"#svgHeroMainBlobPath",x:"200",y:"16"}),n.createElement("use",{href:"#svgHeroMainBlobPath",x:"80",y:"8"})),n.createElement("g",{clipPath:"url(#svgHeroMainBlobPathClip)"},n.createElement("use",{href:"#svgLeaf",x:"900",y:"440",width:"130",height:"325"}),n.createElement("use",{href:"#svgLeaf",x:"1050",y:"220",width:"160",height:"400"}),n.createElement("use",{href:"#svgLeaf",x:"1000",y:"48",width:"96",height:"240"}),n.createElement("use",{href:"#svgLeaf",x:"640",y:"560",width:"130",height:"325",opacity:"0.5"}),n.createElement("use",{href:"#svgTarget",x:"600",y:"0",width:"400",height:"500"})),n.createElement("use",{href:"#svgArcher",x:"0",y:"80",width:"600",height:"800"}))),n.createElement("div",{className:l},n.createElement(r.A,null)))}},3666:function(e,t,a){a.d(t,{A:function(){return H}});var n={};a.r(n),a.d(n,{active:function(){return C},amt:function(){return I},ctaC:function(){return T},dt:function(){return k},expired:function(){return P},id:function(){return L},metaInfoC:function(){return O},paid:function(){return S},pt:function(){return D},ptCacheInfo:function(){return z},ptFtr:function(){return R},sts:function(){return B}});var r=a(4506),l=a(6540),c=a(4164),i=a(3093),o=a(1381),s=a(1298),m=a(2161),u=a(117),d=a(214),h=a(3654),f=a(998),E=a(9563),p=a(961),g=(a(5338),"customIframe-module--hiden--31da3"),y="customIframe-module--ifrm--2fc35";function v(e){let{title:t,children:a,cssString:n,isHiddenOnScreen:r,showPrintButton:i,printBtnText:o,...s}=e;const{0:m,1:u}=(0,l.useState)(null),d=(0,l.useRef)(null);return(0,l.useEffect)((()=>{var e,a,r;if(null!==d.current&&(m||u(null===(e=d.current)||void 0===e||null===(a=e.contentDocument)||void 0===a?void 0:a.body),t&&null!==(r=d.current)&&void 0!==r&&r.contentDocument&&(d.current.contentDocument.title=t),n)){var l,c;const e=null===(l=d.current)||void 0===l||null===(c=l.contentDocument)||void 0===c?void 0:c.head;if(e){const t=document.createElement("STYLE");t.setAttribute("type","text/css"),t.textContent=n,e.appendChild(t)}}return()=>{u(null)}}),[d]),l.createElement(l.Fragment,null,l.createElement("iframe",Object.assign({ref:d,onLoad:e=>{const a=e.target;if(null!=a&&a.contentDocument&&(u(null==a?void 0:a.contentDocument.body),t&&a.contentDocument&&(a.contentDocument.title=t),n)){var r;const e=null===(r=a.contentDocument)||void 0===r?void 0:r.head;if(e){const t=document.createElement("STYLE");t.setAttribute("type","text/css"),t.textContent=n,e.appendChild(t)}}},className:(0,c.A)(y,r&&g)},s),m&&(0,p.createPortal)(a,m)),(i||r)&&l.createElement(h.gF,null,l.createElement(h.Ay,{variant:"primary",onClick:()=>{var e;d.current&&(null===(e=d.current)||void 0===e||e.contentWindow.print())},icon:"printer",isIconOnRight:!1},o||"Print")))}const w="body,ul{margin:0;padding:0}body,h2,ul{padding:0}body{font-family:system-ui,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-weight:400;font-size:11pt;line-height:14pt}.wtrmrk{content:'';position:fixed;left:50%;top:50%;width:10cm;height:10cm;transform:translate(-5cm,-5cm);opacity:.15;z-index:-1}ul{list-style-type:none}@media screen{.page{padding:2rem;color:#000}.ftr{margin-top:24px}}@media print{.page{color:#000;box-sizing:border-box;margin:0 1cm}.ftr{position:fixed;bottom:0;left:0;right:0}}.hdr{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between}.logo{margin-bottom:24pt}.hdrDtls{text-align:right}.ftr,table{text-align:center}h1{margin-top:0;font-size:20pt}h2{margin:24pt 0 6pt;font-size:14pt}.ftr,th{font-size:10pt}.data[data-title]:before{content:attr(data-title) ': ';display:inline-block;margin-right:.25cm;font-weight:700;font-size:9pt;white-space:nowrap}.data[data-title]:empty:after{content:'NA';font-size:9pt;visibility:hidden}.ftr>div{font-weight:700}table{margin-top:24pt;border-collapse:collapse;width:100%}td:not(:last-child),th:not(:last-child){border-right:.5pt solid}thead{background:#000;color:#fff}tbody>tr:first-of-type{border-bottom:.5pt solid;height:50pt}td:last-of-type,th:last-of-type{text-align:right;padding-right:8pt}td:first-of-type{border-left:.5pt solid}td:last-of-type{border-right:.5pt solid #000;border-top:.5pt solid;width:100pt}tfoot td{border-bottom:.5pt solid #000}td.grandTotal{background:#094;color:#fff;height:20pt}";function b(e){let{invoiceId:t,invoiceAmt:a,paymentTimestamp:n,userId:r,name:c,email:i,phone:o}=e;const{basePrice:s,gst:m,paymentGatewayFee:u}=(0,d.jK)(a||0,0,0);return l.createElement(v,{title:c.replace(" ","")+"_kaagzi_"+t,showPrintButton:!0,isHiddenOnScreen:!0,printBtnText:"Print Invoice",cssString:w},l.createElement("main",{className:"page"},l.createElement("div",{className:"hdr"},l.createElement("div",null,l.createElement("img",{className:"logo",src:"https://kaagzi.in/img/logo.svg"}),l.createElement("div",null,l.createElement("b",null,"Kaagzi")),l.createElement("div",{className:"data","data-title":"Phone"},"+91 9920066694"),l.createElement("div",{className:"data","data-title":"Email"},"[email protected]")),l.createElement("div",{className:"hdrDtls"},l.createElement("h1",null,"TAX INVOICE"),l.createElement("div",{className:"data","data-title":"ID"},t),l.createElement("div",{className:"data","data-title":"Purchased on"},(0,d.bR)(n,!1,!0,!0)),l.createElement("div",{className:"data","data-title":"Printed On"},(0,d.bR)(Math.floor(Date.now()/1e3),!1,!0,!0)))),l.createElement("h2",null,"Billed To"),l.createElement("div",{className:"to"},l.createElement("div",null,l.createElement("b",null,c)),l.createElement("div",{className:"data","data-title":"Kaagzi ID"},r),o&&l.createElement("div",{className:"data","data-title":"Phone"},"+91 "+o),l.createElement("div",{className:"data","data-title":"Email"},i)),l.createElement("table",null,l.createElement("thead",null,l.createElement("tr",null,l.createElement("th",null,"Product"),l.createElement("th",null,"Plan"),l.createElement("th",null,"Line Total"))),l.createElement("tbody",null,l.createElement("tr",null,l.createElement("td",null,"Kaagzi"),l.createElement("td",null,"1 month"),l.createElement("td",null,s.toLocaleString("en-IN",{style:"currency",currency:"INR"})))),l.createElement("tfoot",null,l.createElement("tr",null,l.createElement("th",{colSpan:"2"},"Sub Total"),l.createElement("td",null,l.createElement("b",null,s.toLocaleString("en-IN",{style:"currency",currency:"INR"})))),l.createElement("tr",null,l.createElement("th",{colSpan:"2"}," ")),l.createElement("tr",null,l.createElement("th",{colSpan:"2"},"GST"),l.createElement("td",null,"Exempted")),l.createElement("tr",null,l.createElement("th",{colSpan:"2"}," ")),l.createElement("tr",null,l.createElement("th",{colSpan:"2"},"Grand Total"),l.createElement("td",{className:"grandTotal"},l.createElement("b",null,a.toLocaleString("en-IN",{style:"currency",currency:"INR"})))))),l.createElement("div",{className:"ftr"},l.createElement("div",null,"kaagzi.in"),"A/001, Milap, Navagaon, Dahisar West, Mumbai - 68, Maharashtra, India"),l.createElement("img",{className:"wtrmrk",src:"https://kaagzi.in/img/kaagzi-logo.webp"})))}function N(e){let{billId:t,amount:a,billPayTimestamp:n}=e;const{id:r,name:c,email:i,phone:o}=(0,l.useContext)(u.R);return l.createElement(l.Fragment,null,l.createElement(E.A,{amt:a,amtIncludesTaxNFees:!0}),l.createElement(b,{invoiceId:t,invoiceAmt:a,paymentTimestamp:n,userId:r,name:c,email:i,phone:o}))}var x=a(7432),A=a(6399),C="paymentTransactions-module--active--b2687",I="paymentTransactions-module--amt--96a99",T="paymentTransactions-module--ctaC--be7d5",k="paymentTransactions-module--dt--db973",P="paymentTransactions-module--expired--82a6f",L="paymentTransactions-module--id--32565",O="paymentTransactions-module--metaInfoC--e68cf",S="paymentTransactions-module--paid--89f97",D="paymentTransactions-module--pt--09569",z="paymentTransactions-module--ptCacheInfo--b9f92",R="paymentTransactions-module--ptFtr--bf202",B="paymentTransactions-module--sts--3501b";function H(){const{id:e}=(0,l.useContext)(u.R);if(!e)return null;const{0:t,1:a}=(0,l.useState)(!0),{0:E,1:p}=(0,l.useState)(!1),{0:g,1:y}=(0,l.useState)([]),{0:v,1:w}=(0,l.useState)(null),{0:b,1:C}=(0,l.useState)(null),{0:P,1:S}=(0,l.useState)(null),H=(0,l.useContext)(o.M),{getCachedPaymentOrders:M,getCachedPaymentOrdersMetaData:K,setCachedPaymentOrders:F,setCachedPaymentOrdersMetaData:j,deleteCachedPaymentOrders:V,deleteCachedPaymentOrdersMetaData:G}=(0,l.useContext)(i.w),{notify:W}=(0,l.useContext)(s._),{dbQueryData:_}=(0,l.useContext)(m.O),U=async t=>{try{const n=await(async t=>{try{if(!H)throw new Error("Network unavailable");if(!e)throw new Error("No logged-in user");a(!0);let n={TableName:"KaagziPaymentOrders",KeyConditionExpression:"#userAtrName = :userAtrVal",ExpressionAttributeNames:{"#userAtrName":"u"},ExpressionAttributeValues:{":userAtrVal":e},ScanIndexForward:!1,Limit:5};t&&(n.ExclusiveStartKey=t);const r=await _(n);if(!r||"object"!=typeof r||null==r.Items||!Object.hasOwn(r,"Items")||r.Count<1)throw new Error("No order recods found");return r}catch(n){return a(!1),W(n.message||"Error fetching transaction records","err"),null}finally{a(!1)}})(t);if(!n)return W(t?"No more older transactions":"No transactions present"),w(null),null;null!=t?y([].concat((0,r.A)(g),(0,r.A)(n.Items))):(await(async()=>{p(!1),y([]),w(null),C(null),S(null);try{return await V(e),await G(e,null),!0}catch(t){return!1}})(),y(n.Items),p(!1));const l=n.Items.map((e=>{let{o:t,t:a,s:n,a:r}=e;return{o:t,t:a,s:n,a:r}}));await F(e,l).catch((e=>{console.error(e)}));const c=Date.now();return C(c),await j(e,"t",c).catch((e=>{console.error(e)})),n.LastEvaluatedKey?(w(n.LastEvaluatedKey),await j(e,"ddbLastEvalKey",n.LastEvaluatedKey).catch((e=>{console.error(e)}))):(w(null),await G(e,"ddbLastEvalKey").catch((e=>{console.error(e)}))),n.Items}catch(n){return W(n.message||"Error fetching transaction records","err"),null}},Y=()=>{v&&U(v)},Q=async()=>{try{a(!0);if(!await U())throw new Error("Error refreshing orders");return W("Orders refreshed!"),a(!1),!0}catch(e){return a(!1),!1}finally{a(!1)}};return(0,l.useEffect)((()=>{g.length<1&&(async()=>{!await(async()=>{try{a(!0);const t=await M(e);if(!Array.isArray(t)||t.length<1)throw new Error;t.sort(((e,t)=>t.o-e.o));const n=await K(e,"ddbLastEvalKey"),r=await K(e,"t");return y(t),n&&w(n),r&&C(r),p(!0),!0}catch(t){return!1}finally{a(!1)}})()&&H&&await U()})()}),[H]),g.length<1?l.createElement("div",{className:O},t?l.createElement(x.A,{note:"Loading"}):H?l.createElement(A.A,{icon:"credit-card",note:"No Transaction Records",isOverlay:!0}):l.createElement(A.A,{icon:"alert-circle",note:"Network unavailable",isOverlay:!0})):l.createElement(l.Fragment,null,E&&b&&l.createElement("div",{className:z},l.createElement("p",null,"Last fetched on ",(0,d.bR)(new Date(b),!1,!0,!0)),l.createElement(h.Ay,{variant:"tertiary",size:"smaller",onClick:Q,isWip:t,wipText:"Refreshing",icon:"refresh-cw",isDark:!0},"Refresh")),l.createElement("ul",{className:D},l.createElement("li",null,l.createElement("span",{className:L},"Order ID"),l.createElement("span",{className:k},"Date"),l.createElement("span",{className:B},"Status"),l.createElement("span",{className:I},"Amount"),l.createElement("span",{className:T})),g.map(((e,t)=>{let a="Active";switch(+e.s){case-1:a="Expired";break;case 0:a="Active";break;case 3:a="Paid";break;case 4:a="Refunded";break;default:a="Unknown"}return l.createElement("li",{key:e.o,className:(0,c.A)(Object.hasOwn(n,a.toLowerCase())&&n[a.toLowerCase()])},l.createElement("span",{className:L},e.o),l.createElement("span",{className:k},(0,d.bR)(e.t,!1,!0,!1)),l.createElement("span",{className:B},l.createElement("span",null,a)),l.createElement("span",{className:I},e.a),l.createElement("span",{className:T},"Paid"===a&&l.createElement(h.Ay,{variant:"secondary",size:"small",onClick:()=>{S(e)},icon:"arrow-right",isIconOnRight:!0,isDark:!0},"View Bill")))}))),v&&l.createElement(h.gF,{className:R},l.createElement(h.Ay,{variant:"secondary",isDark:!0,onClick:Y,isWip:t,wipText:"Loading"},"Load older transactions")),t&&l.createElement(x.A,{note:"Loading"}),null!==P&&Object.hasOwn(P,"o")&&l.createElement(f.A,{title:"Order # "+P.o,useCloseBtn:!0,doOnClose:()=>{S(null)}},l.createElement(N,{billId:P.o,amount:P.a,billPayTimestamp:P.t})))}},1740:function(e,t,a){a.r(t),a.d(t,{Head:function(){return h},default:function(){return d}});var n=a(6540),r=a(3811),l=a(8244),c=a(7432),i=a(117);function o(e){let{children:t}=e;const{0:a,1:r}=(0,n.useState)(!1),{id:o}=(0,n.useContext)(i.R);return(0,n.useEffect)((()=>{setTimeout((()=>{r(!0)}),100)}),[]),a?o?n.createElement("main",{key:o},t):n.createElement(l.A,null):n.createElement(c.A,{coverFullPage:!0})}function s(e){let{children:t}=e;return n.createElement(n.Fragment,null,n.createElement(r.A,null),n.createElement(o,null,t))}var m=a(268),u=a(7386);function d(){return n.createElement(s,null,n.createElement("h1",null,"Payment ",n.createElement("span",null,"Transactions")),n.createElement(m.A,null,(()=>{const e=a(3666).A;return n.createElement(e,null)})))}function h(){return n.createElement(u.y,{title:"Payment transactions",description:"List of your purchase payment transactions and invoices"})}}}]);