Übersicht mit Status und Standort, Anfragen im Portal (Benachrichtigung + E-Mail ans Team), Zusagen/Absagen mit automatischem Eintrag, Zurücknehmen, Recht „Verleih verwalten“, einstellbare Bezeichnungen und Übernahme aus dem WordPress-Plugin „FL-Verleihsystem“ (WXR mit Bildern). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 line
No EOL
5.9 KiB
JavaScript
1 line
No EOL
5.9 KiB
JavaScript
import{t as e}from"../chunks/createLucideIcon-CYyWUN7r.js";import{n as t,t as n}from"../chunks/loader-circle-DBP4Qhm5.js";import{t as r}from"../chunks/trash-COMUOW6h.js";import{Fragment as i,computed as a,createBlock as o,createCommentVNode as s,createElementBlock as c,createElementVNode as l,createTextVNode as u,createVNode as d,normalizeClass as f,openBlock as p,ref as m,renderList as h,toDisplayString as g,unref as _,withCtx as v,withModifiers as y}from"vue";import{Link as b,useForm as x}from"@inertiajs/vue3";import{AppLayout as S,Button as C,FormField as w,Input as T,PageHeader as E,Panel as D,RichTextEditor as O}from"@inhaus/ui";var k=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`}]]}),A={class:`ih:grid ih:min-w-0 ih:content-start ih:gap-6`},j={class:`ih:grid ih:gap-5`},M={class:`ih:grid ih:content-start ih:gap-6`},N={class:`ih:grid ih:gap-3`},P=[`src`],F={key:0,class:`ih:flex ih:gap-2`},I={key:1,class:`ih:text-[13px] ih:text-destructive`},L={key:2,class:`ih:text-[13px] ih:text-muted-foreground`},R={class:`ih:grid ih:gap-4`},z={class:`ih:grid ih:grid-cols-2 ih:gap-1 ih:rounded-md ih:bg-muted ih:p-1`,role:`radiogroup`,"aria-label":`Verleihstatus`},B=[`aria-checked`,`onClick`],V={__name:`Editor`,props:{item:{type:Object,default:null},labels:{type:Object,required:!0}},setup(e){let V=e,H=V.item,U=x({title:H?.title??``,description:H?.description??``,lent:H?.lent??!1,location:H?.location??``,image:null,remove_image:!1}),W=m(H?.image_url??null),G=m(null),K=m(!1);function q(e){let t=[...e].find(e=>e.type.startsWith(`image/`));t&&(U.image=t,U.remove_image=!1,W.value=URL.createObjectURL(t))}function J(){U.image=null,U.remove_image=!0,W.value=null}let Y=a(()=>H?`${V.labels.singular} bearbeiten`:`${V.labels.singular} erfassen`);function X(){U.transform(e=>({...e,lent:+!!e.lent,remove_image:+!!e.remove_image})).post(H?`/verleih/${H.id}`:`/verleih`,{forceFormData:!0})}return(a,m)=>(p(),o(_(S),{title:Y.value},{default:v(()=>[d(_(b),{href:_(H)?_(H).url:`/verleih`,class:`ih:mb-4 ih:inline-flex ih:items-center ih:gap-1 ih:text-sm ih:font-medium ih:text-muted-foreground ih:hover:text-foreground`},{default:v(()=>[d(_(t),{class:`ih:size-4`}),u(` `+g(_(H)?_(H).title:e.labels.title),1)]),_:1},8,[`href`]),d(_(E),{title:Y.value},null,8,[`title`]),l(`form`,{class:`ih:grid ih:gap-6 ih:lg:grid-cols-[minmax(0,1fr)_20rem]`,onSubmit:y(X,[`prevent`])},[l(`div`,A,[d(_(D),null,{default:v(()=>[l(`div`,j,[d(_(w),{id:`vl-title`,label:`Titel`,error:_(U).errors.title},{default:v(()=>[d(_(T),{id:`vl-title`,modelValue:_(U).title,"onUpdate:modelValue":m[0]||=e=>_(U).title=e,maxlength:`200`,required:``,placeholder:`z. B. „Sommerwiese“, Acryl auf Leinwand`},null,8,[`modelValue`])]),_:1},8,[`error`]),d(_(w),{id:`vl-description`,label:`Beschreibung`,error:_(U).errors.description,hint:`Z. B. Künstlerin oder Künstler, Maße, Technik – alles, was bei der Auswahl hilft.`},{default:v(()=>[d(_(O),{id:`vl-description`,modelValue:_(U).description,"onUpdate:modelValue":m[1]||=e=>_(U).description=e,bordered:``,"min-height":`12rem`,headings:[2,3],placeholder:`Beschreibung …`},null,8,[`modelValue`])]),_:1},8,[`error`])])]),_:1})]),l(`aside`,M,[d(_(D),null,{default:v(()=>[l(`div`,N,[m[12]||=l(`p`,{class:`ih:text-[13px] ih:font-medium`},`Foto`,-1),l(`div`,{class:f([`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`,K.value?`ih:border-brand ih:bg-brand-soft`:``]),onDragover:m[3]||=y(e=>K.value=!0,[`prevent`]),onDragleave:m[4]||=e=>K.value=!1,onDrop:m[5]||=y(e=>{K.value=!1,q(e.dataTransfer.files)},[`prevent`])},[W.value?(p(),c(`img`,{key:0,src:W.value,alt:`Vorschau`,class:`ih:max-h-full ih:max-w-full ih:object-contain`},null,8,P)):(p(),c(`button`,{key:1,type:`button`,class:`ih:grid ih:justify-items-center ih:gap-1 ih:text-sm ih:text-muted-foreground`,onClick:m[2]||=e=>G.value.click()},[d(_(k),{class:`ih:size-8`,"stroke-width":1.5}),m[9]||=u(` Foto wählen oder hierher ziehen `,-1)]))],34),l(`input`,{ref_key:`fileInput`,ref:G,type:`file`,accept:`image/jpeg,image/png,image/webp`,class:`ih:hidden`,onChange:m[6]||=e=>q(e.target.files)},null,544),W.value?(p(),c(`div`,F,[d(_(C),{type:`button`,variant:`outline`,size:`sm`,onClick:m[7]||=e=>G.value.click()},{default:v(()=>[d(_(k)),m[10]||=u(` Anderes Foto`,-1)]),_:1}),d(_(C),{type:`button`,variant:`ghost`,size:`sm`,class:`ih:text-destructive`,onClick:J},{default:v(()=>[d(_(r)),m[11]||=u(` Entfernen`,-1)]),_:1})])):s(``,!0),_(U).errors.image?(p(),c(`p`,I,g(_(U).errors.image),1)):s(``,!0),_(U).progress?(p(),c(`p`,L,`Wird hochgeladen … `+g(_(U).progress.percentage)+` %`,1)):s(``,!0)])]),_:1}),d(_(D),null,{default:v(()=>[l(`fieldset`,R,[m[13]||=l(`legend`,{class:`ih:mb-2 ih:text-[13px] ih:font-medium`},`Verleihstatus`,-1),l(`div`,z,[(p(),c(i,null,h([{value:!1,label:`Verfügbar`},{value:!0,label:`Verliehen`}],e=>l(`button`,{key:e.label,type:`button`,role:`radio`,"aria-checked":_(U).lent===e.value,class:f([`ih:rounded ih:py-1.5 ih:text-sm ih:font-medium`,_(U).lent===e.value?`ih:bg-card ih:shadow-xs`:`ih:text-muted-foreground`]),onClick:t=>_(U).lent=e.value},g(e.label),11,B)),64))]),d(_(w),{id:`vl-location`,label:_(U).lent?`Verliehen an / Ort`:`Aktueller Standort`,error:_(U).errors.location},{default:v(()=>[d(_(T),{id:`vl-location`,modelValue:_(U).location,"onUpdate:modelValue":m[8]||=e=>_(U).location=e,maxlength:`200`,placeholder:_(U).lent?`z. B. Verwaltung, Flur 1. OG`:`z. B. Lager Künstlerteam`},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`,`error`])])]),_:1}),d(_(C),{type:`submit`,size:`lg`,disabled:_(U).processing||!_(U).title.trim()},{default:v(()=>[_(U).processing?(p(),o(_(n),{key:0,class:`ih:animate-spin`})):s(``,!0),m[14]||=u(` Speichern `,-1)]),_:1},8,[`disabled`])])],32)]),_:1},8,[`title`]))}};export{V as default}; |