PageSourceSearch

https://secure-static.fattureincloud.it/612a3dec6c04ffa7afea637957068d66/assets/CompanyInfoPage-BF4EyKOU.js

js fattureincloud.it collected 2026-10-02 02:30:07 UTC 33,588 bytes, 1 lines download raw bytes

1import{K as M,fO as nt,as as n,j as e,bO as ie,r as i,l$ as qe,hC as U,m0 as Fe,F as ot,m1 as rt,b8 as lt,ax as ke,X as ct,C as dt,m2 as we,aj as Ke,f as Oe,e as ut,dl as Le,b0 as Te,dk as pt,g_ as Ge,dp as ve,eD as mt,h as le,bN as Ye,m3 as ht,z as xt,hD as gt,du as ft,lT as yt,dG as Qe,b as Je,lG as jt,a1 as De,kp as Ct,q as $e,cp as vt,m4 as bt,hg as Tt,m5 as Dt,ec as At,lR as St,s as It,dI as _t,I as Et,ar as Rt}from"./index-Q1iXNk99.js";import{T as j,m as Nt,u as Ze,e as H,a as wt,b as Pt,M as Mt,d as kt}from"./InternalApp-Wz5OWhFv.js";import{S as C,B as Be,b as Bt}from"./VaporIconBase-DKBiqbaD.js";import{B as Ot}from"./BetterTabs-Cm_UOsuR.js";import{c as zt,u as Ft,E as Lt,B as Gt,a as $t,M as Ve}from"./useModefinanceBanner-DFPpPYQl.js";import{u as Vt}from"./useSorting-CN2qeyyc.js";import{E as Ut}from"./EmptyTable-DS-P1WJt.js";import{E as Wt}from"./ExportTable-Bai2bifK.js";import{P,D as Ue}from"./documents-Bj0mKn64.js";import{d as Xt}from"./IssuedDocumentHelper-glpQaO12.js";import{V as Ht}from"./useCompanyRegistryActivationPermissions-l6SE_hl0.js";import{T as qt}from"./index-CrS1VC0z.js";import{a as et,u as Kt,f as Yt,B as Qt,E as Jt,g as Zt,c as es,d as ts,e as ss,R as be,N as as}from"./useGetExistingScore-C4ZqTKa-.js";import"./mapRoutes-Bk_cS7Ze.js";import"./FICModule-sJUKROR-.js";import"./FICPageSection-BnLT3aGG.js";import"./FICModuleTitle-CG-_7DU3.js";import"./FICInputText-C9LNsxWR.js";import"./FICTooltip-C8aKWVwm.js";import"./ValidatedInput-bECwFuQ2.js";import"./teamSystemLogoColor-BoYBUdMc.js";import"./NotificationSentModalBody-D2vrAhWs.js";import"./usePersonSelector-B3gieVmm.js";import"./SidesStyle-Rj3wDMBW.js";import"./ComponentWithHooks-6tnToJ1n.js";import"./FICAutocomplete-C-NmwFv3.js";import"./objectUtils-CaUc5Oqv.js";import"./UserInfoBox-Dz_fH-cw.js";import"./timeUtils-wl9JyQyd.js";import"./FICTooltip-U3V2C9wm.js";import"./FICFormGenerator-JXGxSFjb.js";import"./passwordHelper-Ixw_b-Xt.js";import"./validators-DdErpdqQ.js";import"./App-D0F3ZlvM.js";import"./useGetUrlSub-DH9Ch-n7.js";import"./useWithoutHelp-DzHiOgWE.js";import"./EntitySuggestionDropdown-QtVExJIy.js";import"./NumericInput-CE_TH9tW.js";import"./AutocompleteDropdown-BPryTj24.js";import"./useBanner-_Lsenu_V.js";import"./index-CBqSKsdP.js";import"./FICLabel-CM82NjUS.js";const J=M.div.withConfig({displayName:"styled__ContentSection"})(["margin-bottom:32px;"]),Z=M.div.withConfig({displayName:"styled__MainGrid"})(["display:grid;grid-template-columns:176px 1fr 320px;gap:24px;@media (max-width:1024px){grid-template-columns:1fr;}"]),ee=M.div.withConfig({displayName:"styled__InfoGrid"})(["display:grid;grid-template-columns:subgrid;grid-column:1 / 3;gap:12px;row-gap:8px;"]),l=M.div.withConfig({displayName:"styled__InfoItem"})(["display:grid;grid-template-columns:subgrid;grid-column:1 / 3;align-items:start;gap:24px;"]),is=M.div.withConfig({displayName:"styled__MapContainer"})(["grid-column:3;grid-row:1;width:320px;height:320px;background:#f5f5f5;border-radius:8px;display:flex;align-items:center;justify-content:center;color:#999;font-size:14px;overflow:hidden;@media (max-width:1024px){height:250px;}"]),r=M(n).withConfig({displayName:"styled__RegularBody"})(["color:",";font-weight:400;"],({theme:t})=>t.palette.text.secondary),ns=M(nt).withConfig({displayName:"styled__CompanyInfoPageWrapper"})(["padding:0px 24px;min-width:880px;width:100%;max-width:calc(100% - 48px);"]),os=M.div.withConfig({displayName:"styled__Divider"})(["width:100%;border-bottom:1px solid ",";"],({theme:t})=>t.palette.grey[100]),rs=M.div.withConfig({displayName:"styled__BackButtonWrapper"})(["z-index:5;background:",";padding:20px 24px 12px;margin-left:-24px;margin-right:-24px;margin-bottom:12px;position:sticky;top:0;border-bottom:1px solid ",";"],({theme:t})=>t.palette.white[100],({theme:t})=>t.palette.grey[100]),ls=M.div.withConfig({displayName:"styled__BackContent"})(["display:flex;flex-direction:row;gap:4px;flex-wrap:nowrap;align-content:center;align-items:center;cursor:pointer;"]),cs=M.div.withConfig({displayName:"styled__BackText"})(["font-size:14px;font-weight:500;line-height:22px;"]),ds=M.div.withConfig({displayName:"styled__EntityTypeBadge"})(["border:1px solid ",";color:",";padding:4px 8px;border-radius:4px;font-size:12px;font-family:Roboto;font-weight:400;font-style:Regular;leading-trim:NONE;line-height:16px;letter-spacing:0%;vertical-align:middle;"],({$entityType:t})=>t==="suppliers"?"#753F83":"#0095d5",({$entityType:t})=>t==="suppliers"?"#753F83":"#0095d5"),We=({data:t})=>e.jsxs(e.Fragment,{children:[e.jsxs(J,{children:[e.jsx("div",{style:{marginBottom:"16
1px"},children:e.jsx(ie,{bold:!0,style:{margin:0},children:"Attività"})}),e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsxs(l,{children:[e.jsx(r,{children:"Stato attività:"}),e.jsx(n,{children:t?.statusCode||""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Codice ATECO:"}),e.jsx(n,{children:t?.industryAtecoSectorCode||""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Descrizione ATECO:"}),e.jsx(n,{children:t?.industryAtecoDescriptionIt||""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Codice REA:"}),e.jsx(n,{children:t?.reaCode||""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Data d'iscrizione REA:"}),e.jsx(n,{children:t?.relevantRegistrationDate||""})]})]})})]}),e.jsxs(J,{children:[e.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:e.jsx(ie,{bold:!0,style:{margin:0},children:"Dati economici"})}),e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsxs(l,{children:[e.jsx(r,{children:"Fatturato:"}),e.jsx(n,{children:t?.revenue!=null?new Intl.NumberFormat("it-IT",{style:"currency",currency:"EUR",maximumFractionDigits:0}).format(t.revenue):""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Chiusura ultimo bilancio:"}),e.jsx(n,{children:t?.lastBalanceSheetClosingDate||""})]})]})})]}),e.jsx(J,{children:e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(r,{children:"Dati forniti da"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.jsx(j,{variant:"caption",border:{border:"1px solid #1a2b36",padding:"2px",width:"fit-content"},children:"modefinance"}),e.jsx(j,{fontSize:7.5,color:"primary.interactiveDefault",children:"a TeamSystem company"})]})]})})})})]}),us=({ficEntity:t,entityType:s})=>{const a=d=>d?new Date(d).toLocaleDateString("it-IT"):"",o=()=>{if(!t?.defaultPaymentTerms)return"";const d=t.defaultPaymentTerms,h=t.defaultPaymentTermsType==="end_of_month"?"gg. fine mese":"giorni";return`${d} ${h}`},f=()=>{if(!t?.defaultVat)return"";const{description:d,value:p}=t.defaultVat;return d?`${p}% - ${d}`:`${p}%`};return s==="suppliers"?e.jsxs(J,{children:[e.jsx("div",{style:{marginBottom:"16px"},children:e.jsx(ie,{bold:!0,style:{margin:0},children:"Rapporti commerciali"})}),e.jsx(Z,{children:e.jsx(ee,{children:e.jsxs(l,{children:[e.jsx(r,{children:"IBAN:"}),e.jsx(n,{children:t?.bankIban||""})]})})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(J,{children:[e.jsx("div",{style:{marginBottom:"16px"},children:e.jsx(ie,{bold:!0,style:{margin:0},children:"Rapporti commerciali"})}),e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsxs(l,{children:[e.jsx(r,{children:"Aliquota IVA predefinita:"}),e.jsx(n,{children:f()})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Sconto predefinito:"}),e.jsx(n,{children:t?.defaultDiscount!=null?`${t.defaultDiscount}%`:""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Listino prezzi applicato:"}),e.jsx(n,{children:t?.priceList?.name||""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Termini di pagamento:"}),e.jsx(n,{children:o()})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Metodo di pagamento predefinito:"}),e.jsx(n,{children:t?.defaultPaymentMethod?.name||""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"IBAN cliente (RiBa):"}),e.jsx(n,{children:t?.bankIban||""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Fax:"}),e.jsx(n,{children:t?.fax||""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Indirizzo di spedizione:"}),e.jsx(n,{children:t?.shippingAddress||""})]})]})})]}),e.jsxs(J,{children:[e.jsx("div",{style:{marginBottom:"16px"},children:e.jsx(ie,{bold:!0,style:{margin:0},children:"Lettera d'intento"})}),e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsxs(l,{children:[e.jsx(r,{children:"Data ricevuta telematica:"}),e.jsx(n,{children:a(t?.intentDeclarationProtocolDate)})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Protocollo ricezione:"}),e.jsx(n,{children:t?.intentDeclarationProtocolNumber||""})]})]})})]})]})},ps=(t,s,a,o)=>{const[f,d]=i.useState(!1);return i.useEffect(()=>{if(d(!1),!o||!t.trim())return;const p=new AbortController;return fetch(`https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(t)}&key=${qe}`,{signal:p.signal}).then(h=>h.json()).then(h=>{const u=h.results?.[0];if(h.status!=="OK"||!u||u.partial_match||u.geometry?.location_type==="APPROXIMATE"){d(!1);return}const v=u.address_components??[],I=g=>g.trim().toLowerCase(),D=I(a),y=g=>{const A=I(g).split(/[\s,./]+/);return new Set(A.filter(N=>N.length>2&&!/^\d+$/.test(N)))},c=v.find(g=>g.types.includes("route"));if(!c){d(!1);return}const _=y(s),q=new Set([...y(c.long_name),...y(c.short_name)]);if(![..._].some(g=>q.has(g))){d(!1);return}const T=v.find(g=>g.types.includes("locality")||g.types.includes("administrative_area_level_3")||g.types.includes("postal_town")),k=I(T?.long_name??"")===D||I(T?.short_name??"")===D;d(k)}).catch(h=>{h.name!=="AbortError"&&d(!1)}),()=>p.abort()},[t,s,a,o]),f},F=(t,s)=>t||s||"",Xe=({data:t,entityType:s="clients",ficEntity:a,isNew:o=!1})=>{const f=()=>
1a?.addressStreet?a.addressStreet:t&&t.addressStreetName||"",d=()=>[f(),F(a?.addressPostalCode,t?.addressPostalCode),F(a?.addressCity,t?.addressCity),F(a?.addressProvince,t?.provinceCode),a?.country||""].filter(Boolean).join(", "),p=f().trim(),h=F(a?.addressCity,t?.addressCity).trim(),u=ps(d(),p,h,!!p&&!!h);return e.jsx(e.Fragment,{children:e.jsxs(J,{children:[e.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:e.jsx(ie,{bold:!0,style:{margin:0},children:"Panoramica"})}),e.jsxs(Z,{children:[e.jsxs(ee,{children:[e.jsxs(l,{children:[e.jsx(r,{children:"Denominazione:"}),e.jsx(n,{children:F(a?.name,t?.name)})]}),!o&&e.jsxs(l,{children:[e.jsx(r,{children:"Codice destinatario SDI:"}),e.jsx(n,{children:a?.eiCode||""})]}),!o&&e.jsxs(l,{children:[e.jsx(r,{children:"Tipologia:"}),e.jsx(n,{children:F(a?.type?zt.find(v=>v.value===a.type)?.label:null,t?.legalFormDescriptionIt)})]}),!o&&e.jsxs(l,{children:[e.jsx(r,{children:"Referente:"}),e.jsx(n,{children:a?.contactPerson||""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Partita IVA:"}),e.jsx(n,{children:F(a?.vatNumber,t?.vatNumber)})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Codice Fiscale:"}),e.jsx(n,{children:F(a?.taxCode,t?.fiscalCode)})]}),e.jsxs(l,{style:{marginTop:"24px"},children:[e.jsx(r,{children:"Indirizzo:"}),e.jsx(n,{children:f()})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Città:"}),e.jsx(n,{children:F(a?.addressCity,t?.addressCity)})]}),e.jsxs(l,{children:[e.jsx(r,{children:"CAP:"}),e.jsx(n,{children:F(a?.addressPostalCode,t?.addressPostalCode)})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Provincia:"}),e.jsx(n,{children:F(a?.addressProvince,t?.provinceCode)})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Paese:"}),e.jsx(n,{children:a?.country||""})]}),!o&&e.jsxs(e.Fragment,{children:[e.jsxs(l,{children:[e.jsx(r,{children:"Note Indirizzo:"}),e.jsx(n,{children:a?.addressExtra||""})]}),e.jsxs(l,{style:{marginTop:"24px"},children:[e.jsx(r,{children:"Codice cliente interno:"}),e.jsx(n,{children:a?.code||""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Indirizzo e-mail:"}),e.jsx(n,{children:a?.email||""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Indirizzo PEC:"}),e.jsx(n,{children:a?.certifiedEmail||""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Telefono:"}),e.jsx(n,{children:a?.phone||""})]}),e.jsxs(l,{children:[e.jsx(r,{children:"Note:"}),e.jsx(n,{children:a?.notes||""})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"max-content auto",gridColumn:"1 / 3",rowGap:"8px",columnGap:"24px",marginTop:"24px"},children:[e.jsx(r,{children:"Documento di cortesia"}),e.jsx(n,{children:a?.courtesyInvoiceConfig?.enabled===!0?"Il documento di cortesia viene inviato automaticamente a questa anagrafica.":a?.courtesyInvoiceConfig?.enabled===!1?"Il documento di cortesia non viene inviato a questa anagrafica.":"Il documento di cortesia può essere inviato a questa anagrafica."}),e.jsx(r,{children:"Solleciti automatici"}),e.jsx(n,{children:a?.solicitsConfig?.excluded?"L'anagrafica è esclusa dall'invio dei solleciti automatici.":"I solleciti automatici sono attivi per questa anagrafica."})]})]})]}),u&&e.jsx(is,{children:e.jsx("img",{src:`https://maps.googleapis.com/maps/api/staticmap?center=${encodeURIComponent(d())}&zoom=12&size=400x300&markers=color:red%7C${encodeURIComponent(d())}&key=${qe}`,alt:"Map",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"8px"}})})]})]})})},ms={[P.PAID]:{netTaxable:0,withholdingTax:0,total:0},[P.NOT_PAID]:{netTaxable:0,withholdingTax:0,total:0}},hs={icon:lt,color:"red"},xs=[{columnDefType:U.ACCESSOR,key:"documentDate",columnDef:{header:"Data doc.",fixedWidth:120,customCell:t=>e.jsx(Fe,{date:t.original.documentDate,format:"IT",locale:"it"})}},{columnDefType:U.ACCESSOR,key:"date",columnDef:{header:"Scadenza",fixedWidth:120,customCell:t=>t.original.date?e.jsx(Fe,{date:t.original.date,format:"IT",locale:"it"}):e.jsx(e.Fragment,{})}},{columnDefType:U.ACCESSOR,key:"status",columnDef:{header:"Stato",fixedWidth:130,enableSorting:!1,customCell:({original:{paymentAccount:t,status:s,trancheDate:a}})=>{const o=s===P.NOT_PAID&&ot.isBefore(a,"NOW");return e.jsx(rt,{leftIcon:o?hs:void 0,text:t==="rev"?"Stornato":o?"Termine scaduto":s===P.PAID?"Saldato":"Da saldare",type:t==="rev"?"warning":s===P.PAID?"success":"error",tagStyle:"soft"})}}},{columnDefType:U.ACCESSOR,key:"description",columnDef:{header:"Descrizione",minWidth:160,customCell:t=>e.jsxs(e.Fragment,{children:[e.jsx(n,{clamp:2,children:t.original.description}),e.jsx(ke,{clamp:1,children:t.original.subject})]})}},{columnDefType:U.ACCESSOR,key:"paymentAccountName",columnDef:{header:"Conto",customCell:({original:{paymentAccountName:t}})=>e.jsx(n,{children:t})}},{columnDefType:U.ACCESSOR,key:"paymentSettlementStatus",columnDef:{header:"Contabilità",enableSorting:!1,customCell:(t,s)=>t.original.paymentSettlementStatus==="accounted"||t.original.paymentSettlementStatus==="invalidated"?e.jsx(ct,{text:"Contabilizzato",type:dt.SUCCESS}):e.jsx(e.Fragment,{})}},{columnDefType:U.ACCESSOR,key:"netTaxable",columnDef:{header:"Imponibile",customCell:t=>e.jsx(we,{value:t.original.netTaxable,unit:{locale:"it-IT",side:"right",symbol
1:"€"}})}},{columnDefType:U.ACCESSOR,key:"withholdingTax",columnDef:{header:"Ritenuta d'acc.",customCell:t=>e.jsx(we,{value:t.original.withholdingTax,unit:{locale:"it-IT",side:"right",symbol:"€"}})}},{columnDefType:U.ACCESSOR,key:"total",columnDef:{header:"Importo totale",customCell:t=>e.jsx(we,{value:t.original.total,unit:{locale:"it-IT",side:"right",symbol:"€"}})}}],gs=(t,s)=>{const a=Ke(),o=Oe(),{showEditTranchesModal:f}=ut("modals",["showEditTranchesModal"]),[d,p]=i.useState(!1),h=i.useCallback(u=>{u.data.success&&s()},[s]);return Nt(h),i.useEffect(()=>{},[d,s,f]),i.useCallback(u=>{t==="clients"?u.original.documentType===Ue.QUOTE||u.original.documentType===Ue.CREDIT_NOTE?a(`/${u.original.type}s/view/${u.original.id}`):(o(Le({type:u.original.type,id:u.original.id})),o(Te({name:"showEditTranchesModal"})),p(!0)):u.original.net<0?a(`/${u.original.type}s/view/${u.original.id}`):(o(Le({type:u.original.type,id:u.original.id})),o(Te({name:"showEditTranchesModal"})),p(!0))},[t,a,o])},fs=t=>i.useMemo(()=>{const s=t.reduce((a,o)=>(o.status===P.REVERSED||(a[o.status].netTaxable+=o.netTaxable,a[o.status].withholdingTax+=o.withholdingTax,a[o.status].total+=o.total),a),pt.cloneDeep(ms));return[{type:Ge.WARNING,label:"TOTALE DA PAGARE",content:e.jsxs(e.Fragment,{children:[e.jsx(n,{children:ve(s[P.NOT_PAID].total)}),e.jsx(ke,{children:s[P.NOT_PAID].withholdingTax>0?`esclusi ${ve(s[P.NOT_PAID].withholdingTax)} di ritenuta`:"Nessuna ritenuta"})]})},{type:Ge.STANDARD,label:"TOTALE PAGATO",content:e.jsxs(e.Fragment,{children:[e.jsx(n,{children:ve(s[P.PAID].total)}),e.jsx(ke,{children:s[P.PAID].withholdingTax>0?`esclusi ${ve(s[P.PAID].withholdingTax)} di ritenuta`:"Nessuna ritenuta"})]})}]},[t]),ys=M.div.withConfig({displayName:"styled__GridCardWrapper"})(["& > div{border-color:",";}"],({theme:t})=>t.palette.grey[100]),js=t=>t.map(s=>{const a=mt(Xt[s.documentType].singular),o=s.documentNumber||s.numeration?`n° ${s.documentNumber}${s.numeration}/`:"";return{...s,trancheId:s.trancheId||s.id,date:s.status===P.PAID?s.paidDate:s.trancheDate,description:`${a} ${o}${s.year}`,paymentAccountName:s.paymentAccount==="not"?"":s.paymentAccount==="rev"?"Stornato":s.paymentAccount}}),Cs=({entityId:t,entityType:s})=>{const a=ft(),[o,f]=i.useState([]),[d,p]=i.useState(!0),[h,u]=i.useState(),v=i.useCallback(()=>{p(!0),le.get({request:`entities/${s}/${t}/analysis`}).then(c=>({data:c.data.data,extra:c.data.extra})).then(({data:c})=>{f(js(c))}).catch(c=>console.log(c)).finally(()=>{p(!1)})},[s,t]);i.useEffect(()=>v(),[v]);const I=Vt(o,h),D=fs(o),y=gs(s,v);return e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:24,flex:1},children:d?e.jsx(C,{justifyContent:"center",alignItems:"center",flex:1,children:e.jsx(Ye,{})}):e.jsxs(e.Fragment,{children:[e.jsx(ys,{children:e.jsx(ht,{items:D,maxElementsPerRow:2})}),t&&e.jsx(xt,{style:{justifyContent:"flex-end"},children:e.jsx(Wt,{exportFilename:`Export_${s==="clients"?"cliente":"fornitore"}_${t}.xlsx`,exportUrl:`entities/${s}/${t}/analysis/export`})}),e.jsx(gt,{uniqueId:"trancheId",headerSize:yt.SMALL,columns:xs,data:I,noPagination:!0,sortable:!0,onSort:c=>u(c),renderEmptyState:()=>e.jsx(Ut,{title:"Non ci sono dati da visualizzare",description:`Al momento non ci sono dati disponibili per il ${s==="clients"?"cliente":"fornitore"} selezionato`}),onRowClick:y,rowHighlightColor:a.palette.grey[50]})]})})},Pe={textAlign:"center",whiteSpace:"pre-line"},vs=({companyInfo:t,fiscalCode:s,isItaly:a,refetchCompanyInfo:o,setCompanyInfoLoading:f})=>{const{isTrial:d,status:p,trialPhase:h}=et(),{runSemaphoricAnalysis:u}=Kt({fiscalCode:s}),{trackCustomEvent:v}=Qe(),{pathname:I}=Je(),D=Oe(),{canUseModefinance:y,isFicBlocked:c,isTsConnectionCompleted:_}=Ze(),q=I.startsWith("/clients")?"client":"supplier",[R]=i.useState({has_existing_evaluation:!!t?.semaphoreGlobal,license_status:p});i.useEffect(()=>{y&&v("fic_modefinance_evaluation_viewed",R)},[y,v,R]);const T=h!==null||c,k=!!t,g=!!t?.semaphoreUpdatedAt,A="Non sono presenti risultati per questa anagrafica",N=x=>x?{}:{filter:"blur(4px)",opacity:.7,userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"},W=(x,ae)=>ae?{fontStyle:"italic"}:N(x),b=!T&&!!t?.semaphoreGlobal,S=!T&&k&&g&&!t?.semaphoreGlobal,L=t?.semaphoreGlobal||"AAA",K={value:L,description:b?Yt[L.toUpperCase()]?.desc?.replace(/<br *\/?>/g," "):S?A:"Azienda con eccellente profilo economico-finanziario e massima solvibilità, priva di eventi pregiudizievoli o criticità rilevanti.",hasData:b,noResults:S},ce=!T&&!!t?.semaphoreBalance,ne=!T&&k&&g&&!t?.semaphoreBalance,de=t?.semaphoreBalance||"AAA",Y={value:de,description:ce?Qt[de.toUpperCase()]?.desc:ne?A:"La solvibilità dell’impresa è ritenuta massima.",hasData:ce,noResults:ne},G=!T&&!!t?.semaphoreEsg,ue=!T&&k&&g&&!t?.semaphoreEsg,pe=t?.semaphoreEsg||"S1",O={value:pe,description:G?Jt[pe.toUpperCase()]?.desc:ue?A:"Organizzazione esposta a rischi ESG bassi/trascurabili e in grado di gestirli e monitorarli senza esporre gli stakeholder a costi imprevisti o altri impatti negativi rilevanti. La sostenibilità è ben integrata nello sviluppo strategico.",hasData:G,noResults:ue},oe=!T&&!!t?.semaphoreNegativity,me=!T&&k&&g&&!t?.semaphoreNegativity,he=t?.semaphoreNegativity||"G",$={value:he,description:oe?Zt[he.toUpperCase()]?.desc:me?A:"Sono presenti procedure concorsuali, pregiudizievoli, e protesti.",hasData:oe,noResults:me},Ae=t?.shareholdersCount??"0",xe=!T&&t?.shareholdersCount!=null,ge=!T&&k&&g&&t?.shareholdersCount==null,z=t?.defaultProbability?`${t.defaultProbability}%`:"0%",X=!T&&t?.defaultProbability!=null,te=!T&&k&&g&&t?.defaultProbability==null,re=t?.fiscalCode||"XXXXXXXXXXXXXXXX",w=!!t?.fiscalCode,B=t?.semaphoreUpdatedAt||null,[Se,fe]=i.useState(!1),Ie=!s||!a||Se,_e=!y||c||!_||T||(x=>x?Math.floor((Date.now()-new Date(x).getTime())/(1e3*60*60*24)):1/0)(B)>=7,ye=async()=>
1{if(!(!y||c||!_)){if(h==="before"){D(Te({name:"showModefinanceTrialModal"}));return}else if(h==="after"){D(Te({name:"showModefinancePackageModal"}));return}v("fic_modefinance_evaluation_requested",{entity_type:q,is_update:b,license_status:p}),fe(!0),f(!0);try{const x=await u();if(!x){De.success(as);return}(x.semaphoreGlobal||x.semaphoreUpdatedAt)&&await o(s)}catch(x){De.error(x instanceof Error?x.message:"Errore durante la valutazione dell'anagrafica selezionata. Riprova più tardi o contatta il servizio clienti.")}finally{fe(!1),f(!1)}}},se=x=>x?new Date(x).toLocaleDateString("it-IT"):"";return e.jsxs(C,{children:[e.jsxs(C,{direction:"row",alignItems:"center",justifyContent:"space-between",style:{marginBottom:16},children:[e.jsx(j,{variant:"titleSmall",children:"Valutazione"}),e.jsx(C,{direction:"row",gap:12,children:_e&&e.jsx(qt,{arrow:!0,placement:"top",title:p===H.ACTIVATING?d?"Stiamo attivando la tua prova":"Stiamo attivando le informazioni commerciali":y?c?e.jsx("div",{style:Pe,children:ts}):_?"":e.jsx("div",{style:Pe,children:ss}):e.jsx("div",{style:Pe,children:es}),children:e.jsx("span",{children:e.jsx(Be,{startIcon:e.jsx(Ht,{color:g?"primary":"white",icon:jt}),variant:"contained",disabled:y&&_?p===H.ACTIVATING||c?!0:h!==null?!1:Ie&&!g:!0,style:g?{backgroundColor:"#E3F5FF",color:"#0288D1"}:{},onClick:()=>void ye(),children:g?"Aggiorna valutazione":"Ottieni valutazione"})})})})]}),e.jsxs(C,{direction:"column",spacing:3,children:[e.jsxs(C,{direction:"row",gap:6,alignItems:"flex-start",children:[e.jsx(j,{variant:"body500",color:"text.secondary",style:{minWidth:180},children:"Valutazione globale:"}),e.jsxs(C,{direction:"row",alignItems:"flex-start",gap:1,children:[e.jsx(be,{rating:K.value,ratingType:"global",showTooltip:!1,isPlaceholder:!K.hasData}),e.jsx(j,{variant:"body",style:W(K.hasData,K.noResults),children:K.description})]})]}),e.jsxs(C,{direction:"row",gap:6,alignItems:"flex-start",children:[e.jsx(j,{variant:"body500",color:"text.secondary",style:{minWidth:180},children:"Valutazione bilanci:"}),e.jsxs(C,{direction:"row",alignItems:"flex-start",gap:1,children:[e.jsx(be,{rating:Y.value,ratingType:"balance",showTooltip:!1,isPlaceholder:!Y.hasData}),e.jsx(j,{variant:"body",style:W(Y.hasData,Y.noResults),children:Y.description})]})]}),e.jsxs(C,{direction:"row",gap:6,alignItems:"flex-start",children:[e.jsx(j,{variant:"body500",color:"text.secondary",style:{minWidth:180},children:"Valutazione ESG:"}),e.jsxs(C,{direction:"row",alignItems:"flex-start",gap:1,children:[e.jsx(be,{rating:O.value,ratingType:"esg",showTooltip:!1,isPlaceholder:!O.hasData}),e.jsx(j,{variant:"body",style:W(O.hasData,O.noResults),children:O.description})]})]}),e.jsxs(C,{direction:"row",gap:6,alignItems:"flex-start",children:[e.jsx(j,{variant:"body500",color:"text.secondary",style:{minWidth:180},children:"Valutazione negatività:"}),e.jsxs(C,{direction:"row",alignItems:"flex-start",gap:1,children:[e.jsx(be,{rating:$.value,ratingType:"negative",showTooltip:!1,isPlaceholder:!$.hasData}),e.jsx(j,{variant:"body",style:W($.hasData,$.noResults),children:$.description})]})]}),e.jsxs(C,{direction:"row",gap:6,alignItems:"flex-start",children:[e.jsx(j,{variant:"body500",color:"text.secondary",style:{minWidth:180},children:"Numero di soci:"}),e.jsx(j,{variant:"body",style:W(xe,ge),children:ge?A:Ae})]}),e.jsxs(C,{direction:"row",gap:6,alignItems:"flex-start",children:[e.jsx(j,{variant:"body500",color:"text.secondary",style:{minWidth:180},children:"Probabilità di default:"}),e.jsx(j,{variant:"body",style:W(X,te),children:te?A:z})]}),g&&e.jsxs(C,{direction:"row",gap:6,children:[e.jsx(j,{variant:"body500",color:"text.secondary",style:{minWidth:180},children:"Dati aggiornati al:"}),e.jsxs(C,{direction:"row",gap:1,alignItems:"baseline",children:[e.jsx(j,{variant:"body",style:N(!!B),children:se(B)}),e.jsx(j,{variant:"caption",style:N(!!B),children:"Modefinance ricalcola la valutazione settimanalmente."})]})]}),g&&e.jsxs(C,{direction:"row",gap:6,alignItems:"flex-start",children:[e.jsx(j,{variant:"body500",color:"text.secondary",style:{minWidth:180},children:"Codice fiscale valutato:"}
1),e.jsx(j,{variant:"body",style:N(w),children:re})]})]}),e.jsxs(C,{direction:"row",alignItems:"center",gap:2,style:{marginTop:32},children:[e.jsx(j,{variant:"bodySmall",children:"Dati forniti da"}),e.jsxs(C,{direction:"column",children:[e.jsx(j,{variant:"caption",border:{border:"1px solid #1a2b36",padding:"2px",width:"fit-content"},children:"modefinance"}),e.jsx(j,{fontSize:7.5,color:"primary.interactiveDefault",children:"a TeamSystem company"})]})]})]})},bs=t=>{const[s,a]=i.useState(t??null),[o,f]=i.useState(!1),[d,p]=i.useState(null),[h,u]=i.useState(!1),{status:v}=et(),I=i.useCallback(async D=>{f(!0),p(null);const y=encodeURIComponent(D),c=v===H.ACTIVE||v===H.EXPIRING?"modefinance":"basic";try{const _=await le.get({request:`modefinance/${y}`,queryData:{fieldset:c,backfill:!0}});a(_.data.data)}catch(_){p(_ instanceof Error?_.message:"Failed to fetch company info"),console.error("Error fetching company info:",_)}finally{f(!1),u(!0)}},[v]);return{companyInfo:s,setCompanyInfo:a,loading:o,setLoading:f,error:d,hasFetched:h,refetchCompanyInfo:I}},Ts=()=>{const[t,s]=i.useState(null),[a,o]=i.useState(!1),[f,d]=i.useState(null),[p,h]=i.useState(!1),u=i.useCallback(async(v,I)=>{o(!0),d(null),h(!1);try{const y=(await le.get({request:`entities/${v}/${I}`,queryData:{fieldset:"detailed"},onError:c=>c.response?.status!==404})).data.data;if(y.priceListId)try{const c=await le.call({method:"get",request:`price_lists/${y.priceListId}`});y.priceList=c?.data?.data??null}catch{}return s(y),y}catch(D){return Ct.isAxiosError(D)&&D.response?.status===404?(h(!0),null):(d(D instanceof Error?D.message:"Failed to fetch entity data"),console.error("Error fetching FIC entity:",D),null)}finally{o(!1)}},[]);return{ficEntity:t,loading:a,error:f,notFound:p,fetchFicEntity:u}},Ds=t=>({name:t.name,fiscalCode:t.tax_code,vatNumber:t.vat_number,addressStreetName:t.address_street,addressPostalCode:t.address_postal_code,addressCity:t.address_city,addressMunicipalityCode:t.address_city_code??null,addressMunicipalityIstatCode:t.address_city_istat??null,provinceCode:t.address_province,provinceName:t.address_province_description??null,industryAtecoSectorCode:t.ateco_code??null,industryAtecoDescriptionIt:t.ateco??null,industryAtecoInfocamereCode:t.ateco_code_infocamere??null,industryAtecoInfocamereDescription:t.ateco_infocamere??null,statusCode:t.activity_status_code??null,isOperational:t.flag_operativa??null,reaCode:t.rea_code??null,relevantRegistrationDate:t.rea_registration_date??null,legalFormCode:t.company_form_code??null,legalFormDescriptionIt:t.company_form??null,legalFormClass:t.company_form_class??null,paIsPublicEntity:t.pa_ente??null,paIsSupplier:t.pa_fornitore??null,paIsParticipated:t.pa_partecipata??null,lastBalanceSheetYear:t.last_balance_year??null,lastBalanceSheetClosingDate:t.last_balance_date??null,revenue:t.revenue??null,semaphoreGlobal:t.modefinance?.semaphore_global??null,semaphoreUpdatedAt:t.modefinance?.updated_at??null}),As=[{text:"Anagrafica"},{text:"Rapporti commerciali"},{text:"Analisi"},{text:"Dati aggiuntivi"},{text:"Valutazione"}],Ss=[{text:"Anagrafica"},{text:"Dati aggiuntivi"}],Is=[{text:"Anagrafica"}],Me=t=>({defaultProbability:t.defaultProbability,fiscalCode:t.fiscalCode,negativityHasAnticrisisProceedings:t.negativityHasAnticrisisProceedings,negativityHasBankruptcyProceedings:t.negativityHasBankruptcyProceedings,negativityHasPrejudicial:t.negativityHasPrejudicial,negativityHasProtests:t.negativityHasProtests,negativityHasRestructuring:t.negativityHasRestructuring,negativityHasVoluntaryBankruptcy:t.negativityHasVoluntaryBankruptcy,semaphoreBalance:t.semaphoreBalance,semaphoreEsg:t.semaphoreEsg,semaphoreGlobal:t.semaphoreGlobal,semaphoreNegativity:t.semaphoreNegativity,semaphoreUpdatedAt:t.semaphoreUpdatedAt,shareholdersCount:t.shareholdersCount}),He=t=>`${t.fiscalCode}-${t.semaphoreUpdatedAt}`,ga=()=>{const[t,s]=i.useState(0),[a,o]=i.useState(!1),f=Oe(),{trackCustomEvent:d}=Qe(),p=$e(vt),h=$e(bt),{id:u}=Tt(),v=Je(),{pathname:I}=v,D=v.state,y=D?.cervedCompany??null,c=D?.modefinanceAnalysisResult??null,_=i.useRef(c?He(c):null),q=i.useMemo(()=>!y&&!c?null:{...y?Ds(y):{},...c?Me(c):{}},[]),{companyInfo:R,error:T,hasFetched:k,loading:g,refetchCompanyInfo:A,setCompanyInfo:N,setLoading:W}=bs(q),b=I.includes("suppliers")?"suppliers":"clients";i.useEffect(()=>{if(!c)return;const m=He(c);_.current!==m&&(_.current=m,N(V=>({...V??{},...Me(c)})))},[c,N]);const S=u?parseInt(u,10):null,L=Ke(),{canDismissPermanently:K,closeBanner:ce,closeModal:ne,dismissBanner:de,isModalOpen:Y,licenseInfo:G,openModal:ue,showBanner:pe}=Ft(),O=wt(),oe=Pt(I),me=()=>{if(G.status===H.EXPIRING||G.status===H.EXPIRED){if(!O){oe();return}L("/extraservices",{state:{fromModefinance:!0}})}else ue()},[he,$]=i.useState(!1),[Ae,xe]=i.useState(!1),[ge]=Dt(),z=ge.get("fiscalCode")||"",X=!!z&&h.includes(z),{canUseModefinance:te,isTsConnectionCompleted:re}=Ze(),w=re&&O,B=w?4:3,Se=w?3:-1,fe=i.useMemo(()=>As.filter((m,V)=>w||V!==3).map((m,V)=>V===B?{...m,notification:X&&t!==B}:m),[w,B,X,t]),Ie=b==="suppliers"?"FORNITORE":"CLIENTE",{fetchFicEntity:Q,ficEntity:E,loading:_e,notFound:ye,error:se}=Ts(),x=i.useMemo(()=>E?E.taxCode||E.vatNumber||"":z,[E,z]),ae=i.useMemo(()=>E?.country==="Italia"&&!!x&&At(x).valid&&!q&&re&&O,[E?.country,x,q,re,O]);i.useEffect(()=>{if(!S){z||L(`/${b}`);return}Q(b,S)},[S,b,L,Q,z]),i.useEffect(()=>{ye&&L(`/${b}`,{replace:!0})},[b,ye,L]),i.useEffect(()=>{ae&&A(x)},[ae,x,A]),i.useEffect(()=>{if(!X||!k||R?.semaphoreUpdatedAt)return;const m=setTimeout(()=>void A(x),2e3);return()=>clearTimeout(m)},[X,k,R?.semaphoreUpdatedAt,x,A]);const Ee=i.useCallback(()=>void A(x),[x,A]),je=i.useCallback(()=>{S&&Q(b,S)},[S,b,Q]),tt=i.useCallback(async m=>{if(!S)return;const V=E?.taxCode||E?.vatNumber||null,Re=await Q(b,S);if(!Re)return;const Ne=Re.taxCode||Re.vatNumber||null;if(m){N(it=>({...it??{},...Me(m)})),Ne&&A(Ne);return}Ne!==V&&N(null)},[S,b,Q,E,A,N]),Ce=!S,st=Ce?w?Ss:Is:fe,ze=i.useRef(w);i.useEffect(()=>{const m=ze.current!==w;if(ze.current=w,Ce){!w&&t===1&&s(0);return}m&&t===3&&s(0)},[Ce,w,t]),i.useEffect(()=>{t===B&&X&&z&&f(St.actions.removePendingCreditRisk(z))},[t,B,f,z,X]);const at=()=>{if(_e||g||ae&&!R&&!k)return e.jsx(C,{justifyContent:"center",alignItems:"center",flex:1,children:e.jsx(Ye,{})});const m=V=>e.jsx("div",{children:e.jsx(Be,{size:"small",variant:"outlined",onClick:V,children:"Riprova"})});if(Ce)switch(t){case 0:return se?m(je):e.jsx(Xe,{data:R,ficEntity:E,entityType:b,isNew:!0});case 1:return w?T?m(Ee):e.jsx(We,{data:R}):null;default:return null}switch(t){case 0:return se?m(je):e.jsx(Xe,{data:R,ficEntity:E,entityType:b});case 1:return se?m(je):e.jsx(us,{ficEntity:E,entityType:b});
1case 2:return se?m(je):e.jsx(Cs,{entityId:S,entityType:b});case Se:return T?m(Ee):e.jsx(We,{data:R});case B:return T?m(Ee):e.jsx(vs,{fiscalCode:x,companyInfo:R,refetchCompanyInfo:A,setCompanyInfoLoading:W,isItaly:E?.country==="Italia"});default:return null}};return e.jsxs(ns,{children:[e.jsx(Lt,{isOpen:a,setIsOpen:o,entityId:S,entityType:b,reload:m=>void tt(m),initialCervedData:y}),e.jsx(Mt,{isOpen:te&&Y,onClose:ne,title:$t.TITLE,cards:Gt,status:G.status,onCtaClick:()=>{if(ne(),!O){oe();return}$(!0)}}),e.jsx(kt,{isOpen:te&&he,isLoading:Ae,onConfirm:m=>{(async()=>{try{xe(!0),await le.post({request:"modefinance/trial/activate",noAlerts:!0,postData:{terms_accepted:!0,accepted_terms:m}}),$(!1),f(It({modefinanceLicenseCache:{companyId:p,info:{status:H.ACTIVATING,isTrial:!0},cachedAt:Date.now()}})),f(_t({status:"in_activation",errorDetails:null})),window.reloadInvoices?.(),d("fic_modefinance_trial_started",{activation_type:"trial"}),De.success("Prova attivata")}catch{d("fic_modefinance_trial_activation_failed",{}),De.error("Attivazione fallita. Riprova più tardi.")}finally{xe(!1)}})()},onCancel:()=>$(!1)}),e.jsx(rs,{children:e.jsxs(ls,{onClick:()=>L(`/${b}`),children:[e.jsx(Et,{icon:Rt,color:"blue"}),e.jsx(cs,{children:"Torna indietro"})]})}),e.jsxs(C,{justifyContent:"space-between",flexDirection:"row",alignItems:"center",children:[e.jsxs(C,{flexDirection:"column",minWidth:0,children:[e.jsxs(C,{flexDirection:"row",alignItems:"center",gap:"8px",minWidth:0,children:[e.jsxs(j,{variant:"titleSmall",fontWeight:"500",padding:"8px",noWrap:!0,children:["Informazioni su ",E?.name||R?.name||""]}),e.jsx(ds,{$entityType:b,children:Ie})]}),e.jsx(Ot,{index:t,setIndex:m=>{m===B&&d("fic_modefinance_evaluation_tab_switched",{from_tab_index:t}),s(m)},tabs:st})]}),e.jsx(Be,{variant:S?"outlined":"contained",size:"small",onClick:()=>o(!0),sx:{flexShrink:0,ml:2},children:S?"Modifica anagrafica":"Aggiungi anagrafica"})]}),e.jsx(os,{}),e.jsxs(Bt,{padding:"24px 8px",flex:1,display:"flex",flexDirection:"column",children:[te&&G.status===H.ACTIVATING&&e.jsx(Ve,{licenseInfo:G}),pe&&e.jsx(Ve,{licenseInfo:G,canDismissPermanently:K,onCtaClick:me,onDontShowAgain:de,onClose:ce}),at()]})]})};export{ga as default};

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.