1"use strict";(globalThis.webpackChunk_coreui_coreui_free_react_admin_template=globalThis.webpackChunk_coreui_coreui_free_react_admin_template||[]).push([[6520],{66520:(e,a,t)=>{t.r(a),t.d(a,{default:()=>p});var i=t(82483),r=t(88879),s=t(8826),o=t(93376),n=t(99891),l=t(33626),c=t(23080),d=t(90722),h=t(98710),m=t.n(h),u=t(56723);const p=()=>{var e,a;const{register:t,handleSubmit:h,formState:{errors:p},reset:x}=(0,c.mN)(),[g,v]=(0,i.useState)({name:"",company:"",advisorbio:"",advisorshortbio:"",companyimage:"",bioimage:"",homeimage:"",metatitle:"",metadescription:"",bioCharCount:0,shortBioCharCount:0}),[C,j]=(0,i.useState)({}),[b,y]=(0,i.useState)(""),[B,f]=(0,i.useState)(""),[A,N]=(0,i.useState)(""),_=(0,o.Zp)(),S=new URLSearchParams((0,o.zy)().search).get("id");(0,i.useEffect)(()=>{s.A.get(`${r.A}/advisor/${S}`).then(({data:e})=>{var a,t;const i={...e,bioCharCount:(null===(a=e.advisorbio)||void 0===a?void 0:a.replace(/<[^>]*>/g,"").length)||0,shortBioCharCount:(null===(t=e.advisorshortbio)||void 0===t?void 0:t.replace(/<[^>]*>/g,"").length)||0};v(i),x(i)})},[S,x]);const G=(e,a,t,i,r)=>{const s=e.replace(/<[^>]*>/g,"");s.length<=t?(v(t=>({...t,[a]:e,[r]:s.length})),i("")):i(`Bio should be less than ${t} characters`)},$=e=>{const{name:a,value:t,files:i}=e.target,r=i?i[0]:null;r?(v(e=>({...e,[a]:r})),j(e=>({...e,[a]:URL.createObjectURL(r)}))):v(e=>({...e,[a]:t}))};return(0,u.jsx)(l.sK,{children:(0,u.jsxs)(l.UF,{xs:12,children:[(0,u.jsx)("h1",{className:"module-main-heading",children:"Edit Advisor"}),(0,u.jsx)(n.N_,{to:"/admin/advisor",className:"mm-btn",children:"Go Back"}),(0,u.jsx)(l.E$,{className:"mb-4",children:(0,u.jsx)(l.W6,{children:(0,u.jsxs)(l.qI,{onSubmit:h(async()=>{const e=new FormData;Object.entries(g).forEach(([a,t])=>{["bioCharCount","shortBioCharCount"].includes(a)||e.append(a,t)});try{await s.A.post(`${r.A}/advisor/update/${S}`,e),_("../advisor")}catch(a){a.response&&N(a.response.data.msg)}}),encType:"multipart/form-data",children:[(0,u.jsx)(l.BG,{className:"mb-3",children:(0,u.jsx)(l.OG,{...t("name",{required:!0}),value:g.name,name:"name",onChange:$,placeholder:"Name"})}),(0,u.jsx)(l.BG,{className:"mb-3",children:(0,u.jsx)(l.OG,{...t("company",{required:!0}),value:g.company,name:"company",onChange:$,placeholder:"Company"})}),(0,u.jsx)(l.A6,{children:"Advisor Bio"}),(0,u.jsx)(d.CKEditor,{editor:m(),data:g.advisorbio,onChange:(e,a)=>G(a.getData(),"advisorbio",700,y,"bioCharCount")}),b&&(0,u.jsx)("p",{className:"field-errors",children:b}),(0,u.jsxs)("p",{children:["Character count: ",g.bioCharCount,"/700"]}),(0,u.jsx)(l.A6,{children:"Advisor Short Bio"}),(0,u.jsx)(d.CKEditor,{editor:m(),data:g.advisorshortbio,onChange:(e,a)=>G(a.getData(),"advisorshortbio",243,f,"shortBioCharCount")}),B&&(0,u.jsx)("p",{className:"field-errors",children:B}),(0,u.jsxs)("p",{children:["Character count: ",g.shortBioCharCount,"/243"]}),["companyimage","homeimage","bioimage"].map(e=>(0,u.jsxs)(l.BG,{className:"mb-3",style:{flexDirection:"column"},children:[(0,u.jsx)(l.A6,{children:e.replace("image"," Image")}),g[e]&&"string"===typeof g[e]&&(0,u.jsx)(l.t7,{align:"start",rounded:!0,src:`${r.A}/${g[e]}`,style:{maxHeight:"150px",maxWidth:"150px",marginTop:"10px",marginBottom:"10px"}}),C[e]&&(0,u.jsx)("img",{src:C[e],alt:"Preview",style:{maxHeight:"150px",maxWidth:"150px",marginTop:"10px",marginBottom:"10px"}}),(0,u.jsx)(l.OG,{style:{width:"100%"}
1,type:"file",name:e,onChange:$})]},e)),(0,u.jsx)(l.A6,{children:"Meta Title"}),(0,u.jsx)(l.BG,{className:"mb-3",children:(0,u.jsx)(l.OG,{maxLength:60,name:"metatitle",value:null===g||void 0===g?void 0:g.metatitle,...t("metatitle",{validate:e=>e.length<=60||"Must be exactly 60 characters"}),onChange:$})}),(0,u.jsxs)("p",{children:["Character count: ",null===g||void 0===g||null===(e=g.metatitle)||void 0===e?void 0:e.length,"/60"]}),(0,u.jsx)(l.A6,{children:"Meta Description"}),(0,u.jsx)(l.Im,{name:"metadescription",maxLength:160,value:null===g||void 0===g?void 0:g.metadescription,...t("metadescription",{validate:e=>e.length<=160||"Must be exactly 160 characters"}),onChange:$}),(0,u.jsxs)("p",{children:["Character count: ",null===g||void 0===g||null===(a=g.metadescription)||void 0===a?void 0:a.length,"/160"]}),(0,u.jsx)("div",{className:"d-grid submitBtn",children:(0,u.jsx)("input",{type:"submit",value:"Update"})})]})})})]})})}}}]); 2//# sourceMappingURL=6520.d47b51e8.chunk.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.