1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3559],{8898:function(e,l,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/organization/fundraisers/[id]",function(){return i(31739)}])},55222:function(e,l,i){"use strict";var n=i(85893);i(67294),l.Z=function(e){let{condition:l,children:i}=e;return(0,n.jsx)(n.Fragment,{children:l?i:null})}},86308:function(e,l,i){"use strict";var n=i(85893),t=i(86010);l.Z=function(){let{title:e,children:l,color:i,className:o,headerClassName:s}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:props;return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:(0,t.Z)("".concat("gray"===i?"card-gray":"card-green"),o),children:[(0,n.jsx)("div",{className:(0,t.Z)("".concat("gray"===i?"header-gray":"header-green"),s),children:e}),l||" "]})})}},46791:function(e,l,i){"use strict";i.d(l,{Z:function(){return o}});var n=i(85893),t=i(11163);function o(e){let{title:l,hasBackIcon:i=!1,onClickBackIcon:o}=e,s=(0,t.useRouter)();return(0,n.jsxs)("div",{className:"d-flex align-items-center",children:[i&&(0,n.jsx)("i",{className:"fa fa-arrow-left cms-page-back-icon","aria-hidden":"true",onClick:()=>{o?o():s.back()}}),(0,n.jsx)("h1",{className:"cms-page-title",children:l})]})}i(67294)},25827:function(e,l,i){"use strict";var n=i(85893),t=i(86010);i(67294);var o=i(95340),s=i.n(o);l.Z=function(e){let{type:l="text",className:i,style:o,helperText:r,refs:a,disabled:d,readOnly:u,onChange:c,value:v,placeholder:m,showLabel:h=!1,isRequired:f=!1,isDetail:p=!1,label:x=""}=e;return(0,n.jsxs)("div",{className:i,style:o,children:[h&&(0,n.jsx)("p",{className:"admin-form-label",children:m||x}),(0,n.jsx)(s(),{ref:a,name:"totalTargetAmount",disabled:d,readOnly:u,placeholder:"Target Amount",thousandSeparator:!0,value:v,className:(0,t.Z)("form-control admin-input",p&&d&&"admin-form-detail"),prefix:"$",onValueChange:e=>{c(e)}}),r&&(0,n.jsx)("p",{className:"form-text-error",children:r})]})}},3682:function(e,l,i){"use strict";var n=i(85893),t=i(86010),o=i(67294),s=i(16109),r=i(76402);l.Z=function(e){let{type:l="text",className:i,style:a,helperText:d,pattern:u,refs:c,disabled:v,readOnly:m=!1,onChange:h,onClick:f,value:p,placeholder:x,showLabel:g=!1,isRequired:b=!1,isDetail:j=!1,label:N="",autoComplete:y="off"}=e,[w,A]=(0,o.useState)(!1);return(0,n.jsxs)("div",{className:(0,t.Z)("admin-input-container",i),style:a,children:[(0,n.jsxs)(s.Z.Label,{className:(0,t.Z)(w||p||0==p?"label-shrink":null,j&&v&&"admin-form-label-detail"),children:[x||N,b&&(0,n.jsx)("span",{className:"ms-1 admin-required-icon",children:"*"})]}),(0,n.jsx)("input",{onKeyPress:e=>{"number"==l&&(0,r.zL)(e,!1)},type:l,value:p,pattern:u,onChange:h,ref:c,disabled:v,readOnly:m,autoComplete:y,onFocus:e=>{m||A((null==e?void 0:e.type)==="focus")},onClick:f,onBlur:e=>{A((null==e?void 0:e.type)!=="blur")},className:(0,t.Z)("form-control admin-input pt-3",j&&v&&"admin-form-detail")}),d&&(0,n.jsx)("p",{className:"form-text-error",children:d})]})}},69983:function(e,l,i){"use strict";var n=i(85893);i(67294),i(25675);var t=i(4456),o=i(40142),s=i(14456),r=i(11163);l.Z=(0,o.$j)(e=>{let{user:l}=null==e?void 0:e.auth;return{user:l}},e=>{let{logout:l}=s.default;return{logout:()=>e(l())}})(e=>{var l,i,o,s,a;let{handleClickMenu:d,logout:u,user:c}=e,v=(0,r.useRouter)(),m=()=>{v.push("/"),u()};return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("header",{className:"section-header",children:(0,n.jsxs)("div",{className:"bg-admin-v2 admin-header w-100 d-flex",children:[(0,n.jsx)("div",{className:"d-block d-md-none cursor-pointer border rounded-3 px-2 py-1 align-self-center h-auto ms-3",onClick:d,children:(0,n.jsxs)("svg",{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",fill:"#fff",fillRule:"evenodd",clipRule:"evenodd",children:[(0,n.jsx)("path",{d:"M24 18v1h-24v-1h24zm0-6v1h-24v-1h24zm0-6v1h-24v-1h24z",fill:"#1040e2"}),(0,n.jsx)("path",{d:"M24 19h-24v-1h24v1zm0-6h-24v-1h24v1zm0-6h-24v-1h24v1z"})]})}),(0,n.jsxs)("div",{className:"ms-auto position-relative user-profile-w d-flex",children:[(0,n.jsxs)(t.Z,{children:[(0,n.jsx)(t.Z.Toggle,{variant:"success",id:"dropdown-basic",children:(0,n.jsxs)("div",{className:"d-flex align-items-center",children:[(0,n.jsx)("div",{className:"admin-navbar-profile",children:(0,n.jsx)("img",{className:"w-100 h-100 admin-navbar-profile-img",src:(null==c?void 0:null===(i=c.profile)||void 0===i?void 0:null===(l=i.profileImage)||void 0===l?void 0:l.url)||"/assets/icon/profile-empty.png",alt:"profile photo"})}),(0,n.jsx)("p",{className:"mx-2 mb-0 d-inline fw-light user-profile-name text-white",children:null==c?void 0:null===(o=c.profile)||void 0===o?void 0:o.displayName})]})}),(0,n.jsx)(t.Z.Menu,{children:(0,n.jsx)(t.Z.Item,{onClick:()=>m(),children:"Log out"})})]}),(null==c?void 0:c.organization)&&(0,n.jsx)("img",{src:(null==c?void 0:null===(a=c.organization)||void 0===a?void 0:null===(s=a.logo)||void 0===s?void 0:s.url)||"/assets/icon/profile-empty.png",alt:"org logo",className:"custom-org-logo me-2"})]})]})})})})},66989:function(e,l,i){"use strict";var n=i(85893),t=i(67294),o=i(86010),s=i(11163),r=i(41664),a=i.n(r),d=i(12386),u=i(40142);i(96486);var c=i(12761);l.Z=(0,u.$j)(e=>{let{user:l}=null==e?void 0:e.auth;return{user:l}},null)(e=>{var l,i,r;let{isShow:u,closeSelf:v,user:m,navigation:h}=e,f=(0,s.useRouter)(),{SubMenu:p}=d.default,{parentMenu:x}=f.query,g=null==m?void 0:m.permissions,b=null==m?void 0:null===(r=m.permissions)||void 0===r?void 0:r.includes(null===(i=c.Z)||void 0===i?void 0:null===(l=i.EOrganizationPermissions)||void 0===l?void 0:l.LOGIN),[j,N]=(0,t.useState)("/admin/dashboard"),[y,w]=(0,t.useState)(""),[A,k]=(0,t.useState)("");return(0,t.useEffect)(()=>{var e,l,i,n;let t=null==h?void 0:h.find(e=>{var l,i;return null==f?void 0:null===(i=f.pathname)||void 0===i?void 0:i.startsWith(null==e?void 0:null===(l=e.href)||void 0===l?void 0:l.split("#")[0])});if((null==t?void 0:null===(e=t.items)||void 0===e?void 0:e.length)||N(null==t?void 0:t.href),(null==t?void 0:null===(l=t.items)||void 0===l?void 0:l.length)>0){let e=null==t?void 0:null===(n=t.items)||void 0===n?void 0:n.find(e=>{var l;return null==f?void 0:null===(l=f.pathname)||void 0===l?void 0:l.startsWith(null==e?void 0:e.href)});N(null==e?void 0:e.href),k([null==t?void 0:t.href])}(null==f?void 0:null===(i=f.pathname)||void 0===i?void 0:i.includes("/top-donors"))&&(b?N("/organization/donations/top-donors"):N("/admin/donations/top-donors"))},[f]),(0,n.jsxs)("section",{className:(0,o.Z)("section-sidebar",u&&"customMenu"),children:[(0,n.jsxs)("div",{className:"sidebar-header center",children:[(0,n.jsx)(a(),{legacyBehavior:!0,href:"/admin/dashboard",children:(0,n.jsx)("a",{className:"bg-admin-logo cursor-pointer",children:(0,n.jsx)("img",{src:"/assets/admin-v2/KhmerCare-AdminV2Logo.png",className:"img-fluid",alt:"KhmerCareLogo"})})}),(0,n.jsx)("div",{onClick:v,className:(0,o.Z)("closeIcone cursor-pointer d-md-none p-2",u?"d-block":"d-none"),children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"#FFF",children:(0,n.jsx)("path",{d:"M23.954 21.03l-9.184-9.095 9.092-9.174-2.832-2.807-9.09 9.179-9.176-9.088-2.81 2.81 9.186 9.105-9.095 9.184 2.81 2.81 9.112-9.192 9.18 9.1z"})})})]}),(0,n.jsx)("div",{className:"bg-sidebar",children:(0,n.jsx)("div",{className:"sidebar-box",children:(0,n.jsx)("div",{className:"text-white sidebar-items px-0",children:(0,n.jsx)(d.default,{defaultSelectedKeys:f.asPath,mode:"inline",selectedKeys:[j],triggerSubMenuAction:"click",openKeys:y||A,onOpenChange:e=>{w(e)},children:null==h?void 0:h.map((e,l)=>(null==e?void 0:e.items)?(0,n.jsx)(t.Fragment,{children:(null==g?void 0:g.includes(null==e?void 0:e.permissions))?(0,n.jsx)(p,{icon:(0,n.jsx)("img",{src:null==e?void 0:e.icon,alt:"icon",className:"img-admin-icon"}),title:e.title,children:null==e?void 0:e.items.map(e=>(0,n.jsx)(d.default.Item,{children:(0,n.jsx)(a(),{legacyBehavior:!0,href:null==e?void 0:e.href,children:(0,n.jsx)("a",{children:e.title})})},(null==e?void 0:e.href)||f.asPath))},e.href):null},"sidebar + ".concat(l)):(0,n.jsx)(t.Fragment,{children:(null==g?void 0:g.includes(null==e?void 0:e.permissions))?(0,n.jsx)(d.default.Item,{children:(0,n.jsx)(a(),{legacyBehavior:!0,href:null==e?void 0:e.href,children:(0,n.jsxs)("a",{children:[(0,n.jsx)("img",{src:null==e?void 0:e.icon,alt:null==e?void 0:e.title,className:"img-admin-icon"}),(0,n.jsx)("span",{className:"ms-3",children:null==e?void 0:e.title})]})})},null==e?void 0:e.href):null},"sidebar1 + ".concat(l)))})})})})]})})},36680:function(e,l,i){"use strict";var n=i(85893);
1i(67294);var t=i(53201),o=i(87536);l.Z=e=>{let{isShow:l,onClose:i,onSubmit:s}=e,{register:r,handleSubmit:a,formState:{errors:d,isSubmitting:u}}=(0,o.cI)({mode:"onBlur"});return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(t.default,{isShow:l,onClose:i,title:"Reject Reason",size:"lg",children:[(0,n.jsx)(t.default.Body,{children:(0,n.jsx)("form",{onSubmit:()=>{a(s)()},autoComplete:"off",children:(0,n.jsx)("div",{className:"col-12",children:(0,n.jsxs)("div",{className:"form-group mb-2",children:[(0,n.jsx)("textarea",{...r("cancelReason",{required:!0}),type:"text",className:"form-control border-0 input-front bg-white fw-light",name:"cancelReason",id:"cancelReason",rows:"5",placeholder:"Reject Reason"}),d.cancelReason&&(0,n.jsx)("div",{className:"invalid-feedback text-error d-block",children:"Please input reject reason!"})]})})})}),(0,n.jsx)(t.default.Footer,{className:"border-top-0",children:(0,n.jsx)("button",{className:"admin-primary-btn",type:"submit",disabled:u,onClick:()=>{a(s)()},children:"Submit"})})]})})}},62305:function(e,l,i){"use strict";var n=i(85893),t=i(43929);i(67294),l.Z=function(e){let{logo:l,accountName:i,accountNumber:o,isAdmin:s=!1}=e,{t:r}=(0,t.useTranslation)();return(0,n.jsxs)("div",{className:"d-flex align-items-center",children:[(0,n.jsx)("img",{src:l,width:50,height:50}),(0,n.jsx)("span",{className:"web-text-black__fz-12 fw-bold mx-2",children:s?"Account":r("WITHDRAW_FUNDS.ACCOUNT")})," ",(0,n.jsxs)("span",{className:"web-text-gray__fz-12",children:["#",o," ","(".concat(i,")")]})]})}},60486:function(e,l,i){"use strict";var n=i(85893),t=i(43929);i(67294),l.Z=function(e){let{isAdmin:l=!1}=e,{t:i}=(0,t.useTranslation)();return(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{}),(0,n.jsx)("p",{children:l?"I don't have bank account.":i("WITHDRAW_FUNDS_SUCCESS.NO_BANK_ACCOUNT")})]})}},7900:function(e,l,i){"use strict";i.d(l,{Z:function(){return m}});var n,t=i(85893),o=i(69983),s=i(66989),r=i(67294),a=i(11163),d=i(40142),u=i(60487),c=i(12761),v=i(48178),m=(n=e=>{let{children:l}=e,[i,n]=(0,r.useState)(!1),{admin:a}=v.default;return(0,t.jsxs)("div",{className:"d-flex",children:[(0,t.jsx)(s.Z,{isShow:i,closeSelf:()=>n(!1),navigation:a}),(0,t.jsxs)("div",{className:"bg-gray-100",id:"page-content-wrapper",children:[(0,t.jsx)(o.Z,{handleClickMenu:()=>n(!i)}),(0,t.jsx)("div",{className:"container-fluid p-3 admin-min-height",children:l})]})]})},e=>{var l,i,o,s,r;let v=(0,a.useRouter)(),m=(0,d.oR)(),h=null==m?void 0:null===(i=m.getState())||void 0===i?void 0:null===(l=i.auth)||void 0===l?void 0:l.user,f=(0,d.v9)(e=>{var l;return null==e?void 0:null===(l=e._persist)||void 0===l?void 0:l.rehydrated}),p=()=>(0,t.jsx)(u.default,{isLoading:!0}),x=null==h?void 0:null===(r=h.permissions)||void 0===r?void 0:r.includes(null===(s=c.Z)||void 0===s?void 0:null===(o=s.EAdminPermissions)||void 0===o?void 0:o.LOGIN);return f?x&&h?(0,t.jsx)(n,{...e}):(null==v||v.push("/auth/admin/login"),(0,t.jsx)(p,{})):(0,t.jsx)(p,{})})},48178:function(e,l,i){"use strict";var n,t,o,s,r,a,d,u,c,v,m,h,f,p,x,g,b,j,N,y,w,A,k,E,I,T,S,D,F,C,P,Z,R,O,L=i(12761);let M=[{href:"/organization/dashboard",icon:"/assets/admin-v2/dashboard-icon.png",title:"Dashboard",permissions:null===(t=L.Z)||void 0===t?void 0:null===(n=t.EOrganizationPermissions)||void 0===n?void 0:n.LOGIN},{href:"/organization/fundraisers",icon:"/assets/admin-v2/fundraisers-icon.png",title:"Campaigns",permissions:null===(s=L.Z)||void 0===s?void 0:null===(o=s.EOrganizationPermissions)||void 0===o?void 0:o.LOGIN},{href:"/organization/donations#",icon:"/assets/admin-v2/donations-icon.png",title:"Donations",permissions:null===(a=L.Z)||void 0===a?void 0:null===(r=a.EOrganizationPermissions)||void 0===r?void 0:r.LOGIN,items:[{href:"/organization/donations",key:"Donations",title:"Donations"},{href:"/organization/donations/top-donors",key:"Donors",title:"Top Donors"}]},{href:"/organization/withdrawals",icon:"/assets/admin-v2/withdrawals-icon.png",title:"Withdrawals",permissions:null===(u=L.Z)||void 0===u?void 0:null===(d=u.EOrganizationPermissions)||void 0===d?void 0:d.LOGIN},{href:"/organization/members",icon:"/assets/admin-v2/users-icon.png",title:"Members",permissions:null===(v=L.Z)||void 0===v?void 0:null===(c=v.EOrganizationPermissions)||void 0===c?void 0:c.LOGIN},{href:"/organization/organization-profile",icon:"/assets/admin-v2/organization-icon.svg",title:"Organization",permissions:null===(h=L.Z)||void 0===h?void 0:null===(m=h.EOrganizationPermissions)||void 0===m?void 0:m.LOGIN}],U=[{href:"/admin/dashboard",icon:"/assets/admin-v2/dashboard-icon.png",title:"Dashboard",permissions:null===(p=L.Z)||void 0===p?void 0:null===(f=p.EAdminPermissions)||void 0===f?void 0:f.LOGIN},{href:"/admin/fundraisers",icon:"/assets/admin-v2/fundraisers-icon.png",title:"Campaigns",permissions:null===(g=L.Z)||void 0===g?void 0:null===(x=g.EAdminPermissions)||void 0===x?void 0:x.LOGIN},{href:"/admin/donations#",icon:"/assets/admin-v2/donations-icon.png",title:"Donations",permissions:null===(j=L.Z)||void 0===j?void 0:null===(b=j.EAdminPermissions)||void 0===b?void 0:b.LOGIN,items:[{href:"/admin/donations",key:"Donations",title:"Donations"},{href:"/admin/donations/top-donors",key:"Donors",title:"Top Donors"}]},{href:"/admin/withdrawals",icon:"/assets/admin-v2/withdrawals-icon.png",title:"Withdrawals",permissions:null===(y=L.Z)||void 0===y?void 0:null===(N=y.EAdminPermissions)||void 0===N?void 0:N.LOGIN},{href:"/admin/blog",icon:"/assets/admin-v2/blog-icon.png",title:"Blog",permissions:null===(A=L.Z)||void 0===A?void 0:null===(w=A.EAdminPermissions)||void 0===w?void 0:w.LOGIN},{href:"/admin/success-story",icon:"/assets/admin-v2/success-story.svg",title:"Success Story",permissions:null===(E=L.Z)||void 0===E?void 0:null===(k=E.EAdminPermissions)||void 0===k?void 0:k.LOGIN},{href:"/admin/auction#",icon:"/assets/admin-v2/auction-icon.png",title:"Auction",permissions:null===(T=L.Z)||void 0===T?void 0:null===(I=T.EAdminPermissions)||void 0===I?void 0:I.LOGIN,items:[{href:"/admin/auction/setup",key:"Setup",title:"Setup"},{href:"/admin/auction/winner",key:"Winner",title:"Winner"}]},{href:"/admin/sponsorship#",icon:"/assets/admin-v2/sponsorShip-icon.svg",title:"Sponsorship",permissions:null===(D=L.Z)||void 0===D?void 0:null===(S=D.EAdminPermissions)||void 0===S?void 0:S.LOGIN,items:[{href:"/admin/sponsorship/sponsor",key:"Sponsor",title:"Sponsor"},{href:"/admin/sponsorship/advertisement",key:"Advertisement",title:"Advertisement"}]},{href:"/admin/user",icon:"/assets/admin-v2/users-icon.png",title:"KhmerCare Users",permissions:null===(C=L.Z)||void 0===C?void 0:null===(F=C.EAdminPermissions)||void 0===F?void 0:F.LOGIN},{href:"/admin/report",icon:"/assets/admin-v2/report.svg",title:"Report",permissions:null===(Z=L.Z)||void 0===Z?void 0:null===(P=Z.EAdminPermissions)||void 0===P?void 0:P.LOGIN},{href:"/admin/admin-user#",icon:"/assets/admin-v2/setting-icon.png",title:"Admin",permissions:null===(O=L.Z)||void 0===O?void 0:null===(R=O.EAdminPermissions)||void 0===R?void 0:R.LOGIN,items:[{href:"/admin/admin-user/admin-members",key:"Admin-Members",title:"Admin Members"},{href:"/admin/admin-user/organization",key:"Organization",title:"Organization"},{href:"/admin/admin-user/endorser",key:"Endorser",title:"Endorser"}]}];l.default={organization:M,admin:U}},3371:function(e,l,i){"use strict";i.d(l,{Z:function(){return m}});var n,t=i(85893),o=i(69983),s=i(66989),r=i(11163),a=i(40142),d=i(60487),u=i(12761),c=i(67294),v=i(48178),m=(n=e=>{let{children:l}=e,[i,n]=(0,c.useState)(!1),{organization:r}=v.default;return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:"d-flex",children:[(0,t.jsx)(s.Z,{isShow:i,closeSelf:()=>n(!1),navigation:r}),(0,t.jsxs)("div",{className:"bg-gray-100",id:"page-content-wrapper",children:[(0,t.jsx)(o.Z,{handleClickMenu:()=>n(!i)}),(0,t.jsx)("div",{className:"container-fluid p-3 admin-min-height",children:l})]})]})})},e=>{var l,i,o,s,c;let v=(0,r.useRouter)(),m=(0,a.oR)(),h=null==m?void 0:null===(i=m.getState())||void 0===i?void 0:null===(l=i.auth)||void 0===l?void 0:l.user,f=(0,a.v9)(e=>{var l;return null==e?void 0:null===(l=e._persist)||void 0===l?void 0:l.rehydrated}),p=()=>(0,t.jsx)(d.default,{isLoading:!0}),x=null==h?void 0:null===(c=h.permissions)||void 0===c?void 0:c.includes(null===(s=u.Z)||void 0===s?void 0:null===(o=s.EOrganizationPermissions)||void 0===o?void 0:o.LOGIN);return f?x&&h?(0,t.jsx)(n,{...e}):(null==v||v.push("/auth/admin/login"),(0,t.jsx)(p,{})):(0,t.jsx)(p,{})})},81482:function(e,l,i){"use strict";i.r(l),i.d(l,{default:function(){return ez}}
1);var n=i(85893),t=i(7900),o=i(67294),s=e=>{let{children:l}=e;return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("div",{className:"custom-background-card",children:l})})},r=i(60378),a=i(25675),d=i.n(a),u=i(53201),c=i(25518),v=i(86010),m=i(87536),h=i(50671);i(43929);var f=function(e){var l,i,t;let{story:o,register:s,control:r}=e,{errors:a}=(0,m.cl)({control:r});return(0,n.jsxs)("div",{className:"withdraw-wrapper mb-3",children:[(0,n.jsx)("p",{className:"web-text-black web-text-black__bold mb-0",children:"How much would you like to withdraw?"}),(0,n.jsxs)("div",{className:"withdraw-card w-100 d-flex",children:[(0,n.jsx)("div",{className:"withdraw-total-box center",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("p",{className:"web-text-gray__fz-10 mb-0",children:"Total Donated Amount"}),(0,n.jsx)("p",{className:"web-text-green__bold web-text-green__fz-20",children:h.default.currencyFormat(null==o?void 0:null===(l=o.summaryStoryTransaction)||void 0===l?void 0:l.subTotalAmount)})]})}),(0,n.jsx)("div",{className:"withdraw-amount-box py-3 px-4",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"web-text-gray__fz-10 mb-0",children:"Available Amount"}),(0,n.jsx)("p",{className:"web-text-black__bold web-text-black__fz-14 mb-2",children:h.default.currencyFormat(null==o?void 0:null===(i=o.summaryStoryTransaction)||void 0===i?void 0:i.totalAvailableAmount)}),(0,n.jsx)("p",{className:"web-text-gray__fz-10 mb-1",children:"Amount to Withdraw"}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"input-group custom-group-input",children:[(0,n.jsx)("span",{className:"input-group-text bg-white border-0 color-green fs-5",children:"USD $"}),(0,n.jsx)("input",{...s("withdrawAmountInput",{required:!0,validate:{lessThanAvailable:e=>{var l;return!(parseInt(e)>+(null==o?void 0:null===(l=o.summaryStoryTransaction)||void 0===l?void 0:l.totalAvailableAmount))&&0!=e}}}),type:"number",step:"0.01",min:"0",autoComplete:"off",className:"form-control fontSize20 color-green py-2 bg-white border-0 custom-donate-input"})]}),(null==a?void 0:null===(t=a.withdrawAmountInput)||void 0===t?void 0:t.type)==="lessThanAvailable"?(0,n.jsx)("p",{className:"invalid-feedback text-error d-block",children:"Amount is invalid."}):""]})]})})]}),(0,n.jsx)("p",{className:"web-text-black__bold web-text-black__fz-12 mb-1 mt-3",children:"Remarks"}),(0,n.jsx)("textarea",{className:"base-textarea",...s("remark",{required:!0}),rows:"5"})]})},p=i(62305),x=i(60486),g=i(31034),b=i(40142),j=i(55222),N=i(3682),y=i(51813),w=i(26576),A=i(83701);let k={bankId:"",bankAccountName:"",bankAccountNumber:""},E=e=>{let{banks:l}=e,{control:i,formState:{errors:t},setValue:o}=(0,m.Gc)();return(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-main mt-3 mb-0 web-fz-14",children:"Wtihdraw Fund Bank"}),(0,n.jsx)("div",{className:"mb-2",children:(0,n.jsx)(m.Qr,{control:i,name:"bankId",rules:{required:!0},render:e=>{let{field:{onChange:i,value:s,ref:r}}=e;return(0,n.jsx)(w.Z,{disabled:!1,label:"Bank",options:l,className:"mb-3",refs:r,value:s,onChange:e=>{i(e),o("bankAccountName",""),o("bankAccountNumber","")},isMulti:!1,isCreatable:!0,helperText:y.o.getErrorMessage(t,"bankId","Bank")})}})}),(0,n.jsx)("div",{className:"mb-2",children:(0,n.jsx)(m.Qr,{name:"bankAccountName",control:i,defaultValue:"",rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:o}}=e;return(0,n.jsx)(N.Z,{placeholder:"Account Name",ref:l,value:i,onChange:o,helperText:y.o.getErrorMessage(t,"bankAccountName","Account Name")})}})}),(0,n.jsx)("div",{className:"form-group mb-2",children:(0,n.jsx)(m.Qr,{name:"bankAccountNumber",control:i,defaultValue:"",rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:o}}=e;return(0,n.jsx)(N.Z,{placeholder:"Account Number",ref:l,value:i,onChange:o,helperText:y.o.getErrorMessage(t,"bankAccountNumber","Account Number")})}})})]})};var I=function(e){let{bankAccount:l}=e,i=(0,b.v9)(e=>{var l,i;return null==e?void 0:null===(i=e.admin)||void 0===i?void 0:null===(l=i.fundraisers
1)||void 0===l?void 0:l.banks}),t=(0,b.I0)(),[s,r]=(0,o.useState)(!1),a=(0,m.cI)({defaultValues:k});(0,o.useEffect)(()=>{t(A.default.getBanks())},[]);let d=()=>{r(!0),a.reset()},u=e=>{let l=null==i?void 0:i.find(l=>(null==l?void 0:l.value)===(null==e?void 0:e.bankId));e.image=null==l?void 0:l.image,t(A.default.setDefaultBank(e)),r(!1)};return(0,n.jsxs)("div",{className:"mb-1",children:[(0,n.jsxs)("div",{className:"d-flex justify-content-between",children:[(0,n.jsx)("h3",{className:"web-text-black__fz-12",children:"Account"}),(0,n.jsx)(j.Z,{condition:!s,children:(0,n.jsx)("button",{className:"button-link web-text-green__fz-12",onClick:()=>d(),children:"Edit"})})]}),l?(0,n.jsx)("div",{className:"payment-box",children:(0,n.jsx)("div",{className:"payment-name mb-2",children:(0,n.jsx)(p.Z,{logo:null==l?void 0:l.image,accountName:null==l?void 0:l.bankAccountName,accountNumber:null==l?void 0:l.bankAccountNumber,isAdmin:!0})})}):(0,n.jsx)(x.Z,{isAdmin:!0}),(0,n.jsx)(j.Z,{condition:s,children:(0,n.jsxs)(m.RV,{...a,children:[(0,n.jsx)(E,{banks:i}),(0,n.jsxs)("div",{className:"d-flex gap-2",children:[(0,n.jsx)("button",{className:"web-btn-primary",onClick:()=>a.handleSubmit(u)(),children:"Update"}),(0,n.jsx)("button",{className:"web-btn-secondary",onClick:()=>r(!1),children:"Cancel"})]})]})})]})},T=function(e){var l,i,t,o,s,r,a,d,u,c,v,m,f;let{story:p,withdrawAmount:x=0}=e,g=(null==p?void 0:null===(l=p.summaryStoryTransaction)||void 0===l?void 0:l.totalAvailableAmount)-x;return(0,n.jsxs)("div",{className:"web-white-card p-4",children:[(0,n.jsxs)("div",{className:"d-flex align-items-start mb-4",children:[(0,n.jsx)("div",{className:"me-3",children:(0,n.jsx)("img",{className:"base-image image-cover",src:null==p?void 0:null===(t=p.thumbnail)||void 0===t?void 0:null===(i=t.file)||void 0===i?void 0:i.url,width:85,height:85})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"web-text-black__fz-14 web-text-black__bold mb-2",children:null==p?void 0:p.title}),(0,n.jsxs)("div",{className:"d-flex align-items-center",children:[(0,n.jsx)("img",{className:"base-image-round",src:(null==p?void 0:null===(s=p.founder)||void 0===s?void 0:null===(o=s.profile)||void 0===o?void 0:o.url)||(null==p?void 0:null===(a=p.organization)||void 0===a?void 0:null===(r=a.logo)||void 0===r?void 0:r.url)||"/assets/icon/profile-empty.png",width:30,height:30}),(0,n.jsx)("div",{className:"ms-2",children:(0,n.jsx)("p",{className:"web-text-black__fz-12 web-text-black__bold mb-0",children:((null==p?void 0:null===(d=p.founder)||void 0===d?void 0:d.firstName)&&(null==p?void 0:null===(u=p.founder)||void 0===u?void 0:u.lastName)?(null==p?void 0:null===(c=p.founder)||void 0===c?void 0:c.firstName)+" "+(null==p?void 0:null===(v=p.founder)||void 0===v?void 0:v.lastName):null==p?void 0:null===(m=p.organization)||void 0===m?void 0:m.name)||"No Name"})})]})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"web-text-black__fz-12 text-bold mb-0",children:"Summary"}),(0,n.jsx)("hr",{className:"base-hr"}),(0,n.jsxs)("div",{className:"d-flex justify-content-between align-items-center",children:[(0,n.jsx)("p",{className:"web-text-gray__fz-12 mb-0",children:"Available Amount"}),(0,n.jsx)("span",{className:"web-text-black__fz-18 text-bold",children:h.default.currencyFormat(null==p?void 0:null===(f=p.summaryStoryTransaction)||void 0===f?void 0:f.totalAvailableAmount)})]}),(0,n.jsx)("hr",{className:"base-hr"}),(0,n.jsxs)("div",{className:"d-flex justify-content-between align-items-center",children:[(0,n.jsx)("p",{className:"web-text-gray__fz-12 mb-0",children:"Amount to Withdraw"}),(0,n.jsx)("span",{className:"web-text-green__fz-12 text-bold",children:h.default.currencyFormat(x)})]}),(0,n.jsx)("hr",{className:"base-hr"}),(0,n.jsxs)("div",{className:"d-flex justify-content-between align-items-center",children:[(0,n.jsx)("p",{className:"web-text-gray__fz-12 mb-0",children:"Remaining Amount"}),(0,n.jsx)("span",{className:"web-text-black__fz-12 text-bold",children:h.default.currencyFormat(g)||0})]})]})]})},S=i(42027),D=i(30381),F=i.n(D),C=function(e){var l,i,t,o;
1let{isShow:s,onCloseModal:r,story:a,withdrawAmount:d,bankAccount:c,onConfirm:v}=e;return(0,n.jsx)(u.default,{isShow:s,onClose:r,title:"Confirm your Withdrawal",children:(0,n.jsxs)(u.default.Body,{children:[(0,n.jsx)("div",{className:"web-white-card p-3",children:(0,n.jsxs)("div",{className:"d-flex align-items-start",children:[(0,n.jsx)("div",{className:"me-3",children:(0,n.jsx)("img",{className:"base-image image-cover",src:null==a?void 0:null===(i=a.thumbnail)||void 0===i?void 0:null===(l=i.file)||void 0===l?void 0:l.url,width:85,height:85,alt:"logo"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"web-text-black__fz-14 web-text-black__bold mb-2",children:null==a?void 0:a.title}),(0,n.jsxs)("span",{className:"web-text-gray__fz-10",children:["Posted:"," ",(0,n.jsx)("span",{className:"web-text-dark-gray",children:F()(null==a?void 0:a.createdAt).format("DD MMMM, YYYY")})]}),(0,n.jsxs)("p",{className:"web-text-gray__fz-12 mb-0",children:[(0,n.jsx)("span",{children:(0,n.jsx)("i",{className:"fa fa-clock-o","aria-hidden":"true"})})," ",(0,S.fp)(null==a?void 0:a.status)]})]})]})}),(0,n.jsxs)("div",{className:"web-white-card p-3 mt-2",children:[(0,n.jsx)("p",{className:"web-text-black__fz-12 text-bold mb-0",children:"Summary"}),(0,n.jsx)("hr",{className:"base-hr"}),(0,n.jsxs)("div",{className:"d-flex justify-content-between align-items-center",children:[(0,n.jsx)("p",{className:"web-text-gray__fz-12 mb-0",children:"Available Amount"}),(0,n.jsx)("span",{className:"web-text-black__fz-18 text-bold",children:h.default.currencyFormat(null==a?void 0:null===(t=a.summaryStoryTransaction)||void 0===t?void 0:t.totalAvailableAmount)})]}),(0,n.jsx)("hr",{className:"base-hr"}),(0,n.jsxs)("div",{className:"d-flex justify-content-between align-items-center",children:[(0,n.jsx)("p",{className:"web-text-gray__fz-12 mb-0",children:"Amount to Withdraw"}),(0,n.jsx)("span",{className:"web-text-green__fz-12 text-bold",children:h.default.currencyFormat(d)})]}),(0,n.jsx)("hr",{className:"base-hr"}),(0,n.jsxs)("div",{className:"d-flex justify-content-between align-items-center",children:[(0,n.jsx)("p",{className:"web-text-gray__fz-12 mb-0",children:"Remaining Amount"}),(0,n.jsx)("span",{className:"web-text-black__fz-12 text-bold",children:h.default.currencyFormat((null==a?void 0:null===(o=a.summaryStoryTransaction)||void 0===o?void 0:o.totalAvailableAmount)-d)})]})]}),(0,n.jsxs)("div",{className:"web-white-card p-3 mt-2",children:[(0,n.jsx)("p",{className:"web-text-black__fz-12 text-bold",children:"Account"}),(0,n.jsx)(j.Z,{condition:c,children:(0,n.jsx)(p.Z,{logo:null==c?void 0:c.image,accountName:null==c?void 0:c.bankAccountName,accountNumber:null==c?void 0:c.bankAccountNumber,isAdmin:!0})}),(0,n.jsx)(j.Z,{condition:!c,children:(0,n.jsx)(x.Z,{isAdmin:!0})})]}),(0,n.jsx)("div",{className:"d-flex align-items-center py-3",children:(0,n.jsx)("p",{className:"mb-0 web-text-black__fz-12",children:"By continuing, you agree with Terms and Privacy"})}),(0,n.jsx)("button",{className:"web-btn-primary w-100",onClick:v,children:"CONFIRM"})]})})},P=i(12761),Z=function(e){var l,i,t;let{isShow:o,onCloseModal:s,story:r,remainingAmount:a,onBackButton:c}=e,v=(0,b.v9)(e=>null==e?void 0:e.auth.user),m=null==v?void 0:null===(t=v.permissions)||void 0===t?void 0:t.includes(null===(i=P.Z)||void 0===i?void 0:null===(l=i.EOrganizationPermissions)||void 0===l?void 0:l.LOGIN);return(0,n.jsx)(u.default,{isShow:o,onClose:s,hasHeader:!1,children:(0,n.jsx)(u.default.Body,{hasHeader:!1,children:(0,n.jsxs)("div",{className:"modal-complete-withdraw",children:[(0,n.jsxs)("div",{className:"complete-block text-center",children:[(0,n.jsx)(d(),{src:"/assets/icon/money-icon.png",width:70,height:70,style:{maxWidth:"100%",height:"auto"},alt:"icon"}),(0,n.jsx)("p",{className:"web-text-white__fz-25 text-bold mb-0",children:m?"Withdraw Request Submitted":"Withdraw Completed."})]}),(0,n.jsxs)("div",{className:"p-4",children:[(0,n.jsx)("p",{className:"web-text-black__fz-10 mb-0",children:"Thank you for using KhmerCare to help support your cause!"}),m&&(0,n.jsx)("p",{className:"web-text-black__fz-10 web-text-black__bold-500 mb-4",children:"Your withdrawal is now under review. The KhmerCare team will c
1ontact you shortly."}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsxs)("div",{className:"col-12 col-sm-6",children:[(0,n.jsx)("p",{className:"web-text-black__fz-12 mb-0 text-bold",children:"Withdraw Amount"}),(0,n.jsx)("div",{className:"withdraw-box",children:h.default.currencyFormat(null==r?void 0:r.totalAmount)})]}),(0,n.jsxs)("div",{className:"col-12 col-sm-6",children:[(0,n.jsx)("p",{className:"web-text-black__fz-12 mb-0 text-bold",children:"Remaining Amount"}),(0,n.jsx)("div",{className:"remaining-box",children:h.default.currencyFormat(a)})]})]}),(0,n.jsxs)("div",{className:"web-white-card p-3 mt-4",children:[(0,n.jsx)("p",{className:"web-text-black__fz-12 text-bold mb-0",children:"Transaction Details"}),(0,n.jsx)("hr",{className:"base-hr"}),(0,n.jsxs)("div",{className:"d-flex justify-content-between align-items-center gap-2",children:[(0,n.jsx)("p",{className:"web-text-gray__fz-12 mb-0",children:"Trx ID"}),(0,n.jsx)("span",{className:"web-text-black__fz-18 text-bold",children:null==r?void 0:r.code})]}),(0,n.jsx)("hr",{className:"base-hr"}),(0,n.jsxs)("div",{className:"d-flex justify-content-between align-items-center gap-2",children:[(0,n.jsx)("p",{className:"web-text-gray__fz-12 mb-0",children:"Transaction Date"}),(0,n.jsx)("span",{className:"web-text-black__fz-12 text-bold",children:F()(null==r?void 0:r.createdAt).format("LLL")})]}),(0,n.jsx)("hr",{className:"base-hr"}),(0,n.jsxs)("div",{className:"d-flex justify-content-between align-items-center gap-2",children:[(0,n.jsx)("p",{className:"web-text-gray__fz-12 mb-0",children:"From Campaign"}),(0,n.jsx)("span",{className:"web-text-black__fz-12 text-bold",children:null==r?void 0:r.title})]}),(0,n.jsx)("hr",{className:"base-hr"}),(0,n.jsxs)("div",{className:"d-flex justify-content-between align-items-center gap-2",children:[(0,n.jsx)("p",{className:"web-text-gray__fz-12 mb-0",children:"To account"}),(0,n.jsxs)("span",{className:"web-text-black__fz-12 text-bold",children:[null==r?void 0:r.bankAccountName," ",(0,n.jsx)("span",{className:"web-text-gray",children:null==r?void 0:r.bankAccountNumber})]})]})]}),(0,n.jsxs)("button",{className:"back-home-btn__mt-50 bg-green text-white text-center",onClick:c,style:{marginLeft:"auto",marginRight:"auto"},children:[(0,n.jsx)(d(),{src:"/assets/admin-v2/fundraisers-icon.png",width:18,height:18,style:{maxWidth:"100%",height:"auto"}}),(0,n.jsx)("span",{children:"Campaigns"})]})]})]})})})},R=i(11163),O=i(21962),L=function(e){var l,i,t,s;let{isLoading:a}=e,[d,u]=(0,o.useState)(!1),[h,p]=(0,o.useState)(!1),[x,g]=(0,o.useState)(!1),[j,N]=(0,o.useState)([]),[y,w]=(0,o.useState)(),k=(0,b.v9)(e=>{var l;return null===(l=e.admin)||void 0===l?void 0:l.fundraisers}),E=(0,b.v9)(e=>{var l,i;return null==e?void 0:null===(i=e.admin)||void 0===i?void 0:null===(l=i.fundraisers
1)||void 0===l?void 0:l.defaultBank}),{storyDetail:S}=k,D=(0,b.I0)(),F=(0,R.useRouter)(),L=(0,b.v9)(e=>null==e?void 0:e.auth.user),M=null==L?void 0:null===(t=L.permissions)||void 0===t?void 0:t.includes(null===(i=P.Z)||void 0===i?void 0:null===(l=i.EOrganizationPermissions)||void 0===l?void 0:l.LOGIN),{register:U,handleSubmit:z,formState:{errors:q},control:B}=(0,m.cI)();(0,o.useEffect)(()=>{(null==S?void 0:S.id)&&D(A.default.getAdminBankByStoryId(null==S?void 0:S.id)).then(e=>{var l;if(null==e?void 0:e.data){let i=null==e?void 0:null===(l=e.data)||void 0===l?void 0:l.map(e=>new O.G(e));D(A.default.setDefaultBank(i[0]))}else D(A.default.setDefaultBank(null))})},[S]);let V=(0,m.qo)({control:B,name:"withdrawAmountInput"}),G=Number(V)||0,Q=(0,m.qo)({control:B,name:"remark"}),K=e=>{p(!0)},W=e=>{var l;let i=null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.checked;u(i)},Y=e=>{switch(e){case"CONFIRM":p(!1);break;case"COMPLETE":g(!1)}};return(0,n.jsxs)(n.Fragment,{children:[h&&(0,n.jsx)(C,{isShow:h,onCloseModal:()=>Y("CONFIRM"),story:S,withdrawAmount:G,bankAccount:E,onConfirm:()=>{let e=E||[],l=E?{bankAccountName:null==e?void 0:e.bankAccountName,bankAccountNumber:null==e?void 0:e.bankAccountNumber,bankId:null==e?void 0:e.bankId}:{},i=M?{}:{status:r.sr.COMPLETED},n={...l,...i,storyId:null==S?void 0:S.id,subTotalAmount:+G,remark:Q};D(A.default.createAdminWithdraw(n)).then(e=>{var l;w(null==e?void 0:null===(l=e.data)||void 0===l?void 0:l.data),p(!1),g(!0)})}}),x&&(0,n.jsx)(Z,{story:y,isShow:x,onClose:()=>Y("COMPLETE"),remainingAmount:(null==S?void 0:null===(s=S.summaryStoryTransaction)||void 0===s?void 0:s.totalAvailableAmount)-G,onBackButton:()=>{M?F.push("/organization/fundraisers"):F.push("/admin/fundraisers")}}),(0,n.jsxs)("div",{className:"row",children:[(0,n.jsxs)("div",{className:"col-sm-12 col-lg-7",children:[(0,n.jsx)(f,{story:S,register:U,control:B}),!a&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(I,{bankAccount:E}),(0,n.jsxs)("div",{className:"d-flex align-items-center py-3",children:[(0,n.jsx)(c.Z,{className:"me-2",checked:d,onChange:e=>W(e)}),(0,n.jsxs)("p",{className:"mb-0 web-text-black__fz-12 font-w-400",children:["By continuing, you agree to our",(0,n.jsx)("a",{href:"/admin/terms-service",as:"/admin/terms-service}",target:"_blank",children:(0,n.jsx)("span",{className:"web-text-green__fz-12",children:" Terms "})}),"and",(0,n.jsx)("a",{href:"/privacy-policy",target:"_blank",children:(0,n.jsx)("span",{className:"web-text-green__fz-12",children:" Privacy"})})]})]})]}),(0,n.jsx)("button",{onClick:()=>z(K)(),type:"submit",disabled:!d,className:(0,v.Z)("web-btn-primary w-100 mb-2",!d&&"disabled"),children:"Withdraw"})]}),(0,n.jsx)("div",{className:"col-sm-12 col-lg-5",children:(0,n.jsx)(T,{story:S,withdrawAmount:G})})]})]})},M=function(){var e;let[l,i]=(0,o.useState)(!1),t=(0,b.v9)(e=>{var l;return null===(l=e.admin)||void 0===l?void 0:l.fundraisers}),{storyDetail:s}=t,r=+(null==s?void 0:null===(e=s.summaryStoryTransaction)||void 0===e?void 0:e.subTotalAmount);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(u.default,{isShow:l,onClose:()=>{i(!1)},title:"Withdraw Donation Funds",size:"lg",children:[(0,n.jsx)(u.default.Body,{children:(0,n.jsx)(L,{})}),(0,n.jsx)(u.default.Footer,{className:"border-top-0"})]}),(0,n.jsx)("button",{disabled:0===r,className:(0,v.Z)("base-button btn-nobg text-white color-green bg-green border-green donate-now text-center ms-2",0===r&&"disabled"),onClick:()=>i(!0),children:"Withdraw"})]})},U=i(4905),z=i(67171),q=i(82090);let B=e=>{let{status:l}=e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(j.Z,{condition:l===r.sr.COMPLETED,children:(0,n.jsxs)("div",{children:[(0,n.jsx)("img",{src:"/assets/icon/withdraw-complete-icon.png"}),(0,n.jsx)("span",{className:"ms-1 withdraw-status-text",children:"Completed Withdrawals"})]})}),(0,n.jsx)(j.Z,{condition:l===r.sr.REJECTED,children:(0,n.jsxs)("div",{children:[(0,n.jsx)("img",{src:"/assets/icon/withdraw-reject-icon.png"}),(0,n.jsx)("span",{className:"ms-1 withdraw-status-text",children:"Reject Withdrawals"})]})}),(0,n.jsx)(j.Z,{condition:l===r.sr.PENDING,children:(0,n.jsxs)("div",{children:[(0,n.jsx)("img",{src:"/assets/icon/withdraw-pending-icon.png"}),(0,n.jsx)("span",{className:"ms-1 withdraw-status-text",children:"Pending Approval Withdrawals"})]})})]})},V=e=>{let{data:l}=e;return(0,n.jsxs)("div",{className:"withdraw-detail-container mt-3",children:[(0,n.jsx)("p",{className:"mb-2 web-text-black__fz-12 web-text-black__bold",children:"Transaction Details"}),(0,n.jsxs)("div",{className:"withdraw-trx-wrapper",children:[(0,n.jsx)("p",{children:"Trx ID"}),(0,n.jsx)("p",{children:null==l?void 0:l.code})]}),(0,n.jsxs)("div",{className:"withdraw-trx-wrapper",children:[(0,n.jsx)("p",{children:"Requested Date"}),(0,n.jsx)("p",{children:(0,U.cz)(null==l?void 0:l.createdAt,z.Q.ISO_DATE_WITH_TIME)})]}),(0,n.jsxs)("div",{className:"withdraw-trx-wrapper",children:[(0,n.jsx)("p",{children:"Remark"}),(0,n.jsx)("p",{children:null==l?void 0:l.remark})]}),(0,n.jsxs)("div",{className:"withdraw-trx-wrapper",children:[(0,n.jsx)("p",{children:"From Compaign"}),(0,n.jsx)("p",{children:null==l?void 0:l.storyTitle})]}),(0,n.jsxs)("div",{className:"withdraw-trx-wrapper",children:[(0,n.jsx)("p",{className:"mb-0",children:"To Account"}),(0,n.jsx)(j.Z,{condition:null==l?void 0:l.bankAccountName,children:(0,n.jsxs)("p",{className:"mb-0",children:[null==l?void 0:l.bankAccountName," ",(0,n.jsx)("span",{className:"web-text-gray",children:null==l?void 0:l.bankAccountNumber})]})}),(0,n.jsx)(j.Z,{condition:!(null==l?void 0:l.bankAccountName),children:(0,n.jsx)("p",{className:"mb-0",children:"I Don't have bank account."})})]}),(0,n.jsx)(j.Z,{condition:(null==l?void 0:l.status)===r.sr.COMPLETED||(null==l?void 0:l.status)===r.sr.REJECTED,children:(0,n.jsxs)("div",{className:"withdraw-trx-wrapper",children:[(0,n.jsx)("p",{children:(null==l?void 0:l.status)===r.sr.COMPLETED?"Approved Date":(null==l?void 0:l.status)===r.sr.REJECTED?"Rejected Date":""}),(0,n.jsx)("p",{children:(0,U.cz)(null==l?void 0:l.approvedAt,z.Q.ISO_DATE_WITH_TIME)})]})}),(0,n.jsx)(j.Z,{condition:(null==l?void 0:l.status)===r.sr.REJECTED,children:(0,n.jsxs)("div",{className:"withdraw-trx-wrapper",children:[(0,n.jsx)("p",{children:"Rejected Reason"}),(0,n.jsx)("p",{children:null==l?void 0:l.rejectReason})]})})]})},G=e=>{let{status:l,amount:i,activeKey:t,id:s}=e,[a,d]=(0,o.useState)(""),[u,c]=(0,o.useState)("");return(0,o.useEffect)(()=>
1{switch(l){case r.sr.COMPLETED:d("web-text-red"),c("Withdrawn");break;case r.sr.REJECTED:d("web-text-origin-black"),c("Request for Withdrawal");break;case r.sr.PENDING:d("web-text-yellow"),c("Request for Withdrawal")}},[l]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"d-flex gap-2 justify-content-between position-relative",children:[(0,n.jsx)("div",{className:"withdraw-icon",children:(0,n.jsx)("img",{src:"/assets/icon/withdraw-fund-icon.png",width:"16",height:"16"})}),(0,n.jsxs)("div",{className:"withdraw-text-block",children:[(0,n.jsxs)("div",{className:"d-flex justify-content-between",children:[(0,n.jsx)("p",{className:"web-text-black__fz-12 web-text-black__bold-500 mb-0",children:u||"Withdrawn"}),(0,n.jsxs)("p",{className:(0,v.Z)("mb-0 text-bold web-fz-12",a),children:["$",i]})]}),(0,n.jsx)("div",{className:"d-flex justify-content-between",children:(0,n.jsx)(B,{status:l})})]})]}),(0,n.jsxs)("div",{className:"btn-collapse",children:[(0,n.jsx)(j.Z,{condition:s!==t,children:(0,n.jsx)("i",{class:"fa fa-angle-down web-fz-16 web-text-green","aria-hidden":"true"})}),(0,n.jsx)(j.Z,{condition:s==t,children:(0,n.jsx)("i",{class:"fa fa-angle-up web-fz-16 web-text-green","aria-hidden":"true"})})]})]})};var Q=function(e){var l,i,t,s,r;let{story:a,withdrawHistories:d}=e,[u,c]=(0,o.useState)("0");return(0,n.jsxs)("div",{className:"withdraw-history-container",children:[(0,n.jsx)("div",{className:"web-white-card p-3",children:(0,n.jsxs)("div",{className:"d-flex align-items-start",children:[(0,n.jsx)("div",{className:"me-3",children:(0,n.jsx)("img",{className:"base-image image-cover",src:null==a?void 0:null===(i=a.thumbnail)||void 0===i?void 0:null===(l=i.file)||void 0===l?void 0:l.url,width:85,height:85,alt:"logo"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"web-text-black__fz-14 web-text-black__bold mb-2",children:null==a?void 0:a.title}),(0,n.jsxs)("span",{className:"web-text-gray__fz-10",children:["Posted Date:"," ",(0,n.jsx)("span",{className:"web-text-dark-gray",children:F()(null==a?void 0:a.createdAt).format("DD MMMM, YYYY")})]}),(0,n.jsxs)("p",{className:"web-text-gray__fz-12 mb-0",children:[(0,n.jsx)("span",{children:(0,n.jsx)("i",{className:"fa fa-clock-o","aria-hidden":"true"})})," ",(0,S.fp)(null==a?void 0:a.status)]})]})]})}),(0,n.jsxs)("div",{className:"d-flex justify-content-between gap-2 mt-3 mb-4",children:[(0,n.jsx)("div",{className:"bg-white w-100 center pt-2 pb-2 rounded",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("p",{className:"web-text-gray__fz-10 mb-0",children:"Avaliable Amount"}),(0,n.jsx)("p",{className:"mb-0 web-text-origin-black__bold web-text-origin-black__fz-20",children:h.default.currencyFormat(null==a?void 0:null===(t=a.summaryStoryTransaction)||void 0===t?void 0:t.totalAvailableAmount)})]})}),(0,n.jsx)("div",{className:"bg-white w-100 center pt-2 pb-2 rounded",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("p",{className:"web-text-gray__fz-10 mb-0",children:"Withdrawn Amount"}),(0,n.jsx)("p",{className:"mb-0 web-text-red__bold web-text-red__fz-20",children:h.default.currencyFormat(null==a?void 0:null===(s=a.summaryStoryTransaction)||void 0===s?void 0:s.totalWithdrawAmount)})]})})]}),(0,n.jsx)(j.Z,{condition:!0,children:null==d?void 0:null===(r=d.data)||void 0===r?void 0:r.map(e=>{var l;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"withdraw-date mb-3",children:(0,n.jsx)("p",{className:"mb-0",children:(0,U.cz)(null==e?void 0:e.withdrawDate,z.Q.ISO_DATE_NO_TIME)})}),(0,n.jsx)("div",{className:"withdraw-history-wrapper",children:(0,n.jsx)(q.Z,{activeKey:u,onSelect:e=>c(e),children:null==e?void 0:null===(l=e.withdrawTransactions)||void 0===l?void 0:l.map(e=>(0,n.jsxs)("div",{className:"withdraw-box",children:[(0,n.jsx)(q.Z.Toggle,{eventKey:null==e?void 0:e.id,children:(0,n.jsx)(G,{status:null==e?void 0:e.status,amount:null==e?void 0:e.withdrawAmount,activeKey:u,id:null==e?void 0:e.id})}),(0,n.jsx)(q.Z.Collapse,{eventKey:null==e?void 0:e.id,children:(0,n.jsx)(V,{data:e})})]}))})})]})})})]})},K=function(){let[e,l]=(0,o.useState)(!1),i=(0,b.I0)(),t=(0,R.useRouter)(),{id:s}=t.query,r=(0,b.v9)(e=>{var l,i;return null==e?void 0:null===(i=e.admin)||void 0===i?void 0:null===(l=i.fundraisers
1)||void 0===l?void 0:l.storyDetail}),a=(0,b.v9)(e=>{var l,i;return null==e?void 0:null===(i=e.admin)||void 0===i?void 0:null===(l=i.fundraisers)||void 0===l?void 0:l.withdrawHistories});return(0,o.useEffect)(()=>{s&&i(A.default.getWithdrawHistories(s))},[s]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(u.default,{isShow:e,onClose:()=>{l(!1)},title:"Withdraw History",children:[(0,n.jsx)(u.default.Body,{children:(0,n.jsx)(Q,{story:r,withdrawHistories:a})}),(0,n.jsx)(u.default.Footer,{className:"border-top-0"})]}),(0,n.jsx)("button",{className:(0,v.Z)("base-button admin-btn-outline-primary ms-2",!(null==a?void 0:a.total)&&"disabled"),onClick:()=>l(!0),disabled:!(null==a?void 0:a.total),children:"Withdraw History"})]})};let{isProduction:W}=h.default;var Y=e=>{let{isOrg:l=!1,isEdit:i,handelCancel:t,handleEdit:o,status:s,handleApprove:a,handleReject:u,onDraftSave:c,handleRequest:v,type:m="fundraiser",isOrganization:h,storyDetail:f}=e;return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"d-flex flex-column flex-md-row",children:["fundraiser"===m&&(0,n.jsxs)(n.Fragment,{children:["PENDING"===s?(0,n.jsx)("div",{className:"btn-btn-pending",children:(0,n.jsx)("button",{className:"custom-pending cursor-pointer bg-white",children:"! Pending"})}):s===r.sr.INACTIVE?(0,n.jsx)("div",{className:"btn-btn-pending",children:(0,n.jsx)("button",{className:"custom-pending cursor-pointer bg-white",children:"! Inactive"})}):"DRAFT"===s?(0,n.jsx)("div",{className:"btn-btn-pending",children:(0,n.jsx)("button",{className:"custom-pending cursor-pointer bg-white",children:"! Draft"})}):"ACTIVE"===s?(0,n.jsx)("div",{className:"btn-fund-active cursor-pointer",children:(0,n.jsxs)("button",{className:"custom-active d-flex cursor-pointer",disabled:!0,children:[(0,n.jsx)("div",{className:"custom-a-img",children:(0,n.jsx)(d(),{src:"/assets/admin-v2/green-circle.png",alt:"active",className:"img-fluid",width:15,height:15,style:{maxWidth:"100%",height:"auto"}})}),(0,n.jsx)("span",{className:"ms-2 c-mt",children:"Active"})]})}):s===r.sr.COMPLETED?(0,n.jsx)("div",{className:"btn-btn-complete",children:(0,n.jsx)("button",{className:"custom-complete d-flex cursor-pointer",disabled:!0,children:(0,n.jsxs)("div",{className:"text-nowrap d-inline-block status-completed",children:[(0,n.jsx)("i",{className:"fa fa-check me-2","aria-hidden":"true"}),"Completed"]})})}):"REJECTED"!==s||h?"":(0,n.jsx)("div",{className:"btn-btn-reject-off ms-0 ms-md-2 mt-2 mt-md-0",children:(0,n.jsx)("button",{className:"custom-reject-off cursor-pointer",children:"Reject"})}),s===r.sr.PENDING||s===r.sr.ACTIVE||s===r.sr.DRAFT||s===r.sr.INACTIVE?(0,n.jsxs)(n.Fragment,{children:[i&&(0,n.jsx)("div",{className:"btn-btn-reject ms-0 ms-md-2 mt-2 mt-md-0",children:(0,n.jsxs)("button",{onClick:t,className:"admin-btn-outline-primary ",children:[" ","Cancel"]})}),(0,n.jsx)("div",{className:"btn-btn-reject ms-0 ms-md-2 mt-2 mt-md-0",children:(0,n.jsxs)("button",{onClick:o,className:"admin-btn-outline-primary ",children:[" ",i?s===r.sr.DRAFT?"Submit":"Save":"Edit"]})}),i&&s===r.sr.DRAFT&&(0,n.jsx)("div",{className:"btn-btn-approve ms-0 ms-md-2 mt-2 mt-md-0",children:(0,n.jsxs)("button",{className:"custom-approve cursor-pointer",onClick:c,children:[" ","Save Draft"]})}),s===r.sr.PENDING&&!h&&(0,n.jsx)("div",{className:"btn-btn-reject ms-0 ms-md-2 mt-2 mt-md-0",children:(0,n.jsx)("button",{className:"custom-reject cursor-pointer",onClick:u,children:"Reject"})}),s===r.sr.PENDING&&!h&&(0,n.jsx)("div",{className:"btn-btn-approve ms-0 ms-md-2 mt-2 mt-md-0",children:(0,n.jsxs)("button",{className:"custom-approve cursor-pointer",onClick:a,children:[" ","Public Now"]})})]}):""]}),"withdrawal"===m&&("PENDING"===s?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"btn-btn-pending",children:(0,n.jsx)("button",{className:"custom-pending cursor-pointer bg-white",children:"! Pending"})}),(0,n.jsx)("div",{className:"btn-btn-reject ms-0 ms-md-2 mt-2 mt-md-0",children:(0,n.jsx)("button",{className:"custom-reject cursor-pointer",onClick:u,children:"Reject"})}),(0,n.jsx)("div",{className:"btn-btn-approve ms-0 ms-md-2 mt-2 mt-md-0",children:(0,n.jsx)("button",{className:"custom-approve cursor-pointer",onClick:a,children:"Approve"})})]}):s===r.sr.COMPLETED?(0,n.jsxs)("div",{children:[(0,n.jsx)("img",{src:"/assets/admin-v2/green-checked.png",className:"wd-img-complete",alt:"image"}),(0,n.jsx)("span",{className:"color-green",children:"Approved"})]}):"REJECTED"===s?(0,n.jsxs)("div",{children:[(0,n.jsx)("img",{src:"/assets/admin-v2/red-rejected.png",className:"wd-img-complete",alt:"image"}),(0,n.jsx)("span",{className:"text-danger",children:"Rejected"})]}
1):""),(0,n.jsx)(j.Z,{condition:s===r.sr.ACTIVE||s===r.sr.COMPLETED||s===r.sr.FAILED||s===r.sr.EXPIRED||s===r.sr.INACTIVE,children:(0,n.jsxs)("div",{className:"d-flex gap-1",children:[(0,n.jsx)(M,{}),(0,n.jsx)(K,{})]})})]})})},H=i(60487),$=i(76402),J=e=>{var l,i,t,o,s,r;let{data:a,summaryData:d,onExport:u,exportStatus:c=$.q4.INITIAL}=e,v=(null==a?void 0:null===(i=a.storyApprovals)||void 0===i?void 0:null===(l=i.find(e=>"APPROVED"===e.status))||void 0===l?void 0:l.createdAt)||"",m=(null==a?void 0:null===(t=a.summaryStoryTransaction)||void 0===t?void 0:t.subTotalAmount)||0,f=(null==a?void 0:a.totalTargetAmount)||0,p=(0,R.useRouter)();return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"card-body",children:[(0,n.jsx)("h3",{className:"mb-2",children:"Donation"}),(0,n.jsxs)("div",{className:"main-progress mb-4",children:[(0,n.jsxs)("div",{className:"d-flex justify-content-between",children:[(0,n.jsxs)("small",{children:["Raised:"," ",(0,n.jsx)("span",{className:"c-green-p fw-normal",children:h.default.currencyFormat(m)})]}),(0,n.jsxs)("small",{children:["Goal:"," ",(0,n.jsx)("span",{className:"c-p fw-normal",children:h.default.currencyFormat(f)})]})]}),(0,n.jsx)("div",{className:"progress mb-2 custom-cover",children:(0,n.jsx)("div",{className:"progress-bar bg-green m-0 custom-c",role:"progressbar",style:{width:m/f*100+"%"},"aria-valuenow":m,"aria-valuemin":"0","aria-valuemax":f})})]}),(0,n.jsx)("div",{className:"custom-summary-list",children:(null==d?void 0:null===(o=d.data)||void 0===o?void 0:o.length)>0?(0,n.jsx)(n.Fragment,{children:null==d?void 0:null===(s=d.data)||void 0===s?void 0:s.map((e,l)=>{var i,t,o,s,r,a,d,u;return(0,n.jsx)("div",{className:"border-list px-1 mb-2",children:(0,n.jsxs)("div",{className:"d-flex flex-wrap",children:[(0,n.jsxs)("div",{className:"d-flex",children:[(0,n.jsx)("div",{className:"custom-profile",children:(0,n.jsx)("img",{src:(null==e?void 0:null===(o=e.user)||void 0===o?void 0:null===(t=o.profile)||void 0===t?void 0:null===(i=t.profileImage)||void 0===i?void 0:i.url)||"/assets/icon/profile-empty.png",className:"img-fluid custom-img"})}),(0,n.jsxs)("div",{className:"d-flex flex-column ms-2",children:[(0,n.jsx)("span",{className:"custom-name",children:(null==e?void 0:null===(r=e.user)||void 0===r?void 0:null===(s=r.profile)||void 0===s?void 0:s.displayName)||"No Name"}),(0,n.jsx)("small",{className:"small-time",children:F()(null==e?void 0:e.createdAt).startOf("hour").fromNow()||"-"})]})]}),(0,n.jsxs)("div",{className:"ms-auto d-flex flex-column align-items-end mt-1",children:[(0,n.jsxs)("span",{className:"custom-amount",children:["$",(null==e?void 0:e.subTotalAmount)||0]}),(0,n.jsx)("span",{className:"custom-amount text-secondary",children:(null==e?void 0:null===(u=e.storyTransactionPayments)||void 0===u?void 0:null===(d=u[0])||void 0===d?void 0:null===(a=d.paymentMethod)||void 0===a?void 0:a.name)||""})]})]})},l)})}):(0,n.jsx)("p",{className:"no-data-summary",children:"No Data"})}),(null==d?void 0:null===(r=d.data)||void 0===r?void 0:r.length)?(0,n.jsxs)("div",{className:"text-center mt-1",children:[(0,n.jsx)("button",{type:"button",onClick:()=>p.push("".concat(null==a?void 0:a.id,"/donations")),className:"btn-nobg bg-white border-green color-green py-2 px-3 rounded-5 my-2 mx-2",children:"View All"}),(0,n.jsxs)("button",{type:"button",onClick:u,className:"btn-nobg bg-white border-green color-green py-2 px-3 rounded-5 my-2 mx-2 position-relative",style:{cursor:c===$.q4.PENDING&&"no-drop"},disabled:c===$.q4.PENDING,children:["Download Report",c===$.q4.PENDING&&(0,n.jsx)(H.default,{isLoading:!0,size:"sm",style:{inset:0,width:"100%",height:"100%",borderRadius:10},position:"absolute"})]})]}):"",(0,n.jsx)("div",{className:"custom-border-b mt-2"}),(0,n.jsx)("h3",{className:"my-3",children:"Details"}),(0,n.jsxs)("div",{className:"details",children:[(0,n.jsx)("p",{className:"mt-4 c-bottom",children:"Approved"}),(0,n.jsx)("h4",{children:v?F()(v).format("lll"):"-"}),(0,n.jsx)("p",{className:"mt-4 c-bottom",children:"Start Date"}),(0,n.jsx)("h4",{children:F()(null==a?void 0:a.startedAt).format("lll")||"-"}),(0,n.jsx)("p",{className:"mt-4 c-bottom",children:"End Date"}),(0,n.jsx)("h4",{children:F()(null==a?void 0:a.endedAt).format("lll")||"-"}),(0,n.jsx)("p",{className:"mt-4 c-bottom",children:"Last Update"}),(0,n.jsx)("h4",{children:F()(null==a?void 0:a.updatedAt).format("lll")||"-"})]})]})})},X=i(86258),ee=i(98795),el=i(51532),ei=i(73930),en=i(67555),et=i.n(en),eo=i(70385),es=i(42858),er=i(79114),ea=e=>{var l,i,t,s,a,d,u,c,v,h,f,p,x,g,b,j,A,k,E,I,T,S,D,F,C,P,Z,R,O,L,M;let{data:U,watch:z,control:q,errors:B,disabled:V,banks:G,isEdit:Q,setValue:K,raiseFund:W,setRaiseFund:Y,reset:H,isDetail:$=!1}=e,[J,en]=(0,o.useState)(),ea=z("userProfile.address"),ed=z("userProfile.country"),eu=z("userProfile.location"),ec=z("userProfile.latitude"),ev=z("userProfile.longitude"),em=z("userProfile.province"),eh=z("userProfile.bankId");(0,o.useEffect)(()=>{en({latitude:ec,longitude:ev,location:eu,province:em,address:ea,country:ed})},[ea]);let ef=e=>{K("userProfile.address",null==e?void 0:e.address),K("userProfile.latitude",null==e?void 0:e.latitude),K("userProfile.longitude",null==e?void 0:e.longitude),K("userProfile.province",null==e?void 0:e.province),K("userProfile.location",null==e?void 0:e.location),K("userProfile.country",e.country),Y({...W,userProfile:{...W.userProfile,...e}})}
1,ep=e=>{let{name:l,field:i}=e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"mt-4 c-bottom",children:l}),(0,n.jsx)("h4",{children:i||"-"})]})},ex=[{value:"ID",label:"Identity"},{value:"PASSPORT",label:"Passport"}],eg=(null==U?void 0:U.organizationId)!==null,eb=z("userProfile.identifierType");return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"card-body-binfo",children:[(0,n.jsx)("h3",{children:"Phone Number"}),Q&&!eg?(0,n.jsx)("div",{className:"custom-code-number",children:(0,n.jsxs)("div",{className:"row g-0",children:[(0,n.jsx)("div",{className:" col-4 col-sm-3 col-md-3",children:(0,n.jsx)("div",{className:"form-group",style:{borderBottom:"1px solid #e5e5e5",borderTop:"1px solid #e5e5e5",borderLeft:"1px solid #e5e5e5",borderRadius:"6px"},children:(0,n.jsx)(et(),{value:null==W?void 0:W.countryCode,country:"kh",showDropdown:!1,disableDropdown:!1,prefix:"+",onChange:e=>{Y({...W,countryCode:e})},countryCodeEditable:!1})})}),(0,n.jsx)("div",{className:"col-8 col-sm-9 col-md-9",children:(0,n.jsx)(m.Qr,{name:"phoneNumber",control:q,rules:{required:!0,validate:e=>{let l="+".concat(null==W?void 0:W.countryCode).concat(e),i=(0,es.AI)(l);return i.isValid}},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(eo.Z,{placeholder:"Phone Number",ref:l,customStyle:{borderRight:"1px solid #e5e5e5",borderBottom:"1px solid #e5e5e5",borderTop:"1px solid #e5e5e5",borderRadius:"7px"},value:i,className:"border",onChange:e=>{var l;let i=null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value;(""===i||/^[0-9\b]+$/.test(i))&&(t(i),Y({...W,phoneNumber:i}))},helperText:y.o.getErrorMessage(B,"phoneNumber","Phone Number","Invalid Phone Number")})}})})]})}):(0,n.jsxs)("div",{className:"c-body",children:[(0,n.jsxs)("div",{className:"d-flex",children:[(0,n.jsx)("div",{className:"custom-phone",children:(0,n.jsx)("img",{src:"/assets/admin-v2/kh-phone.png",alt:"phone",className:"img-fluid"})}),(0,n.jsx)("h4",{className:"ms-2 mt-ph",children:eg?null==U?void 0:null===(l=U.organization)||void 0===l?void 0:l.contactPersonNumber:null==U?void 0:null===(i=U.founder)||void 0===i?void 0:i.phone})]}),(0,n.jsx)("div",{className:"custom-border-b mt-4"})]}),(0,n.jsx)("h3",{className:"mt-4",children:"User Profile"}),Q&&!eg?(0,n.jsx)("div",{className:"form-group my-4",children:(0,n.jsx)(m.Qr,{name:"userProfile.profileId",control:q,rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(ee.Z,{placeholder:"Upload Image",src:""===i?"/assets/default-icon.svg":i,aspectWidth:1,aspectHeight:1,className:"m-auto",onChange:e=>{Y({...W,userProfile:{...null==W?void 0:W.userProfile,profileId:null==e?void 0:e.id,profileUrl:null==e?void 0:e.fileUrl}}),t(null==e?void 0:e.fileUrl)},helperText:y.o.getErrorMessage(B,"userProfile.profileId","Profile is required")})}})}):(0,n.jsx)("div",{className:"custom-basic-profile-img my-4",children:(0,n.jsx)("img",{src:eg?null==U?void 0:null===(s=U.organization)||void 0===s?void 0:null===(t=s.logo)||void 0===t?void 0:t.url:(null==U?void 0:null===(d=U.founder)||void 0===d?void 0:null===(a=d.profile)||void 0===a?void 0:a.url)||"/assets/icon/profile-empty.png",alt:"profile",className:"img-fluid img-profile-basic"})}),Q&&!eg?(0,n.jsxs)("div",{className:"d-flex my-2",children:[(0,n.jsx)("div",{className:"col-6",children:(0,n.jsx)(m.Qr,{control:q,defaultValue:"",name:"userProfile.firstName",rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(N.Z,{placeholder:"First Name",refs:l,value:i,disabled:V,showLabel:$,isDetail:$,onChange:e=>{var l,i;Y({...W,userProfile:{...null==W?void 0:W.userProfile,firstName:null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value}}),t(null==e?void 0:null===(i=e.target)||void 0===i?void 0:i.value)},helperText:y.o.getErrorMessage(B,"userProfile.firstName","First Name")})}})}),(0,n.jsx)("div",{className:"col-6 ms-2",children:(0,n.jsx)(m.Qr,{control:q,defaultValue:"",name:"userProfile.lastName",rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(N.Z,{placeholder:"Last Name",refs:l,value:i,disabled:V,showLabel:$,isDetail:$,onChange:e=>{var l,i;Y({...W,userProfile:{...null==W?void 0:W.userProfile,lastName:null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value}}),t(null==e?void 0:null===(i=e.target)||void 0===i?void 0:i.value)},helperText:y.o.getErrorMessage(B,"userProfile.lastName","Last Name")}
1)}})})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"c-bottom",children:"Profile Name"}),eg?(0,n.jsx)("h4",{children:(null==U?void 0:null===(u=U.organization)||void 0===u?void 0:u.name)||"No Name"}):(0,n.jsxs)("h4",{children:[(null==U?void 0:null===(c=U.founder)||void 0===c?void 0:c.firstName)||"No"," ",(null==U?void 0:null===(v=U.founder)||void 0===v?void 0:v.lastName)||"Name"]})]}),(0,n.jsxs)("div",{children:[Q&&!eg&&(0,n.jsx)(m.Qr,{name:"userProfile.identifierType",control:q,defaultValue:"",rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(w.Z,{refs:l,placeholder:"Document Type",onChange:e=>{t(e),Y({...W,userProfile:{...null==W?void 0:W.userProfile,identifierType:e}})},value:i,options:ex,disabled:V,showLabel:$,isDetail:$,className:"mb-2",helperText:y.o.getErrorMessage(B,"userProfile.identifierType","Document Type")})}}),Q&&!eg?(0,n.jsx)(m.Qr,{name:"userProfile.identifierNumber",control:q,defaultValue:"",rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(N.Z,{placeholder:"ID / Passport Number",className:"mb-2",onChange:e=>{var l,i;t(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value),Y({...W,userProfile:{...null==W?void 0:W.userProfile,identifierNumber:null==e?void 0:null===(i=e.target)||void 0===i?void 0:i.value}})},value:i,refs:l,disabled:V,showLabel:$,isDetail:$,helperText:y.o.getErrorMessage(B,"userProfile.identifierNumber",eb===r.sr.DOCS_ID?"ID":"Passport Number")})}}):!eg&&(0,n.jsx)(ep,{name:"ID / Passport Number",field:null==U?void 0:null===(h=U.founder)||void 0===h?void 0:h.identifierNumber})]}),Q&&!eg?eb===r.sr.DOCS_ID?(0,n.jsxs)("div",{className:"d-flex my-4",children:[(0,n.jsx)("div",{className:"custom-id-card",children:(0,n.jsx)(m.Qr,{name:"userProfile.frontId",control:q,rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(X.Z,{refs:l,placeholder:"Upload Front ID Card",src:i,type:ei.U.RECTANGLE,aspectWidth:1,aspectHeight:1,onChange:e=>{Y({...W,userProfile:{...null==W?void 0:W.userProfile,frontId:null==e?void 0:e.id,frontUrl:null==e?void 0:e.fileUrl}}),t(null==e?void 0:e.fileUrl)},helperText:y.o.getErrorMessage(B,"userProfile.frontId","Front ID")})}})}),(0,n.jsx)("div",{className:"custom-id-card ms-2",children:(0,n.jsx)(m.Qr,{name:"userProfile.backId",defaultValue:"",control:q,rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(X.Z,{refs:l,placeholder:"Upload Back ID Card",src:i,type:ei.U.RECTANGLE,aspectWidth:1,aspectHeight:1,id:"upload-back-site",onChange:e=>{Y({...W,userProfile:{...null==W?void 0:W.userProfile,backId:null==e?void 0:e.id,backUrl:null==e?void 0:e.fileUrl}}),t(null==e?void 0:e.fileUrl)},helperText:y.o.getErrorMessage(B,"userProfile.frontId","Back ID")})}})})]}):(0,n.jsxs)("div",{className:"d-flex my-4",children:[(0,n.jsx)("div",{className:"custom-id-card",children:(0,n.jsx)(m.Qr,{name:"userProfile.frontId",control:q,rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(X.Z,{refs:l,placeholder:"Upload Passport",src:i,type:ei.U.RECTANGLE,aspectWidth:1,aspectHeight:1,onChange:e=>{Y({...W,userProfile:{...null==W?void 0:W.userProfile,frontId:null==e?void 0:e.id,frontUrl:null==e?void 0:e.fileUrl}}),t(null==e?void 0:e.fileUrl)},helperText:y.o.getErrorMessage(B,"userProfile.frontId","Passport")})}})}),(0,n.jsx)("div",{className:"custom-id-card ms-2 border-0"})]}):!eg&&(0,n.jsx)("div",{className:"d-flex my-4",children:(null==U?void 0:null===(f=U.founder)||void 0===f?void 0:f.identifierType)==="PASSPORT"?(0,n.jsx)("div",{div:!0,className:"custom-id-card",children:(null==U?void 0:null===(x=U.founder)||void 0===x?void 0:null===(p=x.front)||void 0===p?void 0:p.url)?(0,n.jsx)("img",{src:null==U?void 0:null===(b=U.founder)||void 0===b?void 0:null===(g=b.front)||void 0===g?void 0:g.url,alt:"profile",className:"img-fluid img-id-card"}):(0,n.jsx)("span",{className:"passport-img",children:"Front Image"})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"custom-id-card",children:(null==U?void 0:null===(A=U.founder)||void 0===A?void 0:null===(j=A.front)||void 0===j?void 0:j.url)?(0,n.jsx)("img",{src:null==U?void 0:null===(E=U.founder)||void 0===E?void 0:null===(k=E.front)||void 0===k?void 0:k.url,alt:"profile",className:"img-fluid img-id-card"}):(0,n.jsx)("span",{className:"passport-img",children:"Front Image"})}),(0,n.jsx)("div",{className:"custom-id-card ms-2",children:(null==U?void 0:null===(T=U.founder)||void 0===T?void 0:null===(I=T.back)||void 0===I?void 0:I.url)?(0,n.jsx)("img",{src:null==U?void 0:null===(D=U.founder)||void 0===D?void 0:null===(S=D.back)||void 0===S?void 0:S.url,alt:"profile",className:"img-fluid img-id-card"}):(0,n.jsx)("span",{className:"passport-img",children:"Back Image"})})]})}),(0,n.jsx)("div",{children:Q&&!eg?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(m.Qr,{name:"userProfile.address",control:q,defaultValue:"",rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(el.Z,{placeholder:"Address",className:"mb-2",onChange:e=>{var l;t(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value),Y({...W,userProfile:{...W.userProfile,address:ea}})},value:i,refs:l,disabled:V,showLabel:$,isDetail:$,getMapLocation:ef,mapLocationData:J,helperText:y.o.getErrorMessage(B,"userProfile.address","Address")})}}),(0,n.jsx)("div",{className:"form-group mb-2",children:(0,n.jsx)(m.Qr,{name:"userProfile.province",control:q,rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(w.Z,{refs:l,placeholder:"City / Province",onChange:e=>{Y({...W,province:{...W.userProfile,value:e}}),t(e)},value:i,options:er.D,className:"mb-2",helperText:y.o.getErrorMessage(B,"userProfile.province","City / Province")})}})})]}):(0,n.jsx)(ep,{name:"Address",field:eg?null==U?void 0:null===(F=U.organization)||void 0===F?void 0:F.address:null==U?void 0:null===(C=U.founder)||void 0===C?void 0:C.address})}),eg&&(0,n.jsx)(ep,{name:"Email",field:null==U?void 0:null===(P=U.organization)||void 0===P?void 0:P.contactPersonEmail}),!eg&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"custom-border-b mt-4"}),(0,n.jsx)("h3",{className:"my-4",children:"Bank Account Information"})]}),(0,n.jsxs)("div",{children:[Q&&!eg?(0,n.jsx)(m.Qr,{name:"userProfile.bankId",control:q,rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(w.Z,{refs:l,placeholder:"Bank",options:G,onChange:e=>{t(e),Y({...W,userProfile:{...null==W?void 0:W.userProfile,bankId:e}})},value:i,disabled:V,showLabel:$,isDetail:$,className:"mb-2",helperText:y.o.getErrorMessage(B,"userProfile.bankId","Bank")})}}):!eg&&(null==U?void 0:null===(Z=U.founder)||void 0===Z?void 0:Z.bankId)!==null&&(0,n.jsxs)("div",{className:"d-flex",children:[(0,n.jsx)("h4",{children:(null==U?void 0:null===(O=U.founder)||void 0===O?void 0:null===(R=O.bank)||void 0===R?void 0:R.name)||"-"}),(0,n.jsx)("div",{className:"custom-aba aba-left",children:(0,n.jsx)("img",{src:"/assets/admin-v2/aba.png",alt:"aba",className:"img-fluid"})})]}),Q&&!eg?"NO_BANK"!==eh&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(m.Qr,{name:"userProfile.bankAccountName",control:q,defaultValue:"",rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(N.Z,{placeholder:"Account Name",className:"mb-2",onChange:e=>{t(e.target.value),Y({...W,userProfile:{...null==W?void 0:W.userProfile,bankAccountName:e.target.value}})},value:i,refs:l,disabled:V,showLabel:$,isDetail:$,helperText:y.o.getErrorMessage(B,"userProfile.bankAccountName","Bank Account Name")}
1)}}),(0,n.jsx)(m.Qr,{name:"userProfile.bankAccountNumber",control:q,defaultValue:"",rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(N.Z,{placeholder:"Account Number",className:"mb-2",onChange:e=>{t(e.target.value),Y({...W,userProfile:{...null==W?void 0:W.userProfile,bankAccountNumber:e.target.value}})},value:i,refs:l,disabled:V,showLabel:$,isDetail:$,helperText:y.o.getErrorMessage(B,"userProfile.bankAccountNumber","Bank Account Number")})}})]}):!eg&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ep,{name:"Account Name",field:null==U?void 0:null===(L=U.founder)||void 0===L?void 0:L.bankAccountName}),(0,n.jsx)(ep,{name:"Account Number",field:null==U?void 0:null===(M=U.founder)||void 0===M?void 0:M.bankAccountNumber})]})]})]})})},ed=i(22004),eu=i(80872),ec=i(25827),ev=i(76529),em=i(84530),eh=i(28280),ef=i(16653),ep=i(10055),ex=i(41664),eg=i.n(ex),eb=i(26798),ej=i(98360),eN=i(65953);i(5152);var ey=function(e){let{className:l,style:i,helperText:t,onChange:o,value:s,isEdit:r,placeholder:a,showLabel:d=!1,isRequired:u=!1,isDetail:c=!1}=e;return(0,n.jsxs)("div",{className:l,style:i,children:[d&&(0,n.jsx)("p",{className:"admin-form-label",children:a}),c&&r?(0,n.jsx)(ep.Z,{label:"Description KH",value:s,placeholder:a||" Your full story",onChange:o,helperText:t}):(0,n.jsx)("h4",{dangerouslySetInnerHTML:{__html:s||"-"}})]})},ew=i(50355),eA=(0,b.$j)(null,e=>{let{googleTranslate:l}=ej.default;return{googleTranslate:(i,n)=>e(l(i,n))}})(e=>{var l,i,t,s,a,d,u,c;let{data:v,watch:h,control:f,errors:p,disabled:x,isEdit:g,setValue:b,raiseFund:j,setRaiseFund:A,googleTranslate:k,setStartDate:E,setEndDate:I,isDetail:T=!1,categories:S,languagesCount:D}=e,{fields:C,append:P,remove:Z}=(0,m.Dq)({control:f,name:"storyReferences"}),{fields:R}=(0,m.Dq)({control:f,name:"locales"}),O=(null==v?void 0:null===(l=v.video)||void 0===l?void 0:l.url)||"No YouTube Link",L=(null==v?void 0:null===(s=v.storyFiles)||void 0===s?void 0:null===(t=s.find(e=>(null==e?void 0:e.type)==="VIDEO"))||void 0===t?void 0:null===(i=t.file)||void 0===i?void 0:i.url)||"No Video",M=(null==v?void 0:null===(a=v.storyFiles)||void 0===a?void 0:a.filter(e=>(null==e?void 0:e.type)==="THUMBNAIL").map(e=>{var l;return null==e?void 0:null===(l=e.file)||void 0===l?void 0:l.url}))||"No Thumbnail",U=h("videoFiles"),z=h("startedAt");h("endedAt");let q=h("address"),B=h("location"),V=h("latitude"),G=h("longitude"),Q=h("province"),K=h("storyReferences");h("description");let W=h("locales"),[Y,H]=(0,o.useState)(),[$,J]=(0,o.useState)(!0),[X,ee]=(0,o.useState)(!0),[ei,en]=(0,o.useState)(!0);(0,o.useEffect)(()=>{H({latitude:V,longitude:G,location:B,province:Q,address:q})},[q]);let et=e=>{b("address",null==e?void 0:e.address),b("latitude",null==e?void 0:e.latitude),b("longitude",null==e?void 0:e.longitude),b("province",null==e?void 0:e.province),b("location",null==e?void 0:e.location),A({...j,...e})},eo=e=>{let l=_.filter(null==j?void 0:j.storyFiles,l=>l.fileId!=e);A({...j,storyFiles:l})},es=e=>{Z(e)},ea=e=>{let l=_.isEmpty(null==j?void 0:j.storyFiles);if(l)null==j||j.storyFiles.push({fileId:null==e?void 0:e.id,type:"THUMBNAIL",sequence:0,url:null==e?void 0:e.fileUrl});else{let l=_.lastIndexOf(null==j?void 0:j.storyFiles)-1;null==j||j.storyFiles.push({fileId:null==e?void 0:e.id,type:"THUMBNAIL",sequence:l+1,url:null==e?void 0:e.fileUrl})}},ep=async e=>{var l,i;let n,t;let o=(0,eN.pK)(e,null==j?void 0:j.locales);if(!_.isEmpty(o)){if((0,eN.iw)(o,D))t=(0,eN.eL)(o[1].languageId,D),n=(0,eN.o3)(o[1].languageId,null==j?void 0:j.locales);else{let o=(0,eN.EG)(e,null==j?void 0:j.locales);_.isEmpty(o)||(t=(0,eN.eL)(null==o?void 0:null===(l=o[0])||void 0===l?void 0:l.languageId,D),n=(0,eN.o3)(null==o?void 0:null===(i=o[0])||void 0===i?void 0:i.languageId,null==j?void 0:j.locales))}let s={languageCode:t,text:o[0][e]};k(s,"Too many requests, please try again in 30 seconds").then(l=>{var i;let{data:t}=l,o={...j};if(o.locales[n][e]=null==t?void 0:t[0],1===n){let l=null!==(i=null==t?void 0:t[0])&&void 0!==i?i:"",s=l.substring(0,50);b("locales.".concat(n,".").concat(e),s,{shouldValidate:!0}),A(o)}else b("locales.".concat(n,".").concat(e),null==t?void 0:t[0],{shouldValidate:!0}),A(o)})}};return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"card-body",children:[(0,n.jsx)("h3",{children:"Story"}),(0,n.jsxs)("div",{children:[(0,n.jsx)(eb.x,{inputTittle:"Title",disabled:!g&&$,checked:$,onChecked:e=>{var l;return J(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.checked)},children:null==R?void 0:R.map((e,l)=>{var i;return(0,n.jsxs)("div",{className:"translate-form",children:[(0,n.jsx)(m.Qr,{name:"locales.".concat(l,".title"),control:f,rules:{required:(null===(i=(0,eN.pK)("title",j?.locales))||void 0===i?void 0:i.length)<=0},render:i=>{let{field:{ref:t,value:o,onChange:s}}=i;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(N.Z,{placeholder:null==e?void 0:e.code,className:"mb-2",onChange:l=>{var i;let n=null==l?void 0:null===(i=l.target)||void 0===i?void 0:i.value;(null==e?void 0:e.code)===ew.uZ.ENGLISH?s(n.substring(0,50)):s(n),A({...j,locales:W})},value:o,refs:t,disabled:x,showLabel:T,isDetail:T,helperText:y.o.getErrorMessage(p,"locales.".concat(l,".title"),"Title")}),(null==e?void 0:e.code)===ew.uZ.ENGLISH?(0,n.jsxs)("span",{className:"d-flex justify-content-end me-2",children:[null==o?void 0:o.length,"/",50]}):null]})}}),(null==D?void 0:D.length)!==l+1&&(0,n.jsx)(eb.C,{isAutoCheck:!!g&&$,onTranslate:()=>ep("title")})]},null==e?void 0:e.id)})}),(0,n.jsx)(m.Qr,{name:"categoryIds",control:f,rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(w.Z,{refs:l,placeholder:"Category",onChange:e=>{t(e),A({...j,categoryIds:e})},value:i,options:S,disabled:x,showLabel:T,isDetail:T,className:"mb-2",helperText:y.o.getErrorMessage(p,"categoryIds","Category")})}}),(0,n.jsx)(m.Qr,{name:"address",control:f,defaultValue:"",rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(el.Z,{placeholder:"Address",className:"mb-2",onChange:e=>{var l,i;t(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value),A({...j,address:null==e?void 0:null===(i=e.target)||void 0===i?void 0:i.value})},value:i,refs:l,disabled:x,showLabel:T,isDetail:T,getMapLocation:et,mapLocationData:Y,helperText:y.o.getErrorMessage(p,"address","Address")})}}),g&&(0,n.jsx)("div",{className:"form-group mb-2",children:(0,n.jsx)(m.Qr,{name:"province",control:f,rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(w.Z,{refs:l,placeholder:"City / Province",onChange:e=>{A({...j,province:e}),t(e)},value:i,options:er.D,disabled:x,showLabel:T,isDetail:T,className:"mb-2",helperText:y.o.getErrorMessage(p,"province","City / Province")})}})}),(0,n.jsx)(eb.x,{inputTittle:"Description",disabled:!g,checked:X,onChecked:e=>{var l;return ee(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.checked)},children:null==R?void 0:R.map((e,l)=>{var i;return(0,n.jsxs)("div",{className:"translate-form",children:[(0,n.jsx)(m.Qr,{name:"locales.".concat(l,".description"),control:f,rules:{required:(null===(i=(0,eN.pK)("description",j?.locales))||void 0===i?void 0:i.length)<=0},render:l=>{let{field:{ref:i,value:t,onChange:o}}=l;return(0,n.jsx)(ey,{showLabel:T,isDetail:T,disabled:x,isEdit:g,label:null==e?void 0:e.code,isRequired:!0,value:t,placeholder:null==e?void 0:e.code,onChange:e=>{o(e),A({...j,locales:W})}})}}),(null==D?void 0:D.length)!==l+1&&(0,n.jsx)(eb.C,{isAutoCheck:!!g&&X,onTranslate:()=>ep("description")})]},null==e?void 0:e.id)})}),(0,n.jsxs)("div",{className:"mb-3",children:[(0,n.jsx)("h3",{className:"mt-4",children:"Reference Link"}),g?(0,n.jsxs)(n.Fragment,{children:[null==C?void 0:C.map((e,l)=>(0,n.jsxs)("div",{className:"position-relative",children:[(0,n.jsx)("div",{className:"form-group mb-2 ",children:(0,n.jsx)(m.Qr,{render:e=>{let{field:{ref:i,value:t,onChange:o}}=e;return(0,n.jsx)(N.Z,{placeholder:"Reference Link",disabled:x,showLabel:T,isDetail:T,className:"mb-2",onChange:e=>{var l;o(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value),A({...j,storyReferences:K})},value:t,refs:i,helperText:y.o.getErrorMessage(p,"storyReferences[".concat(l,"].url"),"References Link")})},name:"storyReferences[".concat(l,"].url"),control:f,rules:{required:!0}},null==e?void 0:e.id)}),l>0&&(0,n.jsxs)("div",{onClick:()=>es(+l),className:"cursor-pointer",style:{position:"absolute",right:"-21px",top:"7px",fontSize:"16px"},children:[" ","✕"," "]})]},null==e?void 0:e.id)),(0,n.jsxs)("div",{className:"my-auto cursor-pointer mb-5",style:{float:"right"},onClick:()=>{P({url:""})},children:[(0,n.jsx)("span",{className:"color-green fontSize14",children:" + "}),(0,n.jsx)("span",{className:"text-green fontSize14",children:" Add "})]})]}):(0,n.jsx)(n.Fragment,{children:(null==v?void 0:null===(d=v.storyReferences)||void 0===d?void 0:d.length)>0&&(0,n.jsx)("div",{className:"d-flex mb-5",children:null==v?void 0:null===(u=v.storyReferences)||void 0===u?void 0:u.map((e,l)=>(0,n.jsx)(eg(),{legacyBehavior:!0,href:null==e?void 0:e.url,children:(0,n.jsx)("a",{target:"_blank",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"p-3 mx-2 cursor-pointer bg-gray rounded-circle",children:(0,n.jsx)("img",{src:null==e?void 0:e.imageUrl,width:"20px",height:"20px",className:"img img-responsive"})}),(0,n.jsx)("div",{})]})})},l))})})]}),(0,n.jsx)("div",{className:"custom-border-b mt-5"}),(0,n.jsx)("h3",{className:"mt-4",children:"Photos"}),(0,n.jsx)("div",{className:"mt-4 d-flex",children:g?(0,n.jsx)(m.Qr,{render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(em.Z,{col:"custom-photos",placeholder:"Story Image",isRequired:!0,ref:l,data:null==j?void 0:j.storyFiles,value:i,onRemove:eo,onChange:e=>{ea(e),t(null==e?void 0:e.fileUrl)},helperText:y.o.getErrorMessage(p,"imageFiles","Story Image")})},name:"imageFiles",control:f,rules:{required:!!_.isEmpty(null==v?void 0:v.storyFiles)}}):(0,n.jsx)(n.Fragment,{children:"No Thumbnail"!==M?(0,n.jsx)(n.Fragment,{children:null==M?void 0:M.map((e,l)=>(0,n.jsx)("div",{className:"custom-photos ".concat((null==M?void 0:M.length)>1&&"ms-2"),children:(0,n.jsx)("img",{src:e||"",alt:"photo",className:"img-fluid img-video"})},l))}):(0,n.jsx)("div",{className:"custom-photos",children:(0,n.jsx)("span",{className:"passport-img img-fluid video-file",children:"Photo"})})})}),(0,n.jsx)("div",{className:"custom-border-b mt-4"}),(0,n.jsx)("h3",{className:"mt-4",children:"Videos"}),g?(0,n.jsxs)("div",{className:"w-100 align-self-center bg-white my-4",children:[(0,n.jsx)("div",{className:"row g-2",children:(0,n.jsx)("div",{className:"col-12",children:(0,n.jsx)(m.Qr,{render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(N.Z,{placeholder:"YouTube Url",refs:l,value:(0,ef.l)(i)?i:"",type:"url",className:"custom-bg mb-2",pattern:"https://.*",onChange:e=>{var l;let i=null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value;t(i),A({...j,videoFiles:{type:"YOUTUBE",sequence:0,url:i}})},disabled:x,showLabel:T,isDetail:T,helperText:y.o.getErrorMessage(p,"videoFiles","Please Input Correct YouTube Link")})},name:"videoFiles",control:f,defaultValue:"",rules:{required:!1,validate:e=>{if(!e)return!0;(0,ef.l)(e)}}})})}),(0,n.jsx)("div",{className:"border-bottom w-100 position-relative my-4",children:(0,n.jsx)("span",{className:"position-absolute top-0 start-50 translate-middle bg-white px-3 py-1",children:"OR"})}),(0,ef.l)(U)&&(0,n.jsx)("div",{className:"upload-front-input w-max-content mb-2",children:(0,n.jsx)("div",{className:"input-upload-video",style:{marginRight:"auto"},children:(0,n.jsx)("div",{className:"video-container",children:(0,n.jsx)(ed.default,{url:U,controls:!0,width:"100%",height:"100%"})})})}),(0,n.jsx)("div",{className:"text-center col-4 mt-4",children:(0,n.jsx)(m.Qr,{render:e=>{var l;let{field:{ref:i,value:t,onChange:o}}=e;return(0,n.jsx)(eh.Z,{src:null==j?void 0:null===(l=j.videoFiles)||void 0===l?void 0:l.url,placeholder:"Upload From File",value:t,onChange:e=>{o(e.fileUrl);let l={fileId:null==e?void 0:e.id,type:"VIDEO",sequence:0,url:null==e?void 0:e.fileUrl};A({...j,videoFiles:l})},helperText:y.o.getErrorMessage(p,"videoFiles","VIDEO")})},defaultValue:"",name:"videoFiles",control:f,rules:{required:!1}})})]}):(0,n.jsx)(n.Fragment,{children:(null==j?void 0:null===(c=j.videoFiles)||void 0===c?void 0:c.type)==="VIDEO"?(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"w-100",children:[(0,n.jsx)("p",{className:"mt-4 c-bottom",children:"Upload File"}),"No Video"!==L?(0,n.jsx)("div",{className:"cursor-pointer col-4",children:(0,n.jsxs)("video",{className:"img-video",width:"100%",height:"70%",controls:!0,children:[(0,n.jsx)("source",{src:L,type:"video/mp4"}),(0,n.jsx)("source",{src:L,type:"video/flv"}),(0,n.jsx)("source",{src:L,type:"video/avi"}),(0,n.jsx)("source",{src:L,type:"video/wmv"}),(0,n.jsx)("source",{src:L,type:"video/qt"})]})}):(0,n.jsx)("div",{className:"custom-photos",children:(0,n.jsx)("span",{className:"passport-img img-fluid video-file",children:"Video"})})]})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"mt-4 c-bottom",children:"YouTube Link"}),"No YouTube Link"!==O?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h4",{children:(0,n.jsx)("a",{href:O,target:"_blank",children:O})}),(0,n.jsxs)("div",{className:"custom-yt-border p-3",children:[(0,n.jsx)("div",{className:"custom-photos",target:"_blank",children:(0,n.jsx)(ed.default,{url:O,controls:!0,width:135,height:85})}),(0,n.jsx)("p",{className:"mt-3 c-bottom",children:"YOUTUBE.COM"}),(0,n.jsx)("h4",{})]})]}):(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("div",{className:"custom-yt-border p-3",children:(0,n.jsx)("span",{className:"passport-img img-fluid",children:"Youtube Link"})})})]})}),(0,n.jsx)("div",{className:"custom-border-b mt-4"}),(0,n.jsx)("h3",{className:"mt-4",children:"Goal"}),(0,n.jsx)("div",{className:"mt-4",children:(0,n.jsx)(m.Qr,{name:"totalTargetAmount",control:f,defaultValue:"",rules:{required:!0,validate:e=>!!e&&!(e<=0)},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(ec.Z,{placeholder:"Total Target Amount",className:"mb-2",onChange:e=>{t(null==e?void 0:e.value),A({...j,totalTargetAmount:null==e?void 0:e.value})},value:i,refs:l,disabled:x,showLabel:T,isDetail:T,helperText:y.o.getErrorMessage(p,"totalTargetAmount","TotalTargetAmount","Campaign goal amounts should be grater than 0")})}})}),(0,n.jsx)("div",{className:"custom-border-b mt-4"}),(0,n.jsx)("h3",{className:"mt-4",children:"Duration"}),(0,n.jsxs)("div",{className:"mt-4",children:[g?(0,n.jsx)(m.Qr,{name:"startedAt",control:f,defaultValue:"",rules:{required:!0,validate:(null==v?void 0:v.status)===r.sr.DRAFT&&(e=>{let l=F()().format("yyyy-MM-DD"),i=F()(e).format("yyyy-MM-DD");return i>=l})},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(eu.Z,{placeholder:"Start Date",maxDate:z,className:"mb-2",classStyle:"material-border-input",onChange:e=>{t(e),E(e),A({...j,startedAt:e})},value:i,disabled:(null==v?void 0:v.status)===r.sr.ACTIVE,refs:l,helperText:y.o.getErrorMessage(p,"startedAt","Start Date","Start date should be greater than or equal to current date")})}}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h5",{className:"custom-nunito",children:"Start Date"}),(0,n.jsx)("h4",{children:F()(null==v?void 0:v.startedAt).format("ll")||"-"})]}),g?(0,n.jsx)(m.Qr,{name:"endedAt",control:f,defaultValue:"",rules:{required:!0,validate:(null==v?void 0:v.status)===r.sr.DRAFT&&(e=>{let l=(null==j?void 0:j.startedAt)===""?F()(e).format("yyyy-MM-DD"):F()(null==j?void 0:j.startedAt).format("yyyy-MM-DD"),i=F()(e).format("yyyy-MM-DD");return i>l})},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(eu.Z,{placeholder:"End Date",maxDate:z,className:"mb-2",classStyle:"material-border-input",onChange:e=>{t(e),A({...j,endedAt:e}),I(e)},value:i,refs:l,helperText:y.o.getErrorMessage(p,"endedAt","End Date","End Date should be greater than start date.")})}}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h5",{className:"custom-nunito",children:"End Date"}),(0,n.jsx)("h4",{children:F()(null==v?void 0:v.endedAt).format("ll")||"-"})]})]}),(0,n.jsx)("div",{className:"custom-border-b my-3 "}),(0,n.jsx)(eb.x,{inputTittle:"Enter your gratitude message",disabled:!g&&ei,checked:ei,onChecked:e=>{var l;return en(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.checked)},children:null==R?void 0:R.map(
1(e,l)=>{var i;return(0,n.jsxs)("div",{className:"translate-form",children:[(0,n.jsx)(m.Qr,{name:"locales.".concat(l,".message"),control:f,rules:{required:(null===(i=(0,eN.pK)("message",j?.locales))||void 0===i?void 0:i.length)<=0},render:i=>{let{field:{ref:t,value:o,onChange:s}}=i;return(0,n.jsx)(ev.Z,{placeholder:null==e?void 0:e.code,className:"mb-2",onChange:e=>{var l;s(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value),A({...j,locales:W})},value:o,refs:t,disabled:x,showLabel:T,isDetail:T,helperText:y.o.getErrorMessage(p,"locales.".concat(l,".message"),"Message")})}}),(null==D?void 0:D.length)!==l+1&&(0,n.jsx)(eb.C,{isAutoCheck:!!g&&ei,onTranslate:()=>ep("message")})]},null==e?void 0:e.id)})})]})]})})}),ek=i(86308),eE=i(95778),eI=i(36680),eT=e=>{var l,i,t,o,s,r;let{data:a,watch:d,control:u,errors:c,disabled:v,banks:h,isEdit:f,raiseFund:p,setRaiseFund:x,isDetail:g=!1}=e,b=(null==a?void 0:null===(l=a.video)||void 0===l?void 0:l.url)||"No YouTube Link",j=(null==a?void 0:null===(o=a.storyFiles)||void 0===o?void 0:null===(t=o.find(e=>(null==e?void 0:e.type)==="VIDEO"))||void 0===t?void 0:null===(i=t.file)||void 0===i?void 0:i.url)||"No Video",w=(null==a?void 0:null===(s=a.storyFiles)||void 0===s?void 0:s.filter(e=>(null==e?void 0:e.type)==="THUMBNAIL").map(e=>{var l;return null==e?void 0:null===(l=e.file)||void 0===l?void 0:l.url}))||"No Thumbnail",A=d("videoFiles"),k=e=>{let l=_.filter(null==p?void 0:p.storyFiles,l=>l.fileId!=e);x({...p,storyFiles:l})},E=e=>{let l=_.isEmpty(null==p?void 0:p.storyFiles);if(l)null==p||p.storyFiles.push({fileId:null==e?void 0:e.id,type:"THUMBNAIL",sequence:0,url:null==e?void 0:e.fileUrl});else{let l=_.lastIndexOf(null==p?void 0:p.storyFiles)-1;null==p||p.storyFiles.push({fileId:null==e?void 0:e.id,type:"THUMBNAIL",sequence:l+1,url:null==e?void 0:e.fileUrl})}};return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("div",{className:"card-body",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"mt-2",children:"Photos"}),(0,n.jsx)("div",{className:"mt-4 d-flex",children:f?(0,n.jsx)(m.Qr,{render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(em.Z,{placeholder:"Story Image",ref:l,data:null==p?void 0:p.storyFiles,value:i,onRemove:k,onChange:e=>{E(e),t(null==e?void 0:e.fileUrl)},helperText:y.o.getErrorMessage(c,"imageFiles","Story Image")})},name:"imageFiles",control:u,rules:{required:!!_.isEmpty(null==p?void 0:p.storyFiles)}}):(0,n.jsx)(n.Fragment,{children:"No Thumbnail"!==w?(0,n.jsx)(n.Fragment,{children:null==w?void 0:w.map((e,l)=>(0,n.jsx)("div",{className:"custom-photos ".concat((null==w?void 0:w.length)>1&&"ms-2"),children:(0,n.jsx)("img",{src:e||"",alt:"photo",className:"img-fluid img-video"})},l))}):(0,n.jsx)("div",{className:"custom-photos",children:(0,n.jsx)("span",{className:"passport-img img-fluid video-file",children:"Photo"})})})}),(0,n.jsx)("div",{className:"custom-border-b mt-4"}),(0,n.jsx)("h3",{className:"mt-4",children:"Video"}),f?(0,n.jsxs)("div",{className:"w-100 align-self-center bg-white my-4",children:[(0,n.jsx)("div",{className:"row g-2",children:(0,n.jsx)("div",{className:"col-12",children:(0,n.jsx)(m.Qr,{render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(N.Z,{placeholder:"YouTube Url",refs:l,value:(0,ef.l)(i)?i:"",type:"url",className:"custom-bg mb-2",pattern:"https://.*",onChange:e=>{var l;let i=null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value;t(i),x({...p,videoFiles:{type:"YOUTUBE",sequence:0,url:i}})},disabled:v,showLabel:g,isDetail:g,helperText:y.o.getErrorMessage(c,"videoFiles","Please Input Correct YouTube Link")})},name:"videoFiles",control:u,defaultValue:"",rules:{required:!1,validate:e=>{if(!e)return!0;(0,ef.l)(e)}}})})}),(0,n.jsx)("div",{className:"border-bottom w-100 position-relative my-4",children:(0,n.jsx)("span",{className:"position-absolute top-0 start-50 translate-middle bg-white px-3 py-1",children:"OR"})}),(0,ef.l)(A)&&(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{children:(0,n.jsx)("a",{href:A,target:"_blank",children:A})}),(0,n.jsxs)("div",{className:"custom-yt-border p-3",children:[(0,n.jsx)("div",{className:"",target:"_blank",children:(0,n.jsx)(ed.default,{url:A,controls:!0,width:"100%",height:"80%"})}),(0,n.jsx)("p",{className:"mt-2 c-bottom",children:"YOUTUBE.COM"})]})]}),(0,n.jsx)("div",{className:"text-center col-6 mt-4",children:(0,n.jsx)(m.Qr,{render:e=>{var l;let{field:{value:i,onChange:t}}=e;return(0,n.jsx)(eh.Z,{src:null==p?void 0:null===(l=p.videoFiles)||void 0===l?void 0:l.url,placeholder:"Upload From File",value:i,height:"80%",onChange:e=>{t(e.fileUrl);let l={fileId:null==e?void 0:e.id,type:"VIDEO",sequence:0,url:null==e?void 0:e.fileUrl};x({...p,videoFiles:l})},helperText:y.o.getErrorMessage(c,"videoFiles","VIDEO")})},defaultValue:"",name:"videoFiles",control:u,rules:{required:!1}})})]}):(0,n.jsx)(n.Fragment,{children:(null==p?void 0:null===(r=p.videoFiles)||void 0===r?void 0:r.type)==="VIDEO"?(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"w-100",children:[(0,n.jsx)("p",{className:"mt-4 c-bottom",children:"Upload File"}),"No Video"!==j?(0,n.jsx)("div",{className:"cursor-pointer col-4",children:(0,n.jsxs)("video",{className:"img-video",width:"100%",height:"70%",controls:!0,children:[(0,n.jsx)("source",{src:j,type:"video/mp4"}),(0,n.jsx)("source",{src:j,type:"video/flv"}),(0,n.jsx)("source",{src:j,type:"video/avi"}),(0,n.jsx)("source",{src:j,type:"video/wmv"}),(0,n.jsx)("source",{src:j,type:"video/qt"})]})}):(0,n.jsx)("div",{className:"custom-photos",children:(0,n.jsx)("span",{className:"passport-img img-fluid video-file",children:"Video"})})]})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"mt-4 c-bottom",children:"YouTube Link"}),"No YouTube Link"!==b?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h4",{children:(0,n.jsx)("a",{href:b,target:"_blank",children:b})}),(0,n.jsxs)("div",{className:"custom-yt-border p-3",children:[(0,n.jsx)("div",{className:"custom-photos",target:"_blank",children:(0,n.jsx)(ed.default,{url:b,controls:!0,width:135,height:85})}),(0,n.jsx)("p",{className:"mt-3 c-bottom",children:"YOUTUBE.COM"}),(0,n.jsx)("h4",{})]})]}):(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("div",{className:"custom-yt-border p-3",children:(0,n.jsx)("span",{className:"passport-img img-fluid",children:"Youtube Link"})})})]})})]})})})},eS=(0,b.$j)(null,e=>{let{googleTranslate:l}=ej.default;return{googleTranslate:(i,n)=>e(l(i,n))}})(e=>{let{data:l,watch:i,control:t,errors:s,disabled:a,banks:d,isEdit:u,setValue:c,raiseFund:v,setRaiseFund:h,isDetail:f=!1,setStartDate:p,setEndDate:x,languagesCount:g,googleTranslate:b}=e,{fields:j}=(0,m.Dq)({control:t,name:"locales"}),N=i("startedAt"),w=i("endedAt"),A=i("locales"),[k,E]=(0,o.useState)(!0);(0,o.useEffect)(()=>{var e;c("locales",null==v?void 0:null===(e=v.locales)||void 0===e?void 0:e.map(e=>({languageId:null==e?void 0:e.languageId,code:null==e?void 0:e.code,title:null==e?void 0:e.title,de
1scription:null==e?void 0:e.description,useOfFund:null==e?void 0:e.useOfFund,involvement:null==e?void 0:e.involvement,reference:null==e?void 0:e.reference,message:null==e?void 0:e.message})))},[]);let I=async e=>{var l,i;let n,t;let o=(0,eN.pK)(e,null==v?void 0:v.locales);if(!_.isEmpty(o)){if((0,eN.iw)(o,g))t=(0,eN.eL)(o[1].languageId,g),n=(0,eN.o3)(o[1].languageId,null==v?void 0:v.locales);else{let o=(0,eN.EG)(e,null==v?void 0:v.locales);_.isEmpty(o)||(t=(0,eN.eL)(null==o?void 0:null===(l=o[0])||void 0===l?void 0:l.languageId,g),n=(0,eN.o3)(null==o?void 0:null===(i=o[0])||void 0===i?void 0:i.languageId,null==v?void 0:v.locales))}let s={languageCode:t,text:o[0][e]};b(s,"Too many requests, please try again in 30 seconds").then(l=>{let{data:i}=l,t=[...null==v?void 0:v.locales];t[n][e]=null==i?void 0:i[0],c("locales.".concat(n,".").concat(e),null==i?void 0:i[0]),h({...v,locales:t})})}};return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("div",{className:"card-body",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"mt-2",children:"Goal"}),(0,n.jsx)("div",{className:"mt-4",children:u?(0,n.jsx)(m.Qr,{name:"totalTargetAmount",control:t,defaultValue:"",rules:{required:!0,validate:e=>!!e&&!(e<=0)},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(ec.Z,{placeholder:"TotalTargetAmount",className:"mb-2",onChange:e=>{t(null==e?void 0:e.value),h({...v,totalTargetAmount:null==e?void 0:e.value})},value:i,refs:l,disabled:a,showLabel:f,isDetail:f,helperText:y.o.getErrorMessage(s,"totalTargetAmount","TotalTargetAmount","Campaign goal amounts should be grater than 0")})}}):(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsx)("h5",{className:"custom-nunito",children:"Amount in US dollars ($)"}),(0,n.jsxs)("h4",{children:["$",(null==l?void 0:l.totalTargetAmount)!==0?Number(null==l?void 0:l.totalTargetAmount).toFixed(0):0]})]})}),(0,n.jsx)("div",{className:"custom-border-b mt-4"}),(0,n.jsx)("h3",{className:"mt-4",children:"Duration"}),(0,n.jsxs)("div",{className:"mt-4",children:[u?(0,n.jsx)(m.Qr,{name:"startedAt",control:t,rules:{required:!0,validate:(null==l?void 0:l.status)===r.sr.DRAFT&&(e=>{let l=F()().format("yyyy-MM-DD"),i=F()(e).format("yyyy-MM-DD");return i>=l})},render:e=>{let{field:{ref:i,value:t,onChange:o}}=e;return(0,n.jsx)(eu.Z,{placeholder:"Start Date",maxDate:N,onChange:e=>{o(e),p(e),h({...v,startedAt:e})},value:t,style:{borderRadius:8},classStyle:"material-border-input",disabled:(null==l?void 0:l.status)===r.sr.ACTIVE,refs:i,isDetail:f,helperText:y.o.getErrorMessage(s,"startedAt","Start Date","Start date should be greater than current date")})}}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h5",{className:"custom-nunito",children:"Start Date"}),(0,n.jsx)("h4",{children:(null==v?void 0:v.startedAt)===""?"-":F()(null==v?void 0:v.startedAt).format("ll")||"-"})]}),u?(0,n.jsx)(m.Qr,{name:"endedAt",control:t,rules:{required:!0,validate:(null==l?void 0:l.status)===r.sr.DRAFT&&(e=>{let l=(null==v?void 0:v.startedAt)===""?F()(e).format("yyyy-MM-DD"):F()(null==v?void 0:v.startedAt).format("yyyy-MM-DD"),i=F()(e).format("yyyy-MM-DD");return i>l})},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(eu.Z,{placeholder:"End Date",refs:l,onChange:e=>{t(e),h({...v,endedAt:e}),x(e)},value:i,style:{borderRadius:8},classStyle:"material-border-input",maxDate:w,isDetail:!0,helperText:y.o.getErrorMessage(s,"endedAt","End Date","End Date should be greater than start date.")})}}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("h5",{className:"custom-nunito",children:"End Date"}),(0,n.jsx)("h4",{children:(null==v?void 0:v.endedAt)===""?"-":F()(null==v?void 0:v.endedAt).format("ll")})]})]}),(0,n.jsx)("div",{className:"custom-border-b mt-4"}),(0,n.jsx)(eb.x,{inputTittle:"Message",disabled:!u,checked:k,onChecked:e=>{var l;return E(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.checked)},children:null==j?void 0:j.map((e,l)=>{var i;return(0,n.jsxs)("div",{className:"translate-form",children:[(0,n.jsx)(m.Qr,{name:"locales.".concat(l,".message"),control:t,rules:{required:(null===(i=(0,eN.pK)("message",v?.locales))||void 0===i?void 0:i.length)<=0},render:i=>{let{field:{ref:t,value:o,onChange:r}}=i;return(0,n.jsx)(ev.Z,{placeholder:null==e?void 0:e.code,className:"mb-2",onChange:e=>{var l;let i=null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value;r(i),h({...v,locales:A})},value:o,refs:t,disabled:a,showLabel:f,isDetail:f,helperText:y.o.getErrorMessage(s,"locales.".concat(l,".message"),"Message")})}}),(null==g?void 0:g.length)!==l+1&&(0,n.jsx)(eb.C,{isAutoCheck:!!u&&k,onTranslate:()=>I("message")})]},null==e?void 0:e.id)})})]})})})}),eD=(0,b.$j)(null,e=>{let{googleTranslate:l}=ej.default;return{googleTranslate:(i,n)=>e(l(i,n))}})(e=>{var l,i,t,s,r;let{data:a,watch:d,control:u,errors:c,disabled:v,banks:h,isEdit:f,setValue:p,raiseFund:x,setRaiseFund:g,categories:b,googleTranslate:j,isDetail:A=!1,languagesCount:k}=e,{fields:E,append:I,remove:T}=(0,m.Dq)({control:u,name:"storyReferences"}),{fields:S}=(0,m.Dq)({control:u,name:"locales"}),D=(null==a?void 0:null===(l=a.storyCategories)||void 0===l?void 0:l.map(e=>{var l;return null==e?void 0:null===(l=e.category)||void 0===l?void 0:l.name}).join(", "))||"-",[F,C]=(0,o.useState)(),[P,Z]=(0,o.useState)(!0),[R,O]=(0,o.useState)(!0),[L,M]=(0,o.useState)(!0),[U,z]=(0,o.useState)(!0),q=d("locales"),B=d("address"),V=d("location"),G=d("latitude"),Q=d("longitude"),K=d("province"),W=d("storyReferences");(0,o.useEffect)(()=>{C({latitude:G,longitude:Q,location:V,province:K,address:B})},[B]);let Y=e=>{p("address",null==e?void 0:e.address),p("latitude",null==e?void 0:e.latitude),p("longitude",null==e?void 0:e.longitude),p("province",null==e?void 0:e.province),p("location",null==e?void 0:e.location),g({...x,...e})},H=e=>{T(e)},$=e=>{let{name:l,field:i}=e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"mt-2 c-bottom",children:l}),(0,n.jsx)("h4",{children:i||"-"})]})},J=async e=>{var l,i;let n,t;let o=(0,eN.pK)(e,null==x?void 0:x.locales);if(!_.isEmpty(o)){if((0,eN.iw)(o,k))t=(0,eN.eL)(o[1].languageId,k),n=(0,eN.o3)(o[1].languageId,null==x?void 0:x.locales);else{let o=(0,eN.EG)(e,null==x?void 0:x.locales);_.isEmpty(o)||(t=(0,eN.eL)(null==o?void 0:null===(l=o[0])||void 0===l?void 0:l.languageId,k),n=(0,eN.o3)(null==o?void 0:null===(i=o[0])||void 0===i?void 0:i.languageId,null==x?void 0:x.locales))}let s={languageCode:t,text:o[0][e]};j(s,"Too many requests, please try again in 30 seconds").then(l=>{var i;let{data:t}=l,o={...x};if(o.locales[n][e]=null==t?void 0:t[0],1===n){let l=null!==(i=null==t?void 0:t[0])&&void 0!==i?i:"",s=l.substring(0,50);p("locales.".concat(n,".").concat(e),s,{shouldValidate:!0}),g(o)}else p("locales.".concat(n,".").concat(e),null==t?void 0:t[0],{shouldValidate:!0}),g(o)})}},X=(null==a?void 0:a.organizationId)!==null;return null==a||null===(t=a.detail)||void 0===t||null===(i=t.description)||void 0===i||i.replace(/class\s?=\s?\"((ql[\w|-]+\s?)+)\"/g,(e,l)=>{let i=l.replace(/ql[\w|-]+/g,e=>"".concat(e," "));return'class="'.concat(i,'"')}),(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"card-body",children:[(0,n.jsx)("h3",{children:"Story"}),(0,n.jsxs)("div",{children:[(0,n.jsx)(eb.x,{inputTittle:"Title",disabled:!f,checked:P,onChecked:e=>{var l;return Z(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.checked)},children:null==S?void 0:S.map((e,l)=>{var i;return(0,n.jsxs)("div",{className:"translate-form",children:[(0,n.jsx)("div",{className:"mb-2",children:(0,n.jsx)(m.Qr,{name:"locales.".concat(l,".title"),control:u,rules:{required:(null===(i=(0,eN.pK)("title",x?.locales))||void 0===i?void 0:i.length)<=0},render:i=>{let{field:{ref:t,value:o,onChange:s}}=i;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(N.Z,{placeholder:null==e?void 0:e.code,className:"mb-2",onChange:l=>{var i;let n=null==l?void 0:null===(i=l.target)||void 0===i?void 0:i.value;(null==e?void 0:e.code)===ew.uZ.ENGLISH?s(n.substring(0,50)):s(n),g({...x,locales:q})},value:o,refs:t,disabled:v,showLabel:A,isDetail:A,helperText:y.o.getErrorMessage(c,"locales.".concat(l,".title"),"Title")}),(null==e?void 0:e.code)===ew.uZ.ENGLISH?(0,n.jsxs)("span",{className:"d-flex justify-content-end me-2",children:[null==o?void 0:o.length,"/",50]}):null]})}})}),(null==k?void 0:k.length)!==l+1&&(0,n.jsx)(eb.C,{isAutoCheck:!!f&&P,onTranslate:()=>J("title")})]},null==e?void 0:e.id)})}),f?(0,n.jsx)(m.Qr,{name:"categoryIds",control:u,rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(w.Z,{refs:l,placeholder:"Category",onChange:e=>{t(e),g({...x,categoryIds:e})},value:i,options:b,disabled:v,showLabel:A,isDetail:A,className:"mb-2",helperText:y.o.getErrorMessage(c,"categoryIds","Category")})}}):(0,n.jsx)($,{name:"Category",field:D}),f?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(m.Qr,{name:"address",control:u,rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(el.Z,{placeholder:"Address",className:"mb-2",onChange:e=>{var l,i;t(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value),g({...x,address:null==e?void 0:null===(i=e.target)||void 0===i?void 0:i.value})},value:i,refs:l,disabled:v,showLabel:A,isDetail:A,getMapLocation:Y,mapLocationData:F,helperText:y.o.getErrorMessage(c,"address","Address")})}}),(0,n.jsx)("div",{className:"form-group mb-2",children:(0,n.jsx)(m.Qr,{name:"province",control:u,rules:{required:!0},render:e=>{let{field:{ref:l,value:i,onChange:t}}=e;return(0,n.jsx)(w.Z,{refs:l,placeholder:"City / Province",onChange:e=>{g({...x,province:e}),t(e)},value:i,options:er.D,disabled:v,showLabel:A,isDetail:A,className:"mb-2",helperText:y.o.getErrorMessage(c,"province","City / Province")})}})})]}):(0,n.jsx)($,{name:"Address",field:null==a?void 0:a.address}),(0,n.jsx)(eb.x,{inputTittle:"Description",disabled:!f,checked:R,onChecked:e=>{var l;return O(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.checked)},children:null==S?void 0:S.map((e,l)=>{var i;return(0,n.jsxs)("div",{className:"translate-form",children:[(0,n.jsx)(m.Qr,{name:"locales.".concat(l,".description"),control:u,rules:{required:(null===(i=(0,eN.pK)("description",x?.locales))||void 0===i?void 0:i.length)<=0},render:l=>{let{field:{ref:i,value:t,onChange:o}}=l;return(0,n.jsx)(ey,{showLabel:A,isDetail:A,disabled:v,isEdit:f,label:null==e?void 0:e.code,isRequired:!0,value:t,placeholder:null==e?void 0:e.code,onChange:e=>{g({...x,locales:q}),o(e)}})}}),(null==k?void 0:k.length)!==l+1&&(0,n.jsx)(eb.C,{isAutoCheck:!!f&&R,onTranslate:()=>J("description")})]},null==e?void 0:e.id)})}),X?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"custom-border-b mt-4"}),(0,n.jsx)("h3",{className:"mt-4",children:"Reference Link"})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"custom-border-b mt-4"}),(0,n.jsx)("h3",{className:"mt-4",children:"Additional Information"})]}),!X&&(0,n.jsx)(eb.x,{inputTittle:"Use of Fund",disabled:!f,checked:L,onChecked:e=>{var l;return M(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.checked)},children:null==S?void 0:S.map((e,l)=>{var i;return(0,n.jsxs)("div",{className:"translate-form",children:[(0,n.jsx)(m.Qr,{name:"locales.".concat(l,".useOfFund"),control:u,rules:{required:(null===(i=(0,eN.pK)("useOfFund",x?.locales))||void 0===i?void 0:i.length)<=0},render:i=>{let{field:{ref:t,value:o,onChange:s}}=i;return(0,n.jsx)(ev.Z,{placeholder:null==e?void 0:e.code,className:"mb-2",onChange:e=>{var l;let i=null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value;s(i),g({...x,locales:q})},value:o,refs:t,disabled:v,showLabel:A,isDetail:A,helperText:y.o.getErrorMessage(c,"locales.".concat(l,".useOfFund"),"Use Of Fund")})}}),(null==k?void 0:k.length)!==l+1&&(0,n.jsx)(eb.C,{isAutoCheck:!!f&&P,onTranslate:()=>J("useOfFund")})]},null==e?void 0:e.id)})}),!X&&(0,n.jsx)(eb.x,{inputTittle:"Your Involvement",disabled:!f,checked:U,onChecked:e=>{var l;return z(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.checked)},children:null==S?void 0:S.map((e,l)=>{var i;return(0,n.jsxs)("div",{className:"translate-form",children:[(0,n.jsx)(m.Qr,{name:"locales.".concat(l,".involvement"),control:u,rules:{required:(null===(i=(0,eN.pK)("involvement",x?.locales))||void 0===i?void 0:i.length)<=0},render:i=>{let{field:{ref:t,value:o,onChange:s}}=i;return(0,n.jsx)(ev.Z,{placeholder:null==e?void 0:e.code,className:"mb-2",onChange:e=>{var l;let i=null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value;s(i),g({...x,locales:q})},value:o,refs:t,disabled:v,showLabel:A,isDetail:A,helperText:y.o.getErrorMessage(c,"locales.".concat(l,".involvement"),"Your Involvement")})}}),(null==k?void 0:k.length)!==l+1&&(0,n.jsx)(eb.C,{isAutoCheck:!!f&&P,onTranslate:()=>J("involvement")})]},null==e?void 0:e.id)})}),f?(0,n.jsxs)("div",{className:"mb-3",children:[null==E?void 0:E.map((e,l)=>(0,n.jsxs)("div",{className:"position-relative",children:[(0,n.jsx)("div",{className:"form-group mb-2 ",children:(0,n.jsx)(m.Qr,{render:e=>{let{field:{ref:i,value:t,onChange:o}}=e;return(0,n.jsx)(N.Z,{placeholder:"Reference Link",disabled:v,showLabel:A,isDetail:A,className:"mb-2",onChange:e=>{var l;o(null==e?void 0:null===(l=e.target)||void 0===l?void 0:l.value),g({...x,storyReferences:W})},value:t,refs:i,helperText:y.o.getErrorMessage(c,"storyReferences[".concat(l,"].url"),"Reference Link")})},name:"storyReferences[".concat(l,"].url"),control:u,rules:{required:!0}},e.id)}),l>0&&(0,n.jsxs)("div",{onClick:()=>H(+l),className:"cursor-pointer",style:{position:"absolute",right:"-21px",top:"7px",fontSize:"16px"},children:[" ","✕"," "]})]},null==e?void 0:e.id)),(0,n.jsxs)("div",{className:"my-auto cursor-pointer mb-5",style:{float:"right"},onClick:()=>{I({url:""})},children:[(0,n.jsx)("span",{className:"color-green fontSize14",children:" + "}),(0,n.jsx)("span",{className:"text-green fontSize14",children:" Add "})]})]}):(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"mt-2 c-bottom",children:" Reference Link"}),(null==a?void 0:null===(s=a.storyReferences)||void 0===s?void 0:s.length)>0&&(0,n.jsxs)("div",{className:"d-flex ",children:[null==a?void 0:null===(r=a.storyReferences)||void 0===r?void 0:r.map((e,l)=>(0,n.jsx)(eg(),{legacyBehavior:!0,href:null==e?void 0:e.url,children:(0,n.jsx)("a",{target:"_blank",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"p-3 mx-2 cursor-pointer bg-gray rounded-circle",children:(0,n.jsx)("img",{src:null==e?void 0:e.imageUrl,width:"20px",height:"20px",className:"img img-responsive"})}),(0,n.jsx)("div",{})]})})},l)),(0,n.jsx)("div",{})]})]})]})]})})}),eF=i(41695),eC=i(93475),eP=i(46791),e_=i(34538),eZ=i(93196),eR=i(96486),eO=i.n(eR),eL=i(42173),eM=i(12321);let eU=e=>{var l,i,t;let{user:a,storyDetail:d,getStoryAdmin:u,exportDonations:c,categories:v,languages:h,banks:f,rejectStory:p,raiseFundState:x,onUpdateRaiseFund:g,updateAdminStory:b,raiseFundModel:j,onResetRaiseFund:N,getLanguage:y,getBank:w,getCategories:A,createStoryFromDraftAdmin:k,createDraftStoriesAdmin:E,approveStory:I,getFundraiserSummary:T,transactionSummary:D}=e,C=(0,R.useRouter)(),{id:Z}=C.query,[O,L]=(0,o.useState)({}),[M,U]=(0,o.useState)({}),[z,q]=(0,o.useState)(!1),[B,V]=(0,o.useState)($.q4.INITIAL),[G,Q]=(0,o.useState)(!1),[K]=(0,o.useState)({limit:5,offset:0,storyId:Z,type:"DONATED",status:"COMPLETED"}),[W,H]=(0,o.useState)(),[X,ee]=(0,o.useState)(""),[el,ei]=(0,o.useState)(""),[en,et]=(0,o.useState)(""),eo=(0,S.Ft)(null==d?void 0:d.startedAt),er=(0,S.Ft)(null==d?void 0:d.endedAt),ed=null==a?void 0:null===(t=a.permissions)||void 0===t?void 0:t.includes(null===(i=P.Z)||void 0===i?void 0:null===(l=i.EOrganizationPermissions)||void 0===l?void 0:l.LOGIN),eu={address:"",province:"",country:"",latitude:"",longitude:"",location:"",organizationId:"",description:"",reference:"khmer care",message:"",title:"",categoryIds:"",totalTargetAmount:"",startedAt:"",endedAt:"",countryCode:"KH",storyReferences:[{url:""}],storyFiles:"",storyVideo:"",locales:null==h?void 0:h.map(e=>({languageId:null==e?void 0:e.id,code:null==e?void 0:e.name,title:"",description:"",useOfFund:"",involvement:"",reference:"",message:""}))},ec={...eu,userProfile:{firstName:"",lastName:"",province:"",identifierNumber:"",identifierType:"ID",address:"",bankId:"",bankAccountName:"",bankAccountNumber:"",profileId:"",backId:"",frontId:""}},{reset:ev,control:em,handleSubmit:eh,formState:{errors:ef},watch:ep,setValue:ex}=(0,m.cI)("isOrganizati
1on: ",ed?{defaultValues:eu}:{defaultAdminValue:ec}),eg=null==h?void 0:h.map(e=>({languageId:null==e?void 0:e.id,code:null==e?void 0:e.name,title:"",description:"",useOfFund:"",involvement:"",reference:"",message:""}));(0,eM.Z)(()=>{Z&&(u(Z),T({...K,storyId:Z}))},[Z]),(0,o.useEffect)(()=>{U(D)},[D]),(0,eM.Z)(()=>{y(),A(),w()},[]),(0,o.useEffect)(()=>{H(eO().cloneDeep(x))},[x]),(0,o.useEffect)(()=>{var e,l,i,n,t,o,s,r,a,u,c,v,m,f,p,x,g,b,j,N,y,w,A,k,E,I,T,D,F,C,P,Z,R,O,M,U;let z;ey(d),L(eO().cloneDeep(d));let q=null===(l=eO().filter(h,e=>e?.code==="en"))||void 0===l?void 0:null===(e=l[0])||void 0===e?void 0:e.id;et(q),z=(null==d?void 0:d.video)===null?"":(null==d?void 0:null===(Z=d.video)||void 0===Z?void 0:Z.type)==="YOUTUBE"?{url:null==d?void 0:null===(R=d.video)||void 0===R?void 0:R.url,type:"YOUTUBE",sequence:0}:{id:null==d?void 0:null===(M=d.video)||void 0===M?void 0:null===(O=M.file)||void 0===O?void 0:O.id,url:null==d?void 0:null===(U=d.video)||void 0===U?void 0:U.url,type:"VIDEO",sequence:0};let B=(0,eZ.WT)(eg,null==d?void 0:d.locales),V=null==d?void 0:null===(i=d.storyFiles)||void 0===i?void 0:i.filter(e=>(null==e?void 0:e.type)==="THUMBNAIL").map(e=>{var l;return{fileId:null==e?void 0:e.fileId,type:null==e?void 0:e.type,sequence:null==e?void 0:e.sequence,url:null==e?void 0:null===(l=e.file)||void 0===l?void 0:l.url}}),G=(0,es.QG)(null==d?void 0:null===(n=d.founder)||void 0===n?void 0:n.phone),Q={phoneNumber:G?(0,S.Ft)(null==G?void 0:G.nationalNumber):null==d?void 0:null===(t=d.founder)||void 0===t?void 0:t.phone,userProfile:{bankAccountName:(0,S.Ft)(null==d?void 0:null===(o=d.founder)||void 0===o?void 0:o.bankAccountName),bankAccountNumber:(0,S.Ft)(null==d?void 0:null===(s=d.founder)||void 0===s?void 0:s.bankAccountNumber),identifierNumber:(0,S.Ft)(null==d?void 0:null===(r=d.founder)||void 0===r?void 0:r.identifierNumber),firstName:(0,S.Ft)(null==d?void 0:null===(a=d.founder)||void 0===a?void 0:a.firstName),lastName:(0,S.Ft)(null==d?void 0:null===(u=d.founder)||void 0===u?void 0:u.lastName),email:(0,S.Ft)(null==d?void 0:null===(c=d.founder)||void 0===c?void 0:c.email),frontId:(0,S.Ft)(null==d?void 0:null===(m=d.founder)||void 0===m?void 0:null===(v=m.front)||void 0===v?void 0:v.url),backId:(0,S.Ft)(null==d?void 0:null===(p=d.founder)||void 0===p?void 0:null===(f=p.back)||void 0===f?void 0:f.url),identifierType:(0,S.Ft)(null==d?void 0:null===(x=d.founder)||void 0===x?void 0:x.identifierType),profileId:(0,S.Ft)(null==d?void 0:null===(b=d.founder)||void 0===b?void 0:null===(g=b.profile)||void 0===g?void 0:g.url),bankId:(null==d?void 0:null===(j=d.founder)||void 0===j?void 0:j.bankId)===null?"NO_BANK":null==d?void 0:null===(N=d.founder)||void 0===N?void 0:N.bankId,bankAccountName:null==d?void 0:null===(y=d.founder)||void 0===y?void 0:y.bankAccountName,bankAccountNumber:null==d?void 0:null===(w=d.founder)||void 0===w?void 0:w.bankAccountNumber,address:(0,S.Ft)(null==d?void 0:null===(A=d.founder)||void 0===A?void 0:A.address),province:null==d?void 0:null===(k=d.founder)||void 0===k?void 0:k.province}},K={address:(0,S.Ft)(null==d?void 0:d.address),province:(null==d?void 0:d.province)?(0,S.fp)(null==d?void 0:d.province):"",country:(0,S.Ft)(null==d?void 0:d.country),latitude:null==d?void 0:d.latitude,longitude:null==d?void 0:d.longitude,location:null==d?void 0:d.location,organizationId:null==d?void 0:d.organizationId,description:(0,S.Ft)(null==d?void 0:null===(E=d.detail)||void 0===E?void 0:E.description),useOfFund:(0,S.Ft)(null==d?void 0:null===(I=d.detail)||void 0===I?void 0:I.useOfFund),involvement:(0,S.Ft)(null==d?void 0:null===(T=d.detail)||void 0===T?void 0:T.involvement),reference:null==d?void 0:null===(D=d.detail)||void 0===D?void 0:D.reference,message:(0,S.Ft)(null==d?void 0:null===(F=d.detail)||void 0===F?void 0:F.message),title:(0,S.Ft)(null==d?void 0:d.title),categoryIds:eO().isEmpty(null==d?void 0:d.storyCategories)?"":null==d?void 0:null===(P=d.storyCategories)||void 0===P?void 0:null===(C=P[0])||void 0===C?void 0:C.categoryId,totalTargetAmount:null==d?void 0:d.totalTargetAmount,startedAt:(0,S.Ft)(null==d?void 0:d.startedAt),endedAt:(0,S.Ft)(null==d?void 0:d.endedAt),countryCode:d.countryCode,storyReferences:eO().isEmpty(null==d?void 0:d.storyReferences)?[{url:""}]:null==d?void 0:d.storyReferences,storyFiles:V,videoFiles:null==z?void 0:z.url,locales:B};ev(ed?K:{...K,...Q})},[d,h]);let eb=async()=>{I(Z,{status:"APPROVED"}).then(()=>{T(K),u(Z)})},ej=(e,l)=>l===e,eN=e=>{var l,i,n,t,o,s,a,c,v,m,h,f,p,x,g,j,y,w,A;let E="+".concat(null==W?void 0:W.countryCode).concat(null==e?void 0:e.phoneNumber),I=(0,es.AI)(E),T={address:null==e?void 0:null===(l=e.userProfile)||void 0===l?void 0:l.address,province:null==e?void 0:null===(i=e.userProfile)||void 0===i?void 0:i.province,country:"Cambodia",latitude:null==e?void 0:null===(n=e.userProfile)||void 0===n?void 0:n.latitude,longitude:null==e?void 0:null===(t=e.userProfile)||void 0===t?void 0:t.longitude,location:null==e?void 0:null===(o=e.userProfile)||void 0===o?void 0:o.location,identifierType:null==e?void 0:null===(s=e.userProfile)||void 0===s?void 0:s.identifierType,f
1irstName:null==e?void 0:null===(a=e.userProfile)||void 0===a?void 0:a.firstName,lastName:null==e?void 0:null===(c=e.userProfile)||void 0===c?void 0:c.lastName,identifierNumber:null==e?void 0:null===(v=e.userProfile)||void 0===v?void 0:v.identifierNumber,backId:null==W?void 0:null===(m=W.userProfile)||void 0===m?void 0:m.backId,frontId:null==W?void 0:null===(h=W.userProfile)||void 0===h?void 0:h.frontId,profileId:null==W?void 0:null===(f=W.userProfile)||void 0===f?void 0:f.profileId,email:null==W?void 0:null===(p=W.userProfile)||void 0===p?void 0:p.email,phone:null==I?void 0:I.number,type:"FOUNDER"};(null==W?void 0:null===(x=W.userProfile)||void 0===x?void 0:x.bankId)!=="NO_BANK"&&(T={...T,bankId:null==e?void 0:null===(y=e.userProfile)||void 0===y?void 0:y.bankId,bankAccountName:null==e?void 0:null===(w=e.userProfile)||void 0===w?void 0:w.bankAccountName,bankAccountNumber:null==e?void 0:null===(A=e.userProfile)||void 0===A?void 0:A.bankAccountNumber});let S=[];(null==W?void 0:W.videoFiles)!==""&&S.push(null==W?void 0:W.videoFiles);let D=eO().filter(W.storyFiles,e=>void 0!==e),C=[];null==W||null===(g=W.locales)||void 0===g||g.map(e=>{let l=(0,eC.br)(e,eL.ew);eO().isEmpty(l)||C.push(l)});let P=ej(eo,null==W?void 0:W.startedAt),R=ej(er,null==W?void 0:W.endedAt),O=F()(null==e?void 0:e.startedAt).toISOString(),L=F()(null==e?void 0:e.endedAt).toISOString(),M={description:(0,eZ.SL)(null==W?void 0:W.locales,"description",en),useOfFund:(0,eZ.SL)(null==W?void 0:W.locales,"useOfFund",en),involvement:(0,eZ.SL)(null==W?void 0:W.locales,"involvement",en),message:(0,eZ.SL)(null==W?void 0:W.locales,"message",en),title:(0,eZ.SL)(null==W?void 0:W.locales,"title",en),address:null==W?void 0:W.address,reference:null==W?void 0:W.reference,province:null==W?void 0:W.province,country:"Cambodia",latitude:null==W?void 0:W.latitude,longitude:null==W?void 0:W.longitude,countryCode:"KH",location:null==W?void 0:W.location,reference:"Khmer care",categoryIds:(null==e?void 0:e.categoryId)===""?[]:[null==e?void 0:e.categoryIds],totalTargetAmount:parseFloat(null==e?void 0:e.totalTargetAmount),countryCode:e.countryCode,storyReferences:null==e?void 0:null===(j=e.storyReferences)||void 0===j?void 0:j.map(e=>({url:null==e?void 0:e.url})),storyFiles:[...S,...D],locales:eO().isEmpty(C)?[]:C};(null==d?void 0:d.status)===r.sr.DRAFT?(M.startedAt=O,M.endedAt=L):(P||(M={...M,startedAt:O}),R||(M={...M,endedAt:L}));let U={...M,storyUsers:[T],useOfFund:null==e?void 0:e.useOfFund,involvement:null==e?void 0:e.involvement};if(ed)(null==d?void 0:d.status)===r.sr.DRAFT?k(Z,{...M,organizationId:null==e?void 0:e.organizationId,status:"ACTIVE"}).then(()=>{q(!1),N(),u(Z)}):b(Z,ed?{...M,organizationId:null==e?void 0:e.organizationId}:U).then(()=>{q(!1),N(),u(Z)});else{let l=(null==d?void 0:d.organization)===null;(null==d?void 0:d.status)===r.sr.DRAFT?k(Z,l?U:{...M,organizationId:null==e?void 0:e.organizationId}).then(()=>{q(!1),N(),u(Z)}):b(Z,l?U:{...M,organizationId:null==e?void 0:e.organizationId}).then(()=>{q(!1),N(),u(Z)})}},ey=e=>{var l,i,n,t,o,s,r,a,d,u,c,v,m,h,f,p,b,j,N,y,w,A,k,E,I,T,D,F,C,P,Z,R,O,L,M,U,z,q,B,V,G,Q,K,W,Y,H,$;let J=(0,es.QG)(null==e?void 0:null===(l=e.founder)||void 0===l?void 0:l.phone),X=eO().isEmpty(null==e?void 0:e.storyFiles)?[]:eO().filter(null==e?void 0:e.storyFiles,e=>(null==e?void 0:e.type)==="VIDEO"||(null==e?void 0:e.type)==="YOUTUBE"),ee={fileId:null==X?void 0:null===(i=X[0])||void 0===i?void 0:i.fileId,type:null==X?void 0:null===(n=X[0])||void 0===n?void 0:n.type,sequence:0,url:(null==X?void 0:null===(t=X[0])||void 0===t?void 0:t.type)==="YOUTUBE"?null==X?void 0:null===(o=X[0])||void 0===o?void 0:o.url:null==X?void 0:null===(r=X[0])||void 0===r?void 0:null===(s=r.file)||void 0===s?void 0:s.url},el=null==e?void 0:null===(a=e.storyFiles)||void 0===a?void 0:a.filter(e=>(null==e?void 0:e.type)==="THUMBNAIL").map(e=>{var l;return{fileId:null==e?void 0:e.fileId,type:null==e?void 0:e.type,sequence:null==e?void 0:e.sequence,url:null==e?void 0:null===(l=e.file)||void 0===l?void 0:l.url}}),ei=(0,eZ.WT)(eg,null==e?void 0:e.locales);g({...x,description:(0,S.Ft)(null==e?void 0:null===(d=e.detail)||void 0===d?void 0:d.description),useOfFund:(0,S.Ft)(null==e?void 0:null===(u=e.detail)||void 0===u?void 0:u.useOfFund),involvement:(0,S.Ft)(null==e?void 0:null===(c=e.detail)||void 0===c?void 0:c.involvement),message:(0,S.Ft)(null==e?void 0:null===(v=e.detail)||void 0===v?void 0:v.message),reference:(0,S.Ft)(null==e?void 0:null===(m=e.detail)||void 0===m?void 0:m.reference),title:(0,S.Ft)(null==e?void 0:e.title),address:(0,S.Ft)(null==e?void 0:e.address),province:(0,S.Ft)(null==e?void 0:e.province),country:(0,S.Ft)(null==e?void 0:e.country),latitude:(0,S.Ft)(null==e?void 0:e.latitude),longitude:(0,S.Ft)(null==e?void 0:e.longitude),location:(0,S.Ft)(null==e?void 0:e.location),categoryName:eO().isEmpty(null==e?void 0:e.storyCategories)?"":null==e?void 0:null===(p=e.storyCategories)||void 0===p?void 0:null===(f=p[0])||void 0===f?void 0:null===(h=f.category)||void 0===h?void 0:h.code,categoryIds:eO().isEmpty(null==e?void 0:e.storyCategories)?"":null==e?void 0:null===(j=e.storyCategories)||void 0===j?void 0:null===(b=j[0])||void 0===b?void 0:b.categoryId,totalTargetAmount:null==e?void 0:e.totalTargetAmount,startedAt:(0,S.Ft)(null==e?void 0:e.startedAt),endedAt:(0,S.Ft)(null==e?void 0:e.endedAt),locales:ei,userProfile:{userId:(0,S.Ft)(null==e?void 0:null===(N=e.founder)||void 0===N?void 0:N.userId),bankId:(null==e?void 0:null===(y=e.founder)||void 0===y?void 0:y.bankId)===null?"NO_BANK":null==e?void 0:null===(w=e.founder)||void 0===w?void 0:w.bankId,bankAccountName:(0,S.Ft)(null==e?void 0:null===(A=e.founder)||void 0===A?void 0:A.bankAccountName),bankAccountNumber:(0,S.Ft)(null==e?void 0:null===(k=e.founder)||void 0===k?void 0:k.bankAccountNumber),identifierNumber:(0,S.Ft)(null==e?void 0:null===(E=e.founder)||void 0===E?void 0:E.identifierNumber),identifierType:(0,S.Ft)(null==e?void 0:null===(I=e.founder)||void 0===I?void 0:I.identifierType),firstName:(0,S.Ft)(null==e?void 0:null===(T=e.founder)||void 0===T?void 0:T.firstName),lastName:(0,S.Ft)(null==e?void 0:null===(D=e.founder)||void 0===D?void 0:D.lastName),email:(0,S.Ft)(null==e?void 0:null===(F=e.founder)||void 0===F?void 0:F.email),phone:(0,S.Ft)(null==e?void 0:null===(C=e.founder)||void 0===C?void 0:C.phone),frontId:(0,S.Ft)(null==e?void 0:null===(Z=e.founder)||void 0===Z?void 0:null===(P=Z.front)||void 0===P?void 0:P.id),frontUrl:(0,S.Ft)(null==e?void 0:null===(O=e.founder)||void 0===O?void 0:null===(R=O.front)||void 0===R?void 0:R.url),backId:(0,S.Ft)(null==e?void 0:null===(M=e.founder)||void 0===M?void 0:null===(L=M.back)||void 0===L?void 0:L.id),backUrl:(0,S.Ft)(null==e?void 0:null===(z=e.founder)||void 0===z?void 0:null===(U=z.back)||void 0===U?void 0:U.url),profileId:(0,S.Ft)(null==e?void 0:null===(B=e.founder)||void 0===B?void 0:null===(q=B.profile)||void 0===q?void 0:q.id),profileUrl:(0,S.Ft)(null==e?void 0:null===(G=e.founder)||void 0===G?void 0:null===(V=G.profile)||void 0===V?void 0:V.url),address:(0,S.Ft)(null==e?void 0:null===(Q=e.founder)||void 0===Q?void 0:Q.address),latitude:(0,S.Ft)(null==e?void 0:null===(K=e.founder)||void 0===K?void 0:K.latitude),longitude:(0,S.Ft)(null==e?void 0:null===(W=e.founder)||void 0===W?void 0:W.longitude),location:(0,S.Ft)(null==e?void 0:null===(Y=e.founder)||void 0===Y?void 0:Y.location),province:(0,S.Ft)(null==e?void 0:null===(H=e.founder)||void 0===H?void 0:H.province),type:"FOUNDER"},storyReferences:eO().isEmpty(null==e?void 0:e.storyReferences)?[]:null==e?void 0:e.storyReferences,storyUsers:[],storyFiles:eO().isEmpty(null==e?void 0:e.storyFiles)?[]:el,videoFiles:eO().isEmpty(null==e?void 0:e.video)?"":ee,phoneNumber:void 0===J?null==e?void 0:null===($=e.founder)||void 0===$?void 0:$.phone:(0,S.Ft)(null==J?void 0:J.nationalNumber),countryCode:void 0===J?"855":null==J?void 0:J.countryCallingCode})},ew=()=>{(0,$.nz)({offset:0,type:"DONATED",status:"COMPLETED",storyId:Z},"Story-Transactions",e=>{V(e)})};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s,{children:(0,n.jsx)("div",{className:"bg-fundraisers-detail",children:(0,n.jsxs)("div",{className:"detail-box",children:[(0,n.jsxs)("div",{className:"d-flex flex-column flex-md-row",children:[(0,n.jsx)("div",{className:"d-flex",children:(0,n.jsx)(eP.Z,{title:"Campaign Details",hasBackIcon:!0})}),(0,n.jsx)("div",{className:"ms-md-auto",children:(0,n.jsx)(Y,{status:null==O?void 0:O.status,handleApprove:eb,handleReject:()=>{Q(!G)},handleRequest:()=>{},onDraftSave:()=>{var e,l,i,n,t,o,s,r,a,c,v,m,h,f,p,x,g,b,y;let w="+".concat(null==W?void 0:W.countryCode).concat(null==W?void 0:W.phoneNumber),A=(0,es.AI)(w),k={address:null==W?void 0:null===(e=W.userProfile)||void 0===e?void 0:e.address,province:null==W?void 0:null===(l=W.userProfile)||void 0===l?void 0:l.province,country:"Cambodia",latitude:null==W?void 0:null===(i=W.userProfile)||void 0===i?void 0:i.latitude,longitude:null==W?void 0:null===(n=W.userProfile)||void 0===n?void 0:n.longitude,location:null==W?void 0:null===(t=W.userProfile)||void 0===t?void 0:t.location,identifierType:null==W?void 0:null===(o=W.userProfile)||void 0===o?void 0:o.identifierType,f
1irstName:null==W?void 0:null===(s=W.userProfile)||void 0===s?void 0:s.firstName,lastName:null==W?void 0:null===(r=W.userProfile)||void 0===r?void 0:r.lastName,identifierNumber:null==W?void 0:null===(a=W.userProfile)||void 0===a?void 0:a.identifierNumber,backId:null==W?void 0:null===(c=W.userProfile)||void 0===c?void 0:c.backId,frontId:null==W?void 0:null===(v=W.userProfile)||void 0===v?void 0:v.frontId,profileId:null==W?void 0:null===(m=W.userProfile)||void 0===m?void 0:m.profileId,email:null==W?void 0:null===(h=W.userProfile)||void 0===h?void 0:h.email,phone:null==A?void 0:A.number,type:"FOUNDER"};(null==W?void 0:null===(f=W.userProfile)||void 0===f?void 0:f.bankId)!=="NO_BANK"&&(k={...k,bankId:null==W?void 0:null===(g=W.userProfile)||void 0===g?void 0:g.bankId,bankAccountName:null==W?void 0:null===(b=W.userProfile)||void 0===b?void 0:b.bankAccountName,bankAccountNumber:null==W?void 0:null===(y=W.userProfile)||void 0===y?void 0:y.bankAccountNumber});let I=[];(null==W?void 0:W.videoFiles)!==""&&I.push(null==W?void 0:W.videoFiles);let T=eO().filter(W.storyFiles,e=>void 0!==e),S=[];null==W||null===(p=W.locales)||void 0===p||p.map(e=>{let l=(0,eC.br)(e,eL.ew);eO().isEmpty(l)||S.push(l)});let D=ej(eo,null==W?void 0:W.startedAt),C=ej(er,null==W?void 0:W.endedAt),P={description:(0,eZ.SL)(null==W?void 0:W.locales,"description",en),message:(0,eZ.SL)(null==W?void 0:W.locales,"message",en),title:(0,eZ.SL)(null==W?void 0:W.locales,"title",en),address:null==W?void 0:W.address,province:null==W?void 0:W.province,country:"Cambodia",latitude:null==W?void 0:W.latitude,longitude:null==W?void 0:W.longitude,location:null==W?void 0:W.location,reference:"Khmer care",categoryIds:(null==W?void 0:W.categoryIds)===""?[]:[null==W?void 0:W.categoryIds],totalTargetAmount:parseFloat(null==W?void 0:W.totalTargetAmount),countryCode:"KH",storyReferences:null==W?void 0:null===(x=W.storyReferences)||void 0===x?void 0:x.map(e=>({url:null==e?void 0:e.url})),storyFiles:[...I,...T],locales:eO().isEmpty(S)?[]:S};if(D||(P.startedAt=F()(null==W?void 0:W.startedAt).toISOString()),C||(P.endedAt=F()(null==W?void 0:W.endedAt).toISOString()),ed){let e=(0,eC.KP)({...P,id:Z,organizationId:d.organizationId},j);E(e).then(()=>{q(!1),N(),u(Z)})}else{let e={...P,storyUsers:[k],useOfFund:(0,eZ.SL)(null==W?void 0:W.locales,"useOfFund",en),involvement:(0,eZ.SL)(null==W?void 0:W.locales,"involvement",en)},l=(0,eC.KP)(e,j);E({...l,id:Z}).then(()=>{N(),q(!1),u(Z)})}},isEdit:z,isOrg:ed,handelCancel:()=>q(!1),handleEdit:()=>{if(!z)return q(!0);q(!0),eh(eN)()},isOrganization:ed,storyDetail:d})})]}),(0,n.jsx)("hr",{className:"break-line my-3"}),ed?(0,n.jsx)(n.Fragment,{children:(null==O?void 0:O.status)==="DRAFT"?(0,n.jsx)("div",{className:"d-flex flex-column py-2",children:(0,n.jsx)("div",{className:"ms-0 ms-md-3 mt-3 mt-md-0",children:(0,n.jsx)(ek.Z,{title:"Information",color:"gray",children:(0,n.jsx)("form",{onSubmit:eh(eN),autoComplete:"off",children:(0,n.jsx)(eA,{data:O,categories:v,control:em,errors:ef,watch:ep,setValue:ex,disabled:!z,isDetail:!0,isEdit:z,raiseFund:W,startDate:X,setStartDate:ee,setEndDate:ei,setRaiseFund:H,languagesCount:h})})})})}):(0,n.jsxs)("div",{className:"d-flex flex-column flex-md-row py-2",children:[(0,n.jsx)("div",{className:"col-4",children:(0,n.jsx)(ek.Z,{title:"Campaign Summary",color:"green",children:(0,n.jsx)(J,{onExport:ew,languagesCount:h,data:O,summaryData:M,exportStatus:B})})}),(0,n.jsx)("div",{className:"ms-0 ms-md-3 mt-3 mt-md-0 col-8",children:(0,n.jsx)(ek.Z,{title:"Campaign Information",color:"gray",children:(0,n.jsx)("form",{onSubmit:eh(eN),autoComplete:"off",children:(0,n.jsx)(eA,{data:O,categories:v,control:em,errors:ef,watch:ep,setValue:ex,disabled:!z,isDetail:!0,isEdit:z,raiseFund:W,setRaiseFund:H,startDate:X,setStartDate:ee,setEndDate:ei,languagesCount:h})})})})]})}):(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("form",{onSubmit:eh(eN),autoComplete:"off",children:(0,n.jsxs)("div",{className:"d-flex flex-column flex-md-row py-2",children:[(0,n.jsxs)("div",{className:"flex-column col-5",children:[(null==O?void 0:O.status)!=="PENDING"&&(0,n.jsx)("div",{children:(0,n.jsx)(ek.Z,{title:"Campaign Summary",color:"green",children:(0,n.jsx)(J,{onExport:ew,data:O,summaryData:M,exportStatus:B})})}),(0,n.jsx)("div",{className:"".concat((null==O?void 0:O.status)!=="PENDING"?"mt-3":""),children:(0,n.jsx)(ek.Z,{title:"Basic Information",color:"gray",children:(0,n.jsx)(ea,{data:O,control:em,errors:ef,watch:ep,setValue:ex,banks:f,disabled:!z,isDetail:!0,isEdit:z,raiseFund:W,setRaiseFund:H})})})]}),(0,n.jsxs)("div",{className:"ms-0 ms-md-3 mt-3 mt-md-0 col-7",children:[(0,n.jsx)(ek.Z,{title:"Story",color:"gray",children:(0,n.jsx)(eD,{languagesCount:h,data:O,control:em,errors:ef,watch:ep,setValue:ex,disabled:!z,categories:v,isDetail:!0,isEdit:z,raiseFund:W,setRaiseFund:H})}),(0,n.jsx)("div",{className:" mt-3 ",children:(0,n.jsx)(ek.Z,{title:"Photos & Videos",color:"gray",children:(0,n.jsx)(eT,{data:O,control:em,errors:ef,watch:ep,setValue:ex,disabled:!z,isDetail:!0,isEdit:z,raiseFund:W,setRaiseFund:H})})}),(0,n.jsx)("div",{className:" mt-3 ",children:(0,n.jsx)(ek.Z,{title:"Goal",color:"gray",children:(0,n.jsx)(eS,{data:O,control:em,errors:ef,watch:ep,setValue:ex,disabled:!z,isDetail:!0,isEdit:z,raiseFund:W,setRaiseFund:H,startDate:X,setStartDate:ee,setEndDate:ei,languagesCount:h})})})]})]})})})]})})}),G&&(0,n.jsx)(eI.Z,{isShow:G,onClose:()=>Q(!1),onSubmit:e=>{let l={status:"REJECTED",remark:null==e?void 0:e.cancelReason};p(Z,l).then(()=>{T(K),Q(!1)})}})]})};eU.layout=t.Z;var ez=(0,b.$j)(e=>{var l,i,n,t;let{user:o}=e.auth,{storyDetail:s,transactionSummary:r}=null==e?void 0:null===(l=e.admin)||void 0===l?void 0:l.fundraisers,{categories:a,banks:d}=null==e?void 0:null===(i=e.admin)||void 0===i?void 0:i.organization,{user:u}=null==e?void 0:null===(n=e.admin)||void 0===n?void 0:n.user,{raiseFundState:c,raiseFundModel:v}=null==e?void 0:e.raiseFundraising,{languages:m}=null==e?void 0:null===(t=e.admin)||void 0===t?void 0:t.languages;return{storyDetail:s,transactionSummary:r,user:o,useRole:u,raiseFundState:c,categories:a,banks:d,raiseFundModel:v,languages:m}},e=>
1{let{getDraftStoryAdmin:l,exportDonations:i,getFundraiserSummary:n,updateStatusStory:t,updateAdminStory:o,createDraftStoriesAdmin:s,createStoryFromDraftAdmin:r}=A.default,{onUpdateRaiseFund:a,onResetRaiseFund:d}=eF.default,{getCategories:u,getBank:c}=g.default,{getUser:v}=eE.default,{getLanguage:m}=e_.default;return{getStoryAdmin:i=>e(l(i)),exportDonations:(l,n)=>e(i(l,n)),onUpdateRaiseFund:l=>e(a(l)),getFundraiserSummary:l=>e(n(l)),rejectStory:(l,i)=>e(t(l,i)),approveStory:(l,i)=>e(t(l,i)),getUser:l=>e(v(l)),getCategories:()=>e(u()),updateAdminStory:(l,i)=>e(o(l,i)),createDraftStoriesAdmin:l=>e(s(l)),createStoryFromDraftAdmin:(l,i)=>e(r(l,i)),onResetRaiseFund:()=>e(d()),getBank:()=>e(c()),getLanguage:()=>e(m())}})(eU)},31739:function(e,l,i){"use strict";i.r(l);var n=i(85893),t=i(81482),o=i(3371);let s=()=>(0,n.jsx)(t.default,{});s.layout=o.Z,l.default=s},51813:function(e,l,i){"use strict";i.d(l,{o:function(){return t}});var n=i(96486);let t={getErrorMessage:(e,l,i,t)=>{var o;let s=n.get(e,"".concat(l,".type"));if(s)switch(s){case"required":return"".concat(i," is required");case"minLength":case"maxLength":return t||"".concat(i," should contain 8 characters");case"pattern":return t||"".concat(i," is invalid");case"manual":return"".concat(null==e?void 0:e[l].message);case"min":return t||"".concat(i," cannot be less than 0");case"max":return t||"".concat(i," cannot be greater than 100");case"validate":return(null===(o=e[l])||void 0===o?void 0:o.message)||t;default:return""}}}},25518:function(e,l,i){"use strict";var n=i(85893),t=i(86010);i(67294);var o=i(16109),s=i(6316);l.Z=function(e){let{label:l,onChange:i,onClick:r,value:a,className:d,disabled:u=!1,error:c,helperText:v,name:m,checked:h}=e;return(0,n.jsxs)(o.Z.Group,{className:(0,t.Z)("app-checkbox",d),children:[(0,n.jsxs)(s.Z.Label,{children:[(0,n.jsx)(s.Z.Input,{onChange:i,onClick:r,value:a,disabled:u,type:"checkbox",name:m,checked:h}),l&&(0,n.jsx)("span",{className:"ms-2",children:l||""})]}),v&&(0,n.jsx)(o.Z.Text,{className:"error-text",children:v})]})}},76402:function(e,l,i){"use strict";i.d(l,{IL:function(){return c},JO:function(){return d},Wc:function(){return m},lm:function(){return a},nz:function(){return r},q4:function(){return s},w4:function(){return u},zL:function(){return v}});var n=i(95147);i(81534);var t=i(96486),o=i.n(t);let s={PENDING:"PENDING",SUCCESS:"SUCCESS",FAILED:"FAILED",INITIAL:"INITIAL"},r=function(e){var l;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Donation Report",t=arguments.length>2?arguments[2]:void 0,r=null===(l=e?.categoryIds||[])||void 0===l?void 0:l.join("|"),d={...o().omit(e,"categoryIds"),categoryIds:r,limit:0,offset:0};t(s.PENDING),n.default.get("/v2/admin/stories/transactions/exports",{params:d,responseType:"arraybuffer",headers:{Accept:"application/octet-stream"}}).then(e=>{a(e.data,i,"xlsx"),t(s.SUCCESS)}).catch(e=>{t(s.FAILED)})},a=function(e,l){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"jpg",n=new Blob([e]),t=window.URL.createObjectURL(n),o=document.createElement("a");document.body.appendChild(o),o.setAttribute("style","display: none"),o.href=t,o.download="".concat(l,".").concat(i),o.click(),window.URL.revokeObjectURL(t),o.remove()};function d(e,l,i){return new Promise((n,t)=>{try{(function(e,l,i){let n=new Blob([e]),t=window.URL.createObjectURL(n),o=document.createElement("a");document.body.appendChild(o),o.setAttribute("style","display: none"),o.href=t,o.download="".concat(l,".").concat(i),o.click(),window.URL.revokeObjectURL(t),o.remove()})(e,l,i),n({file:e,filename:l,extension:i})}catch(e){t(e)}})}function u(e,l){let i=document.createElement("a");document.body.appendChild(i),i.setAttribute("style","display: none"),i.href=e,i.download="".concat(l),i.target="_blank",i.click(),window.URL.revokeObjectURL(e),i.remove()}function c(e){return new Promise((l,i)=>{let t=new FormData;for(let l=0;l<(null==e?void 0:e.length);l++)t.append("filenames",e[l]);n.default.post("v2/uploads/all-type/multiple",t).then(e=>{l(e)}).catch(e=>{var l,n;null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||l.message,i(e)})})}function v(e){var l,i,n,t,o,s,r,a,d,u,c;let v=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e=e||window.event;let m=(null===(l=e)||void 0===l?void 0:l.which)?null===(i=e)||void 0===i?void 0:i.which:null===(n=e)||void 0===n?void 0:n.keyCode;if(v){if(46===m&&((null===(s=e)||void 0===s?void 0:null===(o=s.target)||void 0===o?void 0:null===(t=o.value)||void 0===t?void 0:t.length)===0||(null===(d=e)||void 0===d?void 0:null===(a=d.target)||void 0===a?void 0:null===(r=a.value)||void 0===r?void 0:r.indexOf("."))!==-1)){e.preventDefault();return}if(m>31&&(m<48||m>57)&&46!==m)return null===(u=e)||void 0===u||u.preventDefault(),!1}else if(m>31&&(m<48||m>57))return null===(c=e)||void 0===c||c.preventDefault(),!1}function m(e,l,i){let n=Array.from(e),[t]=n.splice(l,1);return n.splice(i,0,t),n}},21962:function(e,l,i){"use strict";i.d(l,{G:function(){return n},k:function(){return t}});
1class n{constructor(e){var l,i;this.bankAccountName=null==e?void 0:e.bankAccountName,this.bankAccountNumber=null==e?void 0:e.bankAccountNumber,this.bankId=null==e?void 0:e.bankId,this.image=null==e?void 0:null===(i=e.bank)||void 0===i?void 0:null===(l=i.logo)||void 0===l?void 0:l.url}}class t{constructor(e){var l;this.value=null==e?void 0:e.id,this.label=null==e?void 0:e.name,this.image=null==e?void 0:null===(l=e.image)||void 0===l?void 0:l.url}}},50319:function(e,l,i){"use strict";i.d(l,{U:function(){return o}});var n=i(30381),t=i.n(n);class o{constructor(e){var l;this.withdrawDate=t()(null==e?void 0:e.withdrawDate,"YYYY-MM-DD").toDate().toISOString(),this.withdrawTransactions=null==e?void 0:null===(l=e.data)||void 0===l?void 0:l.map(e=>new s(e))}}class s{constructor(e){var l,i,n,t;this.id=null==e?void 0:e.id,this.code=null==e?void 0:e.code,this.status=null==e?void 0:e.status,this.createdAt=null==e?void 0:e.createdAt,this.storyTitle=null==e?void 0:e.title,this.rejectReason=null==e?void 0:null===(l=e.detail)||void 0===l?void 0:l.cancelReason,this.withdrawAmount=null==e?void 0:e.totalAmount,this.bankAccountName=null==e?void 0:null===(i=e.detail)||void 0===i?void 0:i.bankAccountName,this.bankAccountNumber=null==e?void 0:null===(n=e.detail)||void 0===n?void 0:n.bankAccountNumber,this.remark=null==e?void 0:null===(t=e.detail)||void 0===t?void 0:t.remark,this.approvedAt=null==e?void 0:e.approvedAt}}},83701:function(e,l,i){"use strict";var n=i(81534),t=i(95147),o=i(41962),s=i(96486),r=i.n(s),a=i(21556),d=i(76402),u=i(50319),c=i(21962);let v="/v2/admin/stories",m="v2/admin/stories/transactions/withdraws",h=e=>l=>{l({type:a.Z.SET_REQUESTING,payload:e})},f=e=>l=>{l({type:a.Z.DASHBOARD_REQUEST,payload:e})};l.default={createDraftStoriesAdmin:e=>()=>new Promise((l,i)=>{t.default.post("".concat(v,"/drafts"),e).then(e=>{l(e)}).catch(e=>{var l,t;let s=null==e?void 0:null===(t=e.response)||void 0===t?void 0:null===(l=t.data)||void 0===l?void 0:l.message;n.ZP.error(s||o.Z.Toastify.Unspecific_Error),i(e)})}),createStoryFromDraftAdmin:(e,l)=>()=>new Promise((i,s)=>{t.default.post("".concat(v,"/drafts/").concat(e),l).then(e=>{i(e)}).catch(e=>{var l,i;let t=null==e?void 0:null===(i=e.response)||void 0===i?void 0:null===(l=i.data)||void 0===l?void 0:l.message;n.ZP.error(t||o.Z.Toastify.Unspecific_Error),s(e)})}),createRaiseFundsAdmin:e=>()=>new Promise((l,i)=>{t.default.post(v,e).then(e=>{l(e)}).catch(e=>{var l,t;let s=null==e?void 0:null===(t=e.response)||void 0===t?void 0:null===(l=t.data)||void 0===l?void 0:l.message;n.ZP.error(s||o.Z.Toastify.Unspecific_Error),i(e)})}),getStoriesAdmin:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(l,i)=>{var n,o,s,d,u,c;l(h(!0));let m=r().cloneDeep(null===(s=i())||void 0===s?void 0:null===(o=s.admin)||void 0===o?void 0:null===(n=o.fundraisers
1)||void 0===n?void 0:n.queries),f=r().omit(m,"page"|"categoryIds"),p=null===(d=m?.categoryIds||[])||void 0===d?void 0:d.join("|"),x=r().cloneDeep(null===(c=i())||void 0===c?void 0:null===(u=c.admin.fundraisers)||void 0===u?void 0:u.fundraiser);return new Promise((i,n)=>{t.default.get(v,{params:{...f,categoryIds:p}}).then(n=>{let{data:t,metadata:o}=null==n?void 0:n.data,s={fundraiser:e?[...x,...t]:t,metadata:o};l({type:a.Z.GET_FUNDRAISER,payload:s});let r={total:null==o?void 0:o.total};l({type:a.Z.SET_LOCAL_STATES,payload:r}),l(h(!1)),i(n)}).catch(e=>{l(h(!1)),n(e)})})}},exportDonations:function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return()=>{t.default.post("".concat(v,"/transactions/").concat(e,"/exports"),{},{params:l,responseType:"arraybuffer",headers:{Accept:"application/octet-stream"}}).then(e=>{(0,d.lm)(e.data,"Donation Report","xlsx")}).catch(e=>{})}},setQueries:e=>l=>{l({type:a.Z.SET_QUERIES,payload:e})},setRequesting:h,resetQueries:()=>e=>{e({type:a.Z.RESET_QUERIES})},setDashBoardRequesting:f,getDashBoardStories:e=>e=>(e(f(!0)),new Promise((l,i)=>{t.default.get("".concat(v,"/dashboard")).then(i=>{e(f(!1));let n={...null==i?void 0:i.data};e({type:a.Z.GET_STORIES_DASHBOARD,payload:n}),l(i)}).catch(l=>{e(f(!1)),i(l)})})),getDraftStoryAdmin:e=>l=>new Promise((i,n)=>{t.default.get("".concat(v,"/").concat(e)).then(e=>{let n=null==e?void 0:e.data;i(n),l({type:a.Z.GET_STORY_BY_ID,payload:n})}).catch(e=>{n(e)})}),getFundraiserSummary:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return l=>new Promise((i,n)=>{t.default.get("".concat(v,"/transactions"),{limit:5,offset:0,params:e}).then(e=>{let n=null==e?void 0:e.data;l({type:a.Z.GET_SUMMARY_TRANSACTION,payload:n}),i(n)}).catch(e=>{n(e)})})},updateStatusStory:(e,l)=>(i,s)=>new Promise((d,u)=>{t.default.put("".concat(v,"/").concat(e,"/approves"),l).then(e=>{var n,t,o;d(e);let u=r().cloneDeep(null===(o=s())||void 0===o?void 0:null===(t=o.admin)||void 0===t?void 0:null===(n=t.fundraisers)||void 0===n?void 0:n.storyDetail),c={...u,status:null==l?void 0:l.status};i({type:a.Z.UPDATE_STORY_LOCAL,payload:c})}).catch(e=>{var l,i;let t=null==e?void 0:null===(i=e.response)||void 0===i?void 0:null===(l=i.data)||void 0===l?void 0:l.message;n.ZP.error(t||o.Z.Toastify.Unspecific_Error),u(e)})}),deleteStory:(e,l)=>(i,n)=>new Promise((n,o)=>{t.default.delete("".concat(v,"/").concat(e),{data:{status:l}}).then(e=>{i(h(!1)),n(e)}).catch(e=>{i(h(!1)),o(e)})}),deleteDraftStory:e=>(l,i)=>new Promise((l,i)=>{t.default.delete("".concat(v,"/drafts/").concat(e)).then(e=>{l(e)}).catch(e=>{i(e)})}),updateAdminStory:(e,l)=>()=>new Promise((i,s)=>{t.default.put("".concat(v,"/").concat(e),l).then(e=>{i(e)}).catch(e=>{var l,i;let t=null==e?void 0:null===(i=e.response)||void 0===i?void 0:null===(l=i.data)||void 0===l?void 0:l.message;n.ZP.error(t||o.Z.Toastify.Unspecific_Error),s(e)})}),setLocalStatesAction:e=>l=>{let i={...e};l({type:a.Z.SET_LOCAL_STATES,payload:i})},getAdminBankByStoryId:e=>l=>new Promise((i,n)=>{t.default.get("".concat(v,"/").concat(e,"/banks")).then(e=>{var n;i(null==e?void 0:e.data),l({type:WithDrawTypes.GET_BANK_ACCOUNT_BY_STORY_ID,payload:null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.data})}).catch(e=>{var l,i;null==e||null===(i=e.response)||void 0===i||null===(l=i.data)||void 0===l||l.message,n(null==e?void 0:e.response)})}),createAdminWithdraw:e=>l=>new Promise((l,i)=>{t.default.post("".concat(m),e).then(e=>{l(e)}).catch(e=>{var l,n;null==e||null===(n=e.response)||void 0===n||null===(l=n.data)||void 0===l||l.message,i(null==e?void 0:e.response)})}),getWithdrawHistories:e=>l=>new Promise((i,n)=>{t.default.get("".concat(m,"/stories/").concat(e),{params:{limit:0}}).then(e=>{var n,t,o;i(e),l({type:a.Z.GET_WITHDRAW_HISTORIES,payload:{data:null==e?void 0:null===(t=e.data)||void 0===t?void 0:null===(n=t.data)||void 0===n?void 0:n.map(e=>new u.U(e)),total:null==e?void 0:null===(o=e.data)||void 0===o?void 0:o.totalWithdrawnAmount}})}).catch(e=>{n(null==e?void 0:e.response)})}),setDefaultBank:e=>l=>{l({type:a.Z.SET_DEFAULT_BANK,payload:e})},getBanks:()=>{let e={type:"BANK"};return l=>{t.default.get("".concat("/v2/organizations"),{params:e}).then(e=>{var i,n;let t=null==e?void 0:null===(n=e.data)||void 0===n?void 0:null===(i=n.data)||void 0===i?void 0:i.map(e=>new c.k(e));l({type:a.Z.GET_BANKS,payload:t})}).catch(e=>{var l,i;null==e||null===(i=e.response)||void 0===i||null===(l=i.data)||void 0===l||l.message})}}}},34538:function(e,l,i){"use strict";var n=i(95147),t=i(36808),o=i.n(t),s=i(96486),r=i.n(s),a=i(4734);let d=e=>l=>{l({type:a.Z.SET_REQUESTING,payload:e})};l.default={setRequesting:d,getLanguage:()=>(e,l)=>(e(d(!0)),new Promise((i,t)=>{var o,s,u;
1let c=r().cloneDeep(null===(u=l())||void 0===u?void 0:null===(s=u.admin)||void 0===s?void 0:null===(o=s.languages)||void 0===o?void 0:o.queries);n.default.get("/v2/admin/languages",{params:c}).then(l=>{e(d(!1));let{data:n}=null==l?void 0:l.data,t={languages:r().map(n,r().partialRight(r().pick,["id","code","name"]))};e({type:a.Z.GET_LANGUAGE,payload:t}),i(l)}).catch(e=>{t(e)})})),onSwitchLng:e=>l=>{o().set("locale",e),l({type:a.Z.LANGUAGE_CHANGE,payload:e})}}},95778:function(e,l,i){"use strict";var n=i(95147),t=i(16047),o=i(81534),s=i(41962);let r="/v2/admin/users",a=e=>l=>{l({type:t.Z.SET_REQUESTING,payload:e})};l.default={setRequesting:a,getUsers:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(l,i)=>{var o,s,d,u,c,v;l(a(!0,"users"));let m=_.cloneDeep(null===(d=i())||void 0===d?void 0:null===(s=d.admin)||void 0===s?void 0:null===(o=s.user)||void 0===o?void 0:o.queries),h=_.omit(m,"page"),f=_.cloneDeep(null===(v=i())||void 0===v?void 0:null===(c=v.admin)||void 0===c?void 0:null===(u=c.user)||void 0===u?void 0:u.users);n.default.get("".concat(r),{params:h}).then(i=>{l(a(!1,"users"));let{data:n,metadata:o}=null==i?void 0:i.data,s={users:e?[...f,...n]:n,metadata:o};l({type:t.Z.GET_USERS,payload:s})}).catch(e=>{l(a(!1,"users"))})}},getUser:function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return i=>{i(a(!0,"users"));let o={organizationId:l};return new Promise((l,s)=>{n.default.get("".concat(r,"/").concat(e),{params:o}).then(e=>{i(a(!1,"users"));let n=null==e?void 0:e.data;i({type:t.Z.GET_USER,payload:n}),l(e)}).catch(e=>{i(a(!1,"users")),s(e)})})}},setQueries:e=>(l,i)=>{var n,o;let s=null===(o=i())||void 0===o?void 0:null===(n=o.admin.user)||void 0===n?void 0:n.queries,r={...s,...e};l({type:t.Z.SET_QUERIES,payload:r})},resetQueries:()=>e=>{e({type:t.Z.RESET_QUERIES})},createAdminUser:e=>l=>new Promise((l,i)=>{n.default.post("".concat(r),e).then(e=>{l(e)}).catch(e=>{var l,i;let n=null==e?void 0:null===(i=e.response)||void 0===i?void 0:null===(l=i.data)||void 0===l?void 0:l.message;o.ZP.error(n||s.Z.Toastify.Unspecific_Error)})}),editAdminUser:(e,l)=>i=>new Promise((i,t)=>{n.default.put("".concat(r,"/").concat(e),l).then(e=>{i(e)}).catch(e=>{var l,i;let n=null==e?void 0:null===(i=e.response)||void 0===i?void 0:null===(l=i.data)||void 0===l?void 0:l.message;o.ZP.error(n||s.Z.Toastify.Unspecific_Error),t(e)})}),deleteAdminUser:e=>l=>new Promise((l,i)=>{n.default.delete("".concat(r,"/").concat(e)).then(e=>{o.ZP.success("Status is successfully updated"),l(e)}).catch(e=>{var l,n;let t=null==e?void 0:null===(n=e.response)||void 0===n?void 0:null===(l=n.data)||void 0===l?void 0:l.message;o.ZP.error(t||s.Z.Toastify.Unspecific_Error),i(e)})}),getDropdownUsers:()=>(e,l)=>{var i,o,s;let a=_.cloneDeep(null===(s=l())||void 0===s?void 0:null===(o=s.admin)||void 0===o?void 0:null===(i=o.user)||void 0===i?void 0:i.queries),d=_.omit(a,"page");n.default.get("".concat(r),{params:d}).then(l=>{let{data:i,metadata:n}=null==l?void 0:l.data;e({type:t.Z.GET_DROPDOWN_USERS,payload:{dropdownUsers:i,dropdownUserMetadata:n}})}).catch(e=>{})},removeEndorserUser:e=>l=>new Promise((l,i)=>{n.default.put("".concat(r,"/").concat(e,"/endorses"),{id:e}).then(e=>{l(e)}).catch(e=>{var l,n;let t=null==e?void 0:null===(n=e.response)||void 0===n?void 0:null===(l=n.data)||void 0===l?void 0:l.message;o.ZP.error(t||s.Z.Toastify.Unspecific_Error),i(e)})})}},4905:function(e,l,i){"use strict";i.d(l,{F7:function(){return a},cz:function(){return s},g9:function(){return r}});var n=i(30381),t=i.n(n),o=i(67171);let s=function(){var e;let l=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null===(e=o.Q)||void 0===e?void 0:e.ISO_DATE_WITH_TIME,n=t()(l);return(null==n?void 0:n.isValid())?null==n?void 0:n.format(i):""},r=function(e,l){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=!(arguments.length>3)||void 0===arguments[3]||arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=t()(e),r=t()(l);if((null==s?void 0:s.isValid())&&(null==r?void 0:r.isValid())){let e=null==r?void 0:r.diff(s,"years");null==s||s.add(e,"years");let l=null==r?void 0:r.diff(s,"months");null==s||s.add(l,"months");let t=null==r?void 0:r.diff(s,"days");null==s||s.add(t,"days");let a=null==r?void 0:r.diff(s,"hours");null==s||s.add(a,"hours");let d=null==r?void 0:r.diff(s,"minutes"),u="",c="";if(i){let i=e?e+" year".concat(e>1?"s":""):"";u+=i,u+=u&&l?" ":"";let n=l?l+" month".concat(l>1?"s":""):"";u+=n,u+=u&&t?" ":"";let o=t?t+" day".concat(t>1?"s":""):"";u+=o,c=c||i||n||o}if(n){u+=u&&d?" ":"";let e=a?a+" hour".concat(a>1?"s":""):"";u+=e,u+=u&&a?" ":"";let l=d?d+" minute".concat(d>1?"s":""):"";u+=l,c=c||e||l}return o?c:u}return""},a=(e,l)=>{let i=new Date(e),n=new Date(l);return!e||!l||i<=n}},58514:function(){},82090:function(e,l,i){"use strict";var n=i(87462),t=i(63366),o=i(94184),s=i.n(o),r=i(67294),a=i(47150),d=i(76792),u=i(68496),c=i(45017),v=i(44945),m=i(88792),h=["as","activeKey","b
1sPrefix","children","className","onSelect"],f=r.forwardRef(function(e,l){var i=(0,a.Ch)(e,{activeKey:"onSelect"}),o=i.as,u=void 0===o?"div":o,v=i.activeKey,f=i.bsPrefix,p=i.children,x=i.className,g=i.onSelect,b=(0,t.Z)(i,h),j=s()(x,(0,d.vE)(f,"accordion"));return r.createElement(m.Z.Provider,{value:v||null},r.createElement(c.Z.Provider,{value:g||null},r.createElement(u,(0,n.Z)({ref:l},b,{className:j}),p)))});f.displayName="Accordion",f.Toggle=u.Z,f.Collapse=v.Z,l.Z=f},44945:function(e,l,i){"use strict";var n=i(87462),t=i(63366),o=i(67294),s=i(9966),r=i(88792),a=i(45017),d=["children","eventKey"],u=o.forwardRef(function(e,l){var i=e.children,u=e.eventKey,c=(0,t.Z)(e,d),v=(0,o.useContext)(r.Z);return o.createElement(a.Z.Provider,{value:null},o.createElement(s.Z,(0,n.Z)({ref:l,in:v===u},c),o.createElement("div",null,o.Children.only(i))))});u.displayName="AccordionCollapse",l.Z=u},88792:function(e,l,i){"use strict";var n=i(67294).createContext(null);n.displayName="AccordionContext",l.Z=n},68496:function(e,l,i){"use strict";i.d(l,{n:function(){return d}});var n=i(87462),t=i(63366),o=i(67294),s=i(45017),r=i(88792),a=["as","children","eventKey","onClick"];function d(e,l){var i=(0,o.useContext)(r.Z),n=(0,o.useContext)(s.Z);return function(t){var o=e===i?null:e;n&&n(o,t),l&&l(t)}}var u=o.forwardRef(function(e,l){var i=e.as,s=void 0===i?"button":i,r=e.children,u=e.eventKey,c=e.onClick,v=(0,t.Z)(e,a),m=d(u,c);return"button"===s&&(v.type="button"),o.createElement(s,(0,n.Z)({ref:l,onClick:m},v),r)});l.Z=u},9966:function(e,l,i){"use strict";var n,t=i(87462),o=i(63366),s=i(94184),r=i.n(s),a=i(91505),d=i(67294),u=i(26273),c=i(93825),v=i(16833),m=i(34509),h=["onEnter","onEntering","onEntered","onExit","onExiting","className","children","dimension","getDimensionValue"],f={height:["marginTop","marginBottom"],width:["marginLeft","marginRight"]};function p(e,l){var i=l["offset"+e[0].toUpperCase()+e.slice(1)],n=f[e];return i+parseInt((0,a.Z)(l,n[0]),10)+parseInt((0,a.Z)(l,n[1]),10)}var x=((n={})[u.Wj]="collapse",n[u.Ix]="collapsing",n[u.d0]="collapsing",n[u.cn]="collapse show",n),g=d.forwardRef(function(e,l){var i=e.onEnter,n=e.onEntering,s=e.onEntered,a=e.onExit,f=e.onExiting,g=e.className,b=e.children,j=e.dimension,N=void 0===j?"height":j,y=e.getDimensionValue,w=void 0===y?p:y,A=(0,o.Z)(e,h),k="function"==typeof N?N():N,E=(0,d.useMemo)(function(){return(0,v.Z)(function(e){e.style[k]="0"},i)},[k,i]),I=(0,d.useMemo)(function(){return(0,v.Z)(function(e){var l="scroll"+k[0].toUpperCase()+k.slice(1);e.style[k]=e[l]+"px"},n)},[k,n]),T=(0,d.useMemo)(function(){return(0,v.Z)(function(e){e.style[k]=null},s)},[k,s]),S=(0,d.useMemo)(function(){return(0,v.Z)(function(e){e.style[k]=w(k,e)+"px",(0,m.Z)(e)},a)},[a,w,k]),D=(0,d.useMemo)(function(){return(0,v.Z)(function(e){e.style[k]=null},f)},[k,f]);return d.createElement(u.ZP,(0,t.Z)({ref:l,addEndListener:c.Z},A,{"aria-expanded":A.role?A.in:null,onEnter:E,onEntering:I,onEntered:T,onExit:S,onExiting:D}),function(e,l){return d.cloneElement(b,(0,t.Z)({},l,{className:r()(g,b.props.className,x[e],"width"===k&&"width")}))})});g.defaultProps={in:!1,timeout:300,mountOnEnter:!1,unmountOnExit:!1,appear:!1,getDimensionValue:p},l.Z=g},95340:function(e,l,i){"use strict";var n=Object.assign||function(e){for(var l=1;l<arguments.length;l++){var i=arguments[l];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},t=function(){function e(e,l){for(var i=0;i<l.length;i++){var n=l[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(l,i,n){return i&&e(l.prototype,i),n&&e(l,n),l}}(),o=a(i(45697)),s=a(i(67294)),r=i(89571);function a(e){return e&&e.__esModule?e:{default:e}}var d={thousandSeparator:o.default.oneOfType([o.default.string,o.default.oneOf([
1!0])]),thousandSpacing:o.default.oneOf(["2","2s","3","4"]),decimalSeparator:o.default.string,decimalScale:o.default.number,fixedDecimalScale:o.default.bool,displayType:o.default.oneOf(["input","text"]),prefix:o.default.string,suffix:o.default.string,format:o.default.oneOfType([o.default.string,o.default.func]),removeFormatting:o.default.func,mask:o.default.oneOfType([o.default.string,o.default.arrayOf(o.default.string)]),value:o.default.oneOfType([o.default.number,o.default.string]),isNumericString:o.default.bool,customInput:o.default.func,allowNegative:o.default.bool,onValueChange:o.default.func,onKeyDown:o.default.func,onMouseUp:o.default.func,onChange:o.default.func,onFocus:o.default.func,onBlur:o.default.func,type:o.default.oneOf(["text","tel"]),isAllowed:o.default.func,renderText:o.default.func},u={displayType:"input",decimalSeparator:".",thousandSpacing:"3",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,isNumericString:!1,type:"text",onValueChange:r.noop,onChange:r.noop,onKeyDown:r.noop,onMouseUp:r.noop,onFocus:r.noop,onBlur:r.noop,isAllowed:r.returnTrue},c=function(e){function l(e){!function(e,l){if(!(e instanceof l))throw TypeError("Cannot call a class as a function")}(this,l);var i=function(e,l){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return l&&("object"==typeof l||"function"==typeof l)?l:e}(this,(l.__proto__||Object.getPrototypeOf(l)).call(this,e));i.validateProps();var n=i.formatValueProp();return i.state={value:n,numAsString:i.removeFormatting(n)},i.onChange=i.onChange.bind(i),i.onKeyDown=i.onKeyDown.bind(i),i.onMouseUp=i.onMouseUp.bind(i),i.onFocus=i.onFocus.bind(i),i.onBlur=i.onBlur.bind(i),i}return!function(e,l){if("function"!=typeof l&&null!==l)throw TypeError("Super expression must either be null or a function, not "+typeof l);e.prototype=Object.create(l&&l.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),l&&(Object.setPrototypeOf?Object.setPrototypeOf(e,l):e.__proto__=l)}(l,e),t(l,[{key:"componentDidUpdate",value:function(e){this.updateValueIfRequired(e)}},{key:"updateValueIfRequired",value:function(e){var l=this.props,i=this.state;if(e!==l){this.validateProps();var n=i.value,t=i.numAsString||"",o=void 0===l.value?this.formatNumString(t):this.formatValueProp();o!==n&&this.setState({value:o,numAsString:this.removeFormatting(o)})}}},{key:"getFloatString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",l=this.getSeparators().decimalSeparator,i=this.getNumberRegex(!0),n="-"===e[0];n&&(e=e.replace("-",""));var t=(e=(e.match(i)||[]).join("").replace(l,".")).indexOf(".");return -1!==t&&(e=e.substring(0,t)+"."+e.substring(t+1,e.length).replace(RegExp((0,r.escapeRegExp)(l),"g"),"")),n&&(e="-"+e),e}},{key:"getNumberRegex",value:function(e,l){var i=this.props,n=i.format,t=i.decimalScale,o=this.getSeparators().decimalSeparator;return RegExp("\\d"+(!o||0===t||l||n?"":"|"+(0,r.escapeRegExp)(o)),e?"g":void 0)}},{key:"getSeparators",value:function(){var e=this.props,l=e.decimalSeparator,i=e.thousandSpacing,n=this.props.thousandSeparator;return!0===n&&(n=","),{decimalSeparator:l,thousandSeparator:n,thousandSpacing:i}}},{key:"getMaskAtIndex",value:function(e){var l=this.props.mask,i=void 0===l?" ":l;return"string"==typeof i?i:i[e]||" "}},{key:"validateProps",value:function(){var e=this.props.mask,l=this.getSeparators(),i=l.decimalSeparator,n=l.thousandSeparator;if(i===n)throw Error("\n Decimal separator can't be same as thousand separator.\n\n thousandSeparator: "+n+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+i+" (default value for decimalSeparator is .)\n ");if(e&&("string"===e?e:e.toString()).match(/\d/g))throw Error("\n Mask "+e+" should not contain numeric character;\n ")}},{key:"splitDecimal",value:function(e){var l=this.props.allowNegative,i="-"===e[0],n=(e=e.replace("-","")).split(".");return{beforeDecimal:n[0],afterDecimal:n[1]||"",hasNagation:i,addNegation:i&&l}}},{key:"setPatchedCaretPosition",value:function(e,l,i){(0,r.setCaretPosition)(e,l),setTimeout(function(){e.value===i&&(0,r.setCaretPosition)(e,l)},0)}},{key:"correctCaretPosition",value:function(e,l,i){var n=this.props,t=n.prefix,o=n.suffix,s=n.format;if(!s){var a="-"===e[0];return Math.min(Math.max(l,t.length+(a?1:0)),e.length-o.length)}if("function"==typeof s||"#"===s[l]&&(0,r.charIsNumber)(e[l])||"#"===s[l-1]&&(0,r.charIsNumber)(e[l-1]))return l;var d=s.indexOf("#");l=Math.min(Math.max(l,d),s.lastIndexOf("#")+1);for(var u=s.substring(l,s.length).indexOf("#"),c=l,v=l+(-1===u?0:u);c>d&&("#"!==s[c]||!(0,r.charIsNumber)(e[c]));)c-=1;
1return!(0,r.charIsNumber)(e[v])||"left"===i&&l!==d||l-c<v-l?c+1:v}},{key:"getCaretPosition",value:function(e,l,i){var n=this.props.format,t=this.state.value,o=this.getNumberRegex(!0),s=(e.match(o)||[]).join(""),r=(l.match(o)||[]).join(""),a=void 0,d=void 0;for(d=0,a=0;d<i;d++){var u=e[d]||"",c=l[a]||"";if((u.match(o)||u===c)&&(!("0"===u&&c.match(o))||"0"===c||s.length===r.length)){for(;u!==l[a]&&a<l.length;)a++;a++}}return"string"!=typeof n||t||(a=l.length),a=this.correctCaretPosition(l,a)}},{key:"removePrefixAndSuffix",value:function(e){var l=this.props,i=l.format,n=l.prefix,t=l.suffix;if(!i&&e){var o="-"===e[0];o&&(e=e.substring(1,e.length));var s=(e=n&&0===e.indexOf(n)?e.substring(n.length,e.length):e).lastIndexOf(t);e=t&&-1!==s&&s===e.length-t.length?e.substring(0,s):e,o&&(e="-"+e)}return e}},{key:"removePatternFormatting",value:function(e){for(var l=this.props.format.split("#").filter(function(e){return""!==e}),i=0,n="",t=0,o=l.length;t<=o;t++){var s=l[t]||"",r=t===o?e.length:e.indexOf(s,i);if(-1===r){n=e;break}n+=e.substring(i,r),i=r+s.length}return(n.match(/\d/g)||[]).join("")}},{key:"removeFormatting",value:function(e){var l=this.props,i=l.format,n=l.removeFormatting;return e&&(i?e="string"==typeof i?this.removePatternFormatting(e):"function"==typeof n?n(e):(e.match(/\d/g)||[]).join(""):(e=this.removePrefixAndSuffix(e),e=this.getFloatString(e))),e}},{key:"formatWithPattern",value:function(e){for(var l=this.props.format,i=0,n=l.split(""),t=0,o=l.length;t<o;t++)"#"===l[t]&&(n[t]=e[i]||this.getMaskAtIndex(i),i+=1);return n.join("")}},{key:"formatThousand",value:function(e,l,i){var n=void 0;switch(i){case r.thousandGroupSpacing.two:n=/(\d)(?=(\d{2})+(?!\d))/g;break;case r.thousandGroupSpacing.twoScaled:n=/(\d)(?=(((\d{2})+)(\d{1})(?!\d)))/g;break;case r.thousandGroupSpacing.four:n=/(\d)(?=(\d{4})+(?!\d))/g;break;default:n=/(\d)(?=(\d{3})+(?!\d))/g}return e.replace(n,"$1"+l)}},{key:"formatAsNumber",value:function(e){var l=this.props,i=l.decimalScale,n=l.fixedDecimalScale,t=l.prefix,o=l.suffix,s=this.getSeparators(),a=s.thousandSeparator,d=s.decimalSeparator,u=s.thousandSpacing,c=-1!==e.indexOf(".")||i&&n,v=this.splitDecimal(e),m=v.beforeDecimal,h=v.afterDecimal,f=v.addNegation;return void 0!==i&&(h=(0,r.limitToScale)(h,i,n)),a&&(m=this.formatThousand(m,a,u)),t&&(m=t+m),o&&(h+=o),f&&(m="-"+m),e=m+(c&&d||"")+h}},{key:"formatNumString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",l=this.props.format,i=e;return""===e?i="":"-"!==e||l?i="string"==typeof l?this.formatWithPattern(i):"function"==typeof l?l(i):this.formatAsNumber(i):(i="-",e=""),i}},{key:"formatValueProp",value:function(){var e=this.props,l=e.format,i=e.decimalScale,n=e.fixedDecimalScale,t=this.props,o=t.value,s=t.isNumericString;return void 0===o?"":("number"==typeof o&&(o=o.toString(),s=!0),s&&!l&&"number"==typeof i&&(o=(0,r.roundToPrecision)(o,i,n)),s?this.formatNumString(o):this.formatInput(o))}},{key:"formatNegation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",l=this.props.allowNegative,i=RegExp("(-)(.)*(-)"),n=/(-)/.test(e),t=i.test(e);return e=e.replace(/-/g,""),n&&!t&&l&&(e="-"+e),e}},{key:"formatInput",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this.props.format||(e=this.formatNegation(e)),e=this.removeFormatting(e),this.formatNumString(e)}},{key:"isCharacterAFormat",value:function(e,l){var i=this.props,n=i.format,t=i.prefix,o=i.suffix,s=i.decimalScale,r=i.fixedDecimalScale,a=this.getSeparators().decimalSeparator;return"string"==typeof n&&"#"!==n[e]||!n&&(e<t.length||e>=l.length-o.length||!!s&&!!r&&l[e]===a)}},{key:"checkIfFormatGotDeleted",value:function(e,l,i){for(var n=e;n<l;n++)if(this.isCharacterAFormat(n,i))return!0;return!1}},{key:"correctInputValue",value:function(e,l,i){var n=this.props.format,t=this.state.numAsString||"";if(i.length>=l.length||!i.length)return i;var o=(0,r.splitString)(l,e),s=(0,r.splitString)(i,e),a=o[1].lastIndexOf(s[1]),d=-1!==a?o[1].substring(0,a):"",u=e+d.length;if(this.checkIfFormatGotDeleted(e,u,l)&&(i=l),!n){var c=this.removeFormatting(i),v=this.splitDecimal(c),m=v.beforeDecimal,h=v.afterDecimal,f=v.addNegation;if(c.length<t.length&&""===m&&!parseFloat(h))return f?"-":""}return i}},{key:"onChange",value:function(e){e.persist();var l=e.target,i=l.value,n=this.state,t=this.props,o=t.isAllowed,s=n.value||"",r=Math.max(l.selectionStart,l.selectionEnd);
1i=this.correctInputValue(r,s,i);var a=this.formatInput(i)||"",d=this.removeFormatting(a),u={formattedValue:a,value:d,floatValue:parseFloat(d)};o(u)||(a=s),l.value=a;var c=this.getCaretPosition(i,a,r);this.setPatchedCaretPosition(l,c,a),a!==s?this.setState({value:a,numAsString:d},function(){t.onValueChange(u),t.onChange(e)}):t.onChange(e)}},{key:"onBlur",value:function(e){var l=this.props,i=this.state,n=l.format,t=l.onBlur,o=i.numAsString,s=i.value;if(!n){o=(0,r.fixLeadingZero)(o);var a=this.formatNumString(o),d={formattedValue:a,value:o,floatValue:parseFloat(o)};if(a!==s){e.persist(),this.setState({value:a,numAsString:o},function(){l.onValueChange(d),t(e)});return}}t(e)}},{key:"onKeyDown",value:function(e){var l=e.target,i=e.key,n=l.selectionEnd,t=l.value,o=l.selectionStart,s=void 0,r=this.props,a=r.decimalScale,d=r.fixedDecimalScale,u=r.prefix,c=r.suffix,v=r.format,m=r.onKeyDown,h=this.getNumberRegex(!1,void 0!==a&&d),f=/-/,p="string"==typeof v;if("ArrowLeft"===i||"Backspace"===i?s=o-1:"ArrowRight"===i?s=o+1:"Delete"===i&&(s=o),void 0===s||o!==n){m(e);return}var x=s,g=p?v.indexOf("#"):u.length,b=p?v.lastIndexOf("#")+1:t.length-c.length;if("ArrowLeft"===i||"ArrowRight"===i)x=this.correctCaretPosition(t,s,"ArrowLeft"===i?"left":"right");else if("Delete"!==i||h.test(t[s])||f.test(t[s])){if("Backspace"===i&&!h.test(t[s])&&!f.test(t[s])){for(;!h.test(t[x-1])&&x>g;)x--;x=this.correctCaretPosition(t,x,"left")}}else for(;!h.test(t[x])&&x<b;)x++;(x!==s||s<g||s>b)&&(e.preventDefault(),this.setPatchedCaretPosition(l,x,t)),e.isUnitTestRun&&this.setPatchedCaretPosition(l,x,t),this.props.onKeyDown(e)}},{key:"onMouseUp",value:function(e){var l=e.target,i=l.selectionStart,n=l.selectionEnd,t=l.value;if(i===n){var o=this.correctCaretPosition(t,i);o!==i&&this.setPatchedCaretPosition(l,o,t)}this.props.onMouseUp(e)}},{key:"onFocus",value:function(e){var l=this;e.persist(),setTimeout(function(){var i=e.target,n=i.selectionStart,t=i.value,o=l.correctCaretPosition(t,n);o!==n&&l.setPatchedCaretPosition(i,o,t),l.props.onFocus(e)})}},{key:"render",value:function(){var e=this.props,l=e.type,i=e.displayType,t=e.customInput,o=e.renderText,a=this.state.value,u=(0,r.omit)(this.props,d),c=n({},u,{type:l,value:a,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});return"text"===i?o?o(a)||null:s.default.createElement("span",u,a):t?s.default.createElement(t,c):s.default.createElement("input",c)}}]),l}(s.default.Component);c.propTypes=d,c.defaultProps=u,e.exports=c},89571:function(e,l){"use strict";function i(e,l,i){for(var n="",t=i?"0":"",o=0;o<=l-1;o++)n+=e[o]||t;return n}Object.defineProperty(l,"__esModule",{value:!0}),l.noop=function(){},l.returnTrue=function(){return!0},l.charIsNumber=function(e){return!!(e||"").match(/\d/)},l.escapeRegExp=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},l.fixLeadingZero=function(e){if(!e)return e;var l="-"===e[0];l&&(e=e.substring(1,e.length));var i=e.split("."),n=i[0].replace(/^0+/,"")||"0",t=i[1]||"";return(l?"-":"")+n+(t?"."+t:"")},l.splitString=function(e,l){return[e.substring(0,l),e.substring(l)]},l.limitToScale=i,l.roundToPrecision=function(e,l,n){var t=e.split("."),o=parseFloat("0."+(t[1]||"0")).toFixed(l).split("."),s=t[0].split("").reverse().reduce(function(e,l,i){return e.length>i?(Number(e[0])+Number(l)).toString()+e.substring(1,e.length):l+e},o[0]),r=i(o[1]||"",(t[1]||"").length,n);return s+(r?"."+r:"")},l.omit=function(e,l){var i={};return Object.keys(e).forEach(function(n){l[n]||(i[n]=e[n])}),i},l.setCaretPosition=function(e,l){if(e.value=e.value,null!==e){if(e.createTextRange){var i=e.createTextRange();return i.move("character",l),i.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(l,l),!0):(e.focus(),!1)}},l.thousandGroupSpacing={two:"2",twoScaled:"2s",three:"3",four:"4"}}},function(e){e.O(0,[9774,4838,1033,8144,19,1664,4459,5506,5150,4055,6109,2284,7536,616,2386,8238,6120,6373,7555,9198,117,2004,7811,1126,4307,7221,2888,179],function(){return e(e.s=8898)}),_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.