1import{D as B,q as R,r as u,a as n,aP as U,ag as H,xp as Y,j as e,I as $,fW as K,b as M,ci as z,a6 as q,c as W,h as Q,kg as J,xq as X,S as Z,xr as ee,a8 as te,aF as se,kG as re,C as ae,xs as ne,xt as ie,aH as oe,xu as le,bc as ce}from"./index-CQaiPqwp.js";import{R as pe}from"./ReinsuranceSentence.component-BgWVZq9p.js";import{b as de,u as me,a as ue,F as ge}from"./index.esm-DGIHq7I6.js";import{S as fe}from"./Submit.component-I8eG1lLz.js";import{T as G,P as xe}from"./PrivateContent.component-CA0ub5Pl.js";import{C as _e}from"./regex.constant-BicOlS9j.js";import{F as he,L as be}from"./LastName.component-C7MJwEGh.js";import{A as Ce}from"./AppLayout.component-B34jiFc-.js";import{S as Ne}from"./StickyCartLayout.component-CbiMBGLY.js";import"./input.helper-D1shRJlk.js";import"./react-select.esm-BTkEaSrm.js";import"./RichTextLink.component-BuB0fEgt.js";import"./CartDrawer.component-xwg0sdVi.js";import"./OpenModal.component-DibLuewg.js";import"./CartDeletion.component-B_yTeshh.js";import"./Recaptcha.component-CLuG1NuO.js";import"./StarRating.component-BQFBN-jS.js";import"./index-Dv-0yCFp.js";import"./Alert.style-CMMqopFC.js";import"./SelectionProduct.style-DzpfFTFo.js";import"./MessageAlert.component-BOpbPenV.js";import"./Alert.component-CNprVkDS.js";import"./SelectionProductList.component-C6KlpcAg.js";import"./SelectionBundleList.component-DYeUyWCm.js";const Se=R.div` 2 padding: 0 20px; 3 4 @media ${B.TABLET} { 5 padding: 0 30px; 6 } 7 8 & > * { 9 margin-top: 30px; 10 } 11`,ve=R.div` 12 gap: 20px; 13 display: flex; 14 flex-direction: column; 15 16 .passenger-civilities-fields-container__flex-column { 17 display: flex; 18 flex-direction: column; 19 } 20 21 .passenger-civilities-fields-container__flex-row { 22 display: flex; 23 flex-direction: row; 24 } 25 26 .passenger-civilities-fields-container__space-between { 27 justify-content: space-between; 28 } 29 30 .passenger-civilities-fields-container__align-center { 31 align-items: center; 32 } 33 34 .passenger-civilities-fields-container__gap-8 { 35 gap: 8px; 36 } 37 38 .passenger-civilities-fields-container__bold { 39 font-weight: bold; 40 } 41 42 .passenger-civilities-fields-container__checkbox-container { 43 background-color: ${t=>t.theme.grey1}; 44 border-radius: 8px; 45 } 46 47 .passenger-civilities-fields-container__field-container { 48 gap: 20px; 49 margin: 8px 0; 50 } 51 52 .passenger-civilities-fields-container__toggle-button { 53 text-decoration: underline; 54 font-size: var(--text-sm); 55 cursor: pointer; 56 color: ${t=>t.theme.primary}; 57 58 &:hover { 59 text-decoration: none; 60 } 61 } 62`,S=t=>t.appDataState.transportFormData,je=t=>S(t)?.editTrip,Te=t=>S(t)?.passengerAttributionReinsurence,Ie=t=>S(t)?.attributionFormSubtitle,Ee=({isCollapsed:t,onTogglePassenger:p,field:a,index:r})=>{const{control:v,setValue:d,formState:{touchedFields:j,isSubmitSuccessful:f},watch:T,getFieldState:g}=de(),[I,E]=u.useState(!1),x=n(U),o=n(S),F=r===0,P=n(H),A=n(Y),m=i=>`${N.PASSENGER_CIVILITIES}.${i}.${N.FIRST_NAME}`,l=i=>`${N.PASSENGER_CIVILITIES}.${i}.${N.LAST_NAME}`,[_,h]=T([m(r),l(r)]),D=(()=>{const i=g(m(r)),O=g(l(r));return!i.error&&i.isDirty&&!O.error&&O.isDirty})()||f?o?.editForm:o?.openForm,w=t?D:o?.closeForm,V=`${o?.passenger} ${r+1}`,y=a.firstName&&a.lastName?{firstName:a.firstName,lastName:a.lastName}:null,[b,s]=u.useState(y),c=i=>{i?(d(m(r),x?.firstName??"",{shouldValidate:!0,shouldDirty:!0}),d(l(r),x?.lastName??"",{shouldValidate:!0,shouldDirty:!0})):(d(m(r),"",{shouldValidate:!0}),d(l(r),"",{shouldValidate:!0}),s(null)),E(i)};return u.useEffect(()=>{_!==""||h!==""?s({firstName:_,lastName:h}):j?.passengerCivilities?.[r]&&s(null)},[_,h,j,r]),o?e.jsxs(ve,{children:[e.jsxs("div",{className:"passenger-civilities-fields-container__flex-row passenger-civilities-fields-container__space-between",children:[e.jsxs("header",{className:"passenger-civilities-fields-container__flex-row passenger-civilities-fields-container__bold passenger-civilities-fields-container__align-center passenger-civilities-fields-container__gap-8",children:[e.jsx($,{name:"profile",color:"grey2",size:"20",desktopSize:"20"}),e.jsxs(G,{children:[b?e.jsx(xe,{children:`${b.firstName} ${b.lastName}`}):e.jsx(G,{tag:"span",children:V}),` - ${a.ticketLabel}`]}),f&&(P?e.jsx(K,{children:e.jsx($,{size:"20",name:"mini-loader",color:"grey3"})}):!A&&e.jsx($,{size:"20",name:"check-mark-circle",color:"success"}))]}),e.jsx("button",{className:"passenger-civilities-fields-container__toggle-button",type:"button",onClick:p,children:w})]}),!t&&e.jsxs(e.Fragment,{children:[F&&e.jsx("div",{className:"passenger-civilities-fields-container__checkbox-container",children:e.jsx(_e,{name:"fillWithCurrentCustomer",value:I,onChange:i=>c(i.target.checked),bordered:!0,children:o.fillFormWithAccountInfo})}),e.jsx("h2",{className:"passenger-civilities-fields-container__bold",children:o.passengerIdentity}),e.jsx("div",{children:e.jsx(M.Fragment,{children:e.jsxs("div",{className:"passenger-civilities-fields-container__flex-column passenger-civilities-fields-container__field-container",children:[e.jsx(he,{control:v,overrideName:m(r),rules:{required:!0}}),e.jsx(be,{overrideName:l(r),control:v,rules:{required:!0}})]})},a.id)}),e.jsx(z,{role:"presentation"})]})]}):e.jsx(e.Fragment,{})},ye=R.div` 63 padding: 20px; 64 display: flex; 65 flex-direction: column; 66 gap: 16px; 67 68 .transport-passenger-card-content__flex-row-space-between-align-start { 69 display: flex; 70 flex-direction: row; 71 justify-content: space-between; 72 align-items: flex-start; 73 } 74 75 .transport-passenger-card-content__flex-column-20 { 76 display: flex; 77 flex-direction: column; 78 gap: 20px; 79 } 80 81 .transport-passenger-card-content__bold { 82 font-weight: bold; 83 } 84 85 .transport-passenger-card-content__mb-4 { 86 margin-bottom: 4px; 87 } 88 89 .transport-passenger-card-content__header-button { 90 text-decoration: underline; 91 font-size: var(--text-sm); 92 93 &:hover { 94 text-decoration: none; 95 cursor: pointer; 96 } 97 } 98 99 .transport-passenger-form__submit-button { 100 width: 100%; 101 102 svg > * { 103 stroke: ${t=>t.theme.onSurface}; 104 } 105 } 106`,C="passengerCivilities";var N=(t=>(t[t.PASSENGER_CIVILITIES=C]="PASSENGER_CIVILITIES",t.FIRST_NAME="firstName",t.LAST_NAME="lastName",t))(N||{});const Fe=()=>{const t=q(),p=W(),{isSmallViewport:a}=Q(),r=`${J}/${X}?${Z.ADDON_LOADED}=true`,v=n(ee),d=n(Ie),j=n(je),f=n(te),[T,g]=u.useState(-1),[I,E]=u.useState(!1),x=n(H),o=n(S),F=()=>{r&&p.push(r)},P=s=>T===s,A=()=>g(-1),m=s=>P(s)?A():g(s),l=me({defaultValues:{[C]:f.map(s=>({variantId:s.variantId,ticketLabel:s.ticketLabel,firstName:s.firstName,lastName:s.lastName}))},mode:"all"}),{control:_,handleSubmit:h,formState:{errors:L,isValidating:D},watch:w}=l,V=ue({name:C,control:_}),{fields:k}=V,y=w(C,k),b=s=>{I&&(t(ne(s.passengerCivilities,a)),g(-1))};return u.useEffect(()=>{const s=y.every(c=>c.firstName!==""&&c.lastName!==""&&!L[C]);E(!!s)},[L,y,D]),f.length?e.jsx(ae,{children:e.jsxs(ye,{children:[e.jsxs("header",{className:"transport-passenger-card-content__flex-row-space-between-align-start",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"transport-passenger-card-content__bold transport-passenger-card-content__mb-4",children:v}),d&&e.jsx("p",{children:d})]}),e.jsx("button",{className:"transport-passenger-card-content__header-button",type:"button",onClick:F,children:j})]}),e.jsx(z,{role:"presentation"}),e.jsx("div",{children:e.jsx(ge,{...l,children:e.jsxs("form",{className:"transport-passenger-card-content__flex-column-20",onSubmit:h(b),children:[k.map((s,c)=>e.jsx(M.Fragment,{children:e.jsx(Ee,{isCollapsed:T!==c,onTogglePassenger:()=>m(c),field:s,index:c})},s.id)),e.jsx(fe,{className:"transport-passenger-form__submit-button",disabled:!I||x,isLoading:x,children:o?.submitTravelerProfile??""})]})})})]})}):(se(p,re),null)},et=()=>{const t=q(),p=W(),a=n(Te),r=n(ie);return u.useEffect(()=>{t(oe(a)),t(le(p))},[t,p,a]),r?e.jsx(ce,{}):e.jsx(Ce,{hasBreadcrumb:!0,children:e.jsxs(Se,{"data-cy":"Trans
106portHolderPresentation",children:[e.jsx(pe,{reinsurance:a}),e.jsx(Ne,{children:e.jsx(Fe,{})})]})})};export{et as TransportHolderPresentation};
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.