1 line
5.7 KiB
JavaScript
1 line
5.7 KiB
JavaScript
import{o as e}from"./dist-BHykSMWQ.js";import{t}from"./jsx-runtime-BpzPEenQ.js";import{t as n}from"./compiler-runtime-sKsOXjDo.js";import{a as r,i,n as a,t as o}from"./shared-Db76xCub.js";var s=n(),c=t();function l(t){let n=(0,s.c)(81),{interest:l,investors:p,owners:m,journeyInvestorId:h}=t,g=h??``,_=`${l.reference} — ${l.sector_interest}`,v;n[0]!==g||n[1]!==_?(v={investor_id:g,legal_name:``,investor_type:``,owner_user_id:``,title:_,next_action:``,due_at:``},n[0]=g,n[1]=_,n[2]=v):v=n[2];let y=e(v),b;n[3]===h?b=n[4]:(b=h&&(0,c.jsx)(`p`,{children:`O investidor da jornada original está seleccionado. A conversão preserva essa identidade.`}),n[3]=h,n[4]=b);let x;n[5]!==l.full_name||n[6]!==l.reference?(x=(0,c.jsxs)(`p`,{children:[l.reference,` · Contacto: `,l.full_name]}),n[5]=l.full_name,n[6]=l.reference,n[7]=x):x=n[7];let S;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,c.jsx)(`p`,{children:`Seleccione um investidor existente ou identifique explicitamente o novo investidor. O nome do contacto não é assumido como denominação de uma empresa.`}),n[8]=S):S=n[8];let C;n[9]!==y||n[10]!==l.id?(C=e=>{e.preventDefault(),y.transform(f),y.post(`/management/crm/convert/${l.id}`)},n[9]=y,n[10]=l.id,n[11]=C):C=n[11];let w=y.processing,T=y.errors.investor_id,E=y.data.investor_id,D;n[12]===y?D=n[13]:(D=e=>y.setData(`investor_id`,e.target.value),n[12]=y,n[13]=D);let O;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,c.jsx)(`option`,{value:``,children:`Criar novo investidor`}),n[14]=O):O=n[14];let k;n[15]===p?k=n[16]:(k=p.map(d),n[15]=p,n[16]=k);let A;n[17]!==y.data.investor_id||n[18]!==D||n[19]!==k?(A=(0,c.jsxs)(`select`,{className:r,value:E,onChange:D,children:[O,k]}),n[17]=y.data.investor_id,n[18]=D,n[19]=k,n[20]=A):A=n[20];let j;n[21]!==y.errors.investor_id||n[22]!==A?(j=(0,c.jsx)(o,{label:`Investidor existente`,error:T,children:A}),n[21]=y.errors.investor_id,n[22]=A,n[23]=j):j=n[23];let M;n[24]===y?M=n[25]:(M=!y.data.investor_id&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(o,{label:`Nome legal do investidor`,error:y.errors.legal_name,children:(0,c.jsx)(`input`,{className:`w-full rounded-md border border-input bg-background p-2 text-foreground`,value:y.data.legal_name,onChange:e=>y.setData(`legal_name`,e.target.value)})}),(0,c.jsx)(o,{label:`Tipo de investidor`,error:y.errors.investor_type,children:(0,c.jsxs)(`select`,{className:`w-full rounded-md border border-input bg-background p-2 text-foreground`,value:y.data.investor_type,onChange:e=>y.setData(`investor_type`,e.target.value),children:[(0,c.jsx)(`option`,{value:``,children:`Seleccione`}),(0,c.jsx)(`option`,{value:`domestic`,children:`Nacional`}),(0,c.jsx)(`option`,{value:`foreign`,children:`Estrangeiro`}),(0,c.jsx)(`option`,{value:`institutional`,children:`Institucional`}),(0,c.jsx)(`option`,{value:`individual`,children:`Individual`})]})})]}),n[24]=y,n[25]=M);let N=y.errors.owner_user_id,P=y.data.owner_user_id,F;n[26]===y?F=n[27]:(F=e=>y.setData(`owner_user_id`,e.target.value),n[26]=y,n[27]=F);let I;n[28]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,c.jsx)(`option`,{value:``,children:`Seleccione`}),n[28]=I):I=n[28];let L;n[29]===m?L=n[30]:(L=m.map(u),n[29]=m,n[30]=L);let R;n[31]!==y.data.owner_user_id||n[32]!==F||n[33]!==L?(R=(0,c.jsxs)(`select`,{className:r,value:P,onChange:F,children:[I,L]}),n[31]=y.data.owner_user_id,n[32]=F,n[33]=L,n[34]=R):R=n[34];let z;n[35]!==y.errors.owner_user_id||n[36]!==R?(z=(0,c.jsx)(o,{label:`Responsável`,error:N,children:R}),n[35]=y.errors.owner_user_id,n[36]=R,n[37]=z):z=n[37];let B;n[38]===y?B=n[39]:(B=e=>y.setData(`title`,e.target.value),n[38]=y,n[39]=B);let V;n[40]!==y.data.title||n[41]!==B?(V=(0,c.jsx)(`input`,{className:r,value:y.data.title,onChange:B}),n[40]=y.data.title,n[41]=B,n[42]=V):V=n[42];let H;n[43]!==y.errors.title||n[44]!==V?(H=(0,c.jsx)(o,{label:`Título do lead`,error:y.errors.title,children:V}),n[43]=y.errors.title,n[44]=V,n[45]=H):H=n[45];let U;n[46]===y?U=n[47]:(U=e=>y.setData(`next_action`,e.target.value),n[46]=y,n[47]=U);let W;n[48]!==y.data.next_action||n[49]!==U?(W=(0,c.jsx)(`input`,{className:r,value:y.data.next_action,onChange:U}),n[48]=y.data.next_action,n[49]=U,n[50]=W):W=n[50];let G;n[51]!==y.errors.next_action||n[52]!==W?(G=(0,c.jsx)(o,{label:`Próxima acção`,error:y.errors.next_action,children:W}),n[51]=y.errors.next_action,n[52]=W,n[53]=G):G=n[53];let K;n[54]===y?K=n[55]:(K=e=>y.setData(`due_at`,e.target.value),n[54]=y,n[55]=K);let q;n[56]!==y.data.due_at||n[57]!==K?(q=(0,c.jsx)(`input`,{type:`datetime-local`,className:r,value:y.data.due_at,onChange:K}),n[56]=y.data.due_at,n[57]=K,n[58]=q):q=n[58];let J;n[59]!==y.errors.due_at||n[60]!==q?(J=(0,c.jsx)(o,{label:`Prazo (hora local)`,error:y.errors.due_at,children:q}),n[59]=y.errors.due_at,n[60]=q,n[61]=J):J=n[61];let Y=y.processing?`A converter…`:`Converter em lead`,X;n[62]!==y.processing||n[63]!==Y?(X=(0,c.jsx)(`button`,{className:i,disabled:y.processing,children:Y}),n[62]=y.processing,n[63]=Y,n[64]=X):X=n[64];let Z;n[65]!==y.processing||n[66]!==j||n[67]!==M||n[68]!==z||n[69]!==H||n[70]!==G||n[71]!==J||n[72]!==X?(Z=(0,c.jsxs)(`fieldset`,{disabled:w,className:`space-y-4`,children:[j,M,z,H,G,J,X]}),n[65]=y.processing,n[66]=j,n[67]=M,n[68]=z,n[69]=H,n[70]=G,n[71]=J,n[72]=X,n[73]=Z):Z=n[73];let Q;n[74]!==Z||n[75]!==C?(Q=(0,c.jsx)(`form`,{className:`max-w-2xl space-y-4`,onSubmit:C,children:Z}),n[74]=Z,n[75]=C,n[76]=Q):Q=n[76];let $;return n[77]!==Q||n[78]!==b||n[79]!==x?($=(0,c.jsxs)(a,{title:`Converter pedido em lead`,children:[b,x,S,Q]}),n[77]=Q,n[78]=b,n[79]=x,n[80]=$):$=n[80],$}function u(e){return(0,c.jsx)(`option`,{value:e.id,children:e.name},e.id)}function d(e){return(0,c.jsx)(`option`,{value:e.id,children:e.legal_name},e.id)}function f(e){return{...e,due_at:e.due_at?new Date(e.due_at).toISOString():``}}export{l as default}; |