-
Notifications
You must be signed in to change notification settings - Fork 0
/
component---src-pages-console-payment-transactions-index-js-c6550d81ccfd6fb32744.js
2 lines (2 loc) · 12.4 KB
/
component---src-pages-console-payment-transactions-index-js-c6550d81ccfd6fb32744.js
1
2
"use strict";(self.webpackChunkkaagzi=self.webpackChunkkaagzi||[]).push([[769],{5115:function(e,t,n){n.d(t,{Z:function(){return z}});var a={};n.r(a),n.d(a,{active:function(){return x},amt:function(){return S},ctaC:function(){return C},dt:function(){return P},expired:function(){return T},id:function(){return k},paid:function(){return L},pt:function(){return D},ptCacheInfo:function(){return O},sts:function(){return A}});var r=n(5785),l=n(7294),c=n(512),o=n(7277),i=n(469),s=n(1797),m=n(3312),u=n(1370),d=n(4860),p=n(7226),E=n(2484),f=n(4049),h=n(3935),y=(n(745),"customIframe-module--hiden--31da3"),g="customIframe-module--ifrm--2fc35";function v(e){let{title:t,children:n,cssString:a,isHiddenOnScreen:r,showPrintButton:o,printBtnText:i,...s}=e;const{0:m,1:u}=(0,l.useState)(null),d=(0,l.useRef)(null);return(0,l.useEffect)((()=>{var e,n,r;if(null!==d.current&&(m||u(null===(e=d.current)||void 0===e||null===(n=e.contentDocument)||void 0===n?void 0:n.body),t&&null!==(r=d.current)&&void 0!==r&&r.contentDocument&&(d.current.contentDocument.title=t),a)){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=a,e.appendChild(t)}}return()=>{u(null)}}),[d]),l.createElement(l.Fragment,null,l.createElement("iframe",Object.assign({ref:d,onLoad:e=>{const n=e.target;if(null!=n&&n.contentDocument&&(u(null==n?void 0:n.contentDocument.body),t&&n.contentDocument&&(n.contentDocument.title=t),a)){var r;const e=null===(r=n.contentDocument)||void 0===r?void 0:r.head;if(e){const t=document.createElement("STYLE");t.setAttribute("type","text/css"),t.textContent=a,e.appendChild(t)}}},className:(0,c.Z)(g,r&&y)},s),m&&(0,h.createPortal)(n,m)),(o||r)&&l.createElement(p.pi,null,l.createElement(p.ZP,{variant:"primary",onClick:()=>{var e;d.current&&(null===(e=d.current)||void 0===e||e.contentWindow.print())},icon:"printer",isIconOnRight:!1},i||"Print")))}const b='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:.2;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}.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}tfoot td{border-bottom:.5pt solid #000}td.grandTotal{background:#094;color:#fff;height:20pt}';function w(e){let{invoiceId:t,invoiceAmt:n,paymentTimestamp:a,userId:r,name:c,email:o,phone:i}=e;const{basePrice:s,gst:m,paymentGatewayFee:u}=(0,d.k)(n||0);return l.createElement(v,{title:c.replace(" ","")+"_kaagzi_"+t,showPrintButton:!0,isHiddenOnScreen:!0,printBtnText:"Print Invoice",cssString:b},l.createElement("main",{className:"page"},l.createElement("div",{className:"hdr"},l.createElement("div",null,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:"data","data-title":"GST"},"354134719hdjgadg3135")),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.$J)(a,!1,!0,!0)),l.createElement("div",{className:"data","data-title":"Printed On"},(0,d.$J)(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),i&&l.createElement("div",{className:"data","data-title":"Phone"},"+91 "+i),l.createElement("div",{className:"data","data-title":"Email"},o)),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,"Active From"),l.createElement("th",null,"Active Till"),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,"25 Sep 2023"),l.createElement("td",null,"24 Oct 2023"),l.createElement("td",null,s.toLocaleString("en-IN",{style:"currency",currency:"INR"})))),l.createElement("tfoot",null,l.createElement("tr",null,l.createElement("th",{colSpan:"4"},"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:"4"}," ")),l.createElement("tr",null,l.createElement("th",{colSpan:"4"},"GST @ 18%"),l.createElement("td",null,m.toLocaleString("en-IN",{style:"currency",currency:"INR"}))),l.createElement("tr",null,l.createElement("th",{colSpan:"4"},"Total"),l.createElement("td",null,l.createElement("b",null,(s+m).toLocaleString("en-IN",{style:"currency",currency:"INR"})))),l.createElement("tr",null,l.createElement("th",{colSpan:"4"}," ")),l.createElement("tr",null,l.createElement("th",{colSpan:"4"},"Payment facilitator fee @ 2% of grand-total"),l.createElement("td",null,u.toLocaleString("en-IN",{style:"currency",currency:"INR"}))),l.createElement("tr",null,l.createElement("th",{colSpan:"4"},"Grand Total"),l.createElement("td",{className:"grandTotal"},l.createElement("b",null,n.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")))}function N(e){let{billId:t,amount:n,billPayTimestamp:a}=e;const{id:r,name:c,email:o,phone:i}=(0,l.useContext)(u.S);return l.createElement(l.Fragment,null,l.createElement(f.Z,{amt:n,amtIncludesTaxNFees:!0}),l.createElement(w,{invoiceId:t,invoiceAmt:n,paymentTimestamp:a,userId:r,name:c,email:o,phone:i}))}var I=n(3461),x="paymentTransactions-module--active--b2687",S="paymentTransactions-module--amt--96a99",C="paymentTransactions-module--ctaC--be7d5",P="paymentTransactions-module--dt--db973",T="paymentTransactions-module--expired--82a6f",k="paymentTransactions-module--id--32565",L="paymentTransactions-module--paid--89f97",D="paymentTransactions-module--pt--09569",O="paymentTransactions-module--ptCacheInfo--b9f92",A="paymentTransactions-module--sts--3501b";function z(){const{id:e}=(0,l.useContext)(u.S);if(!e)return null;const{0:t,1:n}=(0,l.useState)(!0),{0:f,1:h}=(0,l.useState)(!1),{0:y,1:g}=(0,l.useState)([]),{0:v,1:b}=(0,l.useState)(null),{0:w,1:x}=(0,l.useState)(null),{0:T,1:L}=(0,l.useState)(null),z=(0,l.useContext)(i.x),{getCachedPaymentOrders:Z,getCachedPaymentOrdersMetaData:R,setCachedPaymentOrders:K,setCachedPaymentOrdersMetaData:j,deleteCachedPaymentOrders:B,deleteCachedPaymentOrdersMetaData:F}=(0,l.useContext)(o.Z),{notify:M}=(0,l.useContext)(s.L),{dbQueryData:W}=(0,l.useContext)(m.A),H=async t=>{try{const a=await(async t=>{try{if(!z)throw new Error("Network unavailable");if(!e)throw new Error("No logged-in user");n(!0);let a={TableName:"KaagziPaymentOrders",KeyConditionExpression:"#userAtrName = :userAtrVal",ExpressionAttributeNames:{"#userAtrName":"u"},ExpressionAttributeValues:{":userAtrVal":e},ScanIndexForward:!1,Limit:5};t&&(a.ExclusiveStartKey=t);const r=await W(a);if(!r||"object"!=typeof r||null==r.Items||!Object.prototype.hasOwnProperty.call(r,"Items")||r.Count<1)throw new Error("No order recods found");return r}catch(a){return n(!1),M(a.message||"Error fetching transaction records","err"),null}finally{n(!1)}})(t);if(!a)return M(t?"No more older transactions":"No transactions present"),b(null),null;null!=t?g([].concat((0,r.Z)(y),(0,r.Z)(a.Items))):(await(async()=>{h(!1),g([]),b(null),x(null),L(null);try{return await B(e),await F(e,null),!0}catch(t){return!1}})(),g(a.Items),h(!1));const l=a.Items.map((e=>{let{o:t,t:n,s:a,a:r}=e;return{o:t,t:n,s:a,a:r}}));await K(e,l).catch((e=>{console.error(e)}));const c=Date.now();return x(c),await j(e,"t",c).catch((e=>{console.error(e)})),a.LastEvaluatedKey?(b(a.LastEvaluatedKey),await j(e,"ddbLastEvalKey",a.LastEvaluatedKey).catch((e=>{console.error(e)}))):(b(null),await F(e,"ddbLastEvalKey").catch((e=>{console.error(e)}))),a.Items}catch(a){return M(a.message||"Error fetching transaction records","err"),null}},V=()=>{v&&H(v)},G=async()=>{try{n(!0);if(!await H())throw new Error("Error refreshing orders");return M("Orders refreshed!"),n(!1),!0}catch(e){return n(!1),!1}finally{n(!1)}};return(0,l.useEffect)((()=>{y.length<1&&(async()=>{!await(async()=>{try{n(!0);const t=await Z(e);if(!Array.isArray(t)||t.length<1)throw new Error;t.sort(((e,t)=>t.o-e.o));const a=await R(e,"ddbLastEvalKey"),r=await R(e,"t");return g(t),a&&b(a),r&&x(r),h(!0),!0}catch(t){return!1}finally{n(!1)}})()&&z&&await H()})()}),[z]),y.length<1?l.createElement("div",null,t?"Loading...":z?"No records":"You are offline"):l.createElement(l.Fragment,null,l.createElement("div",null,f&&w&&l.createElement("div",{className:O},l.createElement("p",null,"Last fetched on ",(0,d.$J)(new Date(w),!1,!0,!0)),l.createElement(p.ZP,{variant:"tertiary",size:"smaller",onClick:G,isWip:t,wipText:"Refreshing",icon:"refresh-cw",isDark:!0},"Refresh")),l.createElement("ul",{className:D},l.createElement("li",null,l.createElement("span",{className:k},"Order ID"),l.createElement("span",{className:P},"Date"),l.createElement("span",{className:A},"Status"),l.createElement("span",{className:S},"Amount"),l.createElement("span",{className:C})),y.map(((e,t)=>{let n="Active";switch(+e.s){case-1:n="Expired";break;case 0:n="Active";break;case 3:n="Paid";break;case 4:n="Refunded";break;default:n="Unknown"}return l.createElement("li",{key:e.o,className:(0,c.Z)(Object.prototype.hasOwnProperty.call(a,n.toLowerCase())&&a[n.toLowerCase()])},l.createElement("span",{className:k},e.o),l.createElement("span",{className:P},(0,d.$J)(e.t,!1,!0,!1)),l.createElement("span",{className:A},l.createElement("span",null,n)),l.createElement("span",{className:S},e.a),l.createElement("span",{className:C},"Paid"===n&&l.createElement(p.ZP,{variant:"secondary",size:"small",onClick:()=>{L(e)},icon:"arrow-right",isIconOnRight:!0,isDark:!0},"View Bill")))}))),v&&l.createElement(p.pi,null,l.createElement(p.ZP,{variant:"secondary",size:"small",onClick:V,isWip:t,wipText:"Loading"},"Load older transactions")),t&&l.createElement(I.Z,{note:"Loading"})),null!==T&&Object.prototype.hasOwnProperty.call(T,"o")&&l.createElement(E.Z,{title:"Order # "+T.o,useCloseBtn:!0,doOnClose:()=>{L(null)}},l.createElement(N,{billId:T.o,amount:T.a,billPayTimestamp:T.t})))}},2617:function(e,t,n){n.r(t),n.d(t,{Head:function(){return p},default:function(){return d}});var a=n(7294),r=n(1370),l=n(6427),c=n(918),o="fullWidthRestrictedPage-module--verticalHorizontalCenterC--ae912",i="fullWidthRestrictedPage-module--wrap--3081d";function s(e){let{children:t}=e;const{id:n}=(0,a.useContext)(r.S);return a.createElement("div",{id:i},a.createElement(l.Z,null),n?a.createElement("main",null,t):a.createElement("div",{id:o},a.createElement(c.Z,null)))}var m=n(4782),u=n(3072);function d(){return a.createElement(s,null,a.createElement("h1",null,"Payment ",a.createElement("span",null,"Transactions")),a.createElement(m.Z,null,(()=>{const e=n(5115).Z;return a.createElement(e,null)})))}function p(){return a.createElement(u.L,{title:"Payment transactions",description:"List of your purchase payment transactions and invoices"})}}}]);
//# sourceMappingURL=component---src-pages-console-payment-transactions-index-js-c6550d81ccfd6fb32744.js.map