PageSourceSearch

https://superyachtjobs.com/build/assets/UpdateClientInformationForm-CH1GjxJv.js

js superyachtjobs.com collected 2026-10-07 23:56:11 UTC 8,360 bytes, 1 lines download raw bytes

1import{r as _,G as B,j as e,z as R,A as G}from"./filteringStore-DBKx3oq_.js";import{I as r}from"./InputLabel-D9o4Oetu.js";import{I as i}from"./InputError-C-jnWath.js";import{T as c}from"./TextInput-B2IMbgmx.js";import{P as M}from"./PrimaryButton-CeoAolqJ.js";import q from"./MediaUploader-FWB4vUyB.js";import J from"./DescriptionField-DqNJ56jl.js";import{a as V}from"./analyticsService-DYAYRHAq.js";import $ from"./MapResolutionSettings-bkXJhS0j.js";import{u as H}from"./ClientContext-D5XowIcX.js";import{u as K,T as k}from"./app-CSfDaM_X.js";import Q from"./ConfigurationSettingsComponent-ZYRXU23h.js";import"./ApplicationLogo-DyQe9Jh2.js";import"./configRules-0OS3ufDO.js";const me=({className:E,onPageTitleChange:g})=>{const{client:a,setClient:T}=H(),{showToast:h}=K(),[y,x]=_.useState(null),[j,N]=_.useState(!1),[D,b]=_.useState(0);let d=typeof a.map_resolution_settings=="string"?JSON.parse(a.map_resolution_settings):a.map_resolution_settings;if(!a.map_resolution_settings){const t=a.qcDbSizeMB||50;d={defaultResolution:Math.max(15,Math.min(100,Math.round(500/t))),adaptiveMode:"fixed"}}log("Parsed Map Resolution Settings:",d.defaultResolution);const U={defaultResolution:(d==null?void 0:d.defaultResolution)??null,adaptiveMode:(d==null?void 0:d.adaptiveMode)??"auto"},{data:s,setData:l,errors:n,processing:C,setError:I,clearErrors:F}=B({title:a.title||"",name:a.name||"",project_name:a.project_name||"",page_title:a.page_title||"",vessel:a.vessel||"",logo:null,description:a.description||"",map_resolution_settings:U,survey_type:a.survey_type||"",contractor:a.contractor||"",type:a.type||"",nr_streamers:a.nr_streamers||"",nr_sources:a.nr_sources||"",start_date:a.start_date||"",end_date_planned:a.end_date_planned||"",duration:a.duration||"",end_date_est:a.end_date_est||""}),O="image/jpeg,image/jpg,image/png,image/gif",L=t=>{const o=t[0]??null;x(o),l("logo",o),F("logo")},P=async t=>{var S,w;t.preventDefault(),F();const o=new FormData;o.append("title",s.title),o.append("name",s.name),o.append("project_name",s.project_name),o.append("page_title",s.page_title),o.append("vessel",s.vessel),o.append("description",s.description),o.append("survey_type",s.survey_type),o.append("contractor",s.contractor),o.append("nr_streamers",s.nr_streamers),o.append("nr_sources",s.nr_sources),o.append("start_date",s.start_date),o.append("end_date_planned",s.end_date_planned),o.append("map_resolution_settings",JSON.stringify(s.map_resolution_settings)),y&&o.append("logo",y);try{const m=await G.post(route("api.client.update"),o,{headers:{"Content-Type":"multipart/form-data"}});T(m.data.client),V.track("auth_action",{action:"client_update"}),N(!0),x(null),l("logo",null),b(v=>v+1)}catch(m){const v=(S=m==null?void 0:m.response)==null?void 0:S.status,p=(w=m==null?void 0:m.response)==null?void 0:w.data;if(v===422&&(p!=null&&p.errors)){const f=p.message&&p.message!=="The given data was invalid."?p.message:(()=>{const u=Object.values(p.errors)[0];return(u==null?void 0:u[0])??"Update failed. Please try again."})();h("Error",f,k.ERROR),Object.entries(p.errors).forEach(([u,z])=>{const A=z[0]??"Invalid input";I(u,A)})}else console.error("Update failed:",m),h("Error","Update failed. Please try again.",k.ERROR);x(null),l("logo",null),b(f=>f+1)}};return _.useEffect(()=>{if(j){const t=setTimeout(()=>N(!1),2e3);return()=>clearTimeout(t)}},[j]),_.useEffect(()=>{g==null||g(s.page_title.trim()||s.project_name.trim()||a.project_name||"")},[a.project_name,s.page_title,s.project_name,g]),e.jsxs("section",{className:E,children:[e.jsxs("header",{className:"p-4",children:[e.jsx("h2",{className:"text-lg font-medium text-gray-900",children:"Client Details"}),e.jsx("p",{className:"mt-1 text-sm text-gray-600",children:"Update the client details."})]}),e.jsxs("form",{onSubmit:P,className:"mt-6 space-y-6 px-4",children:[e.jsxs("div",{children:[e.jsx(r,{htmlFor:"title",value:"Client"}),e.jsx(c,{id:"title",className:"mt-1 block w-full",value:s.title,onChange:t=>l("title",t.target.value),autoComplete:"title"}),e.jsx(i,{className:"mt-2",message:n.title})]}),e.jsxs("div",{children:[e.jsx(r,{htmlFor:"project_name",value:"Project"}),e.jsx(c,{id:"project_name",className:"mt-1 block w-full",value:s.project_name,onChange:t=>l("project_name",t.target.value),autoComplete:"project_name"}),e.jsx(i,{className:"mt-2",message:n.project_name})]}),e.jsxs("div",{children:[e.jsx(r,{htmlFor:"page_title",value:"Page/Tab title"}),e.jsx(c,{id:"page_title",className:"mt-1 block w-full",value:s.page_title,onChange:t=>l("page_title",t.target.value),autoComplete:"off"}),e.jsx(i,{className:"mt-2",message:n.page_title})]}),e.jsxs("div",{children:[e.jsx(r,{htmlFor:"survey_type",value:"Survey Type"}),e.jsx(c,{id:"survey_type",className:"mt-1 block w-full",value:s.survey_type,onCh
1ange:t=>l("survey_type",t.target.value)}),e.jsx(i,{className:"mt-2",message:n.survey_type})]}),e.jsxs("div",{children:[e.jsx(r,{htmlFor:"name",value:"Location"}),e.jsx(c,{id:"name",className:"mt-1 block w-full",value:s.name,onChange:t=>l("name",t.target.value),autoComplete:"name"}),e.jsx(i,{className:"mt-2",message:n.name})]}),e.jsxs("div",{children:[e.jsx(r,{htmlFor:"contractor",value:"Contractor"}),e.jsx(c,{id:"contractor",className:"mt-1 block w-full",value:s.contractor,onChange:t=>l("contractor",t.target.value)}),e.jsx(i,{className:"mt-2",message:n.contractor})]}),e.jsxs("div",{children:[e.jsx(r,{htmlFor:"vessel",value:"Vessel"}),e.jsx(c,{id:"vessel",className:"mt-1 block w-full",value:s.vessel,onChange:t=>l("vessel",t.target.value),autoComplete:"vessel"}),e.jsx(i,{className:"mt-2",message:n.vessel})]}),e.jsxs("div",{children:[e.jsx(r,{htmlFor:"nr_streamers",value:"No. Streamers"}),e.jsx(c,{id:"nr_streamers",className:"mt-1 block w-full",value:s.nr_streamers,onChange:t=>l("nr_streamers",t.target.value)}),e.jsx(i,{className:"mt-2",message:n.nr_streamers})]}),e.jsxs("div",{children:[e.jsx(r,{htmlFor:"nr_sources",value:"No. Sources"}),e.jsx(c,{id:"nr_sources",className:"mt-1 block w-full",value:s.nr_sources,onChange:t=>l("nr_sources",t.target.value)}),e.jsx(i,{className:"mt-2",message:n.nr_sources})]}),e.jsxs("div",{children:[e.jsx(r,{htmlFor:"start_date",value:"Start Date"}),e.jsx(c,{type:"date",id:"start_date",className:"mt-1 block w-full",value:s.start_date,onChange:t=>l("start_date",t.target.value)}),e.jsx(i,{className:"mt-2",message:n.start_date})]}),e.jsxs("div",{children:[e.jsx(r,{htmlFor:"end_date_planned",value:"End Date (Planned)"}),e.jsx(c,{type:"date",id:"end_date_planned",className:"mt-1 block w-full",value:s.end_date_planned,onChange:t=>l("end_date_planned",t.target.value)}),e.jsx(i,{className:"mt-2",message:n.end_date_planned})]}),e.jsxs("div",{children:[e.jsx(r,{htmlFor:"description",value:"Description"}),e.jsx(J,{data:{description:s.description},setData:(t,o)=>l("description",o)}),e.jsx(i,{className:"mt-2",message:n.description})]}),e.jsxs("div",{children:[e.jsx(r,{htmlFor:"logo",value:"Logo"}),e.jsx(q,{preview:`/storage/${a.logo}`,accept:O,multiple:!1,onFilesChange:L,resetTrigger:D}),e.jsx(i,{className:"mt-2",message:n.logo})]}),e.jsxs("div",{className:"flex flex-col items-center mt-8",children:[e.jsx(R,{show:j,enter:"transition-opacity duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition-opacity duration-300",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:e.jsx("p",{className:"text-sm font-bold text-gray-600",children:"Saved."})}),e.jsx(M,{className:"mt-4 w-full justify-center rounded-none",disabled:C,children:"Update Information"})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx("h3",{className:"text-lg font-semibold border-b pb-2 mb-4",children:"Map Performance Settings"}),e.jsx($,{settings:s.map_resolution_settings,onChange:t=>l("map_resolution_settings",t)})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx("h3",{className:"text-lg font-semibold border-b pb-2 mb-4",children:"Configuration Settings"}),e.jsx(Q,{})]}),e.jsxs("div",{className:"flex flex-col items-center mt-8",children:[e.jsx(R,{show:j,enter:"transition-opacity duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition-opacity duration-300",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:e.jsx("p",{className:"text-sm font-bold text-gray-600",children:"Saved."})}),e.jsx(M,{className:"mt-4 w-full justify-center rounded-none",disabled:C,children:"Update Information"})]})]})]})};export{me 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.