(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5366],{46741:function(e,t,i){Promise.resolve().then(i.bind(i,78268))},78268:function(e,t,i){"use strict";i.d(t,{default:function(){return B}});var n=i(57437),l=i(57818),a=i(2265),s=i(25632),r=i(95154),o=i(35478),c=i(73454),u=i(23288),d=i(46682),p=i(18427),m=i(79226),h=i(26487),f=i(23152),g=i(97019),v=i.n(g),b=i(50104),x=i.n(b),y=i(16463),w=i(16811),C=i(54346),N=i(26683),j=i(57113),_=i(56496),D=i(3222),S=i(69548),k={cart_subscription_welcome_added:"G\xf3i welcome đ\xe3 trong v\xe0o giỏ h\xe0ng"};let Z=(0,a.forwardRef)((e,t)=>{var i,l;let{}=e,r=(0,y.useRouter)(),{config:g}=(0,s.Z)(),[b,Z]=o.ZP.useNotification(),{add:I,getCouponInfo:A,loading:P}=(0,w.Z)(),[O,T]=(0,a.useState)(),{isAuthenticated:E,profile:B}=(0,j.a)(),[M,U]=(0,a.useState)(!1),[R]=c.Z.useForm(),G=c.Z.useWatch("total",{form:R,preserve:!0}),L=c.Z.useWatch("checkBill",{form:R,preserve:!0}),q=c.Z.useWatch("code",{form:R,preserve:!0}),F=c.Z.useWatch("subscription",{form:R,preserve:!0}),z=(0,N.TL)(),W=(e,t)=>{var i;U(!0),R.setFieldsValue({subscription:t,month:null==e?void 0:null===(i=e.duration)||void 0===i?void 0:i.toString(),total:e.duration*e.price})},V=()=>{U(!1),R.resetFields()},H=(0,a.useCallback)(async()=>{let e=R.getFieldValue("code");if(!x()(e)){if(!E){let e="open".concat(Date.now());b.open({message:"Th\xf4ng b\xe1o",description:"Vui l\xf2ng đăng nhập để sử dụng m\xe3 giảm gi\xe1.",placement:"topLeft",btn:(0,n.jsx)(u.Z,{children:(0,n.jsx)(d.ZP,{type:"primary",className:"!bg-primary-2 !h-[36px] !rounded-[56px] !b2-bold",size:"small",onClick:()=>{b.destroy(e),r.push(_.Z_.SIGN_IN.path)},children:"Đăng nhập"})}),key:e});return}if(!x()(e)&&F.id)try{let t=await A({code:e,productId:F.id});t?T({code:e,discountAmount:t.discountAmount,discountType:t.discountType}):b.error({message:"Th\xf4ng b\xe1o",description:"M\xe3 giảm gi\xe1 kh\xf4ng hợp lệ",placement:"topLeft"})}catch(e){b.error({message:"Th\xf4ng b\xe1o",description:"\xc1p dụng m\xe3 giảm gi\xe1 thất bại",placement:"topLeft"})}}},[F,R,E]),Y=e=>{b.error({message:"Đăng k\xfd thất bại",description:e,placement:"topLeft"})},J=(0,a.useCallback)(async()=>{try{let e={userId:(null==B?void 0:B.id)||"",productId:F.id,quantity:Number(R.getFieldValue("month")),hasInvoice:L,note:"",couponCode:null==O?void 0:O.code},t=await I(e);r.push("".concat(_.Z_.PAYMENT.path,"?cartId=").concat(t.id))}catch(t){let e=v()(t,"error","");Y(v()(k,e,"Kh\xf4ng thể đăng k\xfd dịch vụ"))}},[I,B,F,R,L,O]);(0,a.useImperativeHandle)(t,()=>({onOpen:W}),[R]);let K=(0,a.useMemo)(()=>(null==O?void 0:O.discountType)===C.rH.PERCENTAGE?G-G*O.discountAmount/100:(null==O?void 0:O.discountType)===C.rH.FIXED?G-O.discountAmount:G,[G,O]),Q=(0,a.useMemo)(()=>(null==g?void 0:g.tax.value)&&L?(null==g?void 0:g.tax.value)/100*K:0,[L,K,null==g?void 0:g.tax.value]),X=(0,a.useMemo)(()=>K+Q,[K,Q]),$=(0,a.useCallback)(()=>{if(F){let e={product:F,quantity:R.getFieldValue("month"),hasInvoice:L,couponCode:null==O?void 0:O.code,productId:(null==F?void 0:F.id)||"",userId:(null==B?void 0:B.id)||"",cartId:"",discountPrice:K,totalPrice:X,invoicePrice:Q};if(z((0,D.aN)(e)),!E){r.push("/sign-up");return}J()}},[F,R,B,O,L,K,X,Q]);return(0,a.useEffect)(()=>{q!==(null==O?void 0:O.code)&&O&&T(void 0)},[O,q]),(0,n.jsx)(p.Z,{width:512,placement:"right",closable:!1,open:M,destroyOnClose:!0,zIndex:100,onClose:V,children:(0,n.jsxs)("div",{className:"flex flex-col justify-between h-full",children:[Z,(0,n.jsxs)("div",{children:[(0,n.jsxs)("button",{className:"flex items-center b2-regular",onClick:V,children:[(0,n.jsx)("i",{className:"ri-arrow-right-up-line"}),(0,n.jsx)(f.YG0,{className:"mr-2",size:24}),"Quay lại"]}),(0,n.jsxs)(c.Z,{name:"subscription-detail",style:{maxWidth:714},layout:"vertical",autoComplete:"off",size:"large",form:R,initialValues:{month:1,total:0,minDuration:1,checkBill:!1},children:[(0,n.jsx)(c.Z.Item,{className:"w-full !b3-medium !font-bevietnampro !mb-2",children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsxs)("h3",{className:"h5 md:h4 lg:h3 mr-4",children:[(null==F?void 0:F.code)===C._x.SUB_WELCOME&&"\uD83D\uDE80",(null==F?void 0:F.code)===C._x.SUB_STANDARD&&"\uD83D\uDD25️",(null==F?void 0:F.code)===C._x.SUB_PREMIUM&&"\uD83D\uDC8E"]}),(0,n.jsxs)("div",{className:"my-4",children:[(0,n.jsx)("h4",{className:"h4 !text-purple-2 capitalize",children:null==F?void 0:null===(i=F.name)||void 0===i?void 0:i.toLowerCase()}),(0,n.jsx)("p",{className:"b2-regular !text-purple-3 capitalize",children:null==F?void 0:null===(l=F.fullName)||void 0===l?void 0:l.toLowerCase()})]})]})}),(0,n.jsx)(c.Z.Item,{name:"month",className:"w-full !b3-medium !font-bevietnampro !mb-2",label:"Số th\xe1ng tham gia",children:(0,n.jsx)(m.Z,{className:"w-full !h-[56px] [&>*]:!h-full [&>*]:[&>*]:!h-full !b2-medium !text-purple-3",disabled:!0})}),(0,n.jsx)(c.Z.Item,{className:"w-full !b3-medium !font-bevietnampro !my-6",name:"code",children:(0,n.jsx)(m.Z,{className:"w-full !h-[56px] [&>*]:!h-full [&>*]:[&>*]:!h-full !b2-medium !text-purple-3",addonAfter:(0,n.jsx)("div",{className:"h-full flex justify-center items-center cursor-pointer",onClick:H,children:(0,n.jsx)("p",{className:"b3-bold !text-primary-2",children:"\xc1p dụng"})}),placeholder:"M\xe3 giảm gi\xe1"})}),(0,n.jsxs)("div",{className:"flex items-center justify-between !b2-medium",children:[(0,n.jsx)(c.Z.Item,{className:"!mb-0",name:"checkBill",valuePropName:"checked",children:(0,n.jsx)(h.Z,{children:(0,n.jsxs)("p",{className:"!b2-medium !text-purple-3",children:["Ho\xe1 đơn (+",null==g?void 0:g.tax.value,"%)"]})})}),(0,n.jsx)("p",{children:(0,S.T4)(Q)})]})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,n.jsx)("p",{className:"b2-medium !text-purple-3",children:"Tổng tiền"}),(0,n.jsx)("p",{className:"b1-bold !text-primary-2",children:(0,S.T4)(X)})]}),(0,n.jsx)(d.ZP,{className:"!bg-primary-2 !text-white-1 !w-full !h-[56px] !rounded-[56px] !text-lg !font-bold self-center",onClick:$,loading:P,children:"Đăng k\xfd dịch vụ"})]})]})})});Z.displayName="SubDetail";let I=(0,l.default)(()=>i.e(3447).then(i.bind(i,43447)),{loadableGenerated:{webpack:()=>[43447]}}),A=(0,l.default)(()=>Promise.all([i.e(8597),i.e(4052),i.e(2391)]).then(i.bind(i,52391)),{loadableGenerated:{webpack:()=>[52391]}}),P=(0,l.default)(()=>Promise.all([i.e(231),i.e(2606)]).then(i.bind(i,23102)),{loadableGenerated:{webpack:()=>[23102]}}),O=(0,l.default)(()=>i.e(5485).then(i.bind(i,25485)),{loadableGenerated:{webpack:()=>[25485]}}),T=(0,l.default)(()=>i.e(1503).then(i.bind(i,1503)),{loadableGenerated:{webpack:()=>[1503]}}),E=[{name:_.Z_.SUBSCRIPTION.name,link:_.Z_.SUBSCRIPTION.path}];var B=()=>{let{product:e,showCompareBenefits:t,showCompareAddonBenefits:i,loadingProduct:l,getProduct:o,checkShowCompareByPackage:c}=(0,r.m)(),u=(0,a.useRef)(null),{config:d}=(0,s.Z)();return(0,a.useEffect)(()=>{o()},[]),(0,n.jsxs)("main",{className:"flex bg-white flex-col min-h-screen items-center mx-auto bg-white-1 max-w-screen-xl",children:[(0,n.jsxs)("div",{className:"flex flex-col items-center my-4 lg:my-12 w-full px-4 lg:px-0",children:[(0,n.jsx)(P,{breadcumb:E}),(0,n.jsx)("h2",{className:"lg:h2 text-center my-4 md:h4 h5",children:"Tư vấn giải ph\xe1p đầu tư"}),(0,n.jsx)("p",{className:"b3-regular lg:b1-regular !text-purple-3 text-center",children:"“Optimizing Your Investing - Tối Ưu Giải Ph\xe1p Đầu Tư” l\xe0 t\xf4n chỉ hoạt động của đội ngũ GM Invest"})]}),(0,n.jsx)("section",{className:"w-full px-4",children:(0,n.jsx)(T,{loading:l,product:null==e?void 0:e.welcomePackage,onOpenSubDetail:()=>{var t,i,n;null===(n=u.current)||void 0===n||n.onOpen(null==e?void 0:null===(i=e.welcomePackage)||void 0===i?void 0:null===(t=i.monthOptions)||void 0===t?void 0:t[0],null==e?void 0:e.welcomePackage)}})}),(0,n.jsx)("section",{className:"w-full px-4",children:(0,n.jsx)(A,{product:e,loading:l,onOpen:(e,t)=>{var i;return null===(i=u.current)||void 0===i?void 0:i.onOpen(e,t)}})}),(0,n.jsx)("section",{className:"w-full px-4",children:(0,n.jsx)(O,{product:e,showCompareBenefits:t,showCompareAddonBenefits:i,onOpenSubDetail:(e,t)=>{var i;null===(i=u.current)||void 0===i||i.onOpen(e,t)},checkShowCompareByPackage:c})}),(0,n.jsx)("section",{className:"w-full px-4",children:(0,n.jsx)(I,{faqs:null==d?void 0:d.faqs})}),(0,n.jsx)(Z,{ref:u})]})}},16811:function(e,t,i){"use strict";i.d(t,{Z:function(){return c}});var n=i(2265),l=i(66508),a=i(15681);class s{constructor(){this.add=e=>this.apiClient.post("user/api/cart/addDraft",e),this.getAllCartDraft=e=>this.apiClient.get("user/api/cart/getAllDraftCart",{params:e}),this.getOneCartDraft=e=>this.apiClient.get("user/api/cart/getOneDraftCart",{params:e}),this.getCouponInfo=e=>this.apiClient.post("user/api/coupon/getCouponInfo",e),this.updateDraft=e=>this.apiClient.post("user/api/cart/updateDraft",e),this.removeDraft=e=>this.apiClient.post("user/api/cart/removeDraft",e),this.apiClient=new l.Z(a.Z.API_URL)}}let r=new s;var o=i(54346),c=()=>{let[e,t]=(0,n.useState)(!1),[i,l]=(0,n.useState)(!1),[a,s]=(0,n.useState)(!1),[c,u]=(0,n.useState)(!1),[d,p]=(0,n.useState)(),[m,h]=(0,n.useState)();return{add:async e=>{try{return t(!0),await r.add(e)}catch(e){throw e}finally{t(!1)}},getAllCartDraft:async e=>{try{t(!0);let i=e||o.GA,n=await r.getAllCartDraft(i);h(n)}catch(e){throw e}finally{t(!1)}},getOneCartDraft:async e=>{try{u(!0);let t=await r.getOneCartDraft(e);p(t)}catch(e){throw e}finally{u(!1)}},getCouponInfo:async e=>{try{return t(!0),await r.getCouponInfo(e)}catch(e){throw e}finally{t(!1)}},updateDraft:async e=>{try{s(!0),await r.updateDraft(e);let t=await r.getOneCartDraft({id:e.id});p(t)}catch(e){throw e}finally{s(!1)}},removeDraft:async e=>{try{return l(!0),await r.removeDraft(e)}catch(e){throw e}finally{l(!1)}},draftCart:m,draftCartGetOne:d,loading:e,loadingRemoveDraft:i,loadingUpdateDraft:a,loadingGetOneDraft:c}}},25632:function(e,t,i){"use strict";i.d(t,{Z:function(){return u}});var n=i(2265),l=i(66508),a=i(15681);class s{constructor(){this.faq=()=>this.apiClient.get("common/api/config/getSubscriptionFaq"),this.tax=()=>this.apiClient.get("common/api/config/getOnePublicByType?type=tax"),this.getOneByType=e=>this.apiClient.get("common/api/config/getOneByType",{params:e}),this.apiClient=new l.Z(a.Z.API_URL)}}let r=new s;var o=i(3222),c=i(26683),u=()=>{let e=(0,c.TL)(),[t,i]=(0,n.useState)(!1),l=(0,c.CG)(e=>e.global.config),a=async()=>{try{i(!0);let[t,n,l]=await Promise.all([r.faq(),r.tax(),r.getOneByType({type:"course_slider"})]);e((0,o.lu)({faqs:t,tax:n,slidersCourse:l}))}catch(e){}finally{i(!1)}};return(0,n.useEffect)(()=>{l||a()},[]),{getInitConfig:a,loading:t,config:l}}},95154:function(e,t,i){"use strict";i.d(t,{m:function(){return g}});var n=i(2265),l=i(97019),a=i.n(l),s=i(13632),r=i.n(s),o=i(80203),c=i.n(o),u=i(50104),d=i.n(u),p=i(66202),m=i.n(p),h=i(98924),f=i(54346);let g=()=>{let[e,t]=(0,n.useState)(),[i,l]=(0,n.useState)(!1),[s,o]=(0,n.useState)(!1),u=(0,n.useMemo)(()=>{if(d()(e))return{benefits:[],addon_benefits:[]};if(null==e?void 0:e.standardPackage){var t,i,n;let l=JSON.parse(null==e?void 0:null===(t=e.standardPackage)||void 0===t?void 0:t.metadata);return{benefits:null==l?void 0:null===(i=l.benefits)||void 0===i?void 0:i.filter(e=>e.show_compare),addon_benefits:null==l?void 0:null===(n=l.addon_benefit)||void 0===n?void 0:n.filter(e=>e.show_compare)}}return{benefits:[],addon_benefits:[]}},[e]),p=(0,n.useMemo)(()=>{if(d()(e))return{benefits:[],addon_benefits:[]};if(null==e?void 0:e.premiumPackage){var t,i,n;let l=JSON.parse(null==e?void 0:null===(t=e.premiumPackage)||void 0===t?void 0:t.metadata);return{benefits:null==l?void 0:null===(i=l.benefits)||void 0===i?void 0:i.filter(e=>e.show_compare),addon_benefits:null==l?void 0:null===(n=l.addon_benefit)||void 0===n?void 0:n.filter(e=>e.show_compare)}}return{benefits:[],addon_benefits:[]}},[e]),g=(0,n.useMemo)(()=>m()(u.benefits,p.benefits,"description"),[p,u]),v=(0,n.useMemo)(()=>m()(u.addon_benefits,p.addon_benefits,"description"),[p,u]),b=(0,n.useCallback)(function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"benefits";return t===f._x.SUB_STANDARD?r()(a()(u,i),t=>t.description===e):t===f._x.SUB_PREMIUM&&r()(a()(p,i),t=>t.description===e)},[p,u]),x=e=>({welcomePackage:c()(e,e=>e.code===f._x.SUB_WELCOME),premiumPackage:c()(e,e=>e.code===f._x.SUB_PREMIUM),standardPackage:c()(e,e=>e.code===f._x.SUB_STANDARD)});return{product:e,showCompareBenefits:g,showCompareAddonBenefits:v,loadingProduct:i,showCompareStandard:u,showComparePremium:p,getProduct:async()=>{try{l(!0);let e=await h.Z.getAllSubscription(),i=x(e);t({...i})}catch(e){}finally{l(!1)}},getAllCourse:async e=>{try{o(!0);let t=e||{...f.GA};return await h.Z.getAllCourse(t)}catch(e){}finally{o(!1)}},checkShowCompareByPackage:b}}},98924:function(e,t,i){"use strict";var n=i(66508),l=i(15681);class a{constructor(){var e=this;this.getAllSubscription=()=>this.apiClient.get("user/api/product/getAllSubscription"),this.getAllCourse=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.apiClient.get("user/api/product/getAllCourse",{params:t,...i})},this.getOneCourse=e=>this.apiClient.get("user/api/product/getOneCourse",{params:e}),this.getAllEvent=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.apiClient.get("user/api/product/getAllEvent",{params:t,...i})},this.getOneEvent=e=>this.apiClient.get("user/api/product/getOneEvent",{params:e}),this.apiClient=new n.Z(l.Z.API_URL)}}let s=new a;t.Z=s}},function(e){e.O(0,[3665,802,6705,4283,1173,6682,778,4818,3924,2586,2733,1444,7157,8403,6862,2300,5478,5476,3454,6487,5759,3516,1492,2971,7023,1744],function(){return e(e.s=46741)}),_N_E=e.O()}]);