PageSourceSearch

https://albouraq.fr/assets/EditBlog-NCgPzy6-.js

js albouraq.fr collected 2026-10-07 03:56:24 UTC 9,793 bytes, 1 lines download raw bytes

1import{r as o,n as ee,u as U,U as p,b as te,a as ae,j as e,a1 as q,ag as ne,ah as re,a4 as s,a5 as I,c as W}from"./index-y0CXGfsW.js";import{R as oe,U as le,v as se,S as ie}from"./index-CQxEgbTb.js";import{e as ce,f as de,g as me,h as ge,i as ue}from"./index.esm-BGlItAEI.js";import{a as he,b as pe}from"./index.esm-BiXU2nOI.js";import"./progress-Cf2Hoiip.js";const fe="_maincontainer_u0gkt_1",xe="_itemsHeading_u0gkt_10",ye="_headContainer_u0gkt_20",be="_itemHead_u0gkt_28",ve="_card1_u0gkt_35",je="_btnsave_u0gkt_44",Ce="_react_quill_u0gkt_73",i={maincontainer:fe,itemsHeading:xe,headContainer:ye,itemHead:be,card1:ve,btnsave:je,react_quill:Ce},we=[[{size:["small",!1,"large","huge"]}],[{header:"1"},{header:"2"},{header:[3,4,5,6]},{font:[]}],["bold","italic","underline","strike"],[{color:[]},{background:[]}],[{script:"sub"},{script:"super"}],[{list:"ordered"},{list:"bullet"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{align:[]}],["link","image"]],ke={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"fit-content",maxWidth:"90%",bgcolor:"#F2F2F2",color:"#002B7D",fontSize:"calc(0.7rem + 0.2vw)",fontFamily:"var(--font-family-primary)",borderRadius:"1em",p:6};function Fe(){const d=document.createElement("input");d.setAttribute("type","file"),d.setAttribute("accept","image/*"),d.click(),d.onchange=async()=>{const f=d.files[0],m=new FileReader;m.readAsDataURL(f),m.onload=()=>{const g=this.quill.getSelection();this.quill.insertEmbed(g.index,"image",m.result)}}}const Ae=d=>{const[f,m]=o.useState(""),{blogId:g}=ee(),l=U(t=>t.products.selectedLanguage[0].Language);U(t=>t.products.userInfo);const[x]=p.useForm();te();const R=ae(),[u,A]=o.useState({}),[L,b]=o.useState(null),[O,B]=o.useState(""),[$,E]=o.useState(""),P=async()=>{var t,n,r,c;try{const a=await W.get(`https://backapi.leonardo-service.com/api/sofiadis/albouraq/blogs/${g}`);console.log("Response data:",a.data),B((t=a==null?void 0:a.data)==null?void 0:t.title),E(((n=a==null?void 0:a.data)==null?void 0:n.introduction)||""),x.setFieldsValue(a==null?void 0:a.data),A({logo:(r=a==null?void 0:a.data)==null?void 0:r.image}),m(typeof((c=a==null?void 0:a.data)==null?void 0:c.description)=="string"?a.data.description:"")}catch{}};o.useEffect(()=>{P()},[g]);const V=({file:t})=>{const n=new FileReader;n.onload=r=>{v(n.result),j(!0),b(1)},n.readAsDataURL(t)},[H,v]=o.useState(null),[X,j]=o.useState(!1),[y,h]=o.useState(1),[C,w]=o.useState(0),[k,F]=o.useState(!1),[D,S]=o.useState(!1),_=o.useRef(null),Y=()=>{if(_.current){const t=_.current.getImage(),n=document.createElement("canvas"),r=n.getContext("2d");n.width=t.width,n.height=t.height,r.save(),r.translate(t.width/2,t.height/2),r.rotate(C*Math.PI/180),r.scale(k?-1:1,D?-1:1),r.translate(-t.width/2,-t.height/2),r.drawImage(t,0,0),r.restore();const c=n.toDataURL();A(a=>({...a,...L===1?{logo:c}:{favicon:c}})),j(!1),b(null),v(null),h(1),w(0),F(!1),S(!1)}},z=()=>{j(!1),v(null),h(1),w(0),F(!1),S(!1),b(null)},Z=()=>{F(!k)},G=()=>{S(!D)},N=t=>{const n=(C+t)%360;w(n)},M={transform:`${k?"scaleX(-1)":"scaleX(1)"} ${D?"scaleY(-1)":"scaleY(1)"} rotate(${C}deg)`},Q=t=>{m(t)},J=t=>{const{name:n,value:r}=t.target;B(r)},K=t=>{const{name:n,value:r}=t.target;E(r)},T=async(t=null)=>{const n={title:O,introduction:$,description:f,image:u==null?void 0:u.logo};t!==null&&(n.status_id=t),console.log(n);try{const c=await(await W.put(`https://backapi.leonardo-service.com/api/sofiadis/albouraq/blogs/${g}`,n)).data;I.success("Blog updated successfully",{position:"top-right",autoClose:1500,hideProgressBar:!0,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:0,theme:"colored"}),R("/blogs"),console.log(c)}catch(r){console.error("Error:",r),I.error("An error occurred. Please try again.",{position:"top-right",autoClose:1500,hideProgressBar:!0,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:0,theme:"colored"})}};return e.jsxs("div",{className:i.maincontainer,children:[e.jsx("div",{className:i.itemsHeading,children:e.jsx("div",{className:i.headContainer,children:e.jsx("p",{className:i.itemHead,children:l==="eng"?"Edit Blog":"Editer Le Blog"})})}),e.jsxs(p,{layout:"vertical",name:"nest-messages",form:x,className:i.card1,children:[e.jsx(p.Item,{name:"title",style:{width:"100%"},label:e.jsx("p",{style:{color:"var(--accent-color)",fontWeight:"500",fontFamily:"var(--font-family-primary)",margin:"0 "},children:l==="eng"?"Blog Title":"Titre du blog"}),children:e.jsx(q,{name:"title",size:"large",placeholder:l==="eng"?"Title":"Titre",style:{border:"1px solid #D9D9D9",backgroundColor:"#F2F2F2",color:"var(--accent-color)",height:"2.5em"},onChange:J})}),e.jsx(p.Item,{name:"introduction",style:{width:"100%"},label:e.jsx("p",{style:{color:"var(--accent-color)",fontWeight:"500",fontFamily:"var(--font-family-primary)",margin:"0 "},children:"Introduction"}),children:e.jsx(q.TextArea,{name:"introduction",rows:3,placeholder:"Introduction",style:{border:"1px solid #D9D9D9",backgroundColor:"#F2F2F2",color:"var(--accent-color)"},onChange:K})}),e.jsx(oe,{style:{height:"20em"},className:i.react_quill,theme:"snow",value:f,onChange:Q,modules:{toolbar:{container:we,handlers:{image:Fe}}}}),e.jsx(p.Item,{name:"logo",style:{marginTop:"2em"},label:e.jsx("p",{style:{color:"var(--accent-color)",fontWeight:"500",fontFamily:"var(--font-family-primary)",margin:"0 "},children:l==="eng"?"Upload Cover Image":"Importer l’image de couverture"}),children:e.jsx(le,{name:"logo",listType:"picture",maxCount:1,beforeUpload:()=>!1,accept:"image/*",onChange:V,children:u.logo?e.jsx("div",{style:{width:"100%",display:"flex",flexDirection:"column"},children:e.jsx("img",{src:u.logo,alt:"Uploaded",style:{maxWidth:"100%",width:"40em",height:"20em",objectFit:"cover",margin:"0",borderRadius:".5em"}})}):e.jsx("div",{style:{maxWidth:"100%",width:"40em",height:"20em",margin:"0",display:"flex",flexDirection:"column",border:"1px solid #D9D9D9",borderRadius:".5em"},children:e.jsxs("div",{style:{margin:"auto"},children:[e.jsx(ce,{style:{color:"var(--primary-color)",margin:"auto",fontSize:"2em"}}),e.jsx("p",{style:{margin:"0",fontWeight:"700"},children:l==="eng"?"Drag and Drop files here":"Glisser-déposer des fichiers ici"}),e.jsx("p",{style:{margin:"0 0 .3em 0",color:"#B3B3B3"},children:"  Images"}),e.jsx("button",{style:{background:"var(--primary-color)",border:"none",borderRadius:".5em",padding:".5em 1em",color:"#fff",cursor:"pointer"},children:l==="eng"?"Upload File":"Importer le fichier"})]})})})}
1),e.jsx(ne,{open:X,onClose:z,"aria-labelledby":"crop-modal-title","aria-describedby":"crop-modal-description",children:e.jsxs(re,{sx:ke,children:[H&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{transformOrigin:"center",textAlign:"center",...M},children:e.jsx(se,{ref:_,image:H,width:400,height:200,border:50,scale:y,rotate:0})}),e.jsx(ie,{min:0,max:2,step:.1,value:y,onChange:t=>h(t),style:{marginTop:"10px"}}),e.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".5em",margin:"auto",width:"fit-content"},children:[e.jsxs(s,{style:{background:"transparent",border:"none",textAlign:"center",display:"flex",flexDirection:"column"},onClick:()=>h(y+.1),children:[e.jsx("div",{children:e.jsx(de,{})}),e.jsx("p",{style:{fontSize:"calc(.5vw + .2rem)",margin:"-1em 0 0 0"},children:"Zoom In"})]}),e.jsxs(s,{style:{background:"transparent",border:"none",textAlign:"center",display:"flex",flexDirection:"column"},onClick:()=>h(y-.1),children:[e.jsx("div",{children:e.jsx(me,{})}),e.jsx("p",{style:{fontSize:"calc(.5vw + .2rem)",margin:"-1em 0 0 0"},children:"Zoom Out"})]}),e.jsxs(s,{style:{background:"transparent",border:"none",textAlign:"center",display:"flex",flexDirection:"column"},onClick:()=>N(90),children:[e.jsx("div",{children:e.jsx(ge,{})}),e.jsx("p",{style:{fontSize:"calc(.5vw + .2rem)",margin:"-1em 0 0 0"},children:"Rotate Right"})]}),e.jsxs(s,{style:{background:"transparent",border:"none",textAlign:"center",display:"flex",flexDirection:"column"},onClick:()=>N(-90),children:[e.jsx("div",{children:e.jsx(ue,{})}),e.jsx("p",{style:{fontSize:"calc(.5vw + .2rem)",margin:"-1em 0 0 0"},children:"Rotate Left"})]}),e.jsxs(s,{style:{background:"transparent",border:"none",textAlign:"center",display:"flex",flexDirection:"column"},onClick:Z,children:[e.jsx("div",{children:e.jsx(he,{})}),e.jsx("p",{style:{fontSize:"calc(.5vw + .2rem)",margin:"-1em 0 0 0"},children:"Flip Horizontally"})]}),e.jsxs(s,{style:{background:"transparent",border:"none",textAlign:"center",display:"flex",flexDirection:"column"},onClick:G,children:[e.jsx("div",{children:e.jsx(pe,{})}),e.jsx("p",{style:{fontSize:"calc(.5vw + .2rem)",margin:"-1em 0 0 0"},children:"Flip Vertically"})]})]})]}),e.jsxs("div",{style:{width:"fit-content",display:"flex",gap:"3em",margin:" 3em auto 0 auto"},children:[e.jsx(s,{onClick:z,className:i.btnsave,style:{background:"var(--secondary-color) "},children:"Cancel"}),e.jsx(s,{onClick:Y,type:"primary",className:i.btnsave,children:"Crop"})]})]})}),e.jsxs("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",justifyContent:"space-between",paddingTop:"2em",borderTop:"1px solid #E3E3E3"},children:[e.jsx(s,{onClick:()=>R("/blogs"),className:i.btnsave,style:{color:"#868686",fontWeight:"600",background:"#fff"},children:l==="eng"?"Discard":"Rejeter"}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:".5em"},children:[e.jsx(s,{className:i.btnsave,onClick:async()=>{try{await x.validateFields()}catch{}T(10)},children:l==="eng"?"Save Draft":"Enregistrer le brouillon"}),e.jsx(s,{className:i.btnsave,onClick:async()=>{try{await x.validateFields()}catch{I.error(l==="eng"?"Please fill required fields before uploading.":"Veuillez remplir les champs requis avant de soumettre.");return}T(43)},children:l==="eng"?"Submit blog for review":"Soumettre le blog pour examen"})]})]})]})]})};export{Ae 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.