1import{_ as x}from"./n4GeZTse.js";import{_ as w}from"./DxM004LA.js";import{_ as C}from"./CGHgxjYR.js";import{f as I,x as n,i as A,M as j,j as a,an as k,D as T,o as i,c as r,a as l,m as d,v as u,s as F,F as m,r as g,t as U,G as P,k as V,d as p,e as c,w as B}from"./2UXwwY6n.js";import{b as D}from"./C___qZ2I.js";import{r as L}from"./CVBGUwd6.js";import{_ as R}from"./DlAUqK2U.js";import"./DvB-R4Ht.js";import"./CNSRS5EI.js";import"./qVJ10Yns.js";import"./frHCfR6o.js";import"./Dq4Cx-s2.js";import"./tci7oTU1.js";import"./DgrmYdoz.js";import"./Bhm1p-tx.js";import"./PHdjsO3h.js";import"./DXzwrqZ9.js";import"./L_xMviyg.js";import"./yv62zb0L.js";import"./s4VRdl3-.js";import"./DAPJOfW4.js";import"./BsoH4CqV.js";import"./DyH7WcSB.js";const $=I({name:"createBlogArticle",setup(){const t=k(),e=a();return{user:t,auth:e}},components:{TrashIcon:L},data(){return{title:"",subtitle:"",titleImage:"",titleImagePrev:null,descriptionImage:"",descriptionImagePrev:null,articleContent:"",albumFiles:[],albumPrevs:[],categories:[],selectedCategory:null,openCropperModal:!1,cropperImage:null,uploadImage:null,prevImage:"",sendingArticle:!1,displayAtHome:1}},mounted(){this.getCategories()},methods:{toggleDisplayAtHome(t){this.displayAtHome=t.target.checked?1:0},onTitleImageFileChange(t){const e=t.target.files[0];this.titleImage=e,this.titleImagePrev=URL.createObjectURL(e)},onDescriptionImageFileChange(t){const e=t.target.files[0];this.descriptionImage=e,this.descriptionImagePrev=URL.createObjectURL(e)},onAlbumFileChange(t){const e=t.target.files;for(let o=0;o<e.length;o++)this.albumFiles.push(e[o]),this.albumPrevs.push(URL.createObjectURL(e[o]))},deleteFromAlbum(t){this.albumPrevs.splice(t,1),this.albumFiles.splice(t,1)},async getCategories(){const{data:t,error:e}=await j("/api/blogCategories",{method:"get",headers:{Authorization:"Bearer "+(a().token?a().token:a().sessionToken)}},"$XnyNnOsKEl");if(e.value)return n().error(`#${e.value.statusCode} - Kategorien konnten nicht geladen werden`);t.value&&(this.categories=t.value)},async insertArticle(t){if(!this.selectedCategory)return n().warning("Wähle eine Kategorie aus");if(this.sendingArticle)return;this.sendingArticle=!0;const e=await D.create(this.title,this.subtitle,this.articleContent,this.titleImage,this.descriptionImage,t,this.selectedCategory,this.albumFiles,this.displayAtHome);if(this.sendingArticle=!1,!e.success)return n().error(e.error);n().success("Blogbeitrag wurde erfolgreich erstellt"),await A().push("/intern/blog")},renderImagePreview(t){this.descriptionImagePrev=URL.createObjectURL(t),this.descriptionImage=t,this.cropperImage=null,this.openCropperModal=!1},startCropper(t){const e=t.target.files[0];this.cropperImage=URL.createObjectURL(e),this.openCropperModal=!0}}}),M={class:"p-4 my-8 max-w-screen-2xl mx-auto flex flex-col gap-5"},H={class:"bg-white rounded-md p-4 flex flex-col gap-8"},z={class:"grid grid-cols-5 gap-5"},S={class:"col-span-4 relative"},N={class:"relative"},O=["value"],E={class:"relative"},K={class:"relative flex items-center gap-2"},Z=["checked"],G={class:"grid grid-cols-2 gap-5"},W={for:"titleImage",class:"w-full relative border-2 border-dashed border-gray-400 rounded-lg flex justify-center items-center gap-2 overflow-hidden h-72 cursor-pointer"},X=["src"],q={for:"descriptionImage",class:"w-full relative border-2 border-dashed border-gray-400 rounded-lg flex justify-center items-center gap-2 overflow-hidden h-72 cursor-pointer"},J=["src"],Q={class:"min-h-[18rem] cursor-pointer grid grid-cols-4 gap-
15"},Y={class:"w-full h-72 overflow-hidden flex items-center justify-center relative"},_=["src"],ee=["onClick"],te={for:"titleImages",class:"w-full relative border-2 border-dashed border-gray-400 rounded-lg flex justify-center items-center gap-2 overflow-hidden h-72"},le={class:"flex gap-5 justify-end items-center"};function se(t,e,o,ie,oe,re){const f=x,h=w,b=T("TrashIcon"),v=C;return i(),r("div",null,[l("div",M,[e[22]||(e[22]=l("h2",{class:"font-bold text-2xl"},"Neuen Beitrag erstellen",-1)),l("div",H,[e[20]||(e[20]=l("h3",{class:"text-xl font-bold"},"Artikelinhalt",-1)),l("div",z,[l("div",S,[e[12]||(e[12]=l("label",{for:"articleTitle",class:"absolute -top-3 left-3 bg-white text-gray-900 px-1 font-semibold text-sm"},"Titel",-1)),d(l("input",{"onUpdate:modelValue":e[0]||(e[0]=s=>t.title=s),id:"articleTitle",class:"rounded-lg focus-visible:outline-none w-full p-2 ring-1 ring-gray-400",placeholder:"Titel (maximal 100 Zeichen)"},null,512),[[u,t.title]])]),l("div",N,[e[13]||(e[13]=l("label",{for:"articleTitle",class:"absolute -top-3 left-3 bg-white text-gray-900 px-1 font-semibold text-sm"},"Artikel Kategorie",-1)),d(l("select",{"onUpdate:modelValue":e[1]||(e[1]=s=>t.selectedCategory=s),class:"p-2.5 ring-1 ring-gray-400 w-full rounded-md focus-visible:outline-none"},[(i(!0),r(m,null,g(t.categories,s=>(i(),r("option",{value:s.id},U(s.name),9,O))),256))],512),[[F,t.selectedCategory]])])]),l("div",null,[l("div",E,[e[14]||(e[14]=l("label",{for:"articleSubTitle",class:"absolute -top-3 left-3 bg-white text-gray-900 px-1 font-semibold text-sm"},"Untertitel",-1)),d(l("input",{"onUpdate:modelValue":e[2]||(e[2]=s=>t.subtitle=s),id:"articleSubTitle",class:"rounded-lg focus-visible:outline-none w-full p-2 ring-1 ring-gray-400",placeholder:"Untertitel (maximal 200 Zeichen)"},null,512),[[u,t.subtitle]])])]),l("div",null,[l("div",K,[l("input",{type:"checkbox",checked:t.displayAtHome===1,onChange:e[3]||(e[3]=(...s)=>t.toggleDisplayAtHome&&t.toggleDisplayAtHome(...s)),id:"displayAtHome"},null,40,Z),e[15]||(e[15]=l("label",{for:"displayAtHome",class:"text-gray-900 font-semibold text-sm"},"Auf der Startseite anzeigen",-1))])]),l("div",G,[l("label",W,[e[16]||(e[16]=l("div",{class:"absolute flex flex-col gap-2 items-center h-full justify-center bg-white/60 w-full top-0 mx-auto z-[1]"},[l("p",{class:"text-2xl font-bold"},"Titelbild wählen"),l("p",{class:"text-gray-500 font-medium"},".png, .jpg oder jpeg (0000x 0000 px)"),l("p",{class:"px-3 py-2 rounded-md text-sm bg-primary text-white"},"Datei hochladen")],-1)),l("img",{src:t.titleImagePrev,class:"w-full h-auto"},null,8,X),l("input",{type:"file",id:"titleImage",class:"hidden",onChange:e[4]||(e[4]=(...s)=>t.onTitleImageFileChange&&t.onTitleImageFileChange(...s))},null,32)]),l("label",q,[e[17]||(e[17]=l("div",{class:"absolute flex flex-col gap-2 items-center h-full justify-center bg-white/60 w-full top-0 mx-auto z-[1]"},[l("p",{class:"text-2xl font-bold"},"Vorschaubild wählen"),l("p",{class:"text-gray-500 font-medium"},".png, .jpg oder jpeg (0000x 0000 px)"),l("p",{class:"px-3 py-2 rounded-md text-sm bg-primary text-white"},"Datei hochladen")],-1)),l("img",{src:t.descriptionImagePrev,class:"w-auto h-full"},null,8,J),l("input",{type:"file",id:"descriptionImage",class:"hidden",onChange:e[5]||(e[5]=(...s)=>t.startCropper&&t.startCropper(...s))},null,32),t.openCropperModal?(i(),P(f,{key:0,"input-image":t.cropperImage,width:400,height:400,onCroppedImage:e[6]||(e[6]=s=>{t.renderImagePreview(s)}),onCloseAction:e[7]||(e[7]=s=>t.openCropperModal=!1)},null,8,["input-image"])):V("",!0)])]),l("div",null,[p(h,{modelValue:t.articleContent,"onUpdate:modelValue":e[8]||(e[8]=s=>t.articleContent=s)},null,8,["modelValue"])]),l("div",Q,[(i(!0),r(m,null,g(t.albumPrevs,(s,y)=>(i(),r("div",Y,[l("img",{src:s,class:"w-full h-full"},null,8,_),l("button",{class:"text-white bg-red-600 rounded-md p-2 absolute bottom-1 right-1 flex items-center gap-2",onClick:ne=>t.deleteFromAlbum(y)},[p(b,{class:"h-5 w-5 text-white"}),e[18]||(e[18]=c(" Löschen ",-1))],8,ee)]))),256)),l("label",te,[e[19]||(e[19]=l("div",{class:"absolute flex flex-col gap-2 items-center h-full justify-center bg-white/60 w-full top-0 mx-auto z-[1]"},[l("p",{class:"text-2xl font-bold text-center"},"Bildergalerie hinzufügen"),l("p",{class:"text-gray-500 font-medium text-center"},".png, .jpg oder jpeg (0000x 0000 px)"),l("p",{class:"px-3 py-2 rounded-md text-sm bg-primary text-white"},"Datei hochladen")],-1)),l("input",{type:"file",multiple:"",id:"titleImages",class:"hidden",onChange:e[9]||(e[9]=(...s)=>t.onAlbumFileChange&&t.onAlbumFileChange(...s))},null,32)])])]),l("div",le,[l("button",{onClick:e[10]||(e[10]=s=>t.insertArticle(!1)),class:"text-medium"},"Als Entwurf speichern"),p(v,{onClick:e[11]||(e[11]=s=>t.insertArticle(!0)),loading:t.sendingArticle},{default:B(()=>[...e[21]||(e[21]=[c("Veröffentlichen",-1)])]),_:1},8,["loading"])]),e[23]||(e[23]=l("div",{class:"flex justify-end"},[l("p",{class:"text-xs opacity-60"},"(Das Veröffentlichen des Beitrags kann bis zu 2 Minuten dauern. Das Fenster bitte nicht schlieÃen und nicht erneut auf veröffentlichen drücken)")],-1))])])}const Ve=R($,[["render",se]]);export{Ve 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.