inhaus-plugin-verleih/dist/pages/Editor.js
Friederich Loheide dea1c7061a Rückweg als Pfad im Seitenkopf, Symbol im Kopf (1.0.2)
Passt zu den neuen Seitenköpfen ab Inhaus 0.48 (Kopfband): kein eigener
Zurück-Link mehr über dem Kopf.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 19:54:45 +00:00

1 line
No EOL
5.8 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{t as e}from"../chunks/createLucideIcon-CYyWUN7r.js";import{t}from"../chunks/loader-circle-km1SveWx.js";import{t as n}from"../chunks/trash-COMUOW6h.js";import{Fragment as r,computed as i,createBlock as a,createCommentVNode as o,createElementBlock as s,createElementVNode as c,createTextVNode as l,createVNode as u,normalizeClass as d,openBlock as f,ref as p,renderList as m,toDisplayString as h,unref as g,withCtx as _,withModifiers as v}from"vue";import{useForm as y}from"@inertiajs/vue3";import{AppLayout as b,Button as x,FormField as S,Input as C,PageHeader as w,Panel as T,RichTextEditor as E}from"@inhaus/ui";var D=e({name:`image-plus`,size:24,node:[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]}),O={class:`ih:grid ih:min-w-0 ih:content-start ih:gap-6`},k={class:`ih:grid ih:gap-5`},A={class:`ih:grid ih:content-start ih:gap-6`},j={class:`ih:grid ih:gap-3`},M=[`src`],N={key:0,class:`ih:flex ih:gap-2`},P={key:1,class:`ih:text-[13px] ih:text-destructive`},F={key:2,class:`ih:text-[13px] ih:text-muted-foreground`},I={class:`ih:grid ih:gap-4`},L={class:`ih:grid ih:grid-cols-2 ih:gap-1 ih:rounded-md ih:bg-muted ih:p-1`,role:`radiogroup`,"aria-label":`Verleihstatus`},R=[`aria-checked`,`onClick`],z={__name:`Editor`,props:{item:{type:Object,default:null},labels:{type:Object,required:!0}},setup(e){let z=e,B=z.item,V=y({title:B?.title??``,description:B?.description??``,lent:B?.lent??!1,location:B?.location??``,image:null,remove_image:!1}),H=p(B?.image_url??null),U=p(null),W=p(!1);function G(e){let t=[...e].find(e=>e.type.startsWith(`image/`));t&&(V.image=t,V.remove_image=!1,H.value=URL.createObjectURL(t))}function K(){V.image=null,V.remove_image=!0,H.value=null}let q=i(()=>B?`${z.labels.singular} bearbeiten`:`${z.labels.singular} erfassen`);function J(){V.transform(e=>({...e,lent:+!!e.lent,remove_image:+!!e.remove_image})).post(B?`/verleih/${B.id}`:`/verleih`,{forceFormData:!0})}return(i,p)=>(f(),a(g(b),{title:q.value},{default:_(()=>[u(g(w),{title:q.value,breadcrumbs:g(B)?[{label:e.labels.title,href:`/verleih`},{label:g(B).title,href:g(B).url}]:[{label:e.labels.title,href:`/verleih`}],icon:`images`},null,8,[`title`,`breadcrumbs`]),c(`form`,{class:`ih:grid ih:gap-6 ih:lg:grid-cols-[minmax(0,1fr)_20rem]`,onSubmit:v(J,[`prevent`])},[c(`div`,O,[u(g(T),null,{default:_(()=>[c(`div`,k,[u(g(S),{id:`vl-title`,label:`Titel`,error:g(V).errors.title},{default:_(()=>[u(g(C),{id:`vl-title`,modelValue:g(V).title,"onUpdate:modelValue":p[0]||=e=>g(V).title=e,maxlength:`200`,required:``,placeholder:`z. B. „Sommerwiese“, Acryl auf Leinwand`},null,8,[`modelValue`])]),_:1},8,[`error`]),u(g(S),{id:`vl-description`,label:`Beschreibung`,error:g(V).errors.description,hint:`Z. B. Künstlerin oder Künstler, Maße, Technik – alles, was bei der Auswahl hilft.`},{default:_(()=>[u(g(E),{id:`vl-description`,modelValue:g(V).description,"onUpdate:modelValue":p[1]||=e=>g(V).description=e,bordered:``,"min-height":`12rem`,headings:[2,3],placeholder:`Beschreibung …`},null,8,[`modelValue`])]),_:1},8,[`error`])])]),_:1})]),c(`aside`,A,[u(g(T),null,{default:_(()=>[c(`div`,j,[p[12]||=c(`p`,{class:`ih:text-[13px] ih:font-medium`},`Foto`,-1),c(`div`,{class:d([`ih:relative ih:grid ih:aspect-[4/3] ih:place-items-center ih:overflow-hidden ih:rounded-md ih:border ih:border-dashed ih:bg-muted ih:p-2`,W.value?`ih:border-brand ih:bg-brand-soft`:``]),onDragover:p[3]||=v(e=>W.value=!0,[`prevent`]),onDragleave:p[4]||=e=>W.value=!1,onDrop:p[5]||=v(e=>{W.value=!1,G(e.dataTransfer.files)},[`prevent`])},[H.value?(f(),s(`img`,{key:0,src:H.value,alt:`Vorschau`,class:`ih:max-h-full ih:max-w-full ih:object-contain`},null,8,M)):(f(),s(`button`,{key:1,type:`button`,class:`ih:grid ih:justify-items-center ih:gap-1 ih:text-sm ih:text-muted-foreground`,onClick:p[2]||=e=>U.value.click()},[u(g(D),{class:`ih:size-8`,"stroke-width":1.5}),p[9]||=l(` Foto wählen oder hierher ziehen `,-1)]))],34),c(`input`,{ref_key:`fileInput`,ref:U,type:`file`,accept:`image/jpeg,image/png,image/webp`,class:`ih:hidden`,onChange:p[6]||=e=>G(e.target.files)},null,544),H.value?(f(),s(`div`,N,[u(g(x),{type:`button`,variant:`outline`,size:`sm`,onClick:p[7]||=e=>U.value.click()},{default:_(()=>[u(g(D)),p[10]||=l(` Anderes Foto`,-1)]),_:1}),u(g(x),{type:`button`,variant:`ghost`,size:`sm`,class:`ih:text-destructive`,onClick:K},{default:_(()=>[u(g(n)),p[11]||=l(` Entfernen`,-1)]),_:1})])):o(``,!0),g(V).errors.image?(f(),s(`p`,P,h(g(V).errors.image),1)):o(``,!0),g(V).progress?(f(),s(`p`,F,`Wird hochgeladen … `+h(g(V).progress.percentage)+` %`,1)):o(``,!0)])]),_:1}),u(g(T),null,{default:_(()=>[c(`fieldset`,I,[p[13]||=c(`legend`,{class:`ih:mb-2 ih:text-[13px] ih:font-medium`},`Verleihstatus`,-1),c(`div`,L,[(f(),s(r,null,m([{value:!1,label:`Verfügbar`},{value:!0,label:`Verliehen`}],e=>c(`button`,{key:e.label,type:`button`,role:`radio`,"aria-checked":g(V).lent===e.value,class:d([`ih:rounded ih:py-1.5 ih:text-sm ih:font-medium`,g(V).lent===e.value?`ih:bg-card ih:shadow-xs`:`ih:text-muted-foreground`]),onClick:t=>g(V).lent=e.value},h(e.label),11,R)),64))]),u(g(S),{id:`vl-location`,label:g(V).lent?`Verliehen an / Ort`:`Aktueller Standort`,error:g(V).errors.location},{default:_(()=>[u(g(C),{id:`vl-location`,modelValue:g(V).location,"onUpdate:modelValue":p[8]||=e=>g(V).location=e,maxlength:`200`,placeholder:g(V).lent?`z. B. Verwaltung, Flur 1. OG`:`z. B. Lager Künstlerteam`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`,`error`])])]),_:1}),u(g(x),{type:`submit`,size:`lg`,disabled:g(V).processing||!g(V).title.trim()},{default:_(()=>[g(V).processing?(f(),a(g(t),{key:0,class:`ih:animate-spin`})):o(``,!0),p[14]||=l(` Speichern `,-1)]),_:1},8,[`disabled`])])],32)]),_:1},8,[`title`]))}};export{z as default};