1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1806,1506,6286,4720,5477],{92473:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return verified_item_list}});var l=i(85893),n=i(3306),r=i(67518),a=i(63262),s=i(5114),o=i(18677),d=i(65301),u=i(48583),c=i(70451),p=i(86926),m=i(78617),v=i(67294),_=i(41609),h=i.n(_),f=i(93967),g=i.n(f),x=i(98451),b=i(58154),y=i(60802),j=i(18510),N=i(11163),w=i(91341),C=i(10265),P=i(43516),O=i(31955),D=i(18272);let PlaceOrderAction=e=>{let[t,i]=(0,v.useState)(null),{createOrder:n,isLoading:r}=(0,x.QE)(),{locale:a}=(0,N.useRouter)(),{items:s}=(0,o.jD)(),{me:p}=(0,w.aF)(),[{billing_address:m,shipping_address:_,delivery_time:f,coupon:A,verified_response:k,customer_contact:R,customer_name:I,payment_gateway:Z,payment_sub_gateway:L,note:T,token:E,payable_amount:S}]=(0,u.KO)(c.hq),[K]=(0,u.KO)(c.yw),[q]=(0,u.KO)(c.xc),{settings:F}=(0,P.rV)();(0,v.useEffect)(()=>{i(null)},[Z]);let G=null==s?void 0:s.filter(e=>{var t;return!(null==k?void 0:null===(t=k.unavailable_products)||void 0===t?void 0:t.includes(e.id))}),M=(0,d.tf)(G,F),Y=null==F?void 0:F.freeShippingAmount,V=null==F?void 0:F.freeShipping,z=V&&Number(Y)<=M,H=(0,d.eA)({totalAmount:M,tax:null==k?void 0:k.total_tax,shipping_charge:null==k?void 0:k.shipping_charge},Number(K)),J=G.find(e=>!!e.is_digital),U=J?[R,Z,G]:[R,Z,m,_,f,G];J||p||U.push(I);let W=U.every(e=>!h()(e));return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(y.Z,{loading:r,className:g()("mt-5 w-full",e.className),onClick:()=>{if(!R){i("Contact Number Is Required");return}if(!q&&!Z){i("Gateway Is Required");return}let e=!!q&&0==S,t=e?C.HY.FULL_WALLET_PAYMENT:Z,l={products:null==G?void 0:G.map(e=>(0,j.Y)(e)),amount:M,coupon_id:Number(null==A?void 0:A.id),discount:null!=K?K:0,paid_total:H,sales_tax:null==k?void 0:k.total_tax,delivery_fee:z?0:null==k?void 0:k.shipping_charge,total:H,delivery_time:null==f?void 0:f.title,customer_contact:R,customer_name:I,note:T,payment_gateway:t,payment_sub_gateway:L,use_wallet_points:q,isFullWalletPayment:e,billing_address:{...(null==_?void 0:_.address)&&_.address},shipping_address:{...(null==_?void 0:_.address)&&_.address}};delete l.billing_address.__typename,delete l.shipping_address.__typename,n(l),O.Z.remove(D.pD)},disabled:!W||!!r,...e}),t&&(0,l.jsx)("div",{className:"mt-3",children:(0,l.jsx)(b.Z,{message:t})}),!W&&(0,l.jsx)("div",{className:"mt-3",children:(0,l.jsx)(b.Z,{message:"Por favor, selecione e preencha todos os campos e finalize seu pedido"})})]})};var A=i(84008),k=i(91737),verified_item_list=e=>{var t,i;let{className:v}=e,{items:_,isEmpty:h}=(0,o.jD)(),[f]=(0,u.KO)(c.Jb),[g,x]=(0,u.KO)(c.GO),[b]=(0,u.KO)(c.yw),[y]=(0,u.KO)(c.y2),[j]=(0,u.KO)(c.xc),{settings:N}=(0,P.rV)(),w=null==_?void 0:_.filter(e=>{var t;return!(null==f?void 0:null===(t=f.unavailable_products)||void 0===t?void 0:t.includes(e.id))}),{price:C}=(0,r.ZP)(f&&{amount:null!==(t=f.total_tax)&&void 0!==t?t:0}),{price:O}=(0,r.ZP)(f&&{amount:null!==(i=f.shipping_charge)&&void 0!==i?i:0}),D=(0,d.tf)(w,N),{price:R}=(0,r.ZP)(f&&{amount:D}),{price:I}=(0,r.ZP)(b&&{amount:Number(b)}),Z=f?(0,d.eA)({totalAmount:D,tax:null==f?void 0:f.total_tax,shipping_charge:null==f?void 0:f.shipping_charge},Number(b)):0,{price:L}=(0,r.ZP)(f&&{amount:Z});return(0,l.jsxs)("div",{className:v,children:[(0,l.jsx)("div",{className:"flex flex-col border-b border-border-200 pb-2",children:h?(0,l.jsx)(a.Z,{}):null==_?void 0:_.map(e=>{var t;let i=null==f?void 0:null===(t=f.unavailable_products)||void 0===t?void 0:t.find(t=>t===e.id);return(0,l.jsx)(k.Z,{item:e,notAvailable:!!i},e.id)})}),(0,l.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,l.jsx)(p.m,{title:"Subtotal",value:R}),(0,l.jsx)(p.m,{title:"Imposto",value:C}),(0,l.jsx)(p.m,{title:"Envio",value:O}),b&&g?(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)("p",{className:"text-sm text-gray-800 ltr:mr-4 rtl:ml-4",children:"Desconto"}),(0,l.jsxs)("span",{className:"flex items-center text-xs font-semibold text-red-500 ltr:mr-auto rtl:ml-auto",children:["(",null==g?void 0:g.code,")",(0,l.jsx)("button",{type:"button",onClick:()=>x(null),children:(0,l.jsx)(s.Tw,{className:"h-3 w-3 ltr:ml-2 rtl:mr-2"})})]}),(0,l.jsx)("span",{className:"text-sm font-semibold text-gray-800",children:I})]}):(0,l.jsx)("div",{className:"!mt-5 !mb-4 flex justify-between",children:(0,l.jsx)(n.Z,{theme:"dark",subtotal:D})}),(0,l.jsxs)("div",{className:"flex justify-between border-t-4 border-double border-border-200 pt-3",children:[(0,l.jsx)("p",{className:"text-base font-semibold text-heading",children:"Valor Total"}),(0,l.jsx)("span",{className:"text-base font-semibold text-heading",children:L})]})]}),f&&(0,l.jsx)(A.Z,{totalPrice:Z,walletAmount:f.wallet_amount,walletCurrency:f.
1wallet_currency}),j&&!y?null:(0,l.jsx)(m.Z,{theme:"bw",className:"mt-10 rounded-md border border-gray-200 bg-light p-5"}),(0,l.jsx)(PlaceOrderAction,{className:"mt-8 h-[50px] w-full font-normal transition-colors",children:"Finalizar Compra"})]})}},51506:function(e,t,i){"use strict";i.r(t),i.d(t,{SpinnerLoader:function(){return SpinnerLoader}});var l=i(85893),n=i(5281),r=i.n(n),a=i(93967),s=i.n(a);let SpinnerLoader=e=>{let{className:t}=e;return(0,l.jsx)("span",{className:s()("inline-flex h-5 w-5 animate-spin rounded-full border-2 border-t-2 border-transparent border-t-accent",t)})};t.default=e=>{let{className:t,showText:i=!0,text:n="Loading",simple:a=!1}=e;return(0,l.jsx)(l.Fragment,{children:a?(0,l.jsx)("span",{className:s()(t,r().simple_loading)}):(0,l.jsxs)("span",{className:s()("flex h-screen w-full flex-col items-center justify-center",t),children:[(0,l.jsx)("span",{className:r().loading}),i&&(0,l.jsx)("h3",{className:"text-lg font-semibold italic text-body",children:n})]})})}},16877:function(e,t,i){"use strict";i.d(t,{M9:function(){return isCheckoutPostOrderNavigationActive},mC:function(){return beginCheckoutPostOrderNavigation},pP:function(){return clearCheckoutPostOrderNavigation}});let l=!1;function beginCheckoutPostOrderNavigation(){l=!0}function isCheckoutPostOrderNavigationActive(){return l}function clearCheckoutPostOrderNavigation(){l=!1}},84395:function(e,t,i){"use strict";i.d(t,{Mo:function(){return needRecipe},Wk:function(){return validatePrescriptionDate},YA:function(){return transformRecipes},nr:function(){return isPsychotropic},q0:function(){return getRecipeRequirement},qv:function(){return saveRecipe}});var l=i(10265),n=i(57661),r=i(71526),a=i(55678),s=i(28065);let isPsychotropic=e=>(null==e?void 0:e.psico_identifier)===!0,needRecipe=e=>(null==e?void 0:e.antibiotico)===!0||(null==e?void 0:e.psico_identifier)===!0,validatePrescriptionDate=(e,t,i)=>{let l;let n=e.split("/"),r="".concat(n[1],"/").concat(n[0],"/").concat(n[2]),a=new Date(r).getTime(),s=new Date,o=s.setDate(s.getDate()+0);return l=void 0!==i&&i>0?s.setDate(s.getDate()-i):t?s.setDate(s.getDate()-30):s.setDate(s.getDate()-10),!(a>o)&&!(a<=l)},transformRecipes=e=>e&&Array.isArray(e)?e.map(e=>{if(!e)return null;let t=e.type?"string"==typeof e.type?e.type.toLowerCase():String(e.type).toLowerCase():"physical",i=null==e?void 0:e.file,n=t!==l.nT.DIGITAL,a=(null==i?void 0:i.id)!=null?i.id:null;return n&&null==a?null:{name:e.name||"",document:e.rg||"",type:t===l.nT.DIGITAL?"digital":"physical",date:e.date?(0,r.p6)(e.date):"",token:(null==e?void 0:e.token)||null,attachment_id:a,user_relationship_id:(null==e?void 0:e.relative_id)||null}}).filter(e=>null!==e):[];function getRecipeRequirement(e){let t=null==e?void 0:e.reduce((e,t)=>{let i="string"==typeof t.value?"true"===t.value.toLowerCase():t.value;return e[t.id]=i,e},{});return{antibiotic:(null==t?void 0:t[n.t.ANTIBIOTICO.id])||!1,psychotropic:(null==t?void 0:t[n.t.PSICOTROPICO.id])||!1}}let saveRecipe=async e=>{let{formValues:t,savedRecipes:i,setSavedRecipes:n,recipeMetadata:o,selectedOwnerType:d,selectedRecipeType:u,onReset:c,me:p,createUserRelationship:m,updateUserRelationship:v}=e,_=t.id||Date.now().toString(),h={id:_,date:t.date||"",ownerType:d,type:u},f={};if(d===l.jc.USER)f={rg:t.rg,name:null==p?void 0:p.first_name};else try{let e=t.relative_id;if(e)await v({relative_id:e,name:t.relative_name,document:t.relative_rg,document_type:"rg",birth_date:(0,r.p6)(t.relative_birthdate),relationship:t.relative_parentesco,phone:t.relative_phone});else{let i=await m({name:t.relative_name,document:t.relative_rg,document_type:"rg",birth_date:(0,r.p6)(t.relative_birthdate),relationship:t.relative_parentesco,phone:t.relative_phone});e=null==i?void 0:i.id}f={relative_id:e,relative_name:t.relative_name,name:t.relative_name,relative_rg:t.relative_rg,rg:t.relative_rg,relative_birthdate:t.relative_birthdate,relative_parentesco:t.relative_parentesco,relative_phone:t.relative_phone}}catch(e){var g,x;s.u.error("Checkout recipe: save recipe failed (user relationship)",{email:null==p?void 0:p.email,responseData:null==e?void 0:null===(g=e.response)||void 0===g?void 0:g.data,status:null==e?void 0:null===(x=e.response)||void 0===x?void 0:x.status}),a.toast.error("Erro ao criar relacionamento do usu\xe1rio, prossiga com o cadastro da receita!");return}let b={...h,...f,...o},y=i.some(e=>e.id===_);n(y?i.map(e=>e.id===_?b:e):[...i,b]),c()}},5281:function(e){e.exports={loading:"spinner_loading__oxEJH",spin:"spinner_spin__F8IIK",simple_loading:"spinner_simple_loading__9C9C7",pulse:"spinner_pulse__pGk4M"}}}]); 2//# sourceMappingURL=1806.ab6ab0758d3a5c7f.js.map
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.